blob: 0040d62b64c04d975a0f4871d30139528ddef061 [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"
Job Snijders3334bab2017-01-20 14:47:12 +000041#include "bgpd/bgp_lcommunity.h"
Paul Jakma4bf6a362006-03-30 14:05:23 +000042#include "bgpd/bgp_damp.h"
paul718e3742002-12-13 20:15:29 +000043#include "bgpd/bgp_debug.h"
hassoe0701b72004-05-20 09:19:34 +000044#include "bgpd/bgp_fsm.h"
paul718e3742002-12-13 20:15:29 +000045#include "bgpd/bgp_mplsvpn.h"
Paul Jakma4bf6a362006-03-30 14:05:23 +000046#include "bgpd/bgp_nexthop.h"
paul718e3742002-12-13 20:15:29 +000047#include "bgpd/bgp_open.h"
Paul Jakma4bf6a362006-03-30 14:05:23 +000048#include "bgpd/bgp_regex.h"
paul718e3742002-12-13 20:15:29 +000049#include "bgpd/bgp_route.h"
50#include "bgpd/bgp_zebra.h"
paulfee0f4c2004-09-13 05:12:46 +000051#include "bgpd/bgp_table.h"
paul94f2b392005-06-28 12:44:16 +000052#include "bgpd/bgp_vty.h"
Josh Bailey165b5ff2011-07-20 20:43:22 -070053#include "bgpd/bgp_mpath.h"
paul718e3742002-12-13 20:15:29 +000054
55/* Utility function to get address family from current node. */
56afi_t
57bgp_node_afi (struct vty *vty)
58{
Lou Berger135ca152016-01-12 13:42:05 -050059 afi_t afi;
Lou Berger13c378d2016-01-12 13:41:56 -050060 switch (vty->node)
61 {
62 case BGP_IPV6_NODE:
63 case BGP_IPV6M_NODE:
64 case BGP_VPNV6_NODE:
Lou Bergera3fda882016-01-12 13:42:04 -050065 case BGP_ENCAPV6_NODE:
Lou Berger135ca152016-01-12 13:42:05 -050066 afi = AFI_IP6;
67 break;
68 default:
69 afi = AFI_IP;
Lou Berger13c378d2016-01-12 13:41:56 -050070 break;
71 }
Lou Berger135ca152016-01-12 13:42:05 -050072 return afi;
paul718e3742002-12-13 20:15:29 +000073}
74
75/* Utility function to get subsequent address family from current
76 node. */
77safi_t
78bgp_node_safi (struct vty *vty)
79{
Lou Berger135ca152016-01-12 13:42:05 -050080 safi_t safi;
81 switch (vty->node)
82 {
83 case BGP_ENCAP_NODE:
84 case BGP_ENCAPV6_NODE:
85 safi = SAFI_ENCAP;
86 break;
87 case BGP_VPNV4_NODE:
88 case BGP_VPNV6_NODE:
89 safi = SAFI_MPLS_VPN;
90 break;
91 case BGP_IPV4M_NODE:
92 case BGP_IPV6M_NODE:
93 safi = SAFI_MULTICAST;
94 break;
95 default:
96 safi = SAFI_UNICAST;
97 break;
98 }
99 return safi;
paul718e3742002-12-13 20:15:29 +0000100}
101
Lou Bergera3fda882016-01-12 13:42:04 -0500102int
103bgp_parse_afi(const char *str, afi_t *afi)
104{
105 if (!strcmp(str, "ipv4")) {
106 *afi = AFI_IP;
107 return 0;
108 }
Lou Bergera3fda882016-01-12 13:42:04 -0500109 if (!strcmp(str, "ipv6")) {
110 *afi = AFI_IP6;
111 return 0;
112 }
Lou Bergera3fda882016-01-12 13:42:04 -0500113 return -1;
114}
115
116int
117bgp_parse_safi(const char *str, safi_t *safi)
118{
119 if (!strcmp(str, "encap")) {
120 *safi = SAFI_ENCAP;
121 return 0;
122 }
123 if (!strcmp(str, "multicast")) {
124 *safi = SAFI_MULTICAST;
125 return 0;
126 }
127 if (!strcmp(str, "unicast")) {
128 *safi = SAFI_UNICAST;
129 return 0;
130 }
131 if (!strcmp(str, "vpn")) {
132 *safi = SAFI_MPLS_VPN;
133 return 0;
134 }
135 return -1;
136}
137
paul94f2b392005-06-28 12:44:16 +0000138static int
paul718e3742002-12-13 20:15:29 +0000139peer_address_self_check (union sockunion *su)
140{
141 struct interface *ifp = NULL;
142
143 if (su->sa.sa_family == AF_INET)
144 ifp = if_lookup_by_ipv4_exact (&su->sin.sin_addr);
paul718e3742002-12-13 20:15:29 +0000145 else if (su->sa.sa_family == AF_INET6)
146 ifp = if_lookup_by_ipv6_exact (&su->sin6.sin6_addr);
paul718e3742002-12-13 20:15:29 +0000147
148 if (ifp)
149 return 1;
150
151 return 0;
152}
153
154/* Utility function for looking up peer from VTY. */
paul94f2b392005-06-28 12:44:16 +0000155static struct peer *
paulfd79ac92004-10-13 05:06:08 +0000156peer_lookup_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +0000157{
158 int ret;
159 struct bgp *bgp;
160 union sockunion su;
161 struct peer *peer;
162
163 bgp = vty->index;
164
165 ret = str2sockunion (ip_str, &su);
166 if (ret < 0)
167 {
168 vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE);
169 return NULL;
170 }
171
172 peer = peer_lookup (bgp, &su);
173 if (! peer)
174 {
175 vty_out (vty, "%% Specify remote-as or peer-group commands first%s", VTY_NEWLINE);
176 return NULL;
177 }
178 return peer;
179}
180
181/* Utility function for looking up peer or peer group. */
paul94f2b392005-06-28 12:44:16 +0000182static struct peer *
paulfd79ac92004-10-13 05:06:08 +0000183peer_and_group_lookup_vty (struct vty *vty, const char *peer_str)
paul718e3742002-12-13 20:15:29 +0000184{
185 int ret;
186 struct bgp *bgp;
187 union sockunion su;
188 struct peer *peer;
189 struct peer_group *group;
190
191 bgp = vty->index;
192
193 ret = str2sockunion (peer_str, &su);
194 if (ret == 0)
195 {
196 peer = peer_lookup (bgp, &su);
197 if (peer)
198 return peer;
199 }
200 else
201 {
202 group = peer_group_lookup (bgp, peer_str);
203 if (group)
204 return group->conf;
205 }
206
207 vty_out (vty, "%% Specify remote-as or peer-group commands first%s",
208 VTY_NEWLINE);
209
210 return NULL;
211}
212
paul94f2b392005-06-28 12:44:16 +0000213static int
paul718e3742002-12-13 20:15:29 +0000214bgp_vty_return (struct vty *vty, int ret)
215{
paulfd79ac92004-10-13 05:06:08 +0000216 const char *str = NULL;
paul718e3742002-12-13 20:15:29 +0000217
218 switch (ret)
219 {
220 case BGP_ERR_INVALID_VALUE:
221 str = "Invalid value";
222 break;
223 case BGP_ERR_INVALID_FLAG:
224 str = "Invalid flag";
225 break;
226 case BGP_ERR_PEER_INACTIVE:
227 str = "Activate the neighbor for the address family first";
228 break;
229 case BGP_ERR_INVALID_FOR_PEER_GROUP_MEMBER:
230 str = "Invalid command for a peer-group member";
231 break;
232 case BGP_ERR_PEER_GROUP_SHUTDOWN:
233 str = "Peer-group has been shutdown. Activate the peer-group first";
234 break;
235 case BGP_ERR_PEER_GROUP_HAS_THE_FLAG:
236 str = "This peer is a peer-group member. Please change peer-group configuration";
237 break;
238 case BGP_ERR_PEER_FLAG_CONFLICT:
239 str = "Can't set override-capability and strict-capability-match at the same time";
240 break;
241 case BGP_ERR_PEER_GROUP_MEMBER_EXISTS:
242 str = "No activate for peergroup can be given only if peer-group has no members";
243 break;
244 case BGP_ERR_PEER_BELONGS_TO_GROUP:
245 str = "No activate for an individual peer-group member is invalid";
246 break;
247 case BGP_ERR_PEER_GROUP_AF_UNCONFIGURED:
248 str = "Activate the peer-group for the address family first";
249 break;
250 case BGP_ERR_PEER_GROUP_NO_REMOTE_AS:
251 str = "Specify remote-as or peer-group remote AS first";
252 break;
253 case BGP_ERR_PEER_GROUP_CANT_CHANGE:
254 str = "Cannot change the peer-group. Deconfigure first";
255 break;
256 case BGP_ERR_PEER_GROUP_MISMATCH:
257 str = "Cannot have different peer-group for the neighbor";
258 break;
259 case BGP_ERR_PEER_FILTER_CONFLICT:
260 str = "Prefix/distribute list can not co-exist";
261 break;
262 case BGP_ERR_NOT_INTERNAL_PEER:
263 str = "Invalid command. Not an internal neighbor";
264 break;
265 case BGP_ERR_REMOVE_PRIVATE_AS:
266 str = "Private AS cannot be removed for IBGP peers";
267 break;
268 case BGP_ERR_LOCAL_AS_ALLOWED_ONLY_FOR_EBGP:
269 str = "Local-AS allowed only for EBGP peers";
270 break;
271 case BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS:
272 str = "Cannot have local-as same as BGP AS number";
273 break;
Paul Jakma0df7c912008-07-21 21:02:49 +0000274 case BGP_ERR_TCPSIG_FAILED:
275 str = "Error while applying TCP-Sig to session(s)";
276 break;
Nick Hilliardfa411a22011-03-23 15:33:17 +0000277 case BGP_ERR_NO_EBGP_MULTIHOP_WITH_TTLHACK:
278 str = "ebgp-multihop and ttl-security cannot be configured together";
279 break;
Stephen Hemmingerf5a48272011-03-24 17:30:21 +0000280 case BGP_ERR_NO_IBGP_WITH_TTLHACK:
281 str = "ttl-security only allowed for EBGP peers";
282 break;
paul718e3742002-12-13 20:15:29 +0000283 }
284 if (str)
285 {
286 vty_out (vty, "%% %s%s", str, VTY_NEWLINE);
287 return CMD_WARNING;
288 }
289 return CMD_SUCCESS;
290}
291
292/* BGP global configuration. */
293
294DEFUN (bgp_multiple_instance_func,
295 bgp_multiple_instance_cmd,
296 "bgp multiple-instance",
297 BGP_STR
298 "Enable bgp multiple instance\n")
299{
300 bgp_option_set (BGP_OPT_MULTIPLE_INSTANCE);
301 return CMD_SUCCESS;
302}
303
304DEFUN (no_bgp_multiple_instance,
305 no_bgp_multiple_instance_cmd,
306 "no bgp multiple-instance",
307 NO_STR
308 BGP_STR
309 "BGP multiple instance\n")
310{
311 int ret;
312
313 ret = bgp_option_unset (BGP_OPT_MULTIPLE_INSTANCE);
314 if (ret < 0)
315 {
316 vty_out (vty, "%% There are more than two BGP instances%s", VTY_NEWLINE);
317 return CMD_WARNING;
318 }
319 return CMD_SUCCESS;
320}
321
322DEFUN (bgp_config_type,
323 bgp_config_type_cmd,
324 "bgp config-type (cisco|zebra)",
325 BGP_STR
326 "Configuration type\n"
327 "cisco\n"
328 "zebra\n")
329{
330 if (strncmp (argv[0], "c", 1) == 0)
331 bgp_option_set (BGP_OPT_CONFIG_CISCO);
332 else
333 bgp_option_unset (BGP_OPT_CONFIG_CISCO);
334
335 return CMD_SUCCESS;
336}
337
338DEFUN (no_bgp_config_type,
339 no_bgp_config_type_cmd,
340 "no bgp config-type",
341 NO_STR
342 BGP_STR
343 "Display configuration type\n")
344{
345 bgp_option_unset (BGP_OPT_CONFIG_CISCO);
346 return CMD_SUCCESS;
347}
348
349DEFUN (no_synchronization,
350 no_synchronization_cmd,
351 "no synchronization",
352 NO_STR
353 "Perform IGP synchronization\n")
354{
355 return CMD_SUCCESS;
356}
357
358DEFUN (no_auto_summary,
359 no_auto_summary_cmd,
360 "no auto-summary",
361 NO_STR
362 "Enable automatic network number summarization\n")
363{
364 return CMD_SUCCESS;
365}
hasso3d515fd2005-02-01 21:30:04 +0000366
367DEFUN_DEPRECATED (neighbor_version,
368 neighbor_version_cmd,
369 NEIGHBOR_CMD "version (4|4-)",
370 NEIGHBOR_STR
371 NEIGHBOR_ADDR_STR
372 "Set the BGP version to match a neighbor\n"
373 "Neighbor's BGP version\n")
374{
375 return CMD_SUCCESS;
376}
David Lamparter6b0655a2014-06-04 06:53:35 +0200377
paul718e3742002-12-13 20:15:29 +0000378/* "router bgp" commands. */
379DEFUN (router_bgp,
380 router_bgp_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000381 "router bgp " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000382 ROUTER_STR
383 BGP_STR
384 AS_STR)
385{
386 int ret;
387 as_t as;
388 struct bgp *bgp;
paulfd79ac92004-10-13 05:06:08 +0000389 const char *name = NULL;
paul718e3742002-12-13 20:15:29 +0000390
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000391 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +0000392
393 if (argc == 2)
394 name = argv[1];
395
396 ret = bgp_get (&bgp, &as, name);
397 switch (ret)
398 {
399 case BGP_ERR_MULTIPLE_INSTANCE_NOT_SET:
400 vty_out (vty, "Please specify 'bgp multiple-instance' first%s",
401 VTY_NEWLINE);
402 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +0000403 case BGP_ERR_AS_MISMATCH:
Denis Ovsienkoaea339f2009-04-30 17:16:22 +0400404 vty_out (vty, "BGP is already running; AS is %u%s", as, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +0000405 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +0000406 case BGP_ERR_INSTANCE_MISMATCH:
407 vty_out (vty, "BGP view name and AS number mismatch%s", VTY_NEWLINE);
Denis Ovsienkoaea339f2009-04-30 17:16:22 +0400408 vty_out (vty, "BGP instance is already running; AS is %u%s",
paul718e3742002-12-13 20:15:29 +0000409 as, VTY_NEWLINE);
410 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +0000411 }
412
413 vty->node = BGP_NODE;
414 vty->index = bgp;
415
416 return CMD_SUCCESS;
417}
418
419ALIAS (router_bgp,
420 router_bgp_view_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000421 "router bgp " CMD_AS_RANGE " view WORD",
paul718e3742002-12-13 20:15:29 +0000422 ROUTER_STR
423 BGP_STR
424 AS_STR
425 "BGP view\n"
426 "view name\n")
David Lamparter6b0655a2014-06-04 06:53:35 +0200427
paul718e3742002-12-13 20:15:29 +0000428/* "no router bgp" commands. */
429DEFUN (no_router_bgp,
430 no_router_bgp_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000431 "no router bgp " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000432 NO_STR
433 ROUTER_STR
434 BGP_STR
435 AS_STR)
436{
437 as_t as;
438 struct bgp *bgp;
paulfd79ac92004-10-13 05:06:08 +0000439 const char *name = NULL;
paul718e3742002-12-13 20:15:29 +0000440
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000441 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +0000442
443 if (argc == 2)
444 name = argv[1];
445
446 /* Lookup bgp structure. */
447 bgp = bgp_lookup (as, name);
448 if (! bgp)
449 {
450 vty_out (vty, "%% Can't find BGP instance%s", VTY_NEWLINE);
451 return CMD_WARNING;
452 }
453
454 bgp_delete (bgp);
455
456 return CMD_SUCCESS;
457}
458
459ALIAS (no_router_bgp,
460 no_router_bgp_view_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000461 "no router bgp " CMD_AS_RANGE " view WORD",
paul718e3742002-12-13 20:15:29 +0000462 NO_STR
463 ROUTER_STR
464 BGP_STR
465 AS_STR
466 "BGP view\n"
467 "view name\n")
David Lamparter6b0655a2014-06-04 06:53:35 +0200468
paul718e3742002-12-13 20:15:29 +0000469/* BGP router-id. */
470
471DEFUN (bgp_router_id,
472 bgp_router_id_cmd,
473 "bgp router-id A.B.C.D",
474 BGP_STR
475 "Override configured router identifier\n"
476 "Manually configured router identifier\n")
477{
478 int ret;
479 struct in_addr id;
480 struct bgp *bgp;
481
482 bgp = vty->index;
483
484 ret = inet_aton (argv[0], &id);
485 if (! ret)
486 {
487 vty_out (vty, "%% Malformed bgp router identifier%s", VTY_NEWLINE);
488 return CMD_WARNING;
489 }
490
David Lamparter584083d2016-05-24 18:58:08 +0200491 bgp_router_id_static_set (bgp, id);
paul718e3742002-12-13 20:15:29 +0000492
493 return CMD_SUCCESS;
494}
495
496DEFUN (no_bgp_router_id,
497 no_bgp_router_id_cmd,
498 "no bgp router-id",
499 NO_STR
500 BGP_STR
501 "Override configured router identifier\n")
502{
503 int ret;
504 struct in_addr id;
505 struct bgp *bgp;
506
507 bgp = vty->index;
508
509 if (argc == 1)
510 {
511 ret = inet_aton (argv[0], &id);
512 if (! ret)
513 {
514 vty_out (vty, "%% Malformed BGP router identifier%s", VTY_NEWLINE);
515 return CMD_WARNING;
516 }
517
hasso18a6dce2004-10-03 18:18:34 +0000518 if (! IPV4_ADDR_SAME (&bgp->router_id_static, &id))
paul718e3742002-12-13 20:15:29 +0000519 {
520 vty_out (vty, "%% BGP router-id doesn't match%s", VTY_NEWLINE);
521 return CMD_WARNING;
522 }
523 }
524
David Lamparter584083d2016-05-24 18:58:08 +0200525 id.s_addr = 0;
526 bgp_router_id_static_set (bgp, id);
paul718e3742002-12-13 20:15:29 +0000527
528 return CMD_SUCCESS;
529}
530
531ALIAS (no_bgp_router_id,
532 no_bgp_router_id_val_cmd,
533 "no bgp router-id A.B.C.D",
534 NO_STR
535 BGP_STR
536 "Override configured router identifier\n"
537 "Manually configured router identifier\n")
David Lamparter6b0655a2014-06-04 06:53:35 +0200538
paul718e3742002-12-13 20:15:29 +0000539/* BGP Cluster ID. */
540
541DEFUN (bgp_cluster_id,
542 bgp_cluster_id_cmd,
543 "bgp cluster-id A.B.C.D",
544 BGP_STR
545 "Configure Route-Reflector Cluster-id\n"
546 "Route-Reflector Cluster-id in IP address format\n")
547{
548 int ret;
549 struct bgp *bgp;
550 struct in_addr cluster;
551
552 bgp = vty->index;
553
554 ret = inet_aton (argv[0], &cluster);
555 if (! ret)
556 {
557 vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE);
558 return CMD_WARNING;
559 }
560
561 bgp_cluster_id_set (bgp, &cluster);
562
563 return CMD_SUCCESS;
564}
565
566ALIAS (bgp_cluster_id,
567 bgp_cluster_id32_cmd,
568 "bgp cluster-id <1-4294967295>",
569 BGP_STR
570 "Configure Route-Reflector Cluster-id\n"
571 "Route-Reflector Cluster-id as 32 bit quantity\n")
572
573DEFUN (no_bgp_cluster_id,
574 no_bgp_cluster_id_cmd,
575 "no bgp cluster-id",
576 NO_STR
577 BGP_STR
578 "Configure Route-Reflector Cluster-id\n")
579{
580 int ret;
581 struct bgp *bgp;
582 struct in_addr cluster;
583
584 bgp = vty->index;
585
586 if (argc == 1)
587 {
588 ret = inet_aton (argv[0], &cluster);
589 if (! ret)
590 {
591 vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE);
592 return CMD_WARNING;
593 }
594 }
595
596 bgp_cluster_id_unset (bgp);
597
598 return CMD_SUCCESS;
599}
600
601ALIAS (no_bgp_cluster_id,
602 no_bgp_cluster_id_arg_cmd,
603 "no bgp cluster-id A.B.C.D",
604 NO_STR
605 BGP_STR
606 "Configure Route-Reflector Cluster-id\n"
607 "Route-Reflector Cluster-id in IP address format\n")
David Lamparter6b0655a2014-06-04 06:53:35 +0200608
paul718e3742002-12-13 20:15:29 +0000609DEFUN (bgp_confederation_identifier,
610 bgp_confederation_identifier_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000611 "bgp confederation identifier " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000612 "BGP specific commands\n"
613 "AS confederation parameters\n"
614 "AS number\n"
615 "Set routing domain confederation AS\n")
616{
617 struct bgp *bgp;
618 as_t as;
619
620 bgp = vty->index;
621
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000622 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +0000623
624 bgp_confederation_id_set (bgp, as);
625
626 return CMD_SUCCESS;
627}
628
629DEFUN (no_bgp_confederation_identifier,
630 no_bgp_confederation_identifier_cmd,
631 "no bgp confederation identifier",
632 NO_STR
633 "BGP specific commands\n"
634 "AS confederation parameters\n"
635 "AS number\n")
636{
637 struct bgp *bgp;
Paul Jakma7aa9dce2014-09-19 14:42:23 +0100638 as_t as __attribute__((unused)); /* Dummy for VTY_GET_INTEGER_RANGE */
paul718e3742002-12-13 20:15:29 +0000639
640 bgp = vty->index;
641
642 if (argc == 1)
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000643 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +0000644
645 bgp_confederation_id_unset (bgp);
646
647 return CMD_SUCCESS;
648}
649
650ALIAS (no_bgp_confederation_identifier,
651 no_bgp_confederation_identifier_arg_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000652 "no bgp confederation identifier " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000653 NO_STR
654 "BGP specific commands\n"
655 "AS confederation parameters\n"
656 "AS number\n"
657 "Set routing domain confederation AS\n")
David Lamparter6b0655a2014-06-04 06:53:35 +0200658
paul718e3742002-12-13 20:15:29 +0000659DEFUN (bgp_confederation_peers,
660 bgp_confederation_peers_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000661 "bgp confederation peers ." CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000662 "BGP specific commands\n"
663 "AS confederation parameters\n"
664 "Peer ASs in BGP confederation\n"
665 AS_STR)
666{
667 struct bgp *bgp;
668 as_t as;
669 int i;
670
671 bgp = vty->index;
672
673 for (i = 0; i < argc; i++)
674 {
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000675 VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +0000676
677 if (bgp->as == as)
678 {
679 vty_out (vty, "%% Local member-AS not allowed in confed peer list%s",
680 VTY_NEWLINE);
681 continue;
682 }
683
684 bgp_confederation_peers_add (bgp, as);
685 }
686 return CMD_SUCCESS;
687}
688
689DEFUN (no_bgp_confederation_peers,
690 no_bgp_confederation_peers_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000691 "no bgp confederation peers ." CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000692 NO_STR
693 "BGP specific commands\n"
694 "AS confederation parameters\n"
695 "Peer ASs in BGP confederation\n"
696 AS_STR)
697{
698 struct bgp *bgp;
699 as_t as;
700 int i;
701
702 bgp = vty->index;
703
704 for (i = 0; i < argc; i++)
705 {
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000706 VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX);
707
paul718e3742002-12-13 20:15:29 +0000708 bgp_confederation_peers_remove (bgp, as);
709 }
710 return CMD_SUCCESS;
711}
David Lamparter6b0655a2014-06-04 06:53:35 +0200712
Josh Bailey165b5ff2011-07-20 20:43:22 -0700713/* Maximum-paths configuration */
714DEFUN (bgp_maxpaths,
715 bgp_maxpaths_cmd,
Donald Sharpecc1a132015-12-09 08:24:47 -0500716 "maximum-paths " CMD_RANGE_STR(1, MULTIPATH_NUM),
Josh Bailey165b5ff2011-07-20 20:43:22 -0700717 "Forward packets over multiple paths\n"
718 "Number of paths\n")
719{
720 struct bgp *bgp;
721 u_int16_t maxpaths;
722 int ret;
723
724 bgp = vty->index;
725
726 VTY_GET_INTEGER_RANGE ("maximum-paths", maxpaths, argv[0], 1, 255);
727
728 ret = bgp_maximum_paths_set (bgp, bgp_node_afi (vty), bgp_node_safi(vty),
729 BGP_PEER_EBGP, maxpaths);
730 if (ret < 0)
731 {
732 vty_out (vty,
733 "%% Failed to set maximum-paths %u for afi %u, safi %u%s",
734 maxpaths, bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE);
735 return CMD_WARNING;
736 }
737
738 return CMD_SUCCESS;
739}
740
741DEFUN (bgp_maxpaths_ibgp,
742 bgp_maxpaths_ibgp_cmd,
Donald Sharpecc1a132015-12-09 08:24:47 -0500743 "maximum-paths ibgp " CMD_RANGE_STR(1, MULTIPATH_NUM),
Josh Bailey165b5ff2011-07-20 20:43:22 -0700744 "Forward packets over multiple paths\n"
745 "iBGP-multipath\n"
746 "Number of paths\n")
747{
748 struct bgp *bgp;
749 u_int16_t maxpaths;
750 int ret;
751
752 bgp = vty->index;
753
754 VTY_GET_INTEGER_RANGE ("maximum-paths", maxpaths, argv[0], 1, 255);
755
756 ret = bgp_maximum_paths_set (bgp, bgp_node_afi (vty), bgp_node_safi(vty),
757 BGP_PEER_IBGP, maxpaths);
758 if (ret < 0)
759 {
760 vty_out (vty,
761 "%% Failed to set maximum-paths ibgp %u for afi %u, safi %u%s",
762 maxpaths, bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE);
763 return CMD_WARNING;
764 }
765
766 return CMD_SUCCESS;
767}
768
769DEFUN (no_bgp_maxpaths,
770 no_bgp_maxpaths_cmd,
771 "no maximum-paths",
772 NO_STR
773 "Forward packets over multiple paths\n"
774 "Number of paths\n")
775{
776 struct bgp *bgp;
777 int ret;
778
779 bgp = vty->index;
780
781 ret = bgp_maximum_paths_unset (bgp, bgp_node_afi (vty), bgp_node_safi(vty),
782 BGP_PEER_EBGP);
783 if (ret < 0)
784 {
785 vty_out (vty,
786 "%% Failed to unset maximum-paths for afi %u, safi %u%s",
787 bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE);
788 return CMD_WARNING;
789 }
790
791 return CMD_SUCCESS;
792}
793
794ALIAS (no_bgp_maxpaths,
795 no_bgp_maxpaths_arg_cmd,
Donald Sharpecc1a132015-12-09 08:24:47 -0500796 "no maximum-paths " CMD_RANGE_STR(1, MULTIPATH_NUM),
Josh Bailey165b5ff2011-07-20 20:43:22 -0700797 NO_STR
798 "Forward packets over multiple paths\n"
799 "Number of paths\n")
800
801DEFUN (no_bgp_maxpaths_ibgp,
802 no_bgp_maxpaths_ibgp_cmd,
803 "no maximum-paths ibgp",
804 NO_STR
805 "Forward packets over multiple paths\n"
806 "iBGP-multipath\n"
807 "Number of paths\n")
808{
809 struct bgp *bgp;
810 int ret;
811
812 bgp = vty->index;
813
814 ret = bgp_maximum_paths_unset (bgp, bgp_node_afi (vty), bgp_node_safi(vty),
815 BGP_PEER_IBGP);
816 if (ret < 0)
817 {
818 vty_out (vty,
819 "%% Failed to unset maximum-paths ibgp for afi %u, safi %u%s",
820 bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE);
821 return CMD_WARNING;
822 }
823
824 return CMD_SUCCESS;
825}
826
827ALIAS (no_bgp_maxpaths_ibgp,
828 no_bgp_maxpaths_ibgp_arg_cmd,
Donald Sharpecc1a132015-12-09 08:24:47 -0500829 "no maximum-paths ibgp " CMD_RANGE_STR(1, MULTIPATH_NUM),
Josh Bailey165b5ff2011-07-20 20:43:22 -0700830 NO_STR
831 "Forward packets over multiple paths\n"
832 "iBGP-multipath\n"
833 "Number of paths\n")
834
835int
836bgp_config_write_maxpaths (struct vty *vty, struct bgp *bgp, afi_t afi,
837 safi_t safi, int *write)
838{
839 if (bgp->maxpaths[afi][safi].maxpaths_ebgp != BGP_DEFAULT_MAXPATHS)
840 {
841 bgp_config_write_family_header (vty, afi, safi, write);
842 vty_out (vty, " maximum-paths %d%s",
843 bgp->maxpaths[afi][safi].maxpaths_ebgp, VTY_NEWLINE);
844 }
845
846 if (bgp->maxpaths[afi][safi].maxpaths_ibgp != BGP_DEFAULT_MAXPATHS)
847 {
848 bgp_config_write_family_header (vty, afi, safi, write);
849 vty_out (vty, " maximum-paths ibgp %d%s",
850 bgp->maxpaths[afi][safi].maxpaths_ibgp, VTY_NEWLINE);
851 }
852
853 return 0;
854}
David Lamparter6b0655a2014-06-04 06:53:35 +0200855
paul718e3742002-12-13 20:15:29 +0000856/* BGP timers. */
857
858DEFUN (bgp_timers,
859 bgp_timers_cmd,
860 "timers bgp <0-65535> <0-65535>",
861 "Adjust routing timers\n"
862 "BGP timers\n"
863 "Keepalive interval\n"
864 "Holdtime\n")
865{
866 struct bgp *bgp;
867 unsigned long keepalive = 0;
868 unsigned long holdtime = 0;
869
870 bgp = vty->index;
871
872 VTY_GET_INTEGER ("keepalive", keepalive, argv[0]);
873 VTY_GET_INTEGER ("holdtime", holdtime, argv[1]);
874
875 /* Holdtime value check. */
876 if (holdtime < 3 && holdtime != 0)
877 {
878 vty_out (vty, "%% hold time value must be either 0 or greater than 3%s",
879 VTY_NEWLINE);
880 return CMD_WARNING;
881 }
882
883 bgp_timers_set (bgp, keepalive, holdtime);
884
885 return CMD_SUCCESS;
886}
887
888DEFUN (no_bgp_timers,
889 no_bgp_timers_cmd,
890 "no timers bgp",
891 NO_STR
892 "Adjust routing timers\n"
893 "BGP timers\n")
894{
895 struct bgp *bgp;
896
897 bgp = vty->index;
898 bgp_timers_unset (bgp);
899
900 return CMD_SUCCESS;
901}
902
903ALIAS (no_bgp_timers,
904 no_bgp_timers_arg_cmd,
905 "no timers bgp <0-65535> <0-65535>",
906 NO_STR
907 "Adjust routing timers\n"
908 "BGP timers\n"
909 "Keepalive interval\n"
910 "Holdtime\n")
David Lamparter6b0655a2014-06-04 06:53:35 +0200911
paul718e3742002-12-13 20:15:29 +0000912DEFUN (bgp_client_to_client_reflection,
913 bgp_client_to_client_reflection_cmd,
914 "bgp client-to-client reflection",
915 "BGP specific commands\n"
916 "Configure client to client route reflection\n"
917 "reflection of routes allowed\n")
918{
919 struct bgp *bgp;
920
921 bgp = vty->index;
922 bgp_flag_unset (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT);
923 return CMD_SUCCESS;
924}
925
926DEFUN (no_bgp_client_to_client_reflection,
927 no_bgp_client_to_client_reflection_cmd,
928 "no bgp client-to-client reflection",
929 NO_STR
930 "BGP specific commands\n"
931 "Configure client to client route reflection\n"
932 "reflection of routes allowed\n")
933{
934 struct bgp *bgp;
935
936 bgp = vty->index;
937 bgp_flag_set (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT);
938 return CMD_SUCCESS;
939}
940
941/* "bgp always-compare-med" configuration. */
942DEFUN (bgp_always_compare_med,
943 bgp_always_compare_med_cmd,
944 "bgp always-compare-med",
945 "BGP specific commands\n"
946 "Allow comparing MED from different neighbors\n")
947{
948 struct bgp *bgp;
949
950 bgp = vty->index;
951 bgp_flag_set (bgp, BGP_FLAG_ALWAYS_COMPARE_MED);
952 return CMD_SUCCESS;
953}
954
955DEFUN (no_bgp_always_compare_med,
956 no_bgp_always_compare_med_cmd,
957 "no bgp always-compare-med",
958 NO_STR
959 "BGP specific commands\n"
960 "Allow comparing MED from different neighbors\n")
961{
962 struct bgp *bgp;
963
964 bgp = vty->index;
965 bgp_flag_unset (bgp, BGP_FLAG_ALWAYS_COMPARE_MED);
966 return CMD_SUCCESS;
967}
David Lamparter6b0655a2014-06-04 06:53:35 +0200968
paul718e3742002-12-13 20:15:29 +0000969/* "bgp deterministic-med" configuration. */
970DEFUN (bgp_deterministic_med,
971 bgp_deterministic_med_cmd,
972 "bgp deterministic-med",
973 "BGP specific commands\n"
974 "Pick the best-MED path among paths advertised from the neighboring AS\n")
975{
976 struct bgp *bgp;
977
978 bgp = vty->index;
979 bgp_flag_set (bgp, BGP_FLAG_DETERMINISTIC_MED);
980 return CMD_SUCCESS;
981}
982
983DEFUN (no_bgp_deterministic_med,
984 no_bgp_deterministic_med_cmd,
985 "no bgp deterministic-med",
986 NO_STR
987 "BGP specific commands\n"
988 "Pick the best-MED path among paths advertised from the neighboring AS\n")
989{
990 struct bgp *bgp;
991
992 bgp = vty->index;
993 bgp_flag_unset (bgp, BGP_FLAG_DETERMINISTIC_MED);
994 return CMD_SUCCESS;
995}
hasso538621f2004-05-21 09:31:30 +0000996
997/* "bgp graceful-restart" configuration. */
998DEFUN (bgp_graceful_restart,
999 bgp_graceful_restart_cmd,
1000 "bgp graceful-restart",
1001 "BGP specific commands\n"
1002 "Graceful restart capability parameters\n")
1003{
1004 struct bgp *bgp;
1005
1006 bgp = vty->index;
1007 bgp_flag_set (bgp, BGP_FLAG_GRACEFUL_RESTART);
1008 return CMD_SUCCESS;
1009}
1010
1011DEFUN (no_bgp_graceful_restart,
1012 no_bgp_graceful_restart_cmd,
1013 "no bgp graceful-restart",
1014 NO_STR
1015 "BGP specific commands\n"
1016 "Graceful restart capability parameters\n")
1017{
1018 struct bgp *bgp;
1019
1020 bgp = vty->index;
1021 bgp_flag_unset (bgp, BGP_FLAG_GRACEFUL_RESTART);
1022 return CMD_SUCCESS;
1023}
1024
hasso93406d82005-02-02 14:40:33 +00001025DEFUN (bgp_graceful_restart_stalepath_time,
1026 bgp_graceful_restart_stalepath_time_cmd,
1027 "bgp graceful-restart stalepath-time <1-3600>",
1028 "BGP specific commands\n"
1029 "Graceful restart capability parameters\n"
1030 "Set the max time to hold onto restarting peer's stale paths\n"
1031 "Delay value (seconds)\n")
1032{
1033 struct bgp *bgp;
1034 u_int32_t stalepath;
1035
1036 bgp = vty->index;
1037 if (! bgp)
1038 return CMD_WARNING;
1039
1040 VTY_GET_INTEGER_RANGE ("stalepath-time", stalepath, argv[0], 1, 3600);
1041 bgp->stalepath_time = stalepath;
1042 return CMD_SUCCESS;
1043}
1044
Philippe Guibert4afa3dd2016-05-24 16:52:02 +02001045DEFUN (bgp_graceful_restart_restart_time,
1046 bgp_graceful_restart_restart_time_cmd,
1047 "bgp graceful-restart restart-time <1-3600>",
1048 "BGP specific commands\n"
1049 "Graceful restart capability parameters\n"
1050 "Set the time to wait to delete stale routes before a BGP open message is received\n"
1051 "Delay value (seconds)\n")
1052{
1053 struct bgp *bgp;
1054 u_int32_t restart;
1055
1056 bgp = vty->index;
1057 if (! bgp)
1058 return CMD_WARNING;
1059
1060 VTY_GET_INTEGER_RANGE ("restart-time", restart, argv[0], 1, 3600);
1061 bgp->restart_time = restart;
1062 return CMD_SUCCESS;
1063}
1064
hasso93406d82005-02-02 14:40:33 +00001065DEFUN (no_bgp_graceful_restart_stalepath_time,
1066 no_bgp_graceful_restart_stalepath_time_cmd,
1067 "no bgp graceful-restart stalepath-time",
1068 NO_STR
1069 "BGP specific commands\n"
1070 "Graceful restart capability parameters\n"
1071 "Set the max time to hold onto restarting peer's stale paths\n")
1072{
1073 struct bgp *bgp;
1074
1075 bgp = vty->index;
1076 if (! bgp)
1077 return CMD_WARNING;
1078
1079 bgp->stalepath_time = BGP_DEFAULT_STALEPATH_TIME;
1080 return CMD_SUCCESS;
1081}
1082
Philippe Guibert4afa3dd2016-05-24 16:52:02 +02001083DEFUN (no_bgp_graceful_restart_restart_time,
1084 no_bgp_graceful_restart_restart_time_cmd,
1085 "no bgp graceful-restart restart-time",
1086 NO_STR
1087 "BGP specific commands\n"
1088 "Graceful restart capability parameters\n"
1089 "Set the time to wait to delete stale routes before a BGP open message is received\n")
1090{
1091 struct bgp *bgp;
1092
1093 bgp = vty->index;
1094 if (! bgp)
1095 return CMD_WARNING;
1096
1097 bgp->restart_time = BGP_DEFAULT_RESTART_TIME;
1098 return CMD_SUCCESS;
1099}
1100
hasso93406d82005-02-02 14:40:33 +00001101ALIAS (no_bgp_graceful_restart_stalepath_time,
1102 no_bgp_graceful_restart_stalepath_time_val_cmd,
1103 "no bgp graceful-restart stalepath-time <1-3600>",
1104 NO_STR
1105 "BGP specific commands\n"
1106 "Graceful restart capability parameters\n"
1107 "Set the max time to hold onto restarting peer's stale paths\n"
1108 "Delay value (seconds)\n")
1109
Philippe Guibert4afa3dd2016-05-24 16:52:02 +02001110ALIAS (no_bgp_graceful_restart_restart_time,
1111 no_bgp_graceful_restart_restart_time_val_cmd,
1112 "no bgp graceful-restart restart-time <1-3600>",
1113 NO_STR
1114 "BGP specific commands\n"
1115 "Graceful restart capability parameters\n"
1116 "Set the time to wait to delete stale routes before a BGP open message is received\n"
1117 "Delay value (seconds)\n")
1118
paul718e3742002-12-13 20:15:29 +00001119/* "bgp fast-external-failover" configuration. */
1120DEFUN (bgp_fast_external_failover,
1121 bgp_fast_external_failover_cmd,
1122 "bgp fast-external-failover",
1123 BGP_STR
1124 "Immediately reset session if a link to a directly connected external peer goes down\n")
1125{
1126 struct bgp *bgp;
1127
1128 bgp = vty->index;
1129 bgp_flag_unset (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER);
1130 return CMD_SUCCESS;
1131}
1132
1133DEFUN (no_bgp_fast_external_failover,
1134 no_bgp_fast_external_failover_cmd,
1135 "no bgp fast-external-failover",
1136 NO_STR
1137 BGP_STR
1138 "Immediately reset session if a link to a directly connected external peer goes down\n")
1139{
1140 struct bgp *bgp;
1141
1142 bgp = vty->index;
1143 bgp_flag_set (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER);
1144 return CMD_SUCCESS;
1145}
David Lamparter6b0655a2014-06-04 06:53:35 +02001146
paul718e3742002-12-13 20:15:29 +00001147/* "bgp enforce-first-as" configuration. */
1148DEFUN (bgp_enforce_first_as,
1149 bgp_enforce_first_as_cmd,
1150 "bgp enforce-first-as",
1151 BGP_STR
1152 "Enforce the first AS for EBGP routes\n")
1153{
1154 struct bgp *bgp;
1155
1156 bgp = vty->index;
1157 bgp_flag_set (bgp, BGP_FLAG_ENFORCE_FIRST_AS);
1158 return CMD_SUCCESS;
1159}
1160
1161DEFUN (no_bgp_enforce_first_as,
1162 no_bgp_enforce_first_as_cmd,
1163 "no bgp enforce-first-as",
1164 NO_STR
1165 BGP_STR
1166 "Enforce the first AS for EBGP routes\n")
1167{
1168 struct bgp *bgp;
1169
1170 bgp = vty->index;
1171 bgp_flag_unset (bgp, BGP_FLAG_ENFORCE_FIRST_AS);
1172 return CMD_SUCCESS;
1173}
David Lamparter6b0655a2014-06-04 06:53:35 +02001174
paul718e3742002-12-13 20:15:29 +00001175/* "bgp bestpath compare-routerid" configuration. */
1176DEFUN (bgp_bestpath_compare_router_id,
1177 bgp_bestpath_compare_router_id_cmd,
1178 "bgp bestpath compare-routerid",
1179 "BGP specific commands\n"
1180 "Change the default bestpath selection\n"
1181 "Compare router-id for identical EBGP paths\n")
1182{
1183 struct bgp *bgp;
1184
1185 bgp = vty->index;
1186 bgp_flag_set (bgp, BGP_FLAG_COMPARE_ROUTER_ID);
1187 return CMD_SUCCESS;
1188}
1189
1190DEFUN (no_bgp_bestpath_compare_router_id,
1191 no_bgp_bestpath_compare_router_id_cmd,
1192 "no bgp bestpath compare-routerid",
1193 NO_STR
1194 "BGP specific commands\n"
1195 "Change the default bestpath selection\n"
1196 "Compare router-id for identical EBGP paths\n")
1197{
1198 struct bgp *bgp;
1199
1200 bgp = vty->index;
1201 bgp_flag_unset (bgp, BGP_FLAG_COMPARE_ROUTER_ID);
1202 return CMD_SUCCESS;
1203}
David Lamparter6b0655a2014-06-04 06:53:35 +02001204
paul718e3742002-12-13 20:15:29 +00001205/* "bgp bestpath as-path ignore" configuration. */
1206DEFUN (bgp_bestpath_aspath_ignore,
1207 bgp_bestpath_aspath_ignore_cmd,
1208 "bgp bestpath as-path ignore",
1209 "BGP specific commands\n"
1210 "Change the default bestpath selection\n"
1211 "AS-path attribute\n"
1212 "Ignore as-path length in selecting a route\n")
1213{
1214 struct bgp *bgp;
1215
1216 bgp = vty->index;
1217 bgp_flag_set (bgp, BGP_FLAG_ASPATH_IGNORE);
1218 return CMD_SUCCESS;
1219}
1220
1221DEFUN (no_bgp_bestpath_aspath_ignore,
1222 no_bgp_bestpath_aspath_ignore_cmd,
1223 "no bgp bestpath as-path ignore",
1224 NO_STR
1225 "BGP specific commands\n"
1226 "Change the default bestpath selection\n"
1227 "AS-path attribute\n"
1228 "Ignore as-path length in selecting a route\n")
1229{
1230 struct bgp *bgp;
1231
1232 bgp = vty->index;
1233 bgp_flag_unset (bgp, BGP_FLAG_ASPATH_IGNORE);
1234 return CMD_SUCCESS;
1235}
David Lamparter6b0655a2014-06-04 06:53:35 +02001236
hasso68118452005-04-08 15:40:36 +00001237/* "bgp bestpath as-path confed" configuration. */
1238DEFUN (bgp_bestpath_aspath_confed,
1239 bgp_bestpath_aspath_confed_cmd,
1240 "bgp bestpath as-path confed",
1241 "BGP specific commands\n"
1242 "Change the default bestpath selection\n"
1243 "AS-path attribute\n"
1244 "Compare path lengths including confederation sets & sequences in selecting a route\n")
1245{
1246 struct bgp *bgp;
1247
1248 bgp = vty->index;
1249 bgp_flag_set (bgp, BGP_FLAG_ASPATH_CONFED);
1250 return CMD_SUCCESS;
1251}
1252
1253DEFUN (no_bgp_bestpath_aspath_confed,
1254 no_bgp_bestpath_aspath_confed_cmd,
1255 "no bgp bestpath as-path confed",
1256 NO_STR
1257 "BGP specific commands\n"
1258 "Change the default bestpath selection\n"
1259 "AS-path attribute\n"
1260 "Compare path lengths including confederation sets & sequences in selecting a route\n")
1261{
1262 struct bgp *bgp;
1263
1264 bgp = vty->index;
1265 bgp_flag_unset (bgp, BGP_FLAG_ASPATH_CONFED);
1266 return CMD_SUCCESS;
1267}
David Lamparter6b0655a2014-06-04 06:53:35 +02001268
Pradosh Mohapatra2fdd4552013-09-07 07:02:36 +00001269/* "bgp bestpath as-path multipath-relax" configuration. */
1270DEFUN (bgp_bestpath_aspath_multipath_relax,
1271 bgp_bestpath_aspath_multipath_relax_cmd,
1272 "bgp bestpath as-path multipath-relax",
1273 "BGP specific commands\n"
1274 "Change the default bestpath selection\n"
1275 "AS-path attribute\n"
1276 "Allow load sharing across routes that have different AS paths (but same length)\n")
1277{
1278 struct bgp *bgp;
1279
1280 bgp = vty->index;
1281 bgp_flag_set (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX);
1282 return CMD_SUCCESS;
1283}
1284
1285DEFUN (no_bgp_bestpath_aspath_multipath_relax,
1286 no_bgp_bestpath_aspath_multipath_relax_cmd,
1287 "no bgp bestpath as-path multipath-relax",
1288 NO_STR
1289 "BGP specific commands\n"
1290 "Change the default bestpath selection\n"
1291 "AS-path attribute\n"
1292 "Allow load sharing across routes that have different AS paths (but same length)\n")
1293{
1294 struct bgp *bgp;
1295
1296 bgp = vty->index;
1297 bgp_flag_unset (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX);
1298 return CMD_SUCCESS;
1299}
David Lamparter6b0655a2014-06-04 06:53:35 +02001300
paul848973c2003-08-13 00:32:49 +00001301/* "bgp log-neighbor-changes" configuration. */
1302DEFUN (bgp_log_neighbor_changes,
1303 bgp_log_neighbor_changes_cmd,
1304 "bgp log-neighbor-changes",
1305 "BGP specific commands\n"
1306 "Log neighbor up/down and reset reason\n")
1307{
1308 struct bgp *bgp;
1309
1310 bgp = vty->index;
1311 bgp_flag_set (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES);
1312 return CMD_SUCCESS;
1313}
1314
1315DEFUN (no_bgp_log_neighbor_changes,
1316 no_bgp_log_neighbor_changes_cmd,
1317 "no bgp log-neighbor-changes",
1318 NO_STR
1319 "BGP specific commands\n"
1320 "Log neighbor up/down and reset reason\n")
1321{
1322 struct bgp *bgp;
1323
1324 bgp = vty->index;
1325 bgp_flag_unset (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES);
1326 return CMD_SUCCESS;
1327}
David Lamparter6b0655a2014-06-04 06:53:35 +02001328
paul718e3742002-12-13 20:15:29 +00001329/* "bgp bestpath med" configuration. */
1330DEFUN (bgp_bestpath_med,
1331 bgp_bestpath_med_cmd,
1332 "bgp bestpath med (confed|missing-as-worst)",
1333 "BGP specific commands\n"
1334 "Change the default bestpath selection\n"
1335 "MED attribute\n"
1336 "Compare MED among confederation paths\n"
1337 "Treat missing MED as the least preferred one\n")
1338{
1339 struct bgp *bgp;
1340
1341 bgp = vty->index;
1342
1343 if (strncmp (argv[0], "confed", 1) == 0)
1344 bgp_flag_set (bgp, BGP_FLAG_MED_CONFED);
1345 else
1346 bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1347
1348 return CMD_SUCCESS;
1349}
1350
1351DEFUN (bgp_bestpath_med2,
1352 bgp_bestpath_med2_cmd,
1353 "bgp bestpath med confed missing-as-worst",
1354 "BGP specific commands\n"
1355 "Change the default bestpath selection\n"
1356 "MED attribute\n"
1357 "Compare MED among confederation paths\n"
1358 "Treat missing MED as the least preferred one\n")
1359{
1360 struct bgp *bgp;
1361
1362 bgp = vty->index;
1363 bgp_flag_set (bgp, BGP_FLAG_MED_CONFED);
1364 bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1365 return CMD_SUCCESS;
1366}
1367
1368ALIAS (bgp_bestpath_med2,
1369 bgp_bestpath_med3_cmd,
1370 "bgp bestpath med missing-as-worst confed",
1371 "BGP specific commands\n"
1372 "Change the default bestpath selection\n"
1373 "MED attribute\n"
1374 "Treat missing MED as the least preferred one\n"
1375 "Compare MED among confederation paths\n")
1376
1377DEFUN (no_bgp_bestpath_med,
1378 no_bgp_bestpath_med_cmd,
1379 "no bgp bestpath med (confed|missing-as-worst)",
1380 NO_STR
1381 "BGP specific commands\n"
1382 "Change the default bestpath selection\n"
1383 "MED attribute\n"
1384 "Compare MED among confederation paths\n"
1385 "Treat missing MED as the least preferred one\n")
1386{
1387 struct bgp *bgp;
1388
1389 bgp = vty->index;
1390
1391 if (strncmp (argv[0], "confed", 1) == 0)
1392 bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED);
1393 else
1394 bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1395
1396 return CMD_SUCCESS;
1397}
1398
1399DEFUN (no_bgp_bestpath_med2,
1400 no_bgp_bestpath_med2_cmd,
1401 "no bgp bestpath med confed missing-as-worst",
1402 NO_STR
1403 "BGP specific commands\n"
1404 "Change the default bestpath selection\n"
1405 "MED attribute\n"
1406 "Compare MED among confederation paths\n"
1407 "Treat missing MED as the least preferred one\n")
1408{
1409 struct bgp *bgp;
1410
1411 bgp = vty->index;
1412 bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED);
1413 bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1414 return CMD_SUCCESS;
1415}
1416
1417ALIAS (no_bgp_bestpath_med2,
1418 no_bgp_bestpath_med3_cmd,
1419 "no bgp bestpath med missing-as-worst confed",
1420 NO_STR
1421 "BGP specific commands\n"
1422 "Change the default bestpath selection\n"
1423 "MED attribute\n"
1424 "Treat missing MED as the least preferred one\n"
1425 "Compare MED among confederation paths\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02001426
paul718e3742002-12-13 20:15:29 +00001427/* "no bgp default ipv4-unicast". */
1428DEFUN (no_bgp_default_ipv4_unicast,
1429 no_bgp_default_ipv4_unicast_cmd,
1430 "no bgp default ipv4-unicast",
1431 NO_STR
1432 "BGP specific commands\n"
1433 "Configure BGP defaults\n"
1434 "Activate ipv4-unicast for a peer by default\n")
1435{
1436 struct bgp *bgp;
1437
1438 bgp = vty->index;
1439 bgp_flag_set (bgp, BGP_FLAG_NO_DEFAULT_IPV4);
1440 return CMD_SUCCESS;
1441}
1442
1443DEFUN (bgp_default_ipv4_unicast,
1444 bgp_default_ipv4_unicast_cmd,
1445 "bgp default ipv4-unicast",
1446 "BGP specific commands\n"
1447 "Configure BGP defaults\n"
1448 "Activate ipv4-unicast for a peer by default\n")
1449{
1450 struct bgp *bgp;
1451
1452 bgp = vty->index;
1453 bgp_flag_unset (bgp, BGP_FLAG_NO_DEFAULT_IPV4);
1454 return CMD_SUCCESS;
1455}
David Lamparter6b0655a2014-06-04 06:53:35 +02001456
paul718e3742002-12-13 20:15:29 +00001457/* "bgp import-check" configuration. */
1458DEFUN (bgp_network_import_check,
1459 bgp_network_import_check_cmd,
1460 "bgp network import-check",
1461 "BGP specific commands\n"
1462 "BGP network command\n"
1463 "Check BGP network route exists in IGP\n")
1464{
1465 struct bgp *bgp;
1466
1467 bgp = vty->index;
1468 bgp_flag_set (bgp, BGP_FLAG_IMPORT_CHECK);
1469 return CMD_SUCCESS;
1470}
1471
1472DEFUN (no_bgp_network_import_check,
1473 no_bgp_network_import_check_cmd,
1474 "no bgp network import-check",
1475 NO_STR
1476 "BGP specific commands\n"
1477 "BGP network command\n"
1478 "Check BGP network route exists in IGP\n")
1479{
1480 struct bgp *bgp;
1481
1482 bgp = vty->index;
1483 bgp_flag_unset (bgp, BGP_FLAG_IMPORT_CHECK);
1484 return CMD_SUCCESS;
1485}
David Lamparter6b0655a2014-06-04 06:53:35 +02001486
paul718e3742002-12-13 20:15:29 +00001487DEFUN (bgp_default_local_preference,
1488 bgp_default_local_preference_cmd,
1489 "bgp default local-preference <0-4294967295>",
1490 "BGP specific commands\n"
1491 "Configure BGP defaults\n"
1492 "local preference (higher=more preferred)\n"
1493 "Configure default local preference value\n")
1494{
1495 struct bgp *bgp;
1496 u_int32_t local_pref;
1497
1498 bgp = vty->index;
1499
1500 VTY_GET_INTEGER ("local preference", local_pref, argv[0]);
1501
1502 bgp_default_local_preference_set (bgp, local_pref);
1503
1504 return CMD_SUCCESS;
1505}
1506
1507DEFUN (no_bgp_default_local_preference,
1508 no_bgp_default_local_preference_cmd,
1509 "no bgp default local-preference",
1510 NO_STR
1511 "BGP specific commands\n"
1512 "Configure BGP defaults\n"
1513 "local preference (higher=more preferred)\n")
1514{
1515 struct bgp *bgp;
1516
1517 bgp = vty->index;
1518 bgp_default_local_preference_unset (bgp);
1519 return CMD_SUCCESS;
1520}
1521
1522ALIAS (no_bgp_default_local_preference,
1523 no_bgp_default_local_preference_val_cmd,
1524 "no bgp default local-preference <0-4294967295>",
1525 NO_STR
1526 "BGP specific commands\n"
1527 "Configure BGP defaults\n"
1528 "local preference (higher=more preferred)\n"
1529 "Configure default local preference value\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02001530
Dinesh Dutt083e5e22015-11-09 20:21:54 -05001531static void
1532peer_announce_routes_if_rmap_out (struct bgp *bgp)
1533{
1534 struct peer *peer;
1535 struct listnode *node, *nnode;
1536 struct bgp_filter *filter;
1537 afi_t afi;
1538 safi_t safi;
1539
1540 /* Reannounce all routes to appropriate neighbors */
1541 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
1542 {
1543 for (afi = AFI_IP; afi < AFI_MAX; afi++)
1544 for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++)
1545 {
1546 if (CHECK_FLAG(peer->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT))
1547 {
1548 /* check if there's an out route-map on this client */
1549 filter = &peer->filter[afi][safi];
1550 if (ROUTE_MAP_OUT_NAME(filter))
1551 {
1552 if (BGP_DEBUG(update, UPDATE_OUT))
1553 zlog_debug("%s: Announcing routes again for peer %s"
1554 "(afi=%d, safi=%d", __func__, peer->host, afi,
1555 safi);
1556
1557 bgp_announce_route_all(peer);
1558 }
1559 }
1560 }
1561 }
1562}
1563
1564DEFUN (bgp_rr_allow_outbound_policy,
1565 bgp_rr_allow_outbound_policy_cmd,
1566 "bgp route-reflector allow-outbound-policy",
1567 "BGP specific commands\n"
1568 "Allow modifications made by out route-map\n"
1569 "on ibgp neighbors\n")
1570{
1571 struct bgp *bgp;
1572
1573 bgp = vty->index;
1574
1575 if (!bgp_flag_check(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY))
1576 {
1577 bgp_flag_set(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY);
1578 peer_announce_routes_if_rmap_out(bgp);
1579 }
1580
1581 return CMD_SUCCESS;
1582}
1583
1584DEFUN (no_bgp_rr_allow_outbound_policy,
1585 no_bgp_rr_allow_outbound_policy_cmd,
1586 "no bgp route-reflector allow-outbound-policy",
1587 NO_STR
1588 "BGP specific commands\n"
1589 "Allow modifications made by out route-map\n"
1590 "on ibgp neighbors\n")
1591{
1592 struct bgp *bgp;
1593
1594 bgp = vty->index;
1595
1596 if (bgp_flag_check(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY))
1597 {
1598 bgp_flag_unset(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY);
1599 peer_announce_routes_if_rmap_out(bgp);
1600 }
1601
1602 return CMD_SUCCESS;
1603}
1604
paul718e3742002-12-13 20:15:29 +00001605static int
paulfd79ac92004-10-13 05:06:08 +00001606peer_remote_as_vty (struct vty *vty, const char *peer_str,
1607 const char *as_str, afi_t afi, safi_t safi)
paul718e3742002-12-13 20:15:29 +00001608{
1609 int ret;
1610 struct bgp *bgp;
1611 as_t as;
1612 union sockunion su;
1613
1614 bgp = vty->index;
1615
1616 /* Get AS number. */
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00001617 VTY_GET_INTEGER_RANGE ("AS", as, as_str, 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +00001618
1619 /* If peer is peer group, call proper function. */
1620 ret = str2sockunion (peer_str, &su);
1621 if (ret < 0)
1622 {
1623 ret = peer_group_remote_as (bgp, peer_str, &as);
1624 if (ret < 0)
1625 {
1626 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1627 return CMD_WARNING;
1628 }
1629 return CMD_SUCCESS;
1630 }
1631
1632 if (peer_address_self_check (&su))
1633 {
1634 vty_out (vty, "%% Can not configure the local system as neighbor%s",
1635 VTY_NEWLINE);
1636 return CMD_WARNING;
1637 }
1638
1639 ret = peer_remote_as (bgp, &su, &as, afi, safi);
1640
1641 /* This peer belongs to peer group. */
1642 switch (ret)
1643 {
1644 case BGP_ERR_PEER_GROUP_MEMBER:
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04001645 vty_out (vty, "%% Peer-group AS %u. Cannot configure remote-as for member%s", as, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00001646 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00001647 case BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT:
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04001648 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 +00001649 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00001650 }
1651 return bgp_vty_return (vty, ret);
1652}
1653
1654DEFUN (neighbor_remote_as,
1655 neighbor_remote_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001656 NEIGHBOR_CMD2 "remote-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001657 NEIGHBOR_STR
1658 NEIGHBOR_ADDR_STR2
1659 "Specify a BGP neighbor\n"
1660 AS_STR)
1661{
1662 return peer_remote_as_vty (vty, argv[0], argv[1], AFI_IP, SAFI_UNICAST);
1663}
David Lamparter6b0655a2014-06-04 06:53:35 +02001664
paul718e3742002-12-13 20:15:29 +00001665DEFUN (neighbor_peer_group,
1666 neighbor_peer_group_cmd,
1667 "neighbor WORD peer-group",
1668 NEIGHBOR_STR
1669 "Neighbor tag\n"
1670 "Configure peer-group\n")
1671{
1672 struct bgp *bgp;
1673 struct peer_group *group;
1674
1675 bgp = vty->index;
1676
1677 group = peer_group_get (bgp, argv[0]);
1678 if (! group)
1679 return CMD_WARNING;
1680
1681 return CMD_SUCCESS;
1682}
1683
1684DEFUN (no_neighbor,
1685 no_neighbor_cmd,
1686 NO_NEIGHBOR_CMD2,
1687 NO_STR
1688 NEIGHBOR_STR
1689 NEIGHBOR_ADDR_STR2)
1690{
1691 int ret;
1692 union sockunion su;
1693 struct peer_group *group;
1694 struct peer *peer;
1695
1696 ret = str2sockunion (argv[0], &su);
1697 if (ret < 0)
1698 {
1699 group = peer_group_lookup (vty->index, argv[0]);
1700 if (group)
1701 peer_group_delete (group);
1702 else
1703 {
1704 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1705 return CMD_WARNING;
1706 }
1707 }
1708 else
1709 {
1710 peer = peer_lookup (vty->index, &su);
1711 if (peer)
paul200df112005-06-01 11:17:05 +00001712 peer_delete (peer);
paul718e3742002-12-13 20:15:29 +00001713 }
1714
1715 return CMD_SUCCESS;
1716}
1717
1718ALIAS (no_neighbor,
1719 no_neighbor_remote_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001720 NO_NEIGHBOR_CMD "remote-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001721 NO_STR
1722 NEIGHBOR_STR
1723 NEIGHBOR_ADDR_STR
1724 "Specify a BGP neighbor\n"
1725 AS_STR)
1726
1727DEFUN (no_neighbor_peer_group,
1728 no_neighbor_peer_group_cmd,
1729 "no neighbor WORD peer-group",
1730 NO_STR
1731 NEIGHBOR_STR
1732 "Neighbor tag\n"
1733 "Configure peer-group\n")
1734{
1735 struct peer_group *group;
1736
1737 group = peer_group_lookup (vty->index, argv[0]);
1738 if (group)
1739 peer_group_delete (group);
1740 else
1741 {
1742 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1743 return CMD_WARNING;
1744 }
1745 return CMD_SUCCESS;
1746}
1747
1748DEFUN (no_neighbor_peer_group_remote_as,
1749 no_neighbor_peer_group_remote_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001750 "no neighbor WORD remote-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001751 NO_STR
1752 NEIGHBOR_STR
1753 "Neighbor tag\n"
1754 "Specify a BGP neighbor\n"
1755 AS_STR)
1756{
1757 struct peer_group *group;
1758
1759 group = peer_group_lookup (vty->index, argv[0]);
1760 if (group)
1761 peer_group_remote_as_delete (group);
1762 else
1763 {
1764 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1765 return CMD_WARNING;
1766 }
1767 return CMD_SUCCESS;
1768}
David Lamparter6b0655a2014-06-04 06:53:35 +02001769
paul718e3742002-12-13 20:15:29 +00001770DEFUN (neighbor_local_as,
1771 neighbor_local_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001772 NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001773 NEIGHBOR_STR
1774 NEIGHBOR_ADDR_STR2
1775 "Specify a local-as number\n"
1776 "AS number used as local AS\n")
1777{
1778 struct peer *peer;
1779 int ret;
1780
1781 peer = peer_and_group_lookup_vty (vty, argv[0]);
1782 if (! peer)
1783 return CMD_WARNING;
1784
Andrew Certain9d3f9702012-11-07 23:50:07 +00001785 ret = peer_local_as_set (peer, atoi (argv[1]), 0, 0);
paul718e3742002-12-13 20:15:29 +00001786 return bgp_vty_return (vty, ret);
1787}
1788
1789DEFUN (neighbor_local_as_no_prepend,
1790 neighbor_local_as_no_prepend_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001791 NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend",
paul718e3742002-12-13 20:15:29 +00001792 NEIGHBOR_STR
1793 NEIGHBOR_ADDR_STR2
1794 "Specify a local-as number\n"
1795 "AS number used as local AS\n"
1796 "Do not prepend local-as to updates from ebgp peers\n")
1797{
1798 struct peer *peer;
1799 int ret;
1800
1801 peer = peer_and_group_lookup_vty (vty, argv[0]);
1802 if (! peer)
1803 return CMD_WARNING;
1804
Andrew Certain9d3f9702012-11-07 23:50:07 +00001805 ret = peer_local_as_set (peer, atoi (argv[1]), 1, 0);
paul718e3742002-12-13 20:15:29 +00001806 return bgp_vty_return (vty, ret);
1807}
1808
Andrew Certain9d3f9702012-11-07 23:50:07 +00001809DEFUN (neighbor_local_as_no_prepend_replace_as,
1810 neighbor_local_as_no_prepend_replace_as_cmd,
1811 NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as",
1812 NEIGHBOR_STR
1813 NEIGHBOR_ADDR_STR2
1814 "Specify a local-as number\n"
1815 "AS number used as local AS\n"
1816 "Do not prepend local-as to updates from ebgp peers\n"
1817 "Do not prepend local-as to updates from ibgp peers\n")
1818{
1819 struct peer *peer;
1820 int ret;
1821
1822 peer = peer_and_group_lookup_vty (vty, argv[0]);
1823 if (! peer)
1824 return CMD_WARNING;
1825
1826 ret = peer_local_as_set (peer, atoi (argv[1]), 1, 1);
1827 return bgp_vty_return (vty, ret);
1828}
1829
1830
paul718e3742002-12-13 20:15:29 +00001831DEFUN (no_neighbor_local_as,
1832 no_neighbor_local_as_cmd,
1833 NO_NEIGHBOR_CMD2 "local-as",
1834 NO_STR
1835 NEIGHBOR_STR
1836 NEIGHBOR_ADDR_STR2
1837 "Specify a local-as number\n")
1838{
1839 struct peer *peer;
1840 int ret;
1841
1842 peer = peer_and_group_lookup_vty (vty, argv[0]);
1843 if (! peer)
1844 return CMD_WARNING;
1845
1846 ret = peer_local_as_unset (peer);
1847 return bgp_vty_return (vty, ret);
1848}
1849
1850ALIAS (no_neighbor_local_as,
1851 no_neighbor_local_as_val_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001852 NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001853 NO_STR
1854 NEIGHBOR_STR
1855 NEIGHBOR_ADDR_STR2
1856 "Specify a local-as number\n"
1857 "AS number used as local AS\n")
1858
1859ALIAS (no_neighbor_local_as,
1860 no_neighbor_local_as_val2_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001861 NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend",
paul718e3742002-12-13 20:15:29 +00001862 NO_STR
1863 NEIGHBOR_STR
1864 NEIGHBOR_ADDR_STR2
1865 "Specify a local-as number\n"
1866 "AS number used as local AS\n"
1867 "Do not prepend local-as to updates from ebgp peers\n")
Andrew Certain9d3f9702012-11-07 23:50:07 +00001868
1869ALIAS (no_neighbor_local_as,
1870 no_neighbor_local_as_val3_cmd,
1871 NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as",
1872 NO_STR
1873 NEIGHBOR_STR
1874 NEIGHBOR_ADDR_STR2
1875 "Specify a local-as number\n"
1876 "AS number used as local AS\n"
1877 "Do not prepend local-as to updates from ebgp peers\n"
1878 "Do not prepend local-as to updates from ibgp peers\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02001879
Paul Jakma0df7c912008-07-21 21:02:49 +00001880DEFUN (neighbor_password,
1881 neighbor_password_cmd,
1882 NEIGHBOR_CMD2 "password LINE",
1883 NEIGHBOR_STR
1884 NEIGHBOR_ADDR_STR2
1885 "Set a password\n"
1886 "The password\n")
1887{
1888 struct peer *peer;
1889 int ret;
1890
1891 peer = peer_and_group_lookup_vty (vty, argv[0]);
1892 if (! peer)
1893 return CMD_WARNING;
1894
1895 ret = peer_password_set (peer, argv[1]);
1896 return bgp_vty_return (vty, ret);
1897}
1898
1899DEFUN (no_neighbor_password,
1900 no_neighbor_password_cmd,
1901 NO_NEIGHBOR_CMD2 "password",
1902 NO_STR
1903 NEIGHBOR_STR
1904 NEIGHBOR_ADDR_STR2
1905 "Set a password\n")
1906{
1907 struct peer *peer;
1908 int ret;
1909
1910 peer = peer_and_group_lookup_vty (vty, argv[0]);
1911 if (! peer)
1912 return CMD_WARNING;
1913
1914 ret = peer_password_unset (peer);
1915 return bgp_vty_return (vty, ret);
1916}
David Lamparter6b0655a2014-06-04 06:53:35 +02001917
paul718e3742002-12-13 20:15:29 +00001918DEFUN (neighbor_activate,
1919 neighbor_activate_cmd,
1920 NEIGHBOR_CMD2 "activate",
1921 NEIGHBOR_STR
1922 NEIGHBOR_ADDR_STR2
1923 "Enable the Address Family for this Neighbor\n")
1924{
1925 struct peer *peer;
1926
1927 peer = peer_and_group_lookup_vty (vty, argv[0]);
1928 if (! peer)
1929 return CMD_WARNING;
1930
1931 peer_activate (peer, bgp_node_afi (vty), bgp_node_safi (vty));
1932
1933 return CMD_SUCCESS;
1934}
1935
1936DEFUN (no_neighbor_activate,
1937 no_neighbor_activate_cmd,
1938 NO_NEIGHBOR_CMD2 "activate",
1939 NO_STR
1940 NEIGHBOR_STR
1941 NEIGHBOR_ADDR_STR2
1942 "Enable the Address Family for this Neighbor\n")
1943{
1944 int ret;
1945 struct peer *peer;
1946
1947 /* Lookup peer. */
1948 peer = peer_and_group_lookup_vty (vty, argv[0]);
1949 if (! peer)
1950 return CMD_WARNING;
1951
1952 ret = peer_deactivate (peer, bgp_node_afi (vty), bgp_node_safi (vty));
1953
1954 return bgp_vty_return (vty, ret);
1955}
David Lamparter6b0655a2014-06-04 06:53:35 +02001956
paul718e3742002-12-13 20:15:29 +00001957DEFUN (neighbor_set_peer_group,
1958 neighbor_set_peer_group_cmd,
1959 NEIGHBOR_CMD "peer-group WORD",
1960 NEIGHBOR_STR
1961 NEIGHBOR_ADDR_STR
1962 "Member of the peer-group\n"
1963 "peer-group name\n")
1964{
1965 int ret;
1966 as_t as;
1967 union sockunion su;
1968 struct bgp *bgp;
1969 struct peer_group *group;
1970
1971 bgp = vty->index;
1972
1973 ret = str2sockunion (argv[0], &su);
1974 if (ret < 0)
1975 {
1976 vty_out (vty, "%% Malformed address: %s%s", argv[0], VTY_NEWLINE);
1977 return CMD_WARNING;
1978 }
1979
1980 group = peer_group_lookup (bgp, argv[1]);
1981 if (! group)
1982 {
1983 vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE);
1984 return CMD_WARNING;
1985 }
1986
1987 if (peer_address_self_check (&su))
1988 {
1989 vty_out (vty, "%% Can not configure the local system as neighbor%s",
1990 VTY_NEWLINE);
1991 return CMD_WARNING;
1992 }
1993
1994 ret = peer_group_bind (bgp, &su, group, bgp_node_afi (vty),
1995 bgp_node_safi (vty), &as);
1996
1997 if (ret == BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT)
1998 {
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04001999 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 +00002000 return CMD_WARNING;
2001 }
2002
2003 return bgp_vty_return (vty, ret);
2004}
2005
2006DEFUN (no_neighbor_set_peer_group,
2007 no_neighbor_set_peer_group_cmd,
2008 NO_NEIGHBOR_CMD "peer-group WORD",
2009 NO_STR
2010 NEIGHBOR_STR
2011 NEIGHBOR_ADDR_STR
2012 "Member of the peer-group\n"
2013 "peer-group name\n")
2014{
2015 int ret;
2016 struct bgp *bgp;
2017 struct peer *peer;
2018 struct peer_group *group;
2019
2020 bgp = vty->index;
2021
2022 peer = peer_lookup_vty (vty, argv[0]);
2023 if (! peer)
2024 return CMD_WARNING;
2025
2026 group = peer_group_lookup (bgp, argv[1]);
2027 if (! group)
2028 {
2029 vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE);
2030 return CMD_WARNING;
2031 }
2032
2033 ret = peer_group_unbind (bgp, peer, group, bgp_node_afi (vty),
2034 bgp_node_safi (vty));
2035
2036 return bgp_vty_return (vty, ret);
2037}
David Lamparter6b0655a2014-06-04 06:53:35 +02002038
paul94f2b392005-06-28 12:44:16 +00002039static int
paulfd79ac92004-10-13 05:06:08 +00002040peer_flag_modify_vty (struct vty *vty, const char *ip_str,
2041 u_int16_t flag, int set)
paul718e3742002-12-13 20:15:29 +00002042{
2043 int ret;
2044 struct peer *peer;
2045
2046 peer = peer_and_group_lookup_vty (vty, ip_str);
2047 if (! peer)
2048 return CMD_WARNING;
2049
2050 if (set)
2051 ret = peer_flag_set (peer, flag);
2052 else
2053 ret = peer_flag_unset (peer, flag);
2054
2055 return bgp_vty_return (vty, ret);
2056}
2057
paul94f2b392005-06-28 12:44:16 +00002058static int
paulfd79ac92004-10-13 05:06:08 +00002059peer_flag_set_vty (struct vty *vty, const char *ip_str, u_int16_t flag)
paul718e3742002-12-13 20:15:29 +00002060{
2061 return peer_flag_modify_vty (vty, ip_str, flag, 1);
2062}
2063
paul94f2b392005-06-28 12:44:16 +00002064static int
paulfd79ac92004-10-13 05:06:08 +00002065peer_flag_unset_vty (struct vty *vty, const char *ip_str, u_int16_t flag)
paul718e3742002-12-13 20:15:29 +00002066{
2067 return peer_flag_modify_vty (vty, ip_str, flag, 0);
2068}
2069
2070/* neighbor passive. */
2071DEFUN (neighbor_passive,
2072 neighbor_passive_cmd,
2073 NEIGHBOR_CMD2 "passive",
2074 NEIGHBOR_STR
2075 NEIGHBOR_ADDR_STR2
2076 "Don't send open messages to this neighbor\n")
2077{
2078 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_PASSIVE);
2079}
2080
2081DEFUN (no_neighbor_passive,
2082 no_neighbor_passive_cmd,
2083 NO_NEIGHBOR_CMD2 "passive",
2084 NO_STR
2085 NEIGHBOR_STR
2086 NEIGHBOR_ADDR_STR2
2087 "Don't send open messages to this neighbor\n")
2088{
2089 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_PASSIVE);
2090}
David Lamparter6b0655a2014-06-04 06:53:35 +02002091
paul718e3742002-12-13 20:15:29 +00002092/* neighbor shutdown. */
2093DEFUN (neighbor_shutdown,
2094 neighbor_shutdown_cmd,
2095 NEIGHBOR_CMD2 "shutdown",
2096 NEIGHBOR_STR
2097 NEIGHBOR_ADDR_STR2
2098 "Administratively shut down this neighbor\n")
2099{
2100 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_SHUTDOWN);
2101}
2102
2103DEFUN (no_neighbor_shutdown,
2104 no_neighbor_shutdown_cmd,
2105 NO_NEIGHBOR_CMD2 "shutdown",
2106 NO_STR
2107 NEIGHBOR_STR
2108 NEIGHBOR_ADDR_STR2
2109 "Administratively shut down this neighbor\n")
2110{
2111 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_SHUTDOWN);
2112}
David Lamparter6b0655a2014-06-04 06:53:35 +02002113
hassoc9502432005-02-01 22:01:48 +00002114/* Deprecated neighbor capability route-refresh. */
2115DEFUN_DEPRECATED (neighbor_capability_route_refresh,
2116 neighbor_capability_route_refresh_cmd,
2117 NEIGHBOR_CMD2 "capability route-refresh",
2118 NEIGHBOR_STR
2119 NEIGHBOR_ADDR_STR2
2120 "Advertise capability to the peer\n"
2121 "Advertise route-refresh capability to this neighbor\n")
paul718e3742002-12-13 20:15:29 +00002122{
hassoc9502432005-02-01 22:01:48 +00002123 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00002124}
2125
hassoc9502432005-02-01 22:01:48 +00002126DEFUN_DEPRECATED (no_neighbor_capability_route_refresh,
2127 no_neighbor_capability_route_refresh_cmd,
2128 NO_NEIGHBOR_CMD2 "capability route-refresh",
2129 NO_STR
2130 NEIGHBOR_STR
2131 NEIGHBOR_ADDR_STR2
2132 "Advertise capability to the peer\n"
2133 "Advertise route-refresh capability to this neighbor\n")
paul718e3742002-12-13 20:15:29 +00002134{
hassoc9502432005-02-01 22:01:48 +00002135 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00002136}
David Lamparter6b0655a2014-06-04 06:53:35 +02002137
paul718e3742002-12-13 20:15:29 +00002138/* neighbor capability dynamic. */
2139DEFUN (neighbor_capability_dynamic,
2140 neighbor_capability_dynamic_cmd,
2141 NEIGHBOR_CMD2 "capability dynamic",
2142 NEIGHBOR_STR
2143 NEIGHBOR_ADDR_STR2
2144 "Advertise capability to the peer\n"
2145 "Advertise dynamic capability to this neighbor\n")
2146{
2147 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY);
2148}
2149
2150DEFUN (no_neighbor_capability_dynamic,
2151 no_neighbor_capability_dynamic_cmd,
2152 NO_NEIGHBOR_CMD2 "capability dynamic",
2153 NO_STR
2154 NEIGHBOR_STR
2155 NEIGHBOR_ADDR_STR2
2156 "Advertise capability to the peer\n"
2157 "Advertise dynamic capability to this neighbor\n")
2158{
2159 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY);
2160}
David Lamparter6b0655a2014-06-04 06:53:35 +02002161
paul718e3742002-12-13 20:15:29 +00002162/* neighbor dont-capability-negotiate */
2163DEFUN (neighbor_dont_capability_negotiate,
2164 neighbor_dont_capability_negotiate_cmd,
2165 NEIGHBOR_CMD2 "dont-capability-negotiate",
2166 NEIGHBOR_STR
2167 NEIGHBOR_ADDR_STR2
2168 "Do not perform capability negotiation\n")
2169{
2170 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY);
2171}
2172
2173DEFUN (no_neighbor_dont_capability_negotiate,
2174 no_neighbor_dont_capability_negotiate_cmd,
2175 NO_NEIGHBOR_CMD2 "dont-capability-negotiate",
2176 NO_STR
2177 NEIGHBOR_STR
2178 NEIGHBOR_ADDR_STR2
2179 "Do not perform capability negotiation\n")
2180{
2181 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY);
2182}
David Lamparter6b0655a2014-06-04 06:53:35 +02002183
paul94f2b392005-06-28 12:44:16 +00002184static int
paulfd79ac92004-10-13 05:06:08 +00002185peer_af_flag_modify_vty (struct vty *vty, const char *peer_str, afi_t afi,
paulfee0f4c2004-09-13 05:12:46 +00002186 safi_t safi, u_int32_t flag, int set)
paul718e3742002-12-13 20:15:29 +00002187{
2188 int ret;
2189 struct peer *peer;
2190
2191 peer = peer_and_group_lookup_vty (vty, peer_str);
2192 if (! peer)
2193 return CMD_WARNING;
2194
2195 if (set)
2196 ret = peer_af_flag_set (peer, afi, safi, flag);
2197 else
2198 ret = peer_af_flag_unset (peer, afi, safi, flag);
2199
2200 return bgp_vty_return (vty, ret);
2201}
2202
paul94f2b392005-06-28 12:44:16 +00002203static int
paulfd79ac92004-10-13 05:06:08 +00002204peer_af_flag_set_vty (struct vty *vty, const char *peer_str, afi_t afi,
paulfee0f4c2004-09-13 05:12:46 +00002205 safi_t safi, u_int32_t flag)
paul718e3742002-12-13 20:15:29 +00002206{
2207 return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 1);
2208}
2209
paul94f2b392005-06-28 12:44:16 +00002210static int
paulfd79ac92004-10-13 05:06:08 +00002211peer_af_flag_unset_vty (struct vty *vty, const char *peer_str, afi_t afi,
paulfee0f4c2004-09-13 05:12:46 +00002212 safi_t safi, u_int32_t flag)
paul718e3742002-12-13 20:15:29 +00002213{
2214 return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 0);
2215}
David Lamparter6b0655a2014-06-04 06:53:35 +02002216
paul718e3742002-12-13 20:15:29 +00002217/* neighbor capability orf prefix-list. */
2218DEFUN (neighbor_capability_orf_prefix,
2219 neighbor_capability_orf_prefix_cmd,
2220 NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)",
2221 NEIGHBOR_STR
2222 NEIGHBOR_ADDR_STR2
2223 "Advertise capability to the peer\n"
2224 "Advertise ORF capability to the peer\n"
2225 "Advertise prefixlist ORF capability to this neighbor\n"
2226 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
2227 "Capability to RECEIVE the ORF from this neighbor\n"
2228 "Capability to SEND the ORF to this neighbor\n")
2229{
2230 u_int16_t flag = 0;
2231
2232 if (strncmp (argv[1], "s", 1) == 0)
2233 flag = PEER_FLAG_ORF_PREFIX_SM;
2234 else if (strncmp (argv[1], "r", 1) == 0)
2235 flag = PEER_FLAG_ORF_PREFIX_RM;
2236 else if (strncmp (argv[1], "b", 1) == 0)
2237 flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM;
2238 else
2239 return CMD_WARNING;
2240
2241 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2242 bgp_node_safi (vty), flag);
2243}
2244
2245DEFUN (no_neighbor_capability_orf_prefix,
2246 no_neighbor_capability_orf_prefix_cmd,
2247 NO_NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)",
2248 NO_STR
2249 NEIGHBOR_STR
2250 NEIGHBOR_ADDR_STR2
2251 "Advertise capability to the peer\n"
2252 "Advertise ORF capability to the peer\n"
2253 "Advertise prefixlist ORF capability to this neighbor\n"
2254 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
2255 "Capability to RECEIVE the ORF from this neighbor\n"
2256 "Capability to SEND the ORF to this neighbor\n")
2257{
2258 u_int16_t flag = 0;
2259
2260 if (strncmp (argv[1], "s", 1) == 0)
2261 flag = PEER_FLAG_ORF_PREFIX_SM;
2262 else if (strncmp (argv[1], "r", 1) == 0)
2263 flag = PEER_FLAG_ORF_PREFIX_RM;
2264 else if (strncmp (argv[1], "b", 1) == 0)
2265 flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM;
2266 else
2267 return CMD_WARNING;
2268
2269 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2270 bgp_node_safi (vty), flag);
2271}
David Lamparter6b0655a2014-06-04 06:53:35 +02002272
paul718e3742002-12-13 20:15:29 +00002273/* neighbor next-hop-self. */
2274DEFUN (neighbor_nexthop_self,
2275 neighbor_nexthop_self_cmd,
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002276 NEIGHBOR_CMD2 "next-hop-self {all}",
paul718e3742002-12-13 20:15:29 +00002277 NEIGHBOR_STR
2278 NEIGHBOR_ADDR_STR2
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002279 "Disable the next hop calculation for this neighbor\n"
2280 "Apply also to ibgp-learned routes when acting as a route reflector\n")
paul718e3742002-12-13 20:15:29 +00002281{
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002282 u_int32_t flags = PEER_FLAG_NEXTHOP_SELF, unset = 0;
2283 int rc;
2284
2285 /* Check if "all" is specified */
2286 if (argv[1] != NULL)
2287 flags |= PEER_FLAG_NEXTHOP_SELF_ALL;
2288 else
2289 unset |= PEER_FLAG_NEXTHOP_SELF_ALL;
2290
2291 rc = peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2292 bgp_node_safi (vty), flags);
2293 if ( rc == CMD_SUCCESS && unset )
2294 rc = peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2295 bgp_node_safi (vty), unset);
2296 return rc;
paul718e3742002-12-13 20:15:29 +00002297}
2298
2299DEFUN (no_neighbor_nexthop_self,
2300 no_neighbor_nexthop_self_cmd,
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002301 NO_NEIGHBOR_CMD2 "next-hop-self {all}",
paul718e3742002-12-13 20:15:29 +00002302 NO_STR
2303 NEIGHBOR_STR
2304 NEIGHBOR_ADDR_STR2
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002305 "Disable the next hop calculation for this neighbor\n"
2306 "Apply also to ibgp-learned routes when acting as a route reflector\n")
paul718e3742002-12-13 20:15:29 +00002307{
2308 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002309 bgp_node_safi (vty),
2310 PEER_FLAG_NEXTHOP_SELF|PEER_FLAG_NEXTHOP_SELF_ALL);
paul718e3742002-12-13 20:15:29 +00002311}
David Lamparter6b0655a2014-06-04 06:53:35 +02002312
paul718e3742002-12-13 20:15:29 +00002313/* neighbor remove-private-AS. */
2314DEFUN (neighbor_remove_private_as,
2315 neighbor_remove_private_as_cmd,
2316 NEIGHBOR_CMD2 "remove-private-AS",
2317 NEIGHBOR_STR
2318 NEIGHBOR_ADDR_STR2
2319 "Remove private AS number from outbound updates\n")
2320{
2321 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2322 bgp_node_safi (vty),
2323 PEER_FLAG_REMOVE_PRIVATE_AS);
2324}
2325
2326DEFUN (no_neighbor_remove_private_as,
2327 no_neighbor_remove_private_as_cmd,
2328 NO_NEIGHBOR_CMD2 "remove-private-AS",
2329 NO_STR
2330 NEIGHBOR_STR
2331 NEIGHBOR_ADDR_STR2
2332 "Remove private AS number from outbound updates\n")
2333{
2334 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2335 bgp_node_safi (vty),
2336 PEER_FLAG_REMOVE_PRIVATE_AS);
2337}
David Lamparter6b0655a2014-06-04 06:53:35 +02002338
paul718e3742002-12-13 20:15:29 +00002339/* neighbor send-community. */
2340DEFUN (neighbor_send_community,
2341 neighbor_send_community_cmd,
2342 NEIGHBOR_CMD2 "send-community",
2343 NEIGHBOR_STR
2344 NEIGHBOR_ADDR_STR2
2345 "Send Community attribute to this neighbor\n")
2346{
2347 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2348 bgp_node_safi (vty),
2349 PEER_FLAG_SEND_COMMUNITY);
2350}
2351
2352DEFUN (no_neighbor_send_community,
2353 no_neighbor_send_community_cmd,
2354 NO_NEIGHBOR_CMD2 "send-community",
2355 NO_STR
2356 NEIGHBOR_STR
2357 NEIGHBOR_ADDR_STR2
2358 "Send Community attribute to this neighbor\n")
2359{
2360 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2361 bgp_node_safi (vty),
2362 PEER_FLAG_SEND_COMMUNITY);
2363}
David Lamparter6b0655a2014-06-04 06:53:35 +02002364
paul718e3742002-12-13 20:15:29 +00002365/* neighbor send-community extended. */
2366DEFUN (neighbor_send_community_type,
2367 neighbor_send_community_type_cmd,
Job Snijders3334bab2017-01-20 14:47:12 +00002368 NEIGHBOR_CMD2 "send-community (both|all|extended|standard|large)",
paul718e3742002-12-13 20:15:29 +00002369 NEIGHBOR_STR
2370 NEIGHBOR_ADDR_STR2
2371 "Send Community attribute to this neighbor\n"
Job Snijders3334bab2017-01-20 14:47:12 +00002372 "Send Standard, Large and Extended Community attributes\n"
2373 "Send Standard, Large and Extended Community attributes\n"
paul718e3742002-12-13 20:15:29 +00002374 "Send Extended Community attributes\n"
Job Snijders3334bab2017-01-20 14:47:12 +00002375 "Send Standard Community attributes\n"
2376 "Send Large Community attributes\n")
paul718e3742002-12-13 20:15:29 +00002377{
2378 if (strncmp (argv[1], "s", 1) == 0)
2379 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2380 bgp_node_safi (vty),
2381 PEER_FLAG_SEND_COMMUNITY);
2382 if (strncmp (argv[1], "e", 1) == 0)
2383 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2384 bgp_node_safi (vty),
2385 PEER_FLAG_SEND_EXT_COMMUNITY);
Job Snijders3334bab2017-01-20 14:47:12 +00002386 if (strncmp (argv[1], "l", 1) == 0)
2387 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2388 bgp_node_safi (vty),
2389 PEER_FLAG_SEND_LARGE_COMMUNITY);
paul718e3742002-12-13 20:15:29 +00002390
2391 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2392 bgp_node_safi (vty),
2393 (PEER_FLAG_SEND_COMMUNITY|
Job Snijders3334bab2017-01-20 14:47:12 +00002394 PEER_FLAG_SEND_EXT_COMMUNITY|
2395 PEER_FLAG_SEND_LARGE_COMMUNITY));
paul718e3742002-12-13 20:15:29 +00002396}
2397
2398DEFUN (no_neighbor_send_community_type,
2399 no_neighbor_send_community_type_cmd,
Job Snijders3334bab2017-01-20 14:47:12 +00002400 NO_NEIGHBOR_CMD2 "send-community (both|all|extended|standard|large)",
paul718e3742002-12-13 20:15:29 +00002401 NO_STR
2402 NEIGHBOR_STR
2403 NEIGHBOR_ADDR_STR2
2404 "Send Community attribute to this neighbor\n"
Job Snijders3334bab2017-01-20 14:47:12 +00002405 "Send Standard, Large and Extended Community attributes\n"
2406 "Send Standard, Large and Extended Community attributes\n"
paul718e3742002-12-13 20:15:29 +00002407 "Send Extended Community attributes\n"
Job Snijders3334bab2017-01-20 14:47:12 +00002408 "Send Standard Community attributes\n"
2409 "Send Large Community attributes\n")
paul718e3742002-12-13 20:15:29 +00002410{
2411 if (strncmp (argv[1], "s", 1) == 0)
2412 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2413 bgp_node_safi (vty),
2414 PEER_FLAG_SEND_COMMUNITY);
2415 if (strncmp (argv[1], "e", 1) == 0)
2416 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2417 bgp_node_safi (vty),
2418 PEER_FLAG_SEND_EXT_COMMUNITY);
Job Snijders3334bab2017-01-20 14:47:12 +00002419 if (strncmp (argv[1], "l", 1) == 0)
2420 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2421 bgp_node_safi (vty),
2422 PEER_FLAG_SEND_LARGE_COMMUNITY);
paul718e3742002-12-13 20:15:29 +00002423
2424 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2425 bgp_node_safi (vty),
2426 (PEER_FLAG_SEND_COMMUNITY |
Job Snijders3334bab2017-01-20 14:47:12 +00002427 PEER_FLAG_SEND_EXT_COMMUNITY|
2428 PEER_FLAG_SEND_LARGE_COMMUNITY));
paul718e3742002-12-13 20:15:29 +00002429}
David Lamparter6b0655a2014-06-04 06:53:35 +02002430
paul718e3742002-12-13 20:15:29 +00002431/* neighbor soft-reconfig. */
2432DEFUN (neighbor_soft_reconfiguration,
2433 neighbor_soft_reconfiguration_cmd,
2434 NEIGHBOR_CMD2 "soft-reconfiguration inbound",
2435 NEIGHBOR_STR
2436 NEIGHBOR_ADDR_STR2
2437 "Per neighbor soft reconfiguration\n"
2438 "Allow inbound soft reconfiguration for this neighbor\n")
2439{
2440 return peer_af_flag_set_vty (vty, argv[0],
2441 bgp_node_afi (vty), bgp_node_safi (vty),
2442 PEER_FLAG_SOFT_RECONFIG);
2443}
2444
2445DEFUN (no_neighbor_soft_reconfiguration,
2446 no_neighbor_soft_reconfiguration_cmd,
2447 NO_NEIGHBOR_CMD2 "soft-reconfiguration inbound",
2448 NO_STR
2449 NEIGHBOR_STR
2450 NEIGHBOR_ADDR_STR2
2451 "Per neighbor soft reconfiguration\n"
2452 "Allow inbound soft reconfiguration for this neighbor\n")
2453{
2454 return peer_af_flag_unset_vty (vty, argv[0],
2455 bgp_node_afi (vty), bgp_node_safi (vty),
2456 PEER_FLAG_SOFT_RECONFIG);
2457}
David Lamparter6b0655a2014-06-04 06:53:35 +02002458
paul718e3742002-12-13 20:15:29 +00002459DEFUN (neighbor_route_reflector_client,
2460 neighbor_route_reflector_client_cmd,
2461 NEIGHBOR_CMD2 "route-reflector-client",
2462 NEIGHBOR_STR
2463 NEIGHBOR_ADDR_STR2
2464 "Configure a neighbor as Route Reflector client\n")
2465{
2466 struct peer *peer;
2467
2468
2469 peer = peer_and_group_lookup_vty (vty, argv[0]);
2470 if (! peer)
2471 return CMD_WARNING;
2472
2473 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2474 bgp_node_safi (vty),
2475 PEER_FLAG_REFLECTOR_CLIENT);
2476}
2477
2478DEFUN (no_neighbor_route_reflector_client,
2479 no_neighbor_route_reflector_client_cmd,
2480 NO_NEIGHBOR_CMD2 "route-reflector-client",
2481 NO_STR
2482 NEIGHBOR_STR
2483 NEIGHBOR_ADDR_STR2
2484 "Configure a neighbor as Route Reflector client\n")
2485{
2486 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2487 bgp_node_safi (vty),
2488 PEER_FLAG_REFLECTOR_CLIENT);
2489}
David Lamparter6b0655a2014-06-04 06:53:35 +02002490
paul94f2b392005-06-28 12:44:16 +00002491static int
paulfd79ac92004-10-13 05:06:08 +00002492peer_rsclient_set_vty (struct vty *vty, const char *peer_str,
2493 int afi, int safi)
paulfee0f4c2004-09-13 05:12:46 +00002494{
2495 int ret;
2496 struct bgp *bgp;
2497 struct peer *peer;
2498 struct peer_group *group;
paul1eb8ef22005-04-07 07:30:20 +00002499 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00002500 struct bgp_filter *pfilter;
2501 struct bgp_filter *gfilter;
Chris Caputo228da422009-07-18 05:44:03 +00002502 int locked_and_added = 0;
paulfee0f4c2004-09-13 05:12:46 +00002503
2504 bgp = vty->index;
2505
2506 peer = peer_and_group_lookup_vty (vty, peer_str);
2507 if ( ! peer )
2508 return CMD_WARNING;
2509
2510 /* If it is already a RS-Client, don't do anything. */
2511 if ( CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) )
2512 return CMD_SUCCESS;
2513
2514 if ( ! peer_rsclient_active (peer) )
paul200df112005-06-01 11:17:05 +00002515 {
2516 peer = peer_lock (peer); /* rsclient peer list reference */
2517 listnode_add_sort (bgp->rsclient, peer);
Chris Caputo228da422009-07-18 05:44:03 +00002518 locked_and_added = 1;
paul200df112005-06-01 11:17:05 +00002519 }
paulfee0f4c2004-09-13 05:12:46 +00002520
2521 ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2522 if (ret < 0)
Chris Caputo228da422009-07-18 05:44:03 +00002523 {
2524 if (locked_and_added)
2525 {
2526 listnode_delete (bgp->rsclient, peer);
2527 peer_unlock (peer); /* rsclient peer list reference */
2528 }
2529
2530 return bgp_vty_return (vty, ret);
2531 }
paulfee0f4c2004-09-13 05:12:46 +00002532
Paul Jakma64e580a2006-02-21 01:09:01 +00002533 peer->rib[afi][safi] = bgp_table_init (afi, safi);
paulfee0f4c2004-09-13 05:12:46 +00002534 peer->rib[afi][safi]->type = BGP_TABLE_RSCLIENT;
Chris Caputo228da422009-07-18 05:44:03 +00002535 /* RIB peer reference. Released when table is free'd in bgp_table_free. */
2536 peer->rib[afi][safi]->owner = peer_lock (peer);
paulfee0f4c2004-09-13 05:12:46 +00002537
2538 /* Check for existing 'network' and 'redistribute' routes. */
2539 bgp_check_local_routes_rsclient (peer, afi, safi);
2540
2541 /* Check for routes for peers configured with 'soft-reconfiguration'. */
2542 bgp_soft_reconfig_rsclient (peer, afi, safi);
2543
2544 if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP))
2545 {
2546 group = peer->group;
2547 gfilter = &peer->filter[afi][safi];
2548
paul1eb8ef22005-04-07 07:30:20 +00002549 for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00002550 {
2551 pfilter = &peer->filter[afi][safi];
2552
2553 /* Members of a non-RS-Client group should not be RS-Clients, as that
2554 is checked when the become part of the peer-group */
2555 ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2556 if (ret < 0)
2557 return bgp_vty_return (vty, ret);
2558
2559 /* Make peer's RIB point to group's RIB. */
2560 peer->rib[afi][safi] = group->conf->rib[afi][safi];
2561
2562 /* Import policy. */
2563 if (pfilter->map[RMAP_IMPORT].name)
2564 free (pfilter->map[RMAP_IMPORT].name);
2565 if (gfilter->map[RMAP_IMPORT].name)
2566 {
2567 pfilter->map[RMAP_IMPORT].name = strdup (gfilter->map[RMAP_IMPORT].name);
2568 pfilter->map[RMAP_IMPORT].map = gfilter->map[RMAP_IMPORT].map;
2569 }
2570 else
2571 {
2572 pfilter->map[RMAP_IMPORT].name = NULL;
2573 pfilter->map[RMAP_IMPORT].map =NULL;
2574 }
2575
2576 /* Export policy. */
2577 if (gfilter->map[RMAP_EXPORT].name && ! pfilter->map[RMAP_EXPORT].name)
2578 {
2579 pfilter->map[RMAP_EXPORT].name = strdup (gfilter->map[RMAP_EXPORT].name);
2580 pfilter->map[RMAP_EXPORT].map = gfilter->map[RMAP_EXPORT].map;
2581 }
2582 }
2583 }
2584 return CMD_SUCCESS;
2585}
2586
paul94f2b392005-06-28 12:44:16 +00002587static int
paulfd79ac92004-10-13 05:06:08 +00002588peer_rsclient_unset_vty (struct vty *vty, const char *peer_str,
2589 int afi, int safi)
paulfee0f4c2004-09-13 05:12:46 +00002590{
2591 int ret;
2592 struct bgp *bgp;
2593 struct peer *peer;
2594 struct peer_group *group;
paul1eb8ef22005-04-07 07:30:20 +00002595 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00002596
2597 bgp = vty->index;
2598
2599 peer = peer_and_group_lookup_vty (vty, peer_str);
2600 if ( ! peer )
2601 return CMD_WARNING;
2602
2603 /* If it is not a RS-Client, don't do anything. */
2604 if ( ! CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) )
2605 return CMD_SUCCESS;
2606
2607 if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP))
2608 {
2609 group = peer->group;
2610
paul1eb8ef22005-04-07 07:30:20 +00002611 for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00002612 {
2613 ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2614 if (ret < 0)
2615 return bgp_vty_return (vty, ret);
2616
2617 peer->rib[afi][safi] = NULL;
2618 }
2619
2620 peer = group->conf;
2621 }
2622
2623 ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2624 if (ret < 0)
2625 return bgp_vty_return (vty, ret);
2626
2627 if ( ! peer_rsclient_active (peer) )
paul200df112005-06-01 11:17:05 +00002628 {
Chris Caputo228da422009-07-18 05:44:03 +00002629 bgp_clear_route (peer, afi, safi, BGP_CLEAR_ROUTE_MY_RSCLIENT);
paul200df112005-06-01 11:17:05 +00002630 listnode_delete (bgp->rsclient, peer);
Chris Caputo228da422009-07-18 05:44:03 +00002631 peer_unlock (peer); /* peer bgp rsclient reference */
paul200df112005-06-01 11:17:05 +00002632 }
paulfee0f4c2004-09-13 05:12:46 +00002633
Paul Jakmab608d5b2008-07-02 02:12:07 +00002634 bgp_table_finish (&peer->rib[bgp_node_afi(vty)][bgp_node_safi(vty)]);
paulfee0f4c2004-09-13 05:12:46 +00002635
2636 return CMD_SUCCESS;
2637}
David Lamparter6b0655a2014-06-04 06:53:35 +02002638
paul718e3742002-12-13 20:15:29 +00002639/* neighbor route-server-client. */
2640DEFUN (neighbor_route_server_client,
2641 neighbor_route_server_client_cmd,
2642 NEIGHBOR_CMD2 "route-server-client",
2643 NEIGHBOR_STR
2644 NEIGHBOR_ADDR_STR2
2645 "Configure a neighbor as Route Server client\n")
2646{
paulfee0f4c2004-09-13 05:12:46 +00002647 return peer_rsclient_set_vty (vty, argv[0], bgp_node_afi(vty),
2648 bgp_node_safi(vty));
paul718e3742002-12-13 20:15:29 +00002649}
2650
2651DEFUN (no_neighbor_route_server_client,
2652 no_neighbor_route_server_client_cmd,
2653 NO_NEIGHBOR_CMD2 "route-server-client",
2654 NO_STR
2655 NEIGHBOR_STR
2656 NEIGHBOR_ADDR_STR2
2657 "Configure a neighbor as Route Server client\n")
2658{
paulfee0f4c2004-09-13 05:12:46 +00002659 return peer_rsclient_unset_vty (vty, argv[0], bgp_node_afi(vty),
2660 bgp_node_safi(vty));
2661}
David Lamparter6b0655a2014-06-04 06:53:35 +02002662
paulfee0f4c2004-09-13 05:12:46 +00002663DEFUN (neighbor_nexthop_local_unchanged,
2664 neighbor_nexthop_local_unchanged_cmd,
2665 NEIGHBOR_CMD2 "nexthop-local unchanged",
2666 NEIGHBOR_STR
2667 NEIGHBOR_ADDR_STR2
2668 "Configure treatment of outgoing link-local nexthop attribute\n"
2669 "Leave link-local nexthop unchanged for this peer\n")
2670{
2671 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2672 bgp_node_safi (vty),
2673 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED );
2674}
David Lamparter6b0655a2014-06-04 06:53:35 +02002675
paulfee0f4c2004-09-13 05:12:46 +00002676DEFUN (no_neighbor_nexthop_local_unchanged,
2677 no_neighbor_nexthop_local_unchanged_cmd,
2678 NO_NEIGHBOR_CMD2 "nexthop-local unchanged",
2679 NO_STR
2680 NEIGHBOR_STR
2681 NEIGHBOR_ADDR_STR2
2682 "Configure treatment of outgoing link-local-nexthop attribute\n"
2683 "Leave link-local nexthop unchanged for this peer\n")
2684{
paul718e3742002-12-13 20:15:29 +00002685 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2686 bgp_node_safi (vty),
paulfee0f4c2004-09-13 05:12:46 +00002687 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED );
paul718e3742002-12-13 20:15:29 +00002688}
David Lamparter6b0655a2014-06-04 06:53:35 +02002689
paul718e3742002-12-13 20:15:29 +00002690DEFUN (neighbor_attr_unchanged,
2691 neighbor_attr_unchanged_cmd,
2692 NEIGHBOR_CMD2 "attribute-unchanged",
2693 NEIGHBOR_STR
2694 NEIGHBOR_ADDR_STR2
2695 "BGP attribute is propagated unchanged to this neighbor\n")
2696{
2697 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2698 bgp_node_safi (vty),
2699 (PEER_FLAG_AS_PATH_UNCHANGED |
2700 PEER_FLAG_NEXTHOP_UNCHANGED |
2701 PEER_FLAG_MED_UNCHANGED));
2702}
2703
2704DEFUN (neighbor_attr_unchanged1,
2705 neighbor_attr_unchanged1_cmd,
2706 NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)",
2707 NEIGHBOR_STR
2708 NEIGHBOR_ADDR_STR2
2709 "BGP attribute is propagated unchanged to this neighbor\n"
2710 "As-path attribute\n"
2711 "Nexthop attribute\n"
2712 "Med attribute\n")
2713{
2714 u_int16_t flags = 0;
2715
2716 if (strncmp (argv[1], "as-path", 1) == 0)
2717 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2718 else if (strncmp (argv[1], "next-hop", 1) == 0)
2719 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2720 else if (strncmp (argv[1], "med", 1) == 0)
2721 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2722
2723 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2724 bgp_node_safi (vty), flags);
2725}
2726
2727DEFUN (neighbor_attr_unchanged2,
2728 neighbor_attr_unchanged2_cmd,
2729 NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)",
2730 NEIGHBOR_STR
2731 NEIGHBOR_ADDR_STR2
2732 "BGP attribute is propagated unchanged to this neighbor\n"
2733 "As-path attribute\n"
2734 "Nexthop attribute\n"
2735 "Med attribute\n")
2736{
2737 u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED;
2738
2739 if (strncmp (argv[1], "next-hop", 1) == 0)
2740 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2741 else if (strncmp (argv[1], "med", 1) == 0)
2742 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2743
2744 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2745 bgp_node_safi (vty), flags);
2746
2747}
2748
2749DEFUN (neighbor_attr_unchanged3,
2750 neighbor_attr_unchanged3_cmd,
2751 NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)",
2752 NEIGHBOR_STR
2753 NEIGHBOR_ADDR_STR2
2754 "BGP attribute is propagated unchanged to this neighbor\n"
2755 "Nexthop attribute\n"
2756 "As-path attribute\n"
2757 "Med attribute\n")
2758{
2759 u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED;
2760
2761 if (strncmp (argv[1], "as-path", 1) == 0)
2762 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2763 else if (strncmp (argv[1], "med", 1) == 0)
2764 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2765
2766 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2767 bgp_node_safi (vty), flags);
2768}
2769
2770DEFUN (neighbor_attr_unchanged4,
2771 neighbor_attr_unchanged4_cmd,
2772 NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)",
2773 NEIGHBOR_STR
2774 NEIGHBOR_ADDR_STR2
2775 "BGP attribute is propagated unchanged to this neighbor\n"
2776 "Med attribute\n"
2777 "As-path attribute\n"
2778 "Nexthop attribute\n")
2779{
2780 u_int16_t flags = PEER_FLAG_MED_UNCHANGED;
2781
2782 if (strncmp (argv[1], "as-path", 1) == 0)
2783 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2784 else if (strncmp (argv[1], "next-hop", 1) == 0)
2785 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2786
2787 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2788 bgp_node_safi (vty), flags);
2789}
2790
2791ALIAS (neighbor_attr_unchanged,
2792 neighbor_attr_unchanged5_cmd,
2793 NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med",
2794 NEIGHBOR_STR
2795 NEIGHBOR_ADDR_STR2
2796 "BGP attribute is propagated unchanged to this neighbor\n"
2797 "As-path attribute\n"
2798 "Nexthop attribute\n"
2799 "Med attribute\n")
2800
2801ALIAS (neighbor_attr_unchanged,
2802 neighbor_attr_unchanged6_cmd,
2803 NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop",
2804 NEIGHBOR_STR
2805 NEIGHBOR_ADDR_STR2
2806 "BGP attribute is propagated unchanged to this neighbor\n"
2807 "As-path attribute\n"
2808 "Med attribute\n"
2809 "Nexthop attribute\n")
2810
2811ALIAS (neighbor_attr_unchanged,
2812 neighbor_attr_unchanged7_cmd,
2813 NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path",
2814 NEIGHBOR_STR
2815 NEIGHBOR_ADDR_STR2
2816 "BGP attribute is propagated unchanged to this neighbor\n"
2817 "Nexthop attribute\n"
2818 "Med attribute\n"
2819 "As-path attribute\n")
2820
2821ALIAS (neighbor_attr_unchanged,
2822 neighbor_attr_unchanged8_cmd,
2823 NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med",
2824 NEIGHBOR_STR
2825 NEIGHBOR_ADDR_STR2
2826 "BGP attribute is propagated unchanged to this neighbor\n"
2827 "Nexthop attribute\n"
2828 "As-path attribute\n"
2829 "Med attribute\n")
2830
2831ALIAS (neighbor_attr_unchanged,
2832 neighbor_attr_unchanged9_cmd,
2833 NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path",
2834 NEIGHBOR_STR
2835 NEIGHBOR_ADDR_STR2
2836 "BGP attribute is propagated unchanged to this neighbor\n"
2837 "Med attribute\n"
2838 "Nexthop attribute\n"
2839 "As-path attribute\n")
2840
2841ALIAS (neighbor_attr_unchanged,
2842 neighbor_attr_unchanged10_cmd,
2843 NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop",
2844 NEIGHBOR_STR
2845 NEIGHBOR_ADDR_STR2
2846 "BGP attribute is propagated unchanged to this neighbor\n"
2847 "Med attribute\n"
2848 "As-path attribute\n"
2849 "Nexthop attribute\n")
2850
2851DEFUN (no_neighbor_attr_unchanged,
2852 no_neighbor_attr_unchanged_cmd,
2853 NO_NEIGHBOR_CMD2 "attribute-unchanged",
2854 NO_STR
2855 NEIGHBOR_STR
2856 NEIGHBOR_ADDR_STR2
2857 "BGP attribute is propagated unchanged to this neighbor\n")
2858{
2859 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2860 bgp_node_safi (vty),
2861 (PEER_FLAG_AS_PATH_UNCHANGED |
2862 PEER_FLAG_NEXTHOP_UNCHANGED |
2863 PEER_FLAG_MED_UNCHANGED));
2864}
2865
2866DEFUN (no_neighbor_attr_unchanged1,
2867 no_neighbor_attr_unchanged1_cmd,
2868 NO_NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)",
2869 NO_STR
2870 NEIGHBOR_STR
2871 NEIGHBOR_ADDR_STR2
2872 "BGP attribute is propagated unchanged to this neighbor\n"
2873 "As-path attribute\n"
2874 "Nexthop attribute\n"
2875 "Med attribute\n")
2876{
2877 u_int16_t flags = 0;
2878
2879 if (strncmp (argv[1], "as-path", 1) == 0)
2880 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2881 else if (strncmp (argv[1], "next-hop", 1) == 0)
2882 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2883 else if (strncmp (argv[1], "med", 1) == 0)
2884 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2885
2886 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2887 bgp_node_safi (vty), flags);
2888}
2889
2890DEFUN (no_neighbor_attr_unchanged2,
2891 no_neighbor_attr_unchanged2_cmd,
2892 NO_NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)",
2893 NO_STR
2894 NEIGHBOR_STR
2895 NEIGHBOR_ADDR_STR2
2896 "BGP attribute is propagated unchanged to this neighbor\n"
2897 "As-path attribute\n"
2898 "Nexthop attribute\n"
2899 "Med attribute\n")
2900{
2901 u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED;
2902
2903 if (strncmp (argv[1], "next-hop", 1) == 0)
2904 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2905 else if (strncmp (argv[1], "med", 1) == 0)
2906 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2907
2908 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2909 bgp_node_safi (vty), flags);
2910}
2911
2912DEFUN (no_neighbor_attr_unchanged3,
2913 no_neighbor_attr_unchanged3_cmd,
2914 NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)",
2915 NO_STR
2916 NEIGHBOR_STR
2917 NEIGHBOR_ADDR_STR2
2918 "BGP attribute is propagated unchanged to this neighbor\n"
2919 "Nexthop attribute\n"
2920 "As-path attribute\n"
2921 "Med attribute\n")
2922{
2923 u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED;
2924
2925 if (strncmp (argv[1], "as-path", 1) == 0)
2926 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2927 else if (strncmp (argv[1], "med", 1) == 0)
2928 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2929
2930 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2931 bgp_node_safi (vty), flags);
2932}
2933
2934DEFUN (no_neighbor_attr_unchanged4,
2935 no_neighbor_attr_unchanged4_cmd,
2936 NO_NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)",
2937 NO_STR
2938 NEIGHBOR_STR
2939 NEIGHBOR_ADDR_STR2
2940 "BGP attribute is propagated unchanged to this neighbor\n"
2941 "Med attribute\n"
2942 "As-path attribute\n"
2943 "Nexthop attribute\n")
2944{
2945 u_int16_t flags = PEER_FLAG_MED_UNCHANGED;
2946
2947 if (strncmp (argv[1], "as-path", 1) == 0)
2948 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2949 else if (strncmp (argv[1], "next-hop", 1) == 0)
2950 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2951
2952 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2953 bgp_node_safi (vty), flags);
2954}
2955
2956ALIAS (no_neighbor_attr_unchanged,
2957 no_neighbor_attr_unchanged5_cmd,
2958 NO_NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med",
2959 NO_STR
2960 NEIGHBOR_STR
2961 NEIGHBOR_ADDR_STR2
2962 "BGP attribute is propagated unchanged to this neighbor\n"
2963 "As-path attribute\n"
2964 "Nexthop attribute\n"
2965 "Med attribute\n")
2966
2967ALIAS (no_neighbor_attr_unchanged,
2968 no_neighbor_attr_unchanged6_cmd,
2969 NO_NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop",
2970 NO_STR
2971 NEIGHBOR_STR
2972 NEIGHBOR_ADDR_STR2
2973 "BGP attribute is propagated unchanged to this neighbor\n"
2974 "As-path attribute\n"
2975 "Med attribute\n"
2976 "Nexthop attribute\n")
2977
2978ALIAS (no_neighbor_attr_unchanged,
2979 no_neighbor_attr_unchanged7_cmd,
2980 NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path",
2981 NO_STR
2982 NEIGHBOR_STR
2983 NEIGHBOR_ADDR_STR2
2984 "BGP attribute is propagated unchanged to this neighbor\n"
2985 "Nexthop attribute\n"
2986 "Med attribute\n"
2987 "As-path attribute\n")
2988
2989ALIAS (no_neighbor_attr_unchanged,
2990 no_neighbor_attr_unchanged8_cmd,
2991 NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med",
2992 NO_STR
2993 NEIGHBOR_STR
2994 NEIGHBOR_ADDR_STR2
2995 "BGP attribute is propagated unchanged to this neighbor\n"
2996 "Nexthop attribute\n"
2997 "As-path attribute\n"
2998 "Med attribute\n")
2999
3000ALIAS (no_neighbor_attr_unchanged,
3001 no_neighbor_attr_unchanged9_cmd,
3002 NO_NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path",
3003 NO_STR
3004 NEIGHBOR_STR
3005 NEIGHBOR_ADDR_STR2
3006 "BGP attribute is propagated unchanged to this neighbor\n"
3007 "Med attribute\n"
3008 "Nexthop attribute\n"
3009 "As-path attribute\n")
3010
3011ALIAS (no_neighbor_attr_unchanged,
3012 no_neighbor_attr_unchanged10_cmd,
3013 NO_NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop",
3014 NO_STR
3015 NEIGHBOR_STR
3016 NEIGHBOR_ADDR_STR2
3017 "BGP attribute is propagated unchanged to this neighbor\n"
3018 "Med attribute\n"
3019 "As-path attribute\n"
3020 "Nexthop attribute\n")
3021
3022/* For old version Zebra compatibility. */
hassodd4c5932005-02-02 17:15:34 +00003023DEFUN_DEPRECATED (neighbor_transparent_as,
3024 neighbor_transparent_as_cmd,
3025 NEIGHBOR_CMD "transparent-as",
3026 NEIGHBOR_STR
3027 NEIGHBOR_ADDR_STR
3028 "Do not append my AS number even peer is EBGP peer\n")
paul718e3742002-12-13 20:15:29 +00003029{
3030 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
3031 bgp_node_safi (vty),
3032 PEER_FLAG_AS_PATH_UNCHANGED);
3033}
3034
hassodd4c5932005-02-02 17:15:34 +00003035DEFUN_DEPRECATED (neighbor_transparent_nexthop,
3036 neighbor_transparent_nexthop_cmd,
3037 NEIGHBOR_CMD "transparent-nexthop",
3038 NEIGHBOR_STR
3039 NEIGHBOR_ADDR_STR
3040 "Do not change nexthop even peer is EBGP peer\n")
paul718e3742002-12-13 20:15:29 +00003041{
3042 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
3043 bgp_node_safi (vty),
3044 PEER_FLAG_NEXTHOP_UNCHANGED);
3045}
David Lamparter6b0655a2014-06-04 06:53:35 +02003046
paul718e3742002-12-13 20:15:29 +00003047/* EBGP multihop configuration. */
paul94f2b392005-06-28 12:44:16 +00003048static int
paulfd79ac92004-10-13 05:06:08 +00003049peer_ebgp_multihop_set_vty (struct vty *vty, const char *ip_str,
3050 const char *ttl_str)
paul718e3742002-12-13 20:15:29 +00003051{
3052 struct peer *peer;
paulfd79ac92004-10-13 05:06:08 +00003053 unsigned int ttl;
paul718e3742002-12-13 20:15:29 +00003054
3055 peer = peer_and_group_lookup_vty (vty, ip_str);
3056 if (! peer)
3057 return CMD_WARNING;
3058
3059 if (! ttl_str)
3060 ttl = TTL_MAX;
3061 else
3062 VTY_GET_INTEGER_RANGE ("TTL", ttl, ttl_str, 1, 255);
3063
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00003064 return bgp_vty_return (vty, peer_ebgp_multihop_set (peer, ttl));
paul718e3742002-12-13 20:15:29 +00003065}
3066
paul94f2b392005-06-28 12:44:16 +00003067static int
paulfd79ac92004-10-13 05:06:08 +00003068peer_ebgp_multihop_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00003069{
3070 struct peer *peer;
3071
3072 peer = peer_and_group_lookup_vty (vty, ip_str);
3073 if (! peer)
3074 return CMD_WARNING;
3075
Timo Teräse3443a22016-10-19 16:02:34 +03003076 return bgp_vty_return (vty, peer_ebgp_multihop_set (peer, 0));
paul718e3742002-12-13 20:15:29 +00003077}
3078
3079/* neighbor ebgp-multihop. */
3080DEFUN (neighbor_ebgp_multihop,
3081 neighbor_ebgp_multihop_cmd,
3082 NEIGHBOR_CMD2 "ebgp-multihop",
3083 NEIGHBOR_STR
3084 NEIGHBOR_ADDR_STR2
3085 "Allow EBGP neighbors not on directly connected networks\n")
3086{
3087 return peer_ebgp_multihop_set_vty (vty, argv[0], NULL);
3088}
3089
3090DEFUN (neighbor_ebgp_multihop_ttl,
3091 neighbor_ebgp_multihop_ttl_cmd,
3092 NEIGHBOR_CMD2 "ebgp-multihop <1-255>",
3093 NEIGHBOR_STR
3094 NEIGHBOR_ADDR_STR2
3095 "Allow EBGP neighbors not on directly connected networks\n"
3096 "maximum hop count\n")
3097{
3098 return peer_ebgp_multihop_set_vty (vty, argv[0], argv[1]);
3099}
3100
3101DEFUN (no_neighbor_ebgp_multihop,
3102 no_neighbor_ebgp_multihop_cmd,
3103 NO_NEIGHBOR_CMD2 "ebgp-multihop",
3104 NO_STR
3105 NEIGHBOR_STR
3106 NEIGHBOR_ADDR_STR2
3107 "Allow EBGP neighbors not on directly connected networks\n")
3108{
3109 return peer_ebgp_multihop_unset_vty (vty, argv[0]);
3110}
3111
3112ALIAS (no_neighbor_ebgp_multihop,
3113 no_neighbor_ebgp_multihop_ttl_cmd,
3114 NO_NEIGHBOR_CMD2 "ebgp-multihop <1-255>",
3115 NO_STR
3116 NEIGHBOR_STR
3117 NEIGHBOR_ADDR_STR2
3118 "Allow EBGP neighbors not on directly connected networks\n"
3119 "maximum hop count\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003120
hasso6ffd2072005-02-02 14:50:11 +00003121/* disable-connected-check */
3122DEFUN (neighbor_disable_connected_check,
3123 neighbor_disable_connected_check_cmd,
3124 NEIGHBOR_CMD2 "disable-connected-check",
3125 NEIGHBOR_STR
3126 NEIGHBOR_ADDR_STR2
3127 "one-hop away EBGP peer using loopback address\n")
3128{
3129 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK);
3130}
3131
3132DEFUN (no_neighbor_disable_connected_check,
3133 no_neighbor_disable_connected_check_cmd,
3134 NO_NEIGHBOR_CMD2 "disable-connected-check",
3135 NO_STR
3136 NEIGHBOR_STR
3137 NEIGHBOR_ADDR_STR2
3138 "one-hop away EBGP peer using loopback address\n")
3139{
3140 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK);
3141}
3142
paul718e3742002-12-13 20:15:29 +00003143/* Enforce multihop. */
hasso6ffd2072005-02-02 14:50:11 +00003144ALIAS (neighbor_disable_connected_check,
paul718e3742002-12-13 20:15:29 +00003145 neighbor_enforce_multihop_cmd,
3146 NEIGHBOR_CMD2 "enforce-multihop",
3147 NEIGHBOR_STR
3148 NEIGHBOR_ADDR_STR2
paule8e19462006-01-19 20:16:55 +00003149 "Enforce EBGP neighbors perform multihop\n")
paul718e3742002-12-13 20:15:29 +00003150
hasso6ffd2072005-02-02 14:50:11 +00003151/* Enforce multihop. */
3152ALIAS (no_neighbor_disable_connected_check,
paul718e3742002-12-13 20:15:29 +00003153 no_neighbor_enforce_multihop_cmd,
3154 NO_NEIGHBOR_CMD2 "enforce-multihop",
3155 NO_STR
3156 NEIGHBOR_STR
3157 NEIGHBOR_ADDR_STR2
paule8e19462006-01-19 20:16:55 +00003158 "Enforce EBGP neighbors perform multihop\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003159
paul718e3742002-12-13 20:15:29 +00003160DEFUN (neighbor_description,
3161 neighbor_description_cmd,
3162 NEIGHBOR_CMD2 "description .LINE",
3163 NEIGHBOR_STR
3164 NEIGHBOR_ADDR_STR2
3165 "Neighbor specific description\n"
3166 "Up to 80 characters describing this neighbor\n")
3167{
3168 struct peer *peer;
paul718e3742002-12-13 20:15:29 +00003169 char *str;
paul718e3742002-12-13 20:15:29 +00003170
3171 peer = peer_and_group_lookup_vty (vty, argv[0]);
3172 if (! peer)
3173 return CMD_WARNING;
3174
3175 if (argc == 1)
3176 return CMD_SUCCESS;
3177
ajs3b8b1852005-01-29 18:19:13 +00003178 str = argv_concat(argv, argc, 1);
paul718e3742002-12-13 20:15:29 +00003179
3180 peer_description_set (peer, str);
3181
ajs3b8b1852005-01-29 18:19:13 +00003182 XFREE (MTYPE_TMP, str);
paul718e3742002-12-13 20:15:29 +00003183
3184 return CMD_SUCCESS;
3185}
3186
3187DEFUN (no_neighbor_description,
3188 no_neighbor_description_cmd,
3189 NO_NEIGHBOR_CMD2 "description",
3190 NO_STR
3191 NEIGHBOR_STR
3192 NEIGHBOR_ADDR_STR2
3193 "Neighbor specific description\n")
3194{
3195 struct peer *peer;
3196
3197 peer = peer_and_group_lookup_vty (vty, argv[0]);
3198 if (! peer)
3199 return CMD_WARNING;
3200
3201 peer_description_unset (peer);
3202
3203 return CMD_SUCCESS;
3204}
3205
3206ALIAS (no_neighbor_description,
3207 no_neighbor_description_val_cmd,
3208 NO_NEIGHBOR_CMD2 "description .LINE",
3209 NO_STR
3210 NEIGHBOR_STR
3211 NEIGHBOR_ADDR_STR2
3212 "Neighbor specific description\n"
3213 "Up to 80 characters describing this neighbor\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003214
paul718e3742002-12-13 20:15:29 +00003215/* Neighbor update-source. */
paul94f2b392005-06-28 12:44:16 +00003216static int
paulfd79ac92004-10-13 05:06:08 +00003217peer_update_source_vty (struct vty *vty, const char *peer_str,
3218 const char *source_str)
paul718e3742002-12-13 20:15:29 +00003219{
3220 struct peer *peer;
paul718e3742002-12-13 20:15:29 +00003221
3222 peer = peer_and_group_lookup_vty (vty, peer_str);
3223 if (! peer)
3224 return CMD_WARNING;
3225
3226 if (source_str)
3227 {
Jorge Boncompte [DTI2]c63b83f2012-04-10 16:57:24 +02003228 union sockunion su;
3229 int ret = str2sockunion (source_str, &su);
3230
3231 if (ret == 0)
3232 peer_update_source_addr_set (peer, &su);
paul718e3742002-12-13 20:15:29 +00003233 else
3234 peer_update_source_if_set (peer, source_str);
3235 }
3236 else
3237 peer_update_source_unset (peer);
3238
3239 return CMD_SUCCESS;
3240}
3241
Paul Jakma9a1a3312009-07-27 12:27:55 +01003242#define BGP_UPDATE_SOURCE_STR "(A.B.C.D|X:X::X:X|WORD)"
Paul Jakma369688c2006-05-23 22:27:55 +00003243#define BGP_UPDATE_SOURCE_HELP_STR \
3244 "IPv4 address\n" \
Paul Jakma9a1a3312009-07-27 12:27:55 +01003245 "IPv6 address\n" \
3246 "Interface name (requires zebra to be running)\n"
Paul Jakma369688c2006-05-23 22:27:55 +00003247
paul718e3742002-12-13 20:15:29 +00003248DEFUN (neighbor_update_source,
3249 neighbor_update_source_cmd,
Paul Jakma369688c2006-05-23 22:27:55 +00003250 NEIGHBOR_CMD2 "update-source " BGP_UPDATE_SOURCE_STR,
paul718e3742002-12-13 20:15:29 +00003251 NEIGHBOR_STR
3252 NEIGHBOR_ADDR_STR2
3253 "Source of routing updates\n"
Paul Jakma369688c2006-05-23 22:27:55 +00003254 BGP_UPDATE_SOURCE_HELP_STR)
paul718e3742002-12-13 20:15:29 +00003255{
3256 return peer_update_source_vty (vty, argv[0], argv[1]);
3257}
3258
3259DEFUN (no_neighbor_update_source,
3260 no_neighbor_update_source_cmd,
3261 NO_NEIGHBOR_CMD2 "update-source",
3262 NO_STR
3263 NEIGHBOR_STR
3264 NEIGHBOR_ADDR_STR2
Paul Jakma369688c2006-05-23 22:27:55 +00003265 "Source of routing updates\n")
paul718e3742002-12-13 20:15:29 +00003266{
3267 return peer_update_source_vty (vty, argv[0], NULL);
3268}
David Lamparter6b0655a2014-06-04 06:53:35 +02003269
paul94f2b392005-06-28 12:44:16 +00003270static int
paulfd79ac92004-10-13 05:06:08 +00003271peer_default_originate_set_vty (struct vty *vty, const char *peer_str,
3272 afi_t afi, safi_t safi,
3273 const char *rmap, int set)
paul718e3742002-12-13 20:15:29 +00003274{
3275 int ret;
3276 struct peer *peer;
3277
3278 peer = peer_and_group_lookup_vty (vty, peer_str);
3279 if (! peer)
3280 return CMD_WARNING;
3281
3282 if (set)
3283 ret = peer_default_originate_set (peer, afi, safi, rmap);
3284 else
3285 ret = peer_default_originate_unset (peer, afi, safi);
3286
3287 return bgp_vty_return (vty, ret);
3288}
3289
3290/* neighbor default-originate. */
3291DEFUN (neighbor_default_originate,
3292 neighbor_default_originate_cmd,
3293 NEIGHBOR_CMD2 "default-originate",
3294 NEIGHBOR_STR
3295 NEIGHBOR_ADDR_STR2
3296 "Originate default route to this neighbor\n")
3297{
3298 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
3299 bgp_node_safi (vty), NULL, 1);
3300}
3301
3302DEFUN (neighbor_default_originate_rmap,
3303 neighbor_default_originate_rmap_cmd,
3304 NEIGHBOR_CMD2 "default-originate route-map WORD",
3305 NEIGHBOR_STR
3306 NEIGHBOR_ADDR_STR2
3307 "Originate default route to this neighbor\n"
3308 "Route-map to specify criteria to originate default\n"
3309 "route-map name\n")
3310{
3311 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
3312 bgp_node_safi (vty), argv[1], 1);
3313}
3314
3315DEFUN (no_neighbor_default_originate,
3316 no_neighbor_default_originate_cmd,
3317 NO_NEIGHBOR_CMD2 "default-originate",
3318 NO_STR
3319 NEIGHBOR_STR
3320 NEIGHBOR_ADDR_STR2
3321 "Originate default route to this neighbor\n")
3322{
3323 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
3324 bgp_node_safi (vty), NULL, 0);
3325}
3326
3327ALIAS (no_neighbor_default_originate,
3328 no_neighbor_default_originate_rmap_cmd,
3329 NO_NEIGHBOR_CMD2 "default-originate route-map WORD",
3330 NO_STR
3331 NEIGHBOR_STR
3332 NEIGHBOR_ADDR_STR2
3333 "Originate default route to this neighbor\n"
3334 "Route-map to specify criteria to originate default\n"
3335 "route-map name\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003336
paul718e3742002-12-13 20:15:29 +00003337/* Set neighbor's BGP port. */
paul94f2b392005-06-28 12:44:16 +00003338static int
paulfd79ac92004-10-13 05:06:08 +00003339peer_port_vty (struct vty *vty, const char *ip_str, int afi,
3340 const char *port_str)
paul718e3742002-12-13 20:15:29 +00003341{
3342 struct peer *peer;
3343 u_int16_t port;
3344 struct servent *sp;
3345
3346 peer = peer_lookup_vty (vty, ip_str);
3347 if (! peer)
3348 return CMD_WARNING;
3349
3350 if (! port_str)
3351 {
3352 sp = getservbyname ("bgp", "tcp");
3353 port = (sp == NULL) ? BGP_PORT_DEFAULT : ntohs (sp->s_port);
3354 }
3355 else
3356 {
3357 VTY_GET_INTEGER("port", port, port_str);
3358 }
3359
3360 peer_port_set (peer, port);
3361
3362 return CMD_SUCCESS;
3363}
3364
hassof4184462005-02-01 20:13:16 +00003365/* Set specified peer's BGP port. */
paul718e3742002-12-13 20:15:29 +00003366DEFUN (neighbor_port,
3367 neighbor_port_cmd,
3368 NEIGHBOR_CMD "port <0-65535>",
3369 NEIGHBOR_STR
3370 NEIGHBOR_ADDR_STR
3371 "Neighbor's BGP port\n"
3372 "TCP port number\n")
3373{
3374 return peer_port_vty (vty, argv[0], AFI_IP, argv[1]);
3375}
3376
3377DEFUN (no_neighbor_port,
3378 no_neighbor_port_cmd,
3379 NO_NEIGHBOR_CMD "port",
3380 NO_STR
3381 NEIGHBOR_STR
3382 NEIGHBOR_ADDR_STR
3383 "Neighbor's BGP port\n")
3384{
3385 return peer_port_vty (vty, argv[0], AFI_IP, NULL);
3386}
3387
3388ALIAS (no_neighbor_port,
3389 no_neighbor_port_val_cmd,
3390 NO_NEIGHBOR_CMD "port <0-65535>",
3391 NO_STR
3392 NEIGHBOR_STR
3393 NEIGHBOR_ADDR_STR
3394 "Neighbor's BGP port\n"
3395 "TCP port number\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003396
paul718e3742002-12-13 20:15:29 +00003397/* neighbor weight. */
paul94f2b392005-06-28 12:44:16 +00003398static int
paulfd79ac92004-10-13 05:06:08 +00003399peer_weight_set_vty (struct vty *vty, const char *ip_str,
3400 const char *weight_str)
paul718e3742002-12-13 20:15:29 +00003401{
paul718e3742002-12-13 20:15:29 +00003402 struct peer *peer;
3403 unsigned long weight;
3404
3405 peer = peer_and_group_lookup_vty (vty, ip_str);
3406 if (! peer)
3407 return CMD_WARNING;
3408
3409 VTY_GET_INTEGER_RANGE("weight", weight, weight_str, 0, 65535);
3410
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003411 return bgp_vty_return (vty, peer_weight_set (peer, weight));
paul718e3742002-12-13 20:15:29 +00003412}
3413
paul94f2b392005-06-28 12:44:16 +00003414static int
paulfd79ac92004-10-13 05:06:08 +00003415peer_weight_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00003416{
3417 struct peer *peer;
3418
3419 peer = peer_and_group_lookup_vty (vty, ip_str);
3420 if (! peer)
3421 return CMD_WARNING;
3422
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003423 return bgp_vty_return (vty, peer_weight_unset (peer));
paul718e3742002-12-13 20:15:29 +00003424}
3425
3426DEFUN (neighbor_weight,
3427 neighbor_weight_cmd,
3428 NEIGHBOR_CMD2 "weight <0-65535>",
3429 NEIGHBOR_STR
3430 NEIGHBOR_ADDR_STR2
3431 "Set default weight for routes from this neighbor\n"
3432 "default weight\n")
3433{
3434 return peer_weight_set_vty (vty, argv[0], argv[1]);
3435}
3436
3437DEFUN (no_neighbor_weight,
3438 no_neighbor_weight_cmd,
3439 NO_NEIGHBOR_CMD2 "weight",
3440 NO_STR
3441 NEIGHBOR_STR
3442 NEIGHBOR_ADDR_STR2
3443 "Set default weight for routes from this neighbor\n")
3444{
3445 return peer_weight_unset_vty (vty, argv[0]);
3446}
3447
3448ALIAS (no_neighbor_weight,
3449 no_neighbor_weight_val_cmd,
3450 NO_NEIGHBOR_CMD2 "weight <0-65535>",
3451 NO_STR
3452 NEIGHBOR_STR
3453 NEIGHBOR_ADDR_STR2
3454 "Set default weight for routes from this neighbor\n"
3455 "default weight\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003456
paul718e3742002-12-13 20:15:29 +00003457/* Override capability negotiation. */
3458DEFUN (neighbor_override_capability,
3459 neighbor_override_capability_cmd,
3460 NEIGHBOR_CMD2 "override-capability",
3461 NEIGHBOR_STR
3462 NEIGHBOR_ADDR_STR2
3463 "Override capability negotiation result\n")
3464{
3465 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY);
3466}
3467
3468DEFUN (no_neighbor_override_capability,
3469 no_neighbor_override_capability_cmd,
3470 NO_NEIGHBOR_CMD2 "override-capability",
3471 NO_STR
3472 NEIGHBOR_STR
3473 NEIGHBOR_ADDR_STR2
3474 "Override capability negotiation result\n")
3475{
3476 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY);
3477}
David Lamparter6b0655a2014-06-04 06:53:35 +02003478
paul718e3742002-12-13 20:15:29 +00003479DEFUN (neighbor_strict_capability,
3480 neighbor_strict_capability_cmd,
3481 NEIGHBOR_CMD "strict-capability-match",
3482 NEIGHBOR_STR
3483 NEIGHBOR_ADDR_STR
3484 "Strict capability negotiation match\n")
3485{
3486 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH);
3487}
3488
3489DEFUN (no_neighbor_strict_capability,
3490 no_neighbor_strict_capability_cmd,
3491 NO_NEIGHBOR_CMD "strict-capability-match",
3492 NO_STR
3493 NEIGHBOR_STR
3494 NEIGHBOR_ADDR_STR
3495 "Strict capability negotiation match\n")
3496{
3497 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH);
3498}
David Lamparter6b0655a2014-06-04 06:53:35 +02003499
paul94f2b392005-06-28 12:44:16 +00003500static int
paulfd79ac92004-10-13 05:06:08 +00003501peer_timers_set_vty (struct vty *vty, const char *ip_str,
3502 const char *keep_str, const char *hold_str)
paul718e3742002-12-13 20:15:29 +00003503{
3504 int ret;
3505 struct peer *peer;
3506 u_int32_t keepalive;
3507 u_int32_t holdtime;
3508
3509 peer = peer_and_group_lookup_vty (vty, ip_str);
3510 if (! peer)
3511 return CMD_WARNING;
3512
3513 VTY_GET_INTEGER_RANGE ("Keepalive", keepalive, keep_str, 0, 65535);
3514 VTY_GET_INTEGER_RANGE ("Holdtime", holdtime, hold_str, 0, 65535);
3515
3516 ret = peer_timers_set (peer, keepalive, holdtime);
3517
3518 return bgp_vty_return (vty, ret);
3519}
David Lamparter6b0655a2014-06-04 06:53:35 +02003520
paul94f2b392005-06-28 12:44:16 +00003521static int
paulfd79ac92004-10-13 05:06:08 +00003522peer_timers_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00003523{
3524 int ret;
3525 struct peer *peer;
3526
3527 peer = peer_lookup_vty (vty, ip_str);
3528 if (! peer)
3529 return CMD_WARNING;
3530
3531 ret = peer_timers_unset (peer);
3532
3533 return bgp_vty_return (vty, ret);
3534}
3535
3536DEFUN (neighbor_timers,
3537 neighbor_timers_cmd,
3538 NEIGHBOR_CMD2 "timers <0-65535> <0-65535>",
3539 NEIGHBOR_STR
3540 NEIGHBOR_ADDR_STR2
3541 "BGP per neighbor timers\n"
3542 "Keepalive interval\n"
3543 "Holdtime\n")
3544{
3545 return peer_timers_set_vty (vty, argv[0], argv[1], argv[2]);
3546}
3547
3548DEFUN (no_neighbor_timers,
3549 no_neighbor_timers_cmd,
3550 NO_NEIGHBOR_CMD2 "timers",
3551 NO_STR
3552 NEIGHBOR_STR
3553 NEIGHBOR_ADDR_STR2
3554 "BGP per neighbor timers\n")
3555{
3556 return peer_timers_unset_vty (vty, argv[0]);
3557}
David Lamparter6b0655a2014-06-04 06:53:35 +02003558
paul94f2b392005-06-28 12:44:16 +00003559static int
paulfd79ac92004-10-13 05:06:08 +00003560peer_timers_connect_set_vty (struct vty *vty, const char *ip_str,
3561 const char *time_str)
paul718e3742002-12-13 20:15:29 +00003562{
paul718e3742002-12-13 20:15:29 +00003563 struct peer *peer;
3564 u_int32_t connect;
3565
Daniel Walton0d7435f2015-10-22 11:35:20 +03003566 peer = peer_and_group_lookup_vty (vty, ip_str);
paul718e3742002-12-13 20:15:29 +00003567 if (! peer)
3568 return CMD_WARNING;
3569
3570 VTY_GET_INTEGER_RANGE ("Connect time", connect, time_str, 0, 65535);
3571
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003572 return bgp_vty_return (vty, peer_timers_connect_set (peer, connect));
paul718e3742002-12-13 20:15:29 +00003573}
3574
paul94f2b392005-06-28 12:44:16 +00003575static int
paulfd79ac92004-10-13 05:06:08 +00003576peer_timers_connect_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00003577{
paul718e3742002-12-13 20:15:29 +00003578 struct peer *peer;
3579
3580 peer = peer_and_group_lookup_vty (vty, ip_str);
3581 if (! peer)
3582 return CMD_WARNING;
3583
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003584 return bgp_vty_return (vty, peer_timers_connect_unset (peer));
paul718e3742002-12-13 20:15:29 +00003585}
3586
3587DEFUN (neighbor_timers_connect,
3588 neighbor_timers_connect_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003589 NEIGHBOR_CMD2 "timers connect <1-65535>",
paul718e3742002-12-13 20:15:29 +00003590 NEIGHBOR_STR
Daniel Walton0d7435f2015-10-22 11:35:20 +03003591 NEIGHBOR_ADDR_STR2
paul718e3742002-12-13 20:15:29 +00003592 "BGP per neighbor timers\n"
3593 "BGP connect timer\n"
3594 "Connect timer\n")
3595{
3596 return peer_timers_connect_set_vty (vty, argv[0], argv[1]);
3597}
3598
3599DEFUN (no_neighbor_timers_connect,
3600 no_neighbor_timers_connect_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003601 NO_NEIGHBOR_CMD2 "timers connect",
paul718e3742002-12-13 20:15:29 +00003602 NO_STR
3603 NEIGHBOR_STR
Daniel Walton0d7435f2015-10-22 11:35:20 +03003604 NEIGHBOR_ADDR_STR2
paul718e3742002-12-13 20:15:29 +00003605 "BGP per neighbor timers\n"
3606 "BGP connect timer\n")
3607{
3608 return peer_timers_connect_unset_vty (vty, argv[0]);
3609}
3610
3611ALIAS (no_neighbor_timers_connect,
3612 no_neighbor_timers_connect_val_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003613 NO_NEIGHBOR_CMD2 "timers connect <1-65535>",
paul718e3742002-12-13 20:15:29 +00003614 NO_STR
3615 NEIGHBOR_STR
Daniel Walton0d7435f2015-10-22 11:35:20 +03003616 NEIGHBOR_ADDR_STR2
paul718e3742002-12-13 20:15:29 +00003617 "BGP per neighbor timers\n"
3618 "BGP connect timer\n"
3619 "Connect timer\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003620
paul94f2b392005-06-28 12:44:16 +00003621static int
paulfd79ac92004-10-13 05:06:08 +00003622peer_advertise_interval_vty (struct vty *vty, const char *ip_str,
3623 const char *time_str, int set)
paul718e3742002-12-13 20:15:29 +00003624{
3625 int ret;
3626 struct peer *peer;
3627 u_int32_t routeadv = 0;
3628
Daniel Walton0d7435f2015-10-22 11:35:20 +03003629 peer = peer_and_group_lookup_vty (vty, ip_str);
paul718e3742002-12-13 20:15:29 +00003630 if (! peer)
3631 return CMD_WARNING;
3632
3633 if (time_str)
3634 VTY_GET_INTEGER_RANGE ("advertise interval", routeadv, time_str, 0, 600);
3635
3636 if (set)
3637 ret = peer_advertise_interval_set (peer, routeadv);
3638 else
3639 ret = peer_advertise_interval_unset (peer);
3640
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003641 return bgp_vty_return (vty, ret);
paul718e3742002-12-13 20:15:29 +00003642}
3643
3644DEFUN (neighbor_advertise_interval,
3645 neighbor_advertise_interval_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003646 NEIGHBOR_CMD2 "advertisement-interval <0-600>",
paul718e3742002-12-13 20:15:29 +00003647 NEIGHBOR_STR
Daniel Walton0d7435f2015-10-22 11:35:20 +03003648 NEIGHBOR_ADDR_STR2
paul718e3742002-12-13 20:15:29 +00003649 "Minimum interval between sending BGP routing updates\n"
3650 "time in seconds\n")
3651{
3652 return peer_advertise_interval_vty (vty, argv[0], argv[1], 1);
3653}
3654
3655DEFUN (no_neighbor_advertise_interval,
3656 no_neighbor_advertise_interval_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003657 NO_NEIGHBOR_CMD2 "advertisement-interval",
paul718e3742002-12-13 20:15:29 +00003658 NO_STR
3659 NEIGHBOR_STR
Daniel Walton0d7435f2015-10-22 11:35:20 +03003660 NEIGHBOR_ADDR_STR2
paul718e3742002-12-13 20:15:29 +00003661 "Minimum interval between sending BGP routing updates\n")
3662{
3663 return peer_advertise_interval_vty (vty, argv[0], NULL, 0);
3664}
3665
3666ALIAS (no_neighbor_advertise_interval,
3667 no_neighbor_advertise_interval_val_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003668 NO_NEIGHBOR_CMD2 "advertisement-interval <0-600>",
paul718e3742002-12-13 20:15:29 +00003669 NO_STR
3670 NEIGHBOR_STR
Daniel Walton0d7435f2015-10-22 11:35:20 +03003671 NEIGHBOR_ADDR_STR2
paul718e3742002-12-13 20:15:29 +00003672 "Minimum interval between sending BGP routing updates\n"
3673 "time in seconds\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003674
paul718e3742002-12-13 20:15:29 +00003675/* neighbor interface */
paul94f2b392005-06-28 12:44:16 +00003676static int
paulfd79ac92004-10-13 05:06:08 +00003677peer_interface_vty (struct vty *vty, const char *ip_str, const char *str)
paul718e3742002-12-13 20:15:29 +00003678{
3679 int ret;
3680 struct peer *peer;
3681
3682 peer = peer_lookup_vty (vty, ip_str);
3683 if (! peer)
3684 return CMD_WARNING;
3685
3686 if (str)
3687 ret = peer_interface_set (peer, str);
3688 else
3689 ret = peer_interface_unset (peer);
3690
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003691 return bgp_vty_return (vty, ret);
paul718e3742002-12-13 20:15:29 +00003692}
3693
3694DEFUN (neighbor_interface,
3695 neighbor_interface_cmd,
3696 NEIGHBOR_CMD "interface WORD",
3697 NEIGHBOR_STR
3698 NEIGHBOR_ADDR_STR
3699 "Interface\n"
3700 "Interface name\n")
3701{
3702 return peer_interface_vty (vty, argv[0], argv[1]);
3703}
3704
3705DEFUN (no_neighbor_interface,
3706 no_neighbor_interface_cmd,
3707 NO_NEIGHBOR_CMD "interface WORD",
3708 NO_STR
3709 NEIGHBOR_STR
3710 NEIGHBOR_ADDR_STR
3711 "Interface\n"
3712 "Interface name\n")
3713{
3714 return peer_interface_vty (vty, argv[0], NULL);
3715}
David Lamparter6b0655a2014-06-04 06:53:35 +02003716
paul718e3742002-12-13 20:15:29 +00003717/* Set distribute list to the peer. */
paul94f2b392005-06-28 12:44:16 +00003718static int
paulfd79ac92004-10-13 05:06:08 +00003719peer_distribute_set_vty (struct vty *vty, const char *ip_str,
3720 afi_t afi, safi_t safi,
3721 const char *name_str, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003722{
3723 int ret;
3724 struct peer *peer;
3725 int direct = FILTER_IN;
3726
3727 peer = peer_and_group_lookup_vty (vty, ip_str);
3728 if (! peer)
3729 return CMD_WARNING;
3730
3731 /* Check filter direction. */
3732 if (strncmp (direct_str, "i", 1) == 0)
3733 direct = FILTER_IN;
3734 else if (strncmp (direct_str, "o", 1) == 0)
3735 direct = FILTER_OUT;
3736
3737 ret = peer_distribute_set (peer, afi, safi, direct, name_str);
3738
3739 return bgp_vty_return (vty, ret);
3740}
3741
paul94f2b392005-06-28 12:44:16 +00003742static int
paulfd79ac92004-10-13 05:06:08 +00003743peer_distribute_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
3744 safi_t safi, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003745{
3746 int ret;
3747 struct peer *peer;
3748 int direct = FILTER_IN;
3749
3750 peer = peer_and_group_lookup_vty (vty, ip_str);
3751 if (! peer)
3752 return CMD_WARNING;
3753
3754 /* Check filter direction. */
3755 if (strncmp (direct_str, "i", 1) == 0)
3756 direct = FILTER_IN;
3757 else if (strncmp (direct_str, "o", 1) == 0)
3758 direct = FILTER_OUT;
3759
3760 ret = peer_distribute_unset (peer, afi, safi, direct);
3761
3762 return bgp_vty_return (vty, ret);
3763}
3764
3765DEFUN (neighbor_distribute_list,
3766 neighbor_distribute_list_cmd,
3767 NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)",
3768 NEIGHBOR_STR
3769 NEIGHBOR_ADDR_STR2
3770 "Filter updates to/from this neighbor\n"
3771 "IP access-list number\n"
3772 "IP access-list number (expanded range)\n"
3773 "IP Access-list name\n"
3774 "Filter incoming updates\n"
3775 "Filter outgoing updates\n")
3776{
3777 return peer_distribute_set_vty (vty, argv[0], bgp_node_afi (vty),
3778 bgp_node_safi (vty), argv[1], argv[2]);
3779}
3780
3781DEFUN (no_neighbor_distribute_list,
3782 no_neighbor_distribute_list_cmd,
3783 NO_NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)",
3784 NO_STR
3785 NEIGHBOR_STR
3786 NEIGHBOR_ADDR_STR2
3787 "Filter updates to/from this neighbor\n"
3788 "IP access-list number\n"
3789 "IP access-list number (expanded range)\n"
3790 "IP Access-list name\n"
3791 "Filter incoming updates\n"
3792 "Filter outgoing updates\n")
3793{
3794 return peer_distribute_unset_vty (vty, argv[0], bgp_node_afi (vty),
3795 bgp_node_safi (vty), argv[2]);
3796}
David Lamparter6b0655a2014-06-04 06:53:35 +02003797
paul718e3742002-12-13 20:15:29 +00003798/* Set prefix list to the peer. */
paul94f2b392005-06-28 12:44:16 +00003799static int
paulfd79ac92004-10-13 05:06:08 +00003800peer_prefix_list_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
3801 safi_t safi, const char *name_str,
3802 const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003803{
3804 int ret;
3805 struct peer *peer;
3806 int direct = FILTER_IN;
3807
3808 peer = peer_and_group_lookup_vty (vty, ip_str);
3809 if (! peer)
3810 return CMD_WARNING;
3811
3812 /* Check filter direction. */
3813 if (strncmp (direct_str, "i", 1) == 0)
3814 direct = FILTER_IN;
3815 else if (strncmp (direct_str, "o", 1) == 0)
3816 direct = FILTER_OUT;
3817
3818 ret = peer_prefix_list_set (peer, afi, safi, direct, name_str);
3819
3820 return bgp_vty_return (vty, ret);
3821}
3822
paul94f2b392005-06-28 12:44:16 +00003823static int
paulfd79ac92004-10-13 05:06:08 +00003824peer_prefix_list_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
3825 safi_t safi, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003826{
3827 int ret;
3828 struct peer *peer;
3829 int direct = FILTER_IN;
3830
3831 peer = peer_and_group_lookup_vty (vty, ip_str);
3832 if (! peer)
3833 return CMD_WARNING;
3834
3835 /* Check filter direction. */
3836 if (strncmp (direct_str, "i", 1) == 0)
3837 direct = FILTER_IN;
3838 else if (strncmp (direct_str, "o", 1) == 0)
3839 direct = FILTER_OUT;
3840
3841 ret = peer_prefix_list_unset (peer, afi, safi, direct);
3842
3843 return bgp_vty_return (vty, ret);
3844}
3845
3846DEFUN (neighbor_prefix_list,
3847 neighbor_prefix_list_cmd,
3848 NEIGHBOR_CMD2 "prefix-list WORD (in|out)",
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_set_vty (vty, argv[0], bgp_node_afi (vty),
3857 bgp_node_safi (vty), argv[1], argv[2]);
3858}
3859
3860DEFUN (no_neighbor_prefix_list,
3861 no_neighbor_prefix_list_cmd,
3862 NO_NEIGHBOR_CMD2 "prefix-list WORD (in|out)",
3863 NO_STR
3864 NEIGHBOR_STR
3865 NEIGHBOR_ADDR_STR2
3866 "Filter updates to/from this neighbor\n"
3867 "Name of a prefix list\n"
3868 "Filter incoming updates\n"
3869 "Filter outgoing updates\n")
3870{
3871 return peer_prefix_list_unset_vty (vty, argv[0], bgp_node_afi (vty),
3872 bgp_node_safi (vty), argv[2]);
3873}
David Lamparter6b0655a2014-06-04 06:53:35 +02003874
paul94f2b392005-06-28 12:44:16 +00003875static int
paulfd79ac92004-10-13 05:06:08 +00003876peer_aslist_set_vty (struct vty *vty, const char *ip_str,
3877 afi_t afi, safi_t safi,
3878 const char *name_str, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003879{
3880 int ret;
3881 struct peer *peer;
3882 int direct = FILTER_IN;
3883
3884 peer = peer_and_group_lookup_vty (vty, ip_str);
3885 if (! peer)
3886 return CMD_WARNING;
3887
3888 /* Check filter direction. */
3889 if (strncmp (direct_str, "i", 1) == 0)
3890 direct = FILTER_IN;
3891 else if (strncmp (direct_str, "o", 1) == 0)
3892 direct = FILTER_OUT;
3893
3894 ret = peer_aslist_set (peer, afi, safi, direct, name_str);
3895
3896 return bgp_vty_return (vty, ret);
3897}
3898
paul94f2b392005-06-28 12:44:16 +00003899static int
paulfd79ac92004-10-13 05:06:08 +00003900peer_aslist_unset_vty (struct vty *vty, const char *ip_str,
3901 afi_t afi, safi_t safi,
3902 const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003903{
3904 int ret;
3905 struct peer *peer;
3906 int direct = FILTER_IN;
3907
3908 peer = peer_and_group_lookup_vty (vty, ip_str);
3909 if (! peer)
3910 return CMD_WARNING;
3911
3912 /* Check filter direction. */
3913 if (strncmp (direct_str, "i", 1) == 0)
3914 direct = FILTER_IN;
3915 else if (strncmp (direct_str, "o", 1) == 0)
3916 direct = FILTER_OUT;
3917
3918 ret = peer_aslist_unset (peer, afi, safi, direct);
3919
3920 return bgp_vty_return (vty, ret);
3921}
3922
3923DEFUN (neighbor_filter_list,
3924 neighbor_filter_list_cmd,
3925 NEIGHBOR_CMD2 "filter-list WORD (in|out)",
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_set_vty (vty, argv[0], bgp_node_afi (vty),
3934 bgp_node_safi (vty), argv[1], argv[2]);
3935}
3936
3937DEFUN (no_neighbor_filter_list,
3938 no_neighbor_filter_list_cmd,
3939 NO_NEIGHBOR_CMD2 "filter-list WORD (in|out)",
3940 NO_STR
3941 NEIGHBOR_STR
3942 NEIGHBOR_ADDR_STR2
3943 "Establish BGP filters\n"
3944 "AS path access-list name\n"
3945 "Filter incoming routes\n"
3946 "Filter outgoing routes\n")
3947{
3948 return peer_aslist_unset_vty (vty, argv[0], bgp_node_afi (vty),
3949 bgp_node_safi (vty), argv[2]);
3950}
David Lamparter6b0655a2014-06-04 06:53:35 +02003951
paul718e3742002-12-13 20:15:29 +00003952/* Set route-map to the peer. */
paul94f2b392005-06-28 12:44:16 +00003953static int
paulfd79ac92004-10-13 05:06:08 +00003954peer_route_map_set_vty (struct vty *vty, const char *ip_str,
3955 afi_t afi, safi_t safi,
3956 const char *name_str, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003957{
3958 int ret;
3959 struct peer *peer;
paulfee0f4c2004-09-13 05:12:46 +00003960 int direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003961
3962 peer = peer_and_group_lookup_vty (vty, ip_str);
3963 if (! peer)
3964 return CMD_WARNING;
3965
3966 /* Check filter direction. */
paulfee0f4c2004-09-13 05:12:46 +00003967 if (strncmp (direct_str, "in", 2) == 0)
3968 direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003969 else if (strncmp (direct_str, "o", 1) == 0)
paulfee0f4c2004-09-13 05:12:46 +00003970 direct = RMAP_OUT;
3971 else if (strncmp (direct_str, "im", 2) == 0)
3972 direct = RMAP_IMPORT;
3973 else if (strncmp (direct_str, "e", 1) == 0)
3974 direct = RMAP_EXPORT;
paul718e3742002-12-13 20:15:29 +00003975
3976 ret = peer_route_map_set (peer, afi, safi, direct, name_str);
3977
3978 return bgp_vty_return (vty, ret);
3979}
3980
paul94f2b392005-06-28 12:44:16 +00003981static int
paulfd79ac92004-10-13 05:06:08 +00003982peer_route_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
3983 safi_t safi, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003984{
3985 int ret;
3986 struct peer *peer;
paulfee0f4c2004-09-13 05:12:46 +00003987 int direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003988
3989 peer = peer_and_group_lookup_vty (vty, ip_str);
3990 if (! peer)
3991 return CMD_WARNING;
3992
3993 /* Check filter direction. */
paulfee0f4c2004-09-13 05:12:46 +00003994 if (strncmp (direct_str, "in", 2) == 0)
3995 direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003996 else if (strncmp (direct_str, "o", 1) == 0)
paulfee0f4c2004-09-13 05:12:46 +00003997 direct = RMAP_OUT;
3998 else if (strncmp (direct_str, "im", 2) == 0)
3999 direct = RMAP_IMPORT;
4000 else if (strncmp (direct_str, "e", 1) == 0)
4001 direct = RMAP_EXPORT;
paul718e3742002-12-13 20:15:29 +00004002
4003 ret = peer_route_map_unset (peer, afi, safi, direct);
4004
4005 return bgp_vty_return (vty, ret);
4006}
4007
4008DEFUN (neighbor_route_map,
4009 neighbor_route_map_cmd,
paulfee0f4c2004-09-13 05:12:46 +00004010 NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)",
paul718e3742002-12-13 20:15:29 +00004011 NEIGHBOR_STR
4012 NEIGHBOR_ADDR_STR2
4013 "Apply route map to neighbor\n"
4014 "Name of route map\n"
4015 "Apply map to incoming routes\n"
paulfee0f4c2004-09-13 05:12:46 +00004016 "Apply map to outbound routes\n"
4017 "Apply map to routes going into a Route-Server client's table\n"
4018 "Apply map to routes coming from a Route-Server client")
paul718e3742002-12-13 20:15:29 +00004019{
4020 return peer_route_map_set_vty (vty, argv[0], bgp_node_afi (vty),
4021 bgp_node_safi (vty), argv[1], argv[2]);
4022}
4023
4024DEFUN (no_neighbor_route_map,
4025 no_neighbor_route_map_cmd,
paulfee0f4c2004-09-13 05:12:46 +00004026 NO_NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)",
paul718e3742002-12-13 20:15:29 +00004027 NO_STR
4028 NEIGHBOR_STR
4029 NEIGHBOR_ADDR_STR2
4030 "Apply route map to neighbor\n"
4031 "Name of route map\n"
4032 "Apply map to incoming routes\n"
paulfee0f4c2004-09-13 05:12:46 +00004033 "Apply map to outbound routes\n"
4034 "Apply map to routes going into a Route-Server client's table\n"
4035 "Apply map to routes coming from a Route-Server client")
paul718e3742002-12-13 20:15:29 +00004036{
4037 return peer_route_map_unset_vty (vty, argv[0], bgp_node_afi (vty),
4038 bgp_node_safi (vty), argv[2]);
4039}
David Lamparter6b0655a2014-06-04 06:53:35 +02004040
paul718e3742002-12-13 20:15:29 +00004041/* Set unsuppress-map to the peer. */
paul94f2b392005-06-28 12:44:16 +00004042static int
paulfd79ac92004-10-13 05:06:08 +00004043peer_unsuppress_map_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
4044 safi_t safi, const char *name_str)
paul718e3742002-12-13 20:15:29 +00004045{
4046 int ret;
4047 struct peer *peer;
4048
4049 peer = peer_and_group_lookup_vty (vty, ip_str);
4050 if (! peer)
4051 return CMD_WARNING;
4052
4053 ret = peer_unsuppress_map_set (peer, afi, safi, name_str);
4054
4055 return bgp_vty_return (vty, ret);
4056}
4057
4058/* Unset route-map from the peer. */
paul94f2b392005-06-28 12:44:16 +00004059static int
paulfd79ac92004-10-13 05:06:08 +00004060peer_unsuppress_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
paul718e3742002-12-13 20:15:29 +00004061 safi_t safi)
4062{
4063 int ret;
4064 struct peer *peer;
4065
4066 peer = peer_and_group_lookup_vty (vty, ip_str);
4067 if (! peer)
4068 return CMD_WARNING;
4069
4070 ret = peer_unsuppress_map_unset (peer, afi, safi);
4071
4072 return bgp_vty_return (vty, ret);
4073}
4074
4075DEFUN (neighbor_unsuppress_map,
4076 neighbor_unsuppress_map_cmd,
4077 NEIGHBOR_CMD2 "unsuppress-map WORD",
4078 NEIGHBOR_STR
4079 NEIGHBOR_ADDR_STR2
4080 "Route-map to selectively unsuppress suppressed routes\n"
4081 "Name of route map\n")
4082{
4083 return peer_unsuppress_map_set_vty (vty, argv[0], bgp_node_afi (vty),
4084 bgp_node_safi (vty), argv[1]);
4085}
4086
4087DEFUN (no_neighbor_unsuppress_map,
4088 no_neighbor_unsuppress_map_cmd,
4089 NO_NEIGHBOR_CMD2 "unsuppress-map WORD",
4090 NO_STR
4091 NEIGHBOR_STR
4092 NEIGHBOR_ADDR_STR2
4093 "Route-map to selectively unsuppress suppressed routes\n"
4094 "Name of route map\n")
4095{
4096 return peer_unsuppress_map_unset_vty (vty, argv[0], bgp_node_afi (vty),
4097 bgp_node_safi (vty));
4098}
David Lamparter6b0655a2014-06-04 06:53:35 +02004099
paul94f2b392005-06-28 12:44:16 +00004100static int
paulfd79ac92004-10-13 05:06:08 +00004101peer_maximum_prefix_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
4102 safi_t safi, const char *num_str,
hasso0a486e52005-02-01 20:57:17 +00004103 const char *threshold_str, int warning,
4104 const char *restart_str)
paul718e3742002-12-13 20:15:29 +00004105{
4106 int ret;
4107 struct peer *peer;
4108 u_int32_t max;
hassoe0701b72004-05-20 09:19:34 +00004109 u_char threshold;
hasso0a486e52005-02-01 20:57:17 +00004110 u_int16_t restart;
paul718e3742002-12-13 20:15:29 +00004111
4112 peer = peer_and_group_lookup_vty (vty, ip_str);
4113 if (! peer)
4114 return CMD_WARNING;
4115
Denis Ovsienkoe6ec1c32011-09-10 21:50:53 +04004116 VTY_GET_INTEGER ("maximum number", max, num_str);
hassoe0701b72004-05-20 09:19:34 +00004117 if (threshold_str)
4118 threshold = atoi (threshold_str);
4119 else
4120 threshold = MAXIMUM_PREFIX_THRESHOLD_DEFAULT;
paul718e3742002-12-13 20:15:29 +00004121
hasso0a486e52005-02-01 20:57:17 +00004122 if (restart_str)
4123 restart = atoi (restart_str);
4124 else
4125 restart = 0;
4126
4127 ret = peer_maximum_prefix_set (peer, afi, safi, max, threshold, warning, restart);
paul718e3742002-12-13 20:15:29 +00004128
4129 return bgp_vty_return (vty, ret);
4130}
4131
paul94f2b392005-06-28 12:44:16 +00004132static int
paulfd79ac92004-10-13 05:06:08 +00004133peer_maximum_prefix_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
paul718e3742002-12-13 20:15:29 +00004134 safi_t safi)
4135{
4136 int ret;
4137 struct peer *peer;
4138
4139 peer = peer_and_group_lookup_vty (vty, ip_str);
4140 if (! peer)
4141 return CMD_WARNING;
4142
4143 ret = peer_maximum_prefix_unset (peer, afi, safi);
4144
4145 return bgp_vty_return (vty, ret);
4146}
4147
4148/* Maximum number of prefix configuration. prefix count is different
4149 for each peer configuration. So this configuration can be set for
4150 each peer configuration. */
4151DEFUN (neighbor_maximum_prefix,
4152 neighbor_maximum_prefix_cmd,
4153 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>",
4154 NEIGHBOR_STR
4155 NEIGHBOR_ADDR_STR2
4156 "Maximum number of prefix accept from this peer\n"
4157 "maximum no. of prefix limit\n")
4158{
4159 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00004160 bgp_node_safi (vty), argv[1], NULL, 0,
4161 NULL);
paul718e3742002-12-13 20:15:29 +00004162}
4163
hassoe0701b72004-05-20 09:19:34 +00004164DEFUN (neighbor_maximum_prefix_threshold,
4165 neighbor_maximum_prefix_threshold_cmd,
4166 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100>",
4167 NEIGHBOR_STR
4168 NEIGHBOR_ADDR_STR2
4169 "Maximum number of prefix accept from this peer\n"
4170 "maximum no. of prefix limit\n"
4171 "Threshold value (%) at which to generate a warning msg\n")
4172{
4173 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00004174 bgp_node_safi (vty), argv[1], argv[2], 0,
4175 NULL);
4176}
hassoe0701b72004-05-20 09:19:34 +00004177
paul718e3742002-12-13 20:15:29 +00004178DEFUN (neighbor_maximum_prefix_warning,
4179 neighbor_maximum_prefix_warning_cmd,
4180 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
4181 NEIGHBOR_STR
4182 NEIGHBOR_ADDR_STR2
4183 "Maximum number of prefix accept from this peer\n"
4184 "maximum no. of prefix limit\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], NULL, 1,
4189 NULL);
paul718e3742002-12-13 20:15:29 +00004190}
4191
hassoe0701b72004-05-20 09:19:34 +00004192DEFUN (neighbor_maximum_prefix_threshold_warning,
4193 neighbor_maximum_prefix_threshold_warning_cmd,
4194 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only",
4195 NEIGHBOR_STR
4196 NEIGHBOR_ADDR_STR2
4197 "Maximum number of prefix accept from this peer\n"
4198 "maximum no. of prefix limit\n"
4199 "Threshold value (%) at which to generate a warning msg\n"
4200 "Only give warning message when limit is exceeded\n")
4201{
4202 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00004203 bgp_node_safi (vty), argv[1], argv[2], 1, NULL);
4204}
4205
4206DEFUN (neighbor_maximum_prefix_restart,
4207 neighbor_maximum_prefix_restart_cmd,
4208 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>",
4209 NEIGHBOR_STR
4210 NEIGHBOR_ADDR_STR2
4211 "Maximum number of prefix accept from this peer\n"
4212 "maximum no. of prefix limit\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], NULL, 0, argv[2]);
4218}
4219
4220DEFUN (neighbor_maximum_prefix_threshold_restart,
4221 neighbor_maximum_prefix_threshold_restart_cmd,
4222 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>",
4223 NEIGHBOR_STR
4224 NEIGHBOR_ADDR_STR2
4225 "Maximum number of prefix accept from this peer\n"
4226 "maximum no. of prefix limit\n"
4227 "Threshold value (%) at which to generate a warning msg\n"
4228 "Restart bgp connection after limit is exceeded\n"
4229 "Restart interval in minutes")
4230{
4231 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
4232 bgp_node_safi (vty), argv[1], argv[2], 0, argv[3]);
4233}
hassoe0701b72004-05-20 09:19:34 +00004234
paul718e3742002-12-13 20:15:29 +00004235DEFUN (no_neighbor_maximum_prefix,
4236 no_neighbor_maximum_prefix_cmd,
4237 NO_NEIGHBOR_CMD2 "maximum-prefix",
4238 NO_STR
4239 NEIGHBOR_STR
4240 NEIGHBOR_ADDR_STR2
4241 "Maximum number of prefix accept from this peer\n")
4242{
4243 return peer_maximum_prefix_unset_vty (vty, argv[0], bgp_node_afi (vty),
4244 bgp_node_safi (vty));
4245}
4246
4247ALIAS (no_neighbor_maximum_prefix,
4248 no_neighbor_maximum_prefix_val_cmd,
4249 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>",
4250 NO_STR
4251 NEIGHBOR_STR
4252 NEIGHBOR_ADDR_STR2
4253 "Maximum number of prefix accept from this peer\n"
4254 "maximum no. of prefix limit\n")
4255
4256ALIAS (no_neighbor_maximum_prefix,
hasso0a486e52005-02-01 20:57:17 +00004257 no_neighbor_maximum_prefix_threshold_cmd,
4258 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
4259 NO_STR
4260 NEIGHBOR_STR
4261 NEIGHBOR_ADDR_STR2
4262 "Maximum number of prefix accept from this peer\n"
4263 "maximum no. of prefix limit\n"
4264 "Threshold value (%) at which to generate a warning msg\n")
4265
4266ALIAS (no_neighbor_maximum_prefix,
4267 no_neighbor_maximum_prefix_warning_cmd,
4268 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
4269 NO_STR
4270 NEIGHBOR_STR
4271 NEIGHBOR_ADDR_STR2
4272 "Maximum number of prefix accept from this peer\n"
4273 "maximum no. of prefix limit\n"
paule8e19462006-01-19 20:16:55 +00004274 "Only give warning message when limit is exceeded\n")
hasso0a486e52005-02-01 20:57:17 +00004275
4276ALIAS (no_neighbor_maximum_prefix,
4277 no_neighbor_maximum_prefix_threshold_warning_cmd,
hassoe0701b72004-05-20 09:19:34 +00004278 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only",
4279 NO_STR
4280 NEIGHBOR_STR
4281 NEIGHBOR_ADDR_STR2
4282 "Maximum number of prefix accept from this peer\n"
4283 "maximum no. of prefix limit\n"
4284 "Threshold value (%) at which to generate a warning msg\n"
paule8e19462006-01-19 20:16:55 +00004285 "Only give warning message when limit is exceeded\n")
hassoe0701b72004-05-20 09:19:34 +00004286
4287ALIAS (no_neighbor_maximum_prefix,
hasso0a486e52005-02-01 20:57:17 +00004288 no_neighbor_maximum_prefix_restart_cmd,
4289 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>",
paul718e3742002-12-13 20:15:29 +00004290 NO_STR
4291 NEIGHBOR_STR
4292 NEIGHBOR_ADDR_STR2
4293 "Maximum number of prefix accept from this peer\n"
4294 "maximum no. of prefix limit\n"
hasso0a486e52005-02-01 20:57:17 +00004295 "Restart bgp connection after limit is exceeded\n"
4296 "Restart interval in minutes")
4297
4298ALIAS (no_neighbor_maximum_prefix,
4299 no_neighbor_maximum_prefix_threshold_restart_cmd,
4300 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>",
4301 NO_STR
4302 NEIGHBOR_STR
4303 NEIGHBOR_ADDR_STR2
4304 "Maximum number of prefix accept from this peer\n"
4305 "maximum no. of prefix limit\n"
4306 "Threshold value (%) at which to generate a warning msg\n"
4307 "Restart bgp connection after limit is exceeded\n"
4308 "Restart interval in minutes")
David Lamparter6b0655a2014-06-04 06:53:35 +02004309
paul718e3742002-12-13 20:15:29 +00004310/* "neighbor allowas-in" */
4311DEFUN (neighbor_allowas_in,
4312 neighbor_allowas_in_cmd,
4313 NEIGHBOR_CMD2 "allowas-in",
4314 NEIGHBOR_STR
4315 NEIGHBOR_ADDR_STR2
4316 "Accept as-path with my AS present in it\n")
4317{
4318 int ret;
4319 struct peer *peer;
paulfd79ac92004-10-13 05:06:08 +00004320 unsigned int allow_num;
paul718e3742002-12-13 20:15:29 +00004321
4322 peer = peer_and_group_lookup_vty (vty, argv[0]);
4323 if (! peer)
4324 return CMD_WARNING;
4325
4326 if (argc == 1)
4327 allow_num = 3;
4328 else
4329 VTY_GET_INTEGER_RANGE ("AS number", allow_num, argv[1], 1, 10);
4330
4331 ret = peer_allowas_in_set (peer, bgp_node_afi (vty), bgp_node_safi (vty),
4332 allow_num);
4333
4334 return bgp_vty_return (vty, ret);
4335}
4336
4337ALIAS (neighbor_allowas_in,
4338 neighbor_allowas_in_arg_cmd,
4339 NEIGHBOR_CMD2 "allowas-in <1-10>",
4340 NEIGHBOR_STR
4341 NEIGHBOR_ADDR_STR2
4342 "Accept as-path with my AS present in it\n"
4343 "Number of occurances of AS number\n")
4344
4345DEFUN (no_neighbor_allowas_in,
4346 no_neighbor_allowas_in_cmd,
4347 NO_NEIGHBOR_CMD2 "allowas-in",
4348 NO_STR
4349 NEIGHBOR_STR
4350 NEIGHBOR_ADDR_STR2
4351 "allow local ASN appears in aspath attribute\n")
4352{
4353 int ret;
4354 struct peer *peer;
4355
4356 peer = peer_and_group_lookup_vty (vty, argv[0]);
4357 if (! peer)
4358 return CMD_WARNING;
4359
4360 ret = peer_allowas_in_unset (peer, bgp_node_afi (vty), bgp_node_safi (vty));
4361
4362 return bgp_vty_return (vty, ret);
4363}
David Lamparter6b0655a2014-06-04 06:53:35 +02004364
Nick Hilliardfa411a22011-03-23 15:33:17 +00004365DEFUN (neighbor_ttl_security,
4366 neighbor_ttl_security_cmd,
4367 NEIGHBOR_CMD2 "ttl-security hops <1-254>",
4368 NEIGHBOR_STR
4369 NEIGHBOR_ADDR_STR2
4370 "Specify the maximum number of hops to the BGP peer\n")
4371{
4372 struct peer *peer;
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00004373 int gtsm_hops;
Nick Hilliardfa411a22011-03-23 15:33:17 +00004374
4375 peer = peer_and_group_lookup_vty (vty, argv[0]);
4376 if (! peer)
4377 return CMD_WARNING;
4378
4379 VTY_GET_INTEGER_RANGE ("", gtsm_hops, argv[1], 1, 254);
4380
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00004381 return bgp_vty_return (vty, peer_ttl_security_hops_set (peer, gtsm_hops));
Nick Hilliardfa411a22011-03-23 15:33:17 +00004382}
4383
4384DEFUN (no_neighbor_ttl_security,
4385 no_neighbor_ttl_security_cmd,
4386 NO_NEIGHBOR_CMD2 "ttl-security hops <1-254>",
4387 NO_STR
4388 NEIGHBOR_STR
4389 NEIGHBOR_ADDR_STR2
4390 "Specify the maximum number of hops to the BGP peer\n")
4391{
4392 struct peer *peer;
Nick Hilliardfa411a22011-03-23 15:33:17 +00004393
4394 peer = peer_and_group_lookup_vty (vty, argv[0]);
4395 if (! peer)
4396 return CMD_WARNING;
4397
Timo Teräse3443a22016-10-19 16:02:34 +03004398 return bgp_vty_return (vty, peer_ttl_security_hops_set (peer, 0));
Nick Hilliardfa411a22011-03-23 15:33:17 +00004399}
David Lamparter6b0655a2014-06-04 06:53:35 +02004400
paul718e3742002-12-13 20:15:29 +00004401/* Address family configuration. */
4402DEFUN (address_family_ipv4,
4403 address_family_ipv4_cmd,
4404 "address-family ipv4",
4405 "Enter Address Family command mode\n"
4406 "Address family\n")
4407{
4408 vty->node = BGP_IPV4_NODE;
4409 return CMD_SUCCESS;
4410}
4411
4412DEFUN (address_family_ipv4_safi,
4413 address_family_ipv4_safi_cmd,
4414 "address-family ipv4 (unicast|multicast)",
4415 "Enter Address Family command mode\n"
4416 "Address family\n"
4417 "Address Family modifier\n"
4418 "Address Family modifier\n")
4419{
4420 if (strncmp (argv[0], "m", 1) == 0)
4421 vty->node = BGP_IPV4M_NODE;
4422 else
4423 vty->node = BGP_IPV4_NODE;
4424
4425 return CMD_SUCCESS;
4426}
4427
paul25ffbdc2005-08-22 22:42:08 +00004428DEFUN (address_family_ipv6,
4429 address_family_ipv6_cmd,
4430 "address-family ipv6",
paul718e3742002-12-13 20:15:29 +00004431 "Enter Address Family command mode\n"
paul25ffbdc2005-08-22 22:42:08 +00004432 "Address family\n")
paul718e3742002-12-13 20:15:29 +00004433{
4434 vty->node = BGP_IPV6_NODE;
4435 return CMD_SUCCESS;
4436}
4437
paul25ffbdc2005-08-22 22:42:08 +00004438DEFUN (address_family_ipv6_safi,
4439 address_family_ipv6_safi_cmd,
4440 "address-family ipv6 (unicast|multicast)",
paul718e3742002-12-13 20:15:29 +00004441 "Enter Address Family command mode\n"
paul25ffbdc2005-08-22 22:42:08 +00004442 "Address family\n"
4443 "Address Family modifier\n"
4444 "Address Family modifier\n")
4445{
4446 if (strncmp (argv[0], "m", 1) == 0)
4447 vty->node = BGP_IPV6M_NODE;
4448 else
4449 vty->node = BGP_IPV6_NODE;
4450
4451 return CMD_SUCCESS;
4452}
paul718e3742002-12-13 20:15:29 +00004453
4454DEFUN (address_family_vpnv4,
4455 address_family_vpnv4_cmd,
4456 "address-family vpnv4",
4457 "Enter Address Family command mode\n"
4458 "Address family\n")
4459{
4460 vty->node = BGP_VPNV4_NODE;
4461 return CMD_SUCCESS;
4462}
4463
4464ALIAS (address_family_vpnv4,
4465 address_family_vpnv4_unicast_cmd,
4466 "address-family vpnv4 unicast",
4467 "Enter Address Family command mode\n"
4468 "Address family\n"
4469 "Address Family Modifier\n")
4470
Lou Berger13c378d2016-01-12 13:41:56 -05004471DEFUN (address_family_vpnv6,
4472 address_family_vpnv6_cmd,
4473 "address-family vpnv6",
4474 "Enter Address Family command mode\n"
4475 "Address family\n")
4476{
4477 vty->node = BGP_VPNV6_NODE;
4478 return CMD_SUCCESS;
4479}
4480
4481ALIAS (address_family_vpnv6,
4482 address_family_vpnv6_unicast_cmd,
4483 "address-family vpnv6 unicast",
4484 "Enter Address Family command mode\n"
4485 "Address family\n"
4486 "Address Family Modifier\n")
4487
Lou Bergera3fda882016-01-12 13:42:04 -05004488DEFUN (address_family_encap,
4489 address_family_encap_cmd,
4490 "address-family encap",
4491 "Enter Address Family command mode\n"
4492 "Address family\n")
4493{
4494 vty->node = BGP_ENCAP_NODE;
4495 return CMD_SUCCESS;
4496}
4497
4498ALIAS (address_family_encap,
4499 address_family_encapv4_cmd,
4500 "address-family encapv4",
4501 "Enter Address Family command mode\n"
4502 "Address family\n")
4503
4504DEFUN (address_family_encapv6,
4505 address_family_encapv6_cmd,
4506 "address-family encapv6",
4507 "Enter Address Family command mode\n"
4508 "Address family\n")
4509{
4510 vty->node = BGP_ENCAPV6_NODE;
4511 return CMD_SUCCESS;
4512}
4513
paul718e3742002-12-13 20:15:29 +00004514DEFUN (exit_address_family,
4515 exit_address_family_cmd,
4516 "exit-address-family",
4517 "Exit from Address Family configuration mode\n")
4518{
Lou Bergera3fda882016-01-12 13:42:04 -05004519 /* should match list in command.c:config_exit */
hassoa8a80d52005-04-09 13:07:47 +00004520 if (vty->node == BGP_IPV4_NODE
Lou Bergera3fda882016-01-12 13:42:04 -05004521 || vty->node == BGP_ENCAP_NODE
4522 || vty->node == BGP_ENCAPV6_NODE
hassoa8a80d52005-04-09 13:07:47 +00004523 || vty->node == BGP_IPV4M_NODE
paul718e3742002-12-13 20:15:29 +00004524 || vty->node == BGP_VPNV4_NODE
Lou Berger13c378d2016-01-12 13:41:56 -05004525 || vty->node == BGP_VPNV6_NODE
paul25ffbdc2005-08-22 22:42:08 +00004526 || vty->node == BGP_IPV6_NODE
4527 || vty->node == BGP_IPV6M_NODE)
paul718e3742002-12-13 20:15:29 +00004528 vty->node = BGP_NODE;
4529 return CMD_SUCCESS;
4530}
David Lamparter6b0655a2014-06-04 06:53:35 +02004531
paul718e3742002-12-13 20:15:29 +00004532/* BGP clear sort. */
4533enum clear_sort
4534{
4535 clear_all,
4536 clear_peer,
4537 clear_group,
4538 clear_external,
4539 clear_as
4540};
4541
paul94f2b392005-06-28 12:44:16 +00004542static void
paul718e3742002-12-13 20:15:29 +00004543bgp_clear_vty_error (struct vty *vty, struct peer *peer, afi_t afi,
4544 safi_t safi, int error)
4545{
4546 switch (error)
4547 {
4548 case BGP_ERR_AF_UNCONFIGURED:
4549 vty_out (vty,
4550 "%%BGP: Enable %s %s address family for the neighbor %s%s",
4551 afi == AFI_IP6 ? "IPv6" : safi == SAFI_MPLS_VPN ? "VPNv4" : "IPv4",
4552 safi == SAFI_MULTICAST ? "Multicast" : "Unicast",
4553 peer->host, VTY_NEWLINE);
4554 break;
4555 case BGP_ERR_SOFT_RECONFIG_UNCONFIGURED:
4556 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);
4557 break;
4558 default:
4559 break;
4560 }
4561}
4562
4563/* `clear ip bgp' functions. */
paul94f2b392005-06-28 12:44:16 +00004564static int
paul718e3742002-12-13 20:15:29 +00004565bgp_clear (struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi,
paulfd79ac92004-10-13 05:06:08 +00004566 enum clear_sort sort,enum bgp_clear_type stype, const char *arg)
paul718e3742002-12-13 20:15:29 +00004567{
4568 int ret;
4569 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00004570 struct listnode *node, *nnode;
paul718e3742002-12-13 20:15:29 +00004571
4572 /* Clear all neighbors. */
4573 if (sort == clear_all)
4574 {
paul1eb8ef22005-04-07 07:30:20 +00004575 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004576 {
4577 if (stype == BGP_CLEAR_SOFT_NONE)
4578 ret = peer_clear (peer);
4579 else
4580 ret = peer_clear_soft (peer, afi, safi, stype);
4581
4582 if (ret < 0)
4583 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4584 }
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004585 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004586 }
4587
4588 /* Clear specified neighbors. */
4589 if (sort == clear_peer)
4590 {
4591 union sockunion su;
4592 int ret;
4593
4594 /* Make sockunion for lookup. */
4595 ret = str2sockunion (arg, &su);
4596 if (ret < 0)
4597 {
4598 vty_out (vty, "Malformed address: %s%s", arg, VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004599 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00004600 }
4601 peer = peer_lookup (bgp, &su);
4602 if (! peer)
4603 {
4604 vty_out (vty, "%%BGP: Unknown neighbor - \"%s\"%s", arg, VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004605 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00004606 }
4607
4608 if (stype == BGP_CLEAR_SOFT_NONE)
4609 ret = peer_clear (peer);
4610 else
4611 ret = peer_clear_soft (peer, afi, safi, stype);
4612
4613 if (ret < 0)
4614 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4615
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004616 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004617 }
4618
4619 /* Clear all peer-group members. */
4620 if (sort == clear_group)
4621 {
4622 struct peer_group *group;
4623
4624 group = peer_group_lookup (bgp, arg);
4625 if (! group)
4626 {
4627 vty_out (vty, "%%BGP: No such peer-group %s%s", arg, VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004628 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00004629 }
4630
paul1eb8ef22005-04-07 07:30:20 +00004631 for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004632 {
4633 if (stype == BGP_CLEAR_SOFT_NONE)
4634 {
4635 ret = peer_clear (peer);
4636 continue;
4637 }
4638
4639 if (! peer->af_group[afi][safi])
4640 continue;
4641
4642 ret = peer_clear_soft (peer, afi, safi, stype);
4643
4644 if (ret < 0)
4645 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4646 }
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004647 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004648 }
4649
4650 if (sort == clear_external)
4651 {
paul1eb8ef22005-04-07 07:30:20 +00004652 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004653 {
Jorge Boncompte [DTI2]6d85b152012-05-07 16:52:54 +00004654 if (peer->sort == BGP_PEER_IBGP)
paul718e3742002-12-13 20:15:29 +00004655 continue;
4656
4657 if (stype == BGP_CLEAR_SOFT_NONE)
4658 ret = peer_clear (peer);
4659 else
4660 ret = peer_clear_soft (peer, afi, safi, stype);
4661
4662 if (ret < 0)
4663 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4664 }
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004665 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004666 }
4667
4668 if (sort == clear_as)
4669 {
4670 as_t as;
paul718e3742002-12-13 20:15:29 +00004671 int find = 0;
4672
Ulrich Weberbde12e32011-11-16 19:32:12 +04004673 VTY_GET_INTEGER_RANGE ("AS", as, arg, 1, BGP_AS4_MAX);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004674
paul1eb8ef22005-04-07 07:30:20 +00004675 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004676 {
4677 if (peer->as != as)
4678 continue;
4679
4680 find = 1;
4681 if (stype == BGP_CLEAR_SOFT_NONE)
4682 ret = peer_clear (peer);
4683 else
4684 ret = peer_clear_soft (peer, afi, safi, stype);
4685
4686 if (ret < 0)
4687 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4688 }
4689 if (! find)
4690 vty_out (vty, "%%BGP: No peer is configured with AS %s%s", arg,
4691 VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004692 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004693 }
4694
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004695 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004696}
4697
Daniel Walton325fcfb2015-05-19 17:58:10 -07004698/* Recalculate bestpath and re-advertise a prefix */
4699static int
4700bgp_clear_prefix (struct vty *vty, char *view_name, const char *ip_str,
4701 afi_t afi, safi_t safi, struct prefix_rd *prd)
4702{
4703 int ret;
4704 struct prefix match;
4705 struct bgp_node *rn;
4706 struct bgp_node *rm;
4707 struct bgp *bgp;
4708 struct bgp_table *table;
4709 struct bgp_table *rib;
4710
4711 /* BGP structure lookup. */
4712 if (view_name)
4713 {
4714 bgp = bgp_lookup_by_name (view_name);
4715 if (bgp == NULL)
4716 {
4717 vty_out (vty, "%% Can't find BGP view %s%s", view_name, VTY_NEWLINE);
4718 return CMD_WARNING;
4719 }
4720 }
4721 else
4722 {
4723 bgp = bgp_get_default ();
4724 if (bgp == NULL)
4725 {
4726 vty_out (vty, "%% No BGP process is configured%s", VTY_NEWLINE);
4727 return CMD_WARNING;
4728 }
4729 }
4730
4731 /* Check IP address argument. */
4732 ret = str2prefix (ip_str, &match);
4733 if (! ret)
4734 {
4735 vty_out (vty, "%% address is malformed%s", VTY_NEWLINE);
4736 return CMD_WARNING;
4737 }
4738
4739 match.family = afi2family (afi);
4740 rib = bgp->rib[afi][safi];
4741
4742 if (safi == SAFI_MPLS_VPN)
4743 {
4744 for (rn = bgp_table_top (rib); rn; rn = bgp_route_next (rn))
4745 {
4746 if (prd && memcmp (rn->p.u.val, prd->val, 8) != 0)
4747 continue;
4748
4749 if ((table = rn->info) != NULL)
4750 {
4751 if ((rm = bgp_node_match (table, &match)) != NULL)
4752 {
4753 if (rm->p.prefixlen == match.prefixlen)
4754 {
4755 SET_FLAG (rn->flags, BGP_NODE_USER_CLEAR);
4756 bgp_process (bgp, rm, afi, safi);
4757 }
4758 bgp_unlock_node (rm);
4759 }
4760 }
4761 }
4762 }
4763 else
4764 {
4765 if ((rn = bgp_node_match (rib, &match)) != NULL)
4766 {
4767 if (rn->p.prefixlen == match.prefixlen)
4768 {
4769 SET_FLAG (rn->flags, BGP_NODE_USER_CLEAR);
4770 bgp_process (bgp, rn, afi, safi);
4771 }
4772 bgp_unlock_node (rn);
4773 }
4774 }
4775
4776 return CMD_SUCCESS;
4777}
4778
paul94f2b392005-06-28 12:44:16 +00004779static int
paulfd79ac92004-10-13 05:06:08 +00004780bgp_clear_vty (struct vty *vty, const char *name, afi_t afi, safi_t safi,
4781 enum clear_sort sort, enum bgp_clear_type stype,
4782 const char *arg)
paul718e3742002-12-13 20:15:29 +00004783{
paul718e3742002-12-13 20:15:29 +00004784 struct bgp *bgp;
4785
4786 /* BGP structure lookup. */
4787 if (name)
4788 {
4789 bgp = bgp_lookup_by_name (name);
4790 if (bgp == NULL)
4791 {
4792 vty_out (vty, "Can't find BGP view %s%s", name, VTY_NEWLINE);
4793 return CMD_WARNING;
4794 }
4795 }
4796 else
4797 {
4798 bgp = bgp_get_default ();
4799 if (bgp == NULL)
4800 {
4801 vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE);
4802 return CMD_WARNING;
4803 }
4804 }
4805
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004806 return bgp_clear (vty, bgp, afi, safi, sort, stype, arg);
paul718e3742002-12-13 20:15:29 +00004807}
4808
4809DEFUN (clear_ip_bgp_all,
4810 clear_ip_bgp_all_cmd,
4811 "clear ip bgp *",
4812 CLEAR_STR
4813 IP_STR
4814 BGP_STR
4815 "Clear all peers\n")
4816{
4817 if (argc == 1)
4818 return bgp_clear_vty (vty, argv[0], 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL);
4819
4820 return bgp_clear_vty (vty, NULL, 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL);
4821}
4822
4823ALIAS (clear_ip_bgp_all,
4824 clear_bgp_all_cmd,
4825 "clear bgp *",
4826 CLEAR_STR
4827 BGP_STR
4828 "Clear all peers\n")
4829
4830ALIAS (clear_ip_bgp_all,
4831 clear_bgp_ipv6_all_cmd,
4832 "clear bgp ipv6 *",
4833 CLEAR_STR
4834 BGP_STR
4835 "Address family\n"
4836 "Clear all peers\n")
4837
4838ALIAS (clear_ip_bgp_all,
4839 clear_ip_bgp_instance_all_cmd,
4840 "clear ip bgp view WORD *",
4841 CLEAR_STR
4842 IP_STR
4843 BGP_STR
4844 "BGP view\n"
4845 "view name\n"
4846 "Clear all peers\n")
4847
4848ALIAS (clear_ip_bgp_all,
4849 clear_bgp_instance_all_cmd,
4850 "clear bgp view WORD *",
4851 CLEAR_STR
4852 BGP_STR
4853 "BGP view\n"
4854 "view name\n"
4855 "Clear all peers\n")
4856
4857DEFUN (clear_ip_bgp_peer,
4858 clear_ip_bgp_peer_cmd,
4859 "clear ip bgp (A.B.C.D|X:X::X:X)",
4860 CLEAR_STR
4861 IP_STR
4862 BGP_STR
4863 "BGP neighbor IP address to clear\n"
4864 "BGP IPv6 neighbor to clear\n")
4865{
4866 return bgp_clear_vty (vty, NULL, 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[0]);
4867}
4868
4869ALIAS (clear_ip_bgp_peer,
4870 clear_bgp_peer_cmd,
4871 "clear bgp (A.B.C.D|X:X::X:X)",
4872 CLEAR_STR
4873 BGP_STR
4874 "BGP neighbor address to clear\n"
4875 "BGP IPv6 neighbor to clear\n")
4876
4877ALIAS (clear_ip_bgp_peer,
4878 clear_bgp_ipv6_peer_cmd,
4879 "clear bgp ipv6 (A.B.C.D|X:X::X:X)",
4880 CLEAR_STR
4881 BGP_STR
4882 "Address family\n"
4883 "BGP neighbor address to clear\n"
4884 "BGP IPv6 neighbor to clear\n")
4885
4886DEFUN (clear_ip_bgp_peer_group,
4887 clear_ip_bgp_peer_group_cmd,
4888 "clear ip bgp peer-group WORD",
4889 CLEAR_STR
4890 IP_STR
4891 BGP_STR
4892 "Clear all members of peer-group\n"
4893 "BGP peer-group name\n")
4894{
4895 return bgp_clear_vty (vty, NULL, 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[0]);
4896}
4897
4898ALIAS (clear_ip_bgp_peer_group,
4899 clear_bgp_peer_group_cmd,
4900 "clear bgp peer-group WORD",
4901 CLEAR_STR
4902 BGP_STR
4903 "Clear all members of peer-group\n"
4904 "BGP peer-group name\n")
4905
4906ALIAS (clear_ip_bgp_peer_group,
4907 clear_bgp_ipv6_peer_group_cmd,
4908 "clear bgp ipv6 peer-group WORD",
4909 CLEAR_STR
4910 BGP_STR
4911 "Address family\n"
4912 "Clear all members of peer-group\n"
4913 "BGP peer-group name\n")
4914
4915DEFUN (clear_ip_bgp_external,
4916 clear_ip_bgp_external_cmd,
4917 "clear ip bgp external",
4918 CLEAR_STR
4919 IP_STR
4920 BGP_STR
4921 "Clear all external peers\n")
4922{
4923 return bgp_clear_vty (vty, NULL, 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL);
4924}
4925
4926ALIAS (clear_ip_bgp_external,
4927 clear_bgp_external_cmd,
4928 "clear bgp external",
4929 CLEAR_STR
4930 BGP_STR
4931 "Clear all external peers\n")
4932
4933ALIAS (clear_ip_bgp_external,
4934 clear_bgp_ipv6_external_cmd,
4935 "clear bgp ipv6 external",
4936 CLEAR_STR
4937 BGP_STR
4938 "Address family\n"
4939 "Clear all external peers\n")
4940
Daniel Walton325fcfb2015-05-19 17:58:10 -07004941DEFUN (clear_ip_bgp_prefix,
4942 clear_ip_bgp_prefix_cmd,
4943 "clear ip bgp prefix A.B.C.D/M",
4944 CLEAR_STR
4945 IP_STR
4946 BGP_STR
4947 "Clear bestpath and re-advertise\n"
4948 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
4949{
4950 return bgp_clear_prefix (vty, NULL, argv[0], AFI_IP, SAFI_UNICAST, NULL);
4951}
4952
4953ALIAS (clear_ip_bgp_prefix,
4954 clear_bgp_prefix_cmd,
4955 "clear bgp prefix A.B.C.D/M",
4956 CLEAR_STR
4957 BGP_STR
4958 "Clear bestpath and re-advertise\n"
4959 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
4960
4961
paul718e3742002-12-13 20:15:29 +00004962DEFUN (clear_ip_bgp_as,
4963 clear_ip_bgp_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00004964 "clear ip bgp " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00004965 CLEAR_STR
4966 IP_STR
4967 BGP_STR
4968 "Clear peers with the AS number\n")
4969{
4970 return bgp_clear_vty (vty, NULL, 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[0]);
4971}
4972
4973ALIAS (clear_ip_bgp_as,
4974 clear_bgp_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00004975 "clear bgp " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00004976 CLEAR_STR
4977 BGP_STR
4978 "Clear peers with the AS number\n")
4979
4980ALIAS (clear_ip_bgp_as,
4981 clear_bgp_ipv6_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00004982 "clear bgp ipv6 " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00004983 CLEAR_STR
4984 BGP_STR
4985 "Address family\n"
4986 "Clear peers with the AS number\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02004987
paul718e3742002-12-13 20:15:29 +00004988/* Outbound soft-reconfiguration */
4989DEFUN (clear_ip_bgp_all_soft_out,
4990 clear_ip_bgp_all_soft_out_cmd,
4991 "clear ip bgp * soft out",
4992 CLEAR_STR
4993 IP_STR
4994 BGP_STR
4995 "Clear all peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07004996 BGP_SOFT_STR
4997 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00004998{
4999 if (argc == 1)
5000 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5001 BGP_CLEAR_SOFT_OUT, NULL);
5002
5003 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5004 BGP_CLEAR_SOFT_OUT, NULL);
5005}
5006
5007ALIAS (clear_ip_bgp_all_soft_out,
5008 clear_ip_bgp_all_out_cmd,
5009 "clear ip bgp * out",
5010 CLEAR_STR
5011 IP_STR
5012 BGP_STR
5013 "Clear all peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005014 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005015
5016ALIAS (clear_ip_bgp_all_soft_out,
5017 clear_ip_bgp_instance_all_soft_out_cmd,
5018 "clear ip bgp view WORD * soft out",
5019 CLEAR_STR
5020 IP_STR
5021 BGP_STR
5022 "BGP view\n"
5023 "view name\n"
5024 "Clear all peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005025 BGP_SOFT_STR
5026 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005027
5028DEFUN (clear_ip_bgp_all_ipv4_soft_out,
5029 clear_ip_bgp_all_ipv4_soft_out_cmd,
5030 "clear ip bgp * ipv4 (unicast|multicast) soft out",
5031 CLEAR_STR
5032 IP_STR
5033 BGP_STR
5034 "Clear all peers\n"
5035 "Address family\n"
5036 "Address Family modifier\n"
5037 "Address Family modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005038 BGP_SOFT_STR
5039 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005040{
5041 if (strncmp (argv[0], "m", 1) == 0)
5042 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
5043 BGP_CLEAR_SOFT_OUT, NULL);
5044
5045 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5046 BGP_CLEAR_SOFT_OUT, NULL);
5047}
5048
5049ALIAS (clear_ip_bgp_all_ipv4_soft_out,
5050 clear_ip_bgp_all_ipv4_out_cmd,
5051 "clear ip bgp * ipv4 (unicast|multicast) out",
5052 CLEAR_STR
5053 IP_STR
5054 BGP_STR
5055 "Clear all peers\n"
5056 "Address family\n"
5057 "Address Family modifier\n"
5058 "Address Family modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005059 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005060
5061DEFUN (clear_ip_bgp_instance_all_ipv4_soft_out,
5062 clear_ip_bgp_instance_all_ipv4_soft_out_cmd,
5063 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft out",
5064 CLEAR_STR
5065 IP_STR
5066 BGP_STR
5067 "BGP view\n"
5068 "view name\n"
5069 "Clear all peers\n"
5070 "Address family\n"
5071 "Address Family modifier\n"
5072 "Address Family modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005073 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005074{
5075 if (strncmp (argv[1], "m", 1) == 0)
5076 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
5077 BGP_CLEAR_SOFT_OUT, NULL);
5078
5079 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5080 BGP_CLEAR_SOFT_OUT, NULL);
5081}
5082
5083DEFUN (clear_ip_bgp_all_vpnv4_soft_out,
5084 clear_ip_bgp_all_vpnv4_soft_out_cmd,
5085 "clear ip bgp * vpnv4 unicast soft out",
5086 CLEAR_STR
5087 IP_STR
5088 BGP_STR
5089 "Clear all peers\n"
5090 "Address family\n"
5091 "Address Family Modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005092 BGP_SOFT_STR
5093 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005094{
5095 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
5096 BGP_CLEAR_SOFT_OUT, NULL);
5097}
5098
5099ALIAS (clear_ip_bgp_all_vpnv4_soft_out,
5100 clear_ip_bgp_all_vpnv4_out_cmd,
5101 "clear ip bgp * vpnv4 unicast out",
5102 CLEAR_STR
5103 IP_STR
5104 BGP_STR
5105 "Clear all peers\n"
5106 "Address family\n"
5107 "Address Family Modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005108 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005109
Lou Berger298cc2f2016-01-12 13:42:02 -05005110DEFUN (clear_ip_bgp_all_encap_soft_out,
5111 clear_ip_bgp_all_encap_soft_out_cmd,
5112 "clear ip bgp * encap unicast soft out",
5113 CLEAR_STR
5114 IP_STR
5115 BGP_STR
5116 "Clear all peers\n"
5117 "Address family\n"
5118 "Address Family Modifier\n"
5119 "Soft reconfig\n"
5120 "Soft reconfig outbound update\n")
5121{
5122 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_all,
5123 BGP_CLEAR_SOFT_OUT, NULL);
5124}
5125
5126ALIAS (clear_ip_bgp_all_encap_soft_out,
5127 clear_ip_bgp_all_encap_out_cmd,
5128 "clear ip bgp * encap unicast out",
5129 CLEAR_STR
5130 IP_STR
5131 BGP_STR
5132 "Clear all peers\n"
5133 "Address family\n"
5134 "Address Family Modifier\n"
5135 "Soft reconfig outbound update\n")
5136
paul718e3742002-12-13 20:15:29 +00005137DEFUN (clear_bgp_all_soft_out,
5138 clear_bgp_all_soft_out_cmd,
5139 "clear bgp * soft out",
5140 CLEAR_STR
5141 BGP_STR
5142 "Clear all peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005143 BGP_SOFT_STR
5144 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005145{
5146 if (argc == 1)
5147 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
5148 BGP_CLEAR_SOFT_OUT, NULL);
5149
5150 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
5151 BGP_CLEAR_SOFT_OUT, NULL);
5152}
5153
5154ALIAS (clear_bgp_all_soft_out,
5155 clear_bgp_instance_all_soft_out_cmd,
5156 "clear bgp view WORD * soft out",
5157 CLEAR_STR
5158 BGP_STR
5159 "BGP view\n"
5160 "view name\n"
5161 "Clear all peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005162 BGP_SOFT_STR
5163 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005164
5165ALIAS (clear_bgp_all_soft_out,
5166 clear_bgp_all_out_cmd,
5167 "clear bgp * out",
5168 CLEAR_STR
5169 BGP_STR
5170 "Clear all peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005171 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005172
5173ALIAS (clear_bgp_all_soft_out,
5174 clear_bgp_ipv6_all_soft_out_cmd,
5175 "clear bgp ipv6 * soft out",
5176 CLEAR_STR
5177 BGP_STR
5178 "Address family\n"
5179 "Clear all peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005180 BGP_SOFT_STR
5181 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005182
5183ALIAS (clear_bgp_all_soft_out,
5184 clear_bgp_ipv6_all_out_cmd,
5185 "clear bgp ipv6 * out",
5186 CLEAR_STR
5187 BGP_STR
5188 "Address family\n"
5189 "Clear all peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005190 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005191
Daniel Walton325fcfb2015-05-19 17:58:10 -07005192DEFUN (clear_bgp_ipv6_safi_prefix,
5193 clear_bgp_ipv6_safi_prefix_cmd,
5194 "clear bgp ipv6 (unicast|multicast) prefix X:X::X:X/M",
5195 CLEAR_STR
5196 BGP_STR
5197 "Address family\n"
5198 "Address Family Modifier\n"
5199 "Clear bestpath and re-advertise\n"
5200 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
5201{
5202 if (strncmp (argv[0], "m", 1) == 0)
5203 return bgp_clear_prefix (vty, NULL, argv[1], AFI_IP6, SAFI_MULTICAST, NULL);
5204 else
5205 return bgp_clear_prefix (vty, NULL, argv[1], AFI_IP6, SAFI_UNICAST, NULL);
5206}
5207
paul718e3742002-12-13 20:15:29 +00005208DEFUN (clear_ip_bgp_peer_soft_out,
5209 clear_ip_bgp_peer_soft_out_cmd,
5210 "clear ip bgp A.B.C.D soft out",
5211 CLEAR_STR
5212 IP_STR
5213 BGP_STR
5214 "BGP neighbor address to clear\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005215 BGP_SOFT_STR
5216 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005217{
5218 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5219 BGP_CLEAR_SOFT_OUT, argv[0]);
5220}
5221
5222ALIAS (clear_ip_bgp_peer_soft_out,
5223 clear_ip_bgp_peer_out_cmd,
5224 "clear ip bgp A.B.C.D out",
5225 CLEAR_STR
5226 IP_STR
5227 BGP_STR
5228 "BGP neighbor address to clear\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005229 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005230
5231DEFUN (clear_ip_bgp_peer_ipv4_soft_out,
5232 clear_ip_bgp_peer_ipv4_soft_out_cmd,
5233 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft out",
5234 CLEAR_STR
5235 IP_STR
5236 BGP_STR
5237 "BGP neighbor address to clear\n"
5238 "Address family\n"
5239 "Address Family modifier\n"
5240 "Address Family modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005241 BGP_SOFT_STR
5242 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005243{
5244 if (strncmp (argv[1], "m", 1) == 0)
5245 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
5246 BGP_CLEAR_SOFT_OUT, argv[0]);
5247
5248 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5249 BGP_CLEAR_SOFT_OUT, argv[0]);
5250}
5251
5252ALIAS (clear_ip_bgp_peer_ipv4_soft_out,
5253 clear_ip_bgp_peer_ipv4_out_cmd,
5254 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) out",
5255 CLEAR_STR
5256 IP_STR
5257 BGP_STR
5258 "BGP neighbor address to clear\n"
5259 "Address family\n"
5260 "Address Family modifier\n"
5261 "Address Family modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005262 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005263
5264DEFUN (clear_ip_bgp_peer_vpnv4_soft_out,
5265 clear_ip_bgp_peer_vpnv4_soft_out_cmd,
5266 "clear ip bgp A.B.C.D vpnv4 unicast soft out",
5267 CLEAR_STR
5268 IP_STR
5269 BGP_STR
5270 "BGP neighbor address to clear\n"
5271 "Address family\n"
5272 "Address Family Modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005273 BGP_SOFT_STR
5274 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005275{
5276 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
5277 BGP_CLEAR_SOFT_OUT, argv[0]);
5278}
5279
5280ALIAS (clear_ip_bgp_peer_vpnv4_soft_out,
5281 clear_ip_bgp_peer_vpnv4_out_cmd,
5282 "clear ip bgp A.B.C.D vpnv4 unicast out",
5283 CLEAR_STR
5284 IP_STR
5285 BGP_STR
5286 "BGP neighbor address to clear\n"
5287 "Address family\n"
5288 "Address Family Modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005289 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005290
Lou Berger298cc2f2016-01-12 13:42:02 -05005291DEFUN (clear_ip_bgp_peer_encap_soft_out,
5292 clear_ip_bgp_peer_encap_soft_out_cmd,
5293 "clear ip bgp A.B.C.D encap unicast soft out",
5294 CLEAR_STR
5295 IP_STR
5296 BGP_STR
5297 "BGP neighbor address to clear\n"
5298 "Address family\n"
5299 "Address Family Modifier\n"
5300 "Soft reconfig\n"
5301 "Soft reconfig outbound update\n")
5302{
5303 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_peer,
5304 BGP_CLEAR_SOFT_OUT, argv[0]);
5305}
5306
5307ALIAS (clear_ip_bgp_peer_encap_soft_out,
5308 clear_ip_bgp_peer_encap_out_cmd,
5309 "clear ip bgp A.B.C.D encap unicast out",
5310 CLEAR_STR
5311 IP_STR
5312 BGP_STR
5313 "BGP neighbor address to clear\n"
5314 "Address family\n"
5315 "Address Family Modifier\n"
5316 "Soft reconfig outbound update\n")
5317
paul718e3742002-12-13 20:15:29 +00005318DEFUN (clear_bgp_peer_soft_out,
5319 clear_bgp_peer_soft_out_cmd,
5320 "clear bgp (A.B.C.D|X:X::X:X) soft out",
5321 CLEAR_STR
5322 BGP_STR
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{
5328 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
5329 BGP_CLEAR_SOFT_OUT, argv[0]);
5330}
5331
5332ALIAS (clear_bgp_peer_soft_out,
5333 clear_bgp_ipv6_peer_soft_out_cmd,
5334 "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft out",
5335 CLEAR_STR
5336 BGP_STR
5337 "Address family\n"
5338 "BGP neighbor address to clear\n"
5339 "BGP IPv6 neighbor to clear\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005340 BGP_SOFT_STR
5341 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005342
5343ALIAS (clear_bgp_peer_soft_out,
5344 clear_bgp_peer_out_cmd,
5345 "clear bgp (A.B.C.D|X:X::X:X) out",
5346 CLEAR_STR
5347 BGP_STR
5348 "BGP neighbor address to clear\n"
5349 "BGP IPv6 neighbor to clear\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005350 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005351
5352ALIAS (clear_bgp_peer_soft_out,
5353 clear_bgp_ipv6_peer_out_cmd,
5354 "clear bgp ipv6 (A.B.C.D|X:X::X:X) out",
5355 CLEAR_STR
5356 BGP_STR
5357 "Address family\n"
5358 "BGP neighbor address to clear\n"
5359 "BGP IPv6 neighbor to clear\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005360 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005361
5362DEFUN (clear_ip_bgp_peer_group_soft_out,
5363 clear_ip_bgp_peer_group_soft_out_cmd,
5364 "clear ip bgp peer-group WORD soft 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_STR
5371 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005372{
5373 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5374 BGP_CLEAR_SOFT_OUT, argv[0]);
5375}
5376
5377ALIAS (clear_ip_bgp_peer_group_soft_out,
5378 clear_ip_bgp_peer_group_out_cmd,
5379 "clear ip bgp peer-group WORD out",
5380 CLEAR_STR
5381 IP_STR
5382 BGP_STR
5383 "Clear all members of peer-group\n"
5384 "BGP peer-group name\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005385 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005386
5387DEFUN (clear_ip_bgp_peer_group_ipv4_soft_out,
5388 clear_ip_bgp_peer_group_ipv4_soft_out_cmd,
5389 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft out",
5390 CLEAR_STR
5391 IP_STR
5392 BGP_STR
5393 "Clear all members of peer-group\n"
5394 "BGP peer-group name\n"
5395 "Address family\n"
5396 "Address Family modifier\n"
5397 "Address Family modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005398 BGP_SOFT_STR
5399 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005400{
5401 if (strncmp (argv[1], "m", 1) == 0)
5402 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
5403 BGP_CLEAR_SOFT_OUT, argv[0]);
5404
5405 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5406 BGP_CLEAR_SOFT_OUT, argv[0]);
5407}
5408
5409ALIAS (clear_ip_bgp_peer_group_ipv4_soft_out,
5410 clear_ip_bgp_peer_group_ipv4_out_cmd,
5411 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) out",
5412 CLEAR_STR
5413 IP_STR
5414 BGP_STR
5415 "Clear all members of peer-group\n"
5416 "BGP peer-group name\n"
5417 "Address family\n"
5418 "Address Family modifier\n"
5419 "Address Family modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005420 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005421
5422DEFUN (clear_bgp_peer_group_soft_out,
5423 clear_bgp_peer_group_soft_out_cmd,
5424 "clear bgp peer-group WORD soft out",
5425 CLEAR_STR
5426 BGP_STR
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{
5432 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
5433 BGP_CLEAR_SOFT_OUT, argv[0]);
5434}
5435
5436ALIAS (clear_bgp_peer_group_soft_out,
5437 clear_bgp_ipv6_peer_group_soft_out_cmd,
5438 "clear bgp ipv6 peer-group WORD soft out",
5439 CLEAR_STR
5440 BGP_STR
5441 "Address family\n"
5442 "Clear all members of peer-group\n"
5443 "BGP peer-group name\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005444 BGP_SOFT_STR
5445 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005446
5447ALIAS (clear_bgp_peer_group_soft_out,
5448 clear_bgp_peer_group_out_cmd,
5449 "clear bgp peer-group WORD out",
5450 CLEAR_STR
5451 BGP_STR
5452 "Clear all members of peer-group\n"
5453 "BGP peer-group name\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005454 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005455
5456ALIAS (clear_bgp_peer_group_soft_out,
5457 clear_bgp_ipv6_peer_group_out_cmd,
5458 "clear bgp ipv6 peer-group WORD out",
5459 CLEAR_STR
5460 BGP_STR
5461 "Address family\n"
5462 "Clear all members of peer-group\n"
5463 "BGP peer-group name\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005464 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005465
5466DEFUN (clear_ip_bgp_external_soft_out,
5467 clear_ip_bgp_external_soft_out_cmd,
5468 "clear ip bgp external soft out",
5469 CLEAR_STR
5470 IP_STR
5471 BGP_STR
5472 "Clear all external peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005473 BGP_SOFT_STR
5474 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005475{
5476 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5477 BGP_CLEAR_SOFT_OUT, NULL);
5478}
5479
5480ALIAS (clear_ip_bgp_external_soft_out,
5481 clear_ip_bgp_external_out_cmd,
5482 "clear ip bgp external out",
5483 CLEAR_STR
5484 IP_STR
5485 BGP_STR
5486 "Clear all external peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005487 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005488
5489DEFUN (clear_ip_bgp_external_ipv4_soft_out,
5490 clear_ip_bgp_external_ipv4_soft_out_cmd,
5491 "clear ip bgp external ipv4 (unicast|multicast) soft out",
5492 CLEAR_STR
5493 IP_STR
5494 BGP_STR
5495 "Clear all external peers\n"
5496 "Address family\n"
5497 "Address Family modifier\n"
5498 "Address Family modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005499 BGP_SOFT_STR
5500 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005501{
5502 if (strncmp (argv[0], "m", 1) == 0)
5503 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
5504 BGP_CLEAR_SOFT_OUT, NULL);
5505
5506 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5507 BGP_CLEAR_SOFT_OUT, NULL);
5508}
5509
5510ALIAS (clear_ip_bgp_external_ipv4_soft_out,
5511 clear_ip_bgp_external_ipv4_out_cmd,
5512 "clear ip bgp external ipv4 (unicast|multicast) out",
5513 CLEAR_STR
5514 IP_STR
5515 BGP_STR
5516 "Clear all external peers\n"
5517 "Address family\n"
5518 "Address Family modifier\n"
5519 "Address Family modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005520 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005521
5522DEFUN (clear_bgp_external_soft_out,
5523 clear_bgp_external_soft_out_cmd,
5524 "clear bgp external soft out",
5525 CLEAR_STR
5526 BGP_STR
5527 "Clear all external peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005528 BGP_SOFT_STR
5529 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005530{
5531 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
5532 BGP_CLEAR_SOFT_OUT, NULL);
5533}
5534
5535ALIAS (clear_bgp_external_soft_out,
5536 clear_bgp_ipv6_external_soft_out_cmd,
5537 "clear bgp ipv6 external soft out",
5538 CLEAR_STR
5539 BGP_STR
5540 "Address family\n"
5541 "Clear all external peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005542 BGP_SOFT_STR
5543 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005544
5545ALIAS (clear_bgp_external_soft_out,
5546 clear_bgp_external_out_cmd,
5547 "clear bgp external out",
5548 CLEAR_STR
5549 BGP_STR
5550 "Clear all external peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005551 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005552
5553ALIAS (clear_bgp_external_soft_out,
5554 clear_bgp_ipv6_external_out_cmd,
5555 "clear bgp ipv6 external WORD out",
5556 CLEAR_STR
5557 BGP_STR
5558 "Address family\n"
5559 "Clear all external peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005560 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005561
5562DEFUN (clear_ip_bgp_as_soft_out,
5563 clear_ip_bgp_as_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005564 "clear ip bgp " CMD_AS_RANGE " soft out",
paul718e3742002-12-13 20:15:29 +00005565 CLEAR_STR
5566 IP_STR
5567 BGP_STR
5568 "Clear peers with the AS number\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005569 BGP_SOFT_STR
5570 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005571{
5572 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
5573 BGP_CLEAR_SOFT_OUT, argv[0]);
5574}
5575
5576ALIAS (clear_ip_bgp_as_soft_out,
5577 clear_ip_bgp_as_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005578 "clear ip bgp " CMD_AS_RANGE " out",
paul718e3742002-12-13 20:15:29 +00005579 CLEAR_STR
5580 IP_STR
5581 BGP_STR
5582 "Clear peers with the AS number\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005583 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005584
5585DEFUN (clear_ip_bgp_as_ipv4_soft_out,
5586 clear_ip_bgp_as_ipv4_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005587 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft out",
paul718e3742002-12-13 20:15:29 +00005588 CLEAR_STR
5589 IP_STR
5590 BGP_STR
5591 "Clear peers with the AS number\n"
5592 "Address family\n"
5593 "Address Family modifier\n"
5594 "Address Family modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005595 BGP_SOFT_STR
5596 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005597{
5598 if (strncmp (argv[1], "m", 1) == 0)
5599 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
5600 BGP_CLEAR_SOFT_OUT, argv[0]);
5601
5602 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
5603 BGP_CLEAR_SOFT_OUT, argv[0]);
5604}
5605
5606ALIAS (clear_ip_bgp_as_ipv4_soft_out,
5607 clear_ip_bgp_as_ipv4_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005608 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) out",
paul718e3742002-12-13 20:15:29 +00005609 CLEAR_STR
5610 IP_STR
5611 BGP_STR
5612 "Clear peers with the AS number\n"
5613 "Address family\n"
5614 "Address Family modifier\n"
5615 "Address Family modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005616 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005617
5618DEFUN (clear_ip_bgp_as_vpnv4_soft_out,
5619 clear_ip_bgp_as_vpnv4_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005620 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft out",
paul718e3742002-12-13 20:15:29 +00005621 CLEAR_STR
5622 IP_STR
5623 BGP_STR
5624 "Clear peers with the AS number\n"
5625 "Address family\n"
5626 "Address Family modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005627 BGP_SOFT_STR
5628 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005629{
5630 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
5631 BGP_CLEAR_SOFT_OUT, argv[0]);
5632}
5633
5634ALIAS (clear_ip_bgp_as_vpnv4_soft_out,
5635 clear_ip_bgp_as_vpnv4_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005636 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast out",
paul718e3742002-12-13 20:15:29 +00005637 CLEAR_STR
5638 IP_STR
5639 BGP_STR
5640 "Clear peers with the AS number\n"
5641 "Address family\n"
5642 "Address Family modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005643 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005644
Lou Berger298cc2f2016-01-12 13:42:02 -05005645DEFUN (clear_ip_bgp_as_encap_soft_out,
5646 clear_ip_bgp_as_encap_soft_out_cmd,
5647 "clear ip bgp " CMD_AS_RANGE " encap unicast soft out",
5648 CLEAR_STR
5649 IP_STR
5650 BGP_STR
5651 "Clear peers with the AS number\n"
5652 "Address family\n"
5653 "Address Family modifier\n"
5654 "Soft reconfig\n"
5655 "Soft reconfig outbound update\n")
5656{
5657 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_as,
5658 BGP_CLEAR_SOFT_OUT, argv[0]);
5659}
5660
5661ALIAS (clear_ip_bgp_as_encap_soft_out,
5662 clear_ip_bgp_as_encap_out_cmd,
5663 "clear ip bgp " CMD_AS_RANGE " encap unicast out",
5664 CLEAR_STR
5665 IP_STR
5666 BGP_STR
5667 "Clear peers with the AS number\n"
5668 "Address family\n"
5669 "Address Family modifier\n"
5670 "Soft reconfig outbound update\n")
5671
paul718e3742002-12-13 20:15:29 +00005672DEFUN (clear_bgp_as_soft_out,
5673 clear_bgp_as_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005674 "clear bgp " CMD_AS_RANGE " soft out",
paul718e3742002-12-13 20:15:29 +00005675 CLEAR_STR
5676 BGP_STR
5677 "Clear peers with the AS number\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005678 BGP_SOFT_STR
5679 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005680{
5681 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
5682 BGP_CLEAR_SOFT_OUT, argv[0]);
5683}
5684
5685ALIAS (clear_bgp_as_soft_out,
5686 clear_bgp_ipv6_as_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005687 "clear bgp ipv6 " CMD_AS_RANGE " soft out",
paul718e3742002-12-13 20:15:29 +00005688 CLEAR_STR
5689 BGP_STR
5690 "Address family\n"
5691 "Clear peers with the AS number\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005692 BGP_SOFT_STR
5693 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005694
5695ALIAS (clear_bgp_as_soft_out,
5696 clear_bgp_as_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005697 "clear bgp " CMD_AS_RANGE " out",
paul718e3742002-12-13 20:15:29 +00005698 CLEAR_STR
5699 BGP_STR
5700 "Clear peers with the AS number\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005701 BGP_SOFT_OUT_STR)
paul718e3742002-12-13 20:15:29 +00005702
5703ALIAS (clear_bgp_as_soft_out,
5704 clear_bgp_ipv6_as_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005705 "clear bgp ipv6 " CMD_AS_RANGE " out",
paul718e3742002-12-13 20:15:29 +00005706 CLEAR_STR
5707 BGP_STR
5708 "Address family\n"
5709 "Clear peers with the AS number\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005710 BGP_SOFT_OUT_STR)
David Lamparter6b0655a2014-06-04 06:53:35 +02005711
paul718e3742002-12-13 20:15:29 +00005712/* Inbound soft-reconfiguration */
5713DEFUN (clear_ip_bgp_all_soft_in,
5714 clear_ip_bgp_all_soft_in_cmd,
5715 "clear ip bgp * soft in",
5716 CLEAR_STR
5717 IP_STR
5718 BGP_STR
5719 "Clear all peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005720 BGP_SOFT_STR
5721 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00005722{
5723 if (argc == 1)
5724 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5725 BGP_CLEAR_SOFT_IN, NULL);
5726
5727 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5728 BGP_CLEAR_SOFT_IN, NULL);
5729}
5730
5731ALIAS (clear_ip_bgp_all_soft_in,
5732 clear_ip_bgp_instance_all_soft_in_cmd,
5733 "clear ip bgp view WORD * soft in",
5734 CLEAR_STR
5735 IP_STR
5736 BGP_STR
5737 "BGP view\n"
5738 "view name\n"
5739 "Clear all peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005740 BGP_SOFT_STR
5741 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00005742
5743ALIAS (clear_ip_bgp_all_soft_in,
5744 clear_ip_bgp_all_in_cmd,
5745 "clear ip bgp * in",
5746 CLEAR_STR
5747 IP_STR
5748 BGP_STR
5749 "Clear all peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005750 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00005751
5752DEFUN (clear_ip_bgp_all_in_prefix_filter,
5753 clear_ip_bgp_all_in_prefix_filter_cmd,
5754 "clear ip bgp * in prefix-filter",
5755 CLEAR_STR
5756 IP_STR
5757 BGP_STR
5758 "Clear all peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005759 BGP_SOFT_IN_STR
paul718e3742002-12-13 20:15:29 +00005760 "Push out prefix-list ORF and do inbound soft reconfig\n")
5761{
5762 if (argc== 1)
5763 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5764 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5765
5766 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5767 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5768}
5769
5770ALIAS (clear_ip_bgp_all_in_prefix_filter,
5771 clear_ip_bgp_instance_all_in_prefix_filter_cmd,
5772 "clear ip bgp view WORD * in prefix-filter",
5773 CLEAR_STR
5774 IP_STR
5775 BGP_STR
5776 "BGP view\n"
5777 "view name\n"
5778 "Clear all peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005779 BGP_SOFT_IN_STR
paul718e3742002-12-13 20:15:29 +00005780 "Push out prefix-list ORF and do inbound soft reconfig\n")
5781
5782
5783DEFUN (clear_ip_bgp_all_ipv4_soft_in,
5784 clear_ip_bgp_all_ipv4_soft_in_cmd,
5785 "clear ip bgp * ipv4 (unicast|multicast) soft in",
5786 CLEAR_STR
5787 IP_STR
5788 BGP_STR
5789 "Clear all peers\n"
5790 "Address family\n"
5791 "Address Family modifier\n"
5792 "Address Family modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005793 BGP_SOFT_STR
5794 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00005795{
5796 if (strncmp (argv[0], "m", 1) == 0)
5797 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
5798 BGP_CLEAR_SOFT_IN, NULL);
5799
5800 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5801 BGP_CLEAR_SOFT_IN, NULL);
5802}
5803
5804ALIAS (clear_ip_bgp_all_ipv4_soft_in,
5805 clear_ip_bgp_all_ipv4_in_cmd,
5806 "clear ip bgp * ipv4 (unicast|multicast) in",
5807 CLEAR_STR
5808 IP_STR
5809 BGP_STR
5810 "Clear all peers\n"
5811 "Address family\n"
5812 "Address Family modifier\n"
5813 "Address Family modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005814 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00005815
5816DEFUN (clear_ip_bgp_instance_all_ipv4_soft_in,
5817 clear_ip_bgp_instance_all_ipv4_soft_in_cmd,
5818 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft in",
5819 CLEAR_STR
5820 IP_STR
5821 BGP_STR
5822 "BGP view\n"
5823 "view name\n"
5824 "Clear all peers\n"
5825 "Address family\n"
5826 "Address Family modifier\n"
5827 "Address Family modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005828 BGP_SOFT_STR
5829 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00005830{
5831 if (strncmp (argv[1], "m", 1) == 0)
5832 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
5833 BGP_CLEAR_SOFT_IN, NULL);
5834
5835 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5836 BGP_CLEAR_SOFT_IN, NULL);
5837}
5838
5839DEFUN (clear_ip_bgp_all_ipv4_in_prefix_filter,
5840 clear_ip_bgp_all_ipv4_in_prefix_filter_cmd,
5841 "clear ip bgp * ipv4 (unicast|multicast) in prefix-filter",
5842 CLEAR_STR
5843 IP_STR
5844 BGP_STR
5845 "Clear all peers\n"
5846 "Address family\n"
5847 "Address Family modifier\n"
5848 "Address Family modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005849 BGP_SOFT_IN_STR
paul718e3742002-12-13 20:15:29 +00005850 "Push out prefix-list ORF and do inbound soft reconfig\n")
5851{
5852 if (strncmp (argv[0], "m", 1) == 0)
5853 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
5854 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5855
5856 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5857 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5858}
5859
5860DEFUN (clear_ip_bgp_instance_all_ipv4_in_prefix_filter,
5861 clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd,
5862 "clear ip bgp view WORD * ipv4 (unicast|multicast) in prefix-filter",
5863 CLEAR_STR
5864 IP_STR
5865 BGP_STR
5866 "Clear all peers\n"
5867 "Address family\n"
5868 "Address Family modifier\n"
5869 "Address Family modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005870 BGP_SOFT_IN_STR
paul718e3742002-12-13 20:15:29 +00005871 "Push out prefix-list ORF and do inbound soft reconfig\n")
5872{
5873 if (strncmp (argv[1], "m", 1) == 0)
5874 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
5875 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5876
5877 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5878 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5879}
5880
5881DEFUN (clear_ip_bgp_all_vpnv4_soft_in,
5882 clear_ip_bgp_all_vpnv4_soft_in_cmd,
5883 "clear ip bgp * vpnv4 unicast soft in",
5884 CLEAR_STR
5885 IP_STR
5886 BGP_STR
5887 "Clear all peers\n"
5888 "Address family\n"
5889 "Address Family Modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005890 BGP_SOFT_STR
5891 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00005892{
5893 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
5894 BGP_CLEAR_SOFT_IN, NULL);
5895}
5896
5897ALIAS (clear_ip_bgp_all_vpnv4_soft_in,
5898 clear_ip_bgp_all_vpnv4_in_cmd,
5899 "clear ip bgp * vpnv4 unicast in",
5900 CLEAR_STR
5901 IP_STR
5902 BGP_STR
5903 "Clear all peers\n"
5904 "Address family\n"
5905 "Address Family Modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005906 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00005907
Lou Berger298cc2f2016-01-12 13:42:02 -05005908DEFUN (clear_ip_bgp_all_encap_soft_in,
5909 clear_ip_bgp_all_encap_soft_in_cmd,
5910 "clear ip bgp * encap unicast soft in",
5911 CLEAR_STR
5912 IP_STR
5913 BGP_STR
5914 "Clear all peers\n"
5915 "Address family\n"
5916 "Address Family Modifier\n"
5917 "Soft reconfig\n"
5918 "Soft reconfig inbound update\n")
5919{
5920 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_all,
5921 BGP_CLEAR_SOFT_IN, NULL);
5922}
5923
5924ALIAS (clear_ip_bgp_all_encap_soft_in,
5925 clear_ip_bgp_all_encap_in_cmd,
5926 "clear ip bgp * encap unicast in",
5927 CLEAR_STR
5928 IP_STR
5929 BGP_STR
5930 "Clear all peers\n"
5931 "Address family\n"
5932 "Address Family Modifier\n"
5933 "Soft reconfig inbound update\n")
5934
paul718e3742002-12-13 20:15:29 +00005935DEFUN (clear_bgp_all_soft_in,
5936 clear_bgp_all_soft_in_cmd,
5937 "clear bgp * soft in",
5938 CLEAR_STR
5939 BGP_STR
5940 "Clear all peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005941 BGP_SOFT_STR
5942 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00005943{
5944 if (argc == 1)
5945 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
5946 BGP_CLEAR_SOFT_IN, NULL);
5947
5948 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
5949 BGP_CLEAR_SOFT_IN, NULL);
5950}
5951
5952ALIAS (clear_bgp_all_soft_in,
5953 clear_bgp_instance_all_soft_in_cmd,
5954 "clear bgp view WORD * soft in",
5955 CLEAR_STR
5956 BGP_STR
5957 "BGP view\n"
5958 "view name\n"
5959 "Clear all peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005960 BGP_SOFT_STR
5961 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00005962
5963ALIAS (clear_bgp_all_soft_in,
5964 clear_bgp_ipv6_all_soft_in_cmd,
5965 "clear bgp ipv6 * soft in",
5966 CLEAR_STR
5967 BGP_STR
5968 "Address family\n"
5969 "Clear all peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005970 BGP_SOFT_STR
5971 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00005972
5973ALIAS (clear_bgp_all_soft_in,
5974 clear_bgp_all_in_cmd,
5975 "clear bgp * in",
5976 CLEAR_STR
5977 BGP_STR
5978 "Clear all peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005979 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00005980
5981ALIAS (clear_bgp_all_soft_in,
5982 clear_bgp_ipv6_all_in_cmd,
5983 "clear bgp ipv6 * in",
5984 CLEAR_STR
5985 BGP_STR
5986 "Address family\n"
5987 "Clear all peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005988 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00005989
5990DEFUN (clear_bgp_all_in_prefix_filter,
5991 clear_bgp_all_in_prefix_filter_cmd,
5992 "clear bgp * in prefix-filter",
5993 CLEAR_STR
5994 BGP_STR
5995 "Clear all peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07005996 BGP_SOFT_IN_STR
paul718e3742002-12-13 20:15:29 +00005997 "Push out prefix-list ORF and do inbound soft reconfig\n")
5998{
5999 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
6000 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
6001}
6002
6003ALIAS (clear_bgp_all_in_prefix_filter,
6004 clear_bgp_ipv6_all_in_prefix_filter_cmd,
6005 "clear bgp ipv6 * in prefix-filter",
6006 CLEAR_STR
6007 BGP_STR
6008 "Address family\n"
6009 "Clear all peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006010 BGP_SOFT_IN_STR
paul718e3742002-12-13 20:15:29 +00006011 "Push out prefix-list ORF and do inbound soft reconfig\n")
6012
6013DEFUN (clear_ip_bgp_peer_soft_in,
6014 clear_ip_bgp_peer_soft_in_cmd,
6015 "clear ip bgp A.B.C.D soft in",
6016 CLEAR_STR
6017 IP_STR
6018 BGP_STR
6019 "BGP neighbor address to clear\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006020 BGP_SOFT_STR
6021 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00006022{
6023 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6024 BGP_CLEAR_SOFT_IN, argv[0]);
6025}
6026
6027ALIAS (clear_ip_bgp_peer_soft_in,
6028 clear_ip_bgp_peer_in_cmd,
6029 "clear ip bgp A.B.C.D in",
6030 CLEAR_STR
6031 IP_STR
6032 BGP_STR
6033 "BGP neighbor address to clear\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006034 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00006035
6036DEFUN (clear_ip_bgp_peer_in_prefix_filter,
6037 clear_ip_bgp_peer_in_prefix_filter_cmd,
6038 "clear ip bgp A.B.C.D in prefix-filter",
6039 CLEAR_STR
6040 IP_STR
6041 BGP_STR
6042 "BGP neighbor address to clear\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006043 BGP_SOFT_IN_STR
paul718e3742002-12-13 20:15:29 +00006044 "Push out the existing ORF prefix-list\n")
6045{
6046 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6047 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6048}
6049
6050DEFUN (clear_ip_bgp_peer_ipv4_soft_in,
6051 clear_ip_bgp_peer_ipv4_soft_in_cmd,
6052 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft in",
6053 CLEAR_STR
6054 IP_STR
6055 BGP_STR
6056 "BGP neighbor address to clear\n"
6057 "Address family\n"
6058 "Address Family modifier\n"
6059 "Address Family modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006060 BGP_SOFT_STR
6061 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00006062{
6063 if (strncmp (argv[1], "m", 1) == 0)
6064 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
6065 BGP_CLEAR_SOFT_IN, argv[0]);
6066
6067 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6068 BGP_CLEAR_SOFT_IN, argv[0]);
6069}
6070
6071ALIAS (clear_ip_bgp_peer_ipv4_soft_in,
6072 clear_ip_bgp_peer_ipv4_in_cmd,
6073 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in",
6074 CLEAR_STR
6075 IP_STR
6076 BGP_STR
6077 "BGP neighbor address to clear\n"
6078 "Address family\n"
6079 "Address Family modifier\n"
6080 "Address Family modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006081 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00006082
6083DEFUN (clear_ip_bgp_peer_ipv4_in_prefix_filter,
6084 clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd,
6085 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in prefix-filter",
6086 CLEAR_STR
6087 IP_STR
6088 BGP_STR
6089 "BGP neighbor address to clear\n"
6090 "Address family\n"
6091 "Address Family modifier\n"
6092 "Address Family modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006093 BGP_SOFT_IN_STR
paul718e3742002-12-13 20:15:29 +00006094 "Push out the existing ORF prefix-list\n")
6095{
6096 if (strncmp (argv[1], "m", 1) == 0)
6097 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
6098 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6099
6100 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6101 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6102}
6103
6104DEFUN (clear_ip_bgp_peer_vpnv4_soft_in,
6105 clear_ip_bgp_peer_vpnv4_soft_in_cmd,
6106 "clear ip bgp A.B.C.D vpnv4 unicast soft in",
6107 CLEAR_STR
6108 IP_STR
6109 BGP_STR
6110 "BGP neighbor address to clear\n"
6111 "Address family\n"
6112 "Address Family Modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006113 BGP_SOFT_STR
6114 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00006115{
6116 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
6117 BGP_CLEAR_SOFT_IN, argv[0]);
6118}
6119
6120ALIAS (clear_ip_bgp_peer_vpnv4_soft_in,
6121 clear_ip_bgp_peer_vpnv4_in_cmd,
6122 "clear ip bgp A.B.C.D vpnv4 unicast in",
6123 CLEAR_STR
6124 IP_STR
6125 BGP_STR
6126 "BGP neighbor address to clear\n"
6127 "Address family\n"
6128 "Address Family Modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006129 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00006130
Lou Berger298cc2f2016-01-12 13:42:02 -05006131DEFUN (clear_ip_bgp_peer_encap_soft_in,
6132 clear_ip_bgp_peer_encap_soft_in_cmd,
6133 "clear ip bgp A.B.C.D encap unicast soft in",
6134 CLEAR_STR
6135 IP_STR
6136 BGP_STR
6137 "BGP neighbor address to clear\n"
6138 "Address family\n"
6139 "Address Family Modifier\n"
6140 "Soft reconfig\n"
6141 "Soft reconfig inbound update\n")
6142{
6143 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_peer,
6144 BGP_CLEAR_SOFT_IN, argv[0]);
6145}
6146
6147ALIAS (clear_ip_bgp_peer_encap_soft_in,
6148 clear_ip_bgp_peer_encap_in_cmd,
6149 "clear ip bgp A.B.C.D encap unicast in",
6150 CLEAR_STR
6151 IP_STR
6152 BGP_STR
6153 "BGP neighbor address to clear\n"
6154 "Address family\n"
6155 "Address Family Modifier\n"
6156 "Soft reconfig inbound update\n")
6157
paul718e3742002-12-13 20:15:29 +00006158DEFUN (clear_bgp_peer_soft_in,
6159 clear_bgp_peer_soft_in_cmd,
6160 "clear bgp (A.B.C.D|X:X::X:X) soft in",
6161 CLEAR_STR
6162 BGP_STR
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{
6168 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
6169 BGP_CLEAR_SOFT_IN, argv[0]);
6170}
6171
6172ALIAS (clear_bgp_peer_soft_in,
6173 clear_bgp_ipv6_peer_soft_in_cmd,
6174 "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft in",
6175 CLEAR_STR
6176 BGP_STR
6177 "Address family\n"
6178 "BGP neighbor address to clear\n"
6179 "BGP IPv6 neighbor to clear\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006180 BGP_SOFT_STR
6181 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00006182
6183ALIAS (clear_bgp_peer_soft_in,
6184 clear_bgp_peer_in_cmd,
6185 "clear bgp (A.B.C.D|X:X::X:X) in",
6186 CLEAR_STR
6187 BGP_STR
6188 "BGP neighbor address to clear\n"
6189 "BGP IPv6 neighbor to clear\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006190 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00006191
6192ALIAS (clear_bgp_peer_soft_in,
6193 clear_bgp_ipv6_peer_in_cmd,
6194 "clear bgp ipv6 (A.B.C.D|X:X::X:X) in",
6195 CLEAR_STR
6196 BGP_STR
6197 "Address family\n"
6198 "BGP neighbor address to clear\n"
6199 "BGP IPv6 neighbor to clear\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006200 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00006201
6202DEFUN (clear_bgp_peer_in_prefix_filter,
6203 clear_bgp_peer_in_prefix_filter_cmd,
6204 "clear bgp (A.B.C.D|X:X::X:X) in prefix-filter",
6205 CLEAR_STR
6206 BGP_STR
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{
6212 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
6213 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6214}
6215
6216ALIAS (clear_bgp_peer_in_prefix_filter,
6217 clear_bgp_ipv6_peer_in_prefix_filter_cmd,
6218 "clear bgp ipv6 (A.B.C.D|X:X::X:X) in prefix-filter",
6219 CLEAR_STR
6220 BGP_STR
6221 "Address family\n"
6222 "BGP neighbor address to clear\n"
6223 "BGP IPv6 neighbor to clear\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006224 BGP_SOFT_IN_STR
paul718e3742002-12-13 20:15:29 +00006225 "Push out the existing ORF prefix-list\n")
6226
6227DEFUN (clear_ip_bgp_peer_group_soft_in,
6228 clear_ip_bgp_peer_group_soft_in_cmd,
6229 "clear ip bgp peer-group WORD soft 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_STR
6236 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00006237{
6238 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6239 BGP_CLEAR_SOFT_IN, argv[0]);
6240}
6241
6242ALIAS (clear_ip_bgp_peer_group_soft_in,
6243 clear_ip_bgp_peer_group_in_cmd,
6244 "clear ip bgp peer-group WORD in",
6245 CLEAR_STR
6246 IP_STR
6247 BGP_STR
6248 "Clear all members of peer-group\n"
6249 "BGP peer-group name\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006250 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00006251
6252DEFUN (clear_ip_bgp_peer_group_in_prefix_filter,
6253 clear_ip_bgp_peer_group_in_prefix_filter_cmd,
6254 "clear ip bgp peer-group WORD in prefix-filter",
6255 CLEAR_STR
6256 IP_STR
6257 BGP_STR
6258 "Clear all members of peer-group\n"
6259 "BGP peer-group name\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006260 BGP_SOFT_IN_STR
paul718e3742002-12-13 20:15:29 +00006261 "Push out prefix-list ORF and do inbound soft reconfig\n")
6262{
6263 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6264 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6265}
6266
6267DEFUN (clear_ip_bgp_peer_group_ipv4_soft_in,
6268 clear_ip_bgp_peer_group_ipv4_soft_in_cmd,
6269 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft in",
6270 CLEAR_STR
6271 IP_STR
6272 BGP_STR
6273 "Clear all members of peer-group\n"
6274 "BGP peer-group name\n"
6275 "Address family\n"
6276 "Address Family modifier\n"
6277 "Address Family modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006278 BGP_SOFT_STR
6279 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00006280{
6281 if (strncmp (argv[1], "m", 1) == 0)
6282 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
6283 BGP_CLEAR_SOFT_IN, argv[0]);
6284
6285 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6286 BGP_CLEAR_SOFT_IN, argv[0]);
6287}
6288
6289ALIAS (clear_ip_bgp_peer_group_ipv4_soft_in,
6290 clear_ip_bgp_peer_group_ipv4_in_cmd,
6291 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in",
6292 CLEAR_STR
6293 IP_STR
6294 BGP_STR
6295 "Clear all members of peer-group\n"
6296 "BGP peer-group name\n"
6297 "Address family\n"
6298 "Address Family modifier\n"
6299 "Address Family modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006300 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00006301
6302DEFUN (clear_ip_bgp_peer_group_ipv4_in_prefix_filter,
6303 clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd,
6304 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in prefix-filter",
6305 CLEAR_STR
6306 IP_STR
6307 BGP_STR
6308 "Clear all members of peer-group\n"
6309 "BGP peer-group name\n"
6310 "Address family\n"
6311 "Address Family modifier\n"
6312 "Address Family modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006313 BGP_SOFT_IN_STR
paul718e3742002-12-13 20:15:29 +00006314 "Push out prefix-list ORF and do inbound soft reconfig\n")
6315{
6316 if (strncmp (argv[1], "m", 1) == 0)
6317 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
6318 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6319
6320 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6321 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6322}
6323
6324DEFUN (clear_bgp_peer_group_soft_in,
6325 clear_bgp_peer_group_soft_in_cmd,
6326 "clear bgp peer-group WORD soft in",
6327 CLEAR_STR
6328 BGP_STR
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{
6334 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
6335 BGP_CLEAR_SOFT_IN, argv[0]);
6336}
6337
6338ALIAS (clear_bgp_peer_group_soft_in,
6339 clear_bgp_ipv6_peer_group_soft_in_cmd,
6340 "clear bgp ipv6 peer-group WORD soft in",
6341 CLEAR_STR
6342 BGP_STR
6343 "Address family\n"
6344 "Clear all members of peer-group\n"
6345 "BGP peer-group name\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006346 BGP_SOFT_STR
6347 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00006348
6349ALIAS (clear_bgp_peer_group_soft_in,
6350 clear_bgp_peer_group_in_cmd,
6351 "clear bgp peer-group WORD in",
6352 CLEAR_STR
6353 BGP_STR
6354 "Clear all members of peer-group\n"
6355 "BGP peer-group name\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006356 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00006357
6358ALIAS (clear_bgp_peer_group_soft_in,
6359 clear_bgp_ipv6_peer_group_in_cmd,
6360 "clear bgp ipv6 peer-group WORD in",
6361 CLEAR_STR
6362 BGP_STR
6363 "Address family\n"
6364 "Clear all members of peer-group\n"
6365 "BGP peer-group name\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006366 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00006367
6368DEFUN (clear_bgp_peer_group_in_prefix_filter,
6369 clear_bgp_peer_group_in_prefix_filter_cmd,
6370 "clear bgp peer-group WORD in prefix-filter",
6371 CLEAR_STR
6372 BGP_STR
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{
6378 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
6379 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6380}
6381
6382ALIAS (clear_bgp_peer_group_in_prefix_filter,
6383 clear_bgp_ipv6_peer_group_in_prefix_filter_cmd,
6384 "clear bgp ipv6 peer-group WORD in prefix-filter",
6385 CLEAR_STR
6386 BGP_STR
6387 "Address family\n"
6388 "Clear all members of peer-group\n"
6389 "BGP peer-group name\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006390 BGP_SOFT_IN_STR
paul718e3742002-12-13 20:15:29 +00006391 "Push out prefix-list ORF and do inbound soft reconfig\n")
6392
6393DEFUN (clear_ip_bgp_external_soft_in,
6394 clear_ip_bgp_external_soft_in_cmd,
6395 "clear ip bgp external soft in",
6396 CLEAR_STR
6397 IP_STR
6398 BGP_STR
6399 "Clear all external peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006400 BGP_SOFT_STR
6401 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00006402{
6403 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6404 BGP_CLEAR_SOFT_IN, NULL);
6405}
6406
6407ALIAS (clear_ip_bgp_external_soft_in,
6408 clear_ip_bgp_external_in_cmd,
6409 "clear ip bgp external in",
6410 CLEAR_STR
6411 IP_STR
6412 BGP_STR
6413 "Clear all external peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006414 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00006415
6416DEFUN (clear_ip_bgp_external_in_prefix_filter,
6417 clear_ip_bgp_external_in_prefix_filter_cmd,
6418 "clear ip bgp external in prefix-filter",
6419 CLEAR_STR
6420 IP_STR
6421 BGP_STR
6422 "Clear all external peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006423 BGP_SOFT_IN_STR
paul718e3742002-12-13 20:15:29 +00006424 "Push out prefix-list ORF and do inbound soft reconfig\n")
6425{
6426 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6427 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
6428}
6429
6430DEFUN (clear_ip_bgp_external_ipv4_soft_in,
6431 clear_ip_bgp_external_ipv4_soft_in_cmd,
6432 "clear ip bgp external ipv4 (unicast|multicast) soft in",
6433 CLEAR_STR
6434 IP_STR
6435 BGP_STR
6436 "Clear all external peers\n"
6437 "Address family\n"
6438 "Address Family modifier\n"
6439 "Address Family modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006440 BGP_SOFT_STR
6441 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00006442{
6443 if (strncmp (argv[0], "m", 1) == 0)
6444 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
6445 BGP_CLEAR_SOFT_IN, NULL);
6446
6447 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6448 BGP_CLEAR_SOFT_IN, NULL);
6449}
6450
6451ALIAS (clear_ip_bgp_external_ipv4_soft_in,
6452 clear_ip_bgp_external_ipv4_in_cmd,
6453 "clear ip bgp external ipv4 (unicast|multicast) in",
6454 CLEAR_STR
6455 IP_STR
6456 BGP_STR
6457 "Clear all external peers\n"
6458 "Address family\n"
6459 "Address Family modifier\n"
6460 "Address Family modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006461 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00006462
6463DEFUN (clear_ip_bgp_external_ipv4_in_prefix_filter,
6464 clear_ip_bgp_external_ipv4_in_prefix_filter_cmd,
6465 "clear ip bgp external ipv4 (unicast|multicast) in prefix-filter",
6466 CLEAR_STR
6467 IP_STR
6468 BGP_STR
6469 "Clear all external peers\n"
6470 "Address family\n"
6471 "Address Family modifier\n"
6472 "Address Family modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006473 BGP_SOFT_IN_STR
paul718e3742002-12-13 20:15:29 +00006474 "Push out prefix-list ORF and do inbound soft reconfig\n")
6475{
6476 if (strncmp (argv[0], "m", 1) == 0)
6477 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
6478 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
6479
6480 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6481 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
6482}
6483
6484DEFUN (clear_bgp_external_soft_in,
6485 clear_bgp_external_soft_in_cmd,
6486 "clear bgp external soft in",
6487 CLEAR_STR
6488 BGP_STR
6489 "Clear all external peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006490 BGP_SOFT_STR
6491 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00006492{
6493 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
6494 BGP_CLEAR_SOFT_IN, NULL);
6495}
6496
6497ALIAS (clear_bgp_external_soft_in,
6498 clear_bgp_ipv6_external_soft_in_cmd,
6499 "clear bgp ipv6 external soft in",
6500 CLEAR_STR
6501 BGP_STR
6502 "Address family\n"
6503 "Clear all external peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006504 BGP_SOFT_STR
6505 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00006506
6507ALIAS (clear_bgp_external_soft_in,
6508 clear_bgp_external_in_cmd,
6509 "clear bgp external in",
6510 CLEAR_STR
6511 BGP_STR
6512 "Clear all external peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006513 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00006514
6515ALIAS (clear_bgp_external_soft_in,
6516 clear_bgp_ipv6_external_in_cmd,
6517 "clear bgp ipv6 external WORD in",
6518 CLEAR_STR
6519 BGP_STR
6520 "Address family\n"
6521 "Clear all external peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006522 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00006523
6524DEFUN (clear_bgp_external_in_prefix_filter,
6525 clear_bgp_external_in_prefix_filter_cmd,
6526 "clear bgp external in prefix-filter",
6527 CLEAR_STR
6528 BGP_STR
6529 "Clear all external peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006530 BGP_SOFT_IN_STR
paul718e3742002-12-13 20:15:29 +00006531 "Push out prefix-list ORF and do inbound soft reconfig\n")
6532{
6533 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
6534 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
6535}
6536
6537ALIAS (clear_bgp_external_in_prefix_filter,
6538 clear_bgp_ipv6_external_in_prefix_filter_cmd,
6539 "clear bgp ipv6 external in prefix-filter",
6540 CLEAR_STR
6541 BGP_STR
6542 "Address family\n"
6543 "Clear all external peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006544 BGP_SOFT_IN_STR
paul718e3742002-12-13 20:15:29 +00006545 "Push out prefix-list ORF and do inbound soft reconfig\n")
6546
6547DEFUN (clear_ip_bgp_as_soft_in,
6548 clear_ip_bgp_as_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006549 "clear ip bgp " CMD_AS_RANGE " soft in",
paul718e3742002-12-13 20:15:29 +00006550 CLEAR_STR
6551 IP_STR
6552 BGP_STR
6553 "Clear peers with the AS number\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006554 BGP_SOFT_STR
6555 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00006556{
6557 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6558 BGP_CLEAR_SOFT_IN, argv[0]);
6559}
6560
6561ALIAS (clear_ip_bgp_as_soft_in,
6562 clear_ip_bgp_as_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006563 "clear ip bgp " CMD_AS_RANGE " in",
paul718e3742002-12-13 20:15:29 +00006564 CLEAR_STR
6565 IP_STR
6566 BGP_STR
6567 "Clear peers with the AS number\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006568 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00006569
6570DEFUN (clear_ip_bgp_as_in_prefix_filter,
6571 clear_ip_bgp_as_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006572 "clear ip bgp " CMD_AS_RANGE " in prefix-filter",
paul718e3742002-12-13 20:15:29 +00006573 CLEAR_STR
6574 IP_STR
6575 BGP_STR
6576 "Clear peers with the AS number\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006577 BGP_SOFT_IN_STR
paul718e3742002-12-13 20:15:29 +00006578 "Push out prefix-list ORF and do inbound soft reconfig\n")
6579{
6580 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6581 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6582}
6583
6584DEFUN (clear_ip_bgp_as_ipv4_soft_in,
6585 clear_ip_bgp_as_ipv4_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006586 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft in",
paul718e3742002-12-13 20:15:29 +00006587 CLEAR_STR
6588 IP_STR
6589 BGP_STR
6590 "Clear peers with the AS number\n"
6591 "Address family\n"
6592 "Address Family modifier\n"
6593 "Address Family modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006594 BGP_SOFT_STR
6595 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00006596{
6597 if (strncmp (argv[1], "m", 1) == 0)
6598 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
6599 BGP_CLEAR_SOFT_IN, argv[0]);
6600
6601 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6602 BGP_CLEAR_SOFT_IN, argv[0]);
6603}
6604
6605ALIAS (clear_ip_bgp_as_ipv4_soft_in,
6606 clear_ip_bgp_as_ipv4_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006607 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in",
paul718e3742002-12-13 20:15:29 +00006608 CLEAR_STR
6609 IP_STR
6610 BGP_STR
6611 "Clear peers with the AS number\n"
6612 "Address family\n"
6613 "Address Family modifier\n"
6614 "Address Family modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006615 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00006616
6617DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter,
6618 clear_ip_bgp_as_ipv4_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006619 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in prefix-filter",
paul718e3742002-12-13 20:15:29 +00006620 CLEAR_STR
6621 IP_STR
6622 BGP_STR
6623 "Clear peers with the AS number\n"
6624 "Address family\n"
6625 "Address Family modifier\n"
6626 "Address Family modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006627 BGP_SOFT_IN_STR
paul718e3742002-12-13 20:15:29 +00006628 "Push out prefix-list ORF and do inbound soft reconfig\n")
6629{
6630 if (strncmp (argv[1], "m", 1) == 0)
6631 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
6632 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6633
6634 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6635 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6636}
6637
6638DEFUN (clear_ip_bgp_as_vpnv4_soft_in,
6639 clear_ip_bgp_as_vpnv4_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006640 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft in",
paul718e3742002-12-13 20:15:29 +00006641 CLEAR_STR
6642 IP_STR
6643 BGP_STR
6644 "Clear peers with the AS number\n"
6645 "Address family\n"
6646 "Address Family modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006647 BGP_SOFT_STR
6648 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00006649{
6650 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
6651 BGP_CLEAR_SOFT_IN, argv[0]);
6652}
6653
6654ALIAS (clear_ip_bgp_as_vpnv4_soft_in,
6655 clear_ip_bgp_as_vpnv4_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006656 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast in",
paul718e3742002-12-13 20:15:29 +00006657 CLEAR_STR
6658 IP_STR
6659 BGP_STR
6660 "Clear peers with the AS number\n"
6661 "Address family\n"
6662 "Address Family modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006663 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00006664
Lou Berger298cc2f2016-01-12 13:42:02 -05006665DEFUN (clear_ip_bgp_as_encap_soft_in,
6666 clear_ip_bgp_as_encap_soft_in_cmd,
6667 "clear ip bgp " CMD_AS_RANGE " encap unicast soft in",
6668 CLEAR_STR
6669 IP_STR
6670 BGP_STR
6671 "Clear peers with the AS number\n"
6672 "Address family\n"
6673 "Address Family modifier\n"
6674 "Soft reconfig\n"
6675 "Soft reconfig inbound update\n")
6676{
6677 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_as,
6678 BGP_CLEAR_SOFT_IN, argv[0]);
6679}
6680
6681ALIAS (clear_ip_bgp_as_encap_soft_in,
6682 clear_ip_bgp_as_encap_in_cmd,
6683 "clear ip bgp " CMD_AS_RANGE " encap unicast in",
6684 CLEAR_STR
6685 IP_STR
6686 BGP_STR
6687 "Clear peers with the AS number\n"
6688 "Address family\n"
6689 "Address Family modifier\n"
6690 "Soft reconfig inbound update\n")
6691
paul718e3742002-12-13 20:15:29 +00006692DEFUN (clear_bgp_as_soft_in,
6693 clear_bgp_as_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006694 "clear bgp " CMD_AS_RANGE " soft in",
paul718e3742002-12-13 20:15:29 +00006695 CLEAR_STR
6696 BGP_STR
6697 "Clear peers with the AS number\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006698 BGP_SOFT_STR
6699 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00006700{
6701 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
6702 BGP_CLEAR_SOFT_IN, argv[0]);
6703}
6704
6705ALIAS (clear_bgp_as_soft_in,
6706 clear_bgp_ipv6_as_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006707 "clear bgp ipv6 " CMD_AS_RANGE " soft in",
paul718e3742002-12-13 20:15:29 +00006708 CLEAR_STR
6709 BGP_STR
6710 "Address family\n"
6711 "Clear peers with the AS number\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006712 BGP_SOFT_STR
6713 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00006714
6715ALIAS (clear_bgp_as_soft_in,
6716 clear_bgp_as_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006717 "clear bgp " CMD_AS_RANGE " in",
paul718e3742002-12-13 20:15:29 +00006718 CLEAR_STR
6719 BGP_STR
6720 "Clear peers with the AS number\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006721 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00006722
6723ALIAS (clear_bgp_as_soft_in,
6724 clear_bgp_ipv6_as_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006725 "clear bgp ipv6 " CMD_AS_RANGE " in",
paul718e3742002-12-13 20:15:29 +00006726 CLEAR_STR
6727 BGP_STR
6728 "Address family\n"
6729 "Clear peers with the AS number\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006730 BGP_SOFT_IN_STR)
paul718e3742002-12-13 20:15:29 +00006731
6732DEFUN (clear_bgp_as_in_prefix_filter,
6733 clear_bgp_as_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006734 "clear bgp " CMD_AS_RANGE " in prefix-filter",
paul718e3742002-12-13 20:15:29 +00006735 CLEAR_STR
6736 BGP_STR
6737 "Clear peers with the AS number\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006738 BGP_SOFT_IN_STR
paul718e3742002-12-13 20:15:29 +00006739 "Push out prefix-list ORF and do inbound soft reconfig\n")
6740{
6741 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
6742 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6743}
6744
6745ALIAS (clear_bgp_as_in_prefix_filter,
6746 clear_bgp_ipv6_as_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006747 "clear bgp ipv6 " CMD_AS_RANGE " in prefix-filter",
paul718e3742002-12-13 20:15:29 +00006748 CLEAR_STR
6749 BGP_STR
6750 "Address family\n"
6751 "Clear peers with the AS number\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006752 BGP_SOFT_IN_STR
paul718e3742002-12-13 20:15:29 +00006753 "Push out prefix-list ORF and do inbound soft reconfig\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02006754
paul718e3742002-12-13 20:15:29 +00006755/* Both soft-reconfiguration */
6756DEFUN (clear_ip_bgp_all_soft,
6757 clear_ip_bgp_all_soft_cmd,
6758 "clear ip bgp * soft",
6759 CLEAR_STR
6760 IP_STR
6761 BGP_STR
6762 "Clear all peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006763 BGP_SOFT_STR)
paul718e3742002-12-13 20:15:29 +00006764{
6765 if (argc == 1)
6766 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
6767 BGP_CLEAR_SOFT_BOTH, NULL);
6768
6769 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6770 BGP_CLEAR_SOFT_BOTH, NULL);
6771}
6772
6773ALIAS (clear_ip_bgp_all_soft,
6774 clear_ip_bgp_instance_all_soft_cmd,
6775 "clear ip bgp view WORD * soft",
6776 CLEAR_STR
6777 IP_STR
6778 BGP_STR
6779 "BGP view\n"
6780 "view name\n"
6781 "Clear all peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006782 BGP_SOFT_STR)
paul718e3742002-12-13 20:15:29 +00006783
6784
6785DEFUN (clear_ip_bgp_all_ipv4_soft,
6786 clear_ip_bgp_all_ipv4_soft_cmd,
6787 "clear ip bgp * ipv4 (unicast|multicast) soft",
6788 CLEAR_STR
6789 IP_STR
6790 BGP_STR
6791 "Clear all peers\n"
6792 "Address family\n"
6793 "Address Family Modifier\n"
6794 "Address Family Modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006795 BGP_SOFT_STR)
paul718e3742002-12-13 20:15:29 +00006796{
6797 if (strncmp (argv[0], "m", 1) == 0)
6798 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
6799 BGP_CLEAR_SOFT_BOTH, NULL);
6800
6801 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6802 BGP_CLEAR_SOFT_BOTH, NULL);
6803}
6804
6805DEFUN (clear_ip_bgp_instance_all_ipv4_soft,
6806 clear_ip_bgp_instance_all_ipv4_soft_cmd,
6807 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft",
6808 CLEAR_STR
6809 IP_STR
6810 BGP_STR
6811 "BGP view\n"
6812 "view name\n"
6813 "Clear all peers\n"
6814 "Address family\n"
6815 "Address Family Modifier\n"
6816 "Address Family Modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006817 BGP_SOFT_STR)
paul718e3742002-12-13 20:15:29 +00006818{
6819 if (strncmp (argv[1], "m", 1) == 0)
6820 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
6821 BGP_CLEAR_SOFT_BOTH, NULL);
6822
6823 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6824 BGP_CLEAR_SOFT_BOTH, NULL);
6825}
6826
6827DEFUN (clear_ip_bgp_all_vpnv4_soft,
6828 clear_ip_bgp_all_vpnv4_soft_cmd,
6829 "clear ip bgp * vpnv4 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"
Daniel Walton988a50c2015-05-19 17:58:11 -07006836 BGP_SOFT_STR)
paul718e3742002-12-13 20:15:29 +00006837{
6838 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
6839 BGP_CLEAR_SOFT_BOTH, argv[0]);
6840}
6841
Lou Berger298cc2f2016-01-12 13:42:02 -05006842DEFUN (clear_ip_bgp_all_encap_soft,
6843 clear_ip_bgp_all_encap_soft_cmd,
6844 "clear ip bgp * encap unicast soft",
6845 CLEAR_STR
6846 IP_STR
6847 BGP_STR
6848 "Clear all peers\n"
6849 "Address family\n"
6850 "Address Family Modifier\n"
6851 "Soft reconfig\n")
6852{
6853 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_all,
6854 BGP_CLEAR_SOFT_BOTH, argv[0]);
6855}
6856
paul718e3742002-12-13 20:15:29 +00006857DEFUN (clear_bgp_all_soft,
6858 clear_bgp_all_soft_cmd,
6859 "clear bgp * soft",
6860 CLEAR_STR
6861 BGP_STR
6862 "Clear all peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006863 BGP_SOFT_STR)
paul718e3742002-12-13 20:15:29 +00006864{
6865 if (argc == 1)
6866 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
6867 BGP_CLEAR_SOFT_BOTH, argv[0]);
6868
6869 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
6870 BGP_CLEAR_SOFT_BOTH, argv[0]);
6871}
6872
6873ALIAS (clear_bgp_all_soft,
6874 clear_bgp_instance_all_soft_cmd,
6875 "clear bgp view WORD * soft",
6876 CLEAR_STR
6877 BGP_STR
6878 "BGP view\n"
6879 "view name\n"
6880 "Clear all peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006881 BGP_SOFT_STR)
paul718e3742002-12-13 20:15:29 +00006882
6883ALIAS (clear_bgp_all_soft,
6884 clear_bgp_ipv6_all_soft_cmd,
6885 "clear bgp ipv6 * soft",
6886 CLEAR_STR
6887 BGP_STR
6888 "Address family\n"
6889 "Clear all peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006890 BGP_SOFT_STR)
paul718e3742002-12-13 20:15:29 +00006891
6892DEFUN (clear_ip_bgp_peer_soft,
6893 clear_ip_bgp_peer_soft_cmd,
6894 "clear ip bgp A.B.C.D soft",
6895 CLEAR_STR
6896 IP_STR
6897 BGP_STR
6898 "BGP neighbor address to clear\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006899 BGP_SOFT_STR)
paul718e3742002-12-13 20:15:29 +00006900{
6901 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6902 BGP_CLEAR_SOFT_BOTH, argv[0]);
6903}
6904
6905DEFUN (clear_ip_bgp_peer_ipv4_soft,
6906 clear_ip_bgp_peer_ipv4_soft_cmd,
6907 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft",
6908 CLEAR_STR
6909 IP_STR
6910 BGP_STR
6911 "BGP neighbor address to clear\n"
6912 "Address family\n"
6913 "Address Family Modifier\n"
6914 "Address Family Modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006915 BGP_SOFT_STR)
paul718e3742002-12-13 20:15:29 +00006916{
6917 if (strncmp (argv[1], "m", 1) == 0)
6918 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
6919 BGP_CLEAR_SOFT_BOTH, argv[0]);
6920
6921 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6922 BGP_CLEAR_SOFT_BOTH, argv[0]);
6923}
6924
6925DEFUN (clear_ip_bgp_peer_vpnv4_soft,
6926 clear_ip_bgp_peer_vpnv4_soft_cmd,
6927 "clear ip bgp A.B.C.D vpnv4 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"
Daniel Walton988a50c2015-05-19 17:58:11 -07006934 BGP_SOFT_STR)
paul718e3742002-12-13 20:15:29 +00006935{
6936 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
6937 BGP_CLEAR_SOFT_BOTH, argv[0]);
6938}
6939
Lou Berger298cc2f2016-01-12 13:42:02 -05006940DEFUN (clear_ip_bgp_peer_encap_soft,
6941 clear_ip_bgp_peer_encap_soft_cmd,
6942 "clear ip bgp A.B.C.D encap unicast soft",
6943 CLEAR_STR
6944 IP_STR
6945 BGP_STR
6946 "BGP neighbor address to clear\n"
6947 "Address family\n"
6948 "Address Family Modifier\n"
6949 "Soft reconfig\n")
6950{
6951 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_peer,
6952 BGP_CLEAR_SOFT_BOTH, argv[0]);
6953}
6954
paul718e3742002-12-13 20:15:29 +00006955DEFUN (clear_bgp_peer_soft,
6956 clear_bgp_peer_soft_cmd,
6957 "clear bgp (A.B.C.D|X:X::X:X) soft",
6958 CLEAR_STR
6959 BGP_STR
6960 "BGP neighbor address to clear\n"
6961 "BGP IPv6 neighbor to clear\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006962 BGP_SOFT_STR)
paul718e3742002-12-13 20:15:29 +00006963{
6964 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
6965 BGP_CLEAR_SOFT_BOTH, argv[0]);
6966}
6967
6968ALIAS (clear_bgp_peer_soft,
6969 clear_bgp_ipv6_peer_soft_cmd,
6970 "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft",
6971 CLEAR_STR
6972 BGP_STR
6973 "Address family\n"
6974 "BGP neighbor address to clear\n"
6975 "BGP IPv6 neighbor to clear\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006976 BGP_SOFT_STR)
paul718e3742002-12-13 20:15:29 +00006977
6978DEFUN (clear_ip_bgp_peer_group_soft,
6979 clear_ip_bgp_peer_group_soft_cmd,
6980 "clear ip bgp peer-group WORD soft",
6981 CLEAR_STR
6982 IP_STR
6983 BGP_STR
6984 "Clear all members of peer-group\n"
6985 "BGP peer-group name\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07006986 BGP_SOFT_STR)
paul718e3742002-12-13 20:15:29 +00006987{
6988 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6989 BGP_CLEAR_SOFT_BOTH, argv[0]);
6990}
6991
6992DEFUN (clear_ip_bgp_peer_group_ipv4_soft,
6993 clear_ip_bgp_peer_group_ipv4_soft_cmd,
6994 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft",
6995 CLEAR_STR
6996 IP_STR
6997 BGP_STR
6998 "Clear all members of peer-group\n"
6999 "BGP peer-group name\n"
7000 "Address family\n"
7001 "Address Family modifier\n"
7002 "Address Family modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07007003 BGP_SOFT_STR)
paul718e3742002-12-13 20:15:29 +00007004{
7005 if (strncmp (argv[1], "m", 1) == 0)
7006 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
7007 BGP_CLEAR_SOFT_BOTH, argv[0]);
7008
7009 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
7010 BGP_CLEAR_SOFT_BOTH, argv[0]);
7011}
7012
7013DEFUN (clear_bgp_peer_group_soft,
7014 clear_bgp_peer_group_soft_cmd,
7015 "clear bgp peer-group WORD soft",
7016 CLEAR_STR
7017 BGP_STR
7018 "Clear all members of peer-group\n"
7019 "BGP peer-group name\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07007020 BGP_SOFT_STR)
paul718e3742002-12-13 20:15:29 +00007021{
7022 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
7023 BGP_CLEAR_SOFT_BOTH, argv[0]);
7024}
7025
7026ALIAS (clear_bgp_peer_group_soft,
7027 clear_bgp_ipv6_peer_group_soft_cmd,
7028 "clear bgp ipv6 peer-group WORD soft",
7029 CLEAR_STR
7030 BGP_STR
7031 "Address family\n"
7032 "Clear all members of peer-group\n"
7033 "BGP peer-group name\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07007034 BGP_SOFT_STR)
paul718e3742002-12-13 20:15:29 +00007035
7036DEFUN (clear_ip_bgp_external_soft,
7037 clear_ip_bgp_external_soft_cmd,
7038 "clear ip bgp external soft",
7039 CLEAR_STR
7040 IP_STR
7041 BGP_STR
7042 "Clear all external peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07007043 BGP_SOFT_STR)
paul718e3742002-12-13 20:15:29 +00007044{
7045 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
7046 BGP_CLEAR_SOFT_BOTH, NULL);
7047}
7048
7049DEFUN (clear_ip_bgp_external_ipv4_soft,
7050 clear_ip_bgp_external_ipv4_soft_cmd,
7051 "clear ip bgp external ipv4 (unicast|multicast) soft",
7052 CLEAR_STR
7053 IP_STR
7054 BGP_STR
7055 "Clear all external peers\n"
7056 "Address family\n"
7057 "Address Family modifier\n"
7058 "Address Family modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07007059 BGP_SOFT_STR)
paul718e3742002-12-13 20:15:29 +00007060{
7061 if (strncmp (argv[0], "m", 1) == 0)
7062 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
7063 BGP_CLEAR_SOFT_BOTH, NULL);
7064
7065 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
7066 BGP_CLEAR_SOFT_BOTH, NULL);
7067}
7068
7069DEFUN (clear_bgp_external_soft,
7070 clear_bgp_external_soft_cmd,
7071 "clear bgp external soft",
7072 CLEAR_STR
7073 BGP_STR
7074 "Clear all external peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07007075 BGP_SOFT_STR)
paul718e3742002-12-13 20:15:29 +00007076{
7077 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
7078 BGP_CLEAR_SOFT_BOTH, NULL);
7079}
7080
7081ALIAS (clear_bgp_external_soft,
7082 clear_bgp_ipv6_external_soft_cmd,
7083 "clear bgp ipv6 external soft",
7084 CLEAR_STR
7085 BGP_STR
7086 "Address family\n"
7087 "Clear all external peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07007088 BGP_SOFT_STR)
paul718e3742002-12-13 20:15:29 +00007089
7090DEFUN (clear_ip_bgp_as_soft,
7091 clear_ip_bgp_as_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00007092 "clear ip bgp " CMD_AS_RANGE " soft",
paul718e3742002-12-13 20:15:29 +00007093 CLEAR_STR
7094 IP_STR
7095 BGP_STR
7096 "Clear peers with the AS number\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07007097 BGP_SOFT_STR)
paul718e3742002-12-13 20:15:29 +00007098{
7099 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
7100 BGP_CLEAR_SOFT_BOTH, argv[0]);
7101}
7102
7103DEFUN (clear_ip_bgp_as_ipv4_soft,
7104 clear_ip_bgp_as_ipv4_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00007105 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft",
paul718e3742002-12-13 20:15:29 +00007106 CLEAR_STR
7107 IP_STR
7108 BGP_STR
7109 "Clear peers with the AS number\n"
7110 "Address family\n"
7111 "Address Family Modifier\n"
7112 "Address Family Modifier\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07007113 BGP_SOFT_STR)
paul718e3742002-12-13 20:15:29 +00007114{
7115 if (strncmp (argv[1], "m", 1) == 0)
7116 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
7117 BGP_CLEAR_SOFT_BOTH, argv[0]);
7118
7119 return bgp_clear_vty (vty, NULL,AFI_IP, SAFI_UNICAST, clear_as,
7120 BGP_CLEAR_SOFT_BOTH, argv[0]);
7121}
7122
7123DEFUN (clear_ip_bgp_as_vpnv4_soft,
7124 clear_ip_bgp_as_vpnv4_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00007125 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft",
paul718e3742002-12-13 20:15:29 +00007126 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"
Daniel Walton988a50c2015-05-19 17:58:11 -07007132 BGP_SOFT_STR)
paul718e3742002-12-13 20:15:29 +00007133{
7134 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
7135 BGP_CLEAR_SOFT_BOTH, argv[0]);
7136}
7137
Lou Berger298cc2f2016-01-12 13:42:02 -05007138DEFUN (clear_ip_bgp_as_encap_soft,
7139 clear_ip_bgp_as_encap_soft_cmd,
7140 "clear ip bgp " CMD_AS_RANGE " encap unicast soft",
7141 CLEAR_STR
7142 IP_STR
7143 BGP_STR
7144 "Clear peers with the AS number\n"
7145 "Address family\n"
7146 "Address Family Modifier\n"
7147 "Soft reconfig\n")
7148{
7149 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_as,
7150 BGP_CLEAR_SOFT_BOTH, argv[0]);
7151}
7152
paul718e3742002-12-13 20:15:29 +00007153DEFUN (clear_bgp_as_soft,
7154 clear_bgp_as_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00007155 "clear bgp " CMD_AS_RANGE " soft",
paul718e3742002-12-13 20:15:29 +00007156 CLEAR_STR
7157 BGP_STR
7158 "Clear peers with the AS number\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07007159 BGP_SOFT_STR)
paul718e3742002-12-13 20:15:29 +00007160{
7161 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
7162 BGP_CLEAR_SOFT_BOTH, argv[0]);
7163}
7164
7165ALIAS (clear_bgp_as_soft,
7166 clear_bgp_ipv6_as_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00007167 "clear bgp ipv6 " CMD_AS_RANGE " soft",
paul718e3742002-12-13 20:15:29 +00007168 CLEAR_STR
7169 BGP_STR
7170 "Address family\n"
7171 "Clear peers with the AS number\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07007172 BGP_SOFT_STR)
David Lamparter6b0655a2014-06-04 06:53:35 +02007173
paulfee0f4c2004-09-13 05:12:46 +00007174/* RS-client soft reconfiguration. */
paulfee0f4c2004-09-13 05:12:46 +00007175DEFUN (clear_bgp_all_rsclient,
7176 clear_bgp_all_rsclient_cmd,
7177 "clear bgp * rsclient",
7178 CLEAR_STR
7179 BGP_STR
7180 "Clear all peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07007181 BGP_SOFT_RSCLIENT_RIB_STR)
paulfee0f4c2004-09-13 05:12:46 +00007182{
7183 if (argc == 1)
7184 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
7185 BGP_CLEAR_SOFT_RSCLIENT, NULL);
7186
7187 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
7188 BGP_CLEAR_SOFT_RSCLIENT, NULL);
7189}
7190
7191ALIAS (clear_bgp_all_rsclient,
7192 clear_bgp_ipv6_all_rsclient_cmd,
7193 "clear bgp ipv6 * rsclient",
7194 CLEAR_STR
7195 BGP_STR
7196 "Address family\n"
7197 "Clear all peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07007198 BGP_SOFT_RSCLIENT_RIB_STR)
paulfee0f4c2004-09-13 05:12:46 +00007199
7200ALIAS (clear_bgp_all_rsclient,
7201 clear_bgp_instance_all_rsclient_cmd,
7202 "clear bgp view WORD * rsclient",
7203 CLEAR_STR
7204 BGP_STR
7205 "BGP view\n"
7206 "view name\n"
7207 "Clear all peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07007208 BGP_SOFT_RSCLIENT_RIB_STR)
paulfee0f4c2004-09-13 05:12:46 +00007209
7210ALIAS (clear_bgp_all_rsclient,
7211 clear_bgp_ipv6_instance_all_rsclient_cmd,
7212 "clear bgp ipv6 view WORD * rsclient",
7213 CLEAR_STR
7214 BGP_STR
7215 "Address family\n"
7216 "BGP view\n"
7217 "view name\n"
7218 "Clear all peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07007219 BGP_SOFT_RSCLIENT_RIB_STR)
paulfee0f4c2004-09-13 05:12:46 +00007220
7221DEFUN (clear_ip_bgp_all_rsclient,
7222 clear_ip_bgp_all_rsclient_cmd,
7223 "clear ip bgp * rsclient",
7224 CLEAR_STR
7225 IP_STR
7226 BGP_STR
7227 "Clear all peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07007228 BGP_SOFT_RSCLIENT_RIB_STR)
paulfee0f4c2004-09-13 05:12:46 +00007229{
7230 if (argc == 1)
7231 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
7232 BGP_CLEAR_SOFT_RSCLIENT, NULL);
7233
7234 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
7235 BGP_CLEAR_SOFT_RSCLIENT, NULL);
7236}
7237
7238ALIAS (clear_ip_bgp_all_rsclient,
7239 clear_ip_bgp_instance_all_rsclient_cmd,
7240 "clear ip bgp view WORD * rsclient",
7241 CLEAR_STR
7242 IP_STR
7243 BGP_STR
7244 "BGP view\n"
7245 "view name\n"
7246 "Clear all peers\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07007247 BGP_SOFT_RSCLIENT_RIB_STR)
paulfee0f4c2004-09-13 05:12:46 +00007248
paulfee0f4c2004-09-13 05:12:46 +00007249DEFUN (clear_bgp_peer_rsclient,
7250 clear_bgp_peer_rsclient_cmd,
7251 "clear bgp (A.B.C.D|X:X::X:X) rsclient",
7252 CLEAR_STR
7253 BGP_STR
7254 "BGP neighbor IP address to clear\n"
7255 "BGP IPv6 neighbor to clear\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07007256 BGP_SOFT_RSCLIENT_RIB_STR)
paulfee0f4c2004-09-13 05:12:46 +00007257{
7258 if (argc == 2)
7259 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_peer,
7260 BGP_CLEAR_SOFT_RSCLIENT, argv[1]);
7261
7262 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
7263 BGP_CLEAR_SOFT_RSCLIENT, argv[0]);
7264}
7265
7266ALIAS (clear_bgp_peer_rsclient,
7267 clear_bgp_ipv6_peer_rsclient_cmd,
7268 "clear bgp ipv6 (A.B.C.D|X:X::X:X) rsclient",
7269 CLEAR_STR
7270 BGP_STR
7271 "Address family\n"
7272 "BGP neighbor IP address to clear\n"
7273 "BGP IPv6 neighbor to clear\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07007274 BGP_SOFT_RSCLIENT_RIB_STR)
paulfee0f4c2004-09-13 05:12:46 +00007275
7276ALIAS (clear_bgp_peer_rsclient,
7277 clear_bgp_instance_peer_rsclient_cmd,
7278 "clear bgp view WORD (A.B.C.D|X:X::X:X) rsclient",
7279 CLEAR_STR
7280 BGP_STR
7281 "BGP view\n"
7282 "view name\n"
7283 "BGP neighbor IP address to clear\n"
7284 "BGP IPv6 neighbor to clear\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07007285 BGP_SOFT_RSCLIENT_RIB_STR)
paulfee0f4c2004-09-13 05:12:46 +00007286
7287ALIAS (clear_bgp_peer_rsclient,
7288 clear_bgp_ipv6_instance_peer_rsclient_cmd,
7289 "clear bgp ipv6 view WORD (A.B.C.D|X:X::X:X) rsclient",
7290 CLEAR_STR
7291 BGP_STR
7292 "Address family\n"
7293 "BGP view\n"
7294 "view name\n"
7295 "BGP neighbor IP address to clear\n"
7296 "BGP IPv6 neighbor to clear\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07007297 BGP_SOFT_RSCLIENT_RIB_STR)
paulfee0f4c2004-09-13 05:12:46 +00007298
7299DEFUN (clear_ip_bgp_peer_rsclient,
7300 clear_ip_bgp_peer_rsclient_cmd,
7301 "clear ip bgp (A.B.C.D|X:X::X:X) rsclient",
7302 CLEAR_STR
7303 IP_STR
7304 BGP_STR
7305 "BGP neighbor IP address to clear\n"
7306 "BGP IPv6 neighbor to clear\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07007307 BGP_SOFT_RSCLIENT_RIB_STR)
paulfee0f4c2004-09-13 05:12:46 +00007308{
7309 if (argc == 2)
7310 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_peer,
7311 BGP_CLEAR_SOFT_RSCLIENT, argv[1]);
7312
7313 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
7314 BGP_CLEAR_SOFT_RSCLIENT, argv[0]);
7315}
7316
7317ALIAS (clear_ip_bgp_peer_rsclient,
7318 clear_ip_bgp_instance_peer_rsclient_cmd,
7319 "clear ip bgp view WORD (A.B.C.D|X:X::X:X) rsclient",
7320 CLEAR_STR
7321 IP_STR
7322 BGP_STR
7323 "BGP view\n"
7324 "view name\n"
7325 "BGP neighbor IP address to clear\n"
7326 "BGP IPv6 neighbor to clear\n"
Daniel Walton988a50c2015-05-19 17:58:11 -07007327 BGP_SOFT_RSCLIENT_RIB_STR)
paulfee0f4c2004-09-13 05:12:46 +00007328
Michael Lamberte0081f72008-11-16 20:12:04 +00007329DEFUN (show_bgp_views,
7330 show_bgp_views_cmd,
7331 "show bgp views",
7332 SHOW_STR
7333 BGP_STR
7334 "Show the defined BGP views\n")
7335{
7336 struct list *inst = bm->bgp;
7337 struct listnode *node;
7338 struct bgp *bgp;
7339
7340 if (!bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE))
7341 {
7342 vty_out (vty, "Multiple BGP views are not defined%s", VTY_NEWLINE);
7343 return CMD_WARNING;
7344 }
7345
7346 vty_out (vty, "Defined BGP views:%s", VTY_NEWLINE);
7347 for (ALL_LIST_ELEMENTS_RO(inst, node, bgp))
7348 vty_out (vty, "\t%s (AS%u)%s",
7349 bgp->name ? bgp->name : "(null)",
7350 bgp->as, VTY_NEWLINE);
7351
7352 return CMD_SUCCESS;
7353}
7354
Paul Jakma4bf6a362006-03-30 14:05:23 +00007355DEFUN (show_bgp_memory,
7356 show_bgp_memory_cmd,
7357 "show bgp memory",
7358 SHOW_STR
7359 BGP_STR
7360 "Global BGP memory statistics\n")
7361{
7362 char memstrbuf[MTYPE_MEMSTR_LEN];
7363 unsigned long count;
7364
7365 /* RIB related usage stats */
7366 count = mtype_stats_alloc (MTYPE_BGP_NODE);
7367 vty_out (vty, "%ld RIB nodes, using %s of memory%s", count,
7368 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7369 count * sizeof (struct bgp_node)),
7370 VTY_NEWLINE);
7371
7372 count = mtype_stats_alloc (MTYPE_BGP_ROUTE);
7373 vty_out (vty, "%ld BGP routes, using %s of memory%s", count,
7374 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7375 count * sizeof (struct bgp_info)),
7376 VTY_NEWLINE);
Paul Jakmafb982c22007-05-04 20:15:47 +00007377 if ((count = mtype_stats_alloc (MTYPE_BGP_ROUTE_EXTRA)))
7378 vty_out (vty, "%ld BGP route ancillaries, using %s of memory%s", count,
7379 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7380 count * sizeof (struct bgp_info_extra)),
7381 VTY_NEWLINE);
Paul Jakma4bf6a362006-03-30 14:05:23 +00007382
7383 if ((count = mtype_stats_alloc (MTYPE_BGP_STATIC)))
7384 vty_out (vty, "%ld Static routes, using %s of memory%s", count,
7385 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7386 count * sizeof (struct bgp_static)),
7387 VTY_NEWLINE);
7388
7389 /* Adj-In/Out */
7390 if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_IN)))
7391 vty_out (vty, "%ld Adj-In entries, using %s of memory%s", count,
7392 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7393 count * sizeof (struct bgp_adj_in)),
7394 VTY_NEWLINE);
7395 if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_OUT)))
7396 vty_out (vty, "%ld Adj-Out entries, using %s of memory%s", count,
7397 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7398 count * sizeof (struct bgp_adj_out)),
7399 VTY_NEWLINE);
7400
7401 if ((count = mtype_stats_alloc (MTYPE_BGP_NEXTHOP_CACHE)))
7402 vty_out (vty, "%ld Nexthop cache entries, using %s of memory%s", count,
7403 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7404 count * sizeof (struct bgp_nexthop_cache)),
7405 VTY_NEWLINE);
7406
7407 if ((count = mtype_stats_alloc (MTYPE_BGP_DAMP_INFO)))
7408 vty_out (vty, "%ld Dampening entries, using %s of memory%s", count,
7409 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7410 count * sizeof (struct bgp_damp_info)),
7411 VTY_NEWLINE);
7412
7413 /* Attributes */
7414 count = attr_count();
7415 vty_out (vty, "%ld BGP attributes, using %s of memory%s", count,
7416 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7417 count * sizeof(struct attr)),
7418 VTY_NEWLINE);
Paul Jakmafb982c22007-05-04 20:15:47 +00007419 if ((count = mtype_stats_alloc (MTYPE_ATTR_EXTRA)))
7420 vty_out (vty, "%ld BGP extra attributes, using %s of memory%s", count,
7421 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7422 count * sizeof(struct attr_extra)),
7423 VTY_NEWLINE);
Paul Jakma4bf6a362006-03-30 14:05:23 +00007424
7425 if ((count = attr_unknown_count()))
7426 vty_out (vty, "%ld unknown attributes%s", count, VTY_NEWLINE);
7427
7428 /* AS_PATH attributes */
7429 count = aspath_count ();
7430 vty_out (vty, "%ld BGP AS-PATH entries, using %s of memory%s", count,
7431 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7432 count * sizeof (struct aspath)),
7433 VTY_NEWLINE);
7434
7435 count = mtype_stats_alloc (MTYPE_AS_SEG);
7436 vty_out (vty, "%ld BGP AS-PATH segments, using %s of memory%s", count,
7437 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7438 count * sizeof (struct assegment)),
7439 VTY_NEWLINE);
7440
7441 /* Other attributes */
7442 if ((count = community_count ()))
7443 vty_out (vty, "%ld BGP community entries, using %s of memory%s", count,
7444 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7445 count * sizeof (struct community)),
7446 VTY_NEWLINE);
7447 if ((count = mtype_stats_alloc (MTYPE_ECOMMUNITY)))
7448 vty_out (vty, "%ld BGP community entries, using %s of memory%s", count,
7449 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7450 count * sizeof (struct ecommunity)),
7451 VTY_NEWLINE);
Job Snijders3334bab2017-01-20 14:47:12 +00007452 if ((count = mtype_stats_alloc (MTYPE_LCOMMUNITY)))
7453 vty_out (vty, "%ld BGP large-community entries, using %s of memory%s",
7454 count,
7455 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7456 count * sizeof (struct lcommunity)),
7457 VTY_NEWLINE);
Paul Jakma4bf6a362006-03-30 14:05:23 +00007458 if ((count = mtype_stats_alloc (MTYPE_CLUSTER)))
7459 vty_out (vty, "%ld Cluster lists, using %s of memory%s", count,
7460 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7461 count * sizeof (struct cluster_list)),
7462 VTY_NEWLINE);
7463
7464 /* Peer related usage */
7465 count = mtype_stats_alloc (MTYPE_BGP_PEER);
7466 vty_out (vty, "%ld peers, using %s of memory%s", count,
7467 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7468 count * sizeof (struct peer)),
7469 VTY_NEWLINE);
7470
7471 if ((count = mtype_stats_alloc (MTYPE_PEER_GROUP)))
7472 vty_out (vty, "%ld peer groups, using %s of memory%s", count,
7473 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7474 count * sizeof (struct peer_group)),
7475 VTY_NEWLINE);
7476
7477 /* Other */
7478 if ((count = mtype_stats_alloc (MTYPE_HASH)))
7479 vty_out (vty, "%ld hash tables, using %s of memory%s", count,
7480 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7481 count * sizeof (struct hash)),
7482 VTY_NEWLINE);
7483 if ((count = mtype_stats_alloc (MTYPE_HASH_BACKET)))
7484 vty_out (vty, "%ld hash buckets, using %s of memory%s", count,
7485 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7486 count * sizeof (struct hash_backet)),
7487 VTY_NEWLINE);
7488 if ((count = mtype_stats_alloc (MTYPE_BGP_REGEXP)))
7489 vty_out (vty, "%ld compiled regexes, using %s of memory%s", count,
7490 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7491 count * sizeof (regex_t)),
7492 VTY_NEWLINE);
7493 return CMD_SUCCESS;
7494}
paulfee0f4c2004-09-13 05:12:46 +00007495
paul718e3742002-12-13 20:15:29 +00007496/* Show BGP peer's summary information. */
paul94f2b392005-06-28 12:44:16 +00007497static int
paul718e3742002-12-13 20:15:29 +00007498bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi)
7499{
7500 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00007501 struct listnode *node, *nnode;
Paul Jakma4bf6a362006-03-30 14:05:23 +00007502 unsigned int count = 0;
Paul Jakma574e5002016-05-17 13:33:11 +01007503 unsigned int totrcount = 0;
7504 unsigned int totecount = 0;
paul718e3742002-12-13 20:15:29 +00007505 char timebuf[BGP_UPTIME_LEN];
7506 int len;
7507
7508 /* Header string for each address family. */
Milan Kociancb4fc592014-12-01 12:48:25 +00007509 static char header[] = "Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd";
Paul Jakma4bf6a362006-03-30 14:05:23 +00007510
paul1eb8ef22005-04-07 07:30:20 +00007511 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00007512 {
7513 if (peer->afc[afi][safi])
7514 {
Paul Jakma4bf6a362006-03-30 14:05:23 +00007515 if (!count)
7516 {
7517 unsigned long ents;
7518 char memstrbuf[MTYPE_MEMSTR_LEN];
7519
7520 /* Usage summary and header */
7521 vty_out (vty,
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04007522 "BGP router identifier %s, local AS number %u%s",
Paul Jakma4bf6a362006-03-30 14:05:23 +00007523 inet_ntoa (bgp->router_id), bgp->as, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007524
Paul Jakma4bf6a362006-03-30 14:05:23 +00007525 ents = bgp_table_count (bgp->rib[afi][safi]);
7526 vty_out (vty, "RIB entries %ld, using %s of memory%s", ents,
7527 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7528 ents * sizeof (struct bgp_node)),
7529 VTY_NEWLINE);
7530
7531 /* Peer related usage */
7532 ents = listcount (bgp->peer);
7533 vty_out (vty, "Peers %ld, using %s of memory%s",
7534 ents,
7535 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7536 ents * sizeof (struct peer)),
7537 VTY_NEWLINE);
7538
7539 if ((ents = listcount (bgp->rsclient)))
7540 vty_out (vty, "RS-Client peers %ld, using %s of memory%s",
7541 ents,
7542 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7543 ents * sizeof (struct peer)),
7544 VTY_NEWLINE);
7545
7546 if ((ents = listcount (bgp->group)))
7547 vty_out (vty, "Peer groups %ld, using %s of memory%s", ents,
7548 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7549 ents * sizeof (struct peer_group)),
7550 VTY_NEWLINE);
7551
7552 if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING))
7553 vty_out (vty, "Dampening enabled.%s", VTY_NEWLINE);
7554 vty_out (vty, "%s", VTY_NEWLINE);
7555 vty_out (vty, "%s%s", header, VTY_NEWLINE);
7556 }
7557
paul718e3742002-12-13 20:15:29 +00007558 count++;
7559
7560 len = vty_out (vty, "%s", peer->host);
7561 len = 16 - len;
7562 if (len < 1)
7563 vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " ");
7564 else
7565 vty_out (vty, "%*s", len, " ");
7566
hasso3d515fd2005-02-01 21:30:04 +00007567 vty_out (vty, "4 ");
paul718e3742002-12-13 20:15:29 +00007568
Pradosh Mohapatraaf309fa2015-11-09 20:21:47 -05007569 vty_out (vty, "%5u %7d %7d %8d %4d %4d ",
paul718e3742002-12-13 20:15:29 +00007570 peer->as,
7571 peer->open_in + peer->update_in + peer->keepalive_in
7572 + peer->notify_in + peer->refresh_in + peer->dynamic_cap_in,
7573 peer->open_out + peer->update_out + peer->keepalive_out
7574 + peer->notify_out + peer->refresh_out
7575 + peer->dynamic_cap_out,
Pradosh Mohapatraaf309fa2015-11-09 20:21:47 -05007576 0, 0,
7577 peer->sync[afi][safi]->update.count +
7578 peer->sync[afi][safi]->withdraw.count);
paul718e3742002-12-13 20:15:29 +00007579
7580 vty_out (vty, "%8s",
7581 peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN));
7582
7583 if (peer->status == Established)
7584 {
7585 vty_out (vty, " %8ld", peer->pcount[afi][safi]);
Paul Jakma574e5002016-05-17 13:33:11 +01007586 totrcount += peer->pcount[afi][safi];
7587 totecount++;
paul718e3742002-12-13 20:15:29 +00007588 }
7589 else
7590 {
7591 if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN))
7592 vty_out (vty, " Idle (Admin)");
7593 else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW))
7594 vty_out (vty, " Idle (PfxCt)");
7595 else
7596 vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, peer->status));
7597 }
7598
7599 vty_out (vty, "%s", VTY_NEWLINE);
7600 }
7601 }
7602
7603 if (count)
Paul Jakma574e5002016-05-17 13:33:11 +01007604 {
7605 vty_out (vty, "%sTotal number of neighbors %d%s", VTY_NEWLINE,
7606 count, VTY_NEWLINE);
7607 vty_out (vty, "%sTotal num. Established sessions %d%s", VTY_NEWLINE,
7608 totecount, VTY_NEWLINE);
7609 vty_out (vty, "Total num. of routes received %d%s",
7610 totrcount, VTY_NEWLINE);
7611 }
paul718e3742002-12-13 20:15:29 +00007612 else
7613 vty_out (vty, "No %s neighbor is configured%s",
7614 afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE);
7615 return CMD_SUCCESS;
7616}
7617
paul94f2b392005-06-28 12:44:16 +00007618static int
paulfd79ac92004-10-13 05:06:08 +00007619bgp_show_summary_vty (struct vty *vty, const char *name,
7620 afi_t afi, safi_t safi)
paul718e3742002-12-13 20:15:29 +00007621{
7622 struct bgp *bgp;
7623
7624 if (name)
7625 {
7626 bgp = bgp_lookup_by_name (name);
7627
7628 if (! bgp)
7629 {
7630 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
7631 return CMD_WARNING;
7632 }
7633
7634 bgp_show_summary (vty, bgp, afi, safi);
7635 return CMD_SUCCESS;
7636 }
7637
7638 bgp = bgp_get_default ();
7639
7640 if (bgp)
7641 bgp_show_summary (vty, bgp, afi, safi);
7642
7643 return CMD_SUCCESS;
7644}
7645
7646/* `show ip bgp summary' commands. */
Lou Bergerf9b6c392016-01-12 13:42:09 -05007647DEFUN (show_ip_bgp_summary,
7648 show_ip_bgp_summary_cmd,
7649 "show ip bgp summary",
7650 SHOW_STR
7651 IP_STR
7652 BGP_STR
7653 "Summary of BGP neighbor status\n")
7654{
7655 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
7656}
7657
7658DEFUN (show_ip_bgp_instance_summary,
7659 show_ip_bgp_instance_summary_cmd,
7660 "show ip bgp view WORD summary",
7661 SHOW_STR
7662 IP_STR
7663 BGP_STR
7664 "BGP view\n"
7665 "View name\n"
7666 "Summary of BGP neighbor status\n")
7667{
7668 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
7669}
7670
7671DEFUN (show_ip_bgp_ipv4_summary,
7672 show_ip_bgp_ipv4_summary_cmd,
7673 "show ip bgp ipv4 (unicast|multicast) summary",
7674 SHOW_STR
7675 IP_STR
7676 BGP_STR
7677 "Address family\n"
7678 "Address Family modifier\n"
7679 "Address Family modifier\n"
7680 "Summary of BGP neighbor status\n")
7681{
7682 if (strncmp (argv[0], "m", 1) == 0)
7683 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
7684
7685 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
7686}
7687
7688DEFUN (show_ip_bgp_instance_ipv4_summary,
7689 show_ip_bgp_instance_ipv4_summary_cmd,
7690 "show ip bgp view WORD ipv4 (unicast|multicast) summary",
7691 SHOW_STR
7692 IP_STR
7693 BGP_STR
7694 "BGP view\n"
7695 "View name\n"
7696 "Address family\n"
7697 "Address Family modifier\n"
7698 "Address Family modifier\n"
7699 "Summary of BGP neighbor status\n")
7700{
7701 if (strncmp (argv[1], "m", 1) == 0)
7702 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
7703 else
7704 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
7705}
7706
7707DEFUN (show_ip_bgp_vpnv4_all_summary,
7708 show_ip_bgp_vpnv4_all_summary_cmd,
7709 "show ip bgp vpnv4 all summary",
7710 SHOW_STR
7711 IP_STR
7712 BGP_STR
7713 "Display VPNv4 NLRI specific information\n"
7714 "Display information about all VPNv4 NLRIs\n"
7715 "Summary of BGP neighbor status\n")
7716{
7717 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
7718}
7719
7720DEFUN (show_ip_bgp_vpnv4_rd_summary,
7721 show_ip_bgp_vpnv4_rd_summary_cmd,
7722 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn summary",
7723 SHOW_STR
7724 IP_STR
7725 BGP_STR
7726 "Display VPNv4 NLRI specific information\n"
7727 "Display information for a route distinguisher\n"
7728 "VPN Route Distinguisher\n"
7729 "Summary of BGP neighbor status\n")
7730{
7731 int ret;
7732 struct prefix_rd prd;
7733
7734 ret = str2prefix_rd (argv[0], &prd);
7735 if (! ret)
7736 {
7737 vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
7738 return CMD_WARNING;
7739 }
7740
7741 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
7742}
7743
Lou Berger651b4022016-01-12 13:42:07 -05007744DEFUN (show_bgp_ipv4_safi_summary,
7745 show_bgp_ipv4_safi_summary_cmd,
7746 "show bgp ipv4 (unicast|multicast) summary",
paul718e3742002-12-13 20:15:29 +00007747 SHOW_STR
paul718e3742002-12-13 20:15:29 +00007748 BGP_STR
7749 "Address family\n"
7750 "Address Family modifier\n"
7751 "Address Family modifier\n"
7752 "Summary of BGP neighbor status\n")
7753{
7754 if (strncmp (argv[0], "m", 1) == 0)
7755 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
7756
7757 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
7758}
7759
Lou Berger651b4022016-01-12 13:42:07 -05007760DEFUN (show_bgp_instance_ipv4_safi_summary,
7761 show_bgp_instance_ipv4_safi_summary_cmd,
7762 "show bgp view WORD ipv4 (unicast|multicast) summary",
Michael Lambert95cbbd22010-07-23 14:43:04 -04007763 SHOW_STR
7764 BGP_STR
paul718e3742002-12-13 20:15:29 +00007765 "BGP view\n"
7766 "View name\n"
7767 "Address family\n"
7768 "Address Family modifier\n"
7769 "Address Family modifier\n"
7770 "Summary of BGP neighbor status\n")
7771{
7772 if (strncmp (argv[1], "m", 1) == 0)
7773 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
7774 else
7775 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
7776}
7777
Lou Berger651b4022016-01-12 13:42:07 -05007778DEFUN (show_bgp_ipv4_vpn_summary,
7779 show_bgp_ipv4_vpn_summary_cmd,
7780 "show bgp ipv4 vpn summary",
Michael Lambert95cbbd22010-07-23 14:43:04 -04007781 SHOW_STR
7782 BGP_STR
Lou Berger651b4022016-01-12 13:42:07 -05007783 "IPv4\n"
7784 "Display VPN NLRI specific information\n"
paul718e3742002-12-13 20:15:29 +00007785 "Summary of BGP neighbor status\n")
7786{
7787 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
7788}
7789
Lou Berger651b4022016-01-12 13:42:07 -05007790/* `show ip bgp summary' commands. */
7791DEFUN (show_bgp_ipv6_vpn_summary,
7792 show_bgp_ipv6_vpn_summary_cmd,
7793 "show bgp ipv6 vpn summary",
paul718e3742002-12-13 20:15:29 +00007794 SHOW_STR
7795 BGP_STR
Lou Berger651b4022016-01-12 13:42:07 -05007796 "IPv6\n"
7797 "Display VPN NLRI specific information\n"
paul718e3742002-12-13 20:15:29 +00007798 "Summary of BGP neighbor status\n")
7799{
Lou Berger651b4022016-01-12 13:42:07 -05007800 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MPLS_VPN);
paul718e3742002-12-13 20:15:29 +00007801}
Lou Berger651b4022016-01-12 13:42:07 -05007802
7803DEFUN (show_bgp_ipv4_encap_summary,
7804 show_bgp_ipv4_encap_summary_cmd,
7805 "show bgp ipv4 encap summary",
7806 SHOW_STR
7807 BGP_STR
7808 "IPv4\n"
7809 "Display ENCAP NLRI specific information\n"
7810 "Summary of BGP neighbor status\n")
7811{
7812 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_ENCAP);
7813}
7814
Lou Berger651b4022016-01-12 13:42:07 -05007815DEFUN (show_bgp_ipv6_encap_summary,
7816 show_bgp_ipv6_encap_summary_cmd,
7817 "show bgp ipv6 encap summary",
7818 SHOW_STR
7819 BGP_STR
7820 "IPv6\n"
7821 "Display ENCAP NLRI specific information\n"
7822 "Summary of BGP neighbor status\n")
7823{
7824 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_ENCAP);
7825}
7826
paul718e3742002-12-13 20:15:29 +00007827DEFUN (show_bgp_instance_summary,
7828 show_bgp_instance_summary_cmd,
7829 "show bgp view WORD summary",
7830 SHOW_STR
7831 BGP_STR
7832 "BGP view\n"
7833 "View name\n"
7834 "Summary of BGP neighbor status\n")
7835{
Lou Berger651b4022016-01-12 13:42:07 -05007836 vty_out(vty, "%sIPv4 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7837 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7838 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
7839 vty_out(vty, "%sIPv4 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7840 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7841 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
7842 vty_out(vty, "%sIPv4 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7843 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7844 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MPLS_VPN);
7845 vty_out(vty, "%sIPv4 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7846 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7847 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_ENCAP);
7848
Lou Berger651b4022016-01-12 13:42:07 -05007849 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7850 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7851 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
7852 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7853 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7854 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST);
7855 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7856 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7857 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MPLS_VPN);
7858 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7859 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7860 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_ENCAP);
Lou Berger205e6742016-01-12 13:42:11 -05007861
Lou Berger651b4022016-01-12 13:42:07 -05007862 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00007863}
7864
Lou Berger651b4022016-01-12 13:42:07 -05007865DEFUN (show_bgp_instance_ipv4_summary,
7866 show_bgp_instance_ipv4_summary_cmd,
7867 "show bgp view WORD ipv4 summary",
paul718e3742002-12-13 20:15:29 +00007868 SHOW_STR
7869 BGP_STR
Lou Berger651b4022016-01-12 13:42:07 -05007870 IP_STR
7871 "Address Family modifier\n"
7872 "Address Family modifier\n"
7873 "BGP view\n"
7874 "View name\n"
paul718e3742002-12-13 20:15:29 +00007875 "Summary of BGP neighbor status\n")
Lou Berger651b4022016-01-12 13:42:07 -05007876{
7877 vty_out(vty, "%sIPv4 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7878 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7879 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
7880 vty_out(vty, "%sIPv4 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7881 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7882 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
7883 vty_out(vty, "%sIPv4 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7884 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7885 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MPLS_VPN);
7886 vty_out(vty, "%sIPv4 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7887 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7888 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_ENCAP);
paul718e3742002-12-13 20:15:29 +00007889
Lou Berger651b4022016-01-12 13:42:07 -05007890 return CMD_SUCCESS;
7891}
7892
Lou Berger651b4022016-01-12 13:42:07 -05007893DEFUN (show_bgp_instance_ipv6_summary,
paul718e3742002-12-13 20:15:29 +00007894 show_bgp_instance_ipv6_summary_cmd,
7895 "show bgp view WORD ipv6 summary",
7896 SHOW_STR
7897 BGP_STR
Lou Berger651b4022016-01-12 13:42:07 -05007898 IPV6_STR
7899 "Address Family modifier\n"
7900 "Address Family modifier\n"
paul718e3742002-12-13 20:15:29 +00007901 "BGP view\n"
7902 "View name\n"
paul718e3742002-12-13 20:15:29 +00007903 "Summary of BGP neighbor status\n")
Lou Berger651b4022016-01-12 13:42:07 -05007904{
7905 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7906 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7907 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
7908 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7909 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7910 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST);
7911 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7912 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7913 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MPLS_VPN);
7914 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7915 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7916 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_ENCAP);
7917
7918 return CMD_SUCCESS;
7919}
paul718e3742002-12-13 20:15:29 +00007920
Michael Lambert95cbbd22010-07-23 14:43:04 -04007921DEFUN (show_bgp_ipv6_safi_summary,
7922 show_bgp_ipv6_safi_summary_cmd,
7923 "show bgp ipv6 (unicast|multicast) summary",
7924 SHOW_STR
7925 BGP_STR
7926 "Address family\n"
7927 "Address Family modifier\n"
7928 "Address Family modifier\n"
7929 "Summary of BGP neighbor status\n")
7930{
7931 if (strncmp (argv[0], "m", 1) == 0)
7932 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
7933
7934 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
7935}
7936
7937DEFUN (show_bgp_instance_ipv6_safi_summary,
7938 show_bgp_instance_ipv6_safi_summary_cmd,
7939 "show bgp view WORD ipv6 (unicast|multicast) summary",
7940 SHOW_STR
7941 BGP_STR
7942 "BGP view\n"
7943 "View name\n"
7944 "Address family\n"
7945 "Address Family modifier\n"
7946 "Address Family modifier\n"
7947 "Summary of BGP neighbor status\n")
7948{
7949 if (strncmp (argv[1], "m", 1) == 0)
7950 return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST);
7951
7952 return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
7953}
7954
Lou Bergerf9b6c392016-01-12 13:42:09 -05007955/* old command */
7956DEFUN (show_ipv6_bgp_summary,
7957 show_ipv6_bgp_summary_cmd,
7958 "show ipv6 bgp summary",
7959 SHOW_STR
7960 IPV6_STR
7961 BGP_STR
7962 "Summary of BGP neighbor status\n")
7963{
7964 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
7965}
7966
7967/* old command */
7968DEFUN (show_ipv6_mbgp_summary,
7969 show_ipv6_mbgp_summary_cmd,
7970 "show ipv6 mbgp summary",
7971 SHOW_STR
7972 IPV6_STR
7973 MBGP_STR
7974 "Summary of BGP neighbor status\n")
7975{
7976 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
7977}
Lou Berger651b4022016-01-12 13:42:07 -05007978
7979/* variations of show bgp [...] summary */
7980
7981/* This one is for the 0-keyword variant */
7982DEFUN (show_bgp_summary,
7983 show_bgp_summary_cmd,
7984 "show bgp summary",
paul718e3742002-12-13 20:15:29 +00007985 SHOW_STR
paul718e3742002-12-13 20:15:29 +00007986 BGP_STR
7987 "Summary of BGP neighbor status\n")
7988{
Lou Berger651b4022016-01-12 13:42:07 -05007989 vty_out(vty, "%sIPv4 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7990 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7991 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
7992 vty_out(vty, "%sIPv4 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7993 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7994 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
7995 vty_out(vty, "%sIPv4 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7996 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7997 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
7998 vty_out(vty, "%sIPv4 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7999 vty_out(vty, "-------------------%s", VTY_NEWLINE);
8000 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_ENCAP);
8001
Lou Berger651b4022016-01-12 13:42:07 -05008002 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
8003 vty_out(vty, "---------------------%s", VTY_NEWLINE);
8004 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
8005 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
8006 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
8007 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
8008 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
8009 vty_out(vty, "-----------------%s", VTY_NEWLINE);
8010 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MPLS_VPN);
8011 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
8012 vty_out(vty, "-------------------%s", VTY_NEWLINE);
8013 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_ENCAP);
Lou Berger205e6742016-01-12 13:42:11 -05008014
Lou Berger651b4022016-01-12 13:42:07 -05008015 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00008016}
8017
Lou Bergerf9b6c392016-01-12 13:42:09 -05008018ALIAS (show_bgp_summary,
8019 show_bgp_ipv6_summary_cmd,
8020 "show bgp ipv6 summary",
8021 SHOW_STR
8022 BGP_STR
8023 "Address family\n"
8024 "Summary of BGP neighbor status\n")
8025
Lou Berger651b4022016-01-12 13:42:07 -05008026DEFUN (show_bgp_summary_1w,
8027 show_bgp_summary_1w_cmd,
Lou Berger651b4022016-01-12 13:42:07 -05008028 "show bgp (ipv4|ipv6|unicast|multicast|vpn|encap) summary",
paul718e3742002-12-13 20:15:29 +00008029 SHOW_STR
Lou Berger651b4022016-01-12 13:42:07 -05008030 BGP_STR
8031 IP_STR
Lou Berger651b4022016-01-12 13:42:07 -05008032 IP6_STR
Lou Berger651b4022016-01-12 13:42:07 -05008033 "Address Family modifier\n"
8034 "Address Family modifier\n"
8035 "Address Family modifier\n"
8036 "Address Family modifier\n"
paul718e3742002-12-13 20:15:29 +00008037 "Summary of BGP neighbor status\n")
8038{
Lou Berger651b4022016-01-12 13:42:07 -05008039 if (strcmp (argv[0], "ipv4") == 0) {
8040 vty_out(vty, "%sIPv4 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
8041 vty_out(vty, "---------------------%s", VTY_NEWLINE);
8042 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
8043 vty_out(vty, "%sIPv4 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
8044 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
8045 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
8046 vty_out(vty, "%sIPv4 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
8047 vty_out(vty, "-----------------%s", VTY_NEWLINE);
8048 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
8049 vty_out(vty, "%sIPv4 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
8050 vty_out(vty, "-------------------%s", VTY_NEWLINE);
8051 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_ENCAP);
8052 return CMD_SUCCESS;
8053 }
Lou Berger205e6742016-01-12 13:42:11 -05008054
Lou Berger651b4022016-01-12 13:42:07 -05008055 if (strcmp (argv[0], "ipv6") == 0) {
8056 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
8057 vty_out(vty, "---------------------%s", VTY_NEWLINE);
8058 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
8059 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
8060 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
8061 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
8062 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
8063 vty_out(vty, "-----------------%s", VTY_NEWLINE);
8064 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MPLS_VPN);
8065 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
8066 vty_out(vty, "-------------------%s", VTY_NEWLINE);
8067 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_ENCAP);
8068 return CMD_SUCCESS;
8069 }
Lou Berger205e6742016-01-12 13:42:11 -05008070
Lou Berger651b4022016-01-12 13:42:07 -05008071 if (strcmp (argv[0], "unicast") == 0) {
8072 vty_out(vty, "IPv4 Unicast Summary:%s", VTY_NEWLINE);
8073 vty_out(vty, "---------------------%s", VTY_NEWLINE);
8074 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
Lou Berger651b4022016-01-12 13:42:07 -05008075 vty_out(vty, "%s", VTY_NEWLINE);
8076 vty_out(vty, "IPv6 Unicast Summary:%s", VTY_NEWLINE);
8077 vty_out(vty, "---------------------%s", VTY_NEWLINE);
8078 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
Lou Berger651b4022016-01-12 13:42:07 -05008079 return CMD_SUCCESS;
8080 }
8081 if (strcmp (argv[0], "multicast") == 0) {
8082 vty_out(vty, "IPv4 Multicast Summary:%s", VTY_NEWLINE);
8083 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
8084 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
Lou Berger651b4022016-01-12 13:42:07 -05008085 vty_out(vty, "%s", VTY_NEWLINE);
8086 vty_out(vty, "IPv6 Multicast Summary:%s", VTY_NEWLINE);
8087 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
8088 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
Lou Berger651b4022016-01-12 13:42:07 -05008089 return CMD_SUCCESS;
8090 }
8091 if (strcmp (argv[0], "vpn") == 0) {
8092 vty_out(vty, "IPv4 VPN Summary:%s", VTY_NEWLINE);
8093 vty_out(vty, "-----------------%s", VTY_NEWLINE);
8094 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
Lou Berger651b4022016-01-12 13:42:07 -05008095 vty_out(vty, "%s", VTY_NEWLINE);
8096 vty_out(vty, "IPv6 VPN Summary:%s", VTY_NEWLINE);
8097 vty_out(vty, "-----------------%s", VTY_NEWLINE);
8098 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MPLS_VPN);
Lou Berger651b4022016-01-12 13:42:07 -05008099 return CMD_SUCCESS;
8100 }
8101 if (strcmp (argv[0], "encap") == 0) {
8102 vty_out(vty, "IPv4 Encap Summary:%s", VTY_NEWLINE);
8103 vty_out(vty, "-------------------%s", VTY_NEWLINE);
8104 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_ENCAP);
Lou Berger651b4022016-01-12 13:42:07 -05008105 vty_out(vty, "%s", VTY_NEWLINE);
8106 vty_out(vty, "IPv6 Encap Summary:%s", VTY_NEWLINE);
8107 vty_out(vty, "-------------------%s", VTY_NEWLINE);
8108 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_ENCAP);
Lou Berger651b4022016-01-12 13:42:07 -05008109 return CMD_SUCCESS;
8110 }
8111 vty_out(vty, "Unknown keyword: %s%s", argv[0], VTY_NEWLINE);
8112 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00008113}
Lou Berger651b4022016-01-12 13:42:07 -05008114
8115
David Lamparter6b0655a2014-06-04 06:53:35 +02008116
paulfd79ac92004-10-13 05:06:08 +00008117const char *
hasso538621f2004-05-21 09:31:30 +00008118afi_safi_print (afi_t afi, safi_t safi)
8119{
8120 if (afi == AFI_IP && safi == SAFI_UNICAST)
8121 return "IPv4 Unicast";
8122 else if (afi == AFI_IP && safi == SAFI_MULTICAST)
8123 return "IPv4 Multicast";
8124 else if (afi == AFI_IP && safi == SAFI_MPLS_VPN)
Lou Berger9da04bc2016-01-12 13:41:55 -05008125 return "VPN-IPv4 Unicast";
Lou Bergera3fda882016-01-12 13:42:04 -05008126 else if (afi == AFI_IP && safi == SAFI_ENCAP)
8127 return "ENCAP-IPv4 Unicast";
hasso538621f2004-05-21 09:31:30 +00008128 else if (afi == AFI_IP6 && safi == SAFI_UNICAST)
8129 return "IPv6 Unicast";
8130 else if (afi == AFI_IP6 && safi == SAFI_MULTICAST)
8131 return "IPv6 Multicast";
Lou Berger9da04bc2016-01-12 13:41:55 -05008132 else if (afi == AFI_IP6 && safi == SAFI_MPLS_VPN)
8133 return "VPN-IPv6 Unicast";
Lou Bergera3fda882016-01-12 13:42:04 -05008134 else if (afi == AFI_IP6 && safi == SAFI_ENCAP)
8135 return "ENCAP-IPv6 Unicast";
hasso538621f2004-05-21 09:31:30 +00008136 else
8137 return "Unknown";
8138}
8139
paul718e3742002-12-13 20:15:29 +00008140/* Show BGP peer's information. */
8141enum show_type
8142{
8143 show_all,
8144 show_peer
8145};
8146
paul94f2b392005-06-28 12:44:16 +00008147static void
paul718e3742002-12-13 20:15:29 +00008148bgp_show_peer_afi_orf_cap (struct vty *vty, struct peer *p,
8149 afi_t afi, safi_t safi,
8150 u_int16_t adv_smcap, u_int16_t adv_rmcap,
8151 u_int16_t rcv_smcap, u_int16_t rcv_rmcap)
8152{
8153 /* Send-Mode */
8154 if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap)
8155 || CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap))
8156 {
8157 vty_out (vty, " Send-mode: ");
8158 if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap))
8159 vty_out (vty, "advertised");
8160 if (CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap))
8161 vty_out (vty, "%sreceived",
8162 CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) ?
8163 ", " : "");
8164 vty_out (vty, "%s", VTY_NEWLINE);
8165 }
8166
8167 /* Receive-Mode */
8168 if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap)
8169 || CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap))
8170 {
8171 vty_out (vty, " Receive-mode: ");
8172 if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap))
8173 vty_out (vty, "advertised");
8174 if (CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap))
8175 vty_out (vty, "%sreceived",
8176 CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) ?
8177 ", " : "");
8178 vty_out (vty, "%s", VTY_NEWLINE);
8179 }
8180}
8181
paul94f2b392005-06-28 12:44:16 +00008182static void
paul718e3742002-12-13 20:15:29 +00008183bgp_show_peer_afi (struct vty *vty, struct peer *p, afi_t afi, safi_t safi)
8184{
8185 struct bgp_filter *filter;
8186 char orf_pfx_name[BUFSIZ];
8187 int orf_pfx_count;
8188
8189 filter = &p->filter[afi][safi];
8190
hasso538621f2004-05-21 09:31:30 +00008191 vty_out (vty, " For address family: %s%s", afi_safi_print (afi, safi),
paul718e3742002-12-13 20:15:29 +00008192 VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00008193
paul718e3742002-12-13 20:15:29 +00008194 if (p->af_group[afi][safi])
8195 vty_out (vty, " %s peer-group member%s", p->group->name, VTY_NEWLINE);
8196
8197 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
8198 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
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_RCV)
8202 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
8203 vty_out (vty, " AF-dependant capabilities:%s", VTY_NEWLINE);
8204
8205 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
8206 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
8207 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
8208 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV))
8209 {
8210 vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
8211 ORF_TYPE_PREFIX, VTY_NEWLINE);
8212 bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
8213 PEER_CAP_ORF_PREFIX_SM_ADV,
8214 PEER_CAP_ORF_PREFIX_RM_ADV,
8215 PEER_CAP_ORF_PREFIX_SM_RCV,
8216 PEER_CAP_ORF_PREFIX_RM_RCV);
8217 }
8218 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
8219 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)
8220 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
8221 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
8222 {
8223 vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
8224 ORF_TYPE_PREFIX_OLD, VTY_NEWLINE);
8225 bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
8226 PEER_CAP_ORF_PREFIX_SM_ADV,
8227 PEER_CAP_ORF_PREFIX_RM_ADV,
8228 PEER_CAP_ORF_PREFIX_SM_OLD_RCV,
8229 PEER_CAP_ORF_PREFIX_RM_OLD_RCV);
8230 }
8231
8232 sprintf (orf_pfx_name, "%s.%d.%d", p->host, afi, safi);
8233 orf_pfx_count = prefix_bgp_show_prefix_list (NULL, afi, orf_pfx_name);
8234
8235 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND)
8236 || orf_pfx_count)
8237 {
8238 vty_out (vty, " Outbound Route Filter (ORF):");
8239 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND))
8240 vty_out (vty, " sent;");
8241 if (orf_pfx_count)
8242 vty_out (vty, " received (%d entries)", orf_pfx_count);
8243 vty_out (vty, "%s", VTY_NEWLINE);
8244 }
8245 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH))
8246 vty_out (vty, " First update is deferred until ORF or ROUTE-REFRESH is received%s", VTY_NEWLINE);
8247
8248 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT))
8249 vty_out (vty, " Route-Reflector Client%s", VTY_NEWLINE);
8250 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT))
8251 vty_out (vty, " Route-Server Client%s", VTY_NEWLINE);
8252 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG))
8253 vty_out (vty, " Inbound soft reconfiguration allowed%s", VTY_NEWLINE);
8254 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS))
8255 vty_out (vty, " Private AS number removed from updates to this neighbor%s", VTY_NEWLINE);
8256 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF))
8257 vty_out (vty, " NEXT_HOP is always this router%s", VTY_NEWLINE);
8258 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED))
8259 vty_out (vty, " AS_PATH is propagated unchanged to this neighbor%s", VTY_NEWLINE);
8260 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED))
8261 vty_out (vty, " NEXT_HOP is propagated unchanged to this neighbor%s", VTY_NEWLINE);
8262 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED))
8263 vty_out (vty, " MED is propagated unchanged to this neighbor%s", VTY_NEWLINE);
8264 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
Job Snijders3334bab2017-01-20 14:47:12 +00008265 || CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)
8266 || CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_LARGE_COMMUNITY))
paul718e3742002-12-13 20:15:29 +00008267 {
8268 vty_out (vty, " Community attribute sent to this neighbor");
8269 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
Job Snijders3334bab2017-01-20 14:47:12 +00008270 && CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY)
8271 && CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_LARGE_COMMUNITY))
8272 vty_out (vty, "(all)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008273 else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
hasso538621f2004-05-21 09:31:30 +00008274 vty_out (vty, "(extended)%s", VTY_NEWLINE);
Job Snijders3334bab2017-01-20 14:47:12 +00008275 else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_LARGE_COMMUNITY))
8276 vty_out (vty, "(large)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008277 else
hasso538621f2004-05-21 09:31:30 +00008278 vty_out (vty, "(standard)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008279 }
8280 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE))
8281 {
8282 vty_out (vty, " Default information originate,");
8283
8284 if (p->default_rmap[afi][safi].name)
8285 vty_out (vty, " default route-map %s%s,",
8286 p->default_rmap[afi][safi].map ? "*" : "",
8287 p->default_rmap[afi][safi].name);
8288 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_DEFAULT_ORIGINATE))
8289 vty_out (vty, " default sent%s", VTY_NEWLINE);
8290 else
8291 vty_out (vty, " default not sent%s", VTY_NEWLINE);
8292 }
8293
8294 if (filter->plist[FILTER_IN].name
8295 || filter->dlist[FILTER_IN].name
8296 || filter->aslist[FILTER_IN].name
paulfee0f4c2004-09-13 05:12:46 +00008297 || filter->map[RMAP_IN].name)
paul718e3742002-12-13 20:15:29 +00008298 vty_out (vty, " Inbound path policy configured%s", VTY_NEWLINE);
8299 if (filter->plist[FILTER_OUT].name
8300 || filter->dlist[FILTER_OUT].name
8301 || filter->aslist[FILTER_OUT].name
paulfee0f4c2004-09-13 05:12:46 +00008302 || filter->map[RMAP_OUT].name
paul718e3742002-12-13 20:15:29 +00008303 || filter->usmap.name)
8304 vty_out (vty, " Outbound path policy configured%s", VTY_NEWLINE);
paulfee0f4c2004-09-13 05:12:46 +00008305 if (filter->map[RMAP_IMPORT].name)
8306 vty_out (vty, " Import policy for this RS-client configured%s", VTY_NEWLINE);
8307 if (filter->map[RMAP_EXPORT].name)
8308 vty_out (vty, " Export policy for this RS-client configured%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008309
8310 /* prefix-list */
8311 if (filter->plist[FILTER_IN].name)
8312 vty_out (vty, " Incoming update prefix filter list is %s%s%s",
8313 filter->plist[FILTER_IN].plist ? "*" : "",
8314 filter->plist[FILTER_IN].name,
8315 VTY_NEWLINE);
8316 if (filter->plist[FILTER_OUT].name)
8317 vty_out (vty, " Outgoing update prefix filter list is %s%s%s",
8318 filter->plist[FILTER_OUT].plist ? "*" : "",
8319 filter->plist[FILTER_OUT].name,
8320 VTY_NEWLINE);
8321
8322 /* distribute-list */
8323 if (filter->dlist[FILTER_IN].name)
8324 vty_out (vty, " Incoming update network filter list is %s%s%s",
8325 filter->dlist[FILTER_IN].alist ? "*" : "",
8326 filter->dlist[FILTER_IN].name,
8327 VTY_NEWLINE);
8328 if (filter->dlist[FILTER_OUT].name)
8329 vty_out (vty, " Outgoing update network filter list is %s%s%s",
8330 filter->dlist[FILTER_OUT].alist ? "*" : "",
8331 filter->dlist[FILTER_OUT].name,
8332 VTY_NEWLINE);
8333
8334 /* filter-list. */
8335 if (filter->aslist[FILTER_IN].name)
8336 vty_out (vty, " Incoming update AS path filter list is %s%s%s",
8337 filter->aslist[FILTER_IN].aslist ? "*" : "",
8338 filter->aslist[FILTER_IN].name,
8339 VTY_NEWLINE);
8340 if (filter->aslist[FILTER_OUT].name)
8341 vty_out (vty, " Outgoing update AS path filter list is %s%s%s",
8342 filter->aslist[FILTER_OUT].aslist ? "*" : "",
8343 filter->aslist[FILTER_OUT].name,
8344 VTY_NEWLINE);
8345
8346 /* route-map. */
paulfee0f4c2004-09-13 05:12:46 +00008347 if (filter->map[RMAP_IN].name)
paul718e3742002-12-13 20:15:29 +00008348 vty_out (vty, " Route map for incoming advertisements is %s%s%s",
paulfee0f4c2004-09-13 05:12:46 +00008349 filter->map[RMAP_IN].map ? "*" : "",
8350 filter->map[RMAP_IN].name,
paul718e3742002-12-13 20:15:29 +00008351 VTY_NEWLINE);
paulfee0f4c2004-09-13 05:12:46 +00008352 if (filter->map[RMAP_OUT].name)
paul718e3742002-12-13 20:15:29 +00008353 vty_out (vty, " Route map for outgoing advertisements is %s%s%s",
paulfee0f4c2004-09-13 05:12:46 +00008354 filter->map[RMAP_OUT].map ? "*" : "",
8355 filter->map[RMAP_OUT].name,
8356 VTY_NEWLINE);
8357 if (filter->map[RMAP_IMPORT].name)
8358 vty_out (vty, " Route map for advertisements going into this RS-client's table is %s%s%s",
8359 filter->map[RMAP_IMPORT].map ? "*" : "",
8360 filter->map[RMAP_IMPORT].name,
8361 VTY_NEWLINE);
8362 if (filter->map[RMAP_EXPORT].name)
8363 vty_out (vty, " Route map for advertisements coming from this RS-client is %s%s%s",
8364 filter->map[RMAP_EXPORT].map ? "*" : "",
8365 filter->map[RMAP_EXPORT].name,
paul718e3742002-12-13 20:15:29 +00008366 VTY_NEWLINE);
8367
8368 /* unsuppress-map */
8369 if (filter->usmap.name)
8370 vty_out (vty, " Route map for selective unsuppress is %s%s%s",
8371 filter->usmap.map ? "*" : "",
8372 filter->usmap.name, VTY_NEWLINE);
8373
8374 /* Receive prefix count */
hassoe0701b72004-05-20 09:19:34 +00008375 vty_out (vty, " %ld accepted prefixes%s", p->pcount[afi][safi], VTY_NEWLINE);
8376
paul718e3742002-12-13 20:15:29 +00008377 /* Maximum prefix */
8378 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX))
8379 {
hasso0a486e52005-02-01 20:57:17 +00008380 vty_out (vty, " Maximum prefixes allowed %ld%s%s", p->pmax[afi][safi],
paul718e3742002-12-13 20:15:29 +00008381 CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING)
hasso0a486e52005-02-01 20:57:17 +00008382 ? " (warning-only)" : "", VTY_NEWLINE);
8383 vty_out (vty, " Threshold for warning message %d%%",
8384 p->pmax_threshold[afi][safi]);
8385 if (p->pmax_restart[afi][safi])
8386 vty_out (vty, ", restart interval %d min", p->pmax_restart[afi][safi]);
8387 vty_out (vty, "%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008388 }
paul718e3742002-12-13 20:15:29 +00008389
8390 vty_out (vty, "%s", VTY_NEWLINE);
8391}
8392
paul94f2b392005-06-28 12:44:16 +00008393static void
paul718e3742002-12-13 20:15:29 +00008394bgp_show_peer (struct vty *vty, struct peer *p)
8395{
8396 struct bgp *bgp;
8397 char buf1[BUFSIZ];
8398 char timebuf[BGP_UPTIME_LEN];
hasso538621f2004-05-21 09:31:30 +00008399 afi_t afi;
8400 safi_t safi;
Timo Teräse3443a22016-10-19 16:02:34 +03008401 int ttl;
paul718e3742002-12-13 20:15:29 +00008402
8403 bgp = p->bgp;
8404
8405 /* Configured IP address. */
8406 vty_out (vty, "BGP neighbor is %s, ", p->host);
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04008407 vty_out (vty, "remote AS %u, ", p->as);
Andrew Certain9d3f9702012-11-07 23:50:07 +00008408 vty_out (vty, "local AS %u%s%s, ",
paul718e3742002-12-13 20:15:29 +00008409 p->change_local_as ? p->change_local_as : p->local_as,
8410 CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND) ?
Andrew Certain9d3f9702012-11-07 23:50:07 +00008411 " no-prepend" : "",
8412 CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_REPLACE_AS) ?
8413 " replace-as" : "");
paul718e3742002-12-13 20:15:29 +00008414 vty_out (vty, "%s link%s",
8415 p->as == p->local_as ? "internal" : "external",
8416 VTY_NEWLINE);
8417
8418 /* Description. */
8419 if (p->desc)
8420 vty_out (vty, " Description: %s%s", p->desc, VTY_NEWLINE);
8421
8422 /* Peer-group */
8423 if (p->group)
8424 vty_out (vty, " Member of peer-group %s for session parameters%s",
8425 p->group->name, VTY_NEWLINE);
8426
8427 /* Administrative shutdown. */
8428 if (CHECK_FLAG (p->flags, PEER_FLAG_SHUTDOWN))
8429 vty_out (vty, " Administratively shut down%s", VTY_NEWLINE);
8430
8431 /* BGP Version. */
8432 vty_out (vty, " BGP version 4");
paul718e3742002-12-13 20:15:29 +00008433 vty_out (vty, ", remote router ID %s%s",
8434 inet_ntop (AF_INET, &p->remote_id, buf1, BUFSIZ),
8435 VTY_NEWLINE);
8436
8437 /* Confederation */
hassoe0701b72004-05-20 09:19:34 +00008438 if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION)
8439 && bgp_confederation_peers_check (bgp, p->as))
paul718e3742002-12-13 20:15:29 +00008440 vty_out (vty, " Neighbor under common administration%s", VTY_NEWLINE);
8441
8442 /* Status. */
8443 vty_out (vty, " BGP state = %s",
8444 LOOKUP (bgp_status_msg, p->status));
8445 if (p->status == Established)
8446 vty_out (vty, ", up for %8s",
8447 peer_uptime (p->uptime, timebuf, BGP_UPTIME_LEN));
hasso93406d82005-02-02 14:40:33 +00008448 else if (p->status == Active)
8449 {
8450 if (CHECK_FLAG (p->flags, PEER_FLAG_PASSIVE))
8451 vty_out (vty, " (passive)");
8452 else if (CHECK_FLAG (p->sflags, PEER_STATUS_NSF_WAIT))
8453 vty_out (vty, " (NSF passive)");
8454 }
paul718e3742002-12-13 20:15:29 +00008455 vty_out (vty, "%s", VTY_NEWLINE);
8456
8457 /* read timer */
8458 vty_out (vty, " Last read %s", peer_uptime (p->readtime, timebuf, BGP_UPTIME_LEN));
8459
8460 /* Configured timer values. */
8461 vty_out (vty, ", hold time is %d, keepalive interval is %d seconds%s",
8462 p->v_holdtime, p->v_keepalive, VTY_NEWLINE);
8463 if (CHECK_FLAG (p->config, PEER_CONFIG_TIMER))
8464 {
8465 vty_out (vty, " Configured hold time is %d", p->holdtime);
8466 vty_out (vty, ", keepalive interval is %d seconds%s",
8467 p->keepalive, VTY_NEWLINE);
8468 }
hasso93406d82005-02-02 14:40:33 +00008469
paul718e3742002-12-13 20:15:29 +00008470 /* Capability. */
8471 if (p->status == Established)
8472 {
hasso538621f2004-05-21 09:31:30 +00008473 if (p->cap
paul718e3742002-12-13 20:15:29 +00008474 || p->afc_adv[AFI_IP][SAFI_UNICAST]
8475 || p->afc_recv[AFI_IP][SAFI_UNICAST]
8476 || p->afc_adv[AFI_IP][SAFI_MULTICAST]
8477 || p->afc_recv[AFI_IP][SAFI_MULTICAST]
paul718e3742002-12-13 20:15:29 +00008478 || p->afc_adv[AFI_IP6][SAFI_UNICAST]
8479 || p->afc_recv[AFI_IP6][SAFI_UNICAST]
8480 || p->afc_adv[AFI_IP6][SAFI_MULTICAST]
8481 || p->afc_recv[AFI_IP6][SAFI_MULTICAST]
Lou Berger9da04bc2016-01-12 13:41:55 -05008482 || p->afc_adv[AFI_IP6][SAFI_MPLS_VPN]
8483 || p->afc_recv[AFI_IP6][SAFI_MPLS_VPN]
Lou Bergera3fda882016-01-12 13:42:04 -05008484 || p->afc_adv[AFI_IP6][SAFI_ENCAP]
8485 || p->afc_recv[AFI_IP6][SAFI_ENCAP]
Lou Bergera3fda882016-01-12 13:42:04 -05008486 || p->afc_adv[AFI_IP][SAFI_ENCAP]
8487 || p->afc_recv[AFI_IP][SAFI_ENCAP]
paul718e3742002-12-13 20:15:29 +00008488 || p->afc_adv[AFI_IP][SAFI_MPLS_VPN]
8489 || p->afc_recv[AFI_IP][SAFI_MPLS_VPN])
8490 {
8491 vty_out (vty, " Neighbor capabilities:%s", VTY_NEWLINE);
8492
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00008493 /* AS4 */
8494 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV)
8495 || CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV))
8496 {
8497 vty_out (vty, " 4 Byte AS:");
8498 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV))
8499 vty_out (vty, " advertised");
8500 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV))
8501 vty_out (vty, " %sreceived",
8502 CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV) ? "and " : "");
8503 vty_out (vty, "%s", VTY_NEWLINE);
8504 }
paul718e3742002-12-13 20:15:29 +00008505 /* Dynamic */
8506 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)
8507 || CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV))
8508 {
8509 vty_out (vty, " Dynamic:");
8510 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV))
8511 vty_out (vty, " advertised");
8512 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV))
hasso538621f2004-05-21 09:31:30 +00008513 vty_out (vty, " %sreceived",
8514 CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV) ? "and " : "");
paul718e3742002-12-13 20:15:29 +00008515 vty_out (vty, "%s", VTY_NEWLINE);
8516 }
8517
8518 /* Route Refresh */
8519 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV)
8520 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)
8521 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
8522 {
8523 vty_out (vty, " Route refresh:");
8524 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV))
8525 vty_out (vty, " advertised");
8526 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)
8527 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
hasso538621f2004-05-21 09:31:30 +00008528 vty_out (vty, " %sreceived(%s)",
8529 CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) ? "and " : "",
8530 (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)
8531 && CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)) ?
8532 "old & new" : CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) ? "old" : "new");
8533
paul718e3742002-12-13 20:15:29 +00008534 vty_out (vty, "%s", VTY_NEWLINE);
8535 }
8536
hasso538621f2004-05-21 09:31:30 +00008537 /* Multiprotocol Extensions */
8538 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
8539 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
8540 if (p->afc_adv[afi][safi] || p->afc_recv[afi][safi])
paul718e3742002-12-13 20:15:29 +00008541 {
hasso538621f2004-05-21 09:31:30 +00008542 vty_out (vty, " Address family %s:", afi_safi_print (afi, safi));
8543 if (p->afc_adv[afi][safi])
8544 vty_out (vty, " advertised");
8545 if (p->afc_recv[afi][safi])
8546 vty_out (vty, " %sreceived", p->afc_adv[afi][safi] ? "and " : "");
8547 vty_out (vty, "%s", VTY_NEWLINE);
8548 }
8549
8550 /* Gracefull Restart */
8551 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)
8552 || CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
paul718e3742002-12-13 20:15:29 +00008553 {
hasso538621f2004-05-21 09:31:30 +00008554 vty_out (vty, " Graceful Restart Capabilty:");
8555 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
paul718e3742002-12-13 20:15:29 +00008556 vty_out (vty, " advertised");
hasso538621f2004-05-21 09:31:30 +00008557 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
8558 vty_out (vty, " %sreceived",
8559 CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV) ? "and " : "");
paul718e3742002-12-13 20:15:29 +00008560 vty_out (vty, "%s", VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00008561
8562 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
paul718e3742002-12-13 20:15:29 +00008563 {
hasso538621f2004-05-21 09:31:30 +00008564 int restart_af_count = 0;
8565
8566 vty_out (vty, " Remote Restart timer is %d seconds%s",
hasso93406d82005-02-02 14:40:33 +00008567 p->v_gr_restart, VTY_NEWLINE);
8568 vty_out (vty, " Address families by peer:%s ", VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00008569
8570 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
8571 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
8572 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_RCV))
8573 {
hasso93406d82005-02-02 14:40:33 +00008574 vty_out (vty, "%s%s(%s)", restart_af_count ? ", " : "",
8575 afi_safi_print (afi, safi),
8576 CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_PRESERVE_RCV) ?
8577 "preserved" : "not preserved");
hasso538621f2004-05-21 09:31:30 +00008578 restart_af_count++;
hasso93406d82005-02-02 14:40:33 +00008579 }
hasso538621f2004-05-21 09:31:30 +00008580 if (! restart_af_count)
8581 vty_out (vty, "none");
8582 vty_out (vty, "%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008583 }
paul718e3742002-12-13 20:15:29 +00008584 }
paul718e3742002-12-13 20:15:29 +00008585 }
8586 }
8587
hasso93406d82005-02-02 14:40:33 +00008588 /* graceful restart information */
8589 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)
8590 || p->t_gr_restart
8591 || p->t_gr_stale)
8592 {
8593 int eor_send_af_count = 0;
8594 int eor_receive_af_count = 0;
8595
8596 vty_out (vty, " Graceful restart informations:%s", VTY_NEWLINE);
8597 if (p->status == Established)
8598 {
8599 vty_out (vty, " End-of-RIB send: ");
8600 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
8601 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
8602 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_SEND))
8603 {
8604 vty_out (vty, "%s%s", eor_send_af_count ? ", " : "",
8605 afi_safi_print (afi, safi));
8606 eor_send_af_count++;
8607 }
8608 vty_out (vty, "%s", VTY_NEWLINE);
8609
8610 vty_out (vty, " End-of-RIB received: ");
8611 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
8612 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
8613 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_RECEIVED))
8614 {
8615 vty_out (vty, "%s%s", eor_receive_af_count ? ", " : "",
8616 afi_safi_print (afi, safi));
8617 eor_receive_af_count++;
8618 }
8619 vty_out (vty, "%s", VTY_NEWLINE);
8620 }
8621
8622 if (p->t_gr_restart)
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00008623 vty_out (vty, " The remaining time of restart timer is %ld%s",
8624 thread_timer_remain_second (p->t_gr_restart), VTY_NEWLINE);
8625
hasso93406d82005-02-02 14:40:33 +00008626 if (p->t_gr_stale)
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00008627 vty_out (vty, " The remaining time of stalepath timer is %ld%s",
8628 thread_timer_remain_second (p->t_gr_stale), VTY_NEWLINE);
hasso93406d82005-02-02 14:40:33 +00008629 }
8630
paul718e3742002-12-13 20:15:29 +00008631 /* Packet counts. */
hasso93406d82005-02-02 14:40:33 +00008632 vty_out (vty, " Message statistics:%s", VTY_NEWLINE);
8633 vty_out (vty, " Inq depth is 0%s", VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00008634 vty_out (vty, " Outq depth is %lu%s", (unsigned long) p->obuf->count, VTY_NEWLINE);
hasso93406d82005-02-02 14:40:33 +00008635 vty_out (vty, " Sent Rcvd%s", VTY_NEWLINE);
8636 vty_out (vty, " Opens: %10d %10d%s", p->open_out, p->open_in, VTY_NEWLINE);
8637 vty_out (vty, " Notifications: %10d %10d%s", p->notify_out, p->notify_in, VTY_NEWLINE);
8638 vty_out (vty, " Updates: %10d %10d%s", p->update_out, p->update_in, VTY_NEWLINE);
8639 vty_out (vty, " Keepalives: %10d %10d%s", p->keepalive_out, p->keepalive_in, VTY_NEWLINE);
8640 vty_out (vty, " Route Refresh: %10d %10d%s", p->refresh_out, p->refresh_in, VTY_NEWLINE);
8641 vty_out (vty, " Capability: %10d %10d%s", p->dynamic_cap_out, p->dynamic_cap_in, VTY_NEWLINE);
8642 vty_out (vty, " Total: %10d %10d%s", p->open_out + p->notify_out +
8643 p->update_out + p->keepalive_out + p->refresh_out + p->dynamic_cap_out,
8644 p->open_in + p->notify_in + p->update_in + p->keepalive_in + p->refresh_in +
8645 p->dynamic_cap_in, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008646
8647 /* advertisement-interval */
8648 vty_out (vty, " Minimum time between advertisement runs is %d seconds%s",
8649 p->v_routeadv, VTY_NEWLINE);
8650
8651 /* Update-source. */
8652 if (p->update_if || p->update_source)
8653 {
8654 vty_out (vty, " Update source is ");
8655 if (p->update_if)
8656 vty_out (vty, "%s", p->update_if);
8657 else if (p->update_source)
8658 vty_out (vty, "%s",
8659 sockunion2str (p->update_source, buf1, SU_ADDRSTRLEN));
8660 vty_out (vty, "%s", VTY_NEWLINE);
8661 }
8662
8663 /* Default weight */
8664 if (CHECK_FLAG (p->config, PEER_CONFIG_WEIGHT))
8665 vty_out (vty, " Default weight %d%s", p->weight,
8666 VTY_NEWLINE);
8667
8668 vty_out (vty, "%s", VTY_NEWLINE);
8669
8670 /* Address Family Information */
hasso538621f2004-05-21 09:31:30 +00008671 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
8672 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
8673 if (p->afc[afi][safi])
8674 bgp_show_peer_afi (vty, p, afi, safi);
paul718e3742002-12-13 20:15:29 +00008675
8676 vty_out (vty, " Connections established %d; dropped %d%s",
8677 p->established, p->dropped,
8678 VTY_NEWLINE);
8679
hassoe0701b72004-05-20 09:19:34 +00008680 if (! p->dropped)
8681 vty_out (vty, " Last reset never%s", VTY_NEWLINE);
8682 else
8683 vty_out (vty, " Last reset %s, due to %s%s",
8684 peer_uptime (p->resettime, timebuf, BGP_UPTIME_LEN),
8685 peer_down_str[(int) p->last_reset], VTY_NEWLINE);
paul848973c2003-08-13 00:32:49 +00008686
paul718e3742002-12-13 20:15:29 +00008687 if (CHECK_FLAG (p->sflags, PEER_STATUS_PREFIX_OVERFLOW))
8688 {
8689 vty_out (vty, " Peer had exceeded the max. no. of prefixes configured.%s", VTY_NEWLINE);
hasso0a486e52005-02-01 20:57:17 +00008690
8691 if (p->t_pmax_restart)
8692 vty_out (vty, " Reduce the no. of prefix from %s, will restart in %ld seconds%s",
8693 p->host, thread_timer_remain_second (p->t_pmax_restart),
8694 VTY_NEWLINE);
8695 else
8696 vty_out (vty, " Reduce the no. of prefix and clear ip bgp %s to restore peering%s",
8697 p->host, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008698 }
8699
Stephen Hemmingerf5a48272011-03-24 17:30:21 +00008700 /* EBGP Multihop and GTSM */
Timo Teräse3443a22016-10-19 16:02:34 +03008701 ttl = p->gtsm_hops;
8702 if (! ttl)
8703 ttl = peer_ttl (p);
8704 vty_out (vty, " %s BGP neighbor may be up to %d hops away.%s",
8705 p->sort == BGP_PEER_IBGP ? "Internal" : "External",
8706 ttl, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008707
8708 /* Local address. */
8709 if (p->su_local)
8710 {
hasso93406d82005-02-02 14:40:33 +00008711 vty_out (vty, "Local host: %s, Local port: %d%s",
paul718e3742002-12-13 20:15:29 +00008712 sockunion2str (p->su_local, buf1, SU_ADDRSTRLEN),
8713 ntohs (p->su_local->sin.sin_port),
paul718e3742002-12-13 20:15:29 +00008714 VTY_NEWLINE);
8715 }
8716
8717 /* Remote address. */
8718 if (p->su_remote)
8719 {
8720 vty_out (vty, "Foreign host: %s, Foreign port: %d%s",
8721 sockunion2str (p->su_remote, buf1, SU_ADDRSTRLEN),
8722 ntohs (p->su_remote->sin.sin_port),
8723 VTY_NEWLINE);
8724 }
8725
8726 /* Nexthop display. */
8727 if (p->su_local)
8728 {
8729 vty_out (vty, "Nexthop: %s%s",
8730 inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ),
8731 VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008732 vty_out (vty, "Nexthop global: %s%s",
8733 inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ),
8734 VTY_NEWLINE);
8735 vty_out (vty, "Nexthop local: %s%s",
8736 inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ),
8737 VTY_NEWLINE);
8738 vty_out (vty, "BGP connection: %s%s",
8739 p->shared_network ? "shared network" : "non shared network",
8740 VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008741 }
8742
Timo Teräsef757702015-04-29 09:43:04 +03008743 /* TCP metrics. */
8744 if (p->status == Established && p->rtt)
8745 vty_out (vty, "Estimated round trip time: %d ms%s",
8746 p->rtt, VTY_NEWLINE);
8747
paul718e3742002-12-13 20:15:29 +00008748 /* Timer information. */
8749 if (p->t_start)
8750 vty_out (vty, "Next start timer due in %ld seconds%s",
8751 thread_timer_remain_second (p->t_start), VTY_NEWLINE);
8752 if (p->t_connect)
8753 vty_out (vty, "Next connect timer due in %ld seconds%s",
8754 thread_timer_remain_second (p->t_connect), VTY_NEWLINE);
8755
8756 vty_out (vty, "Read thread: %s Write thread: %s%s",
8757 p->t_read ? "on" : "off",
8758 p->t_write ? "on" : "off",
8759 VTY_NEWLINE);
8760
8761 if (p->notify.code == BGP_NOTIFY_OPEN_ERR
8762 && p->notify.subcode == BGP_NOTIFY_OPEN_UNSUP_CAPBL)
8763 bgp_capability_vty_out (vty, p);
8764
8765 vty_out (vty, "%s", VTY_NEWLINE);
8766}
8767
paul94f2b392005-06-28 12:44:16 +00008768static int
paul718e3742002-12-13 20:15:29 +00008769bgp_show_neighbor (struct vty *vty, struct bgp *bgp,
8770 enum show_type type, union sockunion *su)
8771{
paul1eb8ef22005-04-07 07:30:20 +00008772 struct listnode *node, *nnode;
paul718e3742002-12-13 20:15:29 +00008773 struct peer *peer;
8774 int find = 0;
8775
paul1eb8ef22005-04-07 07:30:20 +00008776 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00008777 {
8778 switch (type)
8779 {
8780 case show_all:
8781 bgp_show_peer (vty, peer);
8782 break;
8783 case show_peer:
8784 if (sockunion_same (&peer->su, su))
8785 {
8786 find = 1;
8787 bgp_show_peer (vty, peer);
8788 }
8789 break;
8790 }
8791 }
8792
8793 if (type == show_peer && ! find)
8794 vty_out (vty, "%% No such neighbor%s", VTY_NEWLINE);
8795
8796 return CMD_SUCCESS;
8797}
8798
paul94f2b392005-06-28 12:44:16 +00008799static int
paulfd79ac92004-10-13 05:06:08 +00008800bgp_show_neighbor_vty (struct vty *vty, const char *name,
8801 enum show_type type, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00008802{
8803 int ret;
8804 struct bgp *bgp;
8805 union sockunion su;
8806
8807 if (ip_str)
8808 {
8809 ret = str2sockunion (ip_str, &su);
8810 if (ret < 0)
8811 {
8812 vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE);
8813 return CMD_WARNING;
8814 }
8815 }
8816
8817 if (name)
8818 {
8819 bgp = bgp_lookup_by_name (name);
8820
8821 if (! bgp)
8822 {
8823 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
8824 return CMD_WARNING;
8825 }
8826
8827 bgp_show_neighbor (vty, bgp, type, &su);
8828
8829 return CMD_SUCCESS;
8830 }
8831
8832 bgp = bgp_get_default ();
8833
8834 if (bgp)
8835 bgp_show_neighbor (vty, bgp, type, &su);
8836
8837 return CMD_SUCCESS;
8838}
8839
Lou Bergerf9b6c392016-01-12 13:42:09 -05008840/* "show ip bgp neighbors" commands. */DEFUN (show_ip_bgp_neighbors,
8841 show_ip_bgp_neighbors_cmd,
8842 "show ip bgp neighbors",
8843 SHOW_STR
8844 IP_STR
8845 BGP_STR
8846 "Detailed information on TCP and BGP neighbor connections\n")
8847{
8848 return bgp_show_neighbor_vty (vty, NULL, show_all, NULL);
8849}
8850
8851ALIAS (show_ip_bgp_neighbors,
8852 show_ip_bgp_ipv4_neighbors_cmd,
8853 "show ip bgp ipv4 (unicast|multicast) neighbors",
8854 SHOW_STR
8855 IP_STR
8856 BGP_STR
8857 "Address family\n"
8858 "Address Family modifier\n"
8859 "Address Family modifier\n"
8860 "Detailed information on TCP and BGP neighbor connections\n")
8861
8862ALIAS (show_ip_bgp_neighbors,
8863 show_ip_bgp_vpnv4_all_neighbors_cmd,
8864 "show ip bgp vpnv4 all neighbors",
8865 SHOW_STR
8866 IP_STR
8867 BGP_STR
8868 "Display VPNv4 NLRI specific information\n"
8869 "Display information about all VPNv4 NLRIs\n"
8870 "Detailed information on TCP and BGP neighbor connections\n")
8871
8872ALIAS (show_ip_bgp_neighbors,
8873 show_ip_bgp_vpnv4_rd_neighbors_cmd,
8874 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors",
8875 SHOW_STR
8876 IP_STR
8877 BGP_STR
8878 "Display VPNv4 NLRI specific information\n"
8879 "Display information for a route distinguisher\n"
8880 "VPN Route Distinguisher\n"
8881 "Detailed information on TCP and BGP neighbor connections\n")
8882
8883ALIAS (show_ip_bgp_neighbors,
8884 show_bgp_ipv6_neighbors_cmd,
8885 "show bgp ipv6 neighbors",
8886 SHOW_STR
8887 BGP_STR
8888 "Address family\n"
8889 "Detailed information on TCP and BGP neighbor connections\n")
8890
8891DEFUN (show_ip_bgp_neighbors_peer,
8892 show_ip_bgp_neighbors_peer_cmd,
8893 "show ip bgp neighbors (A.B.C.D|X:X::X:X)",
8894 SHOW_STR
8895 IP_STR
8896 BGP_STR
8897 "Detailed information on TCP and BGP neighbor connections\n"
8898 "Neighbor to display information about\n"
8899 "Neighbor to display information about\n")
8900{
8901 return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 1]);
8902}
8903
8904ALIAS (show_ip_bgp_neighbors_peer,
8905 show_ip_bgp_ipv4_neighbors_peer_cmd,
8906 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X)",
8907 SHOW_STR
8908 IP_STR
8909 BGP_STR
8910 "Address family\n"
8911 "Address Family modifier\n"
8912 "Address Family modifier\n"
8913 "Detailed information on TCP and BGP neighbor connections\n"
8914 "Neighbor to display information about\n"
8915 "Neighbor to display information about\n")
8916
8917ALIAS (show_ip_bgp_neighbors_peer,
8918 show_ip_bgp_vpnv4_all_neighbors_peer_cmd,
8919 "show ip bgp vpnv4 all neighbors A.B.C.D",
8920 SHOW_STR
8921 IP_STR
8922 BGP_STR
8923 "Display VPNv4 NLRI specific information\n"
8924 "Display information about all VPNv4 NLRIs\n"
8925 "Detailed information on TCP and BGP neighbor connections\n"
8926 "Neighbor to display information about\n")
8927
8928ALIAS (show_ip_bgp_neighbors_peer,
8929 show_ip_bgp_vpnv4_rd_neighbors_peer_cmd,
8930 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D",
8931 SHOW_STR
8932 IP_STR
8933 BGP_STR
8934 "Display VPNv4 NLRI specific information\n"
8935 "Display information about all VPNv4 NLRIs\n"
8936 "Detailed information on TCP and BGP neighbor connections\n"
8937 "Neighbor to display information about\n")
8938
8939ALIAS (show_ip_bgp_neighbors_peer,
8940 show_bgp_ipv6_neighbors_peer_cmd,
8941 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X)",
8942 SHOW_STR
8943 BGP_STR
8944 "Address family\n"
8945 "Detailed information on TCP and BGP neighbor connections\n"
8946 "Neighbor to display information about\n"
8947 "Neighbor to display information about\n")
8948
8949DEFUN (show_ip_bgp_instance_neighbors,
8950 show_ip_bgp_instance_neighbors_cmd,
8951 "show ip bgp view WORD neighbors",
8952 SHOW_STR
8953 IP_STR
8954 BGP_STR
8955 "BGP view\n"
8956 "View name\n"
8957 "Detailed information on TCP and BGP neighbor connections\n")
8958{
8959 return bgp_show_neighbor_vty (vty, argv[0], show_all, NULL);
8960}
8961
8962ALIAS (show_ip_bgp_instance_neighbors,
8963 show_bgp_instance_ipv6_neighbors_cmd,
8964 "show bgp view WORD ipv6 neighbors",
8965 SHOW_STR
8966 BGP_STR
8967 "BGP view\n"
8968 "View name\n"
8969 "Address family\n"
8970 "Detailed information on TCP and BGP neighbor connections\n")
8971
8972DEFUN (show_ip_bgp_instance_neighbors_peer,
8973 show_ip_bgp_instance_neighbors_peer_cmd,
8974 "show ip bgp view WORD neighbors (A.B.C.D|X:X::X:X)",
8975 SHOW_STR
8976 IP_STR
8977 BGP_STR
8978 "BGP view\n"
8979 "View name\n"
8980 "Detailed information on TCP and BGP neighbor connections\n"
8981 "Neighbor to display information about\n"
8982 "Neighbor to display information about\n")
8983{
8984 return bgp_show_neighbor_vty (vty, argv[0], show_peer, argv[1]);
8985}
8986
8987/* Show BGP's AS paths internal data. There are both `show ip bgp
8988 paths' and `show ip mbgp paths'. Those functions results are the
8989 same.*/
8990DEFUN (show_ip_bgp_paths,
8991 show_ip_bgp_paths_cmd,
8992 "show ip bgp paths",
8993 SHOW_STR
8994 IP_STR
8995 BGP_STR
8996 "Path information\n")
8997{
8998 vty_out (vty, "Address Refcnt Path%s", VTY_NEWLINE);
8999 aspath_print_all_vty (vty);
9000 return CMD_SUCCESS;
9001}
9002
9003DEFUN (show_ip_bgp_ipv4_paths,
9004 show_ip_bgp_ipv4_paths_cmd,
9005 "show ip bgp ipv4 (unicast|multicast) paths",
9006 SHOW_STR
9007 IP_STR
9008 BGP_STR
9009 "Address family\n"
9010 "Address Family modifier\n"
9011 "Address Family modifier\n"
9012 "Path information\n")
9013{
9014 vty_out (vty, "Address Refcnt Path\r\n");
9015 aspath_print_all_vty (vty);
9016
9017 return CMD_SUCCESS;
9018}
9019
Lou Berger651b4022016-01-12 13:42:07 -05009020DEFUN (show_bgp_neighbors,
9021 show_bgp_neighbors_cmd,
9022 "show bgp neighbors",
paul718e3742002-12-13 20:15:29 +00009023 SHOW_STR
paul718e3742002-12-13 20:15:29 +00009024 BGP_STR
9025 "Detailed information on TCP and BGP neighbor connections\n")
9026{
9027 return bgp_show_neighbor_vty (vty, NULL, show_all, NULL);
9028}
9029
Lou Berger651b4022016-01-12 13:42:07 -05009030DEFUN (show_bgp_neighbors_peer,
9031 show_bgp_neighbors_peer_cmd,
Lou Berger651b4022016-01-12 13:42:07 -05009032 "show bgp 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 "Detailed information on TCP and BGP neighbor connections\n"
9036 "Neighbor to display information about\n"
9037 "Neighbor to display information about\n")
9038{
9039 return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 1]);
9040}
9041
Lou Berger651b4022016-01-12 13:42:07 -05009042DEFUN (show_bgp_instance_neighbors,
9043 show_bgp_instance_neighbors_cmd,
9044 "show bgp view WORD neighbors",
paul718e3742002-12-13 20:15:29 +00009045 SHOW_STR
paul718e3742002-12-13 20:15:29 +00009046 BGP_STR
9047 "BGP view\n"
9048 "View name\n"
9049 "Detailed information on TCP and BGP neighbor connections\n")
9050{
9051 return bgp_show_neighbor_vty (vty, argv[0], show_all, NULL);
9052}
9053
Lou Berger651b4022016-01-12 13:42:07 -05009054DEFUN (show_bgp_instance_neighbors_peer,
9055 show_bgp_instance_neighbors_peer_cmd,
Lou Berger651b4022016-01-12 13:42:07 -05009056 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X)",
paul718e3742002-12-13 20:15:29 +00009057 SHOW_STR
paul718e3742002-12-13 20:15:29 +00009058 BGP_STR
9059 "BGP view\n"
9060 "View name\n"
9061 "Detailed information on TCP and BGP neighbor connections\n"
9062 "Neighbor to display information about\n"
9063 "Neighbor to display information about\n")
9064{
9065 return bgp_show_neighbor_vty (vty, argv[0], show_peer, argv[1]);
9066}
paulbb46e942003-10-24 19:02:03 +00009067
Lou Berger651b4022016-01-12 13:42:07 -05009068ALIAS (show_bgp_instance_neighbors_peer,
paulbb46e942003-10-24 19:02:03 +00009069 show_bgp_instance_ipv6_neighbors_peer_cmd,
9070 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X)",
9071 SHOW_STR
9072 BGP_STR
9073 "BGP view\n"
9074 "View name\n"
9075 "Address family\n"
9076 "Detailed information on TCP and BGP neighbor connections\n"
9077 "Neighbor to display information about\n"
9078 "Neighbor to display information about\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02009079
paul718e3742002-12-13 20:15:29 +00009080/* Show BGP's AS paths internal data. There are both `show ip bgp
9081 paths' and `show ip mbgp paths'. Those functions results are the
9082 same.*/
Lou Berger651b4022016-01-12 13:42:07 -05009083DEFUN (show_bgp_ipv4_paths,
9084 show_bgp_ipv4_paths_cmd,
9085 "show bgp paths",
paul718e3742002-12-13 20:15:29 +00009086 SHOW_STR
paul718e3742002-12-13 20:15:29 +00009087 BGP_STR
9088 "Path information\n")
9089{
9090 vty_out (vty, "Address Refcnt Path%s", VTY_NEWLINE);
9091 aspath_print_all_vty (vty);
9092 return CMD_SUCCESS;
9093}
9094
paul718e3742002-12-13 20:15:29 +00009095#include "hash.h"
9096
paul94f2b392005-06-28 12:44:16 +00009097static void
paul718e3742002-12-13 20:15:29 +00009098community_show_all_iterator (struct hash_backet *backet, struct vty *vty)
9099{
9100 struct community *com;
9101
9102 com = (struct community *) backet->data;
David Lampartereed3c482015-03-03 08:51:53 +01009103 vty_out (vty, "[%p] (%ld) %s%s", (void *)backet, com->refcnt,
paul718e3742002-12-13 20:15:29 +00009104 community_str (com), VTY_NEWLINE);
9105}
9106
9107/* Show BGP's community internal data. */
9108DEFUN (show_ip_bgp_community_info,
9109 show_ip_bgp_community_info_cmd,
9110 "show ip bgp community-info",
9111 SHOW_STR
9112 IP_STR
9113 BGP_STR
9114 "List all bgp community information\n")
9115{
9116 vty_out (vty, "Address Refcnt Community%s", VTY_NEWLINE);
9117
9118 hash_iterate (community_hash (),
9119 (void (*) (struct hash_backet *, void *))
9120 community_show_all_iterator,
9121 vty);
9122
9123 return CMD_SUCCESS;
9124}
9125
Job Snijders3334bab2017-01-20 14:47:12 +00009126static void
9127lcommunity_show_all_iterator (struct hash_backet *backet, struct vty *vty)
9128{
9129 struct lcommunity *lcom;
9130
9131 lcom = (struct lcommunity *) backet->data;
9132 vty_out (vty, "[%p] (%ld) %s%s", (void *)backet, lcom->refcnt,
9133 lcommunity_str (lcom), VTY_NEWLINE);
9134}
9135
9136/* Show BGP's community internal data. */
9137DEFUN (show_ip_bgp_lcommunity_info,
9138 show_ip_bgp_lcommunity_info_cmd,
9139 "show ip bgp large-community-info",
9140 SHOW_STR
9141 IP_STR
9142 BGP_STR
9143 "List all bgp large-community information\n")
9144{
9145 vty_out (vty, "Address Refcnt Large-community%s", VTY_NEWLINE);
9146
9147 hash_iterate (lcommunity_hash (),
9148 (void (*) (struct hash_backet *, void *))
9149 lcommunity_show_all_iterator,
9150 vty);
9151
9152 return CMD_SUCCESS;
9153}
9154
paul718e3742002-12-13 20:15:29 +00009155DEFUN (show_ip_bgp_attr_info,
9156 show_ip_bgp_attr_info_cmd,
9157 "show ip bgp attribute-info",
9158 SHOW_STR
9159 IP_STR
9160 BGP_STR
9161 "List all bgp attribute information\n")
9162{
9163 attr_show_all (vty);
9164 return CMD_SUCCESS;
9165}
David Lamparter6b0655a2014-06-04 06:53:35 +02009166
paul94f2b392005-06-28 12:44:16 +00009167static int
paulfee0f4c2004-09-13 05:12:46 +00009168bgp_write_rsclient_summary (struct vty *vty, struct peer *rsclient,
9169 afi_t afi, safi_t safi)
9170{
9171 char timebuf[BGP_UPTIME_LEN];
9172 char rmbuf[14];
paulfd79ac92004-10-13 05:06:08 +00009173 const char *rmname;
paulfee0f4c2004-09-13 05:12:46 +00009174 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00009175 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00009176 int len;
9177 int count = 0;
9178
9179 if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_GROUP))
9180 {
paul1eb8ef22005-04-07 07:30:20 +00009181 for (ALL_LIST_ELEMENTS (rsclient->group->peer, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00009182 {
9183 count++;
9184 bgp_write_rsclient_summary (vty, peer, afi, safi);
9185 }
9186 return count;
9187 }
9188
9189 len = vty_out (vty, "%s", rsclient->host);
9190 len = 16 - len;
9191
9192 if (len < 1)
9193 vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " ");
9194 else
9195 vty_out (vty, "%*s", len, " ");
9196
hasso3d515fd2005-02-01 21:30:04 +00009197 vty_out (vty, "4 ");
paulfee0f4c2004-09-13 05:12:46 +00009198
Milan Kociancb4fc592014-12-01 12:48:25 +00009199 vty_out (vty, "%10u ", rsclient->as);
paulfee0f4c2004-09-13 05:12:46 +00009200
9201 rmname = ROUTE_MAP_EXPORT_NAME(&rsclient->filter[afi][safi]);
9202 if ( rmname && strlen (rmname) > 13 )
9203 {
9204 sprintf (rmbuf, "%13s", "...");
9205 rmname = strncpy (rmbuf, rmname, 10);
9206 }
9207 else if (! rmname)
9208 rmname = "<none>";
9209 vty_out (vty, " %13s ", rmname);
9210
9211 rmname = ROUTE_MAP_IMPORT_NAME(&rsclient->filter[afi][safi]);
9212 if ( rmname && strlen (rmname) > 13 )
9213 {
9214 sprintf (rmbuf, "%13s", "...");
9215 rmname = strncpy (rmbuf, rmname, 10);
9216 }
9217 else if (! rmname)
9218 rmname = "<none>";
9219 vty_out (vty, " %13s ", rmname);
9220
9221 vty_out (vty, "%8s", peer_uptime (rsclient->uptime, timebuf, BGP_UPTIME_LEN));
9222
9223 if (CHECK_FLAG (rsclient->flags, PEER_FLAG_SHUTDOWN))
9224 vty_out (vty, " Idle (Admin)");
9225 else if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_PREFIX_OVERFLOW))
9226 vty_out (vty, " Idle (PfxCt)");
9227 else
9228 vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, rsclient->status));
9229
9230 vty_out (vty, "%s", VTY_NEWLINE);
9231
9232 return 1;
9233}
9234
paul94f2b392005-06-28 12:44:16 +00009235static int
paulfd79ac92004-10-13 05:06:08 +00009236bgp_show_rsclient_summary (struct vty *vty, struct bgp *bgp,
9237 afi_t afi, safi_t safi)
paulfee0f4c2004-09-13 05:12:46 +00009238{
9239 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00009240 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00009241 int count = 0;
9242
9243 /* Header string for each address family. */
Milan Kociancb4fc592014-12-01 12:48:25 +00009244 static char header[] = "Neighbor V AS Export-Policy Import-Policy Up/Down State";
paulfee0f4c2004-09-13 05:12:46 +00009245
paul1eb8ef22005-04-07 07:30:20 +00009246 for (ALL_LIST_ELEMENTS (bgp->rsclient, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00009247 {
9248 if (peer->afc[afi][safi] &&
9249 CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT))
9250 {
9251 if (! count)
9252 {
9253 vty_out (vty,
9254 "Route Server's BGP router identifier %s%s",
9255 inet_ntoa (bgp->router_id), VTY_NEWLINE);
9256 vty_out (vty,
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04009257 "Route Server's local AS number %u%s", bgp->as,
paulfee0f4c2004-09-13 05:12:46 +00009258 VTY_NEWLINE);
9259
9260 vty_out (vty, "%s", VTY_NEWLINE);
9261 vty_out (vty, "%s%s", header, VTY_NEWLINE);
9262 }
9263
9264 count += bgp_write_rsclient_summary (vty, peer, afi, safi);
9265 }
9266 }
9267
9268 if (count)
9269 vty_out (vty, "%sTotal number of Route Server Clients %d%s", VTY_NEWLINE,
9270 count, VTY_NEWLINE);
9271 else
9272 vty_out (vty, "No %s Route Server Client is configured%s",
9273 afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE);
9274
9275 return CMD_SUCCESS;
9276}
9277
paul94f2b392005-06-28 12:44:16 +00009278static int
paulfd79ac92004-10-13 05:06:08 +00009279bgp_show_rsclient_summary_vty (struct vty *vty, const char *name,
9280 afi_t afi, safi_t safi)
paulfee0f4c2004-09-13 05:12:46 +00009281{
9282 struct bgp *bgp;
9283
9284 if (name)
9285 {
9286 bgp = bgp_lookup_by_name (name);
9287
9288 if (! bgp)
9289 {
9290 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
9291 return CMD_WARNING;
9292 }
9293
9294 bgp_show_rsclient_summary (vty, bgp, afi, safi);
9295 return CMD_SUCCESS;
9296 }
9297
9298 bgp = bgp_get_default ();
9299
9300 if (bgp)
9301 bgp_show_rsclient_summary (vty, bgp, afi, safi);
9302
9303 return CMD_SUCCESS;
9304}
9305
9306/* 'show bgp rsclient' commands. */
Lou Bergerf9b6c392016-01-12 13:42:09 -05009307DEFUN (show_ip_bgp_rsclient_summary,
9308 show_ip_bgp_rsclient_summary_cmd,
9309 "show ip bgp rsclient summary",
9310 SHOW_STR
9311 IP_STR
9312 BGP_STR
9313 "Information about Route Server Clients\n"
9314 "Summary of all Route Server Clients\n")
9315{
9316 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
9317}
9318
9319DEFUN (show_ip_bgp_instance_rsclient_summary,
9320 show_ip_bgp_instance_rsclient_summary_cmd,
9321 "show ip bgp view WORD rsclient summary",
9322 SHOW_STR
9323 IP_STR
9324 BGP_STR
9325 "BGP view\n"
9326 "View name\n"
9327 "Information about Route Server Clients\n"
9328 "Summary of all Route Server Clients\n")
9329{
9330 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
9331}
9332
9333DEFUN (show_ip_bgp_ipv4_rsclient_summary,
9334 show_ip_bgp_ipv4_rsclient_summary_cmd,
9335 "show ip bgp ipv4 (unicast|multicast) rsclient summary",
9336 SHOW_STR
9337 IP_STR
9338 BGP_STR
9339 "Address family\n"
9340 "Address Family modifier\n"
9341 "Address Family modifier\n"
9342 "Information about Route Server Clients\n"
9343 "Summary of all Route Server Clients\n")
9344{
9345 if (strncmp (argv[0], "m", 1) == 0)
9346 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
9347
9348 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
9349}
9350
9351DEFUN (show_ip_bgp_instance_ipv4_rsclient_summary,
9352 show_ip_bgp_instance_ipv4_rsclient_summary_cmd,
9353 "show ip bgp view WORD ipv4 (unicast|multicast) rsclient summary",
9354 SHOW_STR
9355 IP_STR
9356 BGP_STR
9357 "BGP view\n"
9358 "View name\n"
9359 "Address family\n"
9360 "Address Family modifier\n"
9361 "Address Family modifier\n"
9362 "Information about Route Server Clients\n"
9363 "Summary of all Route Server Clients\n")
9364{
9365 if (strncmp (argv[1], "m", 1) == 0)
9366 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
9367
9368 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
9369}
paulfee0f4c2004-09-13 05:12:46 +00009370
Michael Lambert95cbbd22010-07-23 14:43:04 -04009371DEFUN (show_bgp_instance_ipv4_safi_rsclient_summary,
9372 show_bgp_instance_ipv4_safi_rsclient_summary_cmd,
9373 "show bgp view WORD ipv4 (unicast|multicast) rsclient summary",
9374 SHOW_STR
9375 BGP_STR
9376 "BGP view\n"
9377 "View name\n"
9378 "Address family\n"
9379 "Address Family modifier\n"
9380 "Address Family modifier\n"
9381 "Information about Route Server Clients\n"
9382 "Summary of all Route Server Clients\n")
9383{
9384 safi_t safi;
9385
9386 if (argc == 2) {
9387 safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
9388 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, safi);
9389 } else {
9390 safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
9391 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, safi);
9392 }
9393}
9394
9395ALIAS (show_bgp_instance_ipv4_safi_rsclient_summary,
9396 show_bgp_ipv4_safi_rsclient_summary_cmd,
9397 "show bgp ipv4 (unicast|multicast) rsclient summary",
9398 SHOW_STR
9399 BGP_STR
9400 "Address family\n"
9401 "Address Family modifier\n"
9402 "Address Family modifier\n"
9403 "Information about Route Server Clients\n"
9404 "Summary of all Route Server Clients\n")
9405
paulfee0f4c2004-09-13 05:12:46 +00009406DEFUN (show_bgp_rsclient_summary,
9407 show_bgp_rsclient_summary_cmd,
9408 "show bgp rsclient summary",
9409 SHOW_STR
9410 BGP_STR
9411 "Information about Route Server Clients\n"
9412 "Summary of all Route Server Clients\n")
9413{
Lou Berger651b4022016-01-12 13:42:07 -05009414 vty_out(vty, "%sIPv4 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9415 vty_out(vty, "---------------------%s", VTY_NEWLINE);
9416 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
9417 vty_out(vty, "%sIPv4 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9418 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
9419 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
9420 vty_out(vty, "%sIPv4 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9421 vty_out(vty, "-----------------%s", VTY_NEWLINE);
9422 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
9423 vty_out(vty, "%sIPv4 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9424 vty_out(vty, "-------------------%s", VTY_NEWLINE);
9425 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_ENCAP);
9426
Lou Berger651b4022016-01-12 13:42:07 -05009427 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9428 vty_out(vty, "---------------------%s", VTY_NEWLINE);
9429 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
9430 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9431 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
9432 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
9433 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9434 vty_out(vty, "-----------------%s", VTY_NEWLINE);
9435 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_MPLS_VPN);
9436 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9437 vty_out(vty, "-------------------%s", VTY_NEWLINE);
9438 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_ENCAP);
Lou Berger205e6742016-01-12 13:42:11 -05009439
Lou Berger651b4022016-01-12 13:42:07 -05009440 return CMD_SUCCESS;
paulfee0f4c2004-09-13 05:12:46 +00009441}
9442
9443DEFUN (show_bgp_instance_rsclient_summary,
9444 show_bgp_instance_rsclient_summary_cmd,
9445 "show bgp view WORD rsclient summary",
9446 SHOW_STR
9447 BGP_STR
9448 "BGP view\n"
9449 "View name\n"
9450 "Information about Route Server Clients\n"
9451 "Summary of all Route Server Clients\n")
9452{
Lou Berger651b4022016-01-12 13:42:07 -05009453 vty_out(vty, "%sIPv4 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9454 vty_out(vty, "---------------------%s", VTY_NEWLINE);
9455 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
9456 vty_out(vty, "%sIPv4 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9457 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
9458 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
9459 vty_out(vty, "%sIPv4 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9460 vty_out(vty, "-----------------%s", VTY_NEWLINE);
9461 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_MPLS_VPN);
9462 vty_out(vty, "%sIPv4 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9463 vty_out(vty, "-------------------%s", VTY_NEWLINE);
9464 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_ENCAP);
9465
Lou Berger651b4022016-01-12 13:42:07 -05009466 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9467 vty_out(vty, "---------------------%s", VTY_NEWLINE);
9468 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
9469 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9470 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
9471 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST);
9472 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9473 vty_out(vty, "-----------------%s", VTY_NEWLINE);
9474 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_MPLS_VPN);
9475 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9476 vty_out(vty, "-------------------%s", VTY_NEWLINE);
9477 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_ENCAP);
Lou Berger205e6742016-01-12 13:42:11 -05009478
Lou Berger651b4022016-01-12 13:42:07 -05009479 return CMD_SUCCESS;
paulfee0f4c2004-09-13 05:12:46 +00009480}
9481
Lou Berger651b4022016-01-12 13:42:07 -05009482DEFUN (show_bgp_ipv6_rsclient_summary,
paulfee0f4c2004-09-13 05:12:46 +00009483 show_bgp_ipv6_rsclient_summary_cmd,
9484 "show bgp ipv6 rsclient summary",
9485 SHOW_STR
9486 BGP_STR
9487 "Address family\n"
9488 "Information about Route Server Clients\n"
9489 "Summary of all Route Server Clients\n")
Lou Berger651b4022016-01-12 13:42:07 -05009490{
9491 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9492 vty_out(vty, "---------------------%s", VTY_NEWLINE);
9493 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
9494 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9495 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
9496 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
9497 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9498 vty_out(vty, "-----------------%s", VTY_NEWLINE);
9499 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_MPLS_VPN);
9500 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9501 vty_out(vty, "-------------------%s", VTY_NEWLINE);
9502 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_ENCAP);
paulfee0f4c2004-09-13 05:12:46 +00009503
Lou Berger651b4022016-01-12 13:42:07 -05009504 return CMD_SUCCESS;
9505}
9506
9507DEFUN (show_bgp_instance_ipv6_rsclient_summary,
paulfee0f4c2004-09-13 05:12:46 +00009508 show_bgp_instance_ipv6_rsclient_summary_cmd,
9509 "show bgp view WORD ipv6 rsclient summary",
9510 SHOW_STR
9511 BGP_STR
9512 "BGP view\n"
9513 "View name\n"
9514 "Address family\n"
9515 "Information about Route Server Clients\n"
9516 "Summary of all Route Server Clients\n")
Lou Berger651b4022016-01-12 13:42:07 -05009517{
9518 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9519 vty_out(vty, "---------------------%s", VTY_NEWLINE);
9520 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
9521 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9522 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
9523 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST);
9524 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9525 vty_out(vty, "-----------------%s", VTY_NEWLINE);
9526 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_MPLS_VPN);
9527 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9528 vty_out(vty, "-------------------%s", VTY_NEWLINE);
9529 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_ENCAP);
9530
9531 return CMD_SUCCESS;
9532}
Michael Lambert95cbbd22010-07-23 14:43:04 -04009533
9534DEFUN (show_bgp_instance_ipv6_safi_rsclient_summary,
9535 show_bgp_instance_ipv6_safi_rsclient_summary_cmd,
9536 "show bgp view WORD ipv6 (unicast|multicast) rsclient summary",
9537 SHOW_STR
9538 BGP_STR
9539 "BGP view\n"
9540 "View name\n"
9541 "Address family\n"
9542 "Address Family modifier\n"
9543 "Address Family modifier\n"
9544 "Information about Route Server Clients\n"
9545 "Summary of all Route Server Clients\n")
9546{
9547 safi_t safi;
9548
9549 if (argc == 2) {
9550 safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
9551 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, safi);
9552 } else {
9553 safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
9554 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, safi);
9555 }
9556}
9557
9558ALIAS (show_bgp_instance_ipv6_safi_rsclient_summary,
9559 show_bgp_ipv6_safi_rsclient_summary_cmd,
9560 "show bgp ipv6 (unicast|multicast) rsclient summary",
9561 SHOW_STR
9562 BGP_STR
Lou Berger651b4022016-01-12 13:42:07 -05009563 IPV6_STR
Michael Lambert95cbbd22010-07-23 14:43:04 -04009564 "Address Family modifier\n"
9565 "Address Family modifier\n"
9566 "Information about Route Server Clients\n"
9567 "Summary of all Route Server Clients\n")
9568
paul718e3742002-12-13 20:15:29 +00009569/* Redistribute VTY commands. */
9570
paul718e3742002-12-13 20:15:29 +00009571DEFUN (bgp_redistribute_ipv4,
9572 bgp_redistribute_ipv4_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009573 "redistribute " QUAGGA_IP_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00009574 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009575 QUAGGA_IP_REDIST_HELP_STR_BGPD)
paul718e3742002-12-13 20:15:29 +00009576{
9577 int type;
9578
David Lampartere0ca5fd2009-09-16 01:52:42 +02009579 type = proto_redistnum (AFI_IP, argv[0]);
9580 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009581 {
9582 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9583 return CMD_WARNING;
9584 }
9585 return bgp_redistribute_set (vty->index, AFI_IP, type);
9586}
9587
9588DEFUN (bgp_redistribute_ipv4_rmap,
9589 bgp_redistribute_ipv4_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009590 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00009591 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009592 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009593 "Route map reference\n"
9594 "Pointer to route-map entries\n")
9595{
9596 int type;
9597
David Lampartere0ca5fd2009-09-16 01:52:42 +02009598 type = proto_redistnum (AFI_IP, argv[0]);
9599 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009600 {
9601 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9602 return CMD_WARNING;
9603 }
9604
9605 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]);
9606 return bgp_redistribute_set (vty->index, AFI_IP, type);
9607}
9608
9609DEFUN (bgp_redistribute_ipv4_metric,
9610 bgp_redistribute_ipv4_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009611 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009612 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009613 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009614 "Metric for redistributed routes\n"
9615 "Default metric\n")
9616{
9617 int type;
9618 u_int32_t metric;
9619
David Lampartere0ca5fd2009-09-16 01:52:42 +02009620 type = proto_redistnum (AFI_IP, argv[0]);
9621 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009622 {
9623 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9624 return CMD_WARNING;
9625 }
9626 VTY_GET_INTEGER ("metric", metric, argv[1]);
9627
9628 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
9629 return bgp_redistribute_set (vty->index, AFI_IP, type);
9630}
9631
9632DEFUN (bgp_redistribute_ipv4_rmap_metric,
9633 bgp_redistribute_ipv4_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009634 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009635 "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 "Route map reference\n"
9638 "Pointer to route-map entries\n"
9639 "Metric for redistributed routes\n"
9640 "Default metric\n")
9641{
9642 int type;
9643 u_int32_t metric;
9644
David Lampartere0ca5fd2009-09-16 01:52:42 +02009645 type = proto_redistnum (AFI_IP, argv[0]);
9646 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009647 {
9648 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9649 return CMD_WARNING;
9650 }
9651 VTY_GET_INTEGER ("metric", metric, argv[2]);
9652
9653 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]);
9654 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
9655 return bgp_redistribute_set (vty->index, AFI_IP, type);
9656}
9657
9658DEFUN (bgp_redistribute_ipv4_metric_rmap,
9659 bgp_redistribute_ipv4_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009660 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00009661 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009662 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009663 "Metric for redistributed routes\n"
9664 "Default metric\n"
9665 "Route map reference\n"
9666 "Pointer to route-map entries\n")
9667{
9668 int type;
9669 u_int32_t metric;
9670
David Lampartere0ca5fd2009-09-16 01:52:42 +02009671 type = proto_redistnum (AFI_IP, argv[0]);
9672 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009673 {
9674 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9675 return CMD_WARNING;
9676 }
9677 VTY_GET_INTEGER ("metric", metric, argv[1]);
9678
9679 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
9680 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[2]);
9681 return bgp_redistribute_set (vty->index, AFI_IP, type);
9682}
9683
9684DEFUN (no_bgp_redistribute_ipv4,
9685 no_bgp_redistribute_ipv4_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009686 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00009687 NO_STR
9688 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009689 QUAGGA_IP_REDIST_HELP_STR_BGPD)
paul718e3742002-12-13 20:15:29 +00009690{
9691 int type;
9692
David Lampartere0ca5fd2009-09-16 01:52:42 +02009693 type = proto_redistnum (AFI_IP, argv[0]);
9694 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009695 {
9696 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9697 return CMD_WARNING;
9698 }
9699
9700 return bgp_redistribute_unset (vty->index, AFI_IP, type);
9701}
9702
Daniel Waltonc0a4cc72015-11-09 20:22:00 -05009703ALIAS (no_bgp_redistribute_ipv4,
paul718e3742002-12-13 20:15:29 +00009704 no_bgp_redistribute_ipv4_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009705 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00009706 NO_STR
9707 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009708 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009709 "Route map reference\n"
9710 "Pointer to route-map entries\n")
paul718e3742002-12-13 20:15:29 +00009711
Daniel Waltonc0a4cc72015-11-09 20:22:00 -05009712ALIAS (no_bgp_redistribute_ipv4,
paul718e3742002-12-13 20:15:29 +00009713 no_bgp_redistribute_ipv4_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009714 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009715 NO_STR
9716 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009717 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009718 "Metric for redistributed routes\n"
9719 "Default metric\n")
paul718e3742002-12-13 20:15:29 +00009720
Daniel Waltonc0a4cc72015-11-09 20:22:00 -05009721ALIAS (no_bgp_redistribute_ipv4,
paul718e3742002-12-13 20:15:29 +00009722 no_bgp_redistribute_ipv4_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009723 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009724 NO_STR
9725 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009726 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009727 "Route map reference\n"
9728 "Pointer to route-map entries\n"
9729 "Metric for redistributed routes\n"
9730 "Default metric\n")
paul718e3742002-12-13 20:15:29 +00009731
Daniel Waltonc0a4cc72015-11-09 20:22:00 -05009732ALIAS (no_bgp_redistribute_ipv4,
paul718e3742002-12-13 20:15:29 +00009733 no_bgp_redistribute_ipv4_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009734 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00009735 NO_STR
9736 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009737 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009738 "Metric for redistributed routes\n"
9739 "Default metric\n"
9740 "Route map reference\n"
9741 "Pointer to route-map entries\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02009742
paul718e3742002-12-13 20:15:29 +00009743DEFUN (bgp_redistribute_ipv6,
9744 bgp_redistribute_ipv6_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009745 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00009746 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009747 QUAGGA_IP6_REDIST_HELP_STR_BGPD)
paul718e3742002-12-13 20:15:29 +00009748{
9749 int type;
9750
David Lampartere0ca5fd2009-09-16 01:52:42 +02009751 type = proto_redistnum (AFI_IP6, argv[0]);
9752 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009753 {
9754 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9755 return CMD_WARNING;
9756 }
9757
9758 return bgp_redistribute_set (vty->index, AFI_IP6, type);
9759}
9760
9761DEFUN (bgp_redistribute_ipv6_rmap,
9762 bgp_redistribute_ipv6_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009763 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00009764 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009765 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009766 "Route map reference\n"
9767 "Pointer to route-map entries\n")
9768{
9769 int type;
9770
David Lampartere0ca5fd2009-09-16 01:52:42 +02009771 type = proto_redistnum (AFI_IP6, argv[0]);
9772 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009773 {
9774 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9775 return CMD_WARNING;
9776 }
9777
9778 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]);
9779 return bgp_redistribute_set (vty->index, AFI_IP6, type);
9780}
9781
9782DEFUN (bgp_redistribute_ipv6_metric,
9783 bgp_redistribute_ipv6_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009784 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009785 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009786 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009787 "Metric for redistributed routes\n"
9788 "Default metric\n")
9789{
9790 int type;
9791 u_int32_t metric;
9792
David Lampartere0ca5fd2009-09-16 01:52:42 +02009793 type = proto_redistnum (AFI_IP6, argv[0]);
9794 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009795 {
9796 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9797 return CMD_WARNING;
9798 }
9799 VTY_GET_INTEGER ("metric", metric, argv[1]);
9800
9801 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
9802 return bgp_redistribute_set (vty->index, AFI_IP6, type);
9803}
9804
9805DEFUN (bgp_redistribute_ipv6_rmap_metric,
9806 bgp_redistribute_ipv6_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009807 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009808 "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 "Route map reference\n"
9811 "Pointer to route-map entries\n"
9812 "Metric for redistributed routes\n"
9813 "Default metric\n")
9814{
9815 int type;
9816 u_int32_t metric;
9817
David Lampartere0ca5fd2009-09-16 01:52:42 +02009818 type = proto_redistnum (AFI_IP6, argv[0]);
9819 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009820 {
9821 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9822 return CMD_WARNING;
9823 }
9824 VTY_GET_INTEGER ("metric", metric, argv[2]);
9825
9826 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]);
9827 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
9828 return bgp_redistribute_set (vty->index, AFI_IP6, type);
9829}
9830
9831DEFUN (bgp_redistribute_ipv6_metric_rmap,
9832 bgp_redistribute_ipv6_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009833 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00009834 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009835 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009836 "Metric for redistributed routes\n"
9837 "Default metric\n"
9838 "Route map reference\n"
9839 "Pointer to route-map entries\n")
9840{
9841 int type;
9842 u_int32_t metric;
9843
David Lampartere0ca5fd2009-09-16 01:52:42 +02009844 type = proto_redistnum (AFI_IP6, argv[0]);
9845 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009846 {
9847 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9848 return CMD_WARNING;
9849 }
9850 VTY_GET_INTEGER ("metric", metric, argv[1]);
9851
9852 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
9853 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[2]);
9854 return bgp_redistribute_set (vty->index, AFI_IP6, type);
9855}
9856
9857DEFUN (no_bgp_redistribute_ipv6,
9858 no_bgp_redistribute_ipv6_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009859 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00009860 NO_STR
9861 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009862 QUAGGA_IP6_REDIST_HELP_STR_BGPD)
paul718e3742002-12-13 20:15:29 +00009863{
9864 int type;
9865
David Lampartere0ca5fd2009-09-16 01:52:42 +02009866 type = proto_redistnum (AFI_IP6, argv[0]);
9867 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009868 {
9869 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9870 return CMD_WARNING;
9871 }
9872
9873 return bgp_redistribute_unset (vty->index, AFI_IP6, type);
9874}
9875
Daniel Waltonc0a4cc72015-11-09 20:22:00 -05009876ALIAS (no_bgp_redistribute_ipv6,
paul718e3742002-12-13 20:15:29 +00009877 no_bgp_redistribute_ipv6_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009878 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00009879 NO_STR
9880 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009881 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009882 "Route map reference\n"
9883 "Pointer to route-map entries\n")
paul718e3742002-12-13 20:15:29 +00009884
Daniel Waltonc0a4cc72015-11-09 20:22:00 -05009885ALIAS (no_bgp_redistribute_ipv6,
paul718e3742002-12-13 20:15:29 +00009886 no_bgp_redistribute_ipv6_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009887 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009888 NO_STR
9889 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009890 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009891 "Metric for redistributed routes\n"
9892 "Default metric\n")
paul718e3742002-12-13 20:15:29 +00009893
Daniel Waltonc0a4cc72015-11-09 20:22:00 -05009894ALIAS (no_bgp_redistribute_ipv6,
paul718e3742002-12-13 20:15:29 +00009895 no_bgp_redistribute_ipv6_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009896 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009897 NO_STR
9898 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009899 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009900 "Route map reference\n"
9901 "Pointer to route-map entries\n"
9902 "Metric for redistributed routes\n"
9903 "Default metric\n")
paul718e3742002-12-13 20:15:29 +00009904
Daniel Waltonc0a4cc72015-11-09 20:22:00 -05009905ALIAS (no_bgp_redistribute_ipv6,
paul718e3742002-12-13 20:15:29 +00009906 no_bgp_redistribute_ipv6_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009907 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00009908 NO_STR
9909 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009910 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009911 "Metric for redistributed routes\n"
9912 "Default metric\n"
9913 "Route map reference\n"
9914 "Pointer to route-map entries\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02009915
paul718e3742002-12-13 20:15:29 +00009916int
9917bgp_config_write_redistribute (struct vty *vty, struct bgp *bgp, afi_t afi,
9918 safi_t safi, int *write)
9919{
9920 int i;
paul718e3742002-12-13 20:15:29 +00009921
9922 /* Unicast redistribution only. */
9923 if (safi != SAFI_UNICAST)
9924 return 0;
9925
9926 for (i = 0; i < ZEBRA_ROUTE_MAX; i++)
9927 {
9928 /* Redistribute BGP does not make sense. */
9929 if (bgp->redist[afi][i] && i != ZEBRA_ROUTE_BGP)
9930 {
9931 /* Display "address-family" when it is not yet diplayed. */
9932 bgp_config_write_family_header (vty, afi, safi, write);
9933
9934 /* "redistribute" configuration. */
ajsf52d13c2005-10-01 17:38:06 +00009935 vty_out (vty, " redistribute %s", zebra_route_string(i));
paul718e3742002-12-13 20:15:29 +00009936
9937 if (bgp->redist_metric_flag[afi][i])
Jorge Boncompte [DTI2]ddc943d2012-04-13 13:46:07 +02009938 vty_out (vty, " metric %u", bgp->redist_metric[afi][i]);
paul718e3742002-12-13 20:15:29 +00009939
9940 if (bgp->rmap[afi][i].name)
9941 vty_out (vty, " route-map %s", bgp->rmap[afi][i].name);
9942
9943 vty_out (vty, "%s", VTY_NEWLINE);
9944 }
9945 }
9946 return *write;
9947}
David Lamparter6b0655a2014-06-04 06:53:35 +02009948
paul718e3742002-12-13 20:15:29 +00009949/* BGP node structure. */
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009950static struct cmd_node bgp_node =
paul718e3742002-12-13 20:15:29 +00009951{
9952 BGP_NODE,
9953 "%s(config-router)# ",
9954 1,
9955};
9956
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009957static struct cmd_node bgp_ipv4_unicast_node =
paul718e3742002-12-13 20:15:29 +00009958{
9959 BGP_IPV4_NODE,
9960 "%s(config-router-af)# ",
9961 1,
9962};
9963
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009964static struct cmd_node bgp_ipv4_multicast_node =
paul718e3742002-12-13 20:15:29 +00009965{
9966 BGP_IPV4M_NODE,
9967 "%s(config-router-af)# ",
9968 1,
9969};
9970
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009971static struct cmd_node bgp_ipv6_unicast_node =
paul718e3742002-12-13 20:15:29 +00009972{
9973 BGP_IPV6_NODE,
9974 "%s(config-router-af)# ",
9975 1,
9976};
9977
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009978static struct cmd_node bgp_ipv6_multicast_node =
paul25ffbdc2005-08-22 22:42:08 +00009979{
9980 BGP_IPV6M_NODE,
9981 "%s(config-router-af)# ",
9982 1,
9983};
9984
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009985static struct cmd_node bgp_vpnv4_node =
paul718e3742002-12-13 20:15:29 +00009986{
9987 BGP_VPNV4_NODE,
9988 "%s(config-router-af)# ",
9989 1
9990};
David Lamparter6b0655a2014-06-04 06:53:35 +02009991
Lou Berger13c378d2016-01-12 13:41:56 -05009992static struct cmd_node bgp_vpnv6_node =
9993{
9994 BGP_VPNV6_NODE,
9995 "%s(config-router-af-vpnv6)# ",
9996 1
9997};
9998
Lou Bergera3fda882016-01-12 13:42:04 -05009999static struct cmd_node bgp_encap_node =
10000{
10001 BGP_ENCAP_NODE,
10002 "%s(config-router-af-encap)# ",
10003 1
10004};
10005
10006static struct cmd_node bgp_encapv6_node =
10007{
10008 BGP_ENCAPV6_NODE,
10009 "%s(config-router-af-encapv6)# ",
10010 1
10011};
10012
paul1f8ae702005-09-09 23:49:49 +000010013static void community_list_vty (void);
10014
paul718e3742002-12-13 20:15:29 +000010015void
paul94f2b392005-06-28 12:44:16 +000010016bgp_vty_init (void)
paul718e3742002-12-13 20:15:29 +000010017{
paul718e3742002-12-13 20:15:29 +000010018 /* Install bgp top node. */
10019 install_node (&bgp_node, bgp_config_write);
10020 install_node (&bgp_ipv4_unicast_node, NULL);
10021 install_node (&bgp_ipv4_multicast_node, NULL);
10022 install_node (&bgp_ipv6_unicast_node, NULL);
paul25ffbdc2005-08-22 22:42:08 +000010023 install_node (&bgp_ipv6_multicast_node, NULL);
paul718e3742002-12-13 20:15:29 +000010024 install_node (&bgp_vpnv4_node, NULL);
Lou Berger13c378d2016-01-12 13:41:56 -050010025 install_node (&bgp_vpnv6_node, NULL);
Lou Bergera3fda882016-01-12 13:42:04 -050010026 install_node (&bgp_encap_node, NULL);
10027 install_node (&bgp_encapv6_node, NULL);
paul718e3742002-12-13 20:15:29 +000010028
10029 /* Install default VTY commands to new nodes. */
10030 install_default (BGP_NODE);
10031 install_default (BGP_IPV4_NODE);
10032 install_default (BGP_IPV4M_NODE);
10033 install_default (BGP_IPV6_NODE);
paul25ffbdc2005-08-22 22:42:08 +000010034 install_default (BGP_IPV6M_NODE);
paul718e3742002-12-13 20:15:29 +000010035 install_default (BGP_VPNV4_NODE);
Lou Berger13c378d2016-01-12 13:41:56 -050010036 install_default (BGP_VPNV6_NODE);
Lou Bergera3fda882016-01-12 13:42:04 -050010037 install_default (BGP_ENCAP_NODE);
10038 install_default (BGP_ENCAPV6_NODE);
paul718e3742002-12-13 20:15:29 +000010039
10040 /* "bgp multiple-instance" commands. */
10041 install_element (CONFIG_NODE, &bgp_multiple_instance_cmd);
10042 install_element (CONFIG_NODE, &no_bgp_multiple_instance_cmd);
10043
10044 /* "bgp config-type" commands. */
10045 install_element (CONFIG_NODE, &bgp_config_type_cmd);
10046 install_element (CONFIG_NODE, &no_bgp_config_type_cmd);
10047
10048 /* Dummy commands (Currently not supported) */
10049 install_element (BGP_NODE, &no_synchronization_cmd);
10050 install_element (BGP_NODE, &no_auto_summary_cmd);
10051
10052 /* "router bgp" commands. */
10053 install_element (CONFIG_NODE, &router_bgp_cmd);
10054 install_element (CONFIG_NODE, &router_bgp_view_cmd);
10055
10056 /* "no router bgp" commands. */
10057 install_element (CONFIG_NODE, &no_router_bgp_cmd);
10058 install_element (CONFIG_NODE, &no_router_bgp_view_cmd);
10059
10060 /* "bgp router-id" commands. */
10061 install_element (BGP_NODE, &bgp_router_id_cmd);
10062 install_element (BGP_NODE, &no_bgp_router_id_cmd);
10063 install_element (BGP_NODE, &no_bgp_router_id_val_cmd);
10064
10065 /* "bgp cluster-id" commands. */
10066 install_element (BGP_NODE, &bgp_cluster_id_cmd);
10067 install_element (BGP_NODE, &bgp_cluster_id32_cmd);
10068 install_element (BGP_NODE, &no_bgp_cluster_id_cmd);
10069 install_element (BGP_NODE, &no_bgp_cluster_id_arg_cmd);
10070
10071 /* "bgp confederation" commands. */
10072 install_element (BGP_NODE, &bgp_confederation_identifier_cmd);
10073 install_element (BGP_NODE, &no_bgp_confederation_identifier_cmd);
10074 install_element (BGP_NODE, &no_bgp_confederation_identifier_arg_cmd);
10075
10076 /* "bgp confederation peers" commands. */
10077 install_element (BGP_NODE, &bgp_confederation_peers_cmd);
10078 install_element (BGP_NODE, &no_bgp_confederation_peers_cmd);
10079
Josh Bailey165b5ff2011-07-20 20:43:22 -070010080 /* "maximum-paths" commands. */
10081 install_element (BGP_NODE, &bgp_maxpaths_cmd);
10082 install_element (BGP_NODE, &no_bgp_maxpaths_cmd);
10083 install_element (BGP_NODE, &no_bgp_maxpaths_arg_cmd);
10084 install_element (BGP_IPV4_NODE, &bgp_maxpaths_cmd);
10085 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_cmd);
10086 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_arg_cmd);
Ayan Banerjeeb8d1f712015-11-09 20:14:54 -050010087 install_element (BGP_IPV6_NODE, &bgp_maxpaths_cmd);
10088 install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_cmd);
10089 install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_arg_cmd);
Josh Bailey165b5ff2011-07-20 20:43:22 -070010090 install_element (BGP_NODE, &bgp_maxpaths_ibgp_cmd);
10091 install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_cmd);
10092 install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_arg_cmd);
10093 install_element (BGP_IPV4_NODE, &bgp_maxpaths_ibgp_cmd);
10094 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_cmd);
10095 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_arg_cmd);
Ayan Banerjeeb8d1f712015-11-09 20:14:54 -050010096 install_element (BGP_IPV6_NODE, &bgp_maxpaths_ibgp_cmd);
10097 install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_ibgp_cmd);
10098 install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_ibgp_arg_cmd);
Josh Bailey165b5ff2011-07-20 20:43:22 -070010099
paul718e3742002-12-13 20:15:29 +000010100 /* "timers bgp" commands. */
10101 install_element (BGP_NODE, &bgp_timers_cmd);
10102 install_element (BGP_NODE, &no_bgp_timers_cmd);
10103 install_element (BGP_NODE, &no_bgp_timers_arg_cmd);
10104
10105 /* "bgp client-to-client reflection" commands */
10106 install_element (BGP_NODE, &no_bgp_client_to_client_reflection_cmd);
10107 install_element (BGP_NODE, &bgp_client_to_client_reflection_cmd);
10108
10109 /* "bgp always-compare-med" commands */
10110 install_element (BGP_NODE, &bgp_always_compare_med_cmd);
10111 install_element (BGP_NODE, &no_bgp_always_compare_med_cmd);
10112
10113 /* "bgp deterministic-med" commands */
10114 install_element (BGP_NODE, &bgp_deterministic_med_cmd);
10115 install_element (BGP_NODE, &no_bgp_deterministic_med_cmd);
hasso538621f2004-05-21 09:31:30 +000010116
hasso538621f2004-05-21 09:31:30 +000010117 /* "bgp graceful-restart" commands */
10118 install_element (BGP_NODE, &bgp_graceful_restart_cmd);
10119 install_element (BGP_NODE, &no_bgp_graceful_restart_cmd);
hasso93406d82005-02-02 14:40:33 +000010120 install_element (BGP_NODE, &bgp_graceful_restart_stalepath_time_cmd);
10121 install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_cmd);
10122 install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_val_cmd);
Philippe Guibert4afa3dd2016-05-24 16:52:02 +020010123 install_element (BGP_NODE, &bgp_graceful_restart_restart_time_cmd);
10124 install_element (BGP_NODE, &no_bgp_graceful_restart_restart_time_cmd);
10125 install_element (BGP_NODE, &no_bgp_graceful_restart_restart_time_val_cmd);
paul718e3742002-12-13 20:15:29 +000010126
10127 /* "bgp fast-external-failover" commands */
10128 install_element (BGP_NODE, &bgp_fast_external_failover_cmd);
10129 install_element (BGP_NODE, &no_bgp_fast_external_failover_cmd);
10130
10131 /* "bgp enforce-first-as" commands */
10132 install_element (BGP_NODE, &bgp_enforce_first_as_cmd);
10133 install_element (BGP_NODE, &no_bgp_enforce_first_as_cmd);
10134
10135 /* "bgp bestpath compare-routerid" commands */
10136 install_element (BGP_NODE, &bgp_bestpath_compare_router_id_cmd);
10137 install_element (BGP_NODE, &no_bgp_bestpath_compare_router_id_cmd);
10138
10139 /* "bgp bestpath as-path ignore" commands */
10140 install_element (BGP_NODE, &bgp_bestpath_aspath_ignore_cmd);
10141 install_element (BGP_NODE, &no_bgp_bestpath_aspath_ignore_cmd);
10142
hasso68118452005-04-08 15:40:36 +000010143 /* "bgp bestpath as-path confed" commands */
10144 install_element (BGP_NODE, &bgp_bestpath_aspath_confed_cmd);
10145 install_element (BGP_NODE, &no_bgp_bestpath_aspath_confed_cmd);
10146
Pradosh Mohapatra2fdd4552013-09-07 07:02:36 +000010147 /* "bgp bestpath as-path multipath-relax" commands */
10148 install_element (BGP_NODE, &bgp_bestpath_aspath_multipath_relax_cmd);
10149 install_element (BGP_NODE, &no_bgp_bestpath_aspath_multipath_relax_cmd);
10150
paul848973c2003-08-13 00:32:49 +000010151 /* "bgp log-neighbor-changes" commands */
10152 install_element (BGP_NODE, &bgp_log_neighbor_changes_cmd);
10153 install_element (BGP_NODE, &no_bgp_log_neighbor_changes_cmd);
10154
paul718e3742002-12-13 20:15:29 +000010155 /* "bgp bestpath med" commands */
10156 install_element (BGP_NODE, &bgp_bestpath_med_cmd);
10157 install_element (BGP_NODE, &bgp_bestpath_med2_cmd);
10158 install_element (BGP_NODE, &bgp_bestpath_med3_cmd);
10159 install_element (BGP_NODE, &no_bgp_bestpath_med_cmd);
10160 install_element (BGP_NODE, &no_bgp_bestpath_med2_cmd);
10161 install_element (BGP_NODE, &no_bgp_bestpath_med3_cmd);
10162
10163 /* "no bgp default ipv4-unicast" commands. */
10164 install_element (BGP_NODE, &no_bgp_default_ipv4_unicast_cmd);
10165 install_element (BGP_NODE, &bgp_default_ipv4_unicast_cmd);
10166
10167 /* "bgp network import-check" commands. */
10168 install_element (BGP_NODE, &bgp_network_import_check_cmd);
10169 install_element (BGP_NODE, &no_bgp_network_import_check_cmd);
10170
10171 /* "bgp default local-preference" commands. */
10172 install_element (BGP_NODE, &bgp_default_local_preference_cmd);
10173 install_element (BGP_NODE, &no_bgp_default_local_preference_cmd);
10174 install_element (BGP_NODE, &no_bgp_default_local_preference_val_cmd);
10175
Dinesh Dutt083e5e22015-11-09 20:21:54 -050010176 /* bgp ibgp-allow-policy-mods command */
10177 install_element (BGP_NODE, &bgp_rr_allow_outbound_policy_cmd);
10178 install_element (BGP_NODE, &no_bgp_rr_allow_outbound_policy_cmd);
10179
paul718e3742002-12-13 20:15:29 +000010180 /* "neighbor remote-as" commands. */
10181 install_element (BGP_NODE, &neighbor_remote_as_cmd);
10182 install_element (BGP_NODE, &no_neighbor_cmd);
10183 install_element (BGP_NODE, &no_neighbor_remote_as_cmd);
10184
10185 /* "neighbor peer-group" commands. */
10186 install_element (BGP_NODE, &neighbor_peer_group_cmd);
10187 install_element (BGP_NODE, &no_neighbor_peer_group_cmd);
10188 install_element (BGP_NODE, &no_neighbor_peer_group_remote_as_cmd);
10189
10190 /* "neighbor local-as" commands. */
10191 install_element (BGP_NODE, &neighbor_local_as_cmd);
10192 install_element (BGP_NODE, &neighbor_local_as_no_prepend_cmd);
Andrew Certain9d3f9702012-11-07 23:50:07 +000010193 install_element (BGP_NODE, &neighbor_local_as_no_prepend_replace_as_cmd);
paul718e3742002-12-13 20:15:29 +000010194 install_element (BGP_NODE, &no_neighbor_local_as_cmd);
10195 install_element (BGP_NODE, &no_neighbor_local_as_val_cmd);
10196 install_element (BGP_NODE, &no_neighbor_local_as_val2_cmd);
Andrew Certain9d3f9702012-11-07 23:50:07 +000010197 install_element (BGP_NODE, &no_neighbor_local_as_val3_cmd);
paul718e3742002-12-13 20:15:29 +000010198
Paul Jakma0df7c912008-07-21 21:02:49 +000010199 /* "neighbor password" commands. */
10200 install_element (BGP_NODE, &neighbor_password_cmd);
10201 install_element (BGP_NODE, &no_neighbor_password_cmd);
10202
paul718e3742002-12-13 20:15:29 +000010203 /* "neighbor activate" commands. */
10204 install_element (BGP_NODE, &neighbor_activate_cmd);
10205 install_element (BGP_IPV4_NODE, &neighbor_activate_cmd);
10206 install_element (BGP_IPV4M_NODE, &neighbor_activate_cmd);
10207 install_element (BGP_IPV6_NODE, &neighbor_activate_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010208 install_element (BGP_IPV6M_NODE, &neighbor_activate_cmd);
paul718e3742002-12-13 20:15:29 +000010209 install_element (BGP_VPNV4_NODE, &neighbor_activate_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010210 install_element (BGP_VPNV6_NODE, &neighbor_activate_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010211 install_element (BGP_ENCAP_NODE, &neighbor_activate_cmd);
10212 install_element (BGP_ENCAPV6_NODE, &neighbor_activate_cmd);
paul718e3742002-12-13 20:15:29 +000010213
10214 /* "no neighbor activate" commands. */
10215 install_element (BGP_NODE, &no_neighbor_activate_cmd);
10216 install_element (BGP_IPV4_NODE, &no_neighbor_activate_cmd);
10217 install_element (BGP_IPV4M_NODE, &no_neighbor_activate_cmd);
10218 install_element (BGP_IPV6_NODE, &no_neighbor_activate_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010219 install_element (BGP_IPV6M_NODE, &no_neighbor_activate_cmd);
paul718e3742002-12-13 20:15:29 +000010220 install_element (BGP_VPNV4_NODE, &no_neighbor_activate_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010221 install_element (BGP_VPNV6_NODE, &no_neighbor_activate_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010222 install_element (BGP_ENCAP_NODE, &no_neighbor_activate_cmd);
10223 install_element (BGP_ENCAPV6_NODE, &no_neighbor_activate_cmd);
paul718e3742002-12-13 20:15:29 +000010224
10225 /* "neighbor peer-group set" commands. */
10226 install_element (BGP_NODE, &neighbor_set_peer_group_cmd);
10227 install_element (BGP_IPV4_NODE, &neighbor_set_peer_group_cmd);
10228 install_element (BGP_IPV4M_NODE, &neighbor_set_peer_group_cmd);
10229 install_element (BGP_IPV6_NODE, &neighbor_set_peer_group_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010230 install_element (BGP_IPV6M_NODE, &neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +000010231 install_element (BGP_VPNV4_NODE, &neighbor_set_peer_group_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010232 install_element (BGP_VPNV6_NODE, &neighbor_set_peer_group_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010233 install_element (BGP_ENCAP_NODE, &neighbor_set_peer_group_cmd);
10234 install_element (BGP_ENCAPV6_NODE, &neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +000010235
paul718e3742002-12-13 20:15:29 +000010236 /* "no neighbor peer-group unset" commands. */
10237 install_element (BGP_NODE, &no_neighbor_set_peer_group_cmd);
10238 install_element (BGP_IPV4_NODE, &no_neighbor_set_peer_group_cmd);
10239 install_element (BGP_IPV4M_NODE, &no_neighbor_set_peer_group_cmd);
10240 install_element (BGP_IPV6_NODE, &no_neighbor_set_peer_group_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010241 install_element (BGP_IPV6M_NODE, &no_neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +000010242 install_element (BGP_VPNV4_NODE, &no_neighbor_set_peer_group_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010243 install_element (BGP_VPNV6_NODE, &no_neighbor_set_peer_group_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010244 install_element (BGP_ENCAP_NODE, &no_neighbor_set_peer_group_cmd);
10245 install_element (BGP_ENCAPV6_NODE, &no_neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +000010246
paul718e3742002-12-13 20:15:29 +000010247 /* "neighbor softreconfiguration inbound" commands.*/
10248 install_element (BGP_NODE, &neighbor_soft_reconfiguration_cmd);
10249 install_element (BGP_NODE, &no_neighbor_soft_reconfiguration_cmd);
10250 install_element (BGP_IPV4_NODE, &neighbor_soft_reconfiguration_cmd);
10251 install_element (BGP_IPV4_NODE, &no_neighbor_soft_reconfiguration_cmd);
10252 install_element (BGP_IPV4M_NODE, &neighbor_soft_reconfiguration_cmd);
10253 install_element (BGP_IPV4M_NODE, &no_neighbor_soft_reconfiguration_cmd);
10254 install_element (BGP_IPV6_NODE, &neighbor_soft_reconfiguration_cmd);
10255 install_element (BGP_IPV6_NODE, &no_neighbor_soft_reconfiguration_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010256 install_element (BGP_IPV6M_NODE, &neighbor_soft_reconfiguration_cmd);
10257 install_element (BGP_IPV6M_NODE, &no_neighbor_soft_reconfiguration_cmd);
paula58545b2003-07-12 21:43:01 +000010258 install_element (BGP_VPNV4_NODE, &neighbor_soft_reconfiguration_cmd);
10259 install_element (BGP_VPNV4_NODE, &no_neighbor_soft_reconfiguration_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010260 install_element (BGP_VPNV6_NODE, &neighbor_soft_reconfiguration_cmd);
10261 install_element (BGP_VPNV6_NODE, &no_neighbor_soft_reconfiguration_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010262 install_element (BGP_ENCAP_NODE, &neighbor_soft_reconfiguration_cmd);
10263 install_element (BGP_ENCAP_NODE, &no_neighbor_soft_reconfiguration_cmd);
10264 install_element (BGP_ENCAPV6_NODE, &neighbor_soft_reconfiguration_cmd);
10265 install_element (BGP_ENCAPV6_NODE, &no_neighbor_soft_reconfiguration_cmd);
paul718e3742002-12-13 20:15:29 +000010266
10267 /* "neighbor attribute-unchanged" commands. */
10268 install_element (BGP_NODE, &neighbor_attr_unchanged_cmd);
10269 install_element (BGP_NODE, &neighbor_attr_unchanged1_cmd);
10270 install_element (BGP_NODE, &neighbor_attr_unchanged2_cmd);
10271 install_element (BGP_NODE, &neighbor_attr_unchanged3_cmd);
10272 install_element (BGP_NODE, &neighbor_attr_unchanged4_cmd);
10273 install_element (BGP_NODE, &neighbor_attr_unchanged5_cmd);
10274 install_element (BGP_NODE, &neighbor_attr_unchanged6_cmd);
10275 install_element (BGP_NODE, &neighbor_attr_unchanged7_cmd);
10276 install_element (BGP_NODE, &neighbor_attr_unchanged8_cmd);
10277 install_element (BGP_NODE, &neighbor_attr_unchanged9_cmd);
10278 install_element (BGP_NODE, &neighbor_attr_unchanged10_cmd);
10279 install_element (BGP_NODE, &no_neighbor_attr_unchanged_cmd);
10280 install_element (BGP_NODE, &no_neighbor_attr_unchanged1_cmd);
10281 install_element (BGP_NODE, &no_neighbor_attr_unchanged2_cmd);
10282 install_element (BGP_NODE, &no_neighbor_attr_unchanged3_cmd);
10283 install_element (BGP_NODE, &no_neighbor_attr_unchanged4_cmd);
10284 install_element (BGP_NODE, &no_neighbor_attr_unchanged5_cmd);
10285 install_element (BGP_NODE, &no_neighbor_attr_unchanged6_cmd);
10286 install_element (BGP_NODE, &no_neighbor_attr_unchanged7_cmd);
10287 install_element (BGP_NODE, &no_neighbor_attr_unchanged8_cmd);
10288 install_element (BGP_NODE, &no_neighbor_attr_unchanged9_cmd);
10289 install_element (BGP_NODE, &no_neighbor_attr_unchanged10_cmd);
10290 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged_cmd);
10291 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged1_cmd);
10292 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged2_cmd);
10293 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged3_cmd);
10294 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged4_cmd);
10295 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged5_cmd);
10296 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged6_cmd);
10297 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged7_cmd);
10298 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged8_cmd);
10299 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged9_cmd);
10300 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged10_cmd);
10301 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged_cmd);
10302 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged1_cmd);
10303 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged2_cmd);
10304 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged3_cmd);
10305 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged4_cmd);
10306 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged5_cmd);
10307 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged6_cmd);
10308 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged7_cmd);
10309 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged8_cmd);
10310 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged9_cmd);
10311 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged10_cmd);
10312 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged_cmd);
10313 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged1_cmd);
10314 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged2_cmd);
10315 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged3_cmd);
10316 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged4_cmd);
10317 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged5_cmd);
10318 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged6_cmd);
10319 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged7_cmd);
10320 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged8_cmd);
10321 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged9_cmd);
10322 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged10_cmd);
10323 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged_cmd);
10324 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged1_cmd);
10325 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged2_cmd);
10326 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged3_cmd);
10327 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged4_cmd);
10328 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged5_cmd);
10329 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged6_cmd);
10330 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged7_cmd);
10331 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged8_cmd);
10332 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged9_cmd);
10333 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged10_cmd);
10334 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged_cmd);
10335 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged1_cmd);
10336 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged2_cmd);
10337 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged3_cmd);
10338 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged4_cmd);
10339 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged5_cmd);
10340 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged6_cmd);
10341 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged7_cmd);
10342 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged8_cmd);
10343 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged9_cmd);
10344 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged10_cmd);
10345 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged_cmd);
10346 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged1_cmd);
10347 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged2_cmd);
10348 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged3_cmd);
10349 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged4_cmd);
10350 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged5_cmd);
10351 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged6_cmd);
10352 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged7_cmd);
10353 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged8_cmd);
10354 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged9_cmd);
10355 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged10_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010356 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged_cmd);
10357 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged1_cmd);
10358 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged2_cmd);
10359 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged3_cmd);
10360 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged4_cmd);
10361 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged5_cmd);
10362 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged6_cmd);
10363 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged7_cmd);
10364 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged8_cmd);
10365 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged9_cmd);
10366 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged10_cmd);
10367 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged_cmd);
10368 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged1_cmd);
10369 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged2_cmd);
10370 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged3_cmd);
10371 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged4_cmd);
10372 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged5_cmd);
10373 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged6_cmd);
10374 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged7_cmd);
10375 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged8_cmd);
10376 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged9_cmd);
10377 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged10_cmd);
paul718e3742002-12-13 20:15:29 +000010378 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged_cmd);
10379 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged1_cmd);
10380 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged2_cmd);
10381 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged3_cmd);
10382 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged4_cmd);
10383 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged5_cmd);
10384 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged6_cmd);
10385 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged7_cmd);
10386 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged8_cmd);
10387 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged9_cmd);
10388 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged10_cmd);
10389 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged_cmd);
10390 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged1_cmd);
10391 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged2_cmd);
10392 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged3_cmd);
10393 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged4_cmd);
10394 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged5_cmd);
10395 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged6_cmd);
10396 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged7_cmd);
10397 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged8_cmd);
10398 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged9_cmd);
10399 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged10_cmd);
10400
Lou Berger13c378d2016-01-12 13:41:56 -050010401 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged_cmd);
10402 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged1_cmd);
10403 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged2_cmd);
10404 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged3_cmd);
10405 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged4_cmd);
10406 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged5_cmd);
10407 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged6_cmd);
10408 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged7_cmd);
10409 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged8_cmd);
10410 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged9_cmd);
10411 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged10_cmd);
10412 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged_cmd);
10413 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged1_cmd);
10414 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged2_cmd);
10415 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged3_cmd);
10416 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged4_cmd);
10417 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged5_cmd);
10418 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged6_cmd);
10419 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged7_cmd);
10420 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged8_cmd);
10421 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged9_cmd);
10422 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged10_cmd);
10423
Lou Bergera3fda882016-01-12 13:42:04 -050010424 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged_cmd);
10425 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged1_cmd);
10426 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged2_cmd);
10427 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged3_cmd);
10428 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged4_cmd);
10429 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged5_cmd);
10430 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged6_cmd);
10431 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged7_cmd);
10432 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged8_cmd);
10433 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged9_cmd);
10434 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged10_cmd);
10435 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged_cmd);
10436 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged1_cmd);
10437 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged2_cmd);
10438 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged3_cmd);
10439 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged4_cmd);
10440 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged5_cmd);
10441 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged6_cmd);
10442 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged7_cmd);
10443 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged8_cmd);
10444 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged9_cmd);
10445 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged10_cmd);
10446
10447 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged_cmd);
10448 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged1_cmd);
10449 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged2_cmd);
10450 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged3_cmd);
10451 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged4_cmd);
10452 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged5_cmd);
10453 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged6_cmd);
10454 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged7_cmd);
10455 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged8_cmd);
10456 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged9_cmd);
10457 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged10_cmd);
10458 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged_cmd);
10459 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged1_cmd);
10460 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged2_cmd);
10461 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged3_cmd);
10462 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged4_cmd);
10463 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged5_cmd);
10464 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged6_cmd);
10465 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged7_cmd);
10466 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged8_cmd);
10467 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged9_cmd);
10468 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged10_cmd);
10469
paulfee0f4c2004-09-13 05:12:46 +000010470 /* "nexthop-local unchanged" commands */
10471 install_element (BGP_IPV6_NODE, &neighbor_nexthop_local_unchanged_cmd);
10472 install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_local_unchanged_cmd);
10473
paul718e3742002-12-13 20:15:29 +000010474 /* "transparent-as" and "transparent-nexthop" for old version
10475 compatibility. */
10476 install_element (BGP_NODE, &neighbor_transparent_as_cmd);
10477 install_element (BGP_NODE, &neighbor_transparent_nexthop_cmd);
10478
10479 /* "neighbor next-hop-self" commands. */
10480 install_element (BGP_NODE, &neighbor_nexthop_self_cmd);
10481 install_element (BGP_NODE, &no_neighbor_nexthop_self_cmd);
10482 install_element (BGP_IPV4_NODE, &neighbor_nexthop_self_cmd);
10483 install_element (BGP_IPV4_NODE, &no_neighbor_nexthop_self_cmd);
10484 install_element (BGP_IPV4M_NODE, &neighbor_nexthop_self_cmd);
10485 install_element (BGP_IPV4M_NODE, &no_neighbor_nexthop_self_cmd);
10486 install_element (BGP_IPV6_NODE, &neighbor_nexthop_self_cmd);
10487 install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_self_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010488 install_element (BGP_IPV6M_NODE, &neighbor_nexthop_self_cmd);
10489 install_element (BGP_IPV6M_NODE, &no_neighbor_nexthop_self_cmd);
paul718e3742002-12-13 20:15:29 +000010490 install_element (BGP_VPNV4_NODE, &neighbor_nexthop_self_cmd);
10491 install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010492 install_element (BGP_VPNV6_NODE, &neighbor_nexthop_self_cmd);
10493 install_element (BGP_VPNV6_NODE, &no_neighbor_nexthop_self_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010494 install_element (BGP_ENCAP_NODE, &neighbor_nexthop_self_cmd);
10495 install_element (BGP_ENCAP_NODE, &no_neighbor_nexthop_self_cmd);
10496 install_element (BGP_ENCAPV6_NODE, &neighbor_nexthop_self_cmd);
10497 install_element (BGP_ENCAPV6_NODE, &no_neighbor_nexthop_self_cmd);
paul718e3742002-12-13 20:15:29 +000010498
10499 /* "neighbor remove-private-AS" commands. */
10500 install_element (BGP_NODE, &neighbor_remove_private_as_cmd);
10501 install_element (BGP_NODE, &no_neighbor_remove_private_as_cmd);
10502 install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_cmd);
10503 install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_cmd);
10504 install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_cmd);
10505 install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_cmd);
10506 install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_cmd);
10507 install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010508 install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_cmd);
10509 install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_cmd);
paul718e3742002-12-13 20:15:29 +000010510 install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_cmd);
10511 install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010512 install_element (BGP_VPNV6_NODE, &neighbor_remove_private_as_cmd);
10513 install_element (BGP_VPNV6_NODE, &no_neighbor_remove_private_as_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010514 install_element (BGP_ENCAP_NODE, &neighbor_remove_private_as_cmd);
10515 install_element (BGP_ENCAP_NODE, &no_neighbor_remove_private_as_cmd);
10516 install_element (BGP_ENCAPV6_NODE, &neighbor_remove_private_as_cmd);
10517 install_element (BGP_ENCAPV6_NODE, &no_neighbor_remove_private_as_cmd);
paul718e3742002-12-13 20:15:29 +000010518
10519 /* "neighbor send-community" commands.*/
10520 install_element (BGP_NODE, &neighbor_send_community_cmd);
10521 install_element (BGP_NODE, &neighbor_send_community_type_cmd);
10522 install_element (BGP_NODE, &no_neighbor_send_community_cmd);
10523 install_element (BGP_NODE, &no_neighbor_send_community_type_cmd);
10524 install_element (BGP_IPV4_NODE, &neighbor_send_community_cmd);
10525 install_element (BGP_IPV4_NODE, &neighbor_send_community_type_cmd);
10526 install_element (BGP_IPV4_NODE, &no_neighbor_send_community_cmd);
10527 install_element (BGP_IPV4_NODE, &no_neighbor_send_community_type_cmd);
10528 install_element (BGP_IPV4M_NODE, &neighbor_send_community_cmd);
10529 install_element (BGP_IPV4M_NODE, &neighbor_send_community_type_cmd);
10530 install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_cmd);
10531 install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_type_cmd);
10532 install_element (BGP_IPV6_NODE, &neighbor_send_community_cmd);
10533 install_element (BGP_IPV6_NODE, &neighbor_send_community_type_cmd);
10534 install_element (BGP_IPV6_NODE, &no_neighbor_send_community_cmd);
10535 install_element (BGP_IPV6_NODE, &no_neighbor_send_community_type_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010536 install_element (BGP_IPV6M_NODE, &neighbor_send_community_cmd);
10537 install_element (BGP_IPV6M_NODE, &neighbor_send_community_type_cmd);
10538 install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_cmd);
10539 install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_type_cmd);
paul718e3742002-12-13 20:15:29 +000010540 install_element (BGP_VPNV4_NODE, &neighbor_send_community_cmd);
10541 install_element (BGP_VPNV4_NODE, &neighbor_send_community_type_cmd);
10542 install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_cmd);
10543 install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_type_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010544 install_element (BGP_VPNV6_NODE, &neighbor_send_community_cmd);
10545 install_element (BGP_VPNV6_NODE, &neighbor_send_community_type_cmd);
10546 install_element (BGP_VPNV6_NODE, &no_neighbor_send_community_cmd);
10547 install_element (BGP_VPNV6_NODE, &no_neighbor_send_community_type_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010548 install_element (BGP_ENCAP_NODE, &neighbor_send_community_cmd);
10549 install_element (BGP_ENCAP_NODE, &neighbor_send_community_type_cmd);
10550 install_element (BGP_ENCAP_NODE, &no_neighbor_send_community_cmd);
10551 install_element (BGP_ENCAP_NODE, &no_neighbor_send_community_type_cmd);
10552 install_element (BGP_ENCAPV6_NODE, &neighbor_send_community_cmd);
10553 install_element (BGP_ENCAPV6_NODE, &neighbor_send_community_type_cmd);
10554 install_element (BGP_ENCAPV6_NODE, &no_neighbor_send_community_cmd);
10555 install_element (BGP_ENCAPV6_NODE, &no_neighbor_send_community_type_cmd);
paul718e3742002-12-13 20:15:29 +000010556
10557 /* "neighbor route-reflector" commands.*/
10558 install_element (BGP_NODE, &neighbor_route_reflector_client_cmd);
10559 install_element (BGP_NODE, &no_neighbor_route_reflector_client_cmd);
10560 install_element (BGP_IPV4_NODE, &neighbor_route_reflector_client_cmd);
10561 install_element (BGP_IPV4_NODE, &no_neighbor_route_reflector_client_cmd);
10562 install_element (BGP_IPV4M_NODE, &neighbor_route_reflector_client_cmd);
10563 install_element (BGP_IPV4M_NODE, &no_neighbor_route_reflector_client_cmd);
10564 install_element (BGP_IPV6_NODE, &neighbor_route_reflector_client_cmd);
10565 install_element (BGP_IPV6_NODE, &no_neighbor_route_reflector_client_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010566 install_element (BGP_IPV6M_NODE, &neighbor_route_reflector_client_cmd);
10567 install_element (BGP_IPV6M_NODE, &no_neighbor_route_reflector_client_cmd);
paul718e3742002-12-13 20:15:29 +000010568 install_element (BGP_VPNV4_NODE, &neighbor_route_reflector_client_cmd);
10569 install_element (BGP_VPNV4_NODE, &no_neighbor_route_reflector_client_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010570 install_element (BGP_VPNV6_NODE, &neighbor_route_reflector_client_cmd);
10571 install_element (BGP_VPNV6_NODE, &no_neighbor_route_reflector_client_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010572 install_element (BGP_ENCAP_NODE, &neighbor_route_reflector_client_cmd);
10573 install_element (BGP_ENCAP_NODE, &no_neighbor_route_reflector_client_cmd);
10574 install_element (BGP_ENCAPV6_NODE, &neighbor_route_reflector_client_cmd);
10575 install_element (BGP_ENCAPV6_NODE, &no_neighbor_route_reflector_client_cmd);
paul718e3742002-12-13 20:15:29 +000010576
10577 /* "neighbor route-server" commands.*/
10578 install_element (BGP_NODE, &neighbor_route_server_client_cmd);
10579 install_element (BGP_NODE, &no_neighbor_route_server_client_cmd);
10580 install_element (BGP_IPV4_NODE, &neighbor_route_server_client_cmd);
10581 install_element (BGP_IPV4_NODE, &no_neighbor_route_server_client_cmd);
10582 install_element (BGP_IPV4M_NODE, &neighbor_route_server_client_cmd);
10583 install_element (BGP_IPV4M_NODE, &no_neighbor_route_server_client_cmd);
10584 install_element (BGP_IPV6_NODE, &neighbor_route_server_client_cmd);
10585 install_element (BGP_IPV6_NODE, &no_neighbor_route_server_client_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010586 install_element (BGP_IPV6M_NODE, &neighbor_route_server_client_cmd);
10587 install_element (BGP_IPV6M_NODE, &no_neighbor_route_server_client_cmd);
paul718e3742002-12-13 20:15:29 +000010588 install_element (BGP_VPNV4_NODE, &neighbor_route_server_client_cmd);
10589 install_element (BGP_VPNV4_NODE, &no_neighbor_route_server_client_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010590 install_element (BGP_VPNV6_NODE, &neighbor_route_server_client_cmd);
10591 install_element (BGP_VPNV6_NODE, &no_neighbor_route_server_client_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010592 install_element (BGP_ENCAP_NODE, &neighbor_route_server_client_cmd);
10593 install_element (BGP_ENCAP_NODE, &no_neighbor_route_server_client_cmd);
10594 install_element (BGP_ENCAPV6_NODE, &neighbor_route_server_client_cmd);
10595 install_element (BGP_ENCAPV6_NODE, &no_neighbor_route_server_client_cmd);
paul718e3742002-12-13 20:15:29 +000010596
10597 /* "neighbor passive" commands. */
10598 install_element (BGP_NODE, &neighbor_passive_cmd);
10599 install_element (BGP_NODE, &no_neighbor_passive_cmd);
10600
10601 /* "neighbor shutdown" commands. */
10602 install_element (BGP_NODE, &neighbor_shutdown_cmd);
10603 install_element (BGP_NODE, &no_neighbor_shutdown_cmd);
10604
hassoc9502432005-02-01 22:01:48 +000010605 /* Deprecated "neighbor capability route-refresh" commands.*/
paul718e3742002-12-13 20:15:29 +000010606 install_element (BGP_NODE, &neighbor_capability_route_refresh_cmd);
10607 install_element (BGP_NODE, &no_neighbor_capability_route_refresh_cmd);
10608
10609 /* "neighbor capability orf prefix-list" commands.*/
10610 install_element (BGP_NODE, &neighbor_capability_orf_prefix_cmd);
10611 install_element (BGP_NODE, &no_neighbor_capability_orf_prefix_cmd);
10612 install_element (BGP_IPV4_NODE, &neighbor_capability_orf_prefix_cmd);
10613 install_element (BGP_IPV4_NODE, &no_neighbor_capability_orf_prefix_cmd);
10614 install_element (BGP_IPV4M_NODE, &neighbor_capability_orf_prefix_cmd);
10615 install_element (BGP_IPV4M_NODE, &no_neighbor_capability_orf_prefix_cmd);
10616 install_element (BGP_IPV6_NODE, &neighbor_capability_orf_prefix_cmd);
10617 install_element (BGP_IPV6_NODE, &no_neighbor_capability_orf_prefix_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010618 install_element (BGP_IPV6M_NODE, &neighbor_capability_orf_prefix_cmd);
10619 install_element (BGP_IPV6M_NODE, &no_neighbor_capability_orf_prefix_cmd);
paul718e3742002-12-13 20:15:29 +000010620
10621 /* "neighbor capability dynamic" commands.*/
10622 install_element (BGP_NODE, &neighbor_capability_dynamic_cmd);
10623 install_element (BGP_NODE, &no_neighbor_capability_dynamic_cmd);
10624
10625 /* "neighbor dont-capability-negotiate" commands. */
10626 install_element (BGP_NODE, &neighbor_dont_capability_negotiate_cmd);
10627 install_element (BGP_NODE, &no_neighbor_dont_capability_negotiate_cmd);
10628
10629 /* "neighbor ebgp-multihop" commands. */
10630 install_element (BGP_NODE, &neighbor_ebgp_multihop_cmd);
10631 install_element (BGP_NODE, &neighbor_ebgp_multihop_ttl_cmd);
10632 install_element (BGP_NODE, &no_neighbor_ebgp_multihop_cmd);
10633 install_element (BGP_NODE, &no_neighbor_ebgp_multihop_ttl_cmd);
10634
hasso6ffd2072005-02-02 14:50:11 +000010635 /* "neighbor disable-connected-check" commands. */
10636 install_element (BGP_NODE, &neighbor_disable_connected_check_cmd);
10637 install_element (BGP_NODE, &no_neighbor_disable_connected_check_cmd);
paul718e3742002-12-13 20:15:29 +000010638 install_element (BGP_NODE, &neighbor_enforce_multihop_cmd);
10639 install_element (BGP_NODE, &no_neighbor_enforce_multihop_cmd);
10640
10641 /* "neighbor description" commands. */
10642 install_element (BGP_NODE, &neighbor_description_cmd);
10643 install_element (BGP_NODE, &no_neighbor_description_cmd);
10644 install_element (BGP_NODE, &no_neighbor_description_val_cmd);
10645
10646 /* "neighbor update-source" commands. "*/
10647 install_element (BGP_NODE, &neighbor_update_source_cmd);
10648 install_element (BGP_NODE, &no_neighbor_update_source_cmd);
10649
10650 /* "neighbor default-originate" commands. */
10651 install_element (BGP_NODE, &neighbor_default_originate_cmd);
10652 install_element (BGP_NODE, &neighbor_default_originate_rmap_cmd);
10653 install_element (BGP_NODE, &no_neighbor_default_originate_cmd);
10654 install_element (BGP_NODE, &no_neighbor_default_originate_rmap_cmd);
10655 install_element (BGP_IPV4_NODE, &neighbor_default_originate_cmd);
10656 install_element (BGP_IPV4_NODE, &neighbor_default_originate_rmap_cmd);
10657 install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_cmd);
10658 install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_rmap_cmd);
10659 install_element (BGP_IPV4M_NODE, &neighbor_default_originate_cmd);
10660 install_element (BGP_IPV4M_NODE, &neighbor_default_originate_rmap_cmd);
10661 install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_cmd);
10662 install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_rmap_cmd);
10663 install_element (BGP_IPV6_NODE, &neighbor_default_originate_cmd);
10664 install_element (BGP_IPV6_NODE, &neighbor_default_originate_rmap_cmd);
10665 install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_cmd);
10666 install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_rmap_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010667 install_element (BGP_IPV6M_NODE, &neighbor_default_originate_cmd);
10668 install_element (BGP_IPV6M_NODE, &neighbor_default_originate_rmap_cmd);
10669 install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_cmd);
10670 install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_rmap_cmd);
paul718e3742002-12-13 20:15:29 +000010671
10672 /* "neighbor port" commands. */
10673 install_element (BGP_NODE, &neighbor_port_cmd);
10674 install_element (BGP_NODE, &no_neighbor_port_cmd);
10675 install_element (BGP_NODE, &no_neighbor_port_val_cmd);
10676
10677 /* "neighbor weight" commands. */
10678 install_element (BGP_NODE, &neighbor_weight_cmd);
10679 install_element (BGP_NODE, &no_neighbor_weight_cmd);
10680 install_element (BGP_NODE, &no_neighbor_weight_val_cmd);
10681
10682 /* "neighbor override-capability" commands. */
10683 install_element (BGP_NODE, &neighbor_override_capability_cmd);
10684 install_element (BGP_NODE, &no_neighbor_override_capability_cmd);
10685
10686 /* "neighbor strict-capability-match" commands. */
10687 install_element (BGP_NODE, &neighbor_strict_capability_cmd);
10688 install_element (BGP_NODE, &no_neighbor_strict_capability_cmd);
10689
10690 /* "neighbor timers" commands. */
10691 install_element (BGP_NODE, &neighbor_timers_cmd);
10692 install_element (BGP_NODE, &no_neighbor_timers_cmd);
10693
10694 /* "neighbor timers connect" commands. */
10695 install_element (BGP_NODE, &neighbor_timers_connect_cmd);
10696 install_element (BGP_NODE, &no_neighbor_timers_connect_cmd);
10697 install_element (BGP_NODE, &no_neighbor_timers_connect_val_cmd);
10698
10699 /* "neighbor advertisement-interval" commands. */
10700 install_element (BGP_NODE, &neighbor_advertise_interval_cmd);
10701 install_element (BGP_NODE, &no_neighbor_advertise_interval_cmd);
10702 install_element (BGP_NODE, &no_neighbor_advertise_interval_val_cmd);
10703
10704 /* "neighbor version" commands. */
10705 install_element (BGP_NODE, &neighbor_version_cmd);
paul718e3742002-12-13 20:15:29 +000010706
10707 /* "neighbor interface" commands. */
10708 install_element (BGP_NODE, &neighbor_interface_cmd);
10709 install_element (BGP_NODE, &no_neighbor_interface_cmd);
10710
10711 /* "neighbor distribute" commands. */
10712 install_element (BGP_NODE, &neighbor_distribute_list_cmd);
10713 install_element (BGP_NODE, &no_neighbor_distribute_list_cmd);
10714 install_element (BGP_IPV4_NODE, &neighbor_distribute_list_cmd);
10715 install_element (BGP_IPV4_NODE, &no_neighbor_distribute_list_cmd);
10716 install_element (BGP_IPV4M_NODE, &neighbor_distribute_list_cmd);
10717 install_element (BGP_IPV4M_NODE, &no_neighbor_distribute_list_cmd);
10718 install_element (BGP_IPV6_NODE, &neighbor_distribute_list_cmd);
10719 install_element (BGP_IPV6_NODE, &no_neighbor_distribute_list_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010720 install_element (BGP_IPV6M_NODE, &neighbor_distribute_list_cmd);
10721 install_element (BGP_IPV6M_NODE, &no_neighbor_distribute_list_cmd);
paul718e3742002-12-13 20:15:29 +000010722 install_element (BGP_VPNV4_NODE, &neighbor_distribute_list_cmd);
10723 install_element (BGP_VPNV4_NODE, &no_neighbor_distribute_list_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010724 install_element (BGP_VPNV6_NODE, &neighbor_distribute_list_cmd);
10725 install_element (BGP_VPNV6_NODE, &no_neighbor_distribute_list_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010726 install_element (BGP_ENCAP_NODE, &neighbor_distribute_list_cmd);
10727 install_element (BGP_ENCAP_NODE, &no_neighbor_distribute_list_cmd);
10728 install_element (BGP_ENCAPV6_NODE, &neighbor_distribute_list_cmd);
10729 install_element (BGP_ENCAPV6_NODE, &no_neighbor_distribute_list_cmd);
paul718e3742002-12-13 20:15:29 +000010730
10731 /* "neighbor prefix-list" commands. */
10732 install_element (BGP_NODE, &neighbor_prefix_list_cmd);
10733 install_element (BGP_NODE, &no_neighbor_prefix_list_cmd);
10734 install_element (BGP_IPV4_NODE, &neighbor_prefix_list_cmd);
10735 install_element (BGP_IPV4_NODE, &no_neighbor_prefix_list_cmd);
10736 install_element (BGP_IPV4M_NODE, &neighbor_prefix_list_cmd);
10737 install_element (BGP_IPV4M_NODE, &no_neighbor_prefix_list_cmd);
10738 install_element (BGP_IPV6_NODE, &neighbor_prefix_list_cmd);
10739 install_element (BGP_IPV6_NODE, &no_neighbor_prefix_list_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010740 install_element (BGP_IPV6M_NODE, &neighbor_prefix_list_cmd);
10741 install_element (BGP_IPV6M_NODE, &no_neighbor_prefix_list_cmd);
paul718e3742002-12-13 20:15:29 +000010742 install_element (BGP_VPNV4_NODE, &neighbor_prefix_list_cmd);
10743 install_element (BGP_VPNV4_NODE, &no_neighbor_prefix_list_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010744 install_element (BGP_VPNV6_NODE, &neighbor_prefix_list_cmd);
10745 install_element (BGP_VPNV6_NODE, &no_neighbor_prefix_list_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010746 install_element (BGP_ENCAP_NODE, &neighbor_prefix_list_cmd);
10747 install_element (BGP_ENCAP_NODE, &no_neighbor_prefix_list_cmd);
10748 install_element (BGP_ENCAPV6_NODE, &neighbor_prefix_list_cmd);
10749 install_element (BGP_ENCAPV6_NODE, &no_neighbor_prefix_list_cmd);
paul718e3742002-12-13 20:15:29 +000010750
10751 /* "neighbor filter-list" commands. */
10752 install_element (BGP_NODE, &neighbor_filter_list_cmd);
10753 install_element (BGP_NODE, &no_neighbor_filter_list_cmd);
10754 install_element (BGP_IPV4_NODE, &neighbor_filter_list_cmd);
10755 install_element (BGP_IPV4_NODE, &no_neighbor_filter_list_cmd);
10756 install_element (BGP_IPV4M_NODE, &neighbor_filter_list_cmd);
10757 install_element (BGP_IPV4M_NODE, &no_neighbor_filter_list_cmd);
10758 install_element (BGP_IPV6_NODE, &neighbor_filter_list_cmd);
10759 install_element (BGP_IPV6_NODE, &no_neighbor_filter_list_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010760 install_element (BGP_IPV6M_NODE, &neighbor_filter_list_cmd);
10761 install_element (BGP_IPV6M_NODE, &no_neighbor_filter_list_cmd);
paul718e3742002-12-13 20:15:29 +000010762 install_element (BGP_VPNV4_NODE, &neighbor_filter_list_cmd);
10763 install_element (BGP_VPNV4_NODE, &no_neighbor_filter_list_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010764 install_element (BGP_VPNV6_NODE, &neighbor_filter_list_cmd);
10765 install_element (BGP_VPNV6_NODE, &no_neighbor_filter_list_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010766 install_element (BGP_ENCAP_NODE, &neighbor_filter_list_cmd);
10767 install_element (BGP_ENCAP_NODE, &no_neighbor_filter_list_cmd);
10768 install_element (BGP_ENCAPV6_NODE, &neighbor_filter_list_cmd);
10769 install_element (BGP_ENCAPV6_NODE, &no_neighbor_filter_list_cmd);
paul718e3742002-12-13 20:15:29 +000010770
10771 /* "neighbor route-map" commands. */
10772 install_element (BGP_NODE, &neighbor_route_map_cmd);
10773 install_element (BGP_NODE, &no_neighbor_route_map_cmd);
10774 install_element (BGP_IPV4_NODE, &neighbor_route_map_cmd);
10775 install_element (BGP_IPV4_NODE, &no_neighbor_route_map_cmd);
10776 install_element (BGP_IPV4M_NODE, &neighbor_route_map_cmd);
10777 install_element (BGP_IPV4M_NODE, &no_neighbor_route_map_cmd);
10778 install_element (BGP_IPV6_NODE, &neighbor_route_map_cmd);
10779 install_element (BGP_IPV6_NODE, &no_neighbor_route_map_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010780 install_element (BGP_IPV6M_NODE, &neighbor_route_map_cmd);
10781 install_element (BGP_IPV6M_NODE, &no_neighbor_route_map_cmd);
paul718e3742002-12-13 20:15:29 +000010782 install_element (BGP_VPNV4_NODE, &neighbor_route_map_cmd);
10783 install_element (BGP_VPNV4_NODE, &no_neighbor_route_map_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010784 install_element (BGP_VPNV6_NODE, &neighbor_route_map_cmd);
10785 install_element (BGP_VPNV6_NODE, &no_neighbor_route_map_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010786 install_element (BGP_ENCAP_NODE, &neighbor_route_map_cmd);
10787 install_element (BGP_ENCAP_NODE, &no_neighbor_route_map_cmd);
10788 install_element (BGP_ENCAPV6_NODE, &neighbor_route_map_cmd);
10789 install_element (BGP_ENCAPV6_NODE, &no_neighbor_route_map_cmd);
paul718e3742002-12-13 20:15:29 +000010790
10791 /* "neighbor unsuppress-map" commands. */
10792 install_element (BGP_NODE, &neighbor_unsuppress_map_cmd);
10793 install_element (BGP_NODE, &no_neighbor_unsuppress_map_cmd);
10794 install_element (BGP_IPV4_NODE, &neighbor_unsuppress_map_cmd);
10795 install_element (BGP_IPV4_NODE, &no_neighbor_unsuppress_map_cmd);
10796 install_element (BGP_IPV4M_NODE, &neighbor_unsuppress_map_cmd);
10797 install_element (BGP_IPV4M_NODE, &no_neighbor_unsuppress_map_cmd);
10798 install_element (BGP_IPV6_NODE, &neighbor_unsuppress_map_cmd);
10799 install_element (BGP_IPV6_NODE, &no_neighbor_unsuppress_map_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010800 install_element (BGP_IPV6M_NODE, &neighbor_unsuppress_map_cmd);
10801 install_element (BGP_IPV6M_NODE, &no_neighbor_unsuppress_map_cmd);
paula58545b2003-07-12 21:43:01 +000010802 install_element (BGP_VPNV4_NODE, &neighbor_unsuppress_map_cmd);
Lou Berger82dd7072016-01-12 13:41:57 -050010803 install_element (BGP_VPNV4_NODE, &no_neighbor_unsuppress_map_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010804 install_element (BGP_VPNV6_NODE, &neighbor_unsuppress_map_cmd);
Lou Berger82dd7072016-01-12 13:41:57 -050010805 install_element (BGP_VPNV6_NODE, &no_neighbor_unsuppress_map_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010806 install_element (BGP_ENCAP_NODE, &neighbor_unsuppress_map_cmd);
10807 install_element (BGP_ENCAP_NODE, &no_neighbor_unsuppress_map_cmd);
10808 install_element (BGP_ENCAPV6_NODE, &neighbor_unsuppress_map_cmd);
10809 install_element (BGP_ENCAPV6_NODE, &no_neighbor_unsuppress_map_cmd);
paul718e3742002-12-13 20:15:29 +000010810
10811 /* "neighbor maximum-prefix" commands. */
10812 install_element (BGP_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +000010813 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +000010814 install_element (BGP_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +000010815 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +000010816 install_element (BGP_NODE, &neighbor_maximum_prefix_restart_cmd);
10817 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010818 install_element (BGP_NODE, &no_neighbor_maximum_prefix_cmd);
10819 install_element (BGP_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +000010820 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10821 install_element (BGP_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10822 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10823 install_element (BGP_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10824 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010825 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +000010826 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +000010827 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +000010828 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +000010829 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_restart_cmd);
10830 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010831 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_cmd);
10832 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +000010833 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10834 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10835 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10836 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10837 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010838 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +000010839 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +000010840 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +000010841 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +000010842 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_restart_cmd);
10843 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010844 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_cmd);
10845 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +000010846 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10847 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10848 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10849 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10850 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010851 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +000010852 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +000010853 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +000010854 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +000010855 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_restart_cmd);
10856 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010857 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_cmd);
10858 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +000010859 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10860 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10861 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10862 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10863 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010864 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_cmd);
10865 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_cmd);
10866 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_warning_cmd);
10867 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
10868 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_restart_cmd);
10869 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
10870 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_cmd);
10871 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_val_cmd);
10872 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10873 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10874 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10875 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10876 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010877 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +000010878 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +000010879 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +000010880 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +000010881 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_restart_cmd);
10882 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010883 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_cmd);
10884 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +000010885 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10886 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10887 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10888 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10889 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010890
Lou Berger13c378d2016-01-12 13:41:56 -050010891 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_cmd);
10892 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_threshold_cmd);
10893 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_warning_cmd);
10894 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
10895 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_restart_cmd);
10896 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
10897 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_cmd);
10898 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_val_cmd);
10899 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10900 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10901 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10902 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10903 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
10904
Lou Bergera3fda882016-01-12 13:42:04 -050010905 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_cmd);
10906 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_threshold_cmd);
10907 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_warning_cmd);
10908 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
10909 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_restart_cmd);
10910 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
10911 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_cmd);
10912 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_val_cmd);
10913 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10914 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10915 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10916 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10917 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
10918
10919 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_cmd);
10920 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_threshold_cmd);
10921 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_warning_cmd);
10922 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
10923 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_restart_cmd);
10924 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
10925 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_cmd);
10926 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_val_cmd);
10927 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10928 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10929 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10930 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10931 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
10932
paul718e3742002-12-13 20:15:29 +000010933 /* "neighbor allowas-in" */
10934 install_element (BGP_NODE, &neighbor_allowas_in_cmd);
10935 install_element (BGP_NODE, &neighbor_allowas_in_arg_cmd);
10936 install_element (BGP_NODE, &no_neighbor_allowas_in_cmd);
10937 install_element (BGP_IPV4_NODE, &neighbor_allowas_in_cmd);
10938 install_element (BGP_IPV4_NODE, &neighbor_allowas_in_arg_cmd);
10939 install_element (BGP_IPV4_NODE, &no_neighbor_allowas_in_cmd);
10940 install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_cmd);
10941 install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_arg_cmd);
10942 install_element (BGP_IPV4M_NODE, &no_neighbor_allowas_in_cmd);
10943 install_element (BGP_IPV6_NODE, &neighbor_allowas_in_cmd);
10944 install_element (BGP_IPV6_NODE, &neighbor_allowas_in_arg_cmd);
10945 install_element (BGP_IPV6_NODE, &no_neighbor_allowas_in_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010946 install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_cmd);
10947 install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_arg_cmd);
10948 install_element (BGP_IPV6M_NODE, &no_neighbor_allowas_in_cmd);
paul718e3742002-12-13 20:15:29 +000010949 install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_cmd);
10950 install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_arg_cmd);
10951 install_element (BGP_VPNV4_NODE, &no_neighbor_allowas_in_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010952 install_element (BGP_VPNV6_NODE, &neighbor_allowas_in_cmd);
10953 install_element (BGP_VPNV6_NODE, &neighbor_allowas_in_arg_cmd);
10954 install_element (BGP_VPNV6_NODE, &no_neighbor_allowas_in_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010955 install_element (BGP_ENCAP_NODE, &neighbor_allowas_in_cmd);
10956 install_element (BGP_ENCAP_NODE, &neighbor_allowas_in_arg_cmd);
10957 install_element (BGP_ENCAP_NODE, &no_neighbor_allowas_in_cmd);
10958 install_element (BGP_ENCAPV6_NODE, &neighbor_allowas_in_cmd);
10959 install_element (BGP_ENCAPV6_NODE, &neighbor_allowas_in_arg_cmd);
10960 install_element (BGP_ENCAPV6_NODE, &no_neighbor_allowas_in_cmd);
paul718e3742002-12-13 20:15:29 +000010961
10962 /* address-family commands. */
10963 install_element (BGP_NODE, &address_family_ipv4_cmd);
10964 install_element (BGP_NODE, &address_family_ipv4_safi_cmd);
paul718e3742002-12-13 20:15:29 +000010965 install_element (BGP_NODE, &address_family_ipv6_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010966 install_element (BGP_NODE, &address_family_ipv6_safi_cmd);
paul718e3742002-12-13 20:15:29 +000010967 install_element (BGP_NODE, &address_family_vpnv4_cmd);
10968 install_element (BGP_NODE, &address_family_vpnv4_unicast_cmd);
10969
Lou Berger13c378d2016-01-12 13:41:56 -050010970 install_element (BGP_NODE, &address_family_vpnv6_cmd);
10971 install_element (BGP_NODE, &address_family_vpnv6_unicast_cmd);
10972
Lou Bergera3fda882016-01-12 13:42:04 -050010973 install_element (BGP_NODE, &address_family_encap_cmd);
10974 install_element (BGP_NODE, &address_family_encapv4_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010975 install_element (BGP_NODE, &address_family_encapv6_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010976
paul718e3742002-12-13 20:15:29 +000010977 /* "exit-address-family" command. */
10978 install_element (BGP_IPV4_NODE, &exit_address_family_cmd);
10979 install_element (BGP_IPV4M_NODE, &exit_address_family_cmd);
10980 install_element (BGP_IPV6_NODE, &exit_address_family_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010981 install_element (BGP_IPV6M_NODE, &exit_address_family_cmd);
paul718e3742002-12-13 20:15:29 +000010982 install_element (BGP_VPNV4_NODE, &exit_address_family_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010983 install_element (BGP_VPNV6_NODE, &exit_address_family_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010984 install_element (BGP_ENCAP_NODE, &exit_address_family_cmd);
10985 install_element (BGP_ENCAPV6_NODE, &exit_address_family_cmd);
paul718e3742002-12-13 20:15:29 +000010986
10987 /* "clear ip bgp commands" */
10988 install_element (ENABLE_NODE, &clear_ip_bgp_all_cmd);
10989 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_cmd);
10990 install_element (ENABLE_NODE, &clear_ip_bgp_as_cmd);
10991 install_element (ENABLE_NODE, &clear_ip_bgp_peer_cmd);
10992 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_cmd);
10993 install_element (ENABLE_NODE, &clear_ip_bgp_external_cmd);
paul718e3742002-12-13 20:15:29 +000010994 install_element (ENABLE_NODE, &clear_bgp_all_cmd);
10995 install_element (ENABLE_NODE, &clear_bgp_instance_all_cmd);
10996 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_cmd);
10997 install_element (ENABLE_NODE, &clear_bgp_peer_cmd);
10998 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_cmd);
10999 install_element (ENABLE_NODE, &clear_bgp_peer_group_cmd);
11000 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_cmd);
11001 install_element (ENABLE_NODE, &clear_bgp_external_cmd);
11002 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_cmd);
11003 install_element (ENABLE_NODE, &clear_bgp_as_cmd);
11004 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_cmd);
paul718e3742002-12-13 20:15:29 +000011005
11006 /* "clear ip bgp neighbor soft in" */
11007 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_in_cmd);
11008 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_in_cmd);
11009 install_element (ENABLE_NODE, &clear_ip_bgp_all_in_cmd);
11010 install_element (ENABLE_NODE, &clear_ip_bgp_all_in_prefix_filter_cmd);
11011 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_in_prefix_filter_cmd);
11012 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_in_cmd);
11013 install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_cmd);
11014 install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_prefix_filter_cmd);
11015 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_in_cmd);
11016 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_cmd);
11017 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_prefix_filter_cmd);
11018 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_in_cmd);
11019 install_element (ENABLE_NODE, &clear_ip_bgp_external_in_cmd);
11020 install_element (ENABLE_NODE, &clear_ip_bgp_external_in_prefix_filter_cmd);
11021 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_in_cmd);
11022 install_element (ENABLE_NODE, &clear_ip_bgp_as_in_cmd);
11023 install_element (ENABLE_NODE, &clear_ip_bgp_as_in_prefix_filter_cmd);
11024 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_in_cmd);
11025 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_in_cmd);
11026 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_cmd);
11027 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_prefix_filter_cmd);
11028 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd);
11029 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_in_cmd);
11030 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_cmd);
11031 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd);
11032 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_in_cmd);
11033 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_cmd);
11034 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd);
11035 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_in_cmd);
11036 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_cmd);
11037 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_prefix_filter_cmd);
11038 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_in_cmd);
11039 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_cmd);
11040 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_prefix_filter_cmd);
11041 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_in_cmd);
11042 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_in_cmd);
11043 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_in_cmd);
11044 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_in_cmd);
11045 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_in_cmd);
11046 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_in_cmd);
Lou Berger298cc2f2016-01-12 13:42:02 -050011047 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_soft_in_cmd);
11048 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_in_cmd);
11049 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_soft_in_cmd);
11050 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_in_cmd);
11051 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_soft_in_cmd);
11052 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_in_cmd);
paul718e3742002-12-13 20:15:29 +000011053 install_element (ENABLE_NODE, &clear_bgp_all_soft_in_cmd);
11054 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_in_cmd);
11055 install_element (ENABLE_NODE, &clear_bgp_all_in_cmd);
11056 install_element (ENABLE_NODE, &clear_bgp_all_in_prefix_filter_cmd);
11057 install_element (ENABLE_NODE, &clear_bgp_peer_soft_in_cmd);
11058 install_element (ENABLE_NODE, &clear_bgp_peer_in_cmd);
11059 install_element (ENABLE_NODE, &clear_bgp_peer_in_prefix_filter_cmd);
11060 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_in_cmd);
11061 install_element (ENABLE_NODE, &clear_bgp_peer_group_in_cmd);
11062 install_element (ENABLE_NODE, &clear_bgp_peer_group_in_prefix_filter_cmd);
11063 install_element (ENABLE_NODE, &clear_bgp_external_soft_in_cmd);
11064 install_element (ENABLE_NODE, &clear_bgp_external_in_cmd);
11065 install_element (ENABLE_NODE, &clear_bgp_external_in_prefix_filter_cmd);
11066 install_element (ENABLE_NODE, &clear_bgp_as_soft_in_cmd);
11067 install_element (ENABLE_NODE, &clear_bgp_as_in_cmd);
11068 install_element (ENABLE_NODE, &clear_bgp_as_in_prefix_filter_cmd);
11069 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_in_cmd);
11070 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_cmd);
11071 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_prefix_filter_cmd);
11072 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_in_cmd);
11073 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_cmd);
11074 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_prefix_filter_cmd);
11075 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_in_cmd);
11076 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_cmd);
11077 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_prefix_filter_cmd);
11078 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_in_cmd);
11079 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_cmd);
11080 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_prefix_filter_cmd);
11081 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_in_cmd);
11082 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_cmd);
11083 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_prefix_filter_cmd);
paul718e3742002-12-13 20:15:29 +000011084
Daniel Walton325fcfb2015-05-19 17:58:10 -070011085 /* clear ip bgp prefix */
11086 install_element (ENABLE_NODE, &clear_ip_bgp_prefix_cmd);
11087 install_element (ENABLE_NODE, &clear_bgp_ipv6_safi_prefix_cmd);
11088
paul718e3742002-12-13 20:15:29 +000011089 /* "clear ip bgp neighbor soft out" */
11090 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_out_cmd);
11091 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_out_cmd);
11092 install_element (ENABLE_NODE, &clear_ip_bgp_all_out_cmd);
11093 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_out_cmd);
11094 install_element (ENABLE_NODE, &clear_ip_bgp_peer_out_cmd);
11095 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_out_cmd);
11096 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_out_cmd);
11097 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_out_cmd);
11098 install_element (ENABLE_NODE, &clear_ip_bgp_external_out_cmd);
11099 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_out_cmd);
11100 install_element (ENABLE_NODE, &clear_ip_bgp_as_out_cmd);
11101 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_out_cmd);
11102 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_out_cmd);
11103 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_out_cmd);
11104 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_out_cmd);
11105 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_out_cmd);
11106 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_out_cmd);
11107 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_out_cmd);
11108 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_out_cmd);
11109 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_out_cmd);
11110 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_out_cmd);
11111 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_out_cmd);
11112 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_out_cmd);
11113 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_out_cmd);
11114 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_out_cmd);
11115 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_out_cmd);
11116 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_out_cmd);
11117 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_out_cmd);
Lou Berger298cc2f2016-01-12 13:42:02 -050011118 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_soft_out_cmd);
11119 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_out_cmd);
11120 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_soft_out_cmd);
11121 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_out_cmd);
11122 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_soft_out_cmd);
11123 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_out_cmd);
paul718e3742002-12-13 20:15:29 +000011124 install_element (ENABLE_NODE, &clear_bgp_all_soft_out_cmd);
11125 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_out_cmd);
11126 install_element (ENABLE_NODE, &clear_bgp_all_out_cmd);
11127 install_element (ENABLE_NODE, &clear_bgp_peer_soft_out_cmd);
11128 install_element (ENABLE_NODE, &clear_bgp_peer_out_cmd);
11129 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_out_cmd);
11130 install_element (ENABLE_NODE, &clear_bgp_peer_group_out_cmd);
11131 install_element (ENABLE_NODE, &clear_bgp_external_soft_out_cmd);
11132 install_element (ENABLE_NODE, &clear_bgp_external_out_cmd);
11133 install_element (ENABLE_NODE, &clear_bgp_as_soft_out_cmd);
11134 install_element (ENABLE_NODE, &clear_bgp_as_out_cmd);
11135 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_out_cmd);
11136 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_out_cmd);
11137 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_out_cmd);
11138 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_out_cmd);
11139 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_out_cmd);
11140 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_out_cmd);
11141 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_out_cmd);
11142 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_out_cmd);
11143 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_out_cmd);
11144 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_out_cmd);
paul718e3742002-12-13 20:15:29 +000011145
11146 /* "clear ip bgp neighbor soft" */
11147 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_cmd);
11148 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_cmd);
11149 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_cmd);
11150 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_cmd);
11151 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_cmd);
11152 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_cmd);
11153 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_cmd);
11154 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_cmd);
11155 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_cmd);
11156 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_cmd);
11157 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_cmd);
11158 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_cmd);
11159 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_cmd);
11160 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_cmd);
11161 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_cmd);
Lou Berger298cc2f2016-01-12 13:42:02 -050011162 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_soft_cmd);
11163 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_soft_cmd);
11164 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_soft_cmd);
paul718e3742002-12-13 20:15:29 +000011165 install_element (ENABLE_NODE, &clear_bgp_all_soft_cmd);
11166 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_cmd);
11167 install_element (ENABLE_NODE, &clear_bgp_peer_soft_cmd);
11168 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_cmd);
11169 install_element (ENABLE_NODE, &clear_bgp_external_soft_cmd);
11170 install_element (ENABLE_NODE, &clear_bgp_as_soft_cmd);
11171 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_cmd);
11172 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_cmd);
11173 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_cmd);
11174 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_cmd);
11175 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_cmd);
paul718e3742002-12-13 20:15:29 +000011176
paulfee0f4c2004-09-13 05:12:46 +000011177 /* "clear ip bgp neighbor rsclient" */
11178 install_element (ENABLE_NODE, &clear_ip_bgp_all_rsclient_cmd);
11179 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_rsclient_cmd);
11180 install_element (ENABLE_NODE, &clear_ip_bgp_peer_rsclient_cmd);
11181 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_rsclient_cmd);
paulfee0f4c2004-09-13 05:12:46 +000011182 install_element (ENABLE_NODE, &clear_bgp_all_rsclient_cmd);
11183 install_element (ENABLE_NODE, &clear_bgp_instance_all_rsclient_cmd);
11184 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_rsclient_cmd);
11185 install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_all_rsclient_cmd);
11186 install_element (ENABLE_NODE, &clear_bgp_peer_rsclient_cmd);
11187 install_element (ENABLE_NODE, &clear_bgp_instance_peer_rsclient_cmd);
11188 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_rsclient_cmd);
11189 install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_peer_rsclient_cmd);
paulfee0f4c2004-09-13 05:12:46 +000011190
paul718e3742002-12-13 20:15:29 +000011191 /* "show ip bgp summary" commands. */
paul718e3742002-12-13 20:15:29 +000011192 install_element (VIEW_NODE, &show_bgp_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011193 install_element (RESTRICTED_NODE, &show_bgp_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011194
11195 install_element (VIEW_NODE, &show_bgp_summary_1w_cmd);
11196 install_element (RESTRICTED_NODE, &show_bgp_summary_1w_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011197
11198 install_element (VIEW_NODE, &show_bgp_ipv4_safi_summary_cmd);
11199 install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_summary_cmd);
11200 install_element (VIEW_NODE, &show_bgp_instance_ipv4_summary_cmd);
11201
11202 install_element (VIEW_NODE, &show_bgp_ipv4_vpn_summary_cmd);
11203 install_element (VIEW_NODE, &show_bgp_ipv4_encap_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011204 install_element (VIEW_NODE, &show_bgp_ipv6_vpn_summary_cmd);
11205 install_element (VIEW_NODE, &show_bgp_ipv6_encap_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011206
paul718e3742002-12-13 20:15:29 +000011207 install_element (VIEW_NODE, &show_bgp_instance_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040011208 install_element (VIEW_NODE, &show_bgp_ipv6_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000011209 install_element (VIEW_NODE, &show_bgp_instance_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040011210 install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_summary_cmd);
Donald Sharp68b45cc2016-03-11 14:27:13 -050011211
Michael Lambert95cbbd22010-07-23 14:43:04 -040011212 install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011213 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040011214 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011215
11216 install_element (RESTRICTED_NODE, &show_bgp_ipv4_vpn_summary_cmd);
11217 install_element (RESTRICTED_NODE, &show_bgp_ipv4_encap_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011218 install_element (RESTRICTED_NODE, &show_bgp_ipv6_vpn_summary_cmd);
11219 install_element (RESTRICTED_NODE, &show_bgp_ipv6_encap_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011220
Paul Jakma62687ff2008-08-23 14:27:06 +010011221 install_element (RESTRICTED_NODE, &show_bgp_instance_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040011222 install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010011223 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040011224 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000011225
11226 /* "show ip bgp neighbors" commands. */
paulbb46e942003-10-24 19:02:03 +000011227 install_element (VIEW_NODE, &show_bgp_instance_neighbors_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011228
11229 install_element (VIEW_NODE, &show_bgp_neighbors_cmd);
11230 install_element (VIEW_NODE, &show_bgp_neighbors_peer_cmd);
11231 install_element (VIEW_NODE, &show_bgp_instance_neighbors_peer_cmd);
11232 install_element (RESTRICTED_NODE, &show_bgp_neighbors_peer_cmd);
11233 install_element (RESTRICTED_NODE, &show_bgp_instance_neighbors_peer_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011234 install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_cmd);
11235 install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
11236 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
paul718e3742002-12-13 20:15:29 +000011237
paulfee0f4c2004-09-13 05:12:46 +000011238 /* "show ip bgp rsclient" commands. */
Michael Lambert95cbbd22010-07-23 14:43:04 -040011239 install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd);
11240 install_element (VIEW_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040011241 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd);
11242 install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000011243
paulfee0f4c2004-09-13 05:12:46 +000011244 install_element (VIEW_NODE, &show_bgp_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000011245 install_element (VIEW_NODE, &show_bgp_instance_rsclient_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011246 install_element (RESTRICTED_NODE, &show_bgp_rsclient_summary_cmd);
11247 install_element (RESTRICTED_NODE, &show_bgp_instance_rsclient_summary_cmd);
Donald Sharp68b45cc2016-03-11 14:27:13 -050011248
Lou Berger651b4022016-01-12 13:42:07 -050011249 install_element (VIEW_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000011250 install_element (VIEW_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040011251 install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd);
11252 install_element (VIEW_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010011253 install_element (RESTRICTED_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010011254 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040011255 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd);
11256 install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000011257
paul718e3742002-12-13 20:15:29 +000011258 /* "show ip bgp paths" commands. */
Lou Berger651b4022016-01-12 13:42:07 -050011259 install_element (VIEW_NODE, &show_bgp_ipv4_paths_cmd);
paul718e3742002-12-13 20:15:29 +000011260
11261 /* "show ip bgp community" commands. */
11262 install_element (VIEW_NODE, &show_ip_bgp_community_info_cmd);
paul718e3742002-12-13 20:15:29 +000011263
Job Snijders3334bab2017-01-20 14:47:12 +000011264 /* "show ip bgp large-community" commands. */
11265 install_element (VIEW_NODE, &show_ip_bgp_lcommunity_info_cmd);
11266
paul718e3742002-12-13 20:15:29 +000011267 /* "show ip bgp attribute-info" commands. */
11268 install_element (VIEW_NODE, &show_ip_bgp_attr_info_cmd);
paul718e3742002-12-13 20:15:29 +000011269
11270 /* "redistribute" commands. */
11271 install_element (BGP_NODE, &bgp_redistribute_ipv4_cmd);
11272 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_cmd);
11273 install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_cmd);
11274 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_cmd);
11275 install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_cmd);
11276 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_cmd);
11277 install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_metric_cmd);
11278 install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_rmap_cmd);
11279 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_metric_cmd);
11280 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_rmap_cmd);
paul718e3742002-12-13 20:15:29 +000011281 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_cmd);
11282 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_cmd);
11283 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_cmd);
11284 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_cmd);
11285 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_cmd);
11286 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_cmd);
11287 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_metric_cmd);
11288 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_rmap_cmd);
11289 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_metric_cmd);
11290 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_rmap_cmd);
paul718e3742002-12-13 20:15:29 +000011291
Nick Hilliardfa411a22011-03-23 15:33:17 +000011292 /* ttl_security commands */
11293 install_element (BGP_NODE, &neighbor_ttl_security_cmd);
11294 install_element (BGP_NODE, &no_neighbor_ttl_security_cmd);
11295
Paul Jakma4bf6a362006-03-30 14:05:23 +000011296 /* "show bgp memory" commands. */
11297 install_element (VIEW_NODE, &show_bgp_memory_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010011298 install_element (RESTRICTED_NODE, &show_bgp_memory_cmd);
Paul Jakma4bf6a362006-03-30 14:05:23 +000011299
Michael Lamberte0081f72008-11-16 20:12:04 +000011300 /* "show bgp views" commands. */
11301 install_element (VIEW_NODE, &show_bgp_views_cmd);
11302 install_element (RESTRICTED_NODE, &show_bgp_views_cmd);
Donald Sharp68b45cc2016-03-11 14:27:13 -050011303
Lou Bergerf9b6c392016-01-12 13:42:09 -050011304 /* non afi/safi forms of commands */
11305 install_element (VIEW_NODE, &show_ip_bgp_summary_cmd);
11306 install_element (VIEW_NODE, &show_ip_bgp_instance_summary_cmd);
11307 install_element (VIEW_NODE, &show_ip_bgp_ipv4_summary_cmd);
11308 install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
11309 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
11310 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
11311 install_element (VIEW_NODE, &show_bgp_ipv6_summary_cmd);
11312 install_element (RESTRICTED_NODE, &show_ip_bgp_summary_cmd);
11313 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_summary_cmd);
11314 install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_summary_cmd);
11315 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
11316 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
11317 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
11318 install_element (RESTRICTED_NODE, &show_bgp_ipv6_summary_cmd);
Lou Bergerf9b6c392016-01-12 13:42:09 -050011319 install_element (VIEW_NODE, &show_ip_bgp_neighbors_cmd);
11320 install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_cmd);
11321 install_element (VIEW_NODE, &show_ip_bgp_neighbors_peer_cmd);
11322 install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
11323 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd);
11324 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd);
11325 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
11326 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
11327 install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_cmd);
11328 install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
11329 install_element (RESTRICTED_NODE, &show_ip_bgp_neighbors_peer_cmd);
11330 install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
11331 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
11332 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
11333 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
Lou Bergerf9b6c392016-01-12 13:42:09 -050011334 install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_cmd);
11335 install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
11336 install_element (RESTRICTED_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
Lou Bergerf9b6c392016-01-12 13:42:09 -050011337 install_element (VIEW_NODE, &show_ipv6_bgp_summary_cmd);
11338 install_element (VIEW_NODE, &show_ipv6_mbgp_summary_cmd);
Lou Bergerf9b6c392016-01-12 13:42:09 -050011339 install_element (VIEW_NODE, &show_ip_bgp_rsclient_summary_cmd);
11340 install_element (VIEW_NODE, &show_ip_bgp_instance_rsclient_summary_cmd);
11341 install_element (VIEW_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd);
11342 install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd);
11343 install_element (RESTRICTED_NODE, &show_ip_bgp_rsclient_summary_cmd);
11344 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_rsclient_summary_cmd);
11345 install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd);
11346 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd);
Lou Bergerf9b6c392016-01-12 13:42:09 -050011347 install_element (VIEW_NODE, &show_ip_bgp_paths_cmd);
11348 install_element (VIEW_NODE, &show_ip_bgp_ipv4_paths_cmd);
paul718e3742002-12-13 20:15:29 +000011349 /* Community-list. */
11350 community_list_vty ();
11351}
David Lamparter6b0655a2014-06-04 06:53:35 +020011352
paul718e3742002-12-13 20:15:29 +000011353#include "memory.h"
11354#include "bgp_regex.h"
11355#include "bgp_clist.h"
11356#include "bgp_ecommunity.h"
11357
11358/* VTY functions. */
11359
11360/* Direction value to string conversion. */
paul94f2b392005-06-28 12:44:16 +000011361static const char *
paul718e3742002-12-13 20:15:29 +000011362community_direct_str (int direct)
11363{
11364 switch (direct)
11365 {
11366 case COMMUNITY_DENY:
11367 return "deny";
paul718e3742002-12-13 20:15:29 +000011368 case COMMUNITY_PERMIT:
11369 return "permit";
paul718e3742002-12-13 20:15:29 +000011370 default:
11371 return "unknown";
paul718e3742002-12-13 20:15:29 +000011372 }
11373}
11374
11375/* Display error string. */
paul94f2b392005-06-28 12:44:16 +000011376static void
paul718e3742002-12-13 20:15:29 +000011377community_list_perror (struct vty *vty, int ret)
11378{
11379 switch (ret)
11380 {
11381 case COMMUNITY_LIST_ERR_CANT_FIND_LIST:
Denis Ovsienkob7292942010-12-08 18:51:37 +030011382 vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000011383 break;
11384 case COMMUNITY_LIST_ERR_MALFORMED_VAL:
11385 vty_out (vty, "%% Malformed community-list value%s", VTY_NEWLINE);
11386 break;
11387 case COMMUNITY_LIST_ERR_STANDARD_CONFLICT:
11388 vty_out (vty, "%% Community name conflict, previously defined as standard community%s", VTY_NEWLINE);
11389 break;
11390 case COMMUNITY_LIST_ERR_EXPANDED_CONFLICT:
11391 vty_out (vty, "%% Community name conflict, previously defined as expanded community%s", VTY_NEWLINE);
11392 break;
11393 }
11394}
11395
11396/* VTY interface for community_set() function. */
paul94f2b392005-06-28 12:44:16 +000011397static int
paulfd79ac92004-10-13 05:06:08 +000011398community_list_set_vty (struct vty *vty, int argc, const char **argv,
11399 int style, int reject_all_digit_name)
paul718e3742002-12-13 20:15:29 +000011400{
11401 int ret;
11402 int direct;
11403 char *str;
11404
11405 /* Check the list type. */
11406 if (strncmp (argv[1], "p", 1) == 0)
11407 direct = COMMUNITY_PERMIT;
11408 else if (strncmp (argv[1], "d", 1) == 0)
11409 direct = COMMUNITY_DENY;
11410 else
11411 {
11412 vty_out (vty, "%% Matching condition must be permit or deny%s",
11413 VTY_NEWLINE);
11414 return CMD_WARNING;
11415 }
11416
11417 /* All digit name check. */
11418 if (reject_all_digit_name && all_digit (argv[0]))
11419 {
11420 vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE);
11421 return CMD_WARNING;
11422 }
11423
11424 /* Concat community string argument. */
11425 if (argc > 1)
11426 str = argv_concat (argv, argc, 2);
11427 else
11428 str = NULL;
11429
11430 /* When community_list_set() return nevetive value, it means
11431 malformed community string. */
11432 ret = community_list_set (bgp_clist, argv[0], str, direct, style);
11433
11434 /* Free temporary community list string allocated by
11435 argv_concat(). */
11436 if (str)
11437 XFREE (MTYPE_TMP, str);
11438
11439 if (ret < 0)
11440 {
11441 /* Display error string. */
11442 community_list_perror (vty, ret);
11443 return CMD_WARNING;
11444 }
11445
11446 return CMD_SUCCESS;
11447}
11448
paul718e3742002-12-13 20:15:29 +000011449/* Communiyt-list entry delete. */
paul94f2b392005-06-28 12:44:16 +000011450static int
hassofee6e4e2005-02-02 16:29:31 +000011451community_list_unset_vty (struct vty *vty, int argc, const char **argv,
11452 int style)
paul718e3742002-12-13 20:15:29 +000011453{
11454 int ret;
hassofee6e4e2005-02-02 16:29:31 +000011455 int direct = 0;
11456 char *str = NULL;
paul718e3742002-12-13 20:15:29 +000011457
hassofee6e4e2005-02-02 16:29:31 +000011458 if (argc > 1)
paul718e3742002-12-13 20:15:29 +000011459 {
hassofee6e4e2005-02-02 16:29:31 +000011460 /* Check the list direct. */
11461 if (strncmp (argv[1], "p", 1) == 0)
11462 direct = COMMUNITY_PERMIT;
11463 else if (strncmp (argv[1], "d", 1) == 0)
11464 direct = COMMUNITY_DENY;
11465 else
11466 {
11467 vty_out (vty, "%% Matching condition must be permit or deny%s",
11468 VTY_NEWLINE);
11469 return CMD_WARNING;
11470 }
paul718e3742002-12-13 20:15:29 +000011471
hassofee6e4e2005-02-02 16:29:31 +000011472 /* Concat community string argument. */
11473 str = argv_concat (argv, argc, 2);
11474 }
paul718e3742002-12-13 20:15:29 +000011475
11476 /* Unset community list. */
11477 ret = community_list_unset (bgp_clist, argv[0], str, direct, style);
11478
11479 /* Free temporary community list string allocated by
11480 argv_concat(). */
hassofee6e4e2005-02-02 16:29:31 +000011481 if (str)
11482 XFREE (MTYPE_TMP, str);
paul718e3742002-12-13 20:15:29 +000011483
11484 if (ret < 0)
11485 {
11486 community_list_perror (vty, ret);
11487 return CMD_WARNING;
11488 }
11489
11490 return CMD_SUCCESS;
11491}
11492
11493/* "community-list" keyword help string. */
11494#define COMMUNITY_LIST_STR "Add a community list entry\n"
11495#define COMMUNITY_VAL_STR "Community number in aa:nn format or internet|local-AS|no-advertise|no-export\n"
11496
paul718e3742002-12-13 20:15:29 +000011497DEFUN (ip_community_list_standard,
11498 ip_community_list_standard_cmd,
11499 "ip community-list <1-99> (deny|permit) .AA:NN",
11500 IP_STR
11501 COMMUNITY_LIST_STR
11502 "Community list number (standard)\n"
11503 "Specify community to reject\n"
11504 "Specify community to accept\n"
11505 COMMUNITY_VAL_STR)
11506{
11507 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0);
11508}
11509
11510ALIAS (ip_community_list_standard,
11511 ip_community_list_standard2_cmd,
11512 "ip community-list <1-99> (deny|permit)",
11513 IP_STR
11514 COMMUNITY_LIST_STR
11515 "Community list number (standard)\n"
11516 "Specify community to reject\n"
11517 "Specify community to accept\n")
11518
11519DEFUN (ip_community_list_expanded,
11520 ip_community_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000011521 "ip community-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000011522 IP_STR
11523 COMMUNITY_LIST_STR
11524 "Community list number (expanded)\n"
11525 "Specify community to reject\n"
11526 "Specify community to accept\n"
11527 "An ordered list as a regular-expression\n")
11528{
11529 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0);
11530}
11531
11532DEFUN (ip_community_list_name_standard,
11533 ip_community_list_name_standard_cmd,
11534 "ip community-list standard WORD (deny|permit) .AA:NN",
11535 IP_STR
11536 COMMUNITY_LIST_STR
11537 "Add a standard community-list entry\n"
11538 "Community list name\n"
11539 "Specify community to reject\n"
11540 "Specify community to accept\n"
11541 COMMUNITY_VAL_STR)
11542{
11543 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1);
11544}
11545
11546ALIAS (ip_community_list_name_standard,
11547 ip_community_list_name_standard2_cmd,
11548 "ip community-list standard WORD (deny|permit)",
11549 IP_STR
11550 COMMUNITY_LIST_STR
11551 "Add a standard community-list entry\n"
11552 "Community list name\n"
11553 "Specify community to reject\n"
11554 "Specify community to accept\n")
11555
11556DEFUN (ip_community_list_name_expanded,
11557 ip_community_list_name_expanded_cmd,
11558 "ip community-list expanded WORD (deny|permit) .LINE",
11559 IP_STR
11560 COMMUNITY_LIST_STR
11561 "Add an expanded community-list entry\n"
11562 "Community list name\n"
11563 "Specify community to reject\n"
11564 "Specify community to accept\n"
11565 "An ordered list as a regular-expression\n")
11566{
11567 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1);
11568}
11569
hassofee6e4e2005-02-02 16:29:31 +000011570DEFUN (no_ip_community_list_standard_all,
11571 no_ip_community_list_standard_all_cmd,
11572 "no ip community-list <1-99>",
paul718e3742002-12-13 20:15:29 +000011573 NO_STR
11574 IP_STR
11575 COMMUNITY_LIST_STR
hassofee6e4e2005-02-02 16:29:31 +000011576 "Community list number (standard)\n")
paul718e3742002-12-13 20:15:29 +000011577{
hassofee6e4e2005-02-02 16:29:31 +000011578 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
paul718e3742002-12-13 20:15:29 +000011579}
11580
hassofee6e4e2005-02-02 16:29:31 +000011581DEFUN (no_ip_community_list_expanded_all,
11582 no_ip_community_list_expanded_all_cmd,
11583 "no ip community-list <100-500>",
11584 NO_STR
11585 IP_STR
11586 COMMUNITY_LIST_STR
11587 "Community list number (expanded)\n")
11588{
11589 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
11590}
11591
11592DEFUN (no_ip_community_list_name_standard_all,
11593 no_ip_community_list_name_standard_all_cmd,
11594 "no ip community-list standard WORD",
paul718e3742002-12-13 20:15:29 +000011595 NO_STR
11596 IP_STR
11597 COMMUNITY_LIST_STR
11598 "Add a standard community-list entry\n"
paul718e3742002-12-13 20:15:29 +000011599 "Community list name\n")
11600{
hassofee6e4e2005-02-02 16:29:31 +000011601 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
paul718e3742002-12-13 20:15:29 +000011602}
11603
hassofee6e4e2005-02-02 16:29:31 +000011604DEFUN (no_ip_community_list_name_expanded_all,
11605 no_ip_community_list_name_expanded_all_cmd,
11606 "no ip community-list expanded WORD",
paul718e3742002-12-13 20:15:29 +000011607 NO_STR
11608 IP_STR
11609 COMMUNITY_LIST_STR
hassofee6e4e2005-02-02 16:29:31 +000011610 "Add an expanded community-list entry\n"
11611 "Community list name\n")
paul718e3742002-12-13 20:15:29 +000011612{
hassofee6e4e2005-02-02 16:29:31 +000011613 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
paul718e3742002-12-13 20:15:29 +000011614}
11615
11616DEFUN (no_ip_community_list_standard,
11617 no_ip_community_list_standard_cmd,
11618 "no ip community-list <1-99> (deny|permit) .AA:NN",
11619 NO_STR
11620 IP_STR
11621 COMMUNITY_LIST_STR
11622 "Community list number (standard)\n"
11623 "Specify community to reject\n"
11624 "Specify community to accept\n"
11625 COMMUNITY_VAL_STR)
11626{
11627 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
11628}
11629
11630DEFUN (no_ip_community_list_expanded,
11631 no_ip_community_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000011632 "no ip community-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000011633 NO_STR
11634 IP_STR
11635 COMMUNITY_LIST_STR
11636 "Community list number (expanded)\n"
11637 "Specify community to reject\n"
11638 "Specify community to accept\n"
11639 "An ordered list as a regular-expression\n")
11640{
11641 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
11642}
11643
11644DEFUN (no_ip_community_list_name_standard,
11645 no_ip_community_list_name_standard_cmd,
11646 "no ip community-list standard WORD (deny|permit) .AA:NN",
11647 NO_STR
11648 IP_STR
11649 COMMUNITY_LIST_STR
11650 "Specify a standard community-list\n"
11651 "Community list name\n"
11652 "Specify community to reject\n"
11653 "Specify community to accept\n"
11654 COMMUNITY_VAL_STR)
11655{
11656 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
11657}
11658
11659DEFUN (no_ip_community_list_name_expanded,
11660 no_ip_community_list_name_expanded_cmd,
11661 "no ip community-list expanded WORD (deny|permit) .LINE",
11662 NO_STR
11663 IP_STR
11664 COMMUNITY_LIST_STR
11665 "Specify an expanded community-list\n"
11666 "Community list name\n"
11667 "Specify community to reject\n"
11668 "Specify community to accept\n"
11669 "An ordered list as a regular-expression\n")
11670{
11671 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
11672}
11673
paul94f2b392005-06-28 12:44:16 +000011674static void
paul718e3742002-12-13 20:15:29 +000011675community_list_show (struct vty *vty, struct community_list *list)
11676{
11677 struct community_entry *entry;
11678
11679 for (entry = list->head; entry; entry = entry->next)
11680 {
11681 if (entry == list->head)
11682 {
11683 if (all_digit (list->name))
11684 vty_out (vty, "Community %s list %s%s",
11685 entry->style == COMMUNITY_LIST_STANDARD ?
11686 "standard" : "(expanded) access",
11687 list->name, VTY_NEWLINE);
11688 else
11689 vty_out (vty, "Named Community %s list %s%s",
11690 entry->style == COMMUNITY_LIST_STANDARD ?
11691 "standard" : "expanded",
11692 list->name, VTY_NEWLINE);
11693 }
11694 if (entry->any)
11695 vty_out (vty, " %s%s",
11696 community_direct_str (entry->direct), VTY_NEWLINE);
11697 else
11698 vty_out (vty, " %s %s%s",
11699 community_direct_str (entry->direct),
11700 entry->style == COMMUNITY_LIST_STANDARD
11701 ? community_str (entry->u.com) : entry->config,
11702 VTY_NEWLINE);
11703 }
11704}
11705
11706DEFUN (show_ip_community_list,
11707 show_ip_community_list_cmd,
11708 "show ip community-list",
11709 SHOW_STR
11710 IP_STR
11711 "List community-list\n")
11712{
11713 struct community_list *list;
11714 struct community_list_master *cm;
11715
hassofee6e4e2005-02-02 16:29:31 +000011716 cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011717 if (! cm)
11718 return CMD_SUCCESS;
11719
11720 for (list = cm->num.head; list; list = list->next)
11721 community_list_show (vty, list);
11722
11723 for (list = cm->str.head; list; list = list->next)
11724 community_list_show (vty, list);
11725
11726 return CMD_SUCCESS;
11727}
11728
11729DEFUN (show_ip_community_list_arg,
11730 show_ip_community_list_arg_cmd,
hassofee6e4e2005-02-02 16:29:31 +000011731 "show ip community-list (<1-500>|WORD)",
paul718e3742002-12-13 20:15:29 +000011732 SHOW_STR
11733 IP_STR
11734 "List community-list\n"
11735 "Community-list number\n"
11736 "Community-list name\n")
11737{
11738 struct community_list *list;
11739
hassofee6e4e2005-02-02 16:29:31 +000011740 list = community_list_lookup (bgp_clist, argv[0], COMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011741 if (! list)
11742 {
Denis Ovsienkob7292942010-12-08 18:51:37 +030011743 vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000011744 return CMD_WARNING;
11745 }
11746
11747 community_list_show (vty, list);
11748
11749 return CMD_SUCCESS;
11750}
David Lamparter6b0655a2014-06-04 06:53:35 +020011751
Job Snijders3334bab2017-01-20 14:47:12 +000011752/*
11753 * Large Community code.
11754 */
11755static int
11756lcommunity_list_set_vty (struct vty *vty, int argc, const char **argv,
11757 int style, int reject_all_digit_name)
11758{
11759 int ret;
11760 int direct;
11761 char *str;
11762
11763 /* Check the list type. */
11764 if (strncmp (argv[1], "p", 1) == 0)
11765 direct = COMMUNITY_PERMIT;
11766 else if (strncmp (argv[1], "d", 1) == 0)
11767 direct = COMMUNITY_DENY;
11768 else
11769 {
11770 vty_out (vty, "%% Matching condition must be permit or deny%s",
11771 VTY_NEWLINE);
11772 return CMD_WARNING;
11773 }
11774
11775 /* All digit name check. */
11776 if (reject_all_digit_name && all_digit (argv[0]))
11777 {
11778 vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE);
11779 return CMD_WARNING;
11780 }
11781
11782 /* Concat community string argument. */
11783 if (argc > 1)
11784 str = argv_concat (argv, argc, 2);
11785 else
11786 str = NULL;
11787
11788 ret = lcommunity_list_set (bgp_clist, argv[0], str, direct, style);
11789
11790 /* Free temporary community list string allocated by
11791 argv_concat(). */
11792 if (str)
11793 XFREE (MTYPE_TMP, str);
11794
11795 if (ret < 0)
11796 {
11797 community_list_perror (vty, ret);
11798 return CMD_WARNING;
11799 }
11800 return CMD_SUCCESS;
11801}
11802
11803static int
11804lcommunity_list_unset_vty (struct vty *vty, int argc, const char **argv,
11805 int style)
11806{
11807 int ret;
11808 int direct = 0;
11809 char *str = NULL;
11810
11811 if (argc > 1)
11812 {
11813 /* Check the list direct. */
11814 if (strncmp (argv[1], "p", 1) == 0)
11815 direct = COMMUNITY_PERMIT;
11816 else if (strncmp (argv[1], "d", 1) == 0)
11817 direct = COMMUNITY_DENY;
11818 else
11819 {
11820 vty_out (vty, "%% Matching condition must be permit or deny%s",
11821 VTY_NEWLINE);
11822 return CMD_WARNING;
11823 }
11824
11825 /* Concat community string argument. */
11826 str = argv_concat (argv, argc, 2);
11827 }
11828
11829 /* Unset community list. */
11830 ret = lcommunity_list_unset (bgp_clist, argv[0], str, direct, style);
11831
11832 /* Free temporary community list string allocated by
11833 argv_concat(). */
11834 if (str)
11835 XFREE (MTYPE_TMP, str);
11836
11837 if (ret < 0)
11838 {
11839 community_list_perror (vty, ret);
11840 return CMD_WARNING;
11841 }
11842
11843 return CMD_SUCCESS;
11844}
11845
11846/* "large-community-list" keyword help string. */
11847#define LCOMMUNITY_LIST_STR "Add a large community list entry\n"
11848#define LCOMMUNITY_VAL_STR "large community in 'aa:bb:cc' format\n"
11849
11850DEFUN (ip_lcommunity_list_standard,
11851 ip_lcommunity_list_standard_cmd,
11852 "ip large-community-list <1-99> (deny|permit) .AA:BB:CC",
11853 IP_STR
11854 LCOMMUNITY_LIST_STR
11855 "Large Community list number (standard)\n"
11856 "Specify large community to reject\n"
11857 "Specify large community to accept\n"
11858 LCOMMUNITY_VAL_STR)
11859{
11860 return lcommunity_list_set_vty (vty, argc, argv, LARGE_COMMUNITY_LIST_STANDARD, 0);
11861}
11862
11863ALIAS (ip_lcommunity_list_standard,
11864 ip_lcommunity_list_standard2_cmd,
11865 "ip large-community-list <1-99> (deny|permit)",
11866 IP_STR
11867 LCOMMUNITY_LIST_STR
11868 "Large Community list number (standard)\n"
11869 "Specify large community to reject\n"
11870 "Specify large community to accept\n")
11871
11872DEFUN (ip_lcommunity_list_expanded,
11873 ip_lcommunity_list_expanded_cmd,
11874 "ip large-community-list <100-500> (deny|permit) .LINE",
11875 IP_STR
11876 LCOMMUNITY_LIST_STR
11877 "Large Community list number (expanded)\n"
11878 "Specify large community to reject\n"
11879 "Specify large community to accept\n"
11880 "An ordered list as a regular-expression\n")
11881{
11882 return lcommunity_list_set_vty (vty, argc, argv, LARGE_COMMUNITY_LIST_EXPANDED, 0);
11883}
11884
11885DEFUN (ip_lcommunity_list_name_standard,
11886 ip_lcommunity_list_name_standard_cmd,
11887 "ip large-community-list standard WORD (deny|permit) .AA:BB.CC",
11888 IP_STR
11889 LCOMMUNITY_LIST_STR
11890 "Specify standard large-community-list\n"
11891 "Large Community list name\n"
11892 "Specify large community to reject\n"
11893 "Specify large community to accept\n"
11894 LCOMMUNITY_VAL_STR)
11895{
11896 return lcommunity_list_set_vty (vty, argc, argv, LARGE_COMMUNITY_LIST_STANDARD, 1);
11897}
11898
11899ALIAS (ip_lcommunity_list_name_standard,
11900 ip_lcommunity_list_name_standard2_cmd,
11901 "ip large-community-list standard WORD (deny|permit)",
11902 IP_STR
11903 LCOMMUNITY_LIST_STR
11904 "Specify standard large-community-list\n"
11905 "Large Community list name\n"
11906 "Specify large community to reject\n"
11907 "Specify large community to accept\n")
11908
11909DEFUN (ip_lcommunity_list_name_expanded,
11910 ip_lcommunity_list_name_expanded_cmd,
11911 "ip large-community-list expanded WORD (deny|permit) .LINE",
11912 IP_STR
11913 LCOMMUNITY_LIST_STR
11914 "Specify expanded large-community-list\n"
11915 "Large Community list name\n"
11916 "Specify large community to reject\n"
11917 "Specify large community to accept\n"
11918 "An ordered list as a regular-expression\n")
11919{
11920 return lcommunity_list_set_vty (vty, argc, argv, LARGE_COMMUNITY_LIST_EXPANDED, 1);
11921}
11922
11923DEFUN (no_ip_lcommunity_list_standard_all,
11924 no_ip_lcommunity_list_standard_all_cmd,
11925 "no ip large-community-list <1-99>",
11926 NO_STR
11927 IP_STR
11928 LCOMMUNITY_LIST_STR
11929 "Large Community list number (standard)\n")
11930{
11931 return lcommunity_list_unset_vty (vty, argc, argv, LARGE_COMMUNITY_LIST_STANDARD);
11932}
11933
11934DEFUN (no_ip_lcommunity_list_expanded_all,
11935 no_ip_lcommunity_list_expanded_all_cmd,
11936 "no ip large-community-list <100-500>",
11937 NO_STR
11938 IP_STR
11939 LCOMMUNITY_LIST_STR
11940 "Large Community list number (expanded)\n")
11941{
11942 return lcommunity_list_unset_vty (vty, argc, argv, LARGE_COMMUNITY_LIST_EXPANDED);
11943}
11944
11945DEFUN (no_ip_lcommunity_list_name_standard_all,
11946 no_ip_lcommunity_list_name_standard_all_cmd,
11947 "no ip large-community-list standard WORD",
11948 NO_STR
11949 IP_STR
11950 LCOMMUNITY_LIST_STR
11951 "Specify standard large-community-list\n"
11952 "Large Community list name\n")
11953{
11954 return lcommunity_list_unset_vty (vty, argc, argv, LARGE_COMMUNITY_LIST_STANDARD);
11955}
11956
11957DEFUN (no_ip_lcommunity_list_name_expanded_all,
11958 no_ip_lcommunity_list_name_expanded_all_cmd,
11959 "no ip large-community-list expanded WORD",
11960 NO_STR
11961 IP_STR
11962 LCOMMUNITY_LIST_STR
11963 "Specify expanded large-community-list\n"
11964 "Large Community list name\n")
11965{
11966 return lcommunity_list_unset_vty (vty, argc, argv, LARGE_COMMUNITY_LIST_EXPANDED);
11967}
11968
11969DEFUN (no_ip_lcommunity_list_standard,
11970 no_ip_lcommunity_list_standard_cmd,
11971 "no ip large-community-list <1-99> (deny|permit) .AA:.AA:NN",
11972 NO_STR
11973 IP_STR
11974 LCOMMUNITY_LIST_STR
11975 "Large Community list number (standard)\n"
11976 "Specify large community to reject\n"
11977 "Specify large community to accept\n"
11978 LCOMMUNITY_VAL_STR)
11979{
11980 return lcommunity_list_unset_vty (vty, argc, argv, LARGE_COMMUNITY_LIST_STANDARD);
11981}
11982
11983DEFUN (no_ip_lcommunity_list_expanded,
11984 no_ip_lcommunity_list_expanded_cmd,
11985 "no ip large-community-list <100-500> (deny|permit) .LINE",
11986 NO_STR
11987 IP_STR
11988 LCOMMUNITY_LIST_STR
11989 "Large Community list number (expanded)\n"
11990 "Specify large community to reject\n"
11991 "Specify large community to accept\n"
11992 "An ordered list as a regular-expression\n")
11993{
11994 return lcommunity_list_unset_vty (vty, argc, argv, LARGE_COMMUNITY_LIST_EXPANDED);
11995}
11996
11997DEFUN (no_ip_lcommunity_list_name_standard,
11998 no_ip_lcommunity_list_name_standard_cmd,
11999 "no ip large-community-list standard WORD (deny|permit) .AA:.AA:NN",
12000 NO_STR
12001 IP_STR
12002 LCOMMUNITY_LIST_STR
12003 "Specify standard large-community-list\n"
12004 "Large Community list name\n"
12005 "Specify large community to reject\n"
12006 "Specify large community to accept\n"
12007 LCOMMUNITY_VAL_STR)
12008{
12009 return lcommunity_list_unset_vty (vty, argc, argv, LARGE_COMMUNITY_LIST_STANDARD);
12010}
12011
12012DEFUN (no_ip_lcommunity_list_name_expanded,
12013 no_ip_lcommunity_list_name_expanded_cmd,
12014 "no ip large-community-list expanded WORD (deny|permit) .LINE",
12015 NO_STR
12016 IP_STR
12017 LCOMMUNITY_LIST_STR
12018 "Specify expanded large-community-list\n"
12019 "Large community list name\n"
12020 "Specify large community to reject\n"
12021 "Specify large community to accept\n"
12022 "An ordered list as a regular-expression\n")
12023{
12024 return lcommunity_list_unset_vty (vty, argc, argv, LARGE_COMMUNITY_LIST_EXPANDED);
12025}
12026
12027static void
12028lcommunity_list_show (struct vty *vty, struct community_list *list)
12029{
12030 struct community_entry *entry;
12031
12032 for (entry = list->head; entry; entry = entry->next)
12033 {
12034 if (entry == list->head)
12035 {
12036 if (all_digit (list->name))
12037 vty_out (vty, "Large community %s list %s%s",
12038 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
12039 "standard" : "(expanded) access",
12040 list->name, VTY_NEWLINE);
12041 else
12042 vty_out (vty, "Named large community %s list %s%s",
12043 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
12044 "standard" : "expanded",
12045 list->name, VTY_NEWLINE);
12046 }
12047 if (entry->any)
12048 vty_out (vty, " %s%s",
12049 community_direct_str (entry->direct), VTY_NEWLINE);
12050 else
12051 vty_out (vty, " %s %s%s",
12052 community_direct_str (entry->direct),
12053 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
12054 entry->u.ecom->str : entry->config,
12055 VTY_NEWLINE);
12056 }
12057}
12058
12059DEFUN (show_ip_lcommunity_list,
12060 show_ip_lcommunity_list_cmd,
12061 "show ip large-community-list",
12062 SHOW_STR
12063 IP_STR
12064 "List large-community list\n")
12065{
12066 struct community_list *list;
12067 struct community_list_master *cm;
12068
12069 cm = community_list_master_lookup (bgp_clist, LARGE_COMMUNITY_LIST_MASTER);
12070 if (! cm)
12071 return CMD_SUCCESS;
12072
12073 for (list = cm->num.head; list; list = list->next)
12074 lcommunity_list_show (vty, list);
12075
12076 for (list = cm->str.head; list; list = list->next)
12077 lcommunity_list_show (vty, list);
12078
12079 return CMD_SUCCESS;
12080}
12081
12082DEFUN (show_ip_lcommunity_list_arg,
12083 show_ip_lcommunity_list_arg_cmd,
12084 "show ip large-community-list (<1-500>|WORD)",
12085 SHOW_STR
12086 IP_STR
12087 "List large-community list\n"
12088 "large-community-list number\n"
12089 "large-community-list name\n")
12090{
12091 struct community_list *list;
12092
12093 list = community_list_lookup (bgp_clist, argv[0], LARGE_COMMUNITY_LIST_MASTER);
12094 if (! list)
12095 {
12096 vty_out (vty, "%% Can't find extcommunity-list%s", VTY_NEWLINE);
12097 return CMD_WARNING;
12098 }
12099
12100 lcommunity_list_show (vty, list);
12101
12102 return CMD_SUCCESS;
12103}
12104
paul94f2b392005-06-28 12:44:16 +000012105static int
paulfd79ac92004-10-13 05:06:08 +000012106extcommunity_list_set_vty (struct vty *vty, int argc, const char **argv,
12107 int style, int reject_all_digit_name)
paul718e3742002-12-13 20:15:29 +000012108{
12109 int ret;
12110 int direct;
12111 char *str;
12112
12113 /* Check the list type. */
12114 if (strncmp (argv[1], "p", 1) == 0)
12115 direct = COMMUNITY_PERMIT;
12116 else if (strncmp (argv[1], "d", 1) == 0)
12117 direct = COMMUNITY_DENY;
12118 else
12119 {
12120 vty_out (vty, "%% Matching condition must be permit or deny%s",
12121 VTY_NEWLINE);
12122 return CMD_WARNING;
12123 }
12124
12125 /* All digit name check. */
12126 if (reject_all_digit_name && all_digit (argv[0]))
12127 {
12128 vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE);
12129 return CMD_WARNING;
12130 }
12131
12132 /* Concat community string argument. */
12133 if (argc > 1)
12134 str = argv_concat (argv, argc, 2);
12135 else
12136 str = NULL;
12137
12138 ret = extcommunity_list_set (bgp_clist, argv[0], str, direct, style);
12139
12140 /* Free temporary community list string allocated by
12141 argv_concat(). */
12142 if (str)
12143 XFREE (MTYPE_TMP, str);
12144
12145 if (ret < 0)
12146 {
12147 community_list_perror (vty, ret);
12148 return CMD_WARNING;
12149 }
12150 return CMD_SUCCESS;
12151}
12152
paul94f2b392005-06-28 12:44:16 +000012153static int
hassofee6e4e2005-02-02 16:29:31 +000012154extcommunity_list_unset_vty (struct vty *vty, int argc, const char **argv,
12155 int style)
paul718e3742002-12-13 20:15:29 +000012156{
12157 int ret;
hassofee6e4e2005-02-02 16:29:31 +000012158 int direct = 0;
12159 char *str = NULL;
paul718e3742002-12-13 20:15:29 +000012160
hassofee6e4e2005-02-02 16:29:31 +000012161 if (argc > 1)
paul718e3742002-12-13 20:15:29 +000012162 {
hassofee6e4e2005-02-02 16:29:31 +000012163 /* Check the list direct. */
12164 if (strncmp (argv[1], "p", 1) == 0)
12165 direct = COMMUNITY_PERMIT;
12166 else if (strncmp (argv[1], "d", 1) == 0)
12167 direct = COMMUNITY_DENY;
12168 else
12169 {
12170 vty_out (vty, "%% Matching condition must be permit or deny%s",
12171 VTY_NEWLINE);
12172 return CMD_WARNING;
12173 }
12174
12175 /* Concat community string argument. */
12176 str = argv_concat (argv, argc, 2);
paul718e3742002-12-13 20:15:29 +000012177 }
paul718e3742002-12-13 20:15:29 +000012178
12179 /* Unset community list. */
12180 ret = extcommunity_list_unset (bgp_clist, argv[0], str, direct, style);
12181
12182 /* Free temporary community list string allocated by
12183 argv_concat(). */
hassofee6e4e2005-02-02 16:29:31 +000012184 if (str)
12185 XFREE (MTYPE_TMP, str);
paul718e3742002-12-13 20:15:29 +000012186
12187 if (ret < 0)
12188 {
12189 community_list_perror (vty, ret);
12190 return CMD_WARNING;
12191 }
12192
12193 return CMD_SUCCESS;
12194}
12195
12196/* "extcommunity-list" keyword help string. */
12197#define EXTCOMMUNITY_LIST_STR "Add a extended community list entry\n"
12198#define EXTCOMMUNITY_VAL_STR "Extended community attribute in 'rt aa:nn_or_IPaddr:nn' OR 'soo aa:nn_or_IPaddr:nn' format\n"
12199
12200DEFUN (ip_extcommunity_list_standard,
12201 ip_extcommunity_list_standard_cmd,
12202 "ip extcommunity-list <1-99> (deny|permit) .AA:NN",
12203 IP_STR
12204 EXTCOMMUNITY_LIST_STR
12205 "Extended Community list number (standard)\n"
12206 "Specify community to reject\n"
12207 "Specify community to accept\n"
12208 EXTCOMMUNITY_VAL_STR)
12209{
12210 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0);
12211}
12212
12213ALIAS (ip_extcommunity_list_standard,
12214 ip_extcommunity_list_standard2_cmd,
12215 "ip extcommunity-list <1-99> (deny|permit)",
12216 IP_STR
12217 EXTCOMMUNITY_LIST_STR
12218 "Extended Community list number (standard)\n"
12219 "Specify community to reject\n"
12220 "Specify community to accept\n")
12221
12222DEFUN (ip_extcommunity_list_expanded,
12223 ip_extcommunity_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000012224 "ip extcommunity-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000012225 IP_STR
12226 EXTCOMMUNITY_LIST_STR
12227 "Extended Community list number (expanded)\n"
12228 "Specify community to reject\n"
12229 "Specify community to accept\n"
12230 "An ordered list as a regular-expression\n")
12231{
12232 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0);
12233}
12234
12235DEFUN (ip_extcommunity_list_name_standard,
12236 ip_extcommunity_list_name_standard_cmd,
12237 "ip extcommunity-list standard WORD (deny|permit) .AA:NN",
12238 IP_STR
12239 EXTCOMMUNITY_LIST_STR
12240 "Specify standard extcommunity-list\n"
12241 "Extended Community list name\n"
12242 "Specify community to reject\n"
12243 "Specify community to accept\n"
12244 EXTCOMMUNITY_VAL_STR)
12245{
12246 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1);
12247}
12248
12249ALIAS (ip_extcommunity_list_name_standard,
12250 ip_extcommunity_list_name_standard2_cmd,
12251 "ip extcommunity-list standard WORD (deny|permit)",
12252 IP_STR
12253 EXTCOMMUNITY_LIST_STR
12254 "Specify standard extcommunity-list\n"
12255 "Extended Community list name\n"
12256 "Specify community to reject\n"
12257 "Specify community to accept\n")
12258
12259DEFUN (ip_extcommunity_list_name_expanded,
12260 ip_extcommunity_list_name_expanded_cmd,
12261 "ip extcommunity-list expanded WORD (deny|permit) .LINE",
12262 IP_STR
12263 EXTCOMMUNITY_LIST_STR
12264 "Specify expanded extcommunity-list\n"
12265 "Extended Community list name\n"
12266 "Specify community to reject\n"
12267 "Specify community to accept\n"
12268 "An ordered list as a regular-expression\n")
12269{
12270 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1);
12271}
12272
hassofee6e4e2005-02-02 16:29:31 +000012273DEFUN (no_ip_extcommunity_list_standard_all,
12274 no_ip_extcommunity_list_standard_all_cmd,
12275 "no ip extcommunity-list <1-99>",
paul718e3742002-12-13 20:15:29 +000012276 NO_STR
12277 IP_STR
12278 EXTCOMMUNITY_LIST_STR
hassofee6e4e2005-02-02 16:29:31 +000012279 "Extended Community list number (standard)\n")
paul718e3742002-12-13 20:15:29 +000012280{
hassofee6e4e2005-02-02 16:29:31 +000012281 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
paul718e3742002-12-13 20:15:29 +000012282}
12283
hassofee6e4e2005-02-02 16:29:31 +000012284DEFUN (no_ip_extcommunity_list_expanded_all,
12285 no_ip_extcommunity_list_expanded_all_cmd,
12286 "no ip extcommunity-list <100-500>",
12287 NO_STR
12288 IP_STR
12289 EXTCOMMUNITY_LIST_STR
12290 "Extended Community list number (expanded)\n")
12291{
12292 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
12293}
12294
12295DEFUN (no_ip_extcommunity_list_name_standard_all,
12296 no_ip_extcommunity_list_name_standard_all_cmd,
12297 "no ip extcommunity-list standard WORD",
paul718e3742002-12-13 20:15:29 +000012298 NO_STR
12299 IP_STR
12300 EXTCOMMUNITY_LIST_STR
12301 "Specify standard extcommunity-list\n"
hassofee6e4e2005-02-02 16:29:31 +000012302 "Extended Community list name\n")
12303{
12304 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
12305}
12306
12307DEFUN (no_ip_extcommunity_list_name_expanded_all,
12308 no_ip_extcommunity_list_name_expanded_all_cmd,
12309 "no ip extcommunity-list expanded WORD",
12310 NO_STR
12311 IP_STR
12312 EXTCOMMUNITY_LIST_STR
paul718e3742002-12-13 20:15:29 +000012313 "Specify expanded extcommunity-list\n"
12314 "Extended Community list name\n")
12315{
hassofee6e4e2005-02-02 16:29:31 +000012316 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
paul718e3742002-12-13 20:15:29 +000012317}
12318
12319DEFUN (no_ip_extcommunity_list_standard,
12320 no_ip_extcommunity_list_standard_cmd,
12321 "no ip extcommunity-list <1-99> (deny|permit) .AA:NN",
12322 NO_STR
12323 IP_STR
12324 EXTCOMMUNITY_LIST_STR
12325 "Extended Community list number (standard)\n"
12326 "Specify community to reject\n"
12327 "Specify community to accept\n"
12328 EXTCOMMUNITY_VAL_STR)
12329{
12330 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
12331}
12332
12333DEFUN (no_ip_extcommunity_list_expanded,
12334 no_ip_extcommunity_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000012335 "no ip extcommunity-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000012336 NO_STR
12337 IP_STR
12338 EXTCOMMUNITY_LIST_STR
12339 "Extended Community list number (expanded)\n"
12340 "Specify community to reject\n"
12341 "Specify community to accept\n"
12342 "An ordered list as a regular-expression\n")
12343{
12344 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
12345}
12346
12347DEFUN (no_ip_extcommunity_list_name_standard,
12348 no_ip_extcommunity_list_name_standard_cmd,
12349 "no ip extcommunity-list standard WORD (deny|permit) .AA:NN",
12350 NO_STR
12351 IP_STR
12352 EXTCOMMUNITY_LIST_STR
12353 "Specify standard extcommunity-list\n"
12354 "Extended Community list name\n"
12355 "Specify community to reject\n"
12356 "Specify community to accept\n"
12357 EXTCOMMUNITY_VAL_STR)
12358{
12359 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
12360}
12361
12362DEFUN (no_ip_extcommunity_list_name_expanded,
12363 no_ip_extcommunity_list_name_expanded_cmd,
12364 "no ip extcommunity-list expanded WORD (deny|permit) .LINE",
12365 NO_STR
12366 IP_STR
12367 EXTCOMMUNITY_LIST_STR
12368 "Specify expanded extcommunity-list\n"
12369 "Community list name\n"
12370 "Specify community to reject\n"
12371 "Specify community to accept\n"
12372 "An ordered list as a regular-expression\n")
12373{
12374 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
12375}
12376
paul94f2b392005-06-28 12:44:16 +000012377static void
paul718e3742002-12-13 20:15:29 +000012378extcommunity_list_show (struct vty *vty, struct community_list *list)
12379{
12380 struct community_entry *entry;
12381
12382 for (entry = list->head; entry; entry = entry->next)
12383 {
12384 if (entry == list->head)
12385 {
12386 if (all_digit (list->name))
12387 vty_out (vty, "Extended community %s list %s%s",
12388 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
12389 "standard" : "(expanded) access",
12390 list->name, VTY_NEWLINE);
12391 else
12392 vty_out (vty, "Named extended community %s list %s%s",
12393 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
12394 "standard" : "expanded",
12395 list->name, VTY_NEWLINE);
12396 }
12397 if (entry->any)
12398 vty_out (vty, " %s%s",
12399 community_direct_str (entry->direct), VTY_NEWLINE);
12400 else
12401 vty_out (vty, " %s %s%s",
12402 community_direct_str (entry->direct),
12403 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
12404 entry->u.ecom->str : entry->config,
12405 VTY_NEWLINE);
12406 }
12407}
12408
12409DEFUN (show_ip_extcommunity_list,
12410 show_ip_extcommunity_list_cmd,
12411 "show ip extcommunity-list",
12412 SHOW_STR
12413 IP_STR
12414 "List extended-community list\n")
12415{
12416 struct community_list *list;
12417 struct community_list_master *cm;
12418
hassofee6e4e2005-02-02 16:29:31 +000012419 cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000012420 if (! cm)
12421 return CMD_SUCCESS;
12422
12423 for (list = cm->num.head; list; list = list->next)
12424 extcommunity_list_show (vty, list);
12425
12426 for (list = cm->str.head; list; list = list->next)
12427 extcommunity_list_show (vty, list);
12428
12429 return CMD_SUCCESS;
12430}
12431
12432DEFUN (show_ip_extcommunity_list_arg,
12433 show_ip_extcommunity_list_arg_cmd,
hassofee6e4e2005-02-02 16:29:31 +000012434 "show ip extcommunity-list (<1-500>|WORD)",
paul718e3742002-12-13 20:15:29 +000012435 SHOW_STR
12436 IP_STR
12437 "List extended-community list\n"
12438 "Extcommunity-list number\n"
12439 "Extcommunity-list name\n")
12440{
12441 struct community_list *list;
12442
hassofee6e4e2005-02-02 16:29:31 +000012443 list = community_list_lookup (bgp_clist, argv[0], EXTCOMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000012444 if (! list)
12445 {
Denis Ovsienkob7292942010-12-08 18:51:37 +030012446 vty_out (vty, "%% Can't find extcommunity-list%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000012447 return CMD_WARNING;
12448 }
12449
12450 extcommunity_list_show (vty, list);
12451
12452 return CMD_SUCCESS;
12453}
David Lamparter6b0655a2014-06-04 06:53:35 +020012454
paul718e3742002-12-13 20:15:29 +000012455/* Return configuration string of community-list entry. */
paulfd79ac92004-10-13 05:06:08 +000012456static const char *
paul718e3742002-12-13 20:15:29 +000012457community_list_config_str (struct community_entry *entry)
12458{
paulfd79ac92004-10-13 05:06:08 +000012459 const char *str;
paul718e3742002-12-13 20:15:29 +000012460
12461 if (entry->any)
12462 str = "";
12463 else
12464 {
12465 if (entry->style == COMMUNITY_LIST_STANDARD)
12466 str = community_str (entry->u.com);
12467 else
12468 str = entry->config;
12469 }
12470 return str;
12471}
12472
12473/* Display community-list and extcommunity-list configuration. */
paul94f2b392005-06-28 12:44:16 +000012474static int
paul718e3742002-12-13 20:15:29 +000012475community_list_config_write (struct vty *vty)
12476{
12477 struct community_list *list;
12478 struct community_entry *entry;
12479 struct community_list_master *cm;
12480 int write = 0;
12481
12482 /* Community-list. */
hassofee6e4e2005-02-02 16:29:31 +000012483 cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000012484
12485 for (list = cm->num.head; list; list = list->next)
12486 for (entry = list->head; entry; entry = entry->next)
12487 {
hassofee6e4e2005-02-02 16:29:31 +000012488 vty_out (vty, "ip community-list %s %s %s%s",
12489 list->name, community_direct_str (entry->direct),
12490 community_list_config_str (entry),
12491 VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000012492 write++;
12493 }
12494 for (list = cm->str.head; list; list = list->next)
12495 for (entry = list->head; entry; entry = entry->next)
12496 {
12497 vty_out (vty, "ip community-list %s %s %s %s%s",
12498 entry->style == COMMUNITY_LIST_STANDARD
12499 ? "standard" : "expanded",
12500 list->name, community_direct_str (entry->direct),
12501 community_list_config_str (entry),
12502 VTY_NEWLINE);
12503 write++;
12504 }
12505
12506 /* Extcommunity-list. */
hassofee6e4e2005-02-02 16:29:31 +000012507 cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000012508
12509 for (list = cm->num.head; list; list = list->next)
12510 for (entry = list->head; entry; entry = entry->next)
12511 {
hassofee6e4e2005-02-02 16:29:31 +000012512 vty_out (vty, "ip extcommunity-list %s %s %s%s",
12513 list->name, community_direct_str (entry->direct),
12514 community_list_config_str (entry), VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000012515 write++;
12516 }
12517 for (list = cm->str.head; list; list = list->next)
12518 for (entry = list->head; entry; entry = entry->next)
12519 {
12520 vty_out (vty, "ip extcommunity-list %s %s %s %s%s",
12521 entry->style == EXTCOMMUNITY_LIST_STANDARD
12522 ? "standard" : "expanded",
12523 list->name, community_direct_str (entry->direct),
12524 community_list_config_str (entry), VTY_NEWLINE);
12525 write++;
12526 }
Job Snijders3334bab2017-01-20 14:47:12 +000012527
12528
12529 /* lcommunity-list. */
12530 cm = community_list_master_lookup (bgp_clist, LARGE_COMMUNITY_LIST_MASTER);
12531
12532 for (list = cm->num.head; list; list = list->next)
12533 for (entry = list->head; entry; entry = entry->next)
12534 {
12535 vty_out (vty, "ip large-community-list %s %s %s%s",
12536 list->name, community_direct_str (entry->direct),
12537 community_list_config_str (entry), VTY_NEWLINE);
12538 write++;
12539 }
12540 for (list = cm->str.head; list; list = list->next)
12541 for (entry = list->head; entry; entry = entry->next)
12542 {
12543 vty_out (vty, "ip large-community-list %s %s %s %s%s",
12544 entry->style == LARGE_COMMUNITY_LIST_STANDARD
12545 ? "standard" : "expanded",
12546 list->name, community_direct_str (entry->direct),
12547 community_list_config_str (entry), VTY_NEWLINE);
12548 write++;
12549 }
12550
paul718e3742002-12-13 20:15:29 +000012551 return write;
12552}
12553
Stephen Hemminger7fc626d2008-12-01 11:10:34 -080012554static struct cmd_node community_list_node =
paul718e3742002-12-13 20:15:29 +000012555{
12556 COMMUNITY_LIST_NODE,
12557 "",
12558 1 /* Export to vtysh. */
12559};
12560
paul94f2b392005-06-28 12:44:16 +000012561static void
12562community_list_vty (void)
paul718e3742002-12-13 20:15:29 +000012563{
12564 install_node (&community_list_node, community_list_config_write);
12565
12566 /* Community-list. */
paul718e3742002-12-13 20:15:29 +000012567 install_element (CONFIG_NODE, &ip_community_list_standard_cmd);
12568 install_element (CONFIG_NODE, &ip_community_list_standard2_cmd);
12569 install_element (CONFIG_NODE, &ip_community_list_expanded_cmd);
12570 install_element (CONFIG_NODE, &ip_community_list_name_standard_cmd);
12571 install_element (CONFIG_NODE, &ip_community_list_name_standard2_cmd);
12572 install_element (CONFIG_NODE, &ip_community_list_name_expanded_cmd);
hassofee6e4e2005-02-02 16:29:31 +000012573 install_element (CONFIG_NODE, &no_ip_community_list_standard_all_cmd);
12574 install_element (CONFIG_NODE, &no_ip_community_list_expanded_all_cmd);
12575 install_element (CONFIG_NODE, &no_ip_community_list_name_standard_all_cmd);
12576 install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_all_cmd);
paul718e3742002-12-13 20:15:29 +000012577 install_element (CONFIG_NODE, &no_ip_community_list_standard_cmd);
12578 install_element (CONFIG_NODE, &no_ip_community_list_expanded_cmd);
12579 install_element (CONFIG_NODE, &no_ip_community_list_name_standard_cmd);
12580 install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_cmd);
12581 install_element (VIEW_NODE, &show_ip_community_list_cmd);
12582 install_element (VIEW_NODE, &show_ip_community_list_arg_cmd);
paul718e3742002-12-13 20:15:29 +000012583
12584 /* Extcommunity-list. */
12585 install_element (CONFIG_NODE, &ip_extcommunity_list_standard_cmd);
12586 install_element (CONFIG_NODE, &ip_extcommunity_list_standard2_cmd);
12587 install_element (CONFIG_NODE, &ip_extcommunity_list_expanded_cmd);
12588 install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard_cmd);
12589 install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard2_cmd);
12590 install_element (CONFIG_NODE, &ip_extcommunity_list_name_expanded_cmd);
hassofee6e4e2005-02-02 16:29:31 +000012591 install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_all_cmd);
12592 install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_all_cmd);
12593 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_all_cmd);
12594 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_all_cmd);
paul718e3742002-12-13 20:15:29 +000012595 install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_cmd);
12596 install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_cmd);
12597 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_cmd);
12598 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_cmd);
12599 install_element (VIEW_NODE, &show_ip_extcommunity_list_cmd);
12600 install_element (VIEW_NODE, &show_ip_extcommunity_list_arg_cmd);
Job Snijders3334bab2017-01-20 14:47:12 +000012601
12602 /* Large Community List */
12603 install_element (CONFIG_NODE, &ip_lcommunity_list_standard_cmd);
12604 install_element (CONFIG_NODE, &ip_lcommunity_list_standard2_cmd);
12605 install_element (CONFIG_NODE, &ip_lcommunity_list_expanded_cmd);
12606 install_element (CONFIG_NODE, &ip_lcommunity_list_name_standard_cmd);
12607 install_element (CONFIG_NODE, &ip_lcommunity_list_name_standard2_cmd);
12608 install_element (CONFIG_NODE, &ip_lcommunity_list_name_expanded_cmd);
12609 install_element (CONFIG_NODE, &no_ip_lcommunity_list_standard_all_cmd);
12610 install_element (CONFIG_NODE, &no_ip_lcommunity_list_expanded_all_cmd);
12611 install_element (CONFIG_NODE, &no_ip_lcommunity_list_name_standard_all_cmd);
12612 install_element (CONFIG_NODE, &no_ip_lcommunity_list_name_expanded_all_cmd);
12613 install_element (CONFIG_NODE, &no_ip_lcommunity_list_standard_cmd);
12614 install_element (CONFIG_NODE, &no_ip_lcommunity_list_expanded_cmd);
12615 install_element (CONFIG_NODE, &no_ip_lcommunity_list_name_standard_cmd);
12616 install_element (CONFIG_NODE, &no_ip_lcommunity_list_name_expanded_cmd);
12617 install_element (VIEW_NODE, &show_ip_lcommunity_list_cmd);
12618 install_element (VIEW_NODE, &show_ip_lcommunity_list_arg_cmd);
paul718e3742002-12-13 20:15:29 +000012619}