blob: 925e2676fd04cefa5e3717b846ee49bbe0baffd9 [file] [log] [blame]
paul718e3742002-12-13 20:15:29 +00001/* BGP VTY interface.
2 Copyright (C) 1996, 97, 98, 99, 2000 Kunihiro Ishiguro
3
4This file is part of GNU Zebra.
5
6GNU Zebra is free software; you can redistribute it and/or modify it
7under the terms of the GNU General Public License as published by the
8Free Software Foundation; either version 2, or (at your option) any
9later version.
10
11GNU Zebra is distributed in the hope that it will be useful, but
12WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with GNU Zebra; see the file COPYING. If not, write to the Free
18Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
1902111-1307, USA. */
20
21#include <zebra.h>
22
23#include "command.h"
24#include "prefix.h"
25#include "plist.h"
26#include "buffer.h"
27#include "linklist.h"
28#include "stream.h"
29#include "thread.h"
30#include "log.h"
ajs3b8b1852005-01-29 18:19:13 +000031#include "memory.h"
Paul Jakma4bf6a362006-03-30 14:05:23 +000032#include "hash.h"
Donald Sharp04907292016-01-07 10:03:01 -050033#include "filter.h"
paul718e3742002-12-13 20:15:29 +000034
35#include "bgpd/bgpd.h"
Paul Jakma4bf6a362006-03-30 14:05:23 +000036#include "bgpd/bgp_advertise.h"
paul718e3742002-12-13 20:15:29 +000037#include "bgpd/bgp_attr.h"
38#include "bgpd/bgp_aspath.h"
39#include "bgpd/bgp_community.h"
Paul Jakma4bf6a362006-03-30 14:05:23 +000040#include "bgpd/bgp_ecommunity.h"
41#include "bgpd/bgp_damp.h"
paul718e3742002-12-13 20:15:29 +000042#include "bgpd/bgp_debug.h"
hassoe0701b72004-05-20 09:19:34 +000043#include "bgpd/bgp_fsm.h"
paul718e3742002-12-13 20:15:29 +000044#include "bgpd/bgp_mplsvpn.h"
Paul Jakma4bf6a362006-03-30 14:05:23 +000045#include "bgpd/bgp_nexthop.h"
paul718e3742002-12-13 20:15:29 +000046#include "bgpd/bgp_open.h"
Paul Jakma4bf6a362006-03-30 14:05:23 +000047#include "bgpd/bgp_regex.h"
paul718e3742002-12-13 20:15:29 +000048#include "bgpd/bgp_route.h"
49#include "bgpd/bgp_zebra.h"
paulfee0f4c2004-09-13 05:12:46 +000050#include "bgpd/bgp_table.h"
paul94f2b392005-06-28 12:44:16 +000051#include "bgpd/bgp_vty.h"
Josh Bailey165b5ff2011-07-20 20:43:22 -070052#include "bgpd/bgp_mpath.h"
paul718e3742002-12-13 20:15:29 +000053
54/* Utility function to get address family from current node. */
55afi_t
56bgp_node_afi (struct vty *vty)
57{
Lou Berger135ca152016-01-12 13:42:05 -050058 afi_t afi;
Lou Berger13c378d2016-01-12 13:41:56 -050059 switch (vty->node)
60 {
61 case BGP_IPV6_NODE:
62 case BGP_IPV6M_NODE:
63 case BGP_VPNV6_NODE:
Lou Bergera3fda882016-01-12 13:42:04 -050064 case BGP_ENCAPV6_NODE:
Lou Berger135ca152016-01-12 13:42:05 -050065 afi = AFI_IP6;
66 break;
67 default:
68 afi = AFI_IP;
Lou Berger13c378d2016-01-12 13:41:56 -050069 break;
70 }
Lou Berger135ca152016-01-12 13:42:05 -050071 return afi;
paul718e3742002-12-13 20:15:29 +000072}
73
74/* Utility function to get subsequent address family from current
75 node. */
76safi_t
77bgp_node_safi (struct vty *vty)
78{
Lou Berger135ca152016-01-12 13:42:05 -050079 safi_t safi;
80 switch (vty->node)
81 {
82 case BGP_ENCAP_NODE:
83 case BGP_ENCAPV6_NODE:
84 safi = SAFI_ENCAP;
85 break;
86 case BGP_VPNV4_NODE:
87 case BGP_VPNV6_NODE:
88 safi = SAFI_MPLS_VPN;
89 break;
90 case BGP_IPV4M_NODE:
91 case BGP_IPV6M_NODE:
92 safi = SAFI_MULTICAST;
93 break;
94 default:
95 safi = SAFI_UNICAST;
96 break;
97 }
98 return safi;
paul718e3742002-12-13 20:15:29 +000099}
100
Lou Bergera3fda882016-01-12 13:42:04 -0500101int
102bgp_parse_afi(const char *str, afi_t *afi)
103{
104 if (!strcmp(str, "ipv4")) {
105 *afi = AFI_IP;
106 return 0;
107 }
Lou Bergera3fda882016-01-12 13:42:04 -0500108 if (!strcmp(str, "ipv6")) {
109 *afi = AFI_IP6;
110 return 0;
111 }
Lou Bergera3fda882016-01-12 13:42:04 -0500112 return -1;
113}
114
115int
116bgp_parse_safi(const char *str, safi_t *safi)
117{
118 if (!strcmp(str, "encap")) {
119 *safi = SAFI_ENCAP;
120 return 0;
121 }
122 if (!strcmp(str, "multicast")) {
123 *safi = SAFI_MULTICAST;
124 return 0;
125 }
126 if (!strcmp(str, "unicast")) {
127 *safi = SAFI_UNICAST;
128 return 0;
129 }
130 if (!strcmp(str, "vpn")) {
131 *safi = SAFI_MPLS_VPN;
132 return 0;
133 }
134 return -1;
135}
136
paul94f2b392005-06-28 12:44:16 +0000137static int
paul718e3742002-12-13 20:15:29 +0000138peer_address_self_check (union sockunion *su)
139{
140 struct interface *ifp = NULL;
141
142 if (su->sa.sa_family == AF_INET)
143 ifp = if_lookup_by_ipv4_exact (&su->sin.sin_addr);
paul718e3742002-12-13 20:15:29 +0000144 else if (su->sa.sa_family == AF_INET6)
145 ifp = if_lookup_by_ipv6_exact (&su->sin6.sin6_addr);
paul718e3742002-12-13 20:15:29 +0000146
147 if (ifp)
148 return 1;
149
150 return 0;
151}
152
153/* Utility function for looking up peer from VTY. */
paul94f2b392005-06-28 12:44:16 +0000154static struct peer *
paulfd79ac92004-10-13 05:06:08 +0000155peer_lookup_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +0000156{
157 int ret;
158 struct bgp *bgp;
159 union sockunion su;
160 struct peer *peer;
161
162 bgp = vty->index;
163
164 ret = str2sockunion (ip_str, &su);
165 if (ret < 0)
166 {
167 vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE);
168 return NULL;
169 }
170
171 peer = peer_lookup (bgp, &su);
172 if (! peer)
173 {
174 vty_out (vty, "%% Specify remote-as or peer-group commands first%s", VTY_NEWLINE);
175 return NULL;
176 }
177 return peer;
178}
179
180/* Utility function for looking up peer or peer group. */
paul94f2b392005-06-28 12:44:16 +0000181static struct peer *
paulfd79ac92004-10-13 05:06:08 +0000182peer_and_group_lookup_vty (struct vty *vty, const char *peer_str)
paul718e3742002-12-13 20:15:29 +0000183{
184 int ret;
185 struct bgp *bgp;
186 union sockunion su;
187 struct peer *peer;
188 struct peer_group *group;
189
190 bgp = vty->index;
191
192 ret = str2sockunion (peer_str, &su);
193 if (ret == 0)
194 {
195 peer = peer_lookup (bgp, &su);
196 if (peer)
197 return peer;
198 }
199 else
200 {
201 group = peer_group_lookup (bgp, peer_str);
202 if (group)
203 return group->conf;
204 }
205
206 vty_out (vty, "%% Specify remote-as or peer-group commands first%s",
207 VTY_NEWLINE);
208
209 return NULL;
210}
211
paul94f2b392005-06-28 12:44:16 +0000212static int
paul718e3742002-12-13 20:15:29 +0000213bgp_vty_return (struct vty *vty, int ret)
214{
paulfd79ac92004-10-13 05:06:08 +0000215 const char *str = NULL;
paul718e3742002-12-13 20:15:29 +0000216
217 switch (ret)
218 {
219 case BGP_ERR_INVALID_VALUE:
220 str = "Invalid value";
221 break;
222 case BGP_ERR_INVALID_FLAG:
223 str = "Invalid flag";
224 break;
225 case BGP_ERR_PEER_INACTIVE:
226 str = "Activate the neighbor for the address family first";
227 break;
228 case BGP_ERR_INVALID_FOR_PEER_GROUP_MEMBER:
229 str = "Invalid command for a peer-group member";
230 break;
231 case BGP_ERR_PEER_GROUP_SHUTDOWN:
232 str = "Peer-group has been shutdown. Activate the peer-group first";
233 break;
234 case BGP_ERR_PEER_GROUP_HAS_THE_FLAG:
235 str = "This peer is a peer-group member. Please change peer-group configuration";
236 break;
237 case BGP_ERR_PEER_FLAG_CONFLICT:
238 str = "Can't set override-capability and strict-capability-match at the same time";
239 break;
240 case BGP_ERR_PEER_GROUP_MEMBER_EXISTS:
241 str = "No activate for peergroup can be given only if peer-group has no members";
242 break;
243 case BGP_ERR_PEER_BELONGS_TO_GROUP:
244 str = "No activate for an individual peer-group member is invalid";
245 break;
246 case BGP_ERR_PEER_GROUP_AF_UNCONFIGURED:
247 str = "Activate the peer-group for the address family first";
248 break;
249 case BGP_ERR_PEER_GROUP_NO_REMOTE_AS:
250 str = "Specify remote-as or peer-group remote AS first";
251 break;
252 case BGP_ERR_PEER_GROUP_CANT_CHANGE:
253 str = "Cannot change the peer-group. Deconfigure first";
254 break;
255 case BGP_ERR_PEER_GROUP_MISMATCH:
256 str = "Cannot have different peer-group for the neighbor";
257 break;
258 case BGP_ERR_PEER_FILTER_CONFLICT:
259 str = "Prefix/distribute list can not co-exist";
260 break;
261 case BGP_ERR_NOT_INTERNAL_PEER:
262 str = "Invalid command. Not an internal neighbor";
263 break;
264 case BGP_ERR_REMOVE_PRIVATE_AS:
265 str = "Private AS cannot be removed for IBGP peers";
266 break;
267 case BGP_ERR_LOCAL_AS_ALLOWED_ONLY_FOR_EBGP:
268 str = "Local-AS allowed only for EBGP peers";
269 break;
270 case BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS:
271 str = "Cannot have local-as same as BGP AS number";
272 break;
Paul Jakma0df7c912008-07-21 21:02:49 +0000273 case BGP_ERR_TCPSIG_FAILED:
274 str = "Error while applying TCP-Sig to session(s)";
275 break;
Nick Hilliardfa411a22011-03-23 15:33:17 +0000276 case BGP_ERR_NO_EBGP_MULTIHOP_WITH_TTLHACK:
277 str = "ebgp-multihop and ttl-security cannot be configured together";
278 break;
Stephen Hemmingerf5a48272011-03-24 17:30:21 +0000279 case BGP_ERR_NO_IBGP_WITH_TTLHACK:
280 str = "ttl-security only allowed for EBGP peers";
281 break;
paul718e3742002-12-13 20:15:29 +0000282 }
283 if (str)
284 {
285 vty_out (vty, "%% %s%s", str, VTY_NEWLINE);
286 return CMD_WARNING;
287 }
288 return CMD_SUCCESS;
289}
290
291/* BGP global configuration. */
292
293DEFUN (bgp_multiple_instance_func,
294 bgp_multiple_instance_cmd,
295 "bgp multiple-instance",
296 BGP_STR
297 "Enable bgp multiple instance\n")
298{
299 bgp_option_set (BGP_OPT_MULTIPLE_INSTANCE);
300 return CMD_SUCCESS;
301}
302
303DEFUN (no_bgp_multiple_instance,
304 no_bgp_multiple_instance_cmd,
305 "no bgp multiple-instance",
306 NO_STR
307 BGP_STR
308 "BGP multiple instance\n")
309{
310 int ret;
311
312 ret = bgp_option_unset (BGP_OPT_MULTIPLE_INSTANCE);
313 if (ret < 0)
314 {
315 vty_out (vty, "%% There are more than two BGP instances%s", VTY_NEWLINE);
316 return CMD_WARNING;
317 }
318 return CMD_SUCCESS;
319}
320
321DEFUN (bgp_config_type,
322 bgp_config_type_cmd,
323 "bgp config-type (cisco|zebra)",
324 BGP_STR
325 "Configuration type\n"
326 "cisco\n"
327 "zebra\n")
328{
329 if (strncmp (argv[0], "c", 1) == 0)
330 bgp_option_set (BGP_OPT_CONFIG_CISCO);
331 else
332 bgp_option_unset (BGP_OPT_CONFIG_CISCO);
333
334 return CMD_SUCCESS;
335}
336
337DEFUN (no_bgp_config_type,
338 no_bgp_config_type_cmd,
339 "no bgp config-type",
340 NO_STR
341 BGP_STR
342 "Display configuration type\n")
343{
344 bgp_option_unset (BGP_OPT_CONFIG_CISCO);
345 return CMD_SUCCESS;
346}
347
348DEFUN (no_synchronization,
349 no_synchronization_cmd,
350 "no synchronization",
351 NO_STR
352 "Perform IGP synchronization\n")
353{
354 return CMD_SUCCESS;
355}
356
357DEFUN (no_auto_summary,
358 no_auto_summary_cmd,
359 "no auto-summary",
360 NO_STR
361 "Enable automatic network number summarization\n")
362{
363 return CMD_SUCCESS;
364}
hasso3d515fd2005-02-01 21:30:04 +0000365
366DEFUN_DEPRECATED (neighbor_version,
367 neighbor_version_cmd,
368 NEIGHBOR_CMD "version (4|4-)",
369 NEIGHBOR_STR
370 NEIGHBOR_ADDR_STR
371 "Set the BGP version to match a neighbor\n"
372 "Neighbor's BGP version\n")
373{
374 return CMD_SUCCESS;
375}
David Lamparter6b0655a2014-06-04 06:53:35 +0200376
paul718e3742002-12-13 20:15:29 +0000377/* "router bgp" commands. */
378DEFUN (router_bgp,
379 router_bgp_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000380 "router bgp " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000381 ROUTER_STR
382 BGP_STR
383 AS_STR)
384{
385 int ret;
386 as_t as;
387 struct bgp *bgp;
paulfd79ac92004-10-13 05:06:08 +0000388 const char *name = NULL;
paul718e3742002-12-13 20:15:29 +0000389
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000390 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +0000391
392 if (argc == 2)
393 name = argv[1];
394
395 ret = bgp_get (&bgp, &as, name);
396 switch (ret)
397 {
398 case BGP_ERR_MULTIPLE_INSTANCE_NOT_SET:
399 vty_out (vty, "Please specify 'bgp multiple-instance' first%s",
400 VTY_NEWLINE);
401 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +0000402 case BGP_ERR_AS_MISMATCH:
Denis Ovsienkoaea339f2009-04-30 17:16:22 +0400403 vty_out (vty, "BGP is already running; AS is %u%s", as, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +0000404 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +0000405 case BGP_ERR_INSTANCE_MISMATCH:
406 vty_out (vty, "BGP view name and AS number mismatch%s", VTY_NEWLINE);
Denis Ovsienkoaea339f2009-04-30 17:16:22 +0400407 vty_out (vty, "BGP instance is already running; AS is %u%s",
paul718e3742002-12-13 20:15:29 +0000408 as, VTY_NEWLINE);
409 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +0000410 }
411
412 vty->node = BGP_NODE;
413 vty->index = bgp;
414
415 return CMD_SUCCESS;
416}
417
418ALIAS (router_bgp,
419 router_bgp_view_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000420 "router bgp " CMD_AS_RANGE " view WORD",
paul718e3742002-12-13 20:15:29 +0000421 ROUTER_STR
422 BGP_STR
423 AS_STR
424 "BGP view\n"
425 "view name\n")
David Lamparter6b0655a2014-06-04 06:53:35 +0200426
paul718e3742002-12-13 20:15:29 +0000427/* "no router bgp" commands. */
428DEFUN (no_router_bgp,
429 no_router_bgp_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000430 "no router bgp " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000431 NO_STR
432 ROUTER_STR
433 BGP_STR
434 AS_STR)
435{
436 as_t as;
437 struct bgp *bgp;
paulfd79ac92004-10-13 05:06:08 +0000438 const char *name = NULL;
paul718e3742002-12-13 20:15:29 +0000439
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000440 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +0000441
442 if (argc == 2)
443 name = argv[1];
444
445 /* Lookup bgp structure. */
446 bgp = bgp_lookup (as, name);
447 if (! bgp)
448 {
449 vty_out (vty, "%% Can't find BGP instance%s", VTY_NEWLINE);
450 return CMD_WARNING;
451 }
452
453 bgp_delete (bgp);
454
455 return CMD_SUCCESS;
456}
457
458ALIAS (no_router_bgp,
459 no_router_bgp_view_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000460 "no router bgp " CMD_AS_RANGE " view WORD",
paul718e3742002-12-13 20:15:29 +0000461 NO_STR
462 ROUTER_STR
463 BGP_STR
464 AS_STR
465 "BGP view\n"
466 "view name\n")
David Lamparter6b0655a2014-06-04 06:53:35 +0200467
paul718e3742002-12-13 20:15:29 +0000468/* BGP router-id. */
469
470DEFUN (bgp_router_id,
471 bgp_router_id_cmd,
472 "bgp router-id A.B.C.D",
473 BGP_STR
474 "Override configured router identifier\n"
475 "Manually configured router identifier\n")
476{
477 int ret;
478 struct in_addr id;
479 struct bgp *bgp;
480
481 bgp = vty->index;
482
483 ret = inet_aton (argv[0], &id);
484 if (! ret)
485 {
486 vty_out (vty, "%% Malformed bgp router identifier%s", VTY_NEWLINE);
487 return CMD_WARNING;
488 }
489
David Lamparter584083d2016-05-24 18:58:08 +0200490 bgp_router_id_static_set (bgp, id);
paul718e3742002-12-13 20:15:29 +0000491
492 return CMD_SUCCESS;
493}
494
495DEFUN (no_bgp_router_id,
496 no_bgp_router_id_cmd,
497 "no bgp router-id",
498 NO_STR
499 BGP_STR
500 "Override configured router identifier\n")
501{
502 int ret;
503 struct in_addr id;
504 struct bgp *bgp;
505
506 bgp = vty->index;
507
508 if (argc == 1)
509 {
510 ret = inet_aton (argv[0], &id);
511 if (! ret)
512 {
513 vty_out (vty, "%% Malformed BGP router identifier%s", VTY_NEWLINE);
514 return CMD_WARNING;
515 }
516
hasso18a6dce2004-10-03 18:18:34 +0000517 if (! IPV4_ADDR_SAME (&bgp->router_id_static, &id))
paul718e3742002-12-13 20:15:29 +0000518 {
519 vty_out (vty, "%% BGP router-id doesn't match%s", VTY_NEWLINE);
520 return CMD_WARNING;
521 }
522 }
523
David Lamparter584083d2016-05-24 18:58:08 +0200524 id.s_addr = 0;
525 bgp_router_id_static_set (bgp, id);
paul718e3742002-12-13 20:15:29 +0000526
527 return CMD_SUCCESS;
528}
529
530ALIAS (no_bgp_router_id,
531 no_bgp_router_id_val_cmd,
532 "no bgp router-id A.B.C.D",
533 NO_STR
534 BGP_STR
535 "Override configured router identifier\n"
536 "Manually configured router identifier\n")
David Lamparter6b0655a2014-06-04 06:53:35 +0200537
paul718e3742002-12-13 20:15:29 +0000538/* BGP Cluster ID. */
539
540DEFUN (bgp_cluster_id,
541 bgp_cluster_id_cmd,
542 "bgp cluster-id A.B.C.D",
543 BGP_STR
544 "Configure Route-Reflector Cluster-id\n"
545 "Route-Reflector Cluster-id in IP address format\n")
546{
547 int ret;
548 struct bgp *bgp;
549 struct in_addr cluster;
550
551 bgp = vty->index;
552
553 ret = inet_aton (argv[0], &cluster);
554 if (! ret)
555 {
556 vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE);
557 return CMD_WARNING;
558 }
559
560 bgp_cluster_id_set (bgp, &cluster);
561
562 return CMD_SUCCESS;
563}
564
565ALIAS (bgp_cluster_id,
566 bgp_cluster_id32_cmd,
567 "bgp cluster-id <1-4294967295>",
568 BGP_STR
569 "Configure Route-Reflector Cluster-id\n"
570 "Route-Reflector Cluster-id as 32 bit quantity\n")
571
572DEFUN (no_bgp_cluster_id,
573 no_bgp_cluster_id_cmd,
574 "no bgp cluster-id",
575 NO_STR
576 BGP_STR
577 "Configure Route-Reflector Cluster-id\n")
578{
579 int ret;
580 struct bgp *bgp;
581 struct in_addr cluster;
582
583 bgp = vty->index;
584
585 if (argc == 1)
586 {
587 ret = inet_aton (argv[0], &cluster);
588 if (! ret)
589 {
590 vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE);
591 return CMD_WARNING;
592 }
593 }
594
595 bgp_cluster_id_unset (bgp);
596
597 return CMD_SUCCESS;
598}
599
600ALIAS (no_bgp_cluster_id,
601 no_bgp_cluster_id_arg_cmd,
602 "no bgp cluster-id A.B.C.D",
603 NO_STR
604 BGP_STR
605 "Configure Route-Reflector Cluster-id\n"
606 "Route-Reflector Cluster-id in IP address format\n")
David Lamparter6b0655a2014-06-04 06:53:35 +0200607
paul718e3742002-12-13 20:15:29 +0000608DEFUN (bgp_confederation_identifier,
609 bgp_confederation_identifier_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000610 "bgp confederation identifier " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000611 "BGP specific commands\n"
612 "AS confederation parameters\n"
613 "AS number\n"
614 "Set routing domain confederation AS\n")
615{
616 struct bgp *bgp;
617 as_t as;
618
619 bgp = vty->index;
620
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000621 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +0000622
623 bgp_confederation_id_set (bgp, as);
624
625 return CMD_SUCCESS;
626}
627
628DEFUN (no_bgp_confederation_identifier,
629 no_bgp_confederation_identifier_cmd,
630 "no bgp confederation identifier",
631 NO_STR
632 "BGP specific commands\n"
633 "AS confederation parameters\n"
634 "AS number\n")
635{
636 struct bgp *bgp;
Paul Jakma7aa9dce2014-09-19 14:42:23 +0100637 as_t as __attribute__((unused)); /* Dummy for VTY_GET_INTEGER_RANGE */
paul718e3742002-12-13 20:15:29 +0000638
639 bgp = vty->index;
640
641 if (argc == 1)
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000642 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +0000643
644 bgp_confederation_id_unset (bgp);
645
646 return CMD_SUCCESS;
647}
648
649ALIAS (no_bgp_confederation_identifier,
650 no_bgp_confederation_identifier_arg_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000651 "no bgp confederation identifier " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000652 NO_STR
653 "BGP specific commands\n"
654 "AS confederation parameters\n"
655 "AS number\n"
656 "Set routing domain confederation AS\n")
David Lamparter6b0655a2014-06-04 06:53:35 +0200657
paul718e3742002-12-13 20:15:29 +0000658DEFUN (bgp_confederation_peers,
659 bgp_confederation_peers_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000660 "bgp confederation peers ." CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000661 "BGP specific commands\n"
662 "AS confederation parameters\n"
663 "Peer ASs in BGP confederation\n"
664 AS_STR)
665{
666 struct bgp *bgp;
667 as_t as;
668 int i;
669
670 bgp = vty->index;
671
672 for (i = 0; i < argc; i++)
673 {
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000674 VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +0000675
676 if (bgp->as == as)
677 {
678 vty_out (vty, "%% Local member-AS not allowed in confed peer list%s",
679 VTY_NEWLINE);
680 continue;
681 }
682
683 bgp_confederation_peers_add (bgp, as);
684 }
685 return CMD_SUCCESS;
686}
687
688DEFUN (no_bgp_confederation_peers,
689 no_bgp_confederation_peers_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000690 "no bgp confederation peers ." CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000691 NO_STR
692 "BGP specific commands\n"
693 "AS confederation parameters\n"
694 "Peer ASs in BGP confederation\n"
695 AS_STR)
696{
697 struct bgp *bgp;
698 as_t as;
699 int i;
700
701 bgp = vty->index;
702
703 for (i = 0; i < argc; i++)
704 {
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000705 VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX);
706
paul718e3742002-12-13 20:15:29 +0000707 bgp_confederation_peers_remove (bgp, as);
708 }
709 return CMD_SUCCESS;
710}
David Lamparter6b0655a2014-06-04 06:53:35 +0200711
Josh Bailey165b5ff2011-07-20 20:43:22 -0700712/* Maximum-paths configuration */
713DEFUN (bgp_maxpaths,
714 bgp_maxpaths_cmd,
Donald Sharpecc1a132015-12-09 08:24:47 -0500715 "maximum-paths " CMD_RANGE_STR(1, MULTIPATH_NUM),
Josh Bailey165b5ff2011-07-20 20:43:22 -0700716 "Forward packets over multiple paths\n"
717 "Number of paths\n")
718{
719 struct bgp *bgp;
720 u_int16_t maxpaths;
721 int ret;
722
723 bgp = vty->index;
724
725 VTY_GET_INTEGER_RANGE ("maximum-paths", maxpaths, argv[0], 1, 255);
726
727 ret = bgp_maximum_paths_set (bgp, bgp_node_afi (vty), bgp_node_safi(vty),
728 BGP_PEER_EBGP, maxpaths);
729 if (ret < 0)
730 {
731 vty_out (vty,
732 "%% Failed to set maximum-paths %u for afi %u, safi %u%s",
733 maxpaths, bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE);
734 return CMD_WARNING;
735 }
736
737 return CMD_SUCCESS;
738}
739
740DEFUN (bgp_maxpaths_ibgp,
741 bgp_maxpaths_ibgp_cmd,
Donald Sharpecc1a132015-12-09 08:24:47 -0500742 "maximum-paths ibgp " CMD_RANGE_STR(1, MULTIPATH_NUM),
Josh Bailey165b5ff2011-07-20 20:43:22 -0700743 "Forward packets over multiple paths\n"
744 "iBGP-multipath\n"
745 "Number of paths\n")
746{
747 struct bgp *bgp;
748 u_int16_t maxpaths;
749 int ret;
750
751 bgp = vty->index;
752
753 VTY_GET_INTEGER_RANGE ("maximum-paths", maxpaths, argv[0], 1, 255);
754
755 ret = bgp_maximum_paths_set (bgp, bgp_node_afi (vty), bgp_node_safi(vty),
756 BGP_PEER_IBGP, maxpaths);
757 if (ret < 0)
758 {
759 vty_out (vty,
760 "%% Failed to set maximum-paths ibgp %u for afi %u, safi %u%s",
761 maxpaths, bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE);
762 return CMD_WARNING;
763 }
764
765 return CMD_SUCCESS;
766}
767
768DEFUN (no_bgp_maxpaths,
769 no_bgp_maxpaths_cmd,
770 "no maximum-paths",
771 NO_STR
772 "Forward packets over multiple paths\n"
773 "Number of paths\n")
774{
775 struct bgp *bgp;
776 int ret;
777
778 bgp = vty->index;
779
780 ret = bgp_maximum_paths_unset (bgp, bgp_node_afi (vty), bgp_node_safi(vty),
781 BGP_PEER_EBGP);
782 if (ret < 0)
783 {
784 vty_out (vty,
785 "%% Failed to unset maximum-paths for afi %u, safi %u%s",
786 bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE);
787 return CMD_WARNING;
788 }
789
790 return CMD_SUCCESS;
791}
792
793ALIAS (no_bgp_maxpaths,
794 no_bgp_maxpaths_arg_cmd,
Donald Sharpecc1a132015-12-09 08:24:47 -0500795 "no maximum-paths " CMD_RANGE_STR(1, MULTIPATH_NUM),
Josh Bailey165b5ff2011-07-20 20:43:22 -0700796 NO_STR
797 "Forward packets over multiple paths\n"
798 "Number of paths\n")
799
800DEFUN (no_bgp_maxpaths_ibgp,
801 no_bgp_maxpaths_ibgp_cmd,
802 "no maximum-paths ibgp",
803 NO_STR
804 "Forward packets over multiple paths\n"
805 "iBGP-multipath\n"
806 "Number of paths\n")
807{
808 struct bgp *bgp;
809 int ret;
810
811 bgp = vty->index;
812
813 ret = bgp_maximum_paths_unset (bgp, bgp_node_afi (vty), bgp_node_safi(vty),
814 BGP_PEER_IBGP);
815 if (ret < 0)
816 {
817 vty_out (vty,
818 "%% Failed to unset maximum-paths ibgp for afi %u, safi %u%s",
819 bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE);
820 return CMD_WARNING;
821 }
822
823 return CMD_SUCCESS;
824}
825
826ALIAS (no_bgp_maxpaths_ibgp,
827 no_bgp_maxpaths_ibgp_arg_cmd,
Donald Sharpecc1a132015-12-09 08:24:47 -0500828 "no maximum-paths ibgp " CMD_RANGE_STR(1, MULTIPATH_NUM),
Josh Bailey165b5ff2011-07-20 20:43:22 -0700829 NO_STR
830 "Forward packets over multiple paths\n"
831 "iBGP-multipath\n"
832 "Number of paths\n")
833
834int
835bgp_config_write_maxpaths (struct vty *vty, struct bgp *bgp, afi_t afi,
836 safi_t safi, int *write)
837{
838 if (bgp->maxpaths[afi][safi].maxpaths_ebgp != BGP_DEFAULT_MAXPATHS)
839 {
840 bgp_config_write_family_header (vty, afi, safi, write);
841 vty_out (vty, " maximum-paths %d%s",
842 bgp->maxpaths[afi][safi].maxpaths_ebgp, VTY_NEWLINE);
843 }
844
845 if (bgp->maxpaths[afi][safi].maxpaths_ibgp != BGP_DEFAULT_MAXPATHS)
846 {
847 bgp_config_write_family_header (vty, afi, safi, write);
848 vty_out (vty, " maximum-paths ibgp %d%s",
849 bgp->maxpaths[afi][safi].maxpaths_ibgp, VTY_NEWLINE);
850 }
851
852 return 0;
853}
David Lamparter6b0655a2014-06-04 06:53:35 +0200854
paul718e3742002-12-13 20:15:29 +0000855/* BGP timers. */
856
857DEFUN (bgp_timers,
858 bgp_timers_cmd,
859 "timers bgp <0-65535> <0-65535>",
860 "Adjust routing timers\n"
861 "BGP timers\n"
862 "Keepalive interval\n"
863 "Holdtime\n")
864{
865 struct bgp *bgp;
866 unsigned long keepalive = 0;
867 unsigned long holdtime = 0;
868
869 bgp = vty->index;
870
871 VTY_GET_INTEGER ("keepalive", keepalive, argv[0]);
872 VTY_GET_INTEGER ("holdtime", holdtime, argv[1]);
873
874 /* Holdtime value check. */
875 if (holdtime < 3 && holdtime != 0)
876 {
877 vty_out (vty, "%% hold time value must be either 0 or greater than 3%s",
878 VTY_NEWLINE);
879 return CMD_WARNING;
880 }
881
882 bgp_timers_set (bgp, keepalive, holdtime);
883
884 return CMD_SUCCESS;
885}
886
887DEFUN (no_bgp_timers,
888 no_bgp_timers_cmd,
889 "no timers bgp",
890 NO_STR
891 "Adjust routing timers\n"
892 "BGP timers\n")
893{
894 struct bgp *bgp;
895
896 bgp = vty->index;
897 bgp_timers_unset (bgp);
898
899 return CMD_SUCCESS;
900}
901
902ALIAS (no_bgp_timers,
903 no_bgp_timers_arg_cmd,
904 "no timers bgp <0-65535> <0-65535>",
905 NO_STR
906 "Adjust routing timers\n"
907 "BGP timers\n"
908 "Keepalive interval\n"
909 "Holdtime\n")
David Lamparter6b0655a2014-06-04 06:53:35 +0200910
paul718e3742002-12-13 20:15:29 +0000911DEFUN (bgp_client_to_client_reflection,
912 bgp_client_to_client_reflection_cmd,
913 "bgp client-to-client reflection",
914 "BGP specific commands\n"
915 "Configure client to client route reflection\n"
916 "reflection of routes allowed\n")
917{
918 struct bgp *bgp;
919
920 bgp = vty->index;
921 bgp_flag_unset (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT);
922 return CMD_SUCCESS;
923}
924
925DEFUN (no_bgp_client_to_client_reflection,
926 no_bgp_client_to_client_reflection_cmd,
927 "no bgp client-to-client reflection",
928 NO_STR
929 "BGP specific commands\n"
930 "Configure client to client route reflection\n"
931 "reflection of routes allowed\n")
932{
933 struct bgp *bgp;
934
935 bgp = vty->index;
936 bgp_flag_set (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT);
937 return CMD_SUCCESS;
938}
939
940/* "bgp always-compare-med" configuration. */
941DEFUN (bgp_always_compare_med,
942 bgp_always_compare_med_cmd,
943 "bgp always-compare-med",
944 "BGP specific commands\n"
945 "Allow comparing MED from different neighbors\n")
946{
947 struct bgp *bgp;
948
949 bgp = vty->index;
950 bgp_flag_set (bgp, BGP_FLAG_ALWAYS_COMPARE_MED);
951 return CMD_SUCCESS;
952}
953
954DEFUN (no_bgp_always_compare_med,
955 no_bgp_always_compare_med_cmd,
956 "no bgp always-compare-med",
957 NO_STR
958 "BGP specific commands\n"
959 "Allow comparing MED from different neighbors\n")
960{
961 struct bgp *bgp;
962
963 bgp = vty->index;
964 bgp_flag_unset (bgp, BGP_FLAG_ALWAYS_COMPARE_MED);
965 return CMD_SUCCESS;
966}
David Lamparter6b0655a2014-06-04 06:53:35 +0200967
paul718e3742002-12-13 20:15:29 +0000968/* "bgp deterministic-med" configuration. */
969DEFUN (bgp_deterministic_med,
970 bgp_deterministic_med_cmd,
971 "bgp deterministic-med",
972 "BGP specific commands\n"
973 "Pick the best-MED path among paths advertised from the neighboring AS\n")
974{
975 struct bgp *bgp;
976
977 bgp = vty->index;
978 bgp_flag_set (bgp, BGP_FLAG_DETERMINISTIC_MED);
979 return CMD_SUCCESS;
980}
981
982DEFUN (no_bgp_deterministic_med,
983 no_bgp_deterministic_med_cmd,
984 "no bgp deterministic-med",
985 NO_STR
986 "BGP specific commands\n"
987 "Pick the best-MED path among paths advertised from the neighboring AS\n")
988{
989 struct bgp *bgp;
990
991 bgp = vty->index;
992 bgp_flag_unset (bgp, BGP_FLAG_DETERMINISTIC_MED);
993 return CMD_SUCCESS;
994}
hasso538621f2004-05-21 09:31:30 +0000995
996/* "bgp graceful-restart" configuration. */
997DEFUN (bgp_graceful_restart,
998 bgp_graceful_restart_cmd,
999 "bgp graceful-restart",
1000 "BGP specific commands\n"
1001 "Graceful restart capability parameters\n")
1002{
1003 struct bgp *bgp;
1004
1005 bgp = vty->index;
1006 bgp_flag_set (bgp, BGP_FLAG_GRACEFUL_RESTART);
1007 return CMD_SUCCESS;
1008}
1009
1010DEFUN (no_bgp_graceful_restart,
1011 no_bgp_graceful_restart_cmd,
1012 "no bgp graceful-restart",
1013 NO_STR
1014 "BGP specific commands\n"
1015 "Graceful restart capability parameters\n")
1016{
1017 struct bgp *bgp;
1018
1019 bgp = vty->index;
1020 bgp_flag_unset (bgp, BGP_FLAG_GRACEFUL_RESTART);
1021 return CMD_SUCCESS;
1022}
1023
hasso93406d82005-02-02 14:40:33 +00001024DEFUN (bgp_graceful_restart_stalepath_time,
1025 bgp_graceful_restart_stalepath_time_cmd,
1026 "bgp graceful-restart stalepath-time <1-3600>",
1027 "BGP specific commands\n"
1028 "Graceful restart capability parameters\n"
1029 "Set the max time to hold onto restarting peer's stale paths\n"
1030 "Delay value (seconds)\n")
1031{
1032 struct bgp *bgp;
1033 u_int32_t stalepath;
1034
1035 bgp = vty->index;
1036 if (! bgp)
1037 return CMD_WARNING;
1038
1039 VTY_GET_INTEGER_RANGE ("stalepath-time", stalepath, argv[0], 1, 3600);
1040 bgp->stalepath_time = stalepath;
1041 return CMD_SUCCESS;
1042}
1043
Philippe Guibert4afa3dd2016-05-24 16:52:02 +02001044DEFUN (bgp_graceful_restart_restart_time,
1045 bgp_graceful_restart_restart_time_cmd,
1046 "bgp graceful-restart restart-time <1-3600>",
1047 "BGP specific commands\n"
1048 "Graceful restart capability parameters\n"
1049 "Set the time to wait to delete stale routes before a BGP open message is received\n"
1050 "Delay value (seconds)\n")
1051{
1052 struct bgp *bgp;
1053 u_int32_t restart;
1054
1055 bgp = vty->index;
1056 if (! bgp)
1057 return CMD_WARNING;
1058
1059 VTY_GET_INTEGER_RANGE ("restart-time", restart, argv[0], 1, 3600);
1060 bgp->restart_time = restart;
1061 return CMD_SUCCESS;
1062}
1063
hasso93406d82005-02-02 14:40:33 +00001064DEFUN (no_bgp_graceful_restart_stalepath_time,
1065 no_bgp_graceful_restart_stalepath_time_cmd,
1066 "no bgp graceful-restart stalepath-time",
1067 NO_STR
1068 "BGP specific commands\n"
1069 "Graceful restart capability parameters\n"
1070 "Set the max time to hold onto restarting peer's stale paths\n")
1071{
1072 struct bgp *bgp;
1073
1074 bgp = vty->index;
1075 if (! bgp)
1076 return CMD_WARNING;
1077
1078 bgp->stalepath_time = BGP_DEFAULT_STALEPATH_TIME;
1079 return CMD_SUCCESS;
1080}
1081
Philippe Guibert4afa3dd2016-05-24 16:52:02 +02001082DEFUN (no_bgp_graceful_restart_restart_time,
1083 no_bgp_graceful_restart_restart_time_cmd,
1084 "no bgp graceful-restart restart-time",
1085 NO_STR
1086 "BGP specific commands\n"
1087 "Graceful restart capability parameters\n"
1088 "Set the time to wait to delete stale routes before a BGP open message is received\n")
1089{
1090 struct bgp *bgp;
1091
1092 bgp = vty->index;
1093 if (! bgp)
1094 return CMD_WARNING;
1095
1096 bgp->restart_time = BGP_DEFAULT_RESTART_TIME;
1097 return CMD_SUCCESS;
1098}
1099
hasso93406d82005-02-02 14:40:33 +00001100ALIAS (no_bgp_graceful_restart_stalepath_time,
1101 no_bgp_graceful_restart_stalepath_time_val_cmd,
1102 "no bgp graceful-restart stalepath-time <1-3600>",
1103 NO_STR
1104 "BGP specific commands\n"
1105 "Graceful restart capability parameters\n"
1106 "Set the max time to hold onto restarting peer's stale paths\n"
1107 "Delay value (seconds)\n")
1108
Philippe Guibert4afa3dd2016-05-24 16:52:02 +02001109ALIAS (no_bgp_graceful_restart_restart_time,
1110 no_bgp_graceful_restart_restart_time_val_cmd,
1111 "no bgp graceful-restart restart-time <1-3600>",
1112 NO_STR
1113 "BGP specific commands\n"
1114 "Graceful restart capability parameters\n"
1115 "Set the time to wait to delete stale routes before a BGP open message is received\n"
1116 "Delay value (seconds)\n")
1117
paul718e3742002-12-13 20:15:29 +00001118/* "bgp fast-external-failover" configuration. */
1119DEFUN (bgp_fast_external_failover,
1120 bgp_fast_external_failover_cmd,
1121 "bgp fast-external-failover",
1122 BGP_STR
1123 "Immediately reset session if a link to a directly connected external peer goes down\n")
1124{
1125 struct bgp *bgp;
1126
1127 bgp = vty->index;
1128 bgp_flag_unset (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER);
1129 return CMD_SUCCESS;
1130}
1131
1132DEFUN (no_bgp_fast_external_failover,
1133 no_bgp_fast_external_failover_cmd,
1134 "no bgp fast-external-failover",
1135 NO_STR
1136 BGP_STR
1137 "Immediately reset session if a link to a directly connected external peer goes down\n")
1138{
1139 struct bgp *bgp;
1140
1141 bgp = vty->index;
1142 bgp_flag_set (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER);
1143 return CMD_SUCCESS;
1144}
David Lamparter6b0655a2014-06-04 06:53:35 +02001145
paul718e3742002-12-13 20:15:29 +00001146/* "bgp enforce-first-as" configuration. */
1147DEFUN (bgp_enforce_first_as,
1148 bgp_enforce_first_as_cmd,
1149 "bgp enforce-first-as",
1150 BGP_STR
1151 "Enforce the first AS for EBGP routes\n")
1152{
1153 struct bgp *bgp;
1154
1155 bgp = vty->index;
1156 bgp_flag_set (bgp, BGP_FLAG_ENFORCE_FIRST_AS);
1157 return CMD_SUCCESS;
1158}
1159
1160DEFUN (no_bgp_enforce_first_as,
1161 no_bgp_enforce_first_as_cmd,
1162 "no bgp enforce-first-as",
1163 NO_STR
1164 BGP_STR
1165 "Enforce the first AS for EBGP routes\n")
1166{
1167 struct bgp *bgp;
1168
1169 bgp = vty->index;
1170 bgp_flag_unset (bgp, BGP_FLAG_ENFORCE_FIRST_AS);
1171 return CMD_SUCCESS;
1172}
David Lamparter6b0655a2014-06-04 06:53:35 +02001173
paul718e3742002-12-13 20:15:29 +00001174/* "bgp bestpath compare-routerid" configuration. */
1175DEFUN (bgp_bestpath_compare_router_id,
1176 bgp_bestpath_compare_router_id_cmd,
1177 "bgp bestpath compare-routerid",
1178 "BGP specific commands\n"
1179 "Change the default bestpath selection\n"
1180 "Compare router-id for identical EBGP paths\n")
1181{
1182 struct bgp *bgp;
1183
1184 bgp = vty->index;
1185 bgp_flag_set (bgp, BGP_FLAG_COMPARE_ROUTER_ID);
1186 return CMD_SUCCESS;
1187}
1188
1189DEFUN (no_bgp_bestpath_compare_router_id,
1190 no_bgp_bestpath_compare_router_id_cmd,
1191 "no bgp bestpath compare-routerid",
1192 NO_STR
1193 "BGP specific commands\n"
1194 "Change the default bestpath selection\n"
1195 "Compare router-id for identical EBGP paths\n")
1196{
1197 struct bgp *bgp;
1198
1199 bgp = vty->index;
1200 bgp_flag_unset (bgp, BGP_FLAG_COMPARE_ROUTER_ID);
1201 return CMD_SUCCESS;
1202}
David Lamparter6b0655a2014-06-04 06:53:35 +02001203
paul718e3742002-12-13 20:15:29 +00001204/* "bgp bestpath as-path ignore" configuration. */
1205DEFUN (bgp_bestpath_aspath_ignore,
1206 bgp_bestpath_aspath_ignore_cmd,
1207 "bgp bestpath as-path ignore",
1208 "BGP specific commands\n"
1209 "Change the default bestpath selection\n"
1210 "AS-path attribute\n"
1211 "Ignore as-path length in selecting a route\n")
1212{
1213 struct bgp *bgp;
1214
1215 bgp = vty->index;
1216 bgp_flag_set (bgp, BGP_FLAG_ASPATH_IGNORE);
1217 return CMD_SUCCESS;
1218}
1219
1220DEFUN (no_bgp_bestpath_aspath_ignore,
1221 no_bgp_bestpath_aspath_ignore_cmd,
1222 "no bgp bestpath as-path ignore",
1223 NO_STR
1224 "BGP specific commands\n"
1225 "Change the default bestpath selection\n"
1226 "AS-path attribute\n"
1227 "Ignore as-path length in selecting a route\n")
1228{
1229 struct bgp *bgp;
1230
1231 bgp = vty->index;
1232 bgp_flag_unset (bgp, BGP_FLAG_ASPATH_IGNORE);
1233 return CMD_SUCCESS;
1234}
David Lamparter6b0655a2014-06-04 06:53:35 +02001235
hasso68118452005-04-08 15:40:36 +00001236/* "bgp bestpath as-path confed" configuration. */
1237DEFUN (bgp_bestpath_aspath_confed,
1238 bgp_bestpath_aspath_confed_cmd,
1239 "bgp bestpath as-path confed",
1240 "BGP specific commands\n"
1241 "Change the default bestpath selection\n"
1242 "AS-path attribute\n"
1243 "Compare path lengths including confederation sets & sequences in selecting a route\n")
1244{
1245 struct bgp *bgp;
1246
1247 bgp = vty->index;
1248 bgp_flag_set (bgp, BGP_FLAG_ASPATH_CONFED);
1249 return CMD_SUCCESS;
1250}
1251
1252DEFUN (no_bgp_bestpath_aspath_confed,
1253 no_bgp_bestpath_aspath_confed_cmd,
1254 "no bgp bestpath as-path confed",
1255 NO_STR
1256 "BGP specific commands\n"
1257 "Change the default bestpath selection\n"
1258 "AS-path attribute\n"
1259 "Compare path lengths including confederation sets & sequences in selecting a route\n")
1260{
1261 struct bgp *bgp;
1262
1263 bgp = vty->index;
1264 bgp_flag_unset (bgp, BGP_FLAG_ASPATH_CONFED);
1265 return CMD_SUCCESS;
1266}
David Lamparter6b0655a2014-06-04 06:53:35 +02001267
Pradosh Mohapatra2fdd4552013-09-07 07:02:36 +00001268/* "bgp bestpath as-path multipath-relax" configuration. */
1269DEFUN (bgp_bestpath_aspath_multipath_relax,
1270 bgp_bestpath_aspath_multipath_relax_cmd,
1271 "bgp bestpath as-path multipath-relax",
1272 "BGP specific commands\n"
1273 "Change the default bestpath selection\n"
1274 "AS-path attribute\n"
1275 "Allow load sharing across routes that have different AS paths (but same length)\n")
1276{
1277 struct bgp *bgp;
1278
1279 bgp = vty->index;
1280 bgp_flag_set (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX);
1281 return CMD_SUCCESS;
1282}
1283
1284DEFUN (no_bgp_bestpath_aspath_multipath_relax,
1285 no_bgp_bestpath_aspath_multipath_relax_cmd,
1286 "no bgp bestpath as-path multipath-relax",
1287 NO_STR
1288 "BGP specific commands\n"
1289 "Change the default bestpath selection\n"
1290 "AS-path attribute\n"
1291 "Allow load sharing across routes that have different AS paths (but same length)\n")
1292{
1293 struct bgp *bgp;
1294
1295 bgp = vty->index;
1296 bgp_flag_unset (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX);
1297 return CMD_SUCCESS;
1298}
David Lamparter6b0655a2014-06-04 06:53:35 +02001299
paul848973c2003-08-13 00:32:49 +00001300/* "bgp log-neighbor-changes" configuration. */
1301DEFUN (bgp_log_neighbor_changes,
1302 bgp_log_neighbor_changes_cmd,
1303 "bgp log-neighbor-changes",
1304 "BGP specific commands\n"
1305 "Log neighbor up/down and reset reason\n")
1306{
1307 struct bgp *bgp;
1308
1309 bgp = vty->index;
1310 bgp_flag_set (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES);
1311 return CMD_SUCCESS;
1312}
1313
1314DEFUN (no_bgp_log_neighbor_changes,
1315 no_bgp_log_neighbor_changes_cmd,
1316 "no bgp log-neighbor-changes",
1317 NO_STR
1318 "BGP specific commands\n"
1319 "Log neighbor up/down and reset reason\n")
1320{
1321 struct bgp *bgp;
1322
1323 bgp = vty->index;
1324 bgp_flag_unset (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES);
1325 return CMD_SUCCESS;
1326}
David Lamparter6b0655a2014-06-04 06:53:35 +02001327
paul718e3742002-12-13 20:15:29 +00001328/* "bgp bestpath med" configuration. */
1329DEFUN (bgp_bestpath_med,
1330 bgp_bestpath_med_cmd,
1331 "bgp bestpath med (confed|missing-as-worst)",
1332 "BGP specific commands\n"
1333 "Change the default bestpath selection\n"
1334 "MED attribute\n"
1335 "Compare MED among confederation paths\n"
1336 "Treat missing MED as the least preferred one\n")
1337{
1338 struct bgp *bgp;
1339
1340 bgp = vty->index;
1341
1342 if (strncmp (argv[0], "confed", 1) == 0)
1343 bgp_flag_set (bgp, BGP_FLAG_MED_CONFED);
1344 else
1345 bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1346
1347 return CMD_SUCCESS;
1348}
1349
1350DEFUN (bgp_bestpath_med2,
1351 bgp_bestpath_med2_cmd,
1352 "bgp bestpath med confed missing-as-worst",
1353 "BGP specific commands\n"
1354 "Change the default bestpath selection\n"
1355 "MED attribute\n"
1356 "Compare MED among confederation paths\n"
1357 "Treat missing MED as the least preferred one\n")
1358{
1359 struct bgp *bgp;
1360
1361 bgp = vty->index;
1362 bgp_flag_set (bgp, BGP_FLAG_MED_CONFED);
1363 bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1364 return CMD_SUCCESS;
1365}
1366
1367ALIAS (bgp_bestpath_med2,
1368 bgp_bestpath_med3_cmd,
1369 "bgp bestpath med missing-as-worst confed",
1370 "BGP specific commands\n"
1371 "Change the default bestpath selection\n"
1372 "MED attribute\n"
1373 "Treat missing MED as the least preferred one\n"
1374 "Compare MED among confederation paths\n")
1375
1376DEFUN (no_bgp_bestpath_med,
1377 no_bgp_bestpath_med_cmd,
1378 "no bgp bestpath med (confed|missing-as-worst)",
1379 NO_STR
1380 "BGP specific commands\n"
1381 "Change the default bestpath selection\n"
1382 "MED attribute\n"
1383 "Compare MED among confederation paths\n"
1384 "Treat missing MED as the least preferred one\n")
1385{
1386 struct bgp *bgp;
1387
1388 bgp = vty->index;
1389
1390 if (strncmp (argv[0], "confed", 1) == 0)
1391 bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED);
1392 else
1393 bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1394
1395 return CMD_SUCCESS;
1396}
1397
1398DEFUN (no_bgp_bestpath_med2,
1399 no_bgp_bestpath_med2_cmd,
1400 "no bgp bestpath med confed missing-as-worst",
1401 NO_STR
1402 "BGP specific commands\n"
1403 "Change the default bestpath selection\n"
1404 "MED attribute\n"
1405 "Compare MED among confederation paths\n"
1406 "Treat missing MED as the least preferred one\n")
1407{
1408 struct bgp *bgp;
1409
1410 bgp = vty->index;
1411 bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED);
1412 bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1413 return CMD_SUCCESS;
1414}
1415
1416ALIAS (no_bgp_bestpath_med2,
1417 no_bgp_bestpath_med3_cmd,
1418 "no bgp bestpath med missing-as-worst confed",
1419 NO_STR
1420 "BGP specific commands\n"
1421 "Change the default bestpath selection\n"
1422 "MED attribute\n"
1423 "Treat missing MED as the least preferred one\n"
1424 "Compare MED among confederation paths\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02001425
paul718e3742002-12-13 20:15:29 +00001426/* "no bgp default ipv4-unicast". */
1427DEFUN (no_bgp_default_ipv4_unicast,
1428 no_bgp_default_ipv4_unicast_cmd,
1429 "no bgp default ipv4-unicast",
1430 NO_STR
1431 "BGP specific commands\n"
1432 "Configure BGP defaults\n"
1433 "Activate ipv4-unicast for a peer by default\n")
1434{
1435 struct bgp *bgp;
1436
1437 bgp = vty->index;
1438 bgp_flag_set (bgp, BGP_FLAG_NO_DEFAULT_IPV4);
1439 return CMD_SUCCESS;
1440}
1441
1442DEFUN (bgp_default_ipv4_unicast,
1443 bgp_default_ipv4_unicast_cmd,
1444 "bgp default ipv4-unicast",
1445 "BGP specific commands\n"
1446 "Configure BGP defaults\n"
1447 "Activate ipv4-unicast for a peer by default\n")
1448{
1449 struct bgp *bgp;
1450
1451 bgp = vty->index;
1452 bgp_flag_unset (bgp, BGP_FLAG_NO_DEFAULT_IPV4);
1453 return CMD_SUCCESS;
1454}
David Lamparter6b0655a2014-06-04 06:53:35 +02001455
paul718e3742002-12-13 20:15:29 +00001456/* "bgp import-check" configuration. */
1457DEFUN (bgp_network_import_check,
1458 bgp_network_import_check_cmd,
1459 "bgp network import-check",
1460 "BGP specific commands\n"
1461 "BGP network command\n"
1462 "Check BGP network route exists in IGP\n")
1463{
1464 struct bgp *bgp;
1465
1466 bgp = vty->index;
1467 bgp_flag_set (bgp, BGP_FLAG_IMPORT_CHECK);
1468 return CMD_SUCCESS;
1469}
1470
1471DEFUN (no_bgp_network_import_check,
1472 no_bgp_network_import_check_cmd,
1473 "no bgp network import-check",
1474 NO_STR
1475 "BGP specific commands\n"
1476 "BGP network command\n"
1477 "Check BGP network route exists in IGP\n")
1478{
1479 struct bgp *bgp;
1480
1481 bgp = vty->index;
1482 bgp_flag_unset (bgp, BGP_FLAG_IMPORT_CHECK);
1483 return CMD_SUCCESS;
1484}
David Lamparter6b0655a2014-06-04 06:53:35 +02001485
paul718e3742002-12-13 20:15:29 +00001486DEFUN (bgp_default_local_preference,
1487 bgp_default_local_preference_cmd,
1488 "bgp default local-preference <0-4294967295>",
1489 "BGP specific commands\n"
1490 "Configure BGP defaults\n"
1491 "local preference (higher=more preferred)\n"
1492 "Configure default local preference value\n")
1493{
1494 struct bgp *bgp;
1495 u_int32_t local_pref;
1496
1497 bgp = vty->index;
1498
1499 VTY_GET_INTEGER ("local preference", local_pref, argv[0]);
1500
1501 bgp_default_local_preference_set (bgp, local_pref);
1502
1503 return CMD_SUCCESS;
1504}
1505
1506DEFUN (no_bgp_default_local_preference,
1507 no_bgp_default_local_preference_cmd,
1508 "no bgp default local-preference",
1509 NO_STR
1510 "BGP specific commands\n"
1511 "Configure BGP defaults\n"
1512 "local preference (higher=more preferred)\n")
1513{
1514 struct bgp *bgp;
1515
1516 bgp = vty->index;
1517 bgp_default_local_preference_unset (bgp);
1518 return CMD_SUCCESS;
1519}
1520
1521ALIAS (no_bgp_default_local_preference,
1522 no_bgp_default_local_preference_val_cmd,
1523 "no bgp default local-preference <0-4294967295>",
1524 NO_STR
1525 "BGP specific commands\n"
1526 "Configure BGP defaults\n"
1527 "local preference (higher=more preferred)\n"
1528 "Configure default local preference value\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02001529
paul718e3742002-12-13 20:15:29 +00001530static int
paulfd79ac92004-10-13 05:06:08 +00001531peer_remote_as_vty (struct vty *vty, const char *peer_str,
1532 const char *as_str, afi_t afi, safi_t safi)
paul718e3742002-12-13 20:15:29 +00001533{
1534 int ret;
1535 struct bgp *bgp;
1536 as_t as;
1537 union sockunion su;
1538
1539 bgp = vty->index;
1540
1541 /* Get AS number. */
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00001542 VTY_GET_INTEGER_RANGE ("AS", as, as_str, 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +00001543
1544 /* If peer is peer group, call proper function. */
1545 ret = str2sockunion (peer_str, &su);
1546 if (ret < 0)
1547 {
1548 ret = peer_group_remote_as (bgp, peer_str, &as);
1549 if (ret < 0)
1550 {
1551 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1552 return CMD_WARNING;
1553 }
1554 return CMD_SUCCESS;
1555 }
1556
1557 if (peer_address_self_check (&su))
1558 {
1559 vty_out (vty, "%% Can not configure the local system as neighbor%s",
1560 VTY_NEWLINE);
1561 return CMD_WARNING;
1562 }
1563
1564 ret = peer_remote_as (bgp, &su, &as, afi, safi);
1565
1566 /* This peer belongs to peer group. */
1567 switch (ret)
1568 {
1569 case BGP_ERR_PEER_GROUP_MEMBER:
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04001570 vty_out (vty, "%% Peer-group AS %u. Cannot configure remote-as for member%s", as, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00001571 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00001572 case BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT:
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04001573 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 +00001574 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00001575 }
1576 return bgp_vty_return (vty, ret);
1577}
1578
1579DEFUN (neighbor_remote_as,
1580 neighbor_remote_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001581 NEIGHBOR_CMD2 "remote-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001582 NEIGHBOR_STR
1583 NEIGHBOR_ADDR_STR2
1584 "Specify a BGP neighbor\n"
1585 AS_STR)
1586{
1587 return peer_remote_as_vty (vty, argv[0], argv[1], AFI_IP, SAFI_UNICAST);
1588}
David Lamparter6b0655a2014-06-04 06:53:35 +02001589
paul718e3742002-12-13 20:15:29 +00001590DEFUN (neighbor_peer_group,
1591 neighbor_peer_group_cmd,
1592 "neighbor WORD peer-group",
1593 NEIGHBOR_STR
1594 "Neighbor tag\n"
1595 "Configure peer-group\n")
1596{
1597 struct bgp *bgp;
1598 struct peer_group *group;
1599
1600 bgp = vty->index;
1601
1602 group = peer_group_get (bgp, argv[0]);
1603 if (! group)
1604 return CMD_WARNING;
1605
1606 return CMD_SUCCESS;
1607}
1608
1609DEFUN (no_neighbor,
1610 no_neighbor_cmd,
1611 NO_NEIGHBOR_CMD2,
1612 NO_STR
1613 NEIGHBOR_STR
1614 NEIGHBOR_ADDR_STR2)
1615{
1616 int ret;
1617 union sockunion su;
1618 struct peer_group *group;
1619 struct peer *peer;
1620
1621 ret = str2sockunion (argv[0], &su);
1622 if (ret < 0)
1623 {
1624 group = peer_group_lookup (vty->index, argv[0]);
1625 if (group)
1626 peer_group_delete (group);
1627 else
1628 {
1629 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1630 return CMD_WARNING;
1631 }
1632 }
1633 else
1634 {
1635 peer = peer_lookup (vty->index, &su);
1636 if (peer)
paul200df112005-06-01 11:17:05 +00001637 peer_delete (peer);
paul718e3742002-12-13 20:15:29 +00001638 }
1639
1640 return CMD_SUCCESS;
1641}
1642
1643ALIAS (no_neighbor,
1644 no_neighbor_remote_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001645 NO_NEIGHBOR_CMD "remote-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001646 NO_STR
1647 NEIGHBOR_STR
1648 NEIGHBOR_ADDR_STR
1649 "Specify a BGP neighbor\n"
1650 AS_STR)
1651
1652DEFUN (no_neighbor_peer_group,
1653 no_neighbor_peer_group_cmd,
1654 "no neighbor WORD peer-group",
1655 NO_STR
1656 NEIGHBOR_STR
1657 "Neighbor tag\n"
1658 "Configure peer-group\n")
1659{
1660 struct peer_group *group;
1661
1662 group = peer_group_lookup (vty->index, argv[0]);
1663 if (group)
1664 peer_group_delete (group);
1665 else
1666 {
1667 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1668 return CMD_WARNING;
1669 }
1670 return CMD_SUCCESS;
1671}
1672
1673DEFUN (no_neighbor_peer_group_remote_as,
1674 no_neighbor_peer_group_remote_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001675 "no neighbor WORD remote-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001676 NO_STR
1677 NEIGHBOR_STR
1678 "Neighbor tag\n"
1679 "Specify a BGP neighbor\n"
1680 AS_STR)
1681{
1682 struct peer_group *group;
1683
1684 group = peer_group_lookup (vty->index, argv[0]);
1685 if (group)
1686 peer_group_remote_as_delete (group);
1687 else
1688 {
1689 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1690 return CMD_WARNING;
1691 }
1692 return CMD_SUCCESS;
1693}
David Lamparter6b0655a2014-06-04 06:53:35 +02001694
paul718e3742002-12-13 20:15:29 +00001695DEFUN (neighbor_local_as,
1696 neighbor_local_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001697 NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001698 NEIGHBOR_STR
1699 NEIGHBOR_ADDR_STR2
1700 "Specify a local-as number\n"
1701 "AS number used as local AS\n")
1702{
1703 struct peer *peer;
1704 int ret;
1705
1706 peer = peer_and_group_lookup_vty (vty, argv[0]);
1707 if (! peer)
1708 return CMD_WARNING;
1709
Andrew Certain9d3f9702012-11-07 23:50:07 +00001710 ret = peer_local_as_set (peer, atoi (argv[1]), 0, 0);
paul718e3742002-12-13 20:15:29 +00001711 return bgp_vty_return (vty, ret);
1712}
1713
1714DEFUN (neighbor_local_as_no_prepend,
1715 neighbor_local_as_no_prepend_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001716 NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend",
paul718e3742002-12-13 20:15:29 +00001717 NEIGHBOR_STR
1718 NEIGHBOR_ADDR_STR2
1719 "Specify a local-as number\n"
1720 "AS number used as local AS\n"
1721 "Do not prepend local-as to updates from ebgp peers\n")
1722{
1723 struct peer *peer;
1724 int ret;
1725
1726 peer = peer_and_group_lookup_vty (vty, argv[0]);
1727 if (! peer)
1728 return CMD_WARNING;
1729
Andrew Certain9d3f9702012-11-07 23:50:07 +00001730 ret = peer_local_as_set (peer, atoi (argv[1]), 1, 0);
paul718e3742002-12-13 20:15:29 +00001731 return bgp_vty_return (vty, ret);
1732}
1733
Andrew Certain9d3f9702012-11-07 23:50:07 +00001734DEFUN (neighbor_local_as_no_prepend_replace_as,
1735 neighbor_local_as_no_prepend_replace_as_cmd,
1736 NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as",
1737 NEIGHBOR_STR
1738 NEIGHBOR_ADDR_STR2
1739 "Specify a local-as number\n"
1740 "AS number used as local AS\n"
1741 "Do not prepend local-as to updates from ebgp peers\n"
1742 "Do not prepend local-as to updates from ibgp peers\n")
1743{
1744 struct peer *peer;
1745 int ret;
1746
1747 peer = peer_and_group_lookup_vty (vty, argv[0]);
1748 if (! peer)
1749 return CMD_WARNING;
1750
1751 ret = peer_local_as_set (peer, atoi (argv[1]), 1, 1);
1752 return bgp_vty_return (vty, ret);
1753}
1754
1755
paul718e3742002-12-13 20:15:29 +00001756DEFUN (no_neighbor_local_as,
1757 no_neighbor_local_as_cmd,
1758 NO_NEIGHBOR_CMD2 "local-as",
1759 NO_STR
1760 NEIGHBOR_STR
1761 NEIGHBOR_ADDR_STR2
1762 "Specify a local-as number\n")
1763{
1764 struct peer *peer;
1765 int ret;
1766
1767 peer = peer_and_group_lookup_vty (vty, argv[0]);
1768 if (! peer)
1769 return CMD_WARNING;
1770
1771 ret = peer_local_as_unset (peer);
1772 return bgp_vty_return (vty, ret);
1773}
1774
1775ALIAS (no_neighbor_local_as,
1776 no_neighbor_local_as_val_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001777 NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001778 NO_STR
1779 NEIGHBOR_STR
1780 NEIGHBOR_ADDR_STR2
1781 "Specify a local-as number\n"
1782 "AS number used as local AS\n")
1783
1784ALIAS (no_neighbor_local_as,
1785 no_neighbor_local_as_val2_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001786 NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend",
paul718e3742002-12-13 20:15:29 +00001787 NO_STR
1788 NEIGHBOR_STR
1789 NEIGHBOR_ADDR_STR2
1790 "Specify a local-as number\n"
1791 "AS number used as local AS\n"
1792 "Do not prepend local-as to updates from ebgp peers\n")
Andrew Certain9d3f9702012-11-07 23:50:07 +00001793
1794ALIAS (no_neighbor_local_as,
1795 no_neighbor_local_as_val3_cmd,
1796 NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as",
1797 NO_STR
1798 NEIGHBOR_STR
1799 NEIGHBOR_ADDR_STR2
1800 "Specify a local-as number\n"
1801 "AS number used as local AS\n"
1802 "Do not prepend local-as to updates from ebgp peers\n"
1803 "Do not prepend local-as to updates from ibgp peers\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02001804
Paul Jakma0df7c912008-07-21 21:02:49 +00001805DEFUN (neighbor_password,
1806 neighbor_password_cmd,
1807 NEIGHBOR_CMD2 "password LINE",
1808 NEIGHBOR_STR
1809 NEIGHBOR_ADDR_STR2
1810 "Set a password\n"
1811 "The password\n")
1812{
1813 struct peer *peer;
1814 int ret;
1815
1816 peer = peer_and_group_lookup_vty (vty, argv[0]);
1817 if (! peer)
1818 return CMD_WARNING;
1819
1820 ret = peer_password_set (peer, argv[1]);
1821 return bgp_vty_return (vty, ret);
1822}
1823
1824DEFUN (no_neighbor_password,
1825 no_neighbor_password_cmd,
1826 NO_NEIGHBOR_CMD2 "password",
1827 NO_STR
1828 NEIGHBOR_STR
1829 NEIGHBOR_ADDR_STR2
1830 "Set a password\n")
1831{
1832 struct peer *peer;
1833 int ret;
1834
1835 peer = peer_and_group_lookup_vty (vty, argv[0]);
1836 if (! peer)
1837 return CMD_WARNING;
1838
1839 ret = peer_password_unset (peer);
1840 return bgp_vty_return (vty, ret);
1841}
David Lamparter6b0655a2014-06-04 06:53:35 +02001842
paul718e3742002-12-13 20:15:29 +00001843DEFUN (neighbor_activate,
1844 neighbor_activate_cmd,
1845 NEIGHBOR_CMD2 "activate",
1846 NEIGHBOR_STR
1847 NEIGHBOR_ADDR_STR2
1848 "Enable the Address Family for this Neighbor\n")
1849{
1850 struct peer *peer;
1851
1852 peer = peer_and_group_lookup_vty (vty, argv[0]);
1853 if (! peer)
1854 return CMD_WARNING;
1855
1856 peer_activate (peer, bgp_node_afi (vty), bgp_node_safi (vty));
1857
1858 return CMD_SUCCESS;
1859}
1860
1861DEFUN (no_neighbor_activate,
1862 no_neighbor_activate_cmd,
1863 NO_NEIGHBOR_CMD2 "activate",
1864 NO_STR
1865 NEIGHBOR_STR
1866 NEIGHBOR_ADDR_STR2
1867 "Enable the Address Family for this Neighbor\n")
1868{
1869 int ret;
1870 struct peer *peer;
1871
1872 /* Lookup peer. */
1873 peer = peer_and_group_lookup_vty (vty, argv[0]);
1874 if (! peer)
1875 return CMD_WARNING;
1876
1877 ret = peer_deactivate (peer, bgp_node_afi (vty), bgp_node_safi (vty));
1878
1879 return bgp_vty_return (vty, ret);
1880}
David Lamparter6b0655a2014-06-04 06:53:35 +02001881
paul718e3742002-12-13 20:15:29 +00001882DEFUN (neighbor_set_peer_group,
1883 neighbor_set_peer_group_cmd,
1884 NEIGHBOR_CMD "peer-group WORD",
1885 NEIGHBOR_STR
1886 NEIGHBOR_ADDR_STR
1887 "Member of the peer-group\n"
1888 "peer-group name\n")
1889{
1890 int ret;
1891 as_t as;
1892 union sockunion su;
1893 struct bgp *bgp;
1894 struct peer_group *group;
1895
1896 bgp = vty->index;
1897
1898 ret = str2sockunion (argv[0], &su);
1899 if (ret < 0)
1900 {
1901 vty_out (vty, "%% Malformed address: %s%s", argv[0], VTY_NEWLINE);
1902 return CMD_WARNING;
1903 }
1904
1905 group = peer_group_lookup (bgp, argv[1]);
1906 if (! group)
1907 {
1908 vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE);
1909 return CMD_WARNING;
1910 }
1911
1912 if (peer_address_self_check (&su))
1913 {
1914 vty_out (vty, "%% Can not configure the local system as neighbor%s",
1915 VTY_NEWLINE);
1916 return CMD_WARNING;
1917 }
1918
1919 ret = peer_group_bind (bgp, &su, group, bgp_node_afi (vty),
1920 bgp_node_safi (vty), &as);
1921
1922 if (ret == BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT)
1923 {
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04001924 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 +00001925 return CMD_WARNING;
1926 }
1927
1928 return bgp_vty_return (vty, ret);
1929}
1930
1931DEFUN (no_neighbor_set_peer_group,
1932 no_neighbor_set_peer_group_cmd,
1933 NO_NEIGHBOR_CMD "peer-group WORD",
1934 NO_STR
1935 NEIGHBOR_STR
1936 NEIGHBOR_ADDR_STR
1937 "Member of the peer-group\n"
1938 "peer-group name\n")
1939{
1940 int ret;
1941 struct bgp *bgp;
1942 struct peer *peer;
1943 struct peer_group *group;
1944
1945 bgp = vty->index;
1946
1947 peer = peer_lookup_vty (vty, argv[0]);
1948 if (! peer)
1949 return CMD_WARNING;
1950
1951 group = peer_group_lookup (bgp, argv[1]);
1952 if (! group)
1953 {
1954 vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE);
1955 return CMD_WARNING;
1956 }
1957
1958 ret = peer_group_unbind (bgp, peer, group, bgp_node_afi (vty),
1959 bgp_node_safi (vty));
1960
1961 return bgp_vty_return (vty, ret);
1962}
David Lamparter6b0655a2014-06-04 06:53:35 +02001963
paul94f2b392005-06-28 12:44:16 +00001964static int
paulfd79ac92004-10-13 05:06:08 +00001965peer_flag_modify_vty (struct vty *vty, const char *ip_str,
1966 u_int16_t flag, int set)
paul718e3742002-12-13 20:15:29 +00001967{
1968 int ret;
1969 struct peer *peer;
1970
1971 peer = peer_and_group_lookup_vty (vty, ip_str);
1972 if (! peer)
1973 return CMD_WARNING;
1974
1975 if (set)
1976 ret = peer_flag_set (peer, flag);
1977 else
1978 ret = peer_flag_unset (peer, flag);
1979
1980 return bgp_vty_return (vty, ret);
1981}
1982
paul94f2b392005-06-28 12:44:16 +00001983static int
paulfd79ac92004-10-13 05:06:08 +00001984peer_flag_set_vty (struct vty *vty, const char *ip_str, u_int16_t flag)
paul718e3742002-12-13 20:15:29 +00001985{
1986 return peer_flag_modify_vty (vty, ip_str, flag, 1);
1987}
1988
paul94f2b392005-06-28 12:44:16 +00001989static int
paulfd79ac92004-10-13 05:06:08 +00001990peer_flag_unset_vty (struct vty *vty, const char *ip_str, u_int16_t flag)
paul718e3742002-12-13 20:15:29 +00001991{
1992 return peer_flag_modify_vty (vty, ip_str, flag, 0);
1993}
1994
1995/* neighbor passive. */
1996DEFUN (neighbor_passive,
1997 neighbor_passive_cmd,
1998 NEIGHBOR_CMD2 "passive",
1999 NEIGHBOR_STR
2000 NEIGHBOR_ADDR_STR2
2001 "Don't send open messages to this neighbor\n")
2002{
2003 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_PASSIVE);
2004}
2005
2006DEFUN (no_neighbor_passive,
2007 no_neighbor_passive_cmd,
2008 NO_NEIGHBOR_CMD2 "passive",
2009 NO_STR
2010 NEIGHBOR_STR
2011 NEIGHBOR_ADDR_STR2
2012 "Don't send open messages to this neighbor\n")
2013{
2014 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_PASSIVE);
2015}
David Lamparter6b0655a2014-06-04 06:53:35 +02002016
paul718e3742002-12-13 20:15:29 +00002017/* neighbor shutdown. */
2018DEFUN (neighbor_shutdown,
2019 neighbor_shutdown_cmd,
2020 NEIGHBOR_CMD2 "shutdown",
2021 NEIGHBOR_STR
2022 NEIGHBOR_ADDR_STR2
2023 "Administratively shut down this neighbor\n")
2024{
2025 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_SHUTDOWN);
2026}
2027
2028DEFUN (no_neighbor_shutdown,
2029 no_neighbor_shutdown_cmd,
2030 NO_NEIGHBOR_CMD2 "shutdown",
2031 NO_STR
2032 NEIGHBOR_STR
2033 NEIGHBOR_ADDR_STR2
2034 "Administratively shut down this neighbor\n")
2035{
2036 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_SHUTDOWN);
2037}
David Lamparter6b0655a2014-06-04 06:53:35 +02002038
hassoc9502432005-02-01 22:01:48 +00002039/* Deprecated neighbor capability route-refresh. */
2040DEFUN_DEPRECATED (neighbor_capability_route_refresh,
2041 neighbor_capability_route_refresh_cmd,
2042 NEIGHBOR_CMD2 "capability route-refresh",
2043 NEIGHBOR_STR
2044 NEIGHBOR_ADDR_STR2
2045 "Advertise capability to the peer\n"
2046 "Advertise route-refresh capability to this neighbor\n")
paul718e3742002-12-13 20:15:29 +00002047{
hassoc9502432005-02-01 22:01:48 +00002048 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00002049}
2050
hassoc9502432005-02-01 22:01:48 +00002051DEFUN_DEPRECATED (no_neighbor_capability_route_refresh,
2052 no_neighbor_capability_route_refresh_cmd,
2053 NO_NEIGHBOR_CMD2 "capability route-refresh",
2054 NO_STR
2055 NEIGHBOR_STR
2056 NEIGHBOR_ADDR_STR2
2057 "Advertise capability to the peer\n"
2058 "Advertise route-refresh capability to this neighbor\n")
paul718e3742002-12-13 20:15:29 +00002059{
hassoc9502432005-02-01 22:01:48 +00002060 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00002061}
David Lamparter6b0655a2014-06-04 06:53:35 +02002062
paul718e3742002-12-13 20:15:29 +00002063/* neighbor capability dynamic. */
2064DEFUN (neighbor_capability_dynamic,
2065 neighbor_capability_dynamic_cmd,
2066 NEIGHBOR_CMD2 "capability dynamic",
2067 NEIGHBOR_STR
2068 NEIGHBOR_ADDR_STR2
2069 "Advertise capability to the peer\n"
2070 "Advertise dynamic capability to this neighbor\n")
2071{
2072 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY);
2073}
2074
2075DEFUN (no_neighbor_capability_dynamic,
2076 no_neighbor_capability_dynamic_cmd,
2077 NO_NEIGHBOR_CMD2 "capability dynamic",
2078 NO_STR
2079 NEIGHBOR_STR
2080 NEIGHBOR_ADDR_STR2
2081 "Advertise capability to the peer\n"
2082 "Advertise dynamic capability to this neighbor\n")
2083{
2084 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY);
2085}
David Lamparter6b0655a2014-06-04 06:53:35 +02002086
paul718e3742002-12-13 20:15:29 +00002087/* neighbor dont-capability-negotiate */
2088DEFUN (neighbor_dont_capability_negotiate,
2089 neighbor_dont_capability_negotiate_cmd,
2090 NEIGHBOR_CMD2 "dont-capability-negotiate",
2091 NEIGHBOR_STR
2092 NEIGHBOR_ADDR_STR2
2093 "Do not perform capability negotiation\n")
2094{
2095 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY);
2096}
2097
2098DEFUN (no_neighbor_dont_capability_negotiate,
2099 no_neighbor_dont_capability_negotiate_cmd,
2100 NO_NEIGHBOR_CMD2 "dont-capability-negotiate",
2101 NO_STR
2102 NEIGHBOR_STR
2103 NEIGHBOR_ADDR_STR2
2104 "Do not perform capability negotiation\n")
2105{
2106 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY);
2107}
David Lamparter6b0655a2014-06-04 06:53:35 +02002108
paul94f2b392005-06-28 12:44:16 +00002109static int
paulfd79ac92004-10-13 05:06:08 +00002110peer_af_flag_modify_vty (struct vty *vty, const char *peer_str, afi_t afi,
paulfee0f4c2004-09-13 05:12:46 +00002111 safi_t safi, u_int32_t flag, int set)
paul718e3742002-12-13 20:15:29 +00002112{
2113 int ret;
2114 struct peer *peer;
2115
2116 peer = peer_and_group_lookup_vty (vty, peer_str);
2117 if (! peer)
2118 return CMD_WARNING;
2119
2120 if (set)
2121 ret = peer_af_flag_set (peer, afi, safi, flag);
2122 else
2123 ret = peer_af_flag_unset (peer, afi, safi, flag);
2124
2125 return bgp_vty_return (vty, ret);
2126}
2127
paul94f2b392005-06-28 12:44:16 +00002128static int
paulfd79ac92004-10-13 05:06:08 +00002129peer_af_flag_set_vty (struct vty *vty, const char *peer_str, afi_t afi,
paulfee0f4c2004-09-13 05:12:46 +00002130 safi_t safi, u_int32_t flag)
paul718e3742002-12-13 20:15:29 +00002131{
2132 return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 1);
2133}
2134
paul94f2b392005-06-28 12:44:16 +00002135static int
paulfd79ac92004-10-13 05:06:08 +00002136peer_af_flag_unset_vty (struct vty *vty, const char *peer_str, afi_t afi,
paulfee0f4c2004-09-13 05:12:46 +00002137 safi_t safi, u_int32_t flag)
paul718e3742002-12-13 20:15:29 +00002138{
2139 return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 0);
2140}
David Lamparter6b0655a2014-06-04 06:53:35 +02002141
paul718e3742002-12-13 20:15:29 +00002142/* neighbor capability orf prefix-list. */
2143DEFUN (neighbor_capability_orf_prefix,
2144 neighbor_capability_orf_prefix_cmd,
2145 NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)",
2146 NEIGHBOR_STR
2147 NEIGHBOR_ADDR_STR2
2148 "Advertise capability to the peer\n"
2149 "Advertise ORF capability to the peer\n"
2150 "Advertise prefixlist ORF capability to this neighbor\n"
2151 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
2152 "Capability to RECEIVE the ORF from this neighbor\n"
2153 "Capability to SEND the ORF to this neighbor\n")
2154{
2155 u_int16_t flag = 0;
2156
2157 if (strncmp (argv[1], "s", 1) == 0)
2158 flag = PEER_FLAG_ORF_PREFIX_SM;
2159 else if (strncmp (argv[1], "r", 1) == 0)
2160 flag = PEER_FLAG_ORF_PREFIX_RM;
2161 else if (strncmp (argv[1], "b", 1) == 0)
2162 flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM;
2163 else
2164 return CMD_WARNING;
2165
2166 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2167 bgp_node_safi (vty), flag);
2168}
2169
2170DEFUN (no_neighbor_capability_orf_prefix,
2171 no_neighbor_capability_orf_prefix_cmd,
2172 NO_NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)",
2173 NO_STR
2174 NEIGHBOR_STR
2175 NEIGHBOR_ADDR_STR2
2176 "Advertise capability to the peer\n"
2177 "Advertise ORF capability to the peer\n"
2178 "Advertise prefixlist ORF capability to this neighbor\n"
2179 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
2180 "Capability to RECEIVE the ORF from this neighbor\n"
2181 "Capability to SEND the ORF to this neighbor\n")
2182{
2183 u_int16_t flag = 0;
2184
2185 if (strncmp (argv[1], "s", 1) == 0)
2186 flag = PEER_FLAG_ORF_PREFIX_SM;
2187 else if (strncmp (argv[1], "r", 1) == 0)
2188 flag = PEER_FLAG_ORF_PREFIX_RM;
2189 else if (strncmp (argv[1], "b", 1) == 0)
2190 flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM;
2191 else
2192 return CMD_WARNING;
2193
2194 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2195 bgp_node_safi (vty), flag);
2196}
David Lamparter6b0655a2014-06-04 06:53:35 +02002197
paul718e3742002-12-13 20:15:29 +00002198/* neighbor next-hop-self. */
2199DEFUN (neighbor_nexthop_self,
2200 neighbor_nexthop_self_cmd,
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002201 NEIGHBOR_CMD2 "next-hop-self {all}",
paul718e3742002-12-13 20:15:29 +00002202 NEIGHBOR_STR
2203 NEIGHBOR_ADDR_STR2
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002204 "Disable the next hop calculation for this neighbor\n"
2205 "Apply also to ibgp-learned routes when acting as a route reflector\n")
paul718e3742002-12-13 20:15:29 +00002206{
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002207 u_int32_t flags = PEER_FLAG_NEXTHOP_SELF, unset = 0;
2208 int rc;
2209
2210 /* Check if "all" is specified */
2211 if (argv[1] != NULL)
2212 flags |= PEER_FLAG_NEXTHOP_SELF_ALL;
2213 else
2214 unset |= PEER_FLAG_NEXTHOP_SELF_ALL;
2215
2216 rc = peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2217 bgp_node_safi (vty), flags);
2218 if ( rc == CMD_SUCCESS && unset )
2219 rc = peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2220 bgp_node_safi (vty), unset);
2221 return rc;
paul718e3742002-12-13 20:15:29 +00002222}
2223
2224DEFUN (no_neighbor_nexthop_self,
2225 no_neighbor_nexthop_self_cmd,
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002226 NO_NEIGHBOR_CMD2 "next-hop-self {all}",
paul718e3742002-12-13 20:15:29 +00002227 NO_STR
2228 NEIGHBOR_STR
2229 NEIGHBOR_ADDR_STR2
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002230 "Disable the next hop calculation for this neighbor\n"
2231 "Apply also to ibgp-learned routes when acting as a route reflector\n")
paul718e3742002-12-13 20:15:29 +00002232{
2233 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002234 bgp_node_safi (vty),
2235 PEER_FLAG_NEXTHOP_SELF|PEER_FLAG_NEXTHOP_SELF_ALL);
paul718e3742002-12-13 20:15:29 +00002236}
David Lamparter6b0655a2014-06-04 06:53:35 +02002237
paul718e3742002-12-13 20:15:29 +00002238/* neighbor remove-private-AS. */
2239DEFUN (neighbor_remove_private_as,
2240 neighbor_remove_private_as_cmd,
2241 NEIGHBOR_CMD2 "remove-private-AS",
2242 NEIGHBOR_STR
2243 NEIGHBOR_ADDR_STR2
2244 "Remove private AS number from outbound updates\n")
2245{
2246 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2247 bgp_node_safi (vty),
2248 PEER_FLAG_REMOVE_PRIVATE_AS);
2249}
2250
2251DEFUN (no_neighbor_remove_private_as,
2252 no_neighbor_remove_private_as_cmd,
2253 NO_NEIGHBOR_CMD2 "remove-private-AS",
2254 NO_STR
2255 NEIGHBOR_STR
2256 NEIGHBOR_ADDR_STR2
2257 "Remove private AS number from outbound updates\n")
2258{
2259 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2260 bgp_node_safi (vty),
2261 PEER_FLAG_REMOVE_PRIVATE_AS);
2262}
David Lamparter6b0655a2014-06-04 06:53:35 +02002263
paul718e3742002-12-13 20:15:29 +00002264/* neighbor send-community. */
2265DEFUN (neighbor_send_community,
2266 neighbor_send_community_cmd,
2267 NEIGHBOR_CMD2 "send-community",
2268 NEIGHBOR_STR
2269 NEIGHBOR_ADDR_STR2
2270 "Send Community attribute to this neighbor\n")
2271{
2272 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2273 bgp_node_safi (vty),
2274 PEER_FLAG_SEND_COMMUNITY);
2275}
2276
2277DEFUN (no_neighbor_send_community,
2278 no_neighbor_send_community_cmd,
2279 NO_NEIGHBOR_CMD2 "send-community",
2280 NO_STR
2281 NEIGHBOR_STR
2282 NEIGHBOR_ADDR_STR2
2283 "Send Community attribute to this neighbor\n")
2284{
2285 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2286 bgp_node_safi (vty),
2287 PEER_FLAG_SEND_COMMUNITY);
2288}
David Lamparter6b0655a2014-06-04 06:53:35 +02002289
paul718e3742002-12-13 20:15:29 +00002290/* neighbor send-community extended. */
2291DEFUN (neighbor_send_community_type,
2292 neighbor_send_community_type_cmd,
2293 NEIGHBOR_CMD2 "send-community (both|extended|standard)",
2294 NEIGHBOR_STR
2295 NEIGHBOR_ADDR_STR2
2296 "Send Community attribute to this neighbor\n"
2297 "Send Standard and Extended Community attributes\n"
2298 "Send Extended Community attributes\n"
2299 "Send Standard Community attributes\n")
2300{
2301 if (strncmp (argv[1], "s", 1) == 0)
2302 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2303 bgp_node_safi (vty),
2304 PEER_FLAG_SEND_COMMUNITY);
2305 if (strncmp (argv[1], "e", 1) == 0)
2306 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2307 bgp_node_safi (vty),
2308 PEER_FLAG_SEND_EXT_COMMUNITY);
2309
2310 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2311 bgp_node_safi (vty),
2312 (PEER_FLAG_SEND_COMMUNITY|
2313 PEER_FLAG_SEND_EXT_COMMUNITY));
2314}
2315
2316DEFUN (no_neighbor_send_community_type,
2317 no_neighbor_send_community_type_cmd,
2318 NO_NEIGHBOR_CMD2 "send-community (both|extended|standard)",
2319 NO_STR
2320 NEIGHBOR_STR
2321 NEIGHBOR_ADDR_STR2
2322 "Send Community attribute to this neighbor\n"
2323 "Send Standard and Extended Community attributes\n"
2324 "Send Extended Community attributes\n"
2325 "Send Standard Community attributes\n")
2326{
2327 if (strncmp (argv[1], "s", 1) == 0)
2328 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2329 bgp_node_safi (vty),
2330 PEER_FLAG_SEND_COMMUNITY);
2331 if (strncmp (argv[1], "e", 1) == 0)
2332 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2333 bgp_node_safi (vty),
2334 PEER_FLAG_SEND_EXT_COMMUNITY);
2335
2336 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2337 bgp_node_safi (vty),
2338 (PEER_FLAG_SEND_COMMUNITY |
2339 PEER_FLAG_SEND_EXT_COMMUNITY));
2340}
David Lamparter6b0655a2014-06-04 06:53:35 +02002341
paul718e3742002-12-13 20:15:29 +00002342/* neighbor soft-reconfig. */
2343DEFUN (neighbor_soft_reconfiguration,
2344 neighbor_soft_reconfiguration_cmd,
2345 NEIGHBOR_CMD2 "soft-reconfiguration inbound",
2346 NEIGHBOR_STR
2347 NEIGHBOR_ADDR_STR2
2348 "Per neighbor soft reconfiguration\n"
2349 "Allow inbound soft reconfiguration for this neighbor\n")
2350{
2351 return peer_af_flag_set_vty (vty, argv[0],
2352 bgp_node_afi (vty), bgp_node_safi (vty),
2353 PEER_FLAG_SOFT_RECONFIG);
2354}
2355
2356DEFUN (no_neighbor_soft_reconfiguration,
2357 no_neighbor_soft_reconfiguration_cmd,
2358 NO_NEIGHBOR_CMD2 "soft-reconfiguration inbound",
2359 NO_STR
2360 NEIGHBOR_STR
2361 NEIGHBOR_ADDR_STR2
2362 "Per neighbor soft reconfiguration\n"
2363 "Allow inbound soft reconfiguration for this neighbor\n")
2364{
2365 return peer_af_flag_unset_vty (vty, argv[0],
2366 bgp_node_afi (vty), bgp_node_safi (vty),
2367 PEER_FLAG_SOFT_RECONFIG);
2368}
David Lamparter6b0655a2014-06-04 06:53:35 +02002369
paul718e3742002-12-13 20:15:29 +00002370DEFUN (neighbor_route_reflector_client,
2371 neighbor_route_reflector_client_cmd,
2372 NEIGHBOR_CMD2 "route-reflector-client",
2373 NEIGHBOR_STR
2374 NEIGHBOR_ADDR_STR2
2375 "Configure a neighbor as Route Reflector client\n")
2376{
2377 struct peer *peer;
2378
2379
2380 peer = peer_and_group_lookup_vty (vty, argv[0]);
2381 if (! peer)
2382 return CMD_WARNING;
2383
2384 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2385 bgp_node_safi (vty),
2386 PEER_FLAG_REFLECTOR_CLIENT);
2387}
2388
2389DEFUN (no_neighbor_route_reflector_client,
2390 no_neighbor_route_reflector_client_cmd,
2391 NO_NEIGHBOR_CMD2 "route-reflector-client",
2392 NO_STR
2393 NEIGHBOR_STR
2394 NEIGHBOR_ADDR_STR2
2395 "Configure a neighbor as Route Reflector client\n")
2396{
2397 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2398 bgp_node_safi (vty),
2399 PEER_FLAG_REFLECTOR_CLIENT);
2400}
David Lamparter6b0655a2014-06-04 06:53:35 +02002401
paul94f2b392005-06-28 12:44:16 +00002402static int
paulfd79ac92004-10-13 05:06:08 +00002403peer_rsclient_set_vty (struct vty *vty, const char *peer_str,
2404 int afi, int safi)
paulfee0f4c2004-09-13 05:12:46 +00002405{
2406 int ret;
2407 struct bgp *bgp;
2408 struct peer *peer;
2409 struct peer_group *group;
paul1eb8ef22005-04-07 07:30:20 +00002410 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00002411 struct bgp_filter *pfilter;
2412 struct bgp_filter *gfilter;
Chris Caputo228da422009-07-18 05:44:03 +00002413 int locked_and_added = 0;
paulfee0f4c2004-09-13 05:12:46 +00002414
2415 bgp = vty->index;
2416
2417 peer = peer_and_group_lookup_vty (vty, peer_str);
2418 if ( ! peer )
2419 return CMD_WARNING;
2420
2421 /* If it is already a RS-Client, don't do anything. */
2422 if ( CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) )
2423 return CMD_SUCCESS;
2424
2425 if ( ! peer_rsclient_active (peer) )
paul200df112005-06-01 11:17:05 +00002426 {
2427 peer = peer_lock (peer); /* rsclient peer list reference */
2428 listnode_add_sort (bgp->rsclient, peer);
Chris Caputo228da422009-07-18 05:44:03 +00002429 locked_and_added = 1;
paul200df112005-06-01 11:17:05 +00002430 }
paulfee0f4c2004-09-13 05:12:46 +00002431
2432 ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2433 if (ret < 0)
Chris Caputo228da422009-07-18 05:44:03 +00002434 {
2435 if (locked_and_added)
2436 {
2437 listnode_delete (bgp->rsclient, peer);
2438 peer_unlock (peer); /* rsclient peer list reference */
2439 }
2440
2441 return bgp_vty_return (vty, ret);
2442 }
paulfee0f4c2004-09-13 05:12:46 +00002443
Paul Jakma64e580a2006-02-21 01:09:01 +00002444 peer->rib[afi][safi] = bgp_table_init (afi, safi);
paulfee0f4c2004-09-13 05:12:46 +00002445 peer->rib[afi][safi]->type = BGP_TABLE_RSCLIENT;
Chris Caputo228da422009-07-18 05:44:03 +00002446 /* RIB peer reference. Released when table is free'd in bgp_table_free. */
2447 peer->rib[afi][safi]->owner = peer_lock (peer);
paulfee0f4c2004-09-13 05:12:46 +00002448
2449 /* Check for existing 'network' and 'redistribute' routes. */
2450 bgp_check_local_routes_rsclient (peer, afi, safi);
2451
2452 /* Check for routes for peers configured with 'soft-reconfiguration'. */
2453 bgp_soft_reconfig_rsclient (peer, afi, safi);
2454
2455 if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP))
2456 {
2457 group = peer->group;
2458 gfilter = &peer->filter[afi][safi];
2459
paul1eb8ef22005-04-07 07:30:20 +00002460 for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00002461 {
2462 pfilter = &peer->filter[afi][safi];
2463
2464 /* Members of a non-RS-Client group should not be RS-Clients, as that
2465 is checked when the become part of the peer-group */
2466 ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2467 if (ret < 0)
2468 return bgp_vty_return (vty, ret);
2469
2470 /* Make peer's RIB point to group's RIB. */
2471 peer->rib[afi][safi] = group->conf->rib[afi][safi];
2472
2473 /* Import policy. */
2474 if (pfilter->map[RMAP_IMPORT].name)
2475 free (pfilter->map[RMAP_IMPORT].name);
2476 if (gfilter->map[RMAP_IMPORT].name)
2477 {
2478 pfilter->map[RMAP_IMPORT].name = strdup (gfilter->map[RMAP_IMPORT].name);
2479 pfilter->map[RMAP_IMPORT].map = gfilter->map[RMAP_IMPORT].map;
2480 }
2481 else
2482 {
2483 pfilter->map[RMAP_IMPORT].name = NULL;
2484 pfilter->map[RMAP_IMPORT].map =NULL;
2485 }
2486
2487 /* Export policy. */
2488 if (gfilter->map[RMAP_EXPORT].name && ! pfilter->map[RMAP_EXPORT].name)
2489 {
2490 pfilter->map[RMAP_EXPORT].name = strdup (gfilter->map[RMAP_EXPORT].name);
2491 pfilter->map[RMAP_EXPORT].map = gfilter->map[RMAP_EXPORT].map;
2492 }
2493 }
2494 }
2495 return CMD_SUCCESS;
2496}
2497
paul94f2b392005-06-28 12:44:16 +00002498static int
paulfd79ac92004-10-13 05:06:08 +00002499peer_rsclient_unset_vty (struct vty *vty, const char *peer_str,
2500 int afi, int safi)
paulfee0f4c2004-09-13 05:12:46 +00002501{
2502 int ret;
2503 struct bgp *bgp;
2504 struct peer *peer;
2505 struct peer_group *group;
paul1eb8ef22005-04-07 07:30:20 +00002506 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00002507
2508 bgp = vty->index;
2509
2510 peer = peer_and_group_lookup_vty (vty, peer_str);
2511 if ( ! peer )
2512 return CMD_WARNING;
2513
2514 /* If it is not a RS-Client, don't do anything. */
2515 if ( ! CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) )
2516 return CMD_SUCCESS;
2517
2518 if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP))
2519 {
2520 group = peer->group;
2521
paul1eb8ef22005-04-07 07:30:20 +00002522 for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00002523 {
2524 ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2525 if (ret < 0)
2526 return bgp_vty_return (vty, ret);
2527
2528 peer->rib[afi][safi] = NULL;
2529 }
2530
2531 peer = group->conf;
2532 }
2533
2534 ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2535 if (ret < 0)
2536 return bgp_vty_return (vty, ret);
2537
2538 if ( ! peer_rsclient_active (peer) )
paul200df112005-06-01 11:17:05 +00002539 {
Chris Caputo228da422009-07-18 05:44:03 +00002540 bgp_clear_route (peer, afi, safi, BGP_CLEAR_ROUTE_MY_RSCLIENT);
paul200df112005-06-01 11:17:05 +00002541 listnode_delete (bgp->rsclient, peer);
Chris Caputo228da422009-07-18 05:44:03 +00002542 peer_unlock (peer); /* peer bgp rsclient reference */
paul200df112005-06-01 11:17:05 +00002543 }
paulfee0f4c2004-09-13 05:12:46 +00002544
Paul Jakmab608d5b2008-07-02 02:12:07 +00002545 bgp_table_finish (&peer->rib[bgp_node_afi(vty)][bgp_node_safi(vty)]);
paulfee0f4c2004-09-13 05:12:46 +00002546
2547 return CMD_SUCCESS;
2548}
David Lamparter6b0655a2014-06-04 06:53:35 +02002549
paul718e3742002-12-13 20:15:29 +00002550/* neighbor route-server-client. */
2551DEFUN (neighbor_route_server_client,
2552 neighbor_route_server_client_cmd,
2553 NEIGHBOR_CMD2 "route-server-client",
2554 NEIGHBOR_STR
2555 NEIGHBOR_ADDR_STR2
2556 "Configure a neighbor as Route Server client\n")
2557{
paulfee0f4c2004-09-13 05:12:46 +00002558 return peer_rsclient_set_vty (vty, argv[0], bgp_node_afi(vty),
2559 bgp_node_safi(vty));
paul718e3742002-12-13 20:15:29 +00002560}
2561
2562DEFUN (no_neighbor_route_server_client,
2563 no_neighbor_route_server_client_cmd,
2564 NO_NEIGHBOR_CMD2 "route-server-client",
2565 NO_STR
2566 NEIGHBOR_STR
2567 NEIGHBOR_ADDR_STR2
2568 "Configure a neighbor as Route Server client\n")
2569{
paulfee0f4c2004-09-13 05:12:46 +00002570 return peer_rsclient_unset_vty (vty, argv[0], bgp_node_afi(vty),
2571 bgp_node_safi(vty));
2572}
David Lamparter6b0655a2014-06-04 06:53:35 +02002573
paulfee0f4c2004-09-13 05:12:46 +00002574DEFUN (neighbor_nexthop_local_unchanged,
2575 neighbor_nexthop_local_unchanged_cmd,
2576 NEIGHBOR_CMD2 "nexthop-local unchanged",
2577 NEIGHBOR_STR
2578 NEIGHBOR_ADDR_STR2
2579 "Configure treatment of outgoing link-local nexthop attribute\n"
2580 "Leave link-local nexthop unchanged for this peer\n")
2581{
2582 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2583 bgp_node_safi (vty),
2584 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED );
2585}
David Lamparter6b0655a2014-06-04 06:53:35 +02002586
paulfee0f4c2004-09-13 05:12:46 +00002587DEFUN (no_neighbor_nexthop_local_unchanged,
2588 no_neighbor_nexthop_local_unchanged_cmd,
2589 NO_NEIGHBOR_CMD2 "nexthop-local unchanged",
2590 NO_STR
2591 NEIGHBOR_STR
2592 NEIGHBOR_ADDR_STR2
2593 "Configure treatment of outgoing link-local-nexthop attribute\n"
2594 "Leave link-local nexthop unchanged for this peer\n")
2595{
paul718e3742002-12-13 20:15:29 +00002596 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2597 bgp_node_safi (vty),
paulfee0f4c2004-09-13 05:12:46 +00002598 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED );
paul718e3742002-12-13 20:15:29 +00002599}
David Lamparter6b0655a2014-06-04 06:53:35 +02002600
paul718e3742002-12-13 20:15:29 +00002601DEFUN (neighbor_attr_unchanged,
2602 neighbor_attr_unchanged_cmd,
2603 NEIGHBOR_CMD2 "attribute-unchanged",
2604 NEIGHBOR_STR
2605 NEIGHBOR_ADDR_STR2
2606 "BGP attribute is propagated unchanged to this neighbor\n")
2607{
2608 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2609 bgp_node_safi (vty),
2610 (PEER_FLAG_AS_PATH_UNCHANGED |
2611 PEER_FLAG_NEXTHOP_UNCHANGED |
2612 PEER_FLAG_MED_UNCHANGED));
2613}
2614
2615DEFUN (neighbor_attr_unchanged1,
2616 neighbor_attr_unchanged1_cmd,
2617 NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)",
2618 NEIGHBOR_STR
2619 NEIGHBOR_ADDR_STR2
2620 "BGP attribute is propagated unchanged to this neighbor\n"
2621 "As-path attribute\n"
2622 "Nexthop attribute\n"
2623 "Med attribute\n")
2624{
2625 u_int16_t flags = 0;
2626
2627 if (strncmp (argv[1], "as-path", 1) == 0)
2628 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2629 else if (strncmp (argv[1], "next-hop", 1) == 0)
2630 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2631 else if (strncmp (argv[1], "med", 1) == 0)
2632 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2633
2634 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2635 bgp_node_safi (vty), flags);
2636}
2637
2638DEFUN (neighbor_attr_unchanged2,
2639 neighbor_attr_unchanged2_cmd,
2640 NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)",
2641 NEIGHBOR_STR
2642 NEIGHBOR_ADDR_STR2
2643 "BGP attribute is propagated unchanged to this neighbor\n"
2644 "As-path attribute\n"
2645 "Nexthop attribute\n"
2646 "Med attribute\n")
2647{
2648 u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED;
2649
2650 if (strncmp (argv[1], "next-hop", 1) == 0)
2651 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2652 else if (strncmp (argv[1], "med", 1) == 0)
2653 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2654
2655 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2656 bgp_node_safi (vty), flags);
2657
2658}
2659
2660DEFUN (neighbor_attr_unchanged3,
2661 neighbor_attr_unchanged3_cmd,
2662 NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)",
2663 NEIGHBOR_STR
2664 NEIGHBOR_ADDR_STR2
2665 "BGP attribute is propagated unchanged to this neighbor\n"
2666 "Nexthop attribute\n"
2667 "As-path attribute\n"
2668 "Med attribute\n")
2669{
2670 u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED;
2671
2672 if (strncmp (argv[1], "as-path", 1) == 0)
2673 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2674 else if (strncmp (argv[1], "med", 1) == 0)
2675 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2676
2677 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2678 bgp_node_safi (vty), flags);
2679}
2680
2681DEFUN (neighbor_attr_unchanged4,
2682 neighbor_attr_unchanged4_cmd,
2683 NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)",
2684 NEIGHBOR_STR
2685 NEIGHBOR_ADDR_STR2
2686 "BGP attribute is propagated unchanged to this neighbor\n"
2687 "Med attribute\n"
2688 "As-path attribute\n"
2689 "Nexthop attribute\n")
2690{
2691 u_int16_t flags = PEER_FLAG_MED_UNCHANGED;
2692
2693 if (strncmp (argv[1], "as-path", 1) == 0)
2694 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2695 else if (strncmp (argv[1], "next-hop", 1) == 0)
2696 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2697
2698 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2699 bgp_node_safi (vty), flags);
2700}
2701
2702ALIAS (neighbor_attr_unchanged,
2703 neighbor_attr_unchanged5_cmd,
2704 NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med",
2705 NEIGHBOR_STR
2706 NEIGHBOR_ADDR_STR2
2707 "BGP attribute is propagated unchanged to this neighbor\n"
2708 "As-path attribute\n"
2709 "Nexthop attribute\n"
2710 "Med attribute\n")
2711
2712ALIAS (neighbor_attr_unchanged,
2713 neighbor_attr_unchanged6_cmd,
2714 NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop",
2715 NEIGHBOR_STR
2716 NEIGHBOR_ADDR_STR2
2717 "BGP attribute is propagated unchanged to this neighbor\n"
2718 "As-path attribute\n"
2719 "Med attribute\n"
2720 "Nexthop attribute\n")
2721
2722ALIAS (neighbor_attr_unchanged,
2723 neighbor_attr_unchanged7_cmd,
2724 NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path",
2725 NEIGHBOR_STR
2726 NEIGHBOR_ADDR_STR2
2727 "BGP attribute is propagated unchanged to this neighbor\n"
2728 "Nexthop attribute\n"
2729 "Med attribute\n"
2730 "As-path attribute\n")
2731
2732ALIAS (neighbor_attr_unchanged,
2733 neighbor_attr_unchanged8_cmd,
2734 NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med",
2735 NEIGHBOR_STR
2736 NEIGHBOR_ADDR_STR2
2737 "BGP attribute is propagated unchanged to this neighbor\n"
2738 "Nexthop attribute\n"
2739 "As-path attribute\n"
2740 "Med attribute\n")
2741
2742ALIAS (neighbor_attr_unchanged,
2743 neighbor_attr_unchanged9_cmd,
2744 NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path",
2745 NEIGHBOR_STR
2746 NEIGHBOR_ADDR_STR2
2747 "BGP attribute is propagated unchanged to this neighbor\n"
2748 "Med attribute\n"
2749 "Nexthop attribute\n"
2750 "As-path attribute\n")
2751
2752ALIAS (neighbor_attr_unchanged,
2753 neighbor_attr_unchanged10_cmd,
2754 NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop",
2755 NEIGHBOR_STR
2756 NEIGHBOR_ADDR_STR2
2757 "BGP attribute is propagated unchanged to this neighbor\n"
2758 "Med attribute\n"
2759 "As-path attribute\n"
2760 "Nexthop attribute\n")
2761
2762DEFUN (no_neighbor_attr_unchanged,
2763 no_neighbor_attr_unchanged_cmd,
2764 NO_NEIGHBOR_CMD2 "attribute-unchanged",
2765 NO_STR
2766 NEIGHBOR_STR
2767 NEIGHBOR_ADDR_STR2
2768 "BGP attribute is propagated unchanged to this neighbor\n")
2769{
2770 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2771 bgp_node_safi (vty),
2772 (PEER_FLAG_AS_PATH_UNCHANGED |
2773 PEER_FLAG_NEXTHOP_UNCHANGED |
2774 PEER_FLAG_MED_UNCHANGED));
2775}
2776
2777DEFUN (no_neighbor_attr_unchanged1,
2778 no_neighbor_attr_unchanged1_cmd,
2779 NO_NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)",
2780 NO_STR
2781 NEIGHBOR_STR
2782 NEIGHBOR_ADDR_STR2
2783 "BGP attribute is propagated unchanged to this neighbor\n"
2784 "As-path attribute\n"
2785 "Nexthop attribute\n"
2786 "Med attribute\n")
2787{
2788 u_int16_t flags = 0;
2789
2790 if (strncmp (argv[1], "as-path", 1) == 0)
2791 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2792 else if (strncmp (argv[1], "next-hop", 1) == 0)
2793 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2794 else if (strncmp (argv[1], "med", 1) == 0)
2795 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2796
2797 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2798 bgp_node_safi (vty), flags);
2799}
2800
2801DEFUN (no_neighbor_attr_unchanged2,
2802 no_neighbor_attr_unchanged2_cmd,
2803 NO_NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)",
2804 NO_STR
2805 NEIGHBOR_STR
2806 NEIGHBOR_ADDR_STR2
2807 "BGP attribute is propagated unchanged to this neighbor\n"
2808 "As-path attribute\n"
2809 "Nexthop attribute\n"
2810 "Med attribute\n")
2811{
2812 u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED;
2813
2814 if (strncmp (argv[1], "next-hop", 1) == 0)
2815 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2816 else if (strncmp (argv[1], "med", 1) == 0)
2817 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2818
2819 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2820 bgp_node_safi (vty), flags);
2821}
2822
2823DEFUN (no_neighbor_attr_unchanged3,
2824 no_neighbor_attr_unchanged3_cmd,
2825 NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)",
2826 NO_STR
2827 NEIGHBOR_STR
2828 NEIGHBOR_ADDR_STR2
2829 "BGP attribute is propagated unchanged to this neighbor\n"
2830 "Nexthop attribute\n"
2831 "As-path attribute\n"
2832 "Med attribute\n")
2833{
2834 u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED;
2835
2836 if (strncmp (argv[1], "as-path", 1) == 0)
2837 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2838 else if (strncmp (argv[1], "med", 1) == 0)
2839 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2840
2841 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2842 bgp_node_safi (vty), flags);
2843}
2844
2845DEFUN (no_neighbor_attr_unchanged4,
2846 no_neighbor_attr_unchanged4_cmd,
2847 NO_NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)",
2848 NO_STR
2849 NEIGHBOR_STR
2850 NEIGHBOR_ADDR_STR2
2851 "BGP attribute is propagated unchanged to this neighbor\n"
2852 "Med attribute\n"
2853 "As-path attribute\n"
2854 "Nexthop attribute\n")
2855{
2856 u_int16_t flags = PEER_FLAG_MED_UNCHANGED;
2857
2858 if (strncmp (argv[1], "as-path", 1) == 0)
2859 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2860 else if (strncmp (argv[1], "next-hop", 1) == 0)
2861 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2862
2863 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2864 bgp_node_safi (vty), flags);
2865}
2866
2867ALIAS (no_neighbor_attr_unchanged,
2868 no_neighbor_attr_unchanged5_cmd,
2869 NO_NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med",
2870 NO_STR
2871 NEIGHBOR_STR
2872 NEIGHBOR_ADDR_STR2
2873 "BGP attribute is propagated unchanged to this neighbor\n"
2874 "As-path attribute\n"
2875 "Nexthop attribute\n"
2876 "Med attribute\n")
2877
2878ALIAS (no_neighbor_attr_unchanged,
2879 no_neighbor_attr_unchanged6_cmd,
2880 NO_NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop",
2881 NO_STR
2882 NEIGHBOR_STR
2883 NEIGHBOR_ADDR_STR2
2884 "BGP attribute is propagated unchanged to this neighbor\n"
2885 "As-path attribute\n"
2886 "Med attribute\n"
2887 "Nexthop attribute\n")
2888
2889ALIAS (no_neighbor_attr_unchanged,
2890 no_neighbor_attr_unchanged7_cmd,
2891 NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path",
2892 NO_STR
2893 NEIGHBOR_STR
2894 NEIGHBOR_ADDR_STR2
2895 "BGP attribute is propagated unchanged to this neighbor\n"
2896 "Nexthop attribute\n"
2897 "Med attribute\n"
2898 "As-path attribute\n")
2899
2900ALIAS (no_neighbor_attr_unchanged,
2901 no_neighbor_attr_unchanged8_cmd,
2902 NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med",
2903 NO_STR
2904 NEIGHBOR_STR
2905 NEIGHBOR_ADDR_STR2
2906 "BGP attribute is propagated unchanged to this neighbor\n"
2907 "Nexthop attribute\n"
2908 "As-path attribute\n"
2909 "Med attribute\n")
2910
2911ALIAS (no_neighbor_attr_unchanged,
2912 no_neighbor_attr_unchanged9_cmd,
2913 NO_NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path",
2914 NO_STR
2915 NEIGHBOR_STR
2916 NEIGHBOR_ADDR_STR2
2917 "BGP attribute is propagated unchanged to this neighbor\n"
2918 "Med attribute\n"
2919 "Nexthop attribute\n"
2920 "As-path attribute\n")
2921
2922ALIAS (no_neighbor_attr_unchanged,
2923 no_neighbor_attr_unchanged10_cmd,
2924 NO_NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop",
2925 NO_STR
2926 NEIGHBOR_STR
2927 NEIGHBOR_ADDR_STR2
2928 "BGP attribute is propagated unchanged to this neighbor\n"
2929 "Med attribute\n"
2930 "As-path attribute\n"
2931 "Nexthop attribute\n")
2932
2933/* For old version Zebra compatibility. */
hassodd4c5932005-02-02 17:15:34 +00002934DEFUN_DEPRECATED (neighbor_transparent_as,
2935 neighbor_transparent_as_cmd,
2936 NEIGHBOR_CMD "transparent-as",
2937 NEIGHBOR_STR
2938 NEIGHBOR_ADDR_STR
2939 "Do not append my AS number even peer is EBGP peer\n")
paul718e3742002-12-13 20:15:29 +00002940{
2941 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2942 bgp_node_safi (vty),
2943 PEER_FLAG_AS_PATH_UNCHANGED);
2944}
2945
hassodd4c5932005-02-02 17:15:34 +00002946DEFUN_DEPRECATED (neighbor_transparent_nexthop,
2947 neighbor_transparent_nexthop_cmd,
2948 NEIGHBOR_CMD "transparent-nexthop",
2949 NEIGHBOR_STR
2950 NEIGHBOR_ADDR_STR
2951 "Do not change nexthop even peer is EBGP peer\n")
paul718e3742002-12-13 20:15:29 +00002952{
2953 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2954 bgp_node_safi (vty),
2955 PEER_FLAG_NEXTHOP_UNCHANGED);
2956}
David Lamparter6b0655a2014-06-04 06:53:35 +02002957
paul718e3742002-12-13 20:15:29 +00002958/* EBGP multihop configuration. */
paul94f2b392005-06-28 12:44:16 +00002959static int
paulfd79ac92004-10-13 05:06:08 +00002960peer_ebgp_multihop_set_vty (struct vty *vty, const char *ip_str,
2961 const char *ttl_str)
paul718e3742002-12-13 20:15:29 +00002962{
2963 struct peer *peer;
paulfd79ac92004-10-13 05:06:08 +00002964 unsigned int ttl;
paul718e3742002-12-13 20:15:29 +00002965
2966 peer = peer_and_group_lookup_vty (vty, ip_str);
2967 if (! peer)
2968 return CMD_WARNING;
2969
2970 if (! ttl_str)
2971 ttl = TTL_MAX;
2972 else
2973 VTY_GET_INTEGER_RANGE ("TTL", ttl, ttl_str, 1, 255);
2974
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00002975 return bgp_vty_return (vty, peer_ebgp_multihop_set (peer, ttl));
paul718e3742002-12-13 20:15:29 +00002976}
2977
paul94f2b392005-06-28 12:44:16 +00002978static int
paulfd79ac92004-10-13 05:06:08 +00002979peer_ebgp_multihop_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00002980{
2981 struct peer *peer;
2982
2983 peer = peer_and_group_lookup_vty (vty, ip_str);
2984 if (! peer)
2985 return CMD_WARNING;
2986
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00002987 return bgp_vty_return (vty, peer_ebgp_multihop_unset (peer));
paul718e3742002-12-13 20:15:29 +00002988}
2989
2990/* neighbor ebgp-multihop. */
2991DEFUN (neighbor_ebgp_multihop,
2992 neighbor_ebgp_multihop_cmd,
2993 NEIGHBOR_CMD2 "ebgp-multihop",
2994 NEIGHBOR_STR
2995 NEIGHBOR_ADDR_STR2
2996 "Allow EBGP neighbors not on directly connected networks\n")
2997{
2998 return peer_ebgp_multihop_set_vty (vty, argv[0], NULL);
2999}
3000
3001DEFUN (neighbor_ebgp_multihop_ttl,
3002 neighbor_ebgp_multihop_ttl_cmd,
3003 NEIGHBOR_CMD2 "ebgp-multihop <1-255>",
3004 NEIGHBOR_STR
3005 NEIGHBOR_ADDR_STR2
3006 "Allow EBGP neighbors not on directly connected networks\n"
3007 "maximum hop count\n")
3008{
3009 return peer_ebgp_multihop_set_vty (vty, argv[0], argv[1]);
3010}
3011
3012DEFUN (no_neighbor_ebgp_multihop,
3013 no_neighbor_ebgp_multihop_cmd,
3014 NO_NEIGHBOR_CMD2 "ebgp-multihop",
3015 NO_STR
3016 NEIGHBOR_STR
3017 NEIGHBOR_ADDR_STR2
3018 "Allow EBGP neighbors not on directly connected networks\n")
3019{
3020 return peer_ebgp_multihop_unset_vty (vty, argv[0]);
3021}
3022
3023ALIAS (no_neighbor_ebgp_multihop,
3024 no_neighbor_ebgp_multihop_ttl_cmd,
3025 NO_NEIGHBOR_CMD2 "ebgp-multihop <1-255>",
3026 NO_STR
3027 NEIGHBOR_STR
3028 NEIGHBOR_ADDR_STR2
3029 "Allow EBGP neighbors not on directly connected networks\n"
3030 "maximum hop count\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003031
hasso6ffd2072005-02-02 14:50:11 +00003032/* disable-connected-check */
3033DEFUN (neighbor_disable_connected_check,
3034 neighbor_disable_connected_check_cmd,
3035 NEIGHBOR_CMD2 "disable-connected-check",
3036 NEIGHBOR_STR
3037 NEIGHBOR_ADDR_STR2
3038 "one-hop away EBGP peer using loopback address\n")
3039{
3040 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK);
3041}
3042
3043DEFUN (no_neighbor_disable_connected_check,
3044 no_neighbor_disable_connected_check_cmd,
3045 NO_NEIGHBOR_CMD2 "disable-connected-check",
3046 NO_STR
3047 NEIGHBOR_STR
3048 NEIGHBOR_ADDR_STR2
3049 "one-hop away EBGP peer using loopback address\n")
3050{
3051 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK);
3052}
3053
paul718e3742002-12-13 20:15:29 +00003054/* Enforce multihop. */
hasso6ffd2072005-02-02 14:50:11 +00003055ALIAS (neighbor_disable_connected_check,
paul718e3742002-12-13 20:15:29 +00003056 neighbor_enforce_multihop_cmd,
3057 NEIGHBOR_CMD2 "enforce-multihop",
3058 NEIGHBOR_STR
3059 NEIGHBOR_ADDR_STR2
paule8e19462006-01-19 20:16:55 +00003060 "Enforce EBGP neighbors perform multihop\n")
paul718e3742002-12-13 20:15:29 +00003061
hasso6ffd2072005-02-02 14:50:11 +00003062/* Enforce multihop. */
3063ALIAS (no_neighbor_disable_connected_check,
paul718e3742002-12-13 20:15:29 +00003064 no_neighbor_enforce_multihop_cmd,
3065 NO_NEIGHBOR_CMD2 "enforce-multihop",
3066 NO_STR
3067 NEIGHBOR_STR
3068 NEIGHBOR_ADDR_STR2
paule8e19462006-01-19 20:16:55 +00003069 "Enforce EBGP neighbors perform multihop\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003070
paul718e3742002-12-13 20:15:29 +00003071DEFUN (neighbor_description,
3072 neighbor_description_cmd,
3073 NEIGHBOR_CMD2 "description .LINE",
3074 NEIGHBOR_STR
3075 NEIGHBOR_ADDR_STR2
3076 "Neighbor specific description\n"
3077 "Up to 80 characters describing this neighbor\n")
3078{
3079 struct peer *peer;
paul718e3742002-12-13 20:15:29 +00003080 char *str;
paul718e3742002-12-13 20:15:29 +00003081
3082 peer = peer_and_group_lookup_vty (vty, argv[0]);
3083 if (! peer)
3084 return CMD_WARNING;
3085
3086 if (argc == 1)
3087 return CMD_SUCCESS;
3088
ajs3b8b1852005-01-29 18:19:13 +00003089 str = argv_concat(argv, argc, 1);
paul718e3742002-12-13 20:15:29 +00003090
3091 peer_description_set (peer, str);
3092
ajs3b8b1852005-01-29 18:19:13 +00003093 XFREE (MTYPE_TMP, str);
paul718e3742002-12-13 20:15:29 +00003094
3095 return CMD_SUCCESS;
3096}
3097
3098DEFUN (no_neighbor_description,
3099 no_neighbor_description_cmd,
3100 NO_NEIGHBOR_CMD2 "description",
3101 NO_STR
3102 NEIGHBOR_STR
3103 NEIGHBOR_ADDR_STR2
3104 "Neighbor specific description\n")
3105{
3106 struct peer *peer;
3107
3108 peer = peer_and_group_lookup_vty (vty, argv[0]);
3109 if (! peer)
3110 return CMD_WARNING;
3111
3112 peer_description_unset (peer);
3113
3114 return CMD_SUCCESS;
3115}
3116
3117ALIAS (no_neighbor_description,
3118 no_neighbor_description_val_cmd,
3119 NO_NEIGHBOR_CMD2 "description .LINE",
3120 NO_STR
3121 NEIGHBOR_STR
3122 NEIGHBOR_ADDR_STR2
3123 "Neighbor specific description\n"
3124 "Up to 80 characters describing this neighbor\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003125
paul718e3742002-12-13 20:15:29 +00003126/* Neighbor update-source. */
paul94f2b392005-06-28 12:44:16 +00003127static int
paulfd79ac92004-10-13 05:06:08 +00003128peer_update_source_vty (struct vty *vty, const char *peer_str,
3129 const char *source_str)
paul718e3742002-12-13 20:15:29 +00003130{
3131 struct peer *peer;
paul718e3742002-12-13 20:15:29 +00003132
3133 peer = peer_and_group_lookup_vty (vty, peer_str);
3134 if (! peer)
3135 return CMD_WARNING;
3136
3137 if (source_str)
3138 {
Jorge Boncompte [DTI2]c63b83f2012-04-10 16:57:24 +02003139 union sockunion su;
3140 int ret = str2sockunion (source_str, &su);
3141
3142 if (ret == 0)
3143 peer_update_source_addr_set (peer, &su);
paul718e3742002-12-13 20:15:29 +00003144 else
3145 peer_update_source_if_set (peer, source_str);
3146 }
3147 else
3148 peer_update_source_unset (peer);
3149
3150 return CMD_SUCCESS;
3151}
3152
Paul Jakma9a1a3312009-07-27 12:27:55 +01003153#define BGP_UPDATE_SOURCE_STR "(A.B.C.D|X:X::X:X|WORD)"
Paul Jakma369688c2006-05-23 22:27:55 +00003154#define BGP_UPDATE_SOURCE_HELP_STR \
3155 "IPv4 address\n" \
Paul Jakma9a1a3312009-07-27 12:27:55 +01003156 "IPv6 address\n" \
3157 "Interface name (requires zebra to be running)\n"
Paul Jakma369688c2006-05-23 22:27:55 +00003158
paul718e3742002-12-13 20:15:29 +00003159DEFUN (neighbor_update_source,
3160 neighbor_update_source_cmd,
Paul Jakma369688c2006-05-23 22:27:55 +00003161 NEIGHBOR_CMD2 "update-source " BGP_UPDATE_SOURCE_STR,
paul718e3742002-12-13 20:15:29 +00003162 NEIGHBOR_STR
3163 NEIGHBOR_ADDR_STR2
3164 "Source of routing updates\n"
Paul Jakma369688c2006-05-23 22:27:55 +00003165 BGP_UPDATE_SOURCE_HELP_STR)
paul718e3742002-12-13 20:15:29 +00003166{
3167 return peer_update_source_vty (vty, argv[0], argv[1]);
3168}
3169
3170DEFUN (no_neighbor_update_source,
3171 no_neighbor_update_source_cmd,
3172 NO_NEIGHBOR_CMD2 "update-source",
3173 NO_STR
3174 NEIGHBOR_STR
3175 NEIGHBOR_ADDR_STR2
Paul Jakma369688c2006-05-23 22:27:55 +00003176 "Source of routing updates\n")
paul718e3742002-12-13 20:15:29 +00003177{
3178 return peer_update_source_vty (vty, argv[0], NULL);
3179}
David Lamparter6b0655a2014-06-04 06:53:35 +02003180
paul94f2b392005-06-28 12:44:16 +00003181static int
paulfd79ac92004-10-13 05:06:08 +00003182peer_default_originate_set_vty (struct vty *vty, const char *peer_str,
3183 afi_t afi, safi_t safi,
3184 const char *rmap, int set)
paul718e3742002-12-13 20:15:29 +00003185{
3186 int ret;
3187 struct peer *peer;
3188
3189 peer = peer_and_group_lookup_vty (vty, peer_str);
3190 if (! peer)
3191 return CMD_WARNING;
3192
3193 if (set)
3194 ret = peer_default_originate_set (peer, afi, safi, rmap);
3195 else
3196 ret = peer_default_originate_unset (peer, afi, safi);
3197
3198 return bgp_vty_return (vty, ret);
3199}
3200
3201/* neighbor default-originate. */
3202DEFUN (neighbor_default_originate,
3203 neighbor_default_originate_cmd,
3204 NEIGHBOR_CMD2 "default-originate",
3205 NEIGHBOR_STR
3206 NEIGHBOR_ADDR_STR2
3207 "Originate default route to this neighbor\n")
3208{
3209 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
3210 bgp_node_safi (vty), NULL, 1);
3211}
3212
3213DEFUN (neighbor_default_originate_rmap,
3214 neighbor_default_originate_rmap_cmd,
3215 NEIGHBOR_CMD2 "default-originate route-map WORD",
3216 NEIGHBOR_STR
3217 NEIGHBOR_ADDR_STR2
3218 "Originate default route to this neighbor\n"
3219 "Route-map to specify criteria to originate default\n"
3220 "route-map name\n")
3221{
3222 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
3223 bgp_node_safi (vty), argv[1], 1);
3224}
3225
3226DEFUN (no_neighbor_default_originate,
3227 no_neighbor_default_originate_cmd,
3228 NO_NEIGHBOR_CMD2 "default-originate",
3229 NO_STR
3230 NEIGHBOR_STR
3231 NEIGHBOR_ADDR_STR2
3232 "Originate default route to this neighbor\n")
3233{
3234 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
3235 bgp_node_safi (vty), NULL, 0);
3236}
3237
3238ALIAS (no_neighbor_default_originate,
3239 no_neighbor_default_originate_rmap_cmd,
3240 NO_NEIGHBOR_CMD2 "default-originate route-map WORD",
3241 NO_STR
3242 NEIGHBOR_STR
3243 NEIGHBOR_ADDR_STR2
3244 "Originate default route to this neighbor\n"
3245 "Route-map to specify criteria to originate default\n"
3246 "route-map name\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003247
paul718e3742002-12-13 20:15:29 +00003248/* Set neighbor's BGP port. */
paul94f2b392005-06-28 12:44:16 +00003249static int
paulfd79ac92004-10-13 05:06:08 +00003250peer_port_vty (struct vty *vty, const char *ip_str, int afi,
3251 const char *port_str)
paul718e3742002-12-13 20:15:29 +00003252{
3253 struct peer *peer;
3254 u_int16_t port;
3255 struct servent *sp;
3256
3257 peer = peer_lookup_vty (vty, ip_str);
3258 if (! peer)
3259 return CMD_WARNING;
3260
3261 if (! port_str)
3262 {
3263 sp = getservbyname ("bgp", "tcp");
3264 port = (sp == NULL) ? BGP_PORT_DEFAULT : ntohs (sp->s_port);
3265 }
3266 else
3267 {
3268 VTY_GET_INTEGER("port", port, port_str);
3269 }
3270
3271 peer_port_set (peer, port);
3272
3273 return CMD_SUCCESS;
3274}
3275
hassof4184462005-02-01 20:13:16 +00003276/* Set specified peer's BGP port. */
paul718e3742002-12-13 20:15:29 +00003277DEFUN (neighbor_port,
3278 neighbor_port_cmd,
3279 NEIGHBOR_CMD "port <0-65535>",
3280 NEIGHBOR_STR
3281 NEIGHBOR_ADDR_STR
3282 "Neighbor's BGP port\n"
3283 "TCP port number\n")
3284{
3285 return peer_port_vty (vty, argv[0], AFI_IP, argv[1]);
3286}
3287
3288DEFUN (no_neighbor_port,
3289 no_neighbor_port_cmd,
3290 NO_NEIGHBOR_CMD "port",
3291 NO_STR
3292 NEIGHBOR_STR
3293 NEIGHBOR_ADDR_STR
3294 "Neighbor's BGP port\n")
3295{
3296 return peer_port_vty (vty, argv[0], AFI_IP, NULL);
3297}
3298
3299ALIAS (no_neighbor_port,
3300 no_neighbor_port_val_cmd,
3301 NO_NEIGHBOR_CMD "port <0-65535>",
3302 NO_STR
3303 NEIGHBOR_STR
3304 NEIGHBOR_ADDR_STR
3305 "Neighbor's BGP port\n"
3306 "TCP port number\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003307
paul718e3742002-12-13 20:15:29 +00003308/* neighbor weight. */
paul94f2b392005-06-28 12:44:16 +00003309static int
paulfd79ac92004-10-13 05:06:08 +00003310peer_weight_set_vty (struct vty *vty, const char *ip_str,
3311 const char *weight_str)
paul718e3742002-12-13 20:15:29 +00003312{
paul718e3742002-12-13 20:15:29 +00003313 struct peer *peer;
3314 unsigned long weight;
3315
3316 peer = peer_and_group_lookup_vty (vty, ip_str);
3317 if (! peer)
3318 return CMD_WARNING;
3319
3320 VTY_GET_INTEGER_RANGE("weight", weight, weight_str, 0, 65535);
3321
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003322 return bgp_vty_return (vty, peer_weight_set (peer, weight));
paul718e3742002-12-13 20:15:29 +00003323}
3324
paul94f2b392005-06-28 12:44:16 +00003325static int
paulfd79ac92004-10-13 05:06:08 +00003326peer_weight_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00003327{
3328 struct peer *peer;
3329
3330 peer = peer_and_group_lookup_vty (vty, ip_str);
3331 if (! peer)
3332 return CMD_WARNING;
3333
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003334 return bgp_vty_return (vty, peer_weight_unset (peer));
paul718e3742002-12-13 20:15:29 +00003335}
3336
3337DEFUN (neighbor_weight,
3338 neighbor_weight_cmd,
3339 NEIGHBOR_CMD2 "weight <0-65535>",
3340 NEIGHBOR_STR
3341 NEIGHBOR_ADDR_STR2
3342 "Set default weight for routes from this neighbor\n"
3343 "default weight\n")
3344{
3345 return peer_weight_set_vty (vty, argv[0], argv[1]);
3346}
3347
3348DEFUN (no_neighbor_weight,
3349 no_neighbor_weight_cmd,
3350 NO_NEIGHBOR_CMD2 "weight",
3351 NO_STR
3352 NEIGHBOR_STR
3353 NEIGHBOR_ADDR_STR2
3354 "Set default weight for routes from this neighbor\n")
3355{
3356 return peer_weight_unset_vty (vty, argv[0]);
3357}
3358
3359ALIAS (no_neighbor_weight,
3360 no_neighbor_weight_val_cmd,
3361 NO_NEIGHBOR_CMD2 "weight <0-65535>",
3362 NO_STR
3363 NEIGHBOR_STR
3364 NEIGHBOR_ADDR_STR2
3365 "Set default weight for routes from this neighbor\n"
3366 "default weight\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003367
paul718e3742002-12-13 20:15:29 +00003368/* Override capability negotiation. */
3369DEFUN (neighbor_override_capability,
3370 neighbor_override_capability_cmd,
3371 NEIGHBOR_CMD2 "override-capability",
3372 NEIGHBOR_STR
3373 NEIGHBOR_ADDR_STR2
3374 "Override capability negotiation result\n")
3375{
3376 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY);
3377}
3378
3379DEFUN (no_neighbor_override_capability,
3380 no_neighbor_override_capability_cmd,
3381 NO_NEIGHBOR_CMD2 "override-capability",
3382 NO_STR
3383 NEIGHBOR_STR
3384 NEIGHBOR_ADDR_STR2
3385 "Override capability negotiation result\n")
3386{
3387 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY);
3388}
David Lamparter6b0655a2014-06-04 06:53:35 +02003389
paul718e3742002-12-13 20:15:29 +00003390DEFUN (neighbor_strict_capability,
3391 neighbor_strict_capability_cmd,
3392 NEIGHBOR_CMD "strict-capability-match",
3393 NEIGHBOR_STR
3394 NEIGHBOR_ADDR_STR
3395 "Strict capability negotiation match\n")
3396{
3397 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH);
3398}
3399
3400DEFUN (no_neighbor_strict_capability,
3401 no_neighbor_strict_capability_cmd,
3402 NO_NEIGHBOR_CMD "strict-capability-match",
3403 NO_STR
3404 NEIGHBOR_STR
3405 NEIGHBOR_ADDR_STR
3406 "Strict capability negotiation match\n")
3407{
3408 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH);
3409}
David Lamparter6b0655a2014-06-04 06:53:35 +02003410
paul94f2b392005-06-28 12:44:16 +00003411static int
paulfd79ac92004-10-13 05:06:08 +00003412peer_timers_set_vty (struct vty *vty, const char *ip_str,
3413 const char *keep_str, const char *hold_str)
paul718e3742002-12-13 20:15:29 +00003414{
3415 int ret;
3416 struct peer *peer;
3417 u_int32_t keepalive;
3418 u_int32_t holdtime;
3419
3420 peer = peer_and_group_lookup_vty (vty, ip_str);
3421 if (! peer)
3422 return CMD_WARNING;
3423
3424 VTY_GET_INTEGER_RANGE ("Keepalive", keepalive, keep_str, 0, 65535);
3425 VTY_GET_INTEGER_RANGE ("Holdtime", holdtime, hold_str, 0, 65535);
3426
3427 ret = peer_timers_set (peer, keepalive, holdtime);
3428
3429 return bgp_vty_return (vty, ret);
3430}
David Lamparter6b0655a2014-06-04 06:53:35 +02003431
paul94f2b392005-06-28 12:44:16 +00003432static int
paulfd79ac92004-10-13 05:06:08 +00003433peer_timers_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00003434{
3435 int ret;
3436 struct peer *peer;
3437
3438 peer = peer_lookup_vty (vty, ip_str);
3439 if (! peer)
3440 return CMD_WARNING;
3441
3442 ret = peer_timers_unset (peer);
3443
3444 return bgp_vty_return (vty, ret);
3445}
3446
3447DEFUN (neighbor_timers,
3448 neighbor_timers_cmd,
3449 NEIGHBOR_CMD2 "timers <0-65535> <0-65535>",
3450 NEIGHBOR_STR
3451 NEIGHBOR_ADDR_STR2
3452 "BGP per neighbor timers\n"
3453 "Keepalive interval\n"
3454 "Holdtime\n")
3455{
3456 return peer_timers_set_vty (vty, argv[0], argv[1], argv[2]);
3457}
3458
3459DEFUN (no_neighbor_timers,
3460 no_neighbor_timers_cmd,
3461 NO_NEIGHBOR_CMD2 "timers",
3462 NO_STR
3463 NEIGHBOR_STR
3464 NEIGHBOR_ADDR_STR2
3465 "BGP per neighbor timers\n")
3466{
3467 return peer_timers_unset_vty (vty, argv[0]);
3468}
David Lamparter6b0655a2014-06-04 06:53:35 +02003469
paul94f2b392005-06-28 12:44:16 +00003470static int
paulfd79ac92004-10-13 05:06:08 +00003471peer_timers_connect_set_vty (struct vty *vty, const char *ip_str,
3472 const char *time_str)
paul718e3742002-12-13 20:15:29 +00003473{
paul718e3742002-12-13 20:15:29 +00003474 struct peer *peer;
3475 u_int32_t connect;
3476
Daniel Walton0d7435f2015-10-22 11:35:20 +03003477 peer = peer_and_group_lookup_vty (vty, ip_str);
paul718e3742002-12-13 20:15:29 +00003478 if (! peer)
3479 return CMD_WARNING;
3480
3481 VTY_GET_INTEGER_RANGE ("Connect time", connect, time_str, 0, 65535);
3482
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003483 return bgp_vty_return (vty, peer_timers_connect_set (peer, connect));
paul718e3742002-12-13 20:15:29 +00003484}
3485
paul94f2b392005-06-28 12:44:16 +00003486static int
paulfd79ac92004-10-13 05:06:08 +00003487peer_timers_connect_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00003488{
paul718e3742002-12-13 20:15:29 +00003489 struct peer *peer;
3490
3491 peer = peer_and_group_lookup_vty (vty, ip_str);
3492 if (! peer)
3493 return CMD_WARNING;
3494
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003495 return bgp_vty_return (vty, peer_timers_connect_unset (peer));
paul718e3742002-12-13 20:15:29 +00003496}
3497
3498DEFUN (neighbor_timers_connect,
3499 neighbor_timers_connect_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003500 NEIGHBOR_CMD2 "timers connect <1-65535>",
paul718e3742002-12-13 20:15:29 +00003501 NEIGHBOR_STR
Daniel Walton0d7435f2015-10-22 11:35:20 +03003502 NEIGHBOR_ADDR_STR2
paul718e3742002-12-13 20:15:29 +00003503 "BGP per neighbor timers\n"
3504 "BGP connect timer\n"
3505 "Connect timer\n")
3506{
3507 return peer_timers_connect_set_vty (vty, argv[0], argv[1]);
3508}
3509
3510DEFUN (no_neighbor_timers_connect,
3511 no_neighbor_timers_connect_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003512 NO_NEIGHBOR_CMD2 "timers connect",
paul718e3742002-12-13 20:15:29 +00003513 NO_STR
3514 NEIGHBOR_STR
Daniel Walton0d7435f2015-10-22 11:35:20 +03003515 NEIGHBOR_ADDR_STR2
paul718e3742002-12-13 20:15:29 +00003516 "BGP per neighbor timers\n"
3517 "BGP connect timer\n")
3518{
3519 return peer_timers_connect_unset_vty (vty, argv[0]);
3520}
3521
3522ALIAS (no_neighbor_timers_connect,
3523 no_neighbor_timers_connect_val_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003524 NO_NEIGHBOR_CMD2 "timers connect <1-65535>",
paul718e3742002-12-13 20:15:29 +00003525 NO_STR
3526 NEIGHBOR_STR
Daniel Walton0d7435f2015-10-22 11:35:20 +03003527 NEIGHBOR_ADDR_STR2
paul718e3742002-12-13 20:15:29 +00003528 "BGP per neighbor timers\n"
3529 "BGP connect timer\n"
3530 "Connect timer\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003531
paul94f2b392005-06-28 12:44:16 +00003532static int
paulfd79ac92004-10-13 05:06:08 +00003533peer_advertise_interval_vty (struct vty *vty, const char *ip_str,
3534 const char *time_str, int set)
paul718e3742002-12-13 20:15:29 +00003535{
3536 int ret;
3537 struct peer *peer;
3538 u_int32_t routeadv = 0;
3539
Daniel Walton0d7435f2015-10-22 11:35:20 +03003540 peer = peer_and_group_lookup_vty (vty, ip_str);
paul718e3742002-12-13 20:15:29 +00003541 if (! peer)
3542 return CMD_WARNING;
3543
3544 if (time_str)
3545 VTY_GET_INTEGER_RANGE ("advertise interval", routeadv, time_str, 0, 600);
3546
3547 if (set)
3548 ret = peer_advertise_interval_set (peer, routeadv);
3549 else
3550 ret = peer_advertise_interval_unset (peer);
3551
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003552 return bgp_vty_return (vty, ret);
paul718e3742002-12-13 20:15:29 +00003553}
3554
3555DEFUN (neighbor_advertise_interval,
3556 neighbor_advertise_interval_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003557 NEIGHBOR_CMD2 "advertisement-interval <0-600>",
paul718e3742002-12-13 20:15:29 +00003558 NEIGHBOR_STR
Daniel Walton0d7435f2015-10-22 11:35:20 +03003559 NEIGHBOR_ADDR_STR2
paul718e3742002-12-13 20:15:29 +00003560 "Minimum interval between sending BGP routing updates\n"
3561 "time in seconds\n")
3562{
3563 return peer_advertise_interval_vty (vty, argv[0], argv[1], 1);
3564}
3565
3566DEFUN (no_neighbor_advertise_interval,
3567 no_neighbor_advertise_interval_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003568 NO_NEIGHBOR_CMD2 "advertisement-interval",
paul718e3742002-12-13 20:15:29 +00003569 NO_STR
3570 NEIGHBOR_STR
Daniel Walton0d7435f2015-10-22 11:35:20 +03003571 NEIGHBOR_ADDR_STR2
paul718e3742002-12-13 20:15:29 +00003572 "Minimum interval between sending BGP routing updates\n")
3573{
3574 return peer_advertise_interval_vty (vty, argv[0], NULL, 0);
3575}
3576
3577ALIAS (no_neighbor_advertise_interval,
3578 no_neighbor_advertise_interval_val_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003579 NO_NEIGHBOR_CMD2 "advertisement-interval <0-600>",
paul718e3742002-12-13 20:15:29 +00003580 NO_STR
3581 NEIGHBOR_STR
Daniel Walton0d7435f2015-10-22 11:35:20 +03003582 NEIGHBOR_ADDR_STR2
paul718e3742002-12-13 20:15:29 +00003583 "Minimum interval between sending BGP routing updates\n"
3584 "time in seconds\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003585
paul718e3742002-12-13 20:15:29 +00003586/* neighbor interface */
paul94f2b392005-06-28 12:44:16 +00003587static int
paulfd79ac92004-10-13 05:06:08 +00003588peer_interface_vty (struct vty *vty, const char *ip_str, const char *str)
paul718e3742002-12-13 20:15:29 +00003589{
3590 int ret;
3591 struct peer *peer;
3592
3593 peer = peer_lookup_vty (vty, ip_str);
3594 if (! peer)
3595 return CMD_WARNING;
3596
3597 if (str)
3598 ret = peer_interface_set (peer, str);
3599 else
3600 ret = peer_interface_unset (peer);
3601
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003602 return bgp_vty_return (vty, ret);
paul718e3742002-12-13 20:15:29 +00003603}
3604
3605DEFUN (neighbor_interface,
3606 neighbor_interface_cmd,
3607 NEIGHBOR_CMD "interface WORD",
3608 NEIGHBOR_STR
3609 NEIGHBOR_ADDR_STR
3610 "Interface\n"
3611 "Interface name\n")
3612{
3613 return peer_interface_vty (vty, argv[0], argv[1]);
3614}
3615
3616DEFUN (no_neighbor_interface,
3617 no_neighbor_interface_cmd,
3618 NO_NEIGHBOR_CMD "interface WORD",
3619 NO_STR
3620 NEIGHBOR_STR
3621 NEIGHBOR_ADDR_STR
3622 "Interface\n"
3623 "Interface name\n")
3624{
3625 return peer_interface_vty (vty, argv[0], NULL);
3626}
David Lamparter6b0655a2014-06-04 06:53:35 +02003627
paul718e3742002-12-13 20:15:29 +00003628/* Set distribute list to the peer. */
paul94f2b392005-06-28 12:44:16 +00003629static int
paulfd79ac92004-10-13 05:06:08 +00003630peer_distribute_set_vty (struct vty *vty, const char *ip_str,
3631 afi_t afi, safi_t safi,
3632 const char *name_str, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003633{
3634 int ret;
3635 struct peer *peer;
3636 int direct = FILTER_IN;
3637
3638 peer = peer_and_group_lookup_vty (vty, ip_str);
3639 if (! peer)
3640 return CMD_WARNING;
3641
3642 /* Check filter direction. */
3643 if (strncmp (direct_str, "i", 1) == 0)
3644 direct = FILTER_IN;
3645 else if (strncmp (direct_str, "o", 1) == 0)
3646 direct = FILTER_OUT;
3647
3648 ret = peer_distribute_set (peer, afi, safi, direct, name_str);
3649
3650 return bgp_vty_return (vty, ret);
3651}
3652
paul94f2b392005-06-28 12:44:16 +00003653static int
paulfd79ac92004-10-13 05:06:08 +00003654peer_distribute_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
3655 safi_t safi, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003656{
3657 int ret;
3658 struct peer *peer;
3659 int direct = FILTER_IN;
3660
3661 peer = peer_and_group_lookup_vty (vty, ip_str);
3662 if (! peer)
3663 return CMD_WARNING;
3664
3665 /* Check filter direction. */
3666 if (strncmp (direct_str, "i", 1) == 0)
3667 direct = FILTER_IN;
3668 else if (strncmp (direct_str, "o", 1) == 0)
3669 direct = FILTER_OUT;
3670
3671 ret = peer_distribute_unset (peer, afi, safi, direct);
3672
3673 return bgp_vty_return (vty, ret);
3674}
3675
3676DEFUN (neighbor_distribute_list,
3677 neighbor_distribute_list_cmd,
3678 NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)",
3679 NEIGHBOR_STR
3680 NEIGHBOR_ADDR_STR2
3681 "Filter updates to/from this neighbor\n"
3682 "IP access-list number\n"
3683 "IP access-list number (expanded range)\n"
3684 "IP Access-list name\n"
3685 "Filter incoming updates\n"
3686 "Filter outgoing updates\n")
3687{
3688 return peer_distribute_set_vty (vty, argv[0], bgp_node_afi (vty),
3689 bgp_node_safi (vty), argv[1], argv[2]);
3690}
3691
3692DEFUN (no_neighbor_distribute_list,
3693 no_neighbor_distribute_list_cmd,
3694 NO_NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)",
3695 NO_STR
3696 NEIGHBOR_STR
3697 NEIGHBOR_ADDR_STR2
3698 "Filter updates to/from this neighbor\n"
3699 "IP access-list number\n"
3700 "IP access-list number (expanded range)\n"
3701 "IP Access-list name\n"
3702 "Filter incoming updates\n"
3703 "Filter outgoing updates\n")
3704{
3705 return peer_distribute_unset_vty (vty, argv[0], bgp_node_afi (vty),
3706 bgp_node_safi (vty), argv[2]);
3707}
David Lamparter6b0655a2014-06-04 06:53:35 +02003708
paul718e3742002-12-13 20:15:29 +00003709/* Set prefix list to the peer. */
paul94f2b392005-06-28 12:44:16 +00003710static int
paulfd79ac92004-10-13 05:06:08 +00003711peer_prefix_list_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
3712 safi_t safi, const char *name_str,
3713 const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003714{
3715 int ret;
3716 struct peer *peer;
3717 int direct = FILTER_IN;
3718
3719 peer = peer_and_group_lookup_vty (vty, ip_str);
3720 if (! peer)
3721 return CMD_WARNING;
3722
3723 /* Check filter direction. */
3724 if (strncmp (direct_str, "i", 1) == 0)
3725 direct = FILTER_IN;
3726 else if (strncmp (direct_str, "o", 1) == 0)
3727 direct = FILTER_OUT;
3728
3729 ret = peer_prefix_list_set (peer, afi, safi, direct, name_str);
3730
3731 return bgp_vty_return (vty, ret);
3732}
3733
paul94f2b392005-06-28 12:44:16 +00003734static int
paulfd79ac92004-10-13 05:06:08 +00003735peer_prefix_list_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
3736 safi_t safi, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003737{
3738 int ret;
3739 struct peer *peer;
3740 int direct = FILTER_IN;
3741
3742 peer = peer_and_group_lookup_vty (vty, ip_str);
3743 if (! peer)
3744 return CMD_WARNING;
3745
3746 /* Check filter direction. */
3747 if (strncmp (direct_str, "i", 1) == 0)
3748 direct = FILTER_IN;
3749 else if (strncmp (direct_str, "o", 1) == 0)
3750 direct = FILTER_OUT;
3751
3752 ret = peer_prefix_list_unset (peer, afi, safi, direct);
3753
3754 return bgp_vty_return (vty, ret);
3755}
3756
3757DEFUN (neighbor_prefix_list,
3758 neighbor_prefix_list_cmd,
3759 NEIGHBOR_CMD2 "prefix-list WORD (in|out)",
3760 NEIGHBOR_STR
3761 NEIGHBOR_ADDR_STR2
3762 "Filter updates to/from this neighbor\n"
3763 "Name of a prefix list\n"
3764 "Filter incoming updates\n"
3765 "Filter outgoing updates\n")
3766{
3767 return peer_prefix_list_set_vty (vty, argv[0], bgp_node_afi (vty),
3768 bgp_node_safi (vty), argv[1], argv[2]);
3769}
3770
3771DEFUN (no_neighbor_prefix_list,
3772 no_neighbor_prefix_list_cmd,
3773 NO_NEIGHBOR_CMD2 "prefix-list WORD (in|out)",
3774 NO_STR
3775 NEIGHBOR_STR
3776 NEIGHBOR_ADDR_STR2
3777 "Filter updates to/from this neighbor\n"
3778 "Name of a prefix list\n"
3779 "Filter incoming updates\n"
3780 "Filter outgoing updates\n")
3781{
3782 return peer_prefix_list_unset_vty (vty, argv[0], bgp_node_afi (vty),
3783 bgp_node_safi (vty), argv[2]);
3784}
David Lamparter6b0655a2014-06-04 06:53:35 +02003785
paul94f2b392005-06-28 12:44:16 +00003786static int
paulfd79ac92004-10-13 05:06:08 +00003787peer_aslist_set_vty (struct vty *vty, const char *ip_str,
3788 afi_t afi, safi_t safi,
3789 const char *name_str, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003790{
3791 int ret;
3792 struct peer *peer;
3793 int direct = FILTER_IN;
3794
3795 peer = peer_and_group_lookup_vty (vty, ip_str);
3796 if (! peer)
3797 return CMD_WARNING;
3798
3799 /* Check filter direction. */
3800 if (strncmp (direct_str, "i", 1) == 0)
3801 direct = FILTER_IN;
3802 else if (strncmp (direct_str, "o", 1) == 0)
3803 direct = FILTER_OUT;
3804
3805 ret = peer_aslist_set (peer, afi, safi, direct, name_str);
3806
3807 return bgp_vty_return (vty, ret);
3808}
3809
paul94f2b392005-06-28 12:44:16 +00003810static int
paulfd79ac92004-10-13 05:06:08 +00003811peer_aslist_unset_vty (struct vty *vty, const char *ip_str,
3812 afi_t afi, safi_t safi,
3813 const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003814{
3815 int ret;
3816 struct peer *peer;
3817 int direct = FILTER_IN;
3818
3819 peer = peer_and_group_lookup_vty (vty, ip_str);
3820 if (! peer)
3821 return CMD_WARNING;
3822
3823 /* Check filter direction. */
3824 if (strncmp (direct_str, "i", 1) == 0)
3825 direct = FILTER_IN;
3826 else if (strncmp (direct_str, "o", 1) == 0)
3827 direct = FILTER_OUT;
3828
3829 ret = peer_aslist_unset (peer, afi, safi, direct);
3830
3831 return bgp_vty_return (vty, ret);
3832}
3833
3834DEFUN (neighbor_filter_list,
3835 neighbor_filter_list_cmd,
3836 NEIGHBOR_CMD2 "filter-list WORD (in|out)",
3837 NEIGHBOR_STR
3838 NEIGHBOR_ADDR_STR2
3839 "Establish BGP filters\n"
3840 "AS path access-list name\n"
3841 "Filter incoming routes\n"
3842 "Filter outgoing routes\n")
3843{
3844 return peer_aslist_set_vty (vty, argv[0], bgp_node_afi (vty),
3845 bgp_node_safi (vty), argv[1], argv[2]);
3846}
3847
3848DEFUN (no_neighbor_filter_list,
3849 no_neighbor_filter_list_cmd,
3850 NO_NEIGHBOR_CMD2 "filter-list WORD (in|out)",
3851 NO_STR
3852 NEIGHBOR_STR
3853 NEIGHBOR_ADDR_STR2
3854 "Establish BGP filters\n"
3855 "AS path access-list name\n"
3856 "Filter incoming routes\n"
3857 "Filter outgoing routes\n")
3858{
3859 return peer_aslist_unset_vty (vty, argv[0], bgp_node_afi (vty),
3860 bgp_node_safi (vty), argv[2]);
3861}
David Lamparter6b0655a2014-06-04 06:53:35 +02003862
paul718e3742002-12-13 20:15:29 +00003863/* Set route-map to the peer. */
paul94f2b392005-06-28 12:44:16 +00003864static int
paulfd79ac92004-10-13 05:06:08 +00003865peer_route_map_set_vty (struct vty *vty, const char *ip_str,
3866 afi_t afi, safi_t safi,
3867 const char *name_str, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003868{
3869 int ret;
3870 struct peer *peer;
paulfee0f4c2004-09-13 05:12:46 +00003871 int direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003872
3873 peer = peer_and_group_lookup_vty (vty, ip_str);
3874 if (! peer)
3875 return CMD_WARNING;
3876
3877 /* Check filter direction. */
paulfee0f4c2004-09-13 05:12:46 +00003878 if (strncmp (direct_str, "in", 2) == 0)
3879 direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003880 else if (strncmp (direct_str, "o", 1) == 0)
paulfee0f4c2004-09-13 05:12:46 +00003881 direct = RMAP_OUT;
3882 else if (strncmp (direct_str, "im", 2) == 0)
3883 direct = RMAP_IMPORT;
3884 else if (strncmp (direct_str, "e", 1) == 0)
3885 direct = RMAP_EXPORT;
paul718e3742002-12-13 20:15:29 +00003886
3887 ret = peer_route_map_set (peer, afi, safi, direct, name_str);
3888
3889 return bgp_vty_return (vty, ret);
3890}
3891
paul94f2b392005-06-28 12:44:16 +00003892static int
paulfd79ac92004-10-13 05:06:08 +00003893peer_route_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
3894 safi_t safi, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003895{
3896 int ret;
3897 struct peer *peer;
paulfee0f4c2004-09-13 05:12:46 +00003898 int direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003899
3900 peer = peer_and_group_lookup_vty (vty, ip_str);
3901 if (! peer)
3902 return CMD_WARNING;
3903
3904 /* Check filter direction. */
paulfee0f4c2004-09-13 05:12:46 +00003905 if (strncmp (direct_str, "in", 2) == 0)
3906 direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003907 else if (strncmp (direct_str, "o", 1) == 0)
paulfee0f4c2004-09-13 05:12:46 +00003908 direct = RMAP_OUT;
3909 else if (strncmp (direct_str, "im", 2) == 0)
3910 direct = RMAP_IMPORT;
3911 else if (strncmp (direct_str, "e", 1) == 0)
3912 direct = RMAP_EXPORT;
paul718e3742002-12-13 20:15:29 +00003913
3914 ret = peer_route_map_unset (peer, afi, safi, direct);
3915
3916 return bgp_vty_return (vty, ret);
3917}
3918
3919DEFUN (neighbor_route_map,
3920 neighbor_route_map_cmd,
paulfee0f4c2004-09-13 05:12:46 +00003921 NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)",
paul718e3742002-12-13 20:15:29 +00003922 NEIGHBOR_STR
3923 NEIGHBOR_ADDR_STR2
3924 "Apply route map to neighbor\n"
3925 "Name of route map\n"
3926 "Apply map to incoming routes\n"
paulfee0f4c2004-09-13 05:12:46 +00003927 "Apply map to outbound routes\n"
3928 "Apply map to routes going into a Route-Server client's table\n"
3929 "Apply map to routes coming from a Route-Server client")
paul718e3742002-12-13 20:15:29 +00003930{
3931 return peer_route_map_set_vty (vty, argv[0], bgp_node_afi (vty),
3932 bgp_node_safi (vty), argv[1], argv[2]);
3933}
3934
3935DEFUN (no_neighbor_route_map,
3936 no_neighbor_route_map_cmd,
paulfee0f4c2004-09-13 05:12:46 +00003937 NO_NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)",
paul718e3742002-12-13 20:15:29 +00003938 NO_STR
3939 NEIGHBOR_STR
3940 NEIGHBOR_ADDR_STR2
3941 "Apply route map to neighbor\n"
3942 "Name of route map\n"
3943 "Apply map to incoming routes\n"
paulfee0f4c2004-09-13 05:12:46 +00003944 "Apply map to outbound routes\n"
3945 "Apply map to routes going into a Route-Server client's table\n"
3946 "Apply map to routes coming from a Route-Server client")
paul718e3742002-12-13 20:15:29 +00003947{
3948 return peer_route_map_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 unsuppress-map to the peer. */
paul94f2b392005-06-28 12:44:16 +00003953static int
paulfd79ac92004-10-13 05:06:08 +00003954peer_unsuppress_map_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
3955 safi_t safi, const char *name_str)
paul718e3742002-12-13 20:15:29 +00003956{
3957 int ret;
3958 struct peer *peer;
3959
3960 peer = peer_and_group_lookup_vty (vty, ip_str);
3961 if (! peer)
3962 return CMD_WARNING;
3963
3964 ret = peer_unsuppress_map_set (peer, afi, safi, name_str);
3965
3966 return bgp_vty_return (vty, ret);
3967}
3968
3969/* Unset route-map from the peer. */
paul94f2b392005-06-28 12:44:16 +00003970static int
paulfd79ac92004-10-13 05:06:08 +00003971peer_unsuppress_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
paul718e3742002-12-13 20:15:29 +00003972 safi_t safi)
3973{
3974 int ret;
3975 struct peer *peer;
3976
3977 peer = peer_and_group_lookup_vty (vty, ip_str);
3978 if (! peer)
3979 return CMD_WARNING;
3980
3981 ret = peer_unsuppress_map_unset (peer, afi, safi);
3982
3983 return bgp_vty_return (vty, ret);
3984}
3985
3986DEFUN (neighbor_unsuppress_map,
3987 neighbor_unsuppress_map_cmd,
3988 NEIGHBOR_CMD2 "unsuppress-map WORD",
3989 NEIGHBOR_STR
3990 NEIGHBOR_ADDR_STR2
3991 "Route-map to selectively unsuppress suppressed routes\n"
3992 "Name of route map\n")
3993{
3994 return peer_unsuppress_map_set_vty (vty, argv[0], bgp_node_afi (vty),
3995 bgp_node_safi (vty), argv[1]);
3996}
3997
3998DEFUN (no_neighbor_unsuppress_map,
3999 no_neighbor_unsuppress_map_cmd,
4000 NO_NEIGHBOR_CMD2 "unsuppress-map WORD",
4001 NO_STR
4002 NEIGHBOR_STR
4003 NEIGHBOR_ADDR_STR2
4004 "Route-map to selectively unsuppress suppressed routes\n"
4005 "Name of route map\n")
4006{
4007 return peer_unsuppress_map_unset_vty (vty, argv[0], bgp_node_afi (vty),
4008 bgp_node_safi (vty));
4009}
David Lamparter6b0655a2014-06-04 06:53:35 +02004010
paul94f2b392005-06-28 12:44:16 +00004011static int
paulfd79ac92004-10-13 05:06:08 +00004012peer_maximum_prefix_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
4013 safi_t safi, const char *num_str,
hasso0a486e52005-02-01 20:57:17 +00004014 const char *threshold_str, int warning,
4015 const char *restart_str)
paul718e3742002-12-13 20:15:29 +00004016{
4017 int ret;
4018 struct peer *peer;
4019 u_int32_t max;
hassoe0701b72004-05-20 09:19:34 +00004020 u_char threshold;
hasso0a486e52005-02-01 20:57:17 +00004021 u_int16_t restart;
paul718e3742002-12-13 20:15:29 +00004022
4023 peer = peer_and_group_lookup_vty (vty, ip_str);
4024 if (! peer)
4025 return CMD_WARNING;
4026
Denis Ovsienkoe6ec1c32011-09-10 21:50:53 +04004027 VTY_GET_INTEGER ("maximum number", max, num_str);
hassoe0701b72004-05-20 09:19:34 +00004028 if (threshold_str)
4029 threshold = atoi (threshold_str);
4030 else
4031 threshold = MAXIMUM_PREFIX_THRESHOLD_DEFAULT;
paul718e3742002-12-13 20:15:29 +00004032
hasso0a486e52005-02-01 20:57:17 +00004033 if (restart_str)
4034 restart = atoi (restart_str);
4035 else
4036 restart = 0;
4037
4038 ret = peer_maximum_prefix_set (peer, afi, safi, max, threshold, warning, restart);
paul718e3742002-12-13 20:15:29 +00004039
4040 return bgp_vty_return (vty, ret);
4041}
4042
paul94f2b392005-06-28 12:44:16 +00004043static int
paulfd79ac92004-10-13 05:06:08 +00004044peer_maximum_prefix_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
paul718e3742002-12-13 20:15:29 +00004045 safi_t safi)
4046{
4047 int ret;
4048 struct peer *peer;
4049
4050 peer = peer_and_group_lookup_vty (vty, ip_str);
4051 if (! peer)
4052 return CMD_WARNING;
4053
4054 ret = peer_maximum_prefix_unset (peer, afi, safi);
4055
4056 return bgp_vty_return (vty, ret);
4057}
4058
4059/* Maximum number of prefix configuration. prefix count is different
4060 for each peer configuration. So this configuration can be set for
4061 each peer configuration. */
4062DEFUN (neighbor_maximum_prefix,
4063 neighbor_maximum_prefix_cmd,
4064 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>",
4065 NEIGHBOR_STR
4066 NEIGHBOR_ADDR_STR2
4067 "Maximum number of prefix accept from this peer\n"
4068 "maximum no. of prefix limit\n")
4069{
4070 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00004071 bgp_node_safi (vty), argv[1], NULL, 0,
4072 NULL);
paul718e3742002-12-13 20:15:29 +00004073}
4074
hassoe0701b72004-05-20 09:19:34 +00004075DEFUN (neighbor_maximum_prefix_threshold,
4076 neighbor_maximum_prefix_threshold_cmd,
4077 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100>",
4078 NEIGHBOR_STR
4079 NEIGHBOR_ADDR_STR2
4080 "Maximum number of prefix accept from this peer\n"
4081 "maximum no. of prefix limit\n"
4082 "Threshold value (%) at which to generate a warning msg\n")
4083{
4084 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00004085 bgp_node_safi (vty), argv[1], argv[2], 0,
4086 NULL);
4087}
hassoe0701b72004-05-20 09:19:34 +00004088
paul718e3742002-12-13 20:15:29 +00004089DEFUN (neighbor_maximum_prefix_warning,
4090 neighbor_maximum_prefix_warning_cmd,
4091 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
4092 NEIGHBOR_STR
4093 NEIGHBOR_ADDR_STR2
4094 "Maximum number of prefix accept from this peer\n"
4095 "maximum no. of prefix limit\n"
4096 "Only give warning message when limit is exceeded\n")
4097{
4098 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00004099 bgp_node_safi (vty), argv[1], NULL, 1,
4100 NULL);
paul718e3742002-12-13 20:15:29 +00004101}
4102
hassoe0701b72004-05-20 09:19:34 +00004103DEFUN (neighbor_maximum_prefix_threshold_warning,
4104 neighbor_maximum_prefix_threshold_warning_cmd,
4105 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only",
4106 NEIGHBOR_STR
4107 NEIGHBOR_ADDR_STR2
4108 "Maximum number of prefix accept from this peer\n"
4109 "maximum no. of prefix limit\n"
4110 "Threshold value (%) at which to generate a warning msg\n"
4111 "Only give warning message when limit is exceeded\n")
4112{
4113 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00004114 bgp_node_safi (vty), argv[1], argv[2], 1, NULL);
4115}
4116
4117DEFUN (neighbor_maximum_prefix_restart,
4118 neighbor_maximum_prefix_restart_cmd,
4119 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>",
4120 NEIGHBOR_STR
4121 NEIGHBOR_ADDR_STR2
4122 "Maximum number of prefix accept from this peer\n"
4123 "maximum no. of prefix limit\n"
4124 "Restart bgp connection after limit is exceeded\n"
4125 "Restart interval in minutes")
4126{
4127 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
4128 bgp_node_safi (vty), argv[1], NULL, 0, argv[2]);
4129}
4130
4131DEFUN (neighbor_maximum_prefix_threshold_restart,
4132 neighbor_maximum_prefix_threshold_restart_cmd,
4133 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>",
4134 NEIGHBOR_STR
4135 NEIGHBOR_ADDR_STR2
4136 "Maximum number of prefix accept from this peer\n"
4137 "maximum no. of prefix limit\n"
4138 "Threshold value (%) at which to generate a warning msg\n"
4139 "Restart bgp connection after limit is exceeded\n"
4140 "Restart interval in minutes")
4141{
4142 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
4143 bgp_node_safi (vty), argv[1], argv[2], 0, argv[3]);
4144}
hassoe0701b72004-05-20 09:19:34 +00004145
paul718e3742002-12-13 20:15:29 +00004146DEFUN (no_neighbor_maximum_prefix,
4147 no_neighbor_maximum_prefix_cmd,
4148 NO_NEIGHBOR_CMD2 "maximum-prefix",
4149 NO_STR
4150 NEIGHBOR_STR
4151 NEIGHBOR_ADDR_STR2
4152 "Maximum number of prefix accept from this peer\n")
4153{
4154 return peer_maximum_prefix_unset_vty (vty, argv[0], bgp_node_afi (vty),
4155 bgp_node_safi (vty));
4156}
4157
4158ALIAS (no_neighbor_maximum_prefix,
4159 no_neighbor_maximum_prefix_val_cmd,
4160 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>",
4161 NO_STR
4162 NEIGHBOR_STR
4163 NEIGHBOR_ADDR_STR2
4164 "Maximum number of prefix accept from this peer\n"
4165 "maximum no. of prefix limit\n")
4166
4167ALIAS (no_neighbor_maximum_prefix,
hasso0a486e52005-02-01 20:57:17 +00004168 no_neighbor_maximum_prefix_threshold_cmd,
4169 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
4170 NO_STR
4171 NEIGHBOR_STR
4172 NEIGHBOR_ADDR_STR2
4173 "Maximum number of prefix accept from this peer\n"
4174 "maximum no. of prefix limit\n"
4175 "Threshold value (%) at which to generate a warning msg\n")
4176
4177ALIAS (no_neighbor_maximum_prefix,
4178 no_neighbor_maximum_prefix_warning_cmd,
4179 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
4180 NO_STR
4181 NEIGHBOR_STR
4182 NEIGHBOR_ADDR_STR2
4183 "Maximum number of prefix accept from this peer\n"
4184 "maximum no. of prefix limit\n"
paule8e19462006-01-19 20:16:55 +00004185 "Only give warning message when limit is exceeded\n")
hasso0a486e52005-02-01 20:57:17 +00004186
4187ALIAS (no_neighbor_maximum_prefix,
4188 no_neighbor_maximum_prefix_threshold_warning_cmd,
hassoe0701b72004-05-20 09:19:34 +00004189 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only",
4190 NO_STR
4191 NEIGHBOR_STR
4192 NEIGHBOR_ADDR_STR2
4193 "Maximum number of prefix accept from this peer\n"
4194 "maximum no. of prefix limit\n"
4195 "Threshold value (%) at which to generate a warning msg\n"
paule8e19462006-01-19 20:16:55 +00004196 "Only give warning message when limit is exceeded\n")
hassoe0701b72004-05-20 09:19:34 +00004197
4198ALIAS (no_neighbor_maximum_prefix,
hasso0a486e52005-02-01 20:57:17 +00004199 no_neighbor_maximum_prefix_restart_cmd,
4200 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>",
paul718e3742002-12-13 20:15:29 +00004201 NO_STR
4202 NEIGHBOR_STR
4203 NEIGHBOR_ADDR_STR2
4204 "Maximum number of prefix accept from this peer\n"
4205 "maximum no. of prefix limit\n"
hasso0a486e52005-02-01 20:57:17 +00004206 "Restart bgp connection after limit is exceeded\n"
4207 "Restart interval in minutes")
4208
4209ALIAS (no_neighbor_maximum_prefix,
4210 no_neighbor_maximum_prefix_threshold_restart_cmd,
4211 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>",
4212 NO_STR
4213 NEIGHBOR_STR
4214 NEIGHBOR_ADDR_STR2
4215 "Maximum number of prefix accept from this peer\n"
4216 "maximum no. of prefix limit\n"
4217 "Threshold value (%) at which to generate a warning msg\n"
4218 "Restart bgp connection after limit is exceeded\n"
4219 "Restart interval in minutes")
David Lamparter6b0655a2014-06-04 06:53:35 +02004220
paul718e3742002-12-13 20:15:29 +00004221/* "neighbor allowas-in" */
4222DEFUN (neighbor_allowas_in,
4223 neighbor_allowas_in_cmd,
4224 NEIGHBOR_CMD2 "allowas-in",
4225 NEIGHBOR_STR
4226 NEIGHBOR_ADDR_STR2
4227 "Accept as-path with my AS present in it\n")
4228{
4229 int ret;
4230 struct peer *peer;
paulfd79ac92004-10-13 05:06:08 +00004231 unsigned int allow_num;
paul718e3742002-12-13 20:15:29 +00004232
4233 peer = peer_and_group_lookup_vty (vty, argv[0]);
4234 if (! peer)
4235 return CMD_WARNING;
4236
4237 if (argc == 1)
4238 allow_num = 3;
4239 else
4240 VTY_GET_INTEGER_RANGE ("AS number", allow_num, argv[1], 1, 10);
4241
4242 ret = peer_allowas_in_set (peer, bgp_node_afi (vty), bgp_node_safi (vty),
4243 allow_num);
4244
4245 return bgp_vty_return (vty, ret);
4246}
4247
4248ALIAS (neighbor_allowas_in,
4249 neighbor_allowas_in_arg_cmd,
4250 NEIGHBOR_CMD2 "allowas-in <1-10>",
4251 NEIGHBOR_STR
4252 NEIGHBOR_ADDR_STR2
4253 "Accept as-path with my AS present in it\n"
4254 "Number of occurances of AS number\n")
4255
4256DEFUN (no_neighbor_allowas_in,
4257 no_neighbor_allowas_in_cmd,
4258 NO_NEIGHBOR_CMD2 "allowas-in",
4259 NO_STR
4260 NEIGHBOR_STR
4261 NEIGHBOR_ADDR_STR2
4262 "allow local ASN appears in aspath attribute\n")
4263{
4264 int ret;
4265 struct peer *peer;
4266
4267 peer = peer_and_group_lookup_vty (vty, argv[0]);
4268 if (! peer)
4269 return CMD_WARNING;
4270
4271 ret = peer_allowas_in_unset (peer, bgp_node_afi (vty), bgp_node_safi (vty));
4272
4273 return bgp_vty_return (vty, ret);
4274}
David Lamparter6b0655a2014-06-04 06:53:35 +02004275
Nick Hilliardfa411a22011-03-23 15:33:17 +00004276DEFUN (neighbor_ttl_security,
4277 neighbor_ttl_security_cmd,
4278 NEIGHBOR_CMD2 "ttl-security hops <1-254>",
4279 NEIGHBOR_STR
4280 NEIGHBOR_ADDR_STR2
4281 "Specify the maximum number of hops to the BGP peer\n")
4282{
4283 struct peer *peer;
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00004284 int gtsm_hops;
Nick Hilliardfa411a22011-03-23 15:33:17 +00004285
4286 peer = peer_and_group_lookup_vty (vty, argv[0]);
4287 if (! peer)
4288 return CMD_WARNING;
4289
4290 VTY_GET_INTEGER_RANGE ("", gtsm_hops, argv[1], 1, 254);
4291
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00004292 return bgp_vty_return (vty, peer_ttl_security_hops_set (peer, gtsm_hops));
Nick Hilliardfa411a22011-03-23 15:33:17 +00004293}
4294
4295DEFUN (no_neighbor_ttl_security,
4296 no_neighbor_ttl_security_cmd,
4297 NO_NEIGHBOR_CMD2 "ttl-security hops <1-254>",
4298 NO_STR
4299 NEIGHBOR_STR
4300 NEIGHBOR_ADDR_STR2
4301 "Specify the maximum number of hops to the BGP peer\n")
4302{
4303 struct peer *peer;
Nick Hilliardfa411a22011-03-23 15:33:17 +00004304
4305 peer = peer_and_group_lookup_vty (vty, argv[0]);
4306 if (! peer)
4307 return CMD_WARNING;
4308
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00004309 return bgp_vty_return (vty, peer_ttl_security_hops_unset (peer));
Nick Hilliardfa411a22011-03-23 15:33:17 +00004310}
David Lamparter6b0655a2014-06-04 06:53:35 +02004311
paul718e3742002-12-13 20:15:29 +00004312/* Address family configuration. */
4313DEFUN (address_family_ipv4,
4314 address_family_ipv4_cmd,
4315 "address-family ipv4",
4316 "Enter Address Family command mode\n"
4317 "Address family\n")
4318{
4319 vty->node = BGP_IPV4_NODE;
4320 return CMD_SUCCESS;
4321}
4322
4323DEFUN (address_family_ipv4_safi,
4324 address_family_ipv4_safi_cmd,
4325 "address-family ipv4 (unicast|multicast)",
4326 "Enter Address Family command mode\n"
4327 "Address family\n"
4328 "Address Family modifier\n"
4329 "Address Family modifier\n")
4330{
4331 if (strncmp (argv[0], "m", 1) == 0)
4332 vty->node = BGP_IPV4M_NODE;
4333 else
4334 vty->node = BGP_IPV4_NODE;
4335
4336 return CMD_SUCCESS;
4337}
4338
paul25ffbdc2005-08-22 22:42:08 +00004339DEFUN (address_family_ipv6,
4340 address_family_ipv6_cmd,
4341 "address-family ipv6",
paul718e3742002-12-13 20:15:29 +00004342 "Enter Address Family command mode\n"
paul25ffbdc2005-08-22 22:42:08 +00004343 "Address family\n")
paul718e3742002-12-13 20:15:29 +00004344{
4345 vty->node = BGP_IPV6_NODE;
4346 return CMD_SUCCESS;
4347}
4348
paul25ffbdc2005-08-22 22:42:08 +00004349DEFUN (address_family_ipv6_safi,
4350 address_family_ipv6_safi_cmd,
4351 "address-family ipv6 (unicast|multicast)",
paul718e3742002-12-13 20:15:29 +00004352 "Enter Address Family command mode\n"
paul25ffbdc2005-08-22 22:42:08 +00004353 "Address family\n"
4354 "Address Family modifier\n"
4355 "Address Family modifier\n")
4356{
4357 if (strncmp (argv[0], "m", 1) == 0)
4358 vty->node = BGP_IPV6M_NODE;
4359 else
4360 vty->node = BGP_IPV6_NODE;
4361
4362 return CMD_SUCCESS;
4363}
paul718e3742002-12-13 20:15:29 +00004364
4365DEFUN (address_family_vpnv4,
4366 address_family_vpnv4_cmd,
4367 "address-family vpnv4",
4368 "Enter Address Family command mode\n"
4369 "Address family\n")
4370{
4371 vty->node = BGP_VPNV4_NODE;
4372 return CMD_SUCCESS;
4373}
4374
4375ALIAS (address_family_vpnv4,
4376 address_family_vpnv4_unicast_cmd,
4377 "address-family vpnv4 unicast",
4378 "Enter Address Family command mode\n"
4379 "Address family\n"
4380 "Address Family Modifier\n")
4381
Lou Berger13c378d2016-01-12 13:41:56 -05004382DEFUN (address_family_vpnv6,
4383 address_family_vpnv6_cmd,
4384 "address-family vpnv6",
4385 "Enter Address Family command mode\n"
4386 "Address family\n")
4387{
4388 vty->node = BGP_VPNV6_NODE;
4389 return CMD_SUCCESS;
4390}
4391
4392ALIAS (address_family_vpnv6,
4393 address_family_vpnv6_unicast_cmd,
4394 "address-family vpnv6 unicast",
4395 "Enter Address Family command mode\n"
4396 "Address family\n"
4397 "Address Family Modifier\n")
4398
Lou Bergera3fda882016-01-12 13:42:04 -05004399DEFUN (address_family_encap,
4400 address_family_encap_cmd,
4401 "address-family encap",
4402 "Enter Address Family command mode\n"
4403 "Address family\n")
4404{
4405 vty->node = BGP_ENCAP_NODE;
4406 return CMD_SUCCESS;
4407}
4408
4409ALIAS (address_family_encap,
4410 address_family_encapv4_cmd,
4411 "address-family encapv4",
4412 "Enter Address Family command mode\n"
4413 "Address family\n")
4414
4415DEFUN (address_family_encapv6,
4416 address_family_encapv6_cmd,
4417 "address-family encapv6",
4418 "Enter Address Family command mode\n"
4419 "Address family\n")
4420{
4421 vty->node = BGP_ENCAPV6_NODE;
4422 return CMD_SUCCESS;
4423}
4424
paul718e3742002-12-13 20:15:29 +00004425DEFUN (exit_address_family,
4426 exit_address_family_cmd,
4427 "exit-address-family",
4428 "Exit from Address Family configuration mode\n")
4429{
Lou Bergera3fda882016-01-12 13:42:04 -05004430 /* should match list in command.c:config_exit */
hassoa8a80d52005-04-09 13:07:47 +00004431 if (vty->node == BGP_IPV4_NODE
Lou Bergera3fda882016-01-12 13:42:04 -05004432 || vty->node == BGP_ENCAP_NODE
4433 || vty->node == BGP_ENCAPV6_NODE
hassoa8a80d52005-04-09 13:07:47 +00004434 || vty->node == BGP_IPV4M_NODE
paul718e3742002-12-13 20:15:29 +00004435 || vty->node == BGP_VPNV4_NODE
Lou Berger13c378d2016-01-12 13:41:56 -05004436 || vty->node == BGP_VPNV6_NODE
paul25ffbdc2005-08-22 22:42:08 +00004437 || vty->node == BGP_IPV6_NODE
4438 || vty->node == BGP_IPV6M_NODE)
paul718e3742002-12-13 20:15:29 +00004439 vty->node = BGP_NODE;
4440 return CMD_SUCCESS;
4441}
David Lamparter6b0655a2014-06-04 06:53:35 +02004442
paul718e3742002-12-13 20:15:29 +00004443/* BGP clear sort. */
4444enum clear_sort
4445{
4446 clear_all,
4447 clear_peer,
4448 clear_group,
4449 clear_external,
4450 clear_as
4451};
4452
paul94f2b392005-06-28 12:44:16 +00004453static void
paul718e3742002-12-13 20:15:29 +00004454bgp_clear_vty_error (struct vty *vty, struct peer *peer, afi_t afi,
4455 safi_t safi, int error)
4456{
4457 switch (error)
4458 {
4459 case BGP_ERR_AF_UNCONFIGURED:
4460 vty_out (vty,
4461 "%%BGP: Enable %s %s address family for the neighbor %s%s",
4462 afi == AFI_IP6 ? "IPv6" : safi == SAFI_MPLS_VPN ? "VPNv4" : "IPv4",
4463 safi == SAFI_MULTICAST ? "Multicast" : "Unicast",
4464 peer->host, VTY_NEWLINE);
4465 break;
4466 case BGP_ERR_SOFT_RECONFIG_UNCONFIGURED:
4467 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);
4468 break;
4469 default:
4470 break;
4471 }
4472}
4473
4474/* `clear ip bgp' functions. */
paul94f2b392005-06-28 12:44:16 +00004475static int
paul718e3742002-12-13 20:15:29 +00004476bgp_clear (struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi,
paulfd79ac92004-10-13 05:06:08 +00004477 enum clear_sort sort,enum bgp_clear_type stype, const char *arg)
paul718e3742002-12-13 20:15:29 +00004478{
4479 int ret;
4480 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00004481 struct listnode *node, *nnode;
paul718e3742002-12-13 20:15:29 +00004482
4483 /* Clear all neighbors. */
4484 if (sort == clear_all)
4485 {
paul1eb8ef22005-04-07 07:30:20 +00004486 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004487 {
4488 if (stype == BGP_CLEAR_SOFT_NONE)
4489 ret = peer_clear (peer);
4490 else
4491 ret = peer_clear_soft (peer, afi, safi, stype);
4492
4493 if (ret < 0)
4494 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4495 }
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004496 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004497 }
4498
4499 /* Clear specified neighbors. */
4500 if (sort == clear_peer)
4501 {
4502 union sockunion su;
4503 int ret;
4504
4505 /* Make sockunion for lookup. */
4506 ret = str2sockunion (arg, &su);
4507 if (ret < 0)
4508 {
4509 vty_out (vty, "Malformed address: %s%s", arg, VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004510 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00004511 }
4512 peer = peer_lookup (bgp, &su);
4513 if (! peer)
4514 {
4515 vty_out (vty, "%%BGP: Unknown neighbor - \"%s\"%s", arg, VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004516 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00004517 }
4518
4519 if (stype == BGP_CLEAR_SOFT_NONE)
4520 ret = peer_clear (peer);
4521 else
4522 ret = peer_clear_soft (peer, afi, safi, stype);
4523
4524 if (ret < 0)
4525 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4526
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004527 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004528 }
4529
4530 /* Clear all peer-group members. */
4531 if (sort == clear_group)
4532 {
4533 struct peer_group *group;
4534
4535 group = peer_group_lookup (bgp, arg);
4536 if (! group)
4537 {
4538 vty_out (vty, "%%BGP: No such peer-group %s%s", arg, VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004539 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00004540 }
4541
paul1eb8ef22005-04-07 07:30:20 +00004542 for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004543 {
4544 if (stype == BGP_CLEAR_SOFT_NONE)
4545 {
4546 ret = peer_clear (peer);
4547 continue;
4548 }
4549
4550 if (! peer->af_group[afi][safi])
4551 continue;
4552
4553 ret = peer_clear_soft (peer, afi, safi, stype);
4554
4555 if (ret < 0)
4556 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4557 }
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004558 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004559 }
4560
4561 if (sort == clear_external)
4562 {
paul1eb8ef22005-04-07 07:30:20 +00004563 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004564 {
Jorge Boncompte [DTI2]6d85b152012-05-07 16:52:54 +00004565 if (peer->sort == BGP_PEER_IBGP)
paul718e3742002-12-13 20:15:29 +00004566 continue;
4567
4568 if (stype == BGP_CLEAR_SOFT_NONE)
4569 ret = peer_clear (peer);
4570 else
4571 ret = peer_clear_soft (peer, afi, safi, stype);
4572
4573 if (ret < 0)
4574 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4575 }
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004576 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004577 }
4578
4579 if (sort == clear_as)
4580 {
4581 as_t as;
paul718e3742002-12-13 20:15:29 +00004582 int find = 0;
4583
Ulrich Weberbde12e32011-11-16 19:32:12 +04004584 VTY_GET_INTEGER_RANGE ("AS", as, arg, 1, BGP_AS4_MAX);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004585
paul1eb8ef22005-04-07 07:30:20 +00004586 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004587 {
4588 if (peer->as != as)
4589 continue;
4590
4591 find = 1;
4592 if (stype == BGP_CLEAR_SOFT_NONE)
4593 ret = peer_clear (peer);
4594 else
4595 ret = peer_clear_soft (peer, afi, safi, stype);
4596
4597 if (ret < 0)
4598 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4599 }
4600 if (! find)
4601 vty_out (vty, "%%BGP: No peer is configured with AS %s%s", arg,
4602 VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004603 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004604 }
4605
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004606 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004607}
4608
paul94f2b392005-06-28 12:44:16 +00004609static int
paulfd79ac92004-10-13 05:06:08 +00004610bgp_clear_vty (struct vty *vty, const char *name, afi_t afi, safi_t safi,
4611 enum clear_sort sort, enum bgp_clear_type stype,
4612 const char *arg)
paul718e3742002-12-13 20:15:29 +00004613{
paul718e3742002-12-13 20:15:29 +00004614 struct bgp *bgp;
4615
4616 /* BGP structure lookup. */
4617 if (name)
4618 {
4619 bgp = bgp_lookup_by_name (name);
4620 if (bgp == NULL)
4621 {
4622 vty_out (vty, "Can't find BGP view %s%s", name, VTY_NEWLINE);
4623 return CMD_WARNING;
4624 }
4625 }
4626 else
4627 {
4628 bgp = bgp_get_default ();
4629 if (bgp == NULL)
4630 {
4631 vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE);
4632 return CMD_WARNING;
4633 }
4634 }
4635
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004636 return bgp_clear (vty, bgp, afi, safi, sort, stype, arg);
paul718e3742002-12-13 20:15:29 +00004637}
4638
4639DEFUN (clear_ip_bgp_all,
4640 clear_ip_bgp_all_cmd,
4641 "clear ip bgp *",
4642 CLEAR_STR
4643 IP_STR
4644 BGP_STR
4645 "Clear all peers\n")
4646{
4647 if (argc == 1)
4648 return bgp_clear_vty (vty, argv[0], 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL);
4649
4650 return bgp_clear_vty (vty, NULL, 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL);
4651}
4652
4653ALIAS (clear_ip_bgp_all,
4654 clear_bgp_all_cmd,
4655 "clear bgp *",
4656 CLEAR_STR
4657 BGP_STR
4658 "Clear all peers\n")
4659
4660ALIAS (clear_ip_bgp_all,
4661 clear_bgp_ipv6_all_cmd,
4662 "clear bgp ipv6 *",
4663 CLEAR_STR
4664 BGP_STR
4665 "Address family\n"
4666 "Clear all peers\n")
4667
4668ALIAS (clear_ip_bgp_all,
4669 clear_ip_bgp_instance_all_cmd,
4670 "clear ip bgp view WORD *",
4671 CLEAR_STR
4672 IP_STR
4673 BGP_STR
4674 "BGP view\n"
4675 "view name\n"
4676 "Clear all peers\n")
4677
4678ALIAS (clear_ip_bgp_all,
4679 clear_bgp_instance_all_cmd,
4680 "clear bgp view WORD *",
4681 CLEAR_STR
4682 BGP_STR
4683 "BGP view\n"
4684 "view name\n"
4685 "Clear all peers\n")
4686
4687DEFUN (clear_ip_bgp_peer,
4688 clear_ip_bgp_peer_cmd,
4689 "clear ip bgp (A.B.C.D|X:X::X:X)",
4690 CLEAR_STR
4691 IP_STR
4692 BGP_STR
4693 "BGP neighbor IP address to clear\n"
4694 "BGP IPv6 neighbor to clear\n")
4695{
4696 return bgp_clear_vty (vty, NULL, 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[0]);
4697}
4698
4699ALIAS (clear_ip_bgp_peer,
4700 clear_bgp_peer_cmd,
4701 "clear bgp (A.B.C.D|X:X::X:X)",
4702 CLEAR_STR
4703 BGP_STR
4704 "BGP neighbor address to clear\n"
4705 "BGP IPv6 neighbor to clear\n")
4706
4707ALIAS (clear_ip_bgp_peer,
4708 clear_bgp_ipv6_peer_cmd,
4709 "clear bgp ipv6 (A.B.C.D|X:X::X:X)",
4710 CLEAR_STR
4711 BGP_STR
4712 "Address family\n"
4713 "BGP neighbor address to clear\n"
4714 "BGP IPv6 neighbor to clear\n")
4715
4716DEFUN (clear_ip_bgp_peer_group,
4717 clear_ip_bgp_peer_group_cmd,
4718 "clear ip bgp peer-group WORD",
4719 CLEAR_STR
4720 IP_STR
4721 BGP_STR
4722 "Clear all members of peer-group\n"
4723 "BGP peer-group name\n")
4724{
4725 return bgp_clear_vty (vty, NULL, 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[0]);
4726}
4727
4728ALIAS (clear_ip_bgp_peer_group,
4729 clear_bgp_peer_group_cmd,
4730 "clear bgp peer-group WORD",
4731 CLEAR_STR
4732 BGP_STR
4733 "Clear all members of peer-group\n"
4734 "BGP peer-group name\n")
4735
4736ALIAS (clear_ip_bgp_peer_group,
4737 clear_bgp_ipv6_peer_group_cmd,
4738 "clear bgp ipv6 peer-group WORD",
4739 CLEAR_STR
4740 BGP_STR
4741 "Address family\n"
4742 "Clear all members of peer-group\n"
4743 "BGP peer-group name\n")
4744
4745DEFUN (clear_ip_bgp_external,
4746 clear_ip_bgp_external_cmd,
4747 "clear ip bgp external",
4748 CLEAR_STR
4749 IP_STR
4750 BGP_STR
4751 "Clear all external peers\n")
4752{
4753 return bgp_clear_vty (vty, NULL, 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL);
4754}
4755
4756ALIAS (clear_ip_bgp_external,
4757 clear_bgp_external_cmd,
4758 "clear bgp external",
4759 CLEAR_STR
4760 BGP_STR
4761 "Clear all external peers\n")
4762
4763ALIAS (clear_ip_bgp_external,
4764 clear_bgp_ipv6_external_cmd,
4765 "clear bgp ipv6 external",
4766 CLEAR_STR
4767 BGP_STR
4768 "Address family\n"
4769 "Clear all external peers\n")
4770
4771DEFUN (clear_ip_bgp_as,
4772 clear_ip_bgp_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00004773 "clear ip bgp " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00004774 CLEAR_STR
4775 IP_STR
4776 BGP_STR
4777 "Clear peers with the AS number\n")
4778{
4779 return bgp_clear_vty (vty, NULL, 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[0]);
4780}
4781
4782ALIAS (clear_ip_bgp_as,
4783 clear_bgp_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00004784 "clear bgp " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00004785 CLEAR_STR
4786 BGP_STR
4787 "Clear peers with the AS number\n")
4788
4789ALIAS (clear_ip_bgp_as,
4790 clear_bgp_ipv6_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00004791 "clear bgp ipv6 " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00004792 CLEAR_STR
4793 BGP_STR
4794 "Address family\n"
4795 "Clear peers with the AS number\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02004796
paul718e3742002-12-13 20:15:29 +00004797/* Outbound soft-reconfiguration */
4798DEFUN (clear_ip_bgp_all_soft_out,
4799 clear_ip_bgp_all_soft_out_cmd,
4800 "clear ip bgp * soft out",
4801 CLEAR_STR
4802 IP_STR
4803 BGP_STR
4804 "Clear all peers\n"
4805 "Soft reconfig\n"
4806 "Soft reconfig outbound update\n")
4807{
4808 if (argc == 1)
4809 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
4810 BGP_CLEAR_SOFT_OUT, NULL);
4811
4812 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
4813 BGP_CLEAR_SOFT_OUT, NULL);
4814}
4815
4816ALIAS (clear_ip_bgp_all_soft_out,
4817 clear_ip_bgp_all_out_cmd,
4818 "clear ip bgp * out",
4819 CLEAR_STR
4820 IP_STR
4821 BGP_STR
4822 "Clear all peers\n"
4823 "Soft reconfig outbound update\n")
4824
4825ALIAS (clear_ip_bgp_all_soft_out,
4826 clear_ip_bgp_instance_all_soft_out_cmd,
4827 "clear ip bgp view WORD * soft out",
4828 CLEAR_STR
4829 IP_STR
4830 BGP_STR
4831 "BGP view\n"
4832 "view name\n"
4833 "Clear all peers\n"
4834 "Soft reconfig\n"
4835 "Soft reconfig outbound update\n")
4836
4837DEFUN (clear_ip_bgp_all_ipv4_soft_out,
4838 clear_ip_bgp_all_ipv4_soft_out_cmd,
4839 "clear ip bgp * ipv4 (unicast|multicast) soft out",
4840 CLEAR_STR
4841 IP_STR
4842 BGP_STR
4843 "Clear all peers\n"
4844 "Address family\n"
4845 "Address Family modifier\n"
4846 "Address Family modifier\n"
4847 "Soft reconfig\n"
4848 "Soft reconfig outbound update\n")
4849{
4850 if (strncmp (argv[0], "m", 1) == 0)
4851 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
4852 BGP_CLEAR_SOFT_OUT, NULL);
4853
4854 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
4855 BGP_CLEAR_SOFT_OUT, NULL);
4856}
4857
4858ALIAS (clear_ip_bgp_all_ipv4_soft_out,
4859 clear_ip_bgp_all_ipv4_out_cmd,
4860 "clear ip bgp * ipv4 (unicast|multicast) out",
4861 CLEAR_STR
4862 IP_STR
4863 BGP_STR
4864 "Clear all peers\n"
4865 "Address family\n"
4866 "Address Family modifier\n"
4867 "Address Family modifier\n"
4868 "Soft reconfig outbound update\n")
4869
4870DEFUN (clear_ip_bgp_instance_all_ipv4_soft_out,
4871 clear_ip_bgp_instance_all_ipv4_soft_out_cmd,
4872 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft out",
4873 CLEAR_STR
4874 IP_STR
4875 BGP_STR
4876 "BGP view\n"
4877 "view name\n"
4878 "Clear all peers\n"
4879 "Address family\n"
4880 "Address Family modifier\n"
4881 "Address Family modifier\n"
4882 "Soft reconfig outbound update\n")
4883{
4884 if (strncmp (argv[1], "m", 1) == 0)
4885 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
4886 BGP_CLEAR_SOFT_OUT, NULL);
4887
4888 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
4889 BGP_CLEAR_SOFT_OUT, NULL);
4890}
4891
4892DEFUN (clear_ip_bgp_all_vpnv4_soft_out,
4893 clear_ip_bgp_all_vpnv4_soft_out_cmd,
4894 "clear ip bgp * vpnv4 unicast soft out",
4895 CLEAR_STR
4896 IP_STR
4897 BGP_STR
4898 "Clear all peers\n"
4899 "Address family\n"
4900 "Address Family Modifier\n"
4901 "Soft reconfig\n"
4902 "Soft reconfig outbound update\n")
4903{
4904 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
4905 BGP_CLEAR_SOFT_OUT, NULL);
4906}
4907
4908ALIAS (clear_ip_bgp_all_vpnv4_soft_out,
4909 clear_ip_bgp_all_vpnv4_out_cmd,
4910 "clear ip bgp * vpnv4 unicast out",
4911 CLEAR_STR
4912 IP_STR
4913 BGP_STR
4914 "Clear all peers\n"
4915 "Address family\n"
4916 "Address Family Modifier\n"
4917 "Soft reconfig outbound update\n")
4918
Lou Berger298cc2f2016-01-12 13:42:02 -05004919DEFUN (clear_ip_bgp_all_encap_soft_out,
4920 clear_ip_bgp_all_encap_soft_out_cmd,
4921 "clear ip bgp * encap unicast soft out",
4922 CLEAR_STR
4923 IP_STR
4924 BGP_STR
4925 "Clear all peers\n"
4926 "Address family\n"
4927 "Address Family Modifier\n"
4928 "Soft reconfig\n"
4929 "Soft reconfig outbound update\n")
4930{
4931 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_all,
4932 BGP_CLEAR_SOFT_OUT, NULL);
4933}
4934
4935ALIAS (clear_ip_bgp_all_encap_soft_out,
4936 clear_ip_bgp_all_encap_out_cmd,
4937 "clear ip bgp * encap unicast out",
4938 CLEAR_STR
4939 IP_STR
4940 BGP_STR
4941 "Clear all peers\n"
4942 "Address family\n"
4943 "Address Family Modifier\n"
4944 "Soft reconfig outbound update\n")
4945
paul718e3742002-12-13 20:15:29 +00004946DEFUN (clear_bgp_all_soft_out,
4947 clear_bgp_all_soft_out_cmd,
4948 "clear bgp * soft out",
4949 CLEAR_STR
4950 BGP_STR
4951 "Clear all peers\n"
4952 "Soft reconfig\n"
4953 "Soft reconfig outbound update\n")
4954{
4955 if (argc == 1)
4956 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
4957 BGP_CLEAR_SOFT_OUT, NULL);
4958
4959 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
4960 BGP_CLEAR_SOFT_OUT, NULL);
4961}
4962
4963ALIAS (clear_bgp_all_soft_out,
4964 clear_bgp_instance_all_soft_out_cmd,
4965 "clear bgp view WORD * soft out",
4966 CLEAR_STR
4967 BGP_STR
4968 "BGP view\n"
4969 "view name\n"
4970 "Clear all peers\n"
4971 "Soft reconfig\n"
4972 "Soft reconfig outbound update\n")
4973
4974ALIAS (clear_bgp_all_soft_out,
4975 clear_bgp_all_out_cmd,
4976 "clear bgp * out",
4977 CLEAR_STR
4978 BGP_STR
4979 "Clear all peers\n"
4980 "Soft reconfig outbound update\n")
4981
4982ALIAS (clear_bgp_all_soft_out,
4983 clear_bgp_ipv6_all_soft_out_cmd,
4984 "clear bgp ipv6 * soft out",
4985 CLEAR_STR
4986 BGP_STR
4987 "Address family\n"
4988 "Clear all peers\n"
4989 "Soft reconfig\n"
4990 "Soft reconfig outbound update\n")
4991
4992ALIAS (clear_bgp_all_soft_out,
4993 clear_bgp_ipv6_all_out_cmd,
4994 "clear bgp ipv6 * out",
4995 CLEAR_STR
4996 BGP_STR
4997 "Address family\n"
4998 "Clear all peers\n"
4999 "Soft reconfig outbound update\n")
5000
5001DEFUN (clear_ip_bgp_peer_soft_out,
5002 clear_ip_bgp_peer_soft_out_cmd,
5003 "clear ip bgp A.B.C.D soft out",
5004 CLEAR_STR
5005 IP_STR
5006 BGP_STR
5007 "BGP neighbor address to clear\n"
5008 "Soft reconfig\n"
5009 "Soft reconfig outbound update\n")
5010{
5011 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5012 BGP_CLEAR_SOFT_OUT, argv[0]);
5013}
5014
5015ALIAS (clear_ip_bgp_peer_soft_out,
5016 clear_ip_bgp_peer_out_cmd,
5017 "clear ip bgp A.B.C.D out",
5018 CLEAR_STR
5019 IP_STR
5020 BGP_STR
5021 "BGP neighbor address to clear\n"
5022 "Soft reconfig outbound update\n")
5023
5024DEFUN (clear_ip_bgp_peer_ipv4_soft_out,
5025 clear_ip_bgp_peer_ipv4_soft_out_cmd,
5026 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft out",
5027 CLEAR_STR
5028 IP_STR
5029 BGP_STR
5030 "BGP neighbor address to clear\n"
5031 "Address family\n"
5032 "Address Family modifier\n"
5033 "Address Family modifier\n"
5034 "Soft reconfig\n"
5035 "Soft reconfig outbound update\n")
5036{
5037 if (strncmp (argv[1], "m", 1) == 0)
5038 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
5039 BGP_CLEAR_SOFT_OUT, argv[0]);
5040
5041 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5042 BGP_CLEAR_SOFT_OUT, argv[0]);
5043}
5044
5045ALIAS (clear_ip_bgp_peer_ipv4_soft_out,
5046 clear_ip_bgp_peer_ipv4_out_cmd,
5047 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) out",
5048 CLEAR_STR
5049 IP_STR
5050 BGP_STR
5051 "BGP neighbor address to clear\n"
5052 "Address family\n"
5053 "Address Family modifier\n"
5054 "Address Family modifier\n"
5055 "Soft reconfig outbound update\n")
5056
5057DEFUN (clear_ip_bgp_peer_vpnv4_soft_out,
5058 clear_ip_bgp_peer_vpnv4_soft_out_cmd,
5059 "clear ip bgp A.B.C.D vpnv4 unicast soft out",
5060 CLEAR_STR
5061 IP_STR
5062 BGP_STR
5063 "BGP neighbor address to clear\n"
5064 "Address family\n"
5065 "Address Family Modifier\n"
5066 "Soft reconfig\n"
5067 "Soft reconfig outbound update\n")
5068{
5069 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
5070 BGP_CLEAR_SOFT_OUT, argv[0]);
5071}
5072
5073ALIAS (clear_ip_bgp_peer_vpnv4_soft_out,
5074 clear_ip_bgp_peer_vpnv4_out_cmd,
5075 "clear ip bgp A.B.C.D vpnv4 unicast out",
5076 CLEAR_STR
5077 IP_STR
5078 BGP_STR
5079 "BGP neighbor address to clear\n"
5080 "Address family\n"
5081 "Address Family Modifier\n"
5082 "Soft reconfig outbound update\n")
5083
Lou Berger298cc2f2016-01-12 13:42:02 -05005084DEFUN (clear_ip_bgp_peer_encap_soft_out,
5085 clear_ip_bgp_peer_encap_soft_out_cmd,
5086 "clear ip bgp A.B.C.D encap unicast soft out",
5087 CLEAR_STR
5088 IP_STR
5089 BGP_STR
5090 "BGP neighbor address to clear\n"
5091 "Address family\n"
5092 "Address Family Modifier\n"
5093 "Soft reconfig\n"
5094 "Soft reconfig outbound update\n")
5095{
5096 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_peer,
5097 BGP_CLEAR_SOFT_OUT, argv[0]);
5098}
5099
5100ALIAS (clear_ip_bgp_peer_encap_soft_out,
5101 clear_ip_bgp_peer_encap_out_cmd,
5102 "clear ip bgp A.B.C.D encap unicast out",
5103 CLEAR_STR
5104 IP_STR
5105 BGP_STR
5106 "BGP neighbor address to clear\n"
5107 "Address family\n"
5108 "Address Family Modifier\n"
5109 "Soft reconfig outbound update\n")
5110
paul718e3742002-12-13 20:15:29 +00005111DEFUN (clear_bgp_peer_soft_out,
5112 clear_bgp_peer_soft_out_cmd,
5113 "clear bgp (A.B.C.D|X:X::X:X) soft out",
5114 CLEAR_STR
5115 BGP_STR
5116 "BGP neighbor address to clear\n"
5117 "BGP IPv6 neighbor to clear\n"
5118 "Soft reconfig\n"
5119 "Soft reconfig outbound update\n")
5120{
5121 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
5122 BGP_CLEAR_SOFT_OUT, argv[0]);
5123}
5124
5125ALIAS (clear_bgp_peer_soft_out,
5126 clear_bgp_ipv6_peer_soft_out_cmd,
5127 "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft out",
5128 CLEAR_STR
5129 BGP_STR
5130 "Address family\n"
5131 "BGP neighbor address to clear\n"
5132 "BGP IPv6 neighbor to clear\n"
5133 "Soft reconfig\n"
5134 "Soft reconfig outbound update\n")
5135
5136ALIAS (clear_bgp_peer_soft_out,
5137 clear_bgp_peer_out_cmd,
5138 "clear bgp (A.B.C.D|X:X::X:X) out",
5139 CLEAR_STR
5140 BGP_STR
5141 "BGP neighbor address to clear\n"
5142 "BGP IPv6 neighbor to clear\n"
5143 "Soft reconfig outbound update\n")
5144
5145ALIAS (clear_bgp_peer_soft_out,
5146 clear_bgp_ipv6_peer_out_cmd,
5147 "clear bgp ipv6 (A.B.C.D|X:X::X:X) out",
5148 CLEAR_STR
5149 BGP_STR
5150 "Address family\n"
5151 "BGP neighbor address to clear\n"
5152 "BGP IPv6 neighbor to clear\n"
5153 "Soft reconfig outbound update\n")
5154
5155DEFUN (clear_ip_bgp_peer_group_soft_out,
5156 clear_ip_bgp_peer_group_soft_out_cmd,
5157 "clear ip bgp peer-group WORD soft out",
5158 CLEAR_STR
5159 IP_STR
5160 BGP_STR
5161 "Clear all members of peer-group\n"
5162 "BGP peer-group name\n"
5163 "Soft reconfig\n"
5164 "Soft reconfig outbound update\n")
5165{
5166 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5167 BGP_CLEAR_SOFT_OUT, argv[0]);
5168}
5169
5170ALIAS (clear_ip_bgp_peer_group_soft_out,
5171 clear_ip_bgp_peer_group_out_cmd,
5172 "clear ip bgp peer-group WORD out",
5173 CLEAR_STR
5174 IP_STR
5175 BGP_STR
5176 "Clear all members of peer-group\n"
5177 "BGP peer-group name\n"
5178 "Soft reconfig outbound update\n")
5179
5180DEFUN (clear_ip_bgp_peer_group_ipv4_soft_out,
5181 clear_ip_bgp_peer_group_ipv4_soft_out_cmd,
5182 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft out",
5183 CLEAR_STR
5184 IP_STR
5185 BGP_STR
5186 "Clear all members of peer-group\n"
5187 "BGP peer-group name\n"
5188 "Address family\n"
5189 "Address Family modifier\n"
5190 "Address Family modifier\n"
5191 "Soft reconfig\n"
5192 "Soft reconfig outbound update\n")
5193{
5194 if (strncmp (argv[1], "m", 1) == 0)
5195 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
5196 BGP_CLEAR_SOFT_OUT, argv[0]);
5197
5198 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5199 BGP_CLEAR_SOFT_OUT, argv[0]);
5200}
5201
5202ALIAS (clear_ip_bgp_peer_group_ipv4_soft_out,
5203 clear_ip_bgp_peer_group_ipv4_out_cmd,
5204 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) out",
5205 CLEAR_STR
5206 IP_STR
5207 BGP_STR
5208 "Clear all members of peer-group\n"
5209 "BGP peer-group name\n"
5210 "Address family\n"
5211 "Address Family modifier\n"
5212 "Address Family modifier\n"
5213 "Soft reconfig outbound update\n")
5214
5215DEFUN (clear_bgp_peer_group_soft_out,
5216 clear_bgp_peer_group_soft_out_cmd,
5217 "clear bgp peer-group WORD soft out",
5218 CLEAR_STR
5219 BGP_STR
5220 "Clear all members of peer-group\n"
5221 "BGP peer-group name\n"
5222 "Soft reconfig\n"
5223 "Soft reconfig outbound update\n")
5224{
5225 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
5226 BGP_CLEAR_SOFT_OUT, argv[0]);
5227}
5228
5229ALIAS (clear_bgp_peer_group_soft_out,
5230 clear_bgp_ipv6_peer_group_soft_out_cmd,
5231 "clear bgp ipv6 peer-group WORD soft out",
5232 CLEAR_STR
5233 BGP_STR
5234 "Address family\n"
5235 "Clear all members of peer-group\n"
5236 "BGP peer-group name\n"
5237 "Soft reconfig\n"
5238 "Soft reconfig outbound update\n")
5239
5240ALIAS (clear_bgp_peer_group_soft_out,
5241 clear_bgp_peer_group_out_cmd,
5242 "clear bgp peer-group WORD out",
5243 CLEAR_STR
5244 BGP_STR
5245 "Clear all members of peer-group\n"
5246 "BGP peer-group name\n"
5247 "Soft reconfig outbound update\n")
5248
5249ALIAS (clear_bgp_peer_group_soft_out,
5250 clear_bgp_ipv6_peer_group_out_cmd,
5251 "clear bgp ipv6 peer-group WORD out",
5252 CLEAR_STR
5253 BGP_STR
5254 "Address family\n"
5255 "Clear all members of peer-group\n"
5256 "BGP peer-group name\n"
5257 "Soft reconfig outbound update\n")
5258
5259DEFUN (clear_ip_bgp_external_soft_out,
5260 clear_ip_bgp_external_soft_out_cmd,
5261 "clear ip bgp external soft out",
5262 CLEAR_STR
5263 IP_STR
5264 BGP_STR
5265 "Clear all external peers\n"
5266 "Soft reconfig\n"
5267 "Soft reconfig outbound update\n")
5268{
5269 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5270 BGP_CLEAR_SOFT_OUT, NULL);
5271}
5272
5273ALIAS (clear_ip_bgp_external_soft_out,
5274 clear_ip_bgp_external_out_cmd,
5275 "clear ip bgp external out",
5276 CLEAR_STR
5277 IP_STR
5278 BGP_STR
5279 "Clear all external peers\n"
5280 "Soft reconfig outbound update\n")
5281
5282DEFUN (clear_ip_bgp_external_ipv4_soft_out,
5283 clear_ip_bgp_external_ipv4_soft_out_cmd,
5284 "clear ip bgp external ipv4 (unicast|multicast) soft out",
5285 CLEAR_STR
5286 IP_STR
5287 BGP_STR
5288 "Clear all external peers\n"
5289 "Address family\n"
5290 "Address Family modifier\n"
5291 "Address Family modifier\n"
5292 "Soft reconfig\n"
5293 "Soft reconfig outbound update\n")
5294{
5295 if (strncmp (argv[0], "m", 1) == 0)
5296 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
5297 BGP_CLEAR_SOFT_OUT, NULL);
5298
5299 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5300 BGP_CLEAR_SOFT_OUT, NULL);
5301}
5302
5303ALIAS (clear_ip_bgp_external_ipv4_soft_out,
5304 clear_ip_bgp_external_ipv4_out_cmd,
5305 "clear ip bgp external ipv4 (unicast|multicast) out",
5306 CLEAR_STR
5307 IP_STR
5308 BGP_STR
5309 "Clear all external peers\n"
5310 "Address family\n"
5311 "Address Family modifier\n"
5312 "Address Family modifier\n"
5313 "Soft reconfig outbound update\n")
5314
5315DEFUN (clear_bgp_external_soft_out,
5316 clear_bgp_external_soft_out_cmd,
5317 "clear bgp external soft out",
5318 CLEAR_STR
5319 BGP_STR
5320 "Clear all external peers\n"
5321 "Soft reconfig\n"
5322 "Soft reconfig outbound update\n")
5323{
5324 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
5325 BGP_CLEAR_SOFT_OUT, NULL);
5326}
5327
5328ALIAS (clear_bgp_external_soft_out,
5329 clear_bgp_ipv6_external_soft_out_cmd,
5330 "clear bgp ipv6 external soft out",
5331 CLEAR_STR
5332 BGP_STR
5333 "Address family\n"
5334 "Clear all external peers\n"
5335 "Soft reconfig\n"
5336 "Soft reconfig outbound update\n")
5337
5338ALIAS (clear_bgp_external_soft_out,
5339 clear_bgp_external_out_cmd,
5340 "clear bgp external out",
5341 CLEAR_STR
5342 BGP_STR
5343 "Clear all external peers\n"
5344 "Soft reconfig outbound update\n")
5345
5346ALIAS (clear_bgp_external_soft_out,
5347 clear_bgp_ipv6_external_out_cmd,
5348 "clear bgp ipv6 external WORD out",
5349 CLEAR_STR
5350 BGP_STR
5351 "Address family\n"
5352 "Clear all external peers\n"
5353 "Soft reconfig outbound update\n")
5354
5355DEFUN (clear_ip_bgp_as_soft_out,
5356 clear_ip_bgp_as_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005357 "clear ip bgp " CMD_AS_RANGE " soft out",
paul718e3742002-12-13 20:15:29 +00005358 CLEAR_STR
5359 IP_STR
5360 BGP_STR
5361 "Clear peers with the AS number\n"
5362 "Soft reconfig\n"
5363 "Soft reconfig outbound update\n")
5364{
5365 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
5366 BGP_CLEAR_SOFT_OUT, argv[0]);
5367}
5368
5369ALIAS (clear_ip_bgp_as_soft_out,
5370 clear_ip_bgp_as_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005371 "clear ip bgp " CMD_AS_RANGE " out",
paul718e3742002-12-13 20:15:29 +00005372 CLEAR_STR
5373 IP_STR
5374 BGP_STR
5375 "Clear peers with the AS number\n"
5376 "Soft reconfig outbound update\n")
5377
5378DEFUN (clear_ip_bgp_as_ipv4_soft_out,
5379 clear_ip_bgp_as_ipv4_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005380 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft out",
paul718e3742002-12-13 20:15:29 +00005381 CLEAR_STR
5382 IP_STR
5383 BGP_STR
5384 "Clear peers with the AS number\n"
5385 "Address family\n"
5386 "Address Family modifier\n"
5387 "Address Family modifier\n"
5388 "Soft reconfig\n"
5389 "Soft reconfig outbound update\n")
5390{
5391 if (strncmp (argv[1], "m", 1) == 0)
5392 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
5393 BGP_CLEAR_SOFT_OUT, argv[0]);
5394
5395 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
5396 BGP_CLEAR_SOFT_OUT, argv[0]);
5397}
5398
5399ALIAS (clear_ip_bgp_as_ipv4_soft_out,
5400 clear_ip_bgp_as_ipv4_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005401 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) out",
paul718e3742002-12-13 20:15:29 +00005402 CLEAR_STR
5403 IP_STR
5404 BGP_STR
5405 "Clear peers with the AS number\n"
5406 "Address family\n"
5407 "Address Family modifier\n"
5408 "Address Family modifier\n"
5409 "Soft reconfig outbound update\n")
5410
5411DEFUN (clear_ip_bgp_as_vpnv4_soft_out,
5412 clear_ip_bgp_as_vpnv4_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005413 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft out",
paul718e3742002-12-13 20:15:29 +00005414 CLEAR_STR
5415 IP_STR
5416 BGP_STR
5417 "Clear peers with the AS number\n"
5418 "Address family\n"
5419 "Address Family modifier\n"
5420 "Soft reconfig\n"
5421 "Soft reconfig outbound update\n")
5422{
5423 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
5424 BGP_CLEAR_SOFT_OUT, argv[0]);
5425}
5426
5427ALIAS (clear_ip_bgp_as_vpnv4_soft_out,
5428 clear_ip_bgp_as_vpnv4_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005429 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast out",
paul718e3742002-12-13 20:15:29 +00005430 CLEAR_STR
5431 IP_STR
5432 BGP_STR
5433 "Clear peers with the AS number\n"
5434 "Address family\n"
5435 "Address Family modifier\n"
5436 "Soft reconfig outbound update\n")
5437
Lou Berger298cc2f2016-01-12 13:42:02 -05005438DEFUN (clear_ip_bgp_as_encap_soft_out,
5439 clear_ip_bgp_as_encap_soft_out_cmd,
5440 "clear ip bgp " CMD_AS_RANGE " encap unicast soft out",
5441 CLEAR_STR
5442 IP_STR
5443 BGP_STR
5444 "Clear peers with the AS number\n"
5445 "Address family\n"
5446 "Address Family modifier\n"
5447 "Soft reconfig\n"
5448 "Soft reconfig outbound update\n")
5449{
5450 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_as,
5451 BGP_CLEAR_SOFT_OUT, argv[0]);
5452}
5453
5454ALIAS (clear_ip_bgp_as_encap_soft_out,
5455 clear_ip_bgp_as_encap_out_cmd,
5456 "clear ip bgp " CMD_AS_RANGE " encap unicast out",
5457 CLEAR_STR
5458 IP_STR
5459 BGP_STR
5460 "Clear peers with the AS number\n"
5461 "Address family\n"
5462 "Address Family modifier\n"
5463 "Soft reconfig outbound update\n")
5464
paul718e3742002-12-13 20:15:29 +00005465DEFUN (clear_bgp_as_soft_out,
5466 clear_bgp_as_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005467 "clear bgp " CMD_AS_RANGE " soft out",
paul718e3742002-12-13 20:15:29 +00005468 CLEAR_STR
5469 BGP_STR
5470 "Clear peers with the AS number\n"
5471 "Soft reconfig\n"
5472 "Soft reconfig outbound update\n")
5473{
5474 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
5475 BGP_CLEAR_SOFT_OUT, argv[0]);
5476}
5477
5478ALIAS (clear_bgp_as_soft_out,
5479 clear_bgp_ipv6_as_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005480 "clear bgp ipv6 " CMD_AS_RANGE " soft out",
paul718e3742002-12-13 20:15:29 +00005481 CLEAR_STR
5482 BGP_STR
5483 "Address family\n"
5484 "Clear peers with the AS number\n"
5485 "Soft reconfig\n"
5486 "Soft reconfig outbound update\n")
5487
5488ALIAS (clear_bgp_as_soft_out,
5489 clear_bgp_as_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005490 "clear bgp " CMD_AS_RANGE " out",
paul718e3742002-12-13 20:15:29 +00005491 CLEAR_STR
5492 BGP_STR
5493 "Clear peers with the AS number\n"
5494 "Soft reconfig outbound update\n")
5495
5496ALIAS (clear_bgp_as_soft_out,
5497 clear_bgp_ipv6_as_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005498 "clear bgp ipv6 " CMD_AS_RANGE " out",
paul718e3742002-12-13 20:15:29 +00005499 CLEAR_STR
5500 BGP_STR
5501 "Address family\n"
5502 "Clear peers with the AS number\n"
5503 "Soft reconfig outbound update\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02005504
paul718e3742002-12-13 20:15:29 +00005505/* Inbound soft-reconfiguration */
5506DEFUN (clear_ip_bgp_all_soft_in,
5507 clear_ip_bgp_all_soft_in_cmd,
5508 "clear ip bgp * soft in",
5509 CLEAR_STR
5510 IP_STR
5511 BGP_STR
5512 "Clear all peers\n"
5513 "Soft reconfig\n"
5514 "Soft reconfig inbound update\n")
5515{
5516 if (argc == 1)
5517 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5518 BGP_CLEAR_SOFT_IN, NULL);
5519
5520 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5521 BGP_CLEAR_SOFT_IN, NULL);
5522}
5523
5524ALIAS (clear_ip_bgp_all_soft_in,
5525 clear_ip_bgp_instance_all_soft_in_cmd,
5526 "clear ip bgp view WORD * soft in",
5527 CLEAR_STR
5528 IP_STR
5529 BGP_STR
5530 "BGP view\n"
5531 "view name\n"
5532 "Clear all peers\n"
5533 "Soft reconfig\n"
5534 "Soft reconfig inbound update\n")
5535
5536ALIAS (clear_ip_bgp_all_soft_in,
5537 clear_ip_bgp_all_in_cmd,
5538 "clear ip bgp * in",
5539 CLEAR_STR
5540 IP_STR
5541 BGP_STR
5542 "Clear all peers\n"
5543 "Soft reconfig inbound update\n")
5544
5545DEFUN (clear_ip_bgp_all_in_prefix_filter,
5546 clear_ip_bgp_all_in_prefix_filter_cmd,
5547 "clear ip bgp * in prefix-filter",
5548 CLEAR_STR
5549 IP_STR
5550 BGP_STR
5551 "Clear all peers\n"
5552 "Soft reconfig inbound update\n"
5553 "Push out prefix-list ORF and do inbound soft reconfig\n")
5554{
5555 if (argc== 1)
5556 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5557 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5558
5559 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5560 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5561}
5562
5563ALIAS (clear_ip_bgp_all_in_prefix_filter,
5564 clear_ip_bgp_instance_all_in_prefix_filter_cmd,
5565 "clear ip bgp view WORD * in prefix-filter",
5566 CLEAR_STR
5567 IP_STR
5568 BGP_STR
5569 "BGP view\n"
5570 "view name\n"
5571 "Clear all peers\n"
5572 "Soft reconfig inbound update\n"
5573 "Push out prefix-list ORF and do inbound soft reconfig\n")
5574
5575
5576DEFUN (clear_ip_bgp_all_ipv4_soft_in,
5577 clear_ip_bgp_all_ipv4_soft_in_cmd,
5578 "clear ip bgp * ipv4 (unicast|multicast) soft in",
5579 CLEAR_STR
5580 IP_STR
5581 BGP_STR
5582 "Clear all peers\n"
5583 "Address family\n"
5584 "Address Family modifier\n"
5585 "Address Family modifier\n"
5586 "Soft reconfig\n"
5587 "Soft reconfig inbound update\n")
5588{
5589 if (strncmp (argv[0], "m", 1) == 0)
5590 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
5591 BGP_CLEAR_SOFT_IN, NULL);
5592
5593 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5594 BGP_CLEAR_SOFT_IN, NULL);
5595}
5596
5597ALIAS (clear_ip_bgp_all_ipv4_soft_in,
5598 clear_ip_bgp_all_ipv4_in_cmd,
5599 "clear ip bgp * ipv4 (unicast|multicast) in",
5600 CLEAR_STR
5601 IP_STR
5602 BGP_STR
5603 "Clear all peers\n"
5604 "Address family\n"
5605 "Address Family modifier\n"
5606 "Address Family modifier\n"
5607 "Soft reconfig inbound update\n")
5608
5609DEFUN (clear_ip_bgp_instance_all_ipv4_soft_in,
5610 clear_ip_bgp_instance_all_ipv4_soft_in_cmd,
5611 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft in",
5612 CLEAR_STR
5613 IP_STR
5614 BGP_STR
5615 "BGP view\n"
5616 "view name\n"
5617 "Clear all peers\n"
5618 "Address family\n"
5619 "Address Family modifier\n"
5620 "Address Family modifier\n"
5621 "Soft reconfig\n"
5622 "Soft reconfig inbound update\n")
5623{
5624 if (strncmp (argv[1], "m", 1) == 0)
5625 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
5626 BGP_CLEAR_SOFT_IN, NULL);
5627
5628 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5629 BGP_CLEAR_SOFT_IN, NULL);
5630}
5631
5632DEFUN (clear_ip_bgp_all_ipv4_in_prefix_filter,
5633 clear_ip_bgp_all_ipv4_in_prefix_filter_cmd,
5634 "clear ip bgp * ipv4 (unicast|multicast) in prefix-filter",
5635 CLEAR_STR
5636 IP_STR
5637 BGP_STR
5638 "Clear all peers\n"
5639 "Address family\n"
5640 "Address Family modifier\n"
5641 "Address Family modifier\n"
5642 "Soft reconfig inbound update\n"
5643 "Push out prefix-list ORF and do inbound soft reconfig\n")
5644{
5645 if (strncmp (argv[0], "m", 1) == 0)
5646 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
5647 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5648
5649 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5650 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5651}
5652
5653DEFUN (clear_ip_bgp_instance_all_ipv4_in_prefix_filter,
5654 clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd,
5655 "clear ip bgp view WORD * ipv4 (unicast|multicast) in prefix-filter",
5656 CLEAR_STR
5657 IP_STR
5658 BGP_STR
5659 "Clear all peers\n"
5660 "Address family\n"
5661 "Address Family modifier\n"
5662 "Address Family modifier\n"
5663 "Soft reconfig inbound update\n"
5664 "Push out prefix-list ORF and do inbound soft reconfig\n")
5665{
5666 if (strncmp (argv[1], "m", 1) == 0)
5667 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
5668 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5669
5670 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5671 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5672}
5673
5674DEFUN (clear_ip_bgp_all_vpnv4_soft_in,
5675 clear_ip_bgp_all_vpnv4_soft_in_cmd,
5676 "clear ip bgp * vpnv4 unicast soft in",
5677 CLEAR_STR
5678 IP_STR
5679 BGP_STR
5680 "Clear all peers\n"
5681 "Address family\n"
5682 "Address Family Modifier\n"
5683 "Soft reconfig\n"
5684 "Soft reconfig inbound update\n")
5685{
5686 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
5687 BGP_CLEAR_SOFT_IN, NULL);
5688}
5689
5690ALIAS (clear_ip_bgp_all_vpnv4_soft_in,
5691 clear_ip_bgp_all_vpnv4_in_cmd,
5692 "clear ip bgp * vpnv4 unicast in",
5693 CLEAR_STR
5694 IP_STR
5695 BGP_STR
5696 "Clear all peers\n"
5697 "Address family\n"
5698 "Address Family Modifier\n"
5699 "Soft reconfig inbound update\n")
5700
Lou Berger298cc2f2016-01-12 13:42:02 -05005701DEFUN (clear_ip_bgp_all_encap_soft_in,
5702 clear_ip_bgp_all_encap_soft_in_cmd,
5703 "clear ip bgp * encap unicast soft in",
5704 CLEAR_STR
5705 IP_STR
5706 BGP_STR
5707 "Clear all peers\n"
5708 "Address family\n"
5709 "Address Family Modifier\n"
5710 "Soft reconfig\n"
5711 "Soft reconfig inbound update\n")
5712{
5713 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_all,
5714 BGP_CLEAR_SOFT_IN, NULL);
5715}
5716
5717ALIAS (clear_ip_bgp_all_encap_soft_in,
5718 clear_ip_bgp_all_encap_in_cmd,
5719 "clear ip bgp * encap unicast in",
5720 CLEAR_STR
5721 IP_STR
5722 BGP_STR
5723 "Clear all peers\n"
5724 "Address family\n"
5725 "Address Family Modifier\n"
5726 "Soft reconfig inbound update\n")
5727
paul718e3742002-12-13 20:15:29 +00005728DEFUN (clear_bgp_all_soft_in,
5729 clear_bgp_all_soft_in_cmd,
5730 "clear bgp * soft in",
5731 CLEAR_STR
5732 BGP_STR
5733 "Clear all peers\n"
5734 "Soft reconfig\n"
5735 "Soft reconfig inbound update\n")
5736{
5737 if (argc == 1)
5738 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
5739 BGP_CLEAR_SOFT_IN, NULL);
5740
5741 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
5742 BGP_CLEAR_SOFT_IN, NULL);
5743}
5744
5745ALIAS (clear_bgp_all_soft_in,
5746 clear_bgp_instance_all_soft_in_cmd,
5747 "clear bgp view WORD * soft in",
5748 CLEAR_STR
5749 BGP_STR
5750 "BGP view\n"
5751 "view name\n"
5752 "Clear all peers\n"
5753 "Soft reconfig\n"
5754 "Soft reconfig inbound update\n")
5755
5756ALIAS (clear_bgp_all_soft_in,
5757 clear_bgp_ipv6_all_soft_in_cmd,
5758 "clear bgp ipv6 * soft in",
5759 CLEAR_STR
5760 BGP_STR
5761 "Address family\n"
5762 "Clear all peers\n"
5763 "Soft reconfig\n"
5764 "Soft reconfig inbound update\n")
5765
5766ALIAS (clear_bgp_all_soft_in,
5767 clear_bgp_all_in_cmd,
5768 "clear bgp * in",
5769 CLEAR_STR
5770 BGP_STR
5771 "Clear all peers\n"
5772 "Soft reconfig inbound update\n")
5773
5774ALIAS (clear_bgp_all_soft_in,
5775 clear_bgp_ipv6_all_in_cmd,
5776 "clear bgp ipv6 * in",
5777 CLEAR_STR
5778 BGP_STR
5779 "Address family\n"
5780 "Clear all peers\n"
5781 "Soft reconfig inbound update\n")
5782
5783DEFUN (clear_bgp_all_in_prefix_filter,
5784 clear_bgp_all_in_prefix_filter_cmd,
5785 "clear bgp * in prefix-filter",
5786 CLEAR_STR
5787 BGP_STR
5788 "Clear all peers\n"
5789 "Soft reconfig inbound update\n"
5790 "Push out prefix-list ORF and do inbound soft reconfig\n")
5791{
5792 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
5793 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5794}
5795
5796ALIAS (clear_bgp_all_in_prefix_filter,
5797 clear_bgp_ipv6_all_in_prefix_filter_cmd,
5798 "clear bgp ipv6 * in prefix-filter",
5799 CLEAR_STR
5800 BGP_STR
5801 "Address family\n"
5802 "Clear all peers\n"
5803 "Soft reconfig inbound update\n"
5804 "Push out prefix-list ORF and do inbound soft reconfig\n")
5805
5806DEFUN (clear_ip_bgp_peer_soft_in,
5807 clear_ip_bgp_peer_soft_in_cmd,
5808 "clear ip bgp A.B.C.D soft in",
5809 CLEAR_STR
5810 IP_STR
5811 BGP_STR
5812 "BGP neighbor address to clear\n"
5813 "Soft reconfig\n"
5814 "Soft reconfig inbound update\n")
5815{
5816 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5817 BGP_CLEAR_SOFT_IN, argv[0]);
5818}
5819
5820ALIAS (clear_ip_bgp_peer_soft_in,
5821 clear_ip_bgp_peer_in_cmd,
5822 "clear ip bgp A.B.C.D in",
5823 CLEAR_STR
5824 IP_STR
5825 BGP_STR
5826 "BGP neighbor address to clear\n"
5827 "Soft reconfig inbound update\n")
5828
5829DEFUN (clear_ip_bgp_peer_in_prefix_filter,
5830 clear_ip_bgp_peer_in_prefix_filter_cmd,
5831 "clear ip bgp A.B.C.D in prefix-filter",
5832 CLEAR_STR
5833 IP_STR
5834 BGP_STR
5835 "BGP neighbor address to clear\n"
5836 "Soft reconfig inbound update\n"
5837 "Push out the existing ORF prefix-list\n")
5838{
5839 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5840 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5841}
5842
5843DEFUN (clear_ip_bgp_peer_ipv4_soft_in,
5844 clear_ip_bgp_peer_ipv4_soft_in_cmd,
5845 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft in",
5846 CLEAR_STR
5847 IP_STR
5848 BGP_STR
5849 "BGP neighbor address to clear\n"
5850 "Address family\n"
5851 "Address Family modifier\n"
5852 "Address Family modifier\n"
5853 "Soft reconfig\n"
5854 "Soft reconfig inbound update\n")
5855{
5856 if (strncmp (argv[1], "m", 1) == 0)
5857 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
5858 BGP_CLEAR_SOFT_IN, argv[0]);
5859
5860 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5861 BGP_CLEAR_SOFT_IN, argv[0]);
5862}
5863
5864ALIAS (clear_ip_bgp_peer_ipv4_soft_in,
5865 clear_ip_bgp_peer_ipv4_in_cmd,
5866 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in",
5867 CLEAR_STR
5868 IP_STR
5869 BGP_STR
5870 "BGP neighbor address to clear\n"
5871 "Address family\n"
5872 "Address Family modifier\n"
5873 "Address Family modifier\n"
5874 "Soft reconfig inbound update\n")
5875
5876DEFUN (clear_ip_bgp_peer_ipv4_in_prefix_filter,
5877 clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd,
5878 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in prefix-filter",
5879 CLEAR_STR
5880 IP_STR
5881 BGP_STR
5882 "BGP neighbor address to clear\n"
5883 "Address family\n"
5884 "Address Family modifier\n"
5885 "Address Family modifier\n"
5886 "Soft reconfig inbound update\n"
5887 "Push out the existing ORF prefix-list\n")
5888{
5889 if (strncmp (argv[1], "m", 1) == 0)
5890 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
5891 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5892
5893 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5894 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5895}
5896
5897DEFUN (clear_ip_bgp_peer_vpnv4_soft_in,
5898 clear_ip_bgp_peer_vpnv4_soft_in_cmd,
5899 "clear ip bgp A.B.C.D vpnv4 unicast soft in",
5900 CLEAR_STR
5901 IP_STR
5902 BGP_STR
5903 "BGP neighbor address to clear\n"
5904 "Address family\n"
5905 "Address Family Modifier\n"
5906 "Soft reconfig\n"
5907 "Soft reconfig inbound update\n")
5908{
5909 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
5910 BGP_CLEAR_SOFT_IN, argv[0]);
5911}
5912
5913ALIAS (clear_ip_bgp_peer_vpnv4_soft_in,
5914 clear_ip_bgp_peer_vpnv4_in_cmd,
5915 "clear ip bgp A.B.C.D vpnv4 unicast in",
5916 CLEAR_STR
5917 IP_STR
5918 BGP_STR
5919 "BGP neighbor address to clear\n"
5920 "Address family\n"
5921 "Address Family Modifier\n"
5922 "Soft reconfig inbound update\n")
5923
Lou Berger298cc2f2016-01-12 13:42:02 -05005924DEFUN (clear_ip_bgp_peer_encap_soft_in,
5925 clear_ip_bgp_peer_encap_soft_in_cmd,
5926 "clear ip bgp A.B.C.D encap unicast soft in",
5927 CLEAR_STR
5928 IP_STR
5929 BGP_STR
5930 "BGP neighbor address to clear\n"
5931 "Address family\n"
5932 "Address Family Modifier\n"
5933 "Soft reconfig\n"
5934 "Soft reconfig inbound update\n")
5935{
5936 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_peer,
5937 BGP_CLEAR_SOFT_IN, argv[0]);
5938}
5939
5940ALIAS (clear_ip_bgp_peer_encap_soft_in,
5941 clear_ip_bgp_peer_encap_in_cmd,
5942 "clear ip bgp A.B.C.D encap unicast in",
5943 CLEAR_STR
5944 IP_STR
5945 BGP_STR
5946 "BGP neighbor address to clear\n"
5947 "Address family\n"
5948 "Address Family Modifier\n"
5949 "Soft reconfig inbound update\n")
5950
paul718e3742002-12-13 20:15:29 +00005951DEFUN (clear_bgp_peer_soft_in,
5952 clear_bgp_peer_soft_in_cmd,
5953 "clear bgp (A.B.C.D|X:X::X:X) soft in",
5954 CLEAR_STR
5955 BGP_STR
5956 "BGP neighbor address to clear\n"
5957 "BGP IPv6 neighbor to clear\n"
5958 "Soft reconfig\n"
5959 "Soft reconfig inbound update\n")
5960{
5961 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
5962 BGP_CLEAR_SOFT_IN, argv[0]);
5963}
5964
5965ALIAS (clear_bgp_peer_soft_in,
5966 clear_bgp_ipv6_peer_soft_in_cmd,
5967 "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft in",
5968 CLEAR_STR
5969 BGP_STR
5970 "Address family\n"
5971 "BGP neighbor address to clear\n"
5972 "BGP IPv6 neighbor to clear\n"
5973 "Soft reconfig\n"
5974 "Soft reconfig inbound update\n")
5975
5976ALIAS (clear_bgp_peer_soft_in,
5977 clear_bgp_peer_in_cmd,
5978 "clear bgp (A.B.C.D|X:X::X:X) in",
5979 CLEAR_STR
5980 BGP_STR
5981 "BGP neighbor address to clear\n"
5982 "BGP IPv6 neighbor to clear\n"
5983 "Soft reconfig inbound update\n")
5984
5985ALIAS (clear_bgp_peer_soft_in,
5986 clear_bgp_ipv6_peer_in_cmd,
5987 "clear bgp ipv6 (A.B.C.D|X:X::X:X) in",
5988 CLEAR_STR
5989 BGP_STR
5990 "Address family\n"
5991 "BGP neighbor address to clear\n"
5992 "BGP IPv6 neighbor to clear\n"
5993 "Soft reconfig inbound update\n")
5994
5995DEFUN (clear_bgp_peer_in_prefix_filter,
5996 clear_bgp_peer_in_prefix_filter_cmd,
5997 "clear bgp (A.B.C.D|X:X::X:X) in prefix-filter",
5998 CLEAR_STR
5999 BGP_STR
6000 "BGP neighbor address to clear\n"
6001 "BGP IPv6 neighbor to clear\n"
6002 "Soft reconfig inbound update\n"
6003 "Push out the existing ORF prefix-list\n")
6004{
6005 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
6006 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6007}
6008
6009ALIAS (clear_bgp_peer_in_prefix_filter,
6010 clear_bgp_ipv6_peer_in_prefix_filter_cmd,
6011 "clear bgp ipv6 (A.B.C.D|X:X::X:X) in prefix-filter",
6012 CLEAR_STR
6013 BGP_STR
6014 "Address family\n"
6015 "BGP neighbor address to clear\n"
6016 "BGP IPv6 neighbor to clear\n"
6017 "Soft reconfig inbound update\n"
6018 "Push out the existing ORF prefix-list\n")
6019
6020DEFUN (clear_ip_bgp_peer_group_soft_in,
6021 clear_ip_bgp_peer_group_soft_in_cmd,
6022 "clear ip bgp peer-group WORD soft in",
6023 CLEAR_STR
6024 IP_STR
6025 BGP_STR
6026 "Clear all members of peer-group\n"
6027 "BGP peer-group name\n"
6028 "Soft reconfig\n"
6029 "Soft reconfig inbound update\n")
6030{
6031 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6032 BGP_CLEAR_SOFT_IN, argv[0]);
6033}
6034
6035ALIAS (clear_ip_bgp_peer_group_soft_in,
6036 clear_ip_bgp_peer_group_in_cmd,
6037 "clear ip bgp peer-group WORD in",
6038 CLEAR_STR
6039 IP_STR
6040 BGP_STR
6041 "Clear all members of peer-group\n"
6042 "BGP peer-group name\n"
6043 "Soft reconfig inbound update\n")
6044
6045DEFUN (clear_ip_bgp_peer_group_in_prefix_filter,
6046 clear_ip_bgp_peer_group_in_prefix_filter_cmd,
6047 "clear ip bgp peer-group WORD in prefix-filter",
6048 CLEAR_STR
6049 IP_STR
6050 BGP_STR
6051 "Clear all members of peer-group\n"
6052 "BGP peer-group name\n"
6053 "Soft reconfig inbound update\n"
6054 "Push out prefix-list ORF and do inbound soft reconfig\n")
6055{
6056 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6057 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6058}
6059
6060DEFUN (clear_ip_bgp_peer_group_ipv4_soft_in,
6061 clear_ip_bgp_peer_group_ipv4_soft_in_cmd,
6062 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft in",
6063 CLEAR_STR
6064 IP_STR
6065 BGP_STR
6066 "Clear all members of peer-group\n"
6067 "BGP peer-group name\n"
6068 "Address family\n"
6069 "Address Family modifier\n"
6070 "Address Family modifier\n"
6071 "Soft reconfig\n"
6072 "Soft reconfig inbound update\n")
6073{
6074 if (strncmp (argv[1], "m", 1) == 0)
6075 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
6076 BGP_CLEAR_SOFT_IN, argv[0]);
6077
6078 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6079 BGP_CLEAR_SOFT_IN, argv[0]);
6080}
6081
6082ALIAS (clear_ip_bgp_peer_group_ipv4_soft_in,
6083 clear_ip_bgp_peer_group_ipv4_in_cmd,
6084 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in",
6085 CLEAR_STR
6086 IP_STR
6087 BGP_STR
6088 "Clear all members of peer-group\n"
6089 "BGP peer-group name\n"
6090 "Address family\n"
6091 "Address Family modifier\n"
6092 "Address Family modifier\n"
6093 "Soft reconfig inbound update\n")
6094
6095DEFUN (clear_ip_bgp_peer_group_ipv4_in_prefix_filter,
6096 clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd,
6097 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in prefix-filter",
6098 CLEAR_STR
6099 IP_STR
6100 BGP_STR
6101 "Clear all members of peer-group\n"
6102 "BGP peer-group name\n"
6103 "Address family\n"
6104 "Address Family modifier\n"
6105 "Address Family modifier\n"
6106 "Soft reconfig inbound update\n"
6107 "Push out prefix-list ORF and do inbound soft reconfig\n")
6108{
6109 if (strncmp (argv[1], "m", 1) == 0)
6110 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
6111 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6112
6113 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6114 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6115}
6116
6117DEFUN (clear_bgp_peer_group_soft_in,
6118 clear_bgp_peer_group_soft_in_cmd,
6119 "clear bgp peer-group WORD soft in",
6120 CLEAR_STR
6121 BGP_STR
6122 "Clear all members of peer-group\n"
6123 "BGP peer-group name\n"
6124 "Soft reconfig\n"
6125 "Soft reconfig inbound update\n")
6126{
6127 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
6128 BGP_CLEAR_SOFT_IN, argv[0]);
6129}
6130
6131ALIAS (clear_bgp_peer_group_soft_in,
6132 clear_bgp_ipv6_peer_group_soft_in_cmd,
6133 "clear bgp ipv6 peer-group WORD soft in",
6134 CLEAR_STR
6135 BGP_STR
6136 "Address family\n"
6137 "Clear all members of peer-group\n"
6138 "BGP peer-group name\n"
6139 "Soft reconfig\n"
6140 "Soft reconfig inbound update\n")
6141
6142ALIAS (clear_bgp_peer_group_soft_in,
6143 clear_bgp_peer_group_in_cmd,
6144 "clear bgp peer-group WORD in",
6145 CLEAR_STR
6146 BGP_STR
6147 "Clear all members of peer-group\n"
6148 "BGP peer-group name\n"
6149 "Soft reconfig inbound update\n")
6150
6151ALIAS (clear_bgp_peer_group_soft_in,
6152 clear_bgp_ipv6_peer_group_in_cmd,
6153 "clear bgp ipv6 peer-group WORD in",
6154 CLEAR_STR
6155 BGP_STR
6156 "Address family\n"
6157 "Clear all members of peer-group\n"
6158 "BGP peer-group name\n"
6159 "Soft reconfig inbound update\n")
6160
6161DEFUN (clear_bgp_peer_group_in_prefix_filter,
6162 clear_bgp_peer_group_in_prefix_filter_cmd,
6163 "clear bgp peer-group WORD in prefix-filter",
6164 CLEAR_STR
6165 BGP_STR
6166 "Clear all members of peer-group\n"
6167 "BGP peer-group name\n"
6168 "Soft reconfig inbound update\n"
6169 "Push out prefix-list ORF and do inbound soft reconfig\n")
6170{
6171 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
6172 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6173}
6174
6175ALIAS (clear_bgp_peer_group_in_prefix_filter,
6176 clear_bgp_ipv6_peer_group_in_prefix_filter_cmd,
6177 "clear bgp ipv6 peer-group WORD in prefix-filter",
6178 CLEAR_STR
6179 BGP_STR
6180 "Address family\n"
6181 "Clear all members of peer-group\n"
6182 "BGP peer-group name\n"
6183 "Soft reconfig inbound update\n"
6184 "Push out prefix-list ORF and do inbound soft reconfig\n")
6185
6186DEFUN (clear_ip_bgp_external_soft_in,
6187 clear_ip_bgp_external_soft_in_cmd,
6188 "clear ip bgp external soft in",
6189 CLEAR_STR
6190 IP_STR
6191 BGP_STR
6192 "Clear all external peers\n"
6193 "Soft reconfig\n"
6194 "Soft reconfig inbound update\n")
6195{
6196 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6197 BGP_CLEAR_SOFT_IN, NULL);
6198}
6199
6200ALIAS (clear_ip_bgp_external_soft_in,
6201 clear_ip_bgp_external_in_cmd,
6202 "clear ip bgp external in",
6203 CLEAR_STR
6204 IP_STR
6205 BGP_STR
6206 "Clear all external peers\n"
6207 "Soft reconfig inbound update\n")
6208
6209DEFUN (clear_ip_bgp_external_in_prefix_filter,
6210 clear_ip_bgp_external_in_prefix_filter_cmd,
6211 "clear ip bgp external in prefix-filter",
6212 CLEAR_STR
6213 IP_STR
6214 BGP_STR
6215 "Clear all external peers\n"
6216 "Soft reconfig inbound update\n"
6217 "Push out prefix-list ORF and do inbound soft reconfig\n")
6218{
6219 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6220 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
6221}
6222
6223DEFUN (clear_ip_bgp_external_ipv4_soft_in,
6224 clear_ip_bgp_external_ipv4_soft_in_cmd,
6225 "clear ip bgp external ipv4 (unicast|multicast) soft in",
6226 CLEAR_STR
6227 IP_STR
6228 BGP_STR
6229 "Clear all external peers\n"
6230 "Address family\n"
6231 "Address Family modifier\n"
6232 "Address Family modifier\n"
6233 "Soft reconfig\n"
6234 "Soft reconfig inbound update\n")
6235{
6236 if (strncmp (argv[0], "m", 1) == 0)
6237 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
6238 BGP_CLEAR_SOFT_IN, NULL);
6239
6240 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6241 BGP_CLEAR_SOFT_IN, NULL);
6242}
6243
6244ALIAS (clear_ip_bgp_external_ipv4_soft_in,
6245 clear_ip_bgp_external_ipv4_in_cmd,
6246 "clear ip bgp external ipv4 (unicast|multicast) in",
6247 CLEAR_STR
6248 IP_STR
6249 BGP_STR
6250 "Clear all external peers\n"
6251 "Address family\n"
6252 "Address Family modifier\n"
6253 "Address Family modifier\n"
6254 "Soft reconfig inbound update\n")
6255
6256DEFUN (clear_ip_bgp_external_ipv4_in_prefix_filter,
6257 clear_ip_bgp_external_ipv4_in_prefix_filter_cmd,
6258 "clear ip bgp external ipv4 (unicast|multicast) in prefix-filter",
6259 CLEAR_STR
6260 IP_STR
6261 BGP_STR
6262 "Clear all external peers\n"
6263 "Address family\n"
6264 "Address Family modifier\n"
6265 "Address Family modifier\n"
6266 "Soft reconfig inbound update\n"
6267 "Push out prefix-list ORF and do inbound soft reconfig\n")
6268{
6269 if (strncmp (argv[0], "m", 1) == 0)
6270 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
6271 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
6272
6273 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6274 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
6275}
6276
6277DEFUN (clear_bgp_external_soft_in,
6278 clear_bgp_external_soft_in_cmd,
6279 "clear bgp external soft in",
6280 CLEAR_STR
6281 BGP_STR
6282 "Clear all external peers\n"
6283 "Soft reconfig\n"
6284 "Soft reconfig inbound update\n")
6285{
6286 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
6287 BGP_CLEAR_SOFT_IN, NULL);
6288}
6289
6290ALIAS (clear_bgp_external_soft_in,
6291 clear_bgp_ipv6_external_soft_in_cmd,
6292 "clear bgp ipv6 external soft in",
6293 CLEAR_STR
6294 BGP_STR
6295 "Address family\n"
6296 "Clear all external peers\n"
6297 "Soft reconfig\n"
6298 "Soft reconfig inbound update\n")
6299
6300ALIAS (clear_bgp_external_soft_in,
6301 clear_bgp_external_in_cmd,
6302 "clear bgp external in",
6303 CLEAR_STR
6304 BGP_STR
6305 "Clear all external peers\n"
6306 "Soft reconfig inbound update\n")
6307
6308ALIAS (clear_bgp_external_soft_in,
6309 clear_bgp_ipv6_external_in_cmd,
6310 "clear bgp ipv6 external WORD in",
6311 CLEAR_STR
6312 BGP_STR
6313 "Address family\n"
6314 "Clear all external peers\n"
6315 "Soft reconfig inbound update\n")
6316
6317DEFUN (clear_bgp_external_in_prefix_filter,
6318 clear_bgp_external_in_prefix_filter_cmd,
6319 "clear bgp external in prefix-filter",
6320 CLEAR_STR
6321 BGP_STR
6322 "Clear all external peers\n"
6323 "Soft reconfig inbound update\n"
6324 "Push out prefix-list ORF and do inbound soft reconfig\n")
6325{
6326 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
6327 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
6328}
6329
6330ALIAS (clear_bgp_external_in_prefix_filter,
6331 clear_bgp_ipv6_external_in_prefix_filter_cmd,
6332 "clear bgp ipv6 external in prefix-filter",
6333 CLEAR_STR
6334 BGP_STR
6335 "Address family\n"
6336 "Clear all external peers\n"
6337 "Soft reconfig inbound update\n"
6338 "Push out prefix-list ORF and do inbound soft reconfig\n")
6339
6340DEFUN (clear_ip_bgp_as_soft_in,
6341 clear_ip_bgp_as_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006342 "clear ip bgp " CMD_AS_RANGE " soft in",
paul718e3742002-12-13 20:15:29 +00006343 CLEAR_STR
6344 IP_STR
6345 BGP_STR
6346 "Clear peers with the AS number\n"
6347 "Soft reconfig\n"
6348 "Soft reconfig inbound update\n")
6349{
6350 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6351 BGP_CLEAR_SOFT_IN, argv[0]);
6352}
6353
6354ALIAS (clear_ip_bgp_as_soft_in,
6355 clear_ip_bgp_as_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006356 "clear ip bgp " CMD_AS_RANGE " in",
paul718e3742002-12-13 20:15:29 +00006357 CLEAR_STR
6358 IP_STR
6359 BGP_STR
6360 "Clear peers with the AS number\n"
6361 "Soft reconfig inbound update\n")
6362
6363DEFUN (clear_ip_bgp_as_in_prefix_filter,
6364 clear_ip_bgp_as_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006365 "clear ip bgp " CMD_AS_RANGE " in prefix-filter",
paul718e3742002-12-13 20:15:29 +00006366 CLEAR_STR
6367 IP_STR
6368 BGP_STR
6369 "Clear peers with the AS number\n"
6370 "Soft reconfig inbound update\n"
6371 "Push out prefix-list ORF and do inbound soft reconfig\n")
6372{
6373 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6374 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6375}
6376
6377DEFUN (clear_ip_bgp_as_ipv4_soft_in,
6378 clear_ip_bgp_as_ipv4_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006379 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft in",
paul718e3742002-12-13 20:15:29 +00006380 CLEAR_STR
6381 IP_STR
6382 BGP_STR
6383 "Clear peers with the AS number\n"
6384 "Address family\n"
6385 "Address Family modifier\n"
6386 "Address Family modifier\n"
6387 "Soft reconfig\n"
6388 "Soft reconfig inbound update\n")
6389{
6390 if (strncmp (argv[1], "m", 1) == 0)
6391 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
6392 BGP_CLEAR_SOFT_IN, argv[0]);
6393
6394 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6395 BGP_CLEAR_SOFT_IN, argv[0]);
6396}
6397
6398ALIAS (clear_ip_bgp_as_ipv4_soft_in,
6399 clear_ip_bgp_as_ipv4_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006400 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in",
paul718e3742002-12-13 20:15:29 +00006401 CLEAR_STR
6402 IP_STR
6403 BGP_STR
6404 "Clear peers with the AS number\n"
6405 "Address family\n"
6406 "Address Family modifier\n"
6407 "Address Family modifier\n"
6408 "Soft reconfig inbound update\n")
6409
6410DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter,
6411 clear_ip_bgp_as_ipv4_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006412 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in prefix-filter",
paul718e3742002-12-13 20:15:29 +00006413 CLEAR_STR
6414 IP_STR
6415 BGP_STR
6416 "Clear peers with the AS number\n"
6417 "Address family\n"
6418 "Address Family modifier\n"
6419 "Address Family modifier\n"
6420 "Soft reconfig inbound update\n"
6421 "Push out prefix-list ORF and do inbound soft reconfig\n")
6422{
6423 if (strncmp (argv[1], "m", 1) == 0)
6424 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
6425 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6426
6427 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6428 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6429}
6430
6431DEFUN (clear_ip_bgp_as_vpnv4_soft_in,
6432 clear_ip_bgp_as_vpnv4_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006433 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft in",
paul718e3742002-12-13 20:15:29 +00006434 CLEAR_STR
6435 IP_STR
6436 BGP_STR
6437 "Clear peers with the AS number\n"
6438 "Address family\n"
6439 "Address Family modifier\n"
6440 "Soft reconfig\n"
6441 "Soft reconfig inbound update\n")
6442{
6443 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
6444 BGP_CLEAR_SOFT_IN, argv[0]);
6445}
6446
6447ALIAS (clear_ip_bgp_as_vpnv4_soft_in,
6448 clear_ip_bgp_as_vpnv4_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006449 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast in",
paul718e3742002-12-13 20:15:29 +00006450 CLEAR_STR
6451 IP_STR
6452 BGP_STR
6453 "Clear peers with the AS number\n"
6454 "Address family\n"
6455 "Address Family modifier\n"
6456 "Soft reconfig inbound update\n")
6457
Lou Berger298cc2f2016-01-12 13:42:02 -05006458DEFUN (clear_ip_bgp_as_encap_soft_in,
6459 clear_ip_bgp_as_encap_soft_in_cmd,
6460 "clear ip bgp " CMD_AS_RANGE " encap unicast soft in",
6461 CLEAR_STR
6462 IP_STR
6463 BGP_STR
6464 "Clear peers with the AS number\n"
6465 "Address family\n"
6466 "Address Family modifier\n"
6467 "Soft reconfig\n"
6468 "Soft reconfig inbound update\n")
6469{
6470 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_as,
6471 BGP_CLEAR_SOFT_IN, argv[0]);
6472}
6473
6474ALIAS (clear_ip_bgp_as_encap_soft_in,
6475 clear_ip_bgp_as_encap_in_cmd,
6476 "clear ip bgp " CMD_AS_RANGE " encap unicast in",
6477 CLEAR_STR
6478 IP_STR
6479 BGP_STR
6480 "Clear peers with the AS number\n"
6481 "Address family\n"
6482 "Address Family modifier\n"
6483 "Soft reconfig inbound update\n")
6484
paul718e3742002-12-13 20:15:29 +00006485DEFUN (clear_bgp_as_soft_in,
6486 clear_bgp_as_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006487 "clear bgp " CMD_AS_RANGE " soft in",
paul718e3742002-12-13 20:15:29 +00006488 CLEAR_STR
6489 BGP_STR
6490 "Clear peers with the AS number\n"
6491 "Soft reconfig\n"
6492 "Soft reconfig inbound update\n")
6493{
6494 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
6495 BGP_CLEAR_SOFT_IN, argv[0]);
6496}
6497
6498ALIAS (clear_bgp_as_soft_in,
6499 clear_bgp_ipv6_as_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006500 "clear bgp ipv6 " CMD_AS_RANGE " soft in",
paul718e3742002-12-13 20:15:29 +00006501 CLEAR_STR
6502 BGP_STR
6503 "Address family\n"
6504 "Clear peers with the AS number\n"
6505 "Soft reconfig\n"
6506 "Soft reconfig inbound update\n")
6507
6508ALIAS (clear_bgp_as_soft_in,
6509 clear_bgp_as_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006510 "clear bgp " CMD_AS_RANGE " in",
paul718e3742002-12-13 20:15:29 +00006511 CLEAR_STR
6512 BGP_STR
6513 "Clear peers with the AS number\n"
6514 "Soft reconfig inbound update\n")
6515
6516ALIAS (clear_bgp_as_soft_in,
6517 clear_bgp_ipv6_as_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006518 "clear bgp ipv6 " CMD_AS_RANGE " in",
paul718e3742002-12-13 20:15:29 +00006519 CLEAR_STR
6520 BGP_STR
6521 "Address family\n"
6522 "Clear peers with the AS number\n"
6523 "Soft reconfig inbound update\n")
6524
6525DEFUN (clear_bgp_as_in_prefix_filter,
6526 clear_bgp_as_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006527 "clear bgp " CMD_AS_RANGE " in prefix-filter",
paul718e3742002-12-13 20:15:29 +00006528 CLEAR_STR
6529 BGP_STR
6530 "Clear peers with the AS number\n"
6531 "Soft reconfig inbound update\n"
6532 "Push out prefix-list ORF and do inbound soft reconfig\n")
6533{
6534 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
6535 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6536}
6537
6538ALIAS (clear_bgp_as_in_prefix_filter,
6539 clear_bgp_ipv6_as_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006540 "clear bgp ipv6 " CMD_AS_RANGE " in prefix-filter",
paul718e3742002-12-13 20:15:29 +00006541 CLEAR_STR
6542 BGP_STR
6543 "Address family\n"
6544 "Clear peers with the AS number\n"
6545 "Soft reconfig inbound update\n"
6546 "Push out prefix-list ORF and do inbound soft reconfig\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02006547
paul718e3742002-12-13 20:15:29 +00006548/* Both soft-reconfiguration */
6549DEFUN (clear_ip_bgp_all_soft,
6550 clear_ip_bgp_all_soft_cmd,
6551 "clear ip bgp * soft",
6552 CLEAR_STR
6553 IP_STR
6554 BGP_STR
6555 "Clear all peers\n"
6556 "Soft reconfig\n")
6557{
6558 if (argc == 1)
6559 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
6560 BGP_CLEAR_SOFT_BOTH, NULL);
6561
6562 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6563 BGP_CLEAR_SOFT_BOTH, NULL);
6564}
6565
6566ALIAS (clear_ip_bgp_all_soft,
6567 clear_ip_bgp_instance_all_soft_cmd,
6568 "clear ip bgp view WORD * soft",
6569 CLEAR_STR
6570 IP_STR
6571 BGP_STR
6572 "BGP view\n"
6573 "view name\n"
6574 "Clear all peers\n"
6575 "Soft reconfig\n")
6576
6577
6578DEFUN (clear_ip_bgp_all_ipv4_soft,
6579 clear_ip_bgp_all_ipv4_soft_cmd,
6580 "clear ip bgp * ipv4 (unicast|multicast) soft",
6581 CLEAR_STR
6582 IP_STR
6583 BGP_STR
6584 "Clear all peers\n"
6585 "Address family\n"
6586 "Address Family Modifier\n"
6587 "Address Family Modifier\n"
6588 "Soft reconfig\n")
6589{
6590 if (strncmp (argv[0], "m", 1) == 0)
6591 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
6592 BGP_CLEAR_SOFT_BOTH, NULL);
6593
6594 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6595 BGP_CLEAR_SOFT_BOTH, NULL);
6596}
6597
6598DEFUN (clear_ip_bgp_instance_all_ipv4_soft,
6599 clear_ip_bgp_instance_all_ipv4_soft_cmd,
6600 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft",
6601 CLEAR_STR
6602 IP_STR
6603 BGP_STR
6604 "BGP view\n"
6605 "view name\n"
6606 "Clear all peers\n"
6607 "Address family\n"
6608 "Address Family Modifier\n"
6609 "Address Family Modifier\n"
6610 "Soft reconfig\n")
6611{
6612 if (strncmp (argv[1], "m", 1) == 0)
6613 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
6614 BGP_CLEAR_SOFT_BOTH, NULL);
6615
6616 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6617 BGP_CLEAR_SOFT_BOTH, NULL);
6618}
6619
6620DEFUN (clear_ip_bgp_all_vpnv4_soft,
6621 clear_ip_bgp_all_vpnv4_soft_cmd,
6622 "clear ip bgp * vpnv4 unicast soft",
6623 CLEAR_STR
6624 IP_STR
6625 BGP_STR
6626 "Clear all peers\n"
6627 "Address family\n"
6628 "Address Family Modifier\n"
6629 "Soft reconfig\n")
6630{
6631 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
6632 BGP_CLEAR_SOFT_BOTH, argv[0]);
6633}
6634
Lou Berger298cc2f2016-01-12 13:42:02 -05006635DEFUN (clear_ip_bgp_all_encap_soft,
6636 clear_ip_bgp_all_encap_soft_cmd,
6637 "clear ip bgp * encap unicast soft",
6638 CLEAR_STR
6639 IP_STR
6640 BGP_STR
6641 "Clear all peers\n"
6642 "Address family\n"
6643 "Address Family Modifier\n"
6644 "Soft reconfig\n")
6645{
6646 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_all,
6647 BGP_CLEAR_SOFT_BOTH, argv[0]);
6648}
6649
paul718e3742002-12-13 20:15:29 +00006650DEFUN (clear_bgp_all_soft,
6651 clear_bgp_all_soft_cmd,
6652 "clear bgp * soft",
6653 CLEAR_STR
6654 BGP_STR
6655 "Clear all peers\n"
6656 "Soft reconfig\n")
6657{
6658 if (argc == 1)
6659 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
6660 BGP_CLEAR_SOFT_BOTH, argv[0]);
6661
6662 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
6663 BGP_CLEAR_SOFT_BOTH, argv[0]);
6664}
6665
6666ALIAS (clear_bgp_all_soft,
6667 clear_bgp_instance_all_soft_cmd,
6668 "clear bgp view WORD * soft",
6669 CLEAR_STR
6670 BGP_STR
6671 "BGP view\n"
6672 "view name\n"
6673 "Clear all peers\n"
6674 "Soft reconfig\n")
6675
6676ALIAS (clear_bgp_all_soft,
6677 clear_bgp_ipv6_all_soft_cmd,
6678 "clear bgp ipv6 * soft",
6679 CLEAR_STR
6680 BGP_STR
6681 "Address family\n"
6682 "Clear all peers\n"
6683 "Soft reconfig\n")
6684
6685DEFUN (clear_ip_bgp_peer_soft,
6686 clear_ip_bgp_peer_soft_cmd,
6687 "clear ip bgp A.B.C.D soft",
6688 CLEAR_STR
6689 IP_STR
6690 BGP_STR
6691 "BGP neighbor address to clear\n"
6692 "Soft reconfig\n")
6693{
6694 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6695 BGP_CLEAR_SOFT_BOTH, argv[0]);
6696}
6697
6698DEFUN (clear_ip_bgp_peer_ipv4_soft,
6699 clear_ip_bgp_peer_ipv4_soft_cmd,
6700 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft",
6701 CLEAR_STR
6702 IP_STR
6703 BGP_STR
6704 "BGP neighbor address to clear\n"
6705 "Address family\n"
6706 "Address Family Modifier\n"
6707 "Address Family Modifier\n"
6708 "Soft reconfig\n")
6709{
6710 if (strncmp (argv[1], "m", 1) == 0)
6711 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
6712 BGP_CLEAR_SOFT_BOTH, argv[0]);
6713
6714 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6715 BGP_CLEAR_SOFT_BOTH, argv[0]);
6716}
6717
6718DEFUN (clear_ip_bgp_peer_vpnv4_soft,
6719 clear_ip_bgp_peer_vpnv4_soft_cmd,
6720 "clear ip bgp A.B.C.D vpnv4 unicast soft",
6721 CLEAR_STR
6722 IP_STR
6723 BGP_STR
6724 "BGP neighbor address to clear\n"
6725 "Address family\n"
6726 "Address Family Modifier\n"
6727 "Soft reconfig\n")
6728{
6729 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
6730 BGP_CLEAR_SOFT_BOTH, argv[0]);
6731}
6732
Lou Berger298cc2f2016-01-12 13:42:02 -05006733DEFUN (clear_ip_bgp_peer_encap_soft,
6734 clear_ip_bgp_peer_encap_soft_cmd,
6735 "clear ip bgp A.B.C.D encap unicast soft",
6736 CLEAR_STR
6737 IP_STR
6738 BGP_STR
6739 "BGP neighbor address to clear\n"
6740 "Address family\n"
6741 "Address Family Modifier\n"
6742 "Soft reconfig\n")
6743{
6744 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_peer,
6745 BGP_CLEAR_SOFT_BOTH, argv[0]);
6746}
6747
paul718e3742002-12-13 20:15:29 +00006748DEFUN (clear_bgp_peer_soft,
6749 clear_bgp_peer_soft_cmd,
6750 "clear bgp (A.B.C.D|X:X::X:X) soft",
6751 CLEAR_STR
6752 BGP_STR
6753 "BGP neighbor address to clear\n"
6754 "BGP IPv6 neighbor to clear\n"
6755 "Soft reconfig\n")
6756{
6757 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
6758 BGP_CLEAR_SOFT_BOTH, argv[0]);
6759}
6760
6761ALIAS (clear_bgp_peer_soft,
6762 clear_bgp_ipv6_peer_soft_cmd,
6763 "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft",
6764 CLEAR_STR
6765 BGP_STR
6766 "Address family\n"
6767 "BGP neighbor address to clear\n"
6768 "BGP IPv6 neighbor to clear\n"
6769 "Soft reconfig\n")
6770
6771DEFUN (clear_ip_bgp_peer_group_soft,
6772 clear_ip_bgp_peer_group_soft_cmd,
6773 "clear ip bgp peer-group WORD soft",
6774 CLEAR_STR
6775 IP_STR
6776 BGP_STR
6777 "Clear all members of peer-group\n"
6778 "BGP peer-group name\n"
6779 "Soft reconfig\n")
6780{
6781 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6782 BGP_CLEAR_SOFT_BOTH, argv[0]);
6783}
6784
6785DEFUN (clear_ip_bgp_peer_group_ipv4_soft,
6786 clear_ip_bgp_peer_group_ipv4_soft_cmd,
6787 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft",
6788 CLEAR_STR
6789 IP_STR
6790 BGP_STR
6791 "Clear all members of peer-group\n"
6792 "BGP peer-group name\n"
6793 "Address family\n"
6794 "Address Family modifier\n"
6795 "Address Family modifier\n"
6796 "Soft reconfig\n")
6797{
6798 if (strncmp (argv[1], "m", 1) == 0)
6799 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
6800 BGP_CLEAR_SOFT_BOTH, argv[0]);
6801
6802 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6803 BGP_CLEAR_SOFT_BOTH, argv[0]);
6804}
6805
6806DEFUN (clear_bgp_peer_group_soft,
6807 clear_bgp_peer_group_soft_cmd,
6808 "clear bgp peer-group WORD soft",
6809 CLEAR_STR
6810 BGP_STR
6811 "Clear all members of peer-group\n"
6812 "BGP peer-group name\n"
6813 "Soft reconfig\n")
6814{
6815 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
6816 BGP_CLEAR_SOFT_BOTH, argv[0]);
6817}
6818
6819ALIAS (clear_bgp_peer_group_soft,
6820 clear_bgp_ipv6_peer_group_soft_cmd,
6821 "clear bgp ipv6 peer-group WORD soft",
6822 CLEAR_STR
6823 BGP_STR
6824 "Address family\n"
6825 "Clear all members of peer-group\n"
6826 "BGP peer-group name\n"
6827 "Soft reconfig\n")
6828
6829DEFUN (clear_ip_bgp_external_soft,
6830 clear_ip_bgp_external_soft_cmd,
6831 "clear ip bgp external soft",
6832 CLEAR_STR
6833 IP_STR
6834 BGP_STR
6835 "Clear all external peers\n"
6836 "Soft reconfig\n")
6837{
6838 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6839 BGP_CLEAR_SOFT_BOTH, NULL);
6840}
6841
6842DEFUN (clear_ip_bgp_external_ipv4_soft,
6843 clear_ip_bgp_external_ipv4_soft_cmd,
6844 "clear ip bgp external ipv4 (unicast|multicast) soft",
6845 CLEAR_STR
6846 IP_STR
6847 BGP_STR
6848 "Clear all external peers\n"
6849 "Address family\n"
6850 "Address Family modifier\n"
6851 "Address Family modifier\n"
6852 "Soft reconfig\n")
6853{
6854 if (strncmp (argv[0], "m", 1) == 0)
6855 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
6856 BGP_CLEAR_SOFT_BOTH, NULL);
6857
6858 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6859 BGP_CLEAR_SOFT_BOTH, NULL);
6860}
6861
6862DEFUN (clear_bgp_external_soft,
6863 clear_bgp_external_soft_cmd,
6864 "clear bgp external soft",
6865 CLEAR_STR
6866 BGP_STR
6867 "Clear all external peers\n"
6868 "Soft reconfig\n")
6869{
6870 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
6871 BGP_CLEAR_SOFT_BOTH, NULL);
6872}
6873
6874ALIAS (clear_bgp_external_soft,
6875 clear_bgp_ipv6_external_soft_cmd,
6876 "clear bgp ipv6 external soft",
6877 CLEAR_STR
6878 BGP_STR
6879 "Address family\n"
6880 "Clear all external peers\n"
6881 "Soft reconfig\n")
6882
6883DEFUN (clear_ip_bgp_as_soft,
6884 clear_ip_bgp_as_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006885 "clear ip bgp " CMD_AS_RANGE " soft",
paul718e3742002-12-13 20:15:29 +00006886 CLEAR_STR
6887 IP_STR
6888 BGP_STR
6889 "Clear peers with the AS number\n"
6890 "Soft reconfig\n")
6891{
6892 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6893 BGP_CLEAR_SOFT_BOTH, argv[0]);
6894}
6895
6896DEFUN (clear_ip_bgp_as_ipv4_soft,
6897 clear_ip_bgp_as_ipv4_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006898 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft",
paul718e3742002-12-13 20:15:29 +00006899 CLEAR_STR
6900 IP_STR
6901 BGP_STR
6902 "Clear peers with the AS number\n"
6903 "Address family\n"
6904 "Address Family Modifier\n"
6905 "Address Family Modifier\n"
6906 "Soft reconfig\n")
6907{
6908 if (strncmp (argv[1], "m", 1) == 0)
6909 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
6910 BGP_CLEAR_SOFT_BOTH, argv[0]);
6911
6912 return bgp_clear_vty (vty, NULL,AFI_IP, SAFI_UNICAST, clear_as,
6913 BGP_CLEAR_SOFT_BOTH, argv[0]);
6914}
6915
6916DEFUN (clear_ip_bgp_as_vpnv4_soft,
6917 clear_ip_bgp_as_vpnv4_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006918 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft",
paul718e3742002-12-13 20:15:29 +00006919 CLEAR_STR
6920 IP_STR
6921 BGP_STR
6922 "Clear peers with the AS number\n"
6923 "Address family\n"
6924 "Address Family Modifier\n"
6925 "Soft reconfig\n")
6926{
6927 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
6928 BGP_CLEAR_SOFT_BOTH, argv[0]);
6929}
6930
Lou Berger298cc2f2016-01-12 13:42:02 -05006931DEFUN (clear_ip_bgp_as_encap_soft,
6932 clear_ip_bgp_as_encap_soft_cmd,
6933 "clear ip bgp " CMD_AS_RANGE " encap unicast soft",
6934 CLEAR_STR
6935 IP_STR
6936 BGP_STR
6937 "Clear peers with the AS number\n"
6938 "Address family\n"
6939 "Address Family Modifier\n"
6940 "Soft reconfig\n")
6941{
6942 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_as,
6943 BGP_CLEAR_SOFT_BOTH, argv[0]);
6944}
6945
paul718e3742002-12-13 20:15:29 +00006946DEFUN (clear_bgp_as_soft,
6947 clear_bgp_as_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006948 "clear bgp " CMD_AS_RANGE " soft",
paul718e3742002-12-13 20:15:29 +00006949 CLEAR_STR
6950 BGP_STR
6951 "Clear peers with the AS number\n"
6952 "Soft reconfig\n")
6953{
6954 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
6955 BGP_CLEAR_SOFT_BOTH, argv[0]);
6956}
6957
6958ALIAS (clear_bgp_as_soft,
6959 clear_bgp_ipv6_as_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006960 "clear bgp ipv6 " CMD_AS_RANGE " soft",
paul718e3742002-12-13 20:15:29 +00006961 CLEAR_STR
6962 BGP_STR
6963 "Address family\n"
6964 "Clear peers with the AS number\n"
6965 "Soft reconfig\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02006966
paulfee0f4c2004-09-13 05:12:46 +00006967/* RS-client soft reconfiguration. */
paulfee0f4c2004-09-13 05:12:46 +00006968DEFUN (clear_bgp_all_rsclient,
6969 clear_bgp_all_rsclient_cmd,
6970 "clear bgp * rsclient",
6971 CLEAR_STR
6972 BGP_STR
6973 "Clear all peers\n"
6974 "Soft reconfig for rsclient RIB\n")
6975{
6976 if (argc == 1)
6977 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
6978 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6979
6980 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
6981 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6982}
6983
6984ALIAS (clear_bgp_all_rsclient,
6985 clear_bgp_ipv6_all_rsclient_cmd,
6986 "clear bgp ipv6 * rsclient",
6987 CLEAR_STR
6988 BGP_STR
6989 "Address family\n"
6990 "Clear all peers\n"
6991 "Soft reconfig for rsclient RIB\n")
6992
6993ALIAS (clear_bgp_all_rsclient,
6994 clear_bgp_instance_all_rsclient_cmd,
6995 "clear bgp view WORD * rsclient",
6996 CLEAR_STR
6997 BGP_STR
6998 "BGP view\n"
6999 "view name\n"
7000 "Clear all peers\n"
7001 "Soft reconfig for rsclient RIB\n")
7002
7003ALIAS (clear_bgp_all_rsclient,
7004 clear_bgp_ipv6_instance_all_rsclient_cmd,
7005 "clear bgp ipv6 view WORD * rsclient",
7006 CLEAR_STR
7007 BGP_STR
7008 "Address family\n"
7009 "BGP view\n"
7010 "view name\n"
7011 "Clear all peers\n"
7012 "Soft reconfig for rsclient RIB\n")
paulfee0f4c2004-09-13 05:12:46 +00007013
7014DEFUN (clear_ip_bgp_all_rsclient,
7015 clear_ip_bgp_all_rsclient_cmd,
7016 "clear ip bgp * rsclient",
7017 CLEAR_STR
7018 IP_STR
7019 BGP_STR
7020 "Clear all peers\n"
7021 "Soft reconfig for rsclient RIB\n")
7022{
7023 if (argc == 1)
7024 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
7025 BGP_CLEAR_SOFT_RSCLIENT, NULL);
7026
7027 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
7028 BGP_CLEAR_SOFT_RSCLIENT, NULL);
7029}
7030
7031ALIAS (clear_ip_bgp_all_rsclient,
7032 clear_ip_bgp_instance_all_rsclient_cmd,
7033 "clear ip bgp view WORD * rsclient",
7034 CLEAR_STR
7035 IP_STR
7036 BGP_STR
7037 "BGP view\n"
7038 "view name\n"
7039 "Clear all peers\n"
7040 "Soft reconfig for rsclient RIB\n")
7041
paulfee0f4c2004-09-13 05:12:46 +00007042DEFUN (clear_bgp_peer_rsclient,
7043 clear_bgp_peer_rsclient_cmd,
7044 "clear bgp (A.B.C.D|X:X::X:X) rsclient",
7045 CLEAR_STR
7046 BGP_STR
7047 "BGP neighbor IP address to clear\n"
7048 "BGP IPv6 neighbor to clear\n"
7049 "Soft reconfig for rsclient RIB\n")
7050{
7051 if (argc == 2)
7052 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_peer,
7053 BGP_CLEAR_SOFT_RSCLIENT, argv[1]);
7054
7055 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
7056 BGP_CLEAR_SOFT_RSCLIENT, argv[0]);
7057}
7058
7059ALIAS (clear_bgp_peer_rsclient,
7060 clear_bgp_ipv6_peer_rsclient_cmd,
7061 "clear bgp ipv6 (A.B.C.D|X:X::X:X) rsclient",
7062 CLEAR_STR
7063 BGP_STR
7064 "Address family\n"
7065 "BGP neighbor IP address to clear\n"
7066 "BGP IPv6 neighbor to clear\n"
7067 "Soft reconfig for rsclient RIB\n")
7068
7069ALIAS (clear_bgp_peer_rsclient,
7070 clear_bgp_instance_peer_rsclient_cmd,
7071 "clear bgp view WORD (A.B.C.D|X:X::X:X) rsclient",
7072 CLEAR_STR
7073 BGP_STR
7074 "BGP view\n"
7075 "view name\n"
7076 "BGP neighbor IP address to clear\n"
7077 "BGP IPv6 neighbor to clear\n"
7078 "Soft reconfig for rsclient RIB\n")
7079
7080ALIAS (clear_bgp_peer_rsclient,
7081 clear_bgp_ipv6_instance_peer_rsclient_cmd,
7082 "clear bgp ipv6 view WORD (A.B.C.D|X:X::X:X) rsclient",
7083 CLEAR_STR
7084 BGP_STR
7085 "Address family\n"
7086 "BGP view\n"
7087 "view name\n"
7088 "BGP neighbor IP address to clear\n"
7089 "BGP IPv6 neighbor to clear\n"
7090 "Soft reconfig for rsclient RIB\n")
paulfee0f4c2004-09-13 05:12:46 +00007091
7092DEFUN (clear_ip_bgp_peer_rsclient,
7093 clear_ip_bgp_peer_rsclient_cmd,
7094 "clear ip bgp (A.B.C.D|X:X::X:X) rsclient",
7095 CLEAR_STR
7096 IP_STR
7097 BGP_STR
7098 "BGP neighbor IP address to clear\n"
7099 "BGP IPv6 neighbor to clear\n"
7100 "Soft reconfig for rsclient RIB\n")
7101{
7102 if (argc == 2)
7103 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_peer,
7104 BGP_CLEAR_SOFT_RSCLIENT, argv[1]);
7105
7106 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
7107 BGP_CLEAR_SOFT_RSCLIENT, argv[0]);
7108}
7109
7110ALIAS (clear_ip_bgp_peer_rsclient,
7111 clear_ip_bgp_instance_peer_rsclient_cmd,
7112 "clear ip bgp view WORD (A.B.C.D|X:X::X:X) rsclient",
7113 CLEAR_STR
7114 IP_STR
7115 BGP_STR
7116 "BGP view\n"
7117 "view name\n"
7118 "BGP neighbor IP address to clear\n"
7119 "BGP IPv6 neighbor to clear\n"
7120 "Soft reconfig for rsclient RIB\n")
7121
Michael Lamberte0081f72008-11-16 20:12:04 +00007122DEFUN (show_bgp_views,
7123 show_bgp_views_cmd,
7124 "show bgp views",
7125 SHOW_STR
7126 BGP_STR
7127 "Show the defined BGP views\n")
7128{
7129 struct list *inst = bm->bgp;
7130 struct listnode *node;
7131 struct bgp *bgp;
7132
7133 if (!bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE))
7134 {
7135 vty_out (vty, "Multiple BGP views are not defined%s", VTY_NEWLINE);
7136 return CMD_WARNING;
7137 }
7138
7139 vty_out (vty, "Defined BGP views:%s", VTY_NEWLINE);
7140 for (ALL_LIST_ELEMENTS_RO(inst, node, bgp))
7141 vty_out (vty, "\t%s (AS%u)%s",
7142 bgp->name ? bgp->name : "(null)",
7143 bgp->as, VTY_NEWLINE);
7144
7145 return CMD_SUCCESS;
7146}
7147
Paul Jakma4bf6a362006-03-30 14:05:23 +00007148DEFUN (show_bgp_memory,
7149 show_bgp_memory_cmd,
7150 "show bgp memory",
7151 SHOW_STR
7152 BGP_STR
7153 "Global BGP memory statistics\n")
7154{
7155 char memstrbuf[MTYPE_MEMSTR_LEN];
7156 unsigned long count;
7157
7158 /* RIB related usage stats */
7159 count = mtype_stats_alloc (MTYPE_BGP_NODE);
7160 vty_out (vty, "%ld RIB nodes, using %s of memory%s", count,
7161 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7162 count * sizeof (struct bgp_node)),
7163 VTY_NEWLINE);
7164
7165 count = mtype_stats_alloc (MTYPE_BGP_ROUTE);
7166 vty_out (vty, "%ld BGP routes, using %s of memory%s", count,
7167 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7168 count * sizeof (struct bgp_info)),
7169 VTY_NEWLINE);
Paul Jakmafb982c22007-05-04 20:15:47 +00007170 if ((count = mtype_stats_alloc (MTYPE_BGP_ROUTE_EXTRA)))
7171 vty_out (vty, "%ld BGP route ancillaries, using %s of memory%s", count,
7172 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7173 count * sizeof (struct bgp_info_extra)),
7174 VTY_NEWLINE);
Paul Jakma4bf6a362006-03-30 14:05:23 +00007175
7176 if ((count = mtype_stats_alloc (MTYPE_BGP_STATIC)))
7177 vty_out (vty, "%ld Static routes, using %s of memory%s", count,
7178 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7179 count * sizeof (struct bgp_static)),
7180 VTY_NEWLINE);
7181
7182 /* Adj-In/Out */
7183 if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_IN)))
7184 vty_out (vty, "%ld Adj-In entries, using %s of memory%s", count,
7185 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7186 count * sizeof (struct bgp_adj_in)),
7187 VTY_NEWLINE);
7188 if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_OUT)))
7189 vty_out (vty, "%ld Adj-Out entries, using %s of memory%s", count,
7190 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7191 count * sizeof (struct bgp_adj_out)),
7192 VTY_NEWLINE);
7193
7194 if ((count = mtype_stats_alloc (MTYPE_BGP_NEXTHOP_CACHE)))
7195 vty_out (vty, "%ld Nexthop cache entries, using %s of memory%s", count,
7196 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7197 count * sizeof (struct bgp_nexthop_cache)),
7198 VTY_NEWLINE);
7199
7200 if ((count = mtype_stats_alloc (MTYPE_BGP_DAMP_INFO)))
7201 vty_out (vty, "%ld Dampening entries, using %s of memory%s", count,
7202 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7203 count * sizeof (struct bgp_damp_info)),
7204 VTY_NEWLINE);
7205
7206 /* Attributes */
7207 count = attr_count();
7208 vty_out (vty, "%ld BGP attributes, using %s of memory%s", count,
7209 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7210 count * sizeof(struct attr)),
7211 VTY_NEWLINE);
Paul Jakmafb982c22007-05-04 20:15:47 +00007212 if ((count = mtype_stats_alloc (MTYPE_ATTR_EXTRA)))
7213 vty_out (vty, "%ld BGP extra attributes, using %s of memory%s", count,
7214 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7215 count * sizeof(struct attr_extra)),
7216 VTY_NEWLINE);
Paul Jakma4bf6a362006-03-30 14:05:23 +00007217
7218 if ((count = attr_unknown_count()))
7219 vty_out (vty, "%ld unknown attributes%s", count, VTY_NEWLINE);
7220
7221 /* AS_PATH attributes */
7222 count = aspath_count ();
7223 vty_out (vty, "%ld BGP AS-PATH entries, using %s of memory%s", count,
7224 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7225 count * sizeof (struct aspath)),
7226 VTY_NEWLINE);
7227
7228 count = mtype_stats_alloc (MTYPE_AS_SEG);
7229 vty_out (vty, "%ld BGP AS-PATH segments, using %s of memory%s", count,
7230 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7231 count * sizeof (struct assegment)),
7232 VTY_NEWLINE);
7233
7234 /* Other attributes */
7235 if ((count = community_count ()))
7236 vty_out (vty, "%ld BGP community entries, using %s of memory%s", count,
7237 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7238 count * sizeof (struct community)),
7239 VTY_NEWLINE);
7240 if ((count = mtype_stats_alloc (MTYPE_ECOMMUNITY)))
7241 vty_out (vty, "%ld BGP community entries, using %s of memory%s", count,
7242 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7243 count * sizeof (struct ecommunity)),
7244 VTY_NEWLINE);
7245
7246 if ((count = mtype_stats_alloc (MTYPE_CLUSTER)))
7247 vty_out (vty, "%ld Cluster lists, using %s of memory%s", count,
7248 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7249 count * sizeof (struct cluster_list)),
7250 VTY_NEWLINE);
7251
7252 /* Peer related usage */
7253 count = mtype_stats_alloc (MTYPE_BGP_PEER);
7254 vty_out (vty, "%ld peers, using %s of memory%s", count,
7255 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7256 count * sizeof (struct peer)),
7257 VTY_NEWLINE);
7258
7259 if ((count = mtype_stats_alloc (MTYPE_PEER_GROUP)))
7260 vty_out (vty, "%ld peer groups, using %s of memory%s", count,
7261 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7262 count * sizeof (struct peer_group)),
7263 VTY_NEWLINE);
7264
7265 /* Other */
7266 if ((count = mtype_stats_alloc (MTYPE_HASH)))
7267 vty_out (vty, "%ld hash tables, using %s of memory%s", count,
7268 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7269 count * sizeof (struct hash)),
7270 VTY_NEWLINE);
7271 if ((count = mtype_stats_alloc (MTYPE_HASH_BACKET)))
7272 vty_out (vty, "%ld hash buckets, using %s of memory%s", count,
7273 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7274 count * sizeof (struct hash_backet)),
7275 VTY_NEWLINE);
7276 if ((count = mtype_stats_alloc (MTYPE_BGP_REGEXP)))
7277 vty_out (vty, "%ld compiled regexes, using %s of memory%s", count,
7278 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7279 count * sizeof (regex_t)),
7280 VTY_NEWLINE);
7281 return CMD_SUCCESS;
7282}
paulfee0f4c2004-09-13 05:12:46 +00007283
paul718e3742002-12-13 20:15:29 +00007284/* Show BGP peer's summary information. */
paul94f2b392005-06-28 12:44:16 +00007285static int
paul718e3742002-12-13 20:15:29 +00007286bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi)
7287{
7288 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00007289 struct listnode *node, *nnode;
Paul Jakma4bf6a362006-03-30 14:05:23 +00007290 unsigned int count = 0;
paul718e3742002-12-13 20:15:29 +00007291 char timebuf[BGP_UPTIME_LEN];
7292 int len;
7293
7294 /* Header string for each address family. */
Milan Kociancb4fc592014-12-01 12:48:25 +00007295 static char header[] = "Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd";
Paul Jakma4bf6a362006-03-30 14:05:23 +00007296
paul1eb8ef22005-04-07 07:30:20 +00007297 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00007298 {
7299 if (peer->afc[afi][safi])
7300 {
Paul Jakma4bf6a362006-03-30 14:05:23 +00007301 if (!count)
7302 {
7303 unsigned long ents;
7304 char memstrbuf[MTYPE_MEMSTR_LEN];
7305
7306 /* Usage summary and header */
7307 vty_out (vty,
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04007308 "BGP router identifier %s, local AS number %u%s",
Paul Jakma4bf6a362006-03-30 14:05:23 +00007309 inet_ntoa (bgp->router_id), bgp->as, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007310
Paul Jakma4bf6a362006-03-30 14:05:23 +00007311 ents = bgp_table_count (bgp->rib[afi][safi]);
7312 vty_out (vty, "RIB entries %ld, using %s of memory%s", ents,
7313 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7314 ents * sizeof (struct bgp_node)),
7315 VTY_NEWLINE);
7316
7317 /* Peer related usage */
7318 ents = listcount (bgp->peer);
7319 vty_out (vty, "Peers %ld, using %s of memory%s",
7320 ents,
7321 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7322 ents * sizeof (struct peer)),
7323 VTY_NEWLINE);
7324
7325 if ((ents = listcount (bgp->rsclient)))
7326 vty_out (vty, "RS-Client peers %ld, using %s of memory%s",
7327 ents,
7328 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7329 ents * sizeof (struct peer)),
7330 VTY_NEWLINE);
7331
7332 if ((ents = listcount (bgp->group)))
7333 vty_out (vty, "Peer groups %ld, using %s of memory%s", ents,
7334 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7335 ents * sizeof (struct peer_group)),
7336 VTY_NEWLINE);
7337
7338 if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING))
7339 vty_out (vty, "Dampening enabled.%s", VTY_NEWLINE);
7340 vty_out (vty, "%s", VTY_NEWLINE);
7341 vty_out (vty, "%s%s", header, VTY_NEWLINE);
7342 }
7343
paul718e3742002-12-13 20:15:29 +00007344 count++;
7345
7346 len = vty_out (vty, "%s", peer->host);
7347 len = 16 - len;
7348 if (len < 1)
7349 vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " ");
7350 else
7351 vty_out (vty, "%*s", len, " ");
7352
hasso3d515fd2005-02-01 21:30:04 +00007353 vty_out (vty, "4 ");
paul718e3742002-12-13 20:15:29 +00007354
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04007355 vty_out (vty, "%5u %7d %7d %8d %4d %4lu ",
paul718e3742002-12-13 20:15:29 +00007356 peer->as,
7357 peer->open_in + peer->update_in + peer->keepalive_in
7358 + peer->notify_in + peer->refresh_in + peer->dynamic_cap_in,
7359 peer->open_out + peer->update_out + peer->keepalive_out
7360 + peer->notify_out + peer->refresh_out
7361 + peer->dynamic_cap_out,
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00007362 0, 0, (unsigned long) peer->obuf->count);
paul718e3742002-12-13 20:15:29 +00007363
7364 vty_out (vty, "%8s",
7365 peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN));
7366
7367 if (peer->status == Established)
7368 {
7369 vty_out (vty, " %8ld", peer->pcount[afi][safi]);
7370 }
7371 else
7372 {
7373 if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN))
7374 vty_out (vty, " Idle (Admin)");
7375 else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW))
7376 vty_out (vty, " Idle (PfxCt)");
7377 else
7378 vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, peer->status));
7379 }
7380
7381 vty_out (vty, "%s", VTY_NEWLINE);
7382 }
7383 }
7384
7385 if (count)
7386 vty_out (vty, "%sTotal number of neighbors %d%s", VTY_NEWLINE,
7387 count, VTY_NEWLINE);
7388 else
7389 vty_out (vty, "No %s neighbor is configured%s",
7390 afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE);
7391 return CMD_SUCCESS;
7392}
7393
paul94f2b392005-06-28 12:44:16 +00007394static int
paulfd79ac92004-10-13 05:06:08 +00007395bgp_show_summary_vty (struct vty *vty, const char *name,
7396 afi_t afi, safi_t safi)
paul718e3742002-12-13 20:15:29 +00007397{
7398 struct bgp *bgp;
7399
7400 if (name)
7401 {
7402 bgp = bgp_lookup_by_name (name);
7403
7404 if (! bgp)
7405 {
7406 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
7407 return CMD_WARNING;
7408 }
7409
7410 bgp_show_summary (vty, bgp, afi, safi);
7411 return CMD_SUCCESS;
7412 }
7413
7414 bgp = bgp_get_default ();
7415
7416 if (bgp)
7417 bgp_show_summary (vty, bgp, afi, safi);
7418
7419 return CMD_SUCCESS;
7420}
7421
7422/* `show ip bgp summary' commands. */
Lou Bergerf9b6c392016-01-12 13:42:09 -05007423DEFUN (show_ip_bgp_summary,
7424 show_ip_bgp_summary_cmd,
7425 "show ip bgp summary",
7426 SHOW_STR
7427 IP_STR
7428 BGP_STR
7429 "Summary of BGP neighbor status\n")
7430{
7431 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
7432}
7433
7434DEFUN (show_ip_bgp_instance_summary,
7435 show_ip_bgp_instance_summary_cmd,
7436 "show ip bgp view WORD summary",
7437 SHOW_STR
7438 IP_STR
7439 BGP_STR
7440 "BGP view\n"
7441 "View name\n"
7442 "Summary of BGP neighbor status\n")
7443{
7444 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
7445}
7446
7447DEFUN (show_ip_bgp_ipv4_summary,
7448 show_ip_bgp_ipv4_summary_cmd,
7449 "show ip bgp ipv4 (unicast|multicast) summary",
7450 SHOW_STR
7451 IP_STR
7452 BGP_STR
7453 "Address family\n"
7454 "Address Family modifier\n"
7455 "Address Family modifier\n"
7456 "Summary of BGP neighbor status\n")
7457{
7458 if (strncmp (argv[0], "m", 1) == 0)
7459 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
7460
7461 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
7462}
7463
7464DEFUN (show_ip_bgp_instance_ipv4_summary,
7465 show_ip_bgp_instance_ipv4_summary_cmd,
7466 "show ip bgp view WORD ipv4 (unicast|multicast) summary",
7467 SHOW_STR
7468 IP_STR
7469 BGP_STR
7470 "BGP view\n"
7471 "View name\n"
7472 "Address family\n"
7473 "Address Family modifier\n"
7474 "Address Family modifier\n"
7475 "Summary of BGP neighbor status\n")
7476{
7477 if (strncmp (argv[1], "m", 1) == 0)
7478 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
7479 else
7480 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
7481}
7482
7483DEFUN (show_ip_bgp_vpnv4_all_summary,
7484 show_ip_bgp_vpnv4_all_summary_cmd,
7485 "show ip bgp vpnv4 all summary",
7486 SHOW_STR
7487 IP_STR
7488 BGP_STR
7489 "Display VPNv4 NLRI specific information\n"
7490 "Display information about all VPNv4 NLRIs\n"
7491 "Summary of BGP neighbor status\n")
7492{
7493 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
7494}
7495
7496DEFUN (show_ip_bgp_vpnv4_rd_summary,
7497 show_ip_bgp_vpnv4_rd_summary_cmd,
7498 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn summary",
7499 SHOW_STR
7500 IP_STR
7501 BGP_STR
7502 "Display VPNv4 NLRI specific information\n"
7503 "Display information for a route distinguisher\n"
7504 "VPN Route Distinguisher\n"
7505 "Summary of BGP neighbor status\n")
7506{
7507 int ret;
7508 struct prefix_rd prd;
7509
7510 ret = str2prefix_rd (argv[0], &prd);
7511 if (! ret)
7512 {
7513 vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
7514 return CMD_WARNING;
7515 }
7516
7517 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
7518}
7519
Lou Berger651b4022016-01-12 13:42:07 -05007520DEFUN (show_bgp_ipv4_safi_summary,
7521 show_bgp_ipv4_safi_summary_cmd,
7522 "show bgp ipv4 (unicast|multicast) summary",
paul718e3742002-12-13 20:15:29 +00007523 SHOW_STR
paul718e3742002-12-13 20:15:29 +00007524 BGP_STR
7525 "Address family\n"
7526 "Address Family modifier\n"
7527 "Address Family modifier\n"
7528 "Summary of BGP neighbor status\n")
7529{
7530 if (strncmp (argv[0], "m", 1) == 0)
7531 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
7532
7533 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
7534}
7535
Lou Berger651b4022016-01-12 13:42:07 -05007536DEFUN (show_bgp_instance_ipv4_safi_summary,
7537 show_bgp_instance_ipv4_safi_summary_cmd,
7538 "show bgp view WORD ipv4 (unicast|multicast) summary",
Michael Lambert95cbbd22010-07-23 14:43:04 -04007539 SHOW_STR
7540 BGP_STR
paul718e3742002-12-13 20:15:29 +00007541 "BGP view\n"
7542 "View name\n"
7543 "Address family\n"
7544 "Address Family modifier\n"
7545 "Address Family modifier\n"
7546 "Summary of BGP neighbor status\n")
7547{
7548 if (strncmp (argv[1], "m", 1) == 0)
7549 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
7550 else
7551 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
7552}
7553
Lou Berger651b4022016-01-12 13:42:07 -05007554DEFUN (show_bgp_ipv4_vpn_summary,
7555 show_bgp_ipv4_vpn_summary_cmd,
7556 "show bgp ipv4 vpn summary",
Michael Lambert95cbbd22010-07-23 14:43:04 -04007557 SHOW_STR
7558 BGP_STR
Lou Berger651b4022016-01-12 13:42:07 -05007559 "IPv4\n"
7560 "Display VPN NLRI specific information\n"
paul718e3742002-12-13 20:15:29 +00007561 "Summary of BGP neighbor status\n")
7562{
7563 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
7564}
7565
Lou Berger651b4022016-01-12 13:42:07 -05007566/* `show ip bgp summary' commands. */
7567DEFUN (show_bgp_ipv6_vpn_summary,
7568 show_bgp_ipv6_vpn_summary_cmd,
7569 "show bgp ipv6 vpn summary",
paul718e3742002-12-13 20:15:29 +00007570 SHOW_STR
7571 BGP_STR
Lou Berger651b4022016-01-12 13:42:07 -05007572 "IPv6\n"
7573 "Display VPN NLRI specific information\n"
paul718e3742002-12-13 20:15:29 +00007574 "Summary of BGP neighbor status\n")
7575{
Lou Berger651b4022016-01-12 13:42:07 -05007576 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MPLS_VPN);
paul718e3742002-12-13 20:15:29 +00007577}
Lou Berger651b4022016-01-12 13:42:07 -05007578
7579DEFUN (show_bgp_ipv4_encap_summary,
7580 show_bgp_ipv4_encap_summary_cmd,
7581 "show bgp ipv4 encap summary",
7582 SHOW_STR
7583 BGP_STR
7584 "IPv4\n"
7585 "Display ENCAP NLRI specific information\n"
7586 "Summary of BGP neighbor status\n")
7587{
7588 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_ENCAP);
7589}
7590
Lou Berger651b4022016-01-12 13:42:07 -05007591DEFUN (show_bgp_ipv6_encap_summary,
7592 show_bgp_ipv6_encap_summary_cmd,
7593 "show bgp ipv6 encap summary",
7594 SHOW_STR
7595 BGP_STR
7596 "IPv6\n"
7597 "Display ENCAP NLRI specific information\n"
7598 "Summary of BGP neighbor status\n")
7599{
7600 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_ENCAP);
7601}
7602
paul718e3742002-12-13 20:15:29 +00007603DEFUN (show_bgp_instance_summary,
7604 show_bgp_instance_summary_cmd,
7605 "show bgp view WORD summary",
7606 SHOW_STR
7607 BGP_STR
7608 "BGP view\n"
7609 "View name\n"
7610 "Summary of BGP neighbor status\n")
7611{
Lou Berger651b4022016-01-12 13:42:07 -05007612 vty_out(vty, "%sIPv4 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7613 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7614 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
7615 vty_out(vty, "%sIPv4 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7616 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7617 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
7618 vty_out(vty, "%sIPv4 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7619 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7620 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MPLS_VPN);
7621 vty_out(vty, "%sIPv4 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7622 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7623 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_ENCAP);
7624
Lou Berger651b4022016-01-12 13:42:07 -05007625 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7626 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7627 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
7628 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7629 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7630 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST);
7631 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7632 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7633 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MPLS_VPN);
7634 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7635 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7636 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_ENCAP);
Lou Berger205e6742016-01-12 13:42:11 -05007637
Lou Berger651b4022016-01-12 13:42:07 -05007638 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00007639}
7640
Lou Berger651b4022016-01-12 13:42:07 -05007641DEFUN (show_bgp_instance_ipv4_summary,
7642 show_bgp_instance_ipv4_summary_cmd,
7643 "show bgp view WORD ipv4 summary",
paul718e3742002-12-13 20:15:29 +00007644 SHOW_STR
7645 BGP_STR
Lou Berger651b4022016-01-12 13:42:07 -05007646 IP_STR
7647 "Address Family modifier\n"
7648 "Address Family modifier\n"
7649 "BGP view\n"
7650 "View name\n"
paul718e3742002-12-13 20:15:29 +00007651 "Summary of BGP neighbor status\n")
Lou Berger651b4022016-01-12 13:42:07 -05007652{
7653 vty_out(vty, "%sIPv4 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7654 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7655 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
7656 vty_out(vty, "%sIPv4 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7657 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7658 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
7659 vty_out(vty, "%sIPv4 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7660 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7661 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MPLS_VPN);
7662 vty_out(vty, "%sIPv4 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7663 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7664 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_ENCAP);
paul718e3742002-12-13 20:15:29 +00007665
Lou Berger651b4022016-01-12 13:42:07 -05007666 return CMD_SUCCESS;
7667}
7668
Lou Berger651b4022016-01-12 13:42:07 -05007669DEFUN (show_bgp_instance_ipv6_summary,
paul718e3742002-12-13 20:15:29 +00007670 show_bgp_instance_ipv6_summary_cmd,
7671 "show bgp view WORD ipv6 summary",
7672 SHOW_STR
7673 BGP_STR
Lou Berger651b4022016-01-12 13:42:07 -05007674 IPV6_STR
7675 "Address Family modifier\n"
7676 "Address Family modifier\n"
paul718e3742002-12-13 20:15:29 +00007677 "BGP view\n"
7678 "View name\n"
paul718e3742002-12-13 20:15:29 +00007679 "Summary of BGP neighbor status\n")
Lou Berger651b4022016-01-12 13:42:07 -05007680{
7681 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7682 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7683 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
7684 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7685 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7686 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST);
7687 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7688 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7689 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MPLS_VPN);
7690 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7691 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7692 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_ENCAP);
7693
7694 return CMD_SUCCESS;
7695}
paul718e3742002-12-13 20:15:29 +00007696
Michael Lambert95cbbd22010-07-23 14:43:04 -04007697DEFUN (show_bgp_ipv6_safi_summary,
7698 show_bgp_ipv6_safi_summary_cmd,
7699 "show bgp ipv6 (unicast|multicast) summary",
7700 SHOW_STR
7701 BGP_STR
7702 "Address family\n"
7703 "Address Family modifier\n"
7704 "Address Family modifier\n"
7705 "Summary of BGP neighbor status\n")
7706{
7707 if (strncmp (argv[0], "m", 1) == 0)
7708 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
7709
7710 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
7711}
7712
7713DEFUN (show_bgp_instance_ipv6_safi_summary,
7714 show_bgp_instance_ipv6_safi_summary_cmd,
7715 "show bgp view WORD ipv6 (unicast|multicast) summary",
7716 SHOW_STR
7717 BGP_STR
7718 "BGP view\n"
7719 "View name\n"
7720 "Address family\n"
7721 "Address Family modifier\n"
7722 "Address Family modifier\n"
7723 "Summary of BGP neighbor status\n")
7724{
7725 if (strncmp (argv[1], "m", 1) == 0)
7726 return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST);
7727
7728 return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
7729}
7730
Lou Bergerf9b6c392016-01-12 13:42:09 -05007731/* old command */
7732DEFUN (show_ipv6_bgp_summary,
7733 show_ipv6_bgp_summary_cmd,
7734 "show ipv6 bgp summary",
7735 SHOW_STR
7736 IPV6_STR
7737 BGP_STR
7738 "Summary of BGP neighbor status\n")
7739{
7740 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
7741}
7742
7743/* old command */
7744DEFUN (show_ipv6_mbgp_summary,
7745 show_ipv6_mbgp_summary_cmd,
7746 "show ipv6 mbgp summary",
7747 SHOW_STR
7748 IPV6_STR
7749 MBGP_STR
7750 "Summary of BGP neighbor status\n")
7751{
7752 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
7753}
Lou Berger651b4022016-01-12 13:42:07 -05007754
7755/* variations of show bgp [...] summary */
7756
7757/* This one is for the 0-keyword variant */
7758DEFUN (show_bgp_summary,
7759 show_bgp_summary_cmd,
7760 "show bgp summary",
paul718e3742002-12-13 20:15:29 +00007761 SHOW_STR
paul718e3742002-12-13 20:15:29 +00007762 BGP_STR
7763 "Summary of BGP neighbor status\n")
7764{
Lou Berger651b4022016-01-12 13:42:07 -05007765 vty_out(vty, "%sIPv4 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7766 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7767 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
7768 vty_out(vty, "%sIPv4 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7769 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7770 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
7771 vty_out(vty, "%sIPv4 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7772 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7773 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
7774 vty_out(vty, "%sIPv4 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7775 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7776 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_ENCAP);
7777
Lou Berger651b4022016-01-12 13:42:07 -05007778 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7779 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7780 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
7781 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7782 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7783 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
7784 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7785 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7786 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MPLS_VPN);
7787 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7788 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7789 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_ENCAP);
Lou Berger205e6742016-01-12 13:42:11 -05007790
Lou Berger651b4022016-01-12 13:42:07 -05007791 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00007792}
7793
Lou Bergerf9b6c392016-01-12 13:42:09 -05007794ALIAS (show_bgp_summary,
7795 show_bgp_ipv6_summary_cmd,
7796 "show bgp ipv6 summary",
7797 SHOW_STR
7798 BGP_STR
7799 "Address family\n"
7800 "Summary of BGP neighbor status\n")
7801
Lou Berger651b4022016-01-12 13:42:07 -05007802DEFUN (show_bgp_summary_1w,
7803 show_bgp_summary_1w_cmd,
Lou Berger651b4022016-01-12 13:42:07 -05007804 "show bgp (ipv4|ipv6|unicast|multicast|vpn|encap) summary",
paul718e3742002-12-13 20:15:29 +00007805 SHOW_STR
Lou Berger651b4022016-01-12 13:42:07 -05007806 BGP_STR
7807 IP_STR
Lou Berger651b4022016-01-12 13:42:07 -05007808 IP6_STR
Lou Berger651b4022016-01-12 13:42:07 -05007809 "Address Family modifier\n"
7810 "Address Family modifier\n"
7811 "Address Family modifier\n"
7812 "Address Family modifier\n"
paul718e3742002-12-13 20:15:29 +00007813 "Summary of BGP neighbor status\n")
7814{
Lou Berger651b4022016-01-12 13:42:07 -05007815 if (strcmp (argv[0], "ipv4") == 0) {
7816 vty_out(vty, "%sIPv4 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7817 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7818 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
7819 vty_out(vty, "%sIPv4 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7820 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7821 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
7822 vty_out(vty, "%sIPv4 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7823 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7824 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
7825 vty_out(vty, "%sIPv4 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7826 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7827 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_ENCAP);
7828 return CMD_SUCCESS;
7829 }
Lou Berger205e6742016-01-12 13:42:11 -05007830
Lou Berger651b4022016-01-12 13:42:07 -05007831 if (strcmp (argv[0], "ipv6") == 0) {
7832 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7833 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7834 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
7835 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7836 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7837 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
7838 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7839 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7840 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MPLS_VPN);
7841 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7842 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7843 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_ENCAP);
7844 return CMD_SUCCESS;
7845 }
Lou Berger205e6742016-01-12 13:42:11 -05007846
Lou Berger651b4022016-01-12 13:42:07 -05007847 if (strcmp (argv[0], "unicast") == 0) {
7848 vty_out(vty, "IPv4 Unicast Summary:%s", VTY_NEWLINE);
7849 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7850 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
Lou Berger651b4022016-01-12 13:42:07 -05007851 vty_out(vty, "%s", VTY_NEWLINE);
7852 vty_out(vty, "IPv6 Unicast Summary:%s", VTY_NEWLINE);
7853 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7854 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
Lou Berger651b4022016-01-12 13:42:07 -05007855 return CMD_SUCCESS;
7856 }
7857 if (strcmp (argv[0], "multicast") == 0) {
7858 vty_out(vty, "IPv4 Multicast Summary:%s", VTY_NEWLINE);
7859 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7860 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
Lou Berger651b4022016-01-12 13:42:07 -05007861 vty_out(vty, "%s", VTY_NEWLINE);
7862 vty_out(vty, "IPv6 Multicast Summary:%s", VTY_NEWLINE);
7863 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7864 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
Lou Berger651b4022016-01-12 13:42:07 -05007865 return CMD_SUCCESS;
7866 }
7867 if (strcmp (argv[0], "vpn") == 0) {
7868 vty_out(vty, "IPv4 VPN Summary:%s", VTY_NEWLINE);
7869 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7870 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
Lou Berger651b4022016-01-12 13:42:07 -05007871 vty_out(vty, "%s", VTY_NEWLINE);
7872 vty_out(vty, "IPv6 VPN Summary:%s", VTY_NEWLINE);
7873 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7874 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MPLS_VPN);
Lou Berger651b4022016-01-12 13:42:07 -05007875 return CMD_SUCCESS;
7876 }
7877 if (strcmp (argv[0], "encap") == 0) {
7878 vty_out(vty, "IPv4 Encap Summary:%s", VTY_NEWLINE);
7879 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7880 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_ENCAP);
Lou Berger651b4022016-01-12 13:42:07 -05007881 vty_out(vty, "%s", VTY_NEWLINE);
7882 vty_out(vty, "IPv6 Encap Summary:%s", VTY_NEWLINE);
7883 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7884 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_ENCAP);
Lou Berger651b4022016-01-12 13:42:07 -05007885 return CMD_SUCCESS;
7886 }
7887 vty_out(vty, "Unknown keyword: %s%s", argv[0], VTY_NEWLINE);
7888 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00007889}
Lou Berger651b4022016-01-12 13:42:07 -05007890
7891
David Lamparter6b0655a2014-06-04 06:53:35 +02007892
paulfd79ac92004-10-13 05:06:08 +00007893const char *
hasso538621f2004-05-21 09:31:30 +00007894afi_safi_print (afi_t afi, safi_t safi)
7895{
7896 if (afi == AFI_IP && safi == SAFI_UNICAST)
7897 return "IPv4 Unicast";
7898 else if (afi == AFI_IP && safi == SAFI_MULTICAST)
7899 return "IPv4 Multicast";
7900 else if (afi == AFI_IP && safi == SAFI_MPLS_VPN)
Lou Berger9da04bc2016-01-12 13:41:55 -05007901 return "VPN-IPv4 Unicast";
Lou Bergera3fda882016-01-12 13:42:04 -05007902 else if (afi == AFI_IP && safi == SAFI_ENCAP)
7903 return "ENCAP-IPv4 Unicast";
hasso538621f2004-05-21 09:31:30 +00007904 else if (afi == AFI_IP6 && safi == SAFI_UNICAST)
7905 return "IPv6 Unicast";
7906 else if (afi == AFI_IP6 && safi == SAFI_MULTICAST)
7907 return "IPv6 Multicast";
Lou Berger9da04bc2016-01-12 13:41:55 -05007908 else if (afi == AFI_IP6 && safi == SAFI_MPLS_VPN)
7909 return "VPN-IPv6 Unicast";
Lou Bergera3fda882016-01-12 13:42:04 -05007910 else if (afi == AFI_IP6 && safi == SAFI_ENCAP)
7911 return "ENCAP-IPv6 Unicast";
hasso538621f2004-05-21 09:31:30 +00007912 else
7913 return "Unknown";
7914}
7915
paul718e3742002-12-13 20:15:29 +00007916/* Show BGP peer's information. */
7917enum show_type
7918{
7919 show_all,
7920 show_peer
7921};
7922
paul94f2b392005-06-28 12:44:16 +00007923static void
paul718e3742002-12-13 20:15:29 +00007924bgp_show_peer_afi_orf_cap (struct vty *vty, struct peer *p,
7925 afi_t afi, safi_t safi,
7926 u_int16_t adv_smcap, u_int16_t adv_rmcap,
7927 u_int16_t rcv_smcap, u_int16_t rcv_rmcap)
7928{
7929 /* Send-Mode */
7930 if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap)
7931 || CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap))
7932 {
7933 vty_out (vty, " Send-mode: ");
7934 if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap))
7935 vty_out (vty, "advertised");
7936 if (CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap))
7937 vty_out (vty, "%sreceived",
7938 CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) ?
7939 ", " : "");
7940 vty_out (vty, "%s", VTY_NEWLINE);
7941 }
7942
7943 /* Receive-Mode */
7944 if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap)
7945 || CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap))
7946 {
7947 vty_out (vty, " Receive-mode: ");
7948 if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap))
7949 vty_out (vty, "advertised");
7950 if (CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap))
7951 vty_out (vty, "%sreceived",
7952 CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) ?
7953 ", " : "");
7954 vty_out (vty, "%s", VTY_NEWLINE);
7955 }
7956}
7957
paul94f2b392005-06-28 12:44:16 +00007958static void
paul718e3742002-12-13 20:15:29 +00007959bgp_show_peer_afi (struct vty *vty, struct peer *p, afi_t afi, safi_t safi)
7960{
7961 struct bgp_filter *filter;
7962 char orf_pfx_name[BUFSIZ];
7963 int orf_pfx_count;
7964
7965 filter = &p->filter[afi][safi];
7966
hasso538621f2004-05-21 09:31:30 +00007967 vty_out (vty, " For address family: %s%s", afi_safi_print (afi, safi),
paul718e3742002-12-13 20:15:29 +00007968 VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00007969
paul718e3742002-12-13 20:15:29 +00007970 if (p->af_group[afi][safi])
7971 vty_out (vty, " %s peer-group member%s", p->group->name, VTY_NEWLINE);
7972
7973 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
7974 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
7975 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)
7976 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
7977 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV)
7978 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
7979 vty_out (vty, " AF-dependant capabilities:%s", VTY_NEWLINE);
7980
7981 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
7982 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
7983 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
7984 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV))
7985 {
7986 vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
7987 ORF_TYPE_PREFIX, VTY_NEWLINE);
7988 bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
7989 PEER_CAP_ORF_PREFIX_SM_ADV,
7990 PEER_CAP_ORF_PREFIX_RM_ADV,
7991 PEER_CAP_ORF_PREFIX_SM_RCV,
7992 PEER_CAP_ORF_PREFIX_RM_RCV);
7993 }
7994 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
7995 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)
7996 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
7997 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
7998 {
7999 vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
8000 ORF_TYPE_PREFIX_OLD, VTY_NEWLINE);
8001 bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
8002 PEER_CAP_ORF_PREFIX_SM_ADV,
8003 PEER_CAP_ORF_PREFIX_RM_ADV,
8004 PEER_CAP_ORF_PREFIX_SM_OLD_RCV,
8005 PEER_CAP_ORF_PREFIX_RM_OLD_RCV);
8006 }
8007
8008 sprintf (orf_pfx_name, "%s.%d.%d", p->host, afi, safi);
8009 orf_pfx_count = prefix_bgp_show_prefix_list (NULL, afi, orf_pfx_name);
8010
8011 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND)
8012 || orf_pfx_count)
8013 {
8014 vty_out (vty, " Outbound Route Filter (ORF):");
8015 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND))
8016 vty_out (vty, " sent;");
8017 if (orf_pfx_count)
8018 vty_out (vty, " received (%d entries)", orf_pfx_count);
8019 vty_out (vty, "%s", VTY_NEWLINE);
8020 }
8021 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH))
8022 vty_out (vty, " First update is deferred until ORF or ROUTE-REFRESH is received%s", VTY_NEWLINE);
8023
8024 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT))
8025 vty_out (vty, " Route-Reflector Client%s", VTY_NEWLINE);
8026 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT))
8027 vty_out (vty, " Route-Server Client%s", VTY_NEWLINE);
8028 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG))
8029 vty_out (vty, " Inbound soft reconfiguration allowed%s", VTY_NEWLINE);
8030 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS))
8031 vty_out (vty, " Private AS number removed from updates to this neighbor%s", VTY_NEWLINE);
8032 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF))
8033 vty_out (vty, " NEXT_HOP is always this router%s", VTY_NEWLINE);
8034 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED))
8035 vty_out (vty, " AS_PATH is propagated unchanged to this neighbor%s", VTY_NEWLINE);
8036 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED))
8037 vty_out (vty, " NEXT_HOP is propagated unchanged to this neighbor%s", VTY_NEWLINE);
8038 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED))
8039 vty_out (vty, " MED is propagated unchanged to this neighbor%s", VTY_NEWLINE);
8040 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
8041 || CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
8042 {
8043 vty_out (vty, " Community attribute sent to this neighbor");
8044 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
8045 && CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
hasso538621f2004-05-21 09:31:30 +00008046 vty_out (vty, "(both)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008047 else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
hasso538621f2004-05-21 09:31:30 +00008048 vty_out (vty, "(extended)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008049 else
hasso538621f2004-05-21 09:31:30 +00008050 vty_out (vty, "(standard)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008051 }
8052 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE))
8053 {
8054 vty_out (vty, " Default information originate,");
8055
8056 if (p->default_rmap[afi][safi].name)
8057 vty_out (vty, " default route-map %s%s,",
8058 p->default_rmap[afi][safi].map ? "*" : "",
8059 p->default_rmap[afi][safi].name);
8060 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_DEFAULT_ORIGINATE))
8061 vty_out (vty, " default sent%s", VTY_NEWLINE);
8062 else
8063 vty_out (vty, " default not sent%s", VTY_NEWLINE);
8064 }
8065
8066 if (filter->plist[FILTER_IN].name
8067 || filter->dlist[FILTER_IN].name
8068 || filter->aslist[FILTER_IN].name
paulfee0f4c2004-09-13 05:12:46 +00008069 || filter->map[RMAP_IN].name)
paul718e3742002-12-13 20:15:29 +00008070 vty_out (vty, " Inbound path policy configured%s", VTY_NEWLINE);
8071 if (filter->plist[FILTER_OUT].name
8072 || filter->dlist[FILTER_OUT].name
8073 || filter->aslist[FILTER_OUT].name
paulfee0f4c2004-09-13 05:12:46 +00008074 || filter->map[RMAP_OUT].name
paul718e3742002-12-13 20:15:29 +00008075 || filter->usmap.name)
8076 vty_out (vty, " Outbound path policy configured%s", VTY_NEWLINE);
paulfee0f4c2004-09-13 05:12:46 +00008077 if (filter->map[RMAP_IMPORT].name)
8078 vty_out (vty, " Import policy for this RS-client configured%s", VTY_NEWLINE);
8079 if (filter->map[RMAP_EXPORT].name)
8080 vty_out (vty, " Export policy for this RS-client configured%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008081
8082 /* prefix-list */
8083 if (filter->plist[FILTER_IN].name)
8084 vty_out (vty, " Incoming update prefix filter list is %s%s%s",
8085 filter->plist[FILTER_IN].plist ? "*" : "",
8086 filter->plist[FILTER_IN].name,
8087 VTY_NEWLINE);
8088 if (filter->plist[FILTER_OUT].name)
8089 vty_out (vty, " Outgoing update prefix filter list is %s%s%s",
8090 filter->plist[FILTER_OUT].plist ? "*" : "",
8091 filter->plist[FILTER_OUT].name,
8092 VTY_NEWLINE);
8093
8094 /* distribute-list */
8095 if (filter->dlist[FILTER_IN].name)
8096 vty_out (vty, " Incoming update network filter list is %s%s%s",
8097 filter->dlist[FILTER_IN].alist ? "*" : "",
8098 filter->dlist[FILTER_IN].name,
8099 VTY_NEWLINE);
8100 if (filter->dlist[FILTER_OUT].name)
8101 vty_out (vty, " Outgoing update network filter list is %s%s%s",
8102 filter->dlist[FILTER_OUT].alist ? "*" : "",
8103 filter->dlist[FILTER_OUT].name,
8104 VTY_NEWLINE);
8105
8106 /* filter-list. */
8107 if (filter->aslist[FILTER_IN].name)
8108 vty_out (vty, " Incoming update AS path filter list is %s%s%s",
8109 filter->aslist[FILTER_IN].aslist ? "*" : "",
8110 filter->aslist[FILTER_IN].name,
8111 VTY_NEWLINE);
8112 if (filter->aslist[FILTER_OUT].name)
8113 vty_out (vty, " Outgoing update AS path filter list is %s%s%s",
8114 filter->aslist[FILTER_OUT].aslist ? "*" : "",
8115 filter->aslist[FILTER_OUT].name,
8116 VTY_NEWLINE);
8117
8118 /* route-map. */
paulfee0f4c2004-09-13 05:12:46 +00008119 if (filter->map[RMAP_IN].name)
paul718e3742002-12-13 20:15:29 +00008120 vty_out (vty, " Route map for incoming advertisements is %s%s%s",
paulfee0f4c2004-09-13 05:12:46 +00008121 filter->map[RMAP_IN].map ? "*" : "",
8122 filter->map[RMAP_IN].name,
paul718e3742002-12-13 20:15:29 +00008123 VTY_NEWLINE);
paulfee0f4c2004-09-13 05:12:46 +00008124 if (filter->map[RMAP_OUT].name)
paul718e3742002-12-13 20:15:29 +00008125 vty_out (vty, " Route map for outgoing advertisements is %s%s%s",
paulfee0f4c2004-09-13 05:12:46 +00008126 filter->map[RMAP_OUT].map ? "*" : "",
8127 filter->map[RMAP_OUT].name,
8128 VTY_NEWLINE);
8129 if (filter->map[RMAP_IMPORT].name)
8130 vty_out (vty, " Route map for advertisements going into this RS-client's table is %s%s%s",
8131 filter->map[RMAP_IMPORT].map ? "*" : "",
8132 filter->map[RMAP_IMPORT].name,
8133 VTY_NEWLINE);
8134 if (filter->map[RMAP_EXPORT].name)
8135 vty_out (vty, " Route map for advertisements coming from this RS-client is %s%s%s",
8136 filter->map[RMAP_EXPORT].map ? "*" : "",
8137 filter->map[RMAP_EXPORT].name,
paul718e3742002-12-13 20:15:29 +00008138 VTY_NEWLINE);
8139
8140 /* unsuppress-map */
8141 if (filter->usmap.name)
8142 vty_out (vty, " Route map for selective unsuppress is %s%s%s",
8143 filter->usmap.map ? "*" : "",
8144 filter->usmap.name, VTY_NEWLINE);
8145
8146 /* Receive prefix count */
hassoe0701b72004-05-20 09:19:34 +00008147 vty_out (vty, " %ld accepted prefixes%s", p->pcount[afi][safi], VTY_NEWLINE);
8148
paul718e3742002-12-13 20:15:29 +00008149 /* Maximum prefix */
8150 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX))
8151 {
hasso0a486e52005-02-01 20:57:17 +00008152 vty_out (vty, " Maximum prefixes allowed %ld%s%s", p->pmax[afi][safi],
paul718e3742002-12-13 20:15:29 +00008153 CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING)
hasso0a486e52005-02-01 20:57:17 +00008154 ? " (warning-only)" : "", VTY_NEWLINE);
8155 vty_out (vty, " Threshold for warning message %d%%",
8156 p->pmax_threshold[afi][safi]);
8157 if (p->pmax_restart[afi][safi])
8158 vty_out (vty, ", restart interval %d min", p->pmax_restart[afi][safi]);
8159 vty_out (vty, "%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008160 }
paul718e3742002-12-13 20:15:29 +00008161
8162 vty_out (vty, "%s", VTY_NEWLINE);
8163}
8164
paul94f2b392005-06-28 12:44:16 +00008165static void
paul718e3742002-12-13 20:15:29 +00008166bgp_show_peer (struct vty *vty, struct peer *p)
8167{
8168 struct bgp *bgp;
8169 char buf1[BUFSIZ];
8170 char timebuf[BGP_UPTIME_LEN];
hasso538621f2004-05-21 09:31:30 +00008171 afi_t afi;
8172 safi_t safi;
paul718e3742002-12-13 20:15:29 +00008173
8174 bgp = p->bgp;
8175
8176 /* Configured IP address. */
8177 vty_out (vty, "BGP neighbor is %s, ", p->host);
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04008178 vty_out (vty, "remote AS %u, ", p->as);
Andrew Certain9d3f9702012-11-07 23:50:07 +00008179 vty_out (vty, "local AS %u%s%s, ",
paul718e3742002-12-13 20:15:29 +00008180 p->change_local_as ? p->change_local_as : p->local_as,
8181 CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND) ?
Andrew Certain9d3f9702012-11-07 23:50:07 +00008182 " no-prepend" : "",
8183 CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_REPLACE_AS) ?
8184 " replace-as" : "");
paul718e3742002-12-13 20:15:29 +00008185 vty_out (vty, "%s link%s",
8186 p->as == p->local_as ? "internal" : "external",
8187 VTY_NEWLINE);
8188
8189 /* Description. */
8190 if (p->desc)
8191 vty_out (vty, " Description: %s%s", p->desc, VTY_NEWLINE);
8192
8193 /* Peer-group */
8194 if (p->group)
8195 vty_out (vty, " Member of peer-group %s for session parameters%s",
8196 p->group->name, VTY_NEWLINE);
8197
8198 /* Administrative shutdown. */
8199 if (CHECK_FLAG (p->flags, PEER_FLAG_SHUTDOWN))
8200 vty_out (vty, " Administratively shut down%s", VTY_NEWLINE);
8201
8202 /* BGP Version. */
8203 vty_out (vty, " BGP version 4");
paul718e3742002-12-13 20:15:29 +00008204 vty_out (vty, ", remote router ID %s%s",
8205 inet_ntop (AF_INET, &p->remote_id, buf1, BUFSIZ),
8206 VTY_NEWLINE);
8207
8208 /* Confederation */
hassoe0701b72004-05-20 09:19:34 +00008209 if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION)
8210 && bgp_confederation_peers_check (bgp, p->as))
paul718e3742002-12-13 20:15:29 +00008211 vty_out (vty, " Neighbor under common administration%s", VTY_NEWLINE);
8212
8213 /* Status. */
8214 vty_out (vty, " BGP state = %s",
8215 LOOKUP (bgp_status_msg, p->status));
8216 if (p->status == Established)
8217 vty_out (vty, ", up for %8s",
8218 peer_uptime (p->uptime, timebuf, BGP_UPTIME_LEN));
hasso93406d82005-02-02 14:40:33 +00008219 else if (p->status == Active)
8220 {
8221 if (CHECK_FLAG (p->flags, PEER_FLAG_PASSIVE))
8222 vty_out (vty, " (passive)");
8223 else if (CHECK_FLAG (p->sflags, PEER_STATUS_NSF_WAIT))
8224 vty_out (vty, " (NSF passive)");
8225 }
paul718e3742002-12-13 20:15:29 +00008226 vty_out (vty, "%s", VTY_NEWLINE);
8227
8228 /* read timer */
8229 vty_out (vty, " Last read %s", peer_uptime (p->readtime, timebuf, BGP_UPTIME_LEN));
8230
8231 /* Configured timer values. */
8232 vty_out (vty, ", hold time is %d, keepalive interval is %d seconds%s",
8233 p->v_holdtime, p->v_keepalive, VTY_NEWLINE);
8234 if (CHECK_FLAG (p->config, PEER_CONFIG_TIMER))
8235 {
8236 vty_out (vty, " Configured hold time is %d", p->holdtime);
8237 vty_out (vty, ", keepalive interval is %d seconds%s",
8238 p->keepalive, VTY_NEWLINE);
8239 }
hasso93406d82005-02-02 14:40:33 +00008240
paul718e3742002-12-13 20:15:29 +00008241 /* Capability. */
8242 if (p->status == Established)
8243 {
hasso538621f2004-05-21 09:31:30 +00008244 if (p->cap
paul718e3742002-12-13 20:15:29 +00008245 || p->afc_adv[AFI_IP][SAFI_UNICAST]
8246 || p->afc_recv[AFI_IP][SAFI_UNICAST]
8247 || p->afc_adv[AFI_IP][SAFI_MULTICAST]
8248 || p->afc_recv[AFI_IP][SAFI_MULTICAST]
paul718e3742002-12-13 20:15:29 +00008249 || p->afc_adv[AFI_IP6][SAFI_UNICAST]
8250 || p->afc_recv[AFI_IP6][SAFI_UNICAST]
8251 || p->afc_adv[AFI_IP6][SAFI_MULTICAST]
8252 || p->afc_recv[AFI_IP6][SAFI_MULTICAST]
Lou Berger9da04bc2016-01-12 13:41:55 -05008253 || p->afc_adv[AFI_IP6][SAFI_MPLS_VPN]
8254 || p->afc_recv[AFI_IP6][SAFI_MPLS_VPN]
Lou Bergera3fda882016-01-12 13:42:04 -05008255 || p->afc_adv[AFI_IP6][SAFI_ENCAP]
8256 || p->afc_recv[AFI_IP6][SAFI_ENCAP]
Lou Bergera3fda882016-01-12 13:42:04 -05008257 || p->afc_adv[AFI_IP][SAFI_ENCAP]
8258 || p->afc_recv[AFI_IP][SAFI_ENCAP]
paul718e3742002-12-13 20:15:29 +00008259 || p->afc_adv[AFI_IP][SAFI_MPLS_VPN]
8260 || p->afc_recv[AFI_IP][SAFI_MPLS_VPN])
8261 {
8262 vty_out (vty, " Neighbor capabilities:%s", VTY_NEWLINE);
8263
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00008264 /* AS4 */
8265 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV)
8266 || CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV))
8267 {
8268 vty_out (vty, " 4 Byte AS:");
8269 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV))
8270 vty_out (vty, " advertised");
8271 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV))
8272 vty_out (vty, " %sreceived",
8273 CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV) ? "and " : "");
8274 vty_out (vty, "%s", VTY_NEWLINE);
8275 }
paul718e3742002-12-13 20:15:29 +00008276 /* Dynamic */
8277 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)
8278 || CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV))
8279 {
8280 vty_out (vty, " Dynamic:");
8281 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV))
8282 vty_out (vty, " advertised");
8283 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV))
hasso538621f2004-05-21 09:31:30 +00008284 vty_out (vty, " %sreceived",
8285 CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV) ? "and " : "");
paul718e3742002-12-13 20:15:29 +00008286 vty_out (vty, "%s", VTY_NEWLINE);
8287 }
8288
8289 /* Route Refresh */
8290 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV)
8291 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)
8292 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
8293 {
8294 vty_out (vty, " Route refresh:");
8295 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV))
8296 vty_out (vty, " advertised");
8297 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)
8298 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
hasso538621f2004-05-21 09:31:30 +00008299 vty_out (vty, " %sreceived(%s)",
8300 CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) ? "and " : "",
8301 (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)
8302 && CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)) ?
8303 "old & new" : CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) ? "old" : "new");
8304
paul718e3742002-12-13 20:15:29 +00008305 vty_out (vty, "%s", VTY_NEWLINE);
8306 }
8307
hasso538621f2004-05-21 09:31:30 +00008308 /* Multiprotocol Extensions */
8309 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
8310 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
8311 if (p->afc_adv[afi][safi] || p->afc_recv[afi][safi])
paul718e3742002-12-13 20:15:29 +00008312 {
hasso538621f2004-05-21 09:31:30 +00008313 vty_out (vty, " Address family %s:", afi_safi_print (afi, safi));
8314 if (p->afc_adv[afi][safi])
8315 vty_out (vty, " advertised");
8316 if (p->afc_recv[afi][safi])
8317 vty_out (vty, " %sreceived", p->afc_adv[afi][safi] ? "and " : "");
8318 vty_out (vty, "%s", VTY_NEWLINE);
8319 }
8320
8321 /* Gracefull Restart */
8322 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)
8323 || CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
paul718e3742002-12-13 20:15:29 +00008324 {
hasso538621f2004-05-21 09:31:30 +00008325 vty_out (vty, " Graceful Restart Capabilty:");
8326 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
paul718e3742002-12-13 20:15:29 +00008327 vty_out (vty, " advertised");
hasso538621f2004-05-21 09:31:30 +00008328 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
8329 vty_out (vty, " %sreceived",
8330 CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV) ? "and " : "");
paul718e3742002-12-13 20:15:29 +00008331 vty_out (vty, "%s", VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00008332
8333 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
paul718e3742002-12-13 20:15:29 +00008334 {
hasso538621f2004-05-21 09:31:30 +00008335 int restart_af_count = 0;
8336
8337 vty_out (vty, " Remote Restart timer is %d seconds%s",
hasso93406d82005-02-02 14:40:33 +00008338 p->v_gr_restart, VTY_NEWLINE);
8339 vty_out (vty, " Address families by peer:%s ", VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00008340
8341 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
8342 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
8343 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_RCV))
8344 {
hasso93406d82005-02-02 14:40:33 +00008345 vty_out (vty, "%s%s(%s)", restart_af_count ? ", " : "",
8346 afi_safi_print (afi, safi),
8347 CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_PRESERVE_RCV) ?
8348 "preserved" : "not preserved");
hasso538621f2004-05-21 09:31:30 +00008349 restart_af_count++;
hasso93406d82005-02-02 14:40:33 +00008350 }
hasso538621f2004-05-21 09:31:30 +00008351 if (! restart_af_count)
8352 vty_out (vty, "none");
8353 vty_out (vty, "%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008354 }
paul718e3742002-12-13 20:15:29 +00008355 }
paul718e3742002-12-13 20:15:29 +00008356 }
8357 }
8358
hasso93406d82005-02-02 14:40:33 +00008359 /* graceful restart information */
8360 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)
8361 || p->t_gr_restart
8362 || p->t_gr_stale)
8363 {
8364 int eor_send_af_count = 0;
8365 int eor_receive_af_count = 0;
8366
8367 vty_out (vty, " Graceful restart informations:%s", VTY_NEWLINE);
8368 if (p->status == Established)
8369 {
8370 vty_out (vty, " End-of-RIB send: ");
8371 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
8372 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
8373 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_SEND))
8374 {
8375 vty_out (vty, "%s%s", eor_send_af_count ? ", " : "",
8376 afi_safi_print (afi, safi));
8377 eor_send_af_count++;
8378 }
8379 vty_out (vty, "%s", VTY_NEWLINE);
8380
8381 vty_out (vty, " End-of-RIB received: ");
8382 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
8383 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
8384 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_RECEIVED))
8385 {
8386 vty_out (vty, "%s%s", eor_receive_af_count ? ", " : "",
8387 afi_safi_print (afi, safi));
8388 eor_receive_af_count++;
8389 }
8390 vty_out (vty, "%s", VTY_NEWLINE);
8391 }
8392
8393 if (p->t_gr_restart)
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00008394 vty_out (vty, " The remaining time of restart timer is %ld%s",
8395 thread_timer_remain_second (p->t_gr_restart), VTY_NEWLINE);
8396
hasso93406d82005-02-02 14:40:33 +00008397 if (p->t_gr_stale)
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00008398 vty_out (vty, " The remaining time of stalepath timer is %ld%s",
8399 thread_timer_remain_second (p->t_gr_stale), VTY_NEWLINE);
hasso93406d82005-02-02 14:40:33 +00008400 }
8401
paul718e3742002-12-13 20:15:29 +00008402 /* Packet counts. */
hasso93406d82005-02-02 14:40:33 +00008403 vty_out (vty, " Message statistics:%s", VTY_NEWLINE);
8404 vty_out (vty, " Inq depth is 0%s", VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00008405 vty_out (vty, " Outq depth is %lu%s", (unsigned long) p->obuf->count, VTY_NEWLINE);
hasso93406d82005-02-02 14:40:33 +00008406 vty_out (vty, " Sent Rcvd%s", VTY_NEWLINE);
8407 vty_out (vty, " Opens: %10d %10d%s", p->open_out, p->open_in, VTY_NEWLINE);
8408 vty_out (vty, " Notifications: %10d %10d%s", p->notify_out, p->notify_in, VTY_NEWLINE);
8409 vty_out (vty, " Updates: %10d %10d%s", p->update_out, p->update_in, VTY_NEWLINE);
8410 vty_out (vty, " Keepalives: %10d %10d%s", p->keepalive_out, p->keepalive_in, VTY_NEWLINE);
8411 vty_out (vty, " Route Refresh: %10d %10d%s", p->refresh_out, p->refresh_in, VTY_NEWLINE);
8412 vty_out (vty, " Capability: %10d %10d%s", p->dynamic_cap_out, p->dynamic_cap_in, VTY_NEWLINE);
8413 vty_out (vty, " Total: %10d %10d%s", p->open_out + p->notify_out +
8414 p->update_out + p->keepalive_out + p->refresh_out + p->dynamic_cap_out,
8415 p->open_in + p->notify_in + p->update_in + p->keepalive_in + p->refresh_in +
8416 p->dynamic_cap_in, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008417
8418 /* advertisement-interval */
8419 vty_out (vty, " Minimum time between advertisement runs is %d seconds%s",
8420 p->v_routeadv, VTY_NEWLINE);
8421
8422 /* Update-source. */
8423 if (p->update_if || p->update_source)
8424 {
8425 vty_out (vty, " Update source is ");
8426 if (p->update_if)
8427 vty_out (vty, "%s", p->update_if);
8428 else if (p->update_source)
8429 vty_out (vty, "%s",
8430 sockunion2str (p->update_source, buf1, SU_ADDRSTRLEN));
8431 vty_out (vty, "%s", VTY_NEWLINE);
8432 }
8433
8434 /* Default weight */
8435 if (CHECK_FLAG (p->config, PEER_CONFIG_WEIGHT))
8436 vty_out (vty, " Default weight %d%s", p->weight,
8437 VTY_NEWLINE);
8438
8439 vty_out (vty, "%s", VTY_NEWLINE);
8440
8441 /* Address Family Information */
hasso538621f2004-05-21 09:31:30 +00008442 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
8443 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
8444 if (p->afc[afi][safi])
8445 bgp_show_peer_afi (vty, p, afi, safi);
paul718e3742002-12-13 20:15:29 +00008446
8447 vty_out (vty, " Connections established %d; dropped %d%s",
8448 p->established, p->dropped,
8449 VTY_NEWLINE);
8450
hassoe0701b72004-05-20 09:19:34 +00008451 if (! p->dropped)
8452 vty_out (vty, " Last reset never%s", VTY_NEWLINE);
8453 else
8454 vty_out (vty, " Last reset %s, due to %s%s",
8455 peer_uptime (p->resettime, timebuf, BGP_UPTIME_LEN),
8456 peer_down_str[(int) p->last_reset], VTY_NEWLINE);
paul848973c2003-08-13 00:32:49 +00008457
paul718e3742002-12-13 20:15:29 +00008458 if (CHECK_FLAG (p->sflags, PEER_STATUS_PREFIX_OVERFLOW))
8459 {
8460 vty_out (vty, " Peer had exceeded the max. no. of prefixes configured.%s", VTY_NEWLINE);
hasso0a486e52005-02-01 20:57:17 +00008461
8462 if (p->t_pmax_restart)
8463 vty_out (vty, " Reduce the no. of prefix from %s, will restart in %ld seconds%s",
8464 p->host, thread_timer_remain_second (p->t_pmax_restart),
8465 VTY_NEWLINE);
8466 else
8467 vty_out (vty, " Reduce the no. of prefix and clear ip bgp %s to restore peering%s",
8468 p->host, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008469 }
8470
Stephen Hemmingerf5a48272011-03-24 17:30:21 +00008471 /* EBGP Multihop and GTSM */
Jorge Boncompte [DTI2]6d85b152012-05-07 16:52:54 +00008472 if (p->sort != BGP_PEER_IBGP)
Stephen Hemmingerf5a48272011-03-24 17:30:21 +00008473 {
8474 if (p->gtsm_hops > 0)
8475 vty_out (vty, " External BGP neighbor may be up to %d hops away.%s",
8476 p->gtsm_hops, VTY_NEWLINE);
8477 else if (p->ttl > 1)
8478 vty_out (vty, " External BGP neighbor may be up to %d hops away.%s",
8479 p->ttl, VTY_NEWLINE);
8480 }
Pradosh Mohapatra5d804b42013-09-12 03:37:07 +00008481 else
8482 {
8483 if (p->gtsm_hops > 0)
8484 vty_out (vty, " Internal BGP neighbor may be up to %d hops away.%s",
8485 p->gtsm_hops, VTY_NEWLINE);
8486 }
paul718e3742002-12-13 20:15:29 +00008487
8488 /* Local address. */
8489 if (p->su_local)
8490 {
hasso93406d82005-02-02 14:40:33 +00008491 vty_out (vty, "Local host: %s, Local port: %d%s",
paul718e3742002-12-13 20:15:29 +00008492 sockunion2str (p->su_local, buf1, SU_ADDRSTRLEN),
8493 ntohs (p->su_local->sin.sin_port),
paul718e3742002-12-13 20:15:29 +00008494 VTY_NEWLINE);
8495 }
8496
8497 /* Remote address. */
8498 if (p->su_remote)
8499 {
8500 vty_out (vty, "Foreign host: %s, Foreign port: %d%s",
8501 sockunion2str (p->su_remote, buf1, SU_ADDRSTRLEN),
8502 ntohs (p->su_remote->sin.sin_port),
8503 VTY_NEWLINE);
8504 }
8505
8506 /* Nexthop display. */
8507 if (p->su_local)
8508 {
8509 vty_out (vty, "Nexthop: %s%s",
8510 inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ),
8511 VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008512 vty_out (vty, "Nexthop global: %s%s",
8513 inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ),
8514 VTY_NEWLINE);
8515 vty_out (vty, "Nexthop local: %s%s",
8516 inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ),
8517 VTY_NEWLINE);
8518 vty_out (vty, "BGP connection: %s%s",
8519 p->shared_network ? "shared network" : "non shared network",
8520 VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008521 }
8522
Timo Teräsef757702015-04-29 09:43:04 +03008523 /* TCP metrics. */
8524 if (p->status == Established && p->rtt)
8525 vty_out (vty, "Estimated round trip time: %d ms%s",
8526 p->rtt, VTY_NEWLINE);
8527
paul718e3742002-12-13 20:15:29 +00008528 /* Timer information. */
8529 if (p->t_start)
8530 vty_out (vty, "Next start timer due in %ld seconds%s",
8531 thread_timer_remain_second (p->t_start), VTY_NEWLINE);
8532 if (p->t_connect)
8533 vty_out (vty, "Next connect timer due in %ld seconds%s",
8534 thread_timer_remain_second (p->t_connect), VTY_NEWLINE);
8535
8536 vty_out (vty, "Read thread: %s Write thread: %s%s",
8537 p->t_read ? "on" : "off",
8538 p->t_write ? "on" : "off",
8539 VTY_NEWLINE);
8540
8541 if (p->notify.code == BGP_NOTIFY_OPEN_ERR
8542 && p->notify.subcode == BGP_NOTIFY_OPEN_UNSUP_CAPBL)
8543 bgp_capability_vty_out (vty, p);
8544
8545 vty_out (vty, "%s", VTY_NEWLINE);
8546}
8547
paul94f2b392005-06-28 12:44:16 +00008548static int
paul718e3742002-12-13 20:15:29 +00008549bgp_show_neighbor (struct vty *vty, struct bgp *bgp,
8550 enum show_type type, union sockunion *su)
8551{
paul1eb8ef22005-04-07 07:30:20 +00008552 struct listnode *node, *nnode;
paul718e3742002-12-13 20:15:29 +00008553 struct peer *peer;
8554 int find = 0;
8555
paul1eb8ef22005-04-07 07:30:20 +00008556 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00008557 {
8558 switch (type)
8559 {
8560 case show_all:
8561 bgp_show_peer (vty, peer);
8562 break;
8563 case show_peer:
8564 if (sockunion_same (&peer->su, su))
8565 {
8566 find = 1;
8567 bgp_show_peer (vty, peer);
8568 }
8569 break;
8570 }
8571 }
8572
8573 if (type == show_peer && ! find)
8574 vty_out (vty, "%% No such neighbor%s", VTY_NEWLINE);
8575
8576 return CMD_SUCCESS;
8577}
8578
paul94f2b392005-06-28 12:44:16 +00008579static int
paulfd79ac92004-10-13 05:06:08 +00008580bgp_show_neighbor_vty (struct vty *vty, const char *name,
8581 enum show_type type, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00008582{
8583 int ret;
8584 struct bgp *bgp;
8585 union sockunion su;
8586
8587 if (ip_str)
8588 {
8589 ret = str2sockunion (ip_str, &su);
8590 if (ret < 0)
8591 {
8592 vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE);
8593 return CMD_WARNING;
8594 }
8595 }
8596
8597 if (name)
8598 {
8599 bgp = bgp_lookup_by_name (name);
8600
8601 if (! bgp)
8602 {
8603 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
8604 return CMD_WARNING;
8605 }
8606
8607 bgp_show_neighbor (vty, bgp, type, &su);
8608
8609 return CMD_SUCCESS;
8610 }
8611
8612 bgp = bgp_get_default ();
8613
8614 if (bgp)
8615 bgp_show_neighbor (vty, bgp, type, &su);
8616
8617 return CMD_SUCCESS;
8618}
8619
Lou Bergerf9b6c392016-01-12 13:42:09 -05008620/* "show ip bgp neighbors" commands. */DEFUN (show_ip_bgp_neighbors,
8621 show_ip_bgp_neighbors_cmd,
8622 "show ip bgp neighbors",
8623 SHOW_STR
8624 IP_STR
8625 BGP_STR
8626 "Detailed information on TCP and BGP neighbor connections\n")
8627{
8628 return bgp_show_neighbor_vty (vty, NULL, show_all, NULL);
8629}
8630
8631ALIAS (show_ip_bgp_neighbors,
8632 show_ip_bgp_ipv4_neighbors_cmd,
8633 "show ip bgp ipv4 (unicast|multicast) neighbors",
8634 SHOW_STR
8635 IP_STR
8636 BGP_STR
8637 "Address family\n"
8638 "Address Family modifier\n"
8639 "Address Family modifier\n"
8640 "Detailed information on TCP and BGP neighbor connections\n")
8641
8642ALIAS (show_ip_bgp_neighbors,
8643 show_ip_bgp_vpnv4_all_neighbors_cmd,
8644 "show ip bgp vpnv4 all neighbors",
8645 SHOW_STR
8646 IP_STR
8647 BGP_STR
8648 "Display VPNv4 NLRI specific information\n"
8649 "Display information about all VPNv4 NLRIs\n"
8650 "Detailed information on TCP and BGP neighbor connections\n")
8651
8652ALIAS (show_ip_bgp_neighbors,
8653 show_ip_bgp_vpnv4_rd_neighbors_cmd,
8654 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors",
8655 SHOW_STR
8656 IP_STR
8657 BGP_STR
8658 "Display VPNv4 NLRI specific information\n"
8659 "Display information for a route distinguisher\n"
8660 "VPN Route Distinguisher\n"
8661 "Detailed information on TCP and BGP neighbor connections\n")
8662
8663ALIAS (show_ip_bgp_neighbors,
8664 show_bgp_ipv6_neighbors_cmd,
8665 "show bgp ipv6 neighbors",
8666 SHOW_STR
8667 BGP_STR
8668 "Address family\n"
8669 "Detailed information on TCP and BGP neighbor connections\n")
8670
8671DEFUN (show_ip_bgp_neighbors_peer,
8672 show_ip_bgp_neighbors_peer_cmd,
8673 "show ip bgp neighbors (A.B.C.D|X:X::X:X)",
8674 SHOW_STR
8675 IP_STR
8676 BGP_STR
8677 "Detailed information on TCP and BGP neighbor connections\n"
8678 "Neighbor to display information about\n"
8679 "Neighbor to display information about\n")
8680{
8681 return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 1]);
8682}
8683
8684ALIAS (show_ip_bgp_neighbors_peer,
8685 show_ip_bgp_ipv4_neighbors_peer_cmd,
8686 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X)",
8687 SHOW_STR
8688 IP_STR
8689 BGP_STR
8690 "Address family\n"
8691 "Address Family modifier\n"
8692 "Address Family modifier\n"
8693 "Detailed information on TCP and BGP neighbor connections\n"
8694 "Neighbor to display information about\n"
8695 "Neighbor to display information about\n")
8696
8697ALIAS (show_ip_bgp_neighbors_peer,
8698 show_ip_bgp_vpnv4_all_neighbors_peer_cmd,
8699 "show ip bgp vpnv4 all neighbors A.B.C.D",
8700 SHOW_STR
8701 IP_STR
8702 BGP_STR
8703 "Display VPNv4 NLRI specific information\n"
8704 "Display information about all VPNv4 NLRIs\n"
8705 "Detailed information on TCP and BGP neighbor connections\n"
8706 "Neighbor to display information about\n")
8707
8708ALIAS (show_ip_bgp_neighbors_peer,
8709 show_ip_bgp_vpnv4_rd_neighbors_peer_cmd,
8710 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D",
8711 SHOW_STR
8712 IP_STR
8713 BGP_STR
8714 "Display VPNv4 NLRI specific information\n"
8715 "Display information about all VPNv4 NLRIs\n"
8716 "Detailed information on TCP and BGP neighbor connections\n"
8717 "Neighbor to display information about\n")
8718
8719ALIAS (show_ip_bgp_neighbors_peer,
8720 show_bgp_ipv6_neighbors_peer_cmd,
8721 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X)",
8722 SHOW_STR
8723 BGP_STR
8724 "Address family\n"
8725 "Detailed information on TCP and BGP neighbor connections\n"
8726 "Neighbor to display information about\n"
8727 "Neighbor to display information about\n")
8728
8729DEFUN (show_ip_bgp_instance_neighbors,
8730 show_ip_bgp_instance_neighbors_cmd,
8731 "show ip bgp view WORD neighbors",
8732 SHOW_STR
8733 IP_STR
8734 BGP_STR
8735 "BGP view\n"
8736 "View name\n"
8737 "Detailed information on TCP and BGP neighbor connections\n")
8738{
8739 return bgp_show_neighbor_vty (vty, argv[0], show_all, NULL);
8740}
8741
8742ALIAS (show_ip_bgp_instance_neighbors,
8743 show_bgp_instance_ipv6_neighbors_cmd,
8744 "show bgp view WORD ipv6 neighbors",
8745 SHOW_STR
8746 BGP_STR
8747 "BGP view\n"
8748 "View name\n"
8749 "Address family\n"
8750 "Detailed information on TCP and BGP neighbor connections\n")
8751
8752DEFUN (show_ip_bgp_instance_neighbors_peer,
8753 show_ip_bgp_instance_neighbors_peer_cmd,
8754 "show ip bgp view WORD neighbors (A.B.C.D|X:X::X:X)",
8755 SHOW_STR
8756 IP_STR
8757 BGP_STR
8758 "BGP view\n"
8759 "View name\n"
8760 "Detailed information on TCP and BGP neighbor connections\n"
8761 "Neighbor to display information about\n"
8762 "Neighbor to display information about\n")
8763{
8764 return bgp_show_neighbor_vty (vty, argv[0], show_peer, argv[1]);
8765}
8766
8767/* Show BGP's AS paths internal data. There are both `show ip bgp
8768 paths' and `show ip mbgp paths'. Those functions results are the
8769 same.*/
8770DEFUN (show_ip_bgp_paths,
8771 show_ip_bgp_paths_cmd,
8772 "show ip bgp paths",
8773 SHOW_STR
8774 IP_STR
8775 BGP_STR
8776 "Path information\n")
8777{
8778 vty_out (vty, "Address Refcnt Path%s", VTY_NEWLINE);
8779 aspath_print_all_vty (vty);
8780 return CMD_SUCCESS;
8781}
8782
8783DEFUN (show_ip_bgp_ipv4_paths,
8784 show_ip_bgp_ipv4_paths_cmd,
8785 "show ip bgp ipv4 (unicast|multicast) paths",
8786 SHOW_STR
8787 IP_STR
8788 BGP_STR
8789 "Address family\n"
8790 "Address Family modifier\n"
8791 "Address Family modifier\n"
8792 "Path information\n")
8793{
8794 vty_out (vty, "Address Refcnt Path\r\n");
8795 aspath_print_all_vty (vty);
8796
8797 return CMD_SUCCESS;
8798}
8799
Lou Berger651b4022016-01-12 13:42:07 -05008800DEFUN (show_bgp_neighbors,
8801 show_bgp_neighbors_cmd,
8802 "show bgp neighbors",
paul718e3742002-12-13 20:15:29 +00008803 SHOW_STR
paul718e3742002-12-13 20:15:29 +00008804 BGP_STR
8805 "Detailed information on TCP and BGP neighbor connections\n")
8806{
8807 return bgp_show_neighbor_vty (vty, NULL, show_all, NULL);
8808}
8809
Lou Berger651b4022016-01-12 13:42:07 -05008810DEFUN (show_bgp_neighbors_peer,
8811 show_bgp_neighbors_peer_cmd,
Lou Berger651b4022016-01-12 13:42:07 -05008812 "show bgp neighbors (A.B.C.D|X:X::X:X)",
paul718e3742002-12-13 20:15:29 +00008813 SHOW_STR
paul718e3742002-12-13 20:15:29 +00008814 BGP_STR
8815 "Detailed information on TCP and BGP neighbor connections\n"
8816 "Neighbor to display information about\n"
8817 "Neighbor to display information about\n")
8818{
8819 return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 1]);
8820}
8821
Lou Berger651b4022016-01-12 13:42:07 -05008822DEFUN (show_bgp_instance_neighbors,
8823 show_bgp_instance_neighbors_cmd,
8824 "show bgp view WORD neighbors",
paul718e3742002-12-13 20:15:29 +00008825 SHOW_STR
paul718e3742002-12-13 20:15:29 +00008826 BGP_STR
8827 "BGP view\n"
8828 "View name\n"
8829 "Detailed information on TCP and BGP neighbor connections\n")
8830{
8831 return bgp_show_neighbor_vty (vty, argv[0], show_all, NULL);
8832}
8833
Lou Berger651b4022016-01-12 13:42:07 -05008834DEFUN (show_bgp_instance_neighbors_peer,
8835 show_bgp_instance_neighbors_peer_cmd,
Lou Berger651b4022016-01-12 13:42:07 -05008836 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X)",
paul718e3742002-12-13 20:15:29 +00008837 SHOW_STR
paul718e3742002-12-13 20:15:29 +00008838 BGP_STR
8839 "BGP view\n"
8840 "View name\n"
8841 "Detailed information on TCP and BGP neighbor connections\n"
8842 "Neighbor to display information about\n"
8843 "Neighbor to display information about\n")
8844{
8845 return bgp_show_neighbor_vty (vty, argv[0], show_peer, argv[1]);
8846}
paulbb46e942003-10-24 19:02:03 +00008847
Lou Berger651b4022016-01-12 13:42:07 -05008848ALIAS (show_bgp_instance_neighbors_peer,
paulbb46e942003-10-24 19:02:03 +00008849 show_bgp_instance_ipv6_neighbors_peer_cmd,
8850 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X)",
8851 SHOW_STR
8852 BGP_STR
8853 "BGP view\n"
8854 "View name\n"
8855 "Address family\n"
8856 "Detailed information on TCP and BGP neighbor connections\n"
8857 "Neighbor to display information about\n"
8858 "Neighbor to display information about\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02008859
paul718e3742002-12-13 20:15:29 +00008860/* Show BGP's AS paths internal data. There are both `show ip bgp
8861 paths' and `show ip mbgp paths'. Those functions results are the
8862 same.*/
Lou Berger651b4022016-01-12 13:42:07 -05008863DEFUN (show_bgp_ipv4_paths,
8864 show_bgp_ipv4_paths_cmd,
8865 "show bgp paths",
paul718e3742002-12-13 20:15:29 +00008866 SHOW_STR
paul718e3742002-12-13 20:15:29 +00008867 BGP_STR
8868 "Path information\n")
8869{
8870 vty_out (vty, "Address Refcnt Path%s", VTY_NEWLINE);
8871 aspath_print_all_vty (vty);
8872 return CMD_SUCCESS;
8873}
8874
paul718e3742002-12-13 20:15:29 +00008875#include "hash.h"
8876
paul94f2b392005-06-28 12:44:16 +00008877static void
paul718e3742002-12-13 20:15:29 +00008878community_show_all_iterator (struct hash_backet *backet, struct vty *vty)
8879{
8880 struct community *com;
8881
8882 com = (struct community *) backet->data;
David Lampartereed3c482015-03-03 08:51:53 +01008883 vty_out (vty, "[%p] (%ld) %s%s", (void *)backet, com->refcnt,
paul718e3742002-12-13 20:15:29 +00008884 community_str (com), VTY_NEWLINE);
8885}
8886
8887/* Show BGP's community internal data. */
8888DEFUN (show_ip_bgp_community_info,
8889 show_ip_bgp_community_info_cmd,
8890 "show ip bgp community-info",
8891 SHOW_STR
8892 IP_STR
8893 BGP_STR
8894 "List all bgp community information\n")
8895{
8896 vty_out (vty, "Address Refcnt Community%s", VTY_NEWLINE);
8897
8898 hash_iterate (community_hash (),
8899 (void (*) (struct hash_backet *, void *))
8900 community_show_all_iterator,
8901 vty);
8902
8903 return CMD_SUCCESS;
8904}
8905
8906DEFUN (show_ip_bgp_attr_info,
8907 show_ip_bgp_attr_info_cmd,
8908 "show ip bgp attribute-info",
8909 SHOW_STR
8910 IP_STR
8911 BGP_STR
8912 "List all bgp attribute information\n")
8913{
8914 attr_show_all (vty);
8915 return CMD_SUCCESS;
8916}
David Lamparter6b0655a2014-06-04 06:53:35 +02008917
paul94f2b392005-06-28 12:44:16 +00008918static int
paulfee0f4c2004-09-13 05:12:46 +00008919bgp_write_rsclient_summary (struct vty *vty, struct peer *rsclient,
8920 afi_t afi, safi_t safi)
8921{
8922 char timebuf[BGP_UPTIME_LEN];
8923 char rmbuf[14];
paulfd79ac92004-10-13 05:06:08 +00008924 const char *rmname;
paulfee0f4c2004-09-13 05:12:46 +00008925 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00008926 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00008927 int len;
8928 int count = 0;
8929
8930 if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_GROUP))
8931 {
paul1eb8ef22005-04-07 07:30:20 +00008932 for (ALL_LIST_ELEMENTS (rsclient->group->peer, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00008933 {
8934 count++;
8935 bgp_write_rsclient_summary (vty, peer, afi, safi);
8936 }
8937 return count;
8938 }
8939
8940 len = vty_out (vty, "%s", rsclient->host);
8941 len = 16 - len;
8942
8943 if (len < 1)
8944 vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " ");
8945 else
8946 vty_out (vty, "%*s", len, " ");
8947
hasso3d515fd2005-02-01 21:30:04 +00008948 vty_out (vty, "4 ");
paulfee0f4c2004-09-13 05:12:46 +00008949
Milan Kociancb4fc592014-12-01 12:48:25 +00008950 vty_out (vty, "%10u ", rsclient->as);
paulfee0f4c2004-09-13 05:12:46 +00008951
8952 rmname = ROUTE_MAP_EXPORT_NAME(&rsclient->filter[afi][safi]);
8953 if ( rmname && strlen (rmname) > 13 )
8954 {
8955 sprintf (rmbuf, "%13s", "...");
8956 rmname = strncpy (rmbuf, rmname, 10);
8957 }
8958 else if (! rmname)
8959 rmname = "<none>";
8960 vty_out (vty, " %13s ", rmname);
8961
8962 rmname = ROUTE_MAP_IMPORT_NAME(&rsclient->filter[afi][safi]);
8963 if ( rmname && strlen (rmname) > 13 )
8964 {
8965 sprintf (rmbuf, "%13s", "...");
8966 rmname = strncpy (rmbuf, rmname, 10);
8967 }
8968 else if (! rmname)
8969 rmname = "<none>";
8970 vty_out (vty, " %13s ", rmname);
8971
8972 vty_out (vty, "%8s", peer_uptime (rsclient->uptime, timebuf, BGP_UPTIME_LEN));
8973
8974 if (CHECK_FLAG (rsclient->flags, PEER_FLAG_SHUTDOWN))
8975 vty_out (vty, " Idle (Admin)");
8976 else if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_PREFIX_OVERFLOW))
8977 vty_out (vty, " Idle (PfxCt)");
8978 else
8979 vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, rsclient->status));
8980
8981 vty_out (vty, "%s", VTY_NEWLINE);
8982
8983 return 1;
8984}
8985
paul94f2b392005-06-28 12:44:16 +00008986static int
paulfd79ac92004-10-13 05:06:08 +00008987bgp_show_rsclient_summary (struct vty *vty, struct bgp *bgp,
8988 afi_t afi, safi_t safi)
paulfee0f4c2004-09-13 05:12:46 +00008989{
8990 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00008991 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00008992 int count = 0;
8993
8994 /* Header string for each address family. */
Milan Kociancb4fc592014-12-01 12:48:25 +00008995 static char header[] = "Neighbor V AS Export-Policy Import-Policy Up/Down State";
paulfee0f4c2004-09-13 05:12:46 +00008996
paul1eb8ef22005-04-07 07:30:20 +00008997 for (ALL_LIST_ELEMENTS (bgp->rsclient, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00008998 {
8999 if (peer->afc[afi][safi] &&
9000 CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT))
9001 {
9002 if (! count)
9003 {
9004 vty_out (vty,
9005 "Route Server's BGP router identifier %s%s",
9006 inet_ntoa (bgp->router_id), VTY_NEWLINE);
9007 vty_out (vty,
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04009008 "Route Server's local AS number %u%s", bgp->as,
paulfee0f4c2004-09-13 05:12:46 +00009009 VTY_NEWLINE);
9010
9011 vty_out (vty, "%s", VTY_NEWLINE);
9012 vty_out (vty, "%s%s", header, VTY_NEWLINE);
9013 }
9014
9015 count += bgp_write_rsclient_summary (vty, peer, afi, safi);
9016 }
9017 }
9018
9019 if (count)
9020 vty_out (vty, "%sTotal number of Route Server Clients %d%s", VTY_NEWLINE,
9021 count, VTY_NEWLINE);
9022 else
9023 vty_out (vty, "No %s Route Server Client is configured%s",
9024 afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE);
9025
9026 return CMD_SUCCESS;
9027}
9028
paul94f2b392005-06-28 12:44:16 +00009029static int
paulfd79ac92004-10-13 05:06:08 +00009030bgp_show_rsclient_summary_vty (struct vty *vty, const char *name,
9031 afi_t afi, safi_t safi)
paulfee0f4c2004-09-13 05:12:46 +00009032{
9033 struct bgp *bgp;
9034
9035 if (name)
9036 {
9037 bgp = bgp_lookup_by_name (name);
9038
9039 if (! bgp)
9040 {
9041 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
9042 return CMD_WARNING;
9043 }
9044
9045 bgp_show_rsclient_summary (vty, bgp, afi, safi);
9046 return CMD_SUCCESS;
9047 }
9048
9049 bgp = bgp_get_default ();
9050
9051 if (bgp)
9052 bgp_show_rsclient_summary (vty, bgp, afi, safi);
9053
9054 return CMD_SUCCESS;
9055}
9056
9057/* 'show bgp rsclient' commands. */
Lou Bergerf9b6c392016-01-12 13:42:09 -05009058DEFUN (show_ip_bgp_rsclient_summary,
9059 show_ip_bgp_rsclient_summary_cmd,
9060 "show ip bgp rsclient summary",
9061 SHOW_STR
9062 IP_STR
9063 BGP_STR
9064 "Information about Route Server Clients\n"
9065 "Summary of all Route Server Clients\n")
9066{
9067 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
9068}
9069
9070DEFUN (show_ip_bgp_instance_rsclient_summary,
9071 show_ip_bgp_instance_rsclient_summary_cmd,
9072 "show ip bgp view WORD rsclient summary",
9073 SHOW_STR
9074 IP_STR
9075 BGP_STR
9076 "BGP view\n"
9077 "View name\n"
9078 "Information about Route Server Clients\n"
9079 "Summary of all Route Server Clients\n")
9080{
9081 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
9082}
9083
9084DEFUN (show_ip_bgp_ipv4_rsclient_summary,
9085 show_ip_bgp_ipv4_rsclient_summary_cmd,
9086 "show ip bgp ipv4 (unicast|multicast) rsclient summary",
9087 SHOW_STR
9088 IP_STR
9089 BGP_STR
9090 "Address family\n"
9091 "Address Family modifier\n"
9092 "Address Family modifier\n"
9093 "Information about Route Server Clients\n"
9094 "Summary of all Route Server Clients\n")
9095{
9096 if (strncmp (argv[0], "m", 1) == 0)
9097 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
9098
9099 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
9100}
9101
9102DEFUN (show_ip_bgp_instance_ipv4_rsclient_summary,
9103 show_ip_bgp_instance_ipv4_rsclient_summary_cmd,
9104 "show ip bgp view WORD ipv4 (unicast|multicast) rsclient summary",
9105 SHOW_STR
9106 IP_STR
9107 BGP_STR
9108 "BGP view\n"
9109 "View name\n"
9110 "Address family\n"
9111 "Address Family modifier\n"
9112 "Address Family modifier\n"
9113 "Information about Route Server Clients\n"
9114 "Summary of all Route Server Clients\n")
9115{
9116 if (strncmp (argv[1], "m", 1) == 0)
9117 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
9118
9119 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
9120}
paulfee0f4c2004-09-13 05:12:46 +00009121
Michael Lambert95cbbd22010-07-23 14:43:04 -04009122DEFUN (show_bgp_instance_ipv4_safi_rsclient_summary,
9123 show_bgp_instance_ipv4_safi_rsclient_summary_cmd,
9124 "show bgp view WORD ipv4 (unicast|multicast) rsclient summary",
9125 SHOW_STR
9126 BGP_STR
9127 "BGP view\n"
9128 "View name\n"
9129 "Address family\n"
9130 "Address Family modifier\n"
9131 "Address Family modifier\n"
9132 "Information about Route Server Clients\n"
9133 "Summary of all Route Server Clients\n")
9134{
9135 safi_t safi;
9136
9137 if (argc == 2) {
9138 safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
9139 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, safi);
9140 } else {
9141 safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
9142 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, safi);
9143 }
9144}
9145
9146ALIAS (show_bgp_instance_ipv4_safi_rsclient_summary,
9147 show_bgp_ipv4_safi_rsclient_summary_cmd,
9148 "show bgp ipv4 (unicast|multicast) rsclient summary",
9149 SHOW_STR
9150 BGP_STR
9151 "Address family\n"
9152 "Address Family modifier\n"
9153 "Address Family modifier\n"
9154 "Information about Route Server Clients\n"
9155 "Summary of all Route Server Clients\n")
9156
paulfee0f4c2004-09-13 05:12:46 +00009157DEFUN (show_bgp_rsclient_summary,
9158 show_bgp_rsclient_summary_cmd,
9159 "show bgp rsclient summary",
9160 SHOW_STR
9161 BGP_STR
9162 "Information about Route Server Clients\n"
9163 "Summary of all Route Server Clients\n")
9164{
Lou Berger651b4022016-01-12 13:42:07 -05009165 vty_out(vty, "%sIPv4 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9166 vty_out(vty, "---------------------%s", VTY_NEWLINE);
9167 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
9168 vty_out(vty, "%sIPv4 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9169 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
9170 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
9171 vty_out(vty, "%sIPv4 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9172 vty_out(vty, "-----------------%s", VTY_NEWLINE);
9173 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
9174 vty_out(vty, "%sIPv4 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9175 vty_out(vty, "-------------------%s", VTY_NEWLINE);
9176 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_ENCAP);
9177
Lou Berger651b4022016-01-12 13:42:07 -05009178 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9179 vty_out(vty, "---------------------%s", VTY_NEWLINE);
9180 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
9181 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9182 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
9183 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
9184 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9185 vty_out(vty, "-----------------%s", VTY_NEWLINE);
9186 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_MPLS_VPN);
9187 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9188 vty_out(vty, "-------------------%s", VTY_NEWLINE);
9189 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_ENCAP);
Lou Berger205e6742016-01-12 13:42:11 -05009190
Lou Berger651b4022016-01-12 13:42:07 -05009191 return CMD_SUCCESS;
paulfee0f4c2004-09-13 05:12:46 +00009192}
9193
9194DEFUN (show_bgp_instance_rsclient_summary,
9195 show_bgp_instance_rsclient_summary_cmd,
9196 "show bgp view WORD rsclient summary",
9197 SHOW_STR
9198 BGP_STR
9199 "BGP view\n"
9200 "View name\n"
9201 "Information about Route Server Clients\n"
9202 "Summary of all Route Server Clients\n")
9203{
Lou Berger651b4022016-01-12 13:42:07 -05009204 vty_out(vty, "%sIPv4 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9205 vty_out(vty, "---------------------%s", VTY_NEWLINE);
9206 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
9207 vty_out(vty, "%sIPv4 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9208 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
9209 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
9210 vty_out(vty, "%sIPv4 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9211 vty_out(vty, "-----------------%s", VTY_NEWLINE);
9212 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_MPLS_VPN);
9213 vty_out(vty, "%sIPv4 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9214 vty_out(vty, "-------------------%s", VTY_NEWLINE);
9215 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_ENCAP);
9216
Lou Berger651b4022016-01-12 13:42:07 -05009217 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9218 vty_out(vty, "---------------------%s", VTY_NEWLINE);
9219 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
9220 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9221 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
9222 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST);
9223 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9224 vty_out(vty, "-----------------%s", VTY_NEWLINE);
9225 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_MPLS_VPN);
9226 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9227 vty_out(vty, "-------------------%s", VTY_NEWLINE);
9228 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_ENCAP);
Lou Berger205e6742016-01-12 13:42:11 -05009229
Lou Berger651b4022016-01-12 13:42:07 -05009230 return CMD_SUCCESS;
paulfee0f4c2004-09-13 05:12:46 +00009231}
9232
Lou Berger651b4022016-01-12 13:42:07 -05009233DEFUN (show_bgp_ipv6_rsclient_summary,
paulfee0f4c2004-09-13 05:12:46 +00009234 show_bgp_ipv6_rsclient_summary_cmd,
9235 "show bgp ipv6 rsclient summary",
9236 SHOW_STR
9237 BGP_STR
9238 "Address family\n"
9239 "Information about Route Server Clients\n"
9240 "Summary of all Route Server Clients\n")
Lou Berger651b4022016-01-12 13:42:07 -05009241{
9242 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9243 vty_out(vty, "---------------------%s", VTY_NEWLINE);
9244 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
9245 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9246 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
9247 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
9248 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9249 vty_out(vty, "-----------------%s", VTY_NEWLINE);
9250 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_MPLS_VPN);
9251 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9252 vty_out(vty, "-------------------%s", VTY_NEWLINE);
9253 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_ENCAP);
paulfee0f4c2004-09-13 05:12:46 +00009254
Lou Berger651b4022016-01-12 13:42:07 -05009255 return CMD_SUCCESS;
9256}
9257
9258DEFUN (show_bgp_instance_ipv6_rsclient_summary,
paulfee0f4c2004-09-13 05:12:46 +00009259 show_bgp_instance_ipv6_rsclient_summary_cmd,
9260 "show bgp view WORD ipv6 rsclient summary",
9261 SHOW_STR
9262 BGP_STR
9263 "BGP view\n"
9264 "View name\n"
9265 "Address family\n"
9266 "Information about Route Server Clients\n"
9267 "Summary of all Route Server Clients\n")
Lou Berger651b4022016-01-12 13:42:07 -05009268{
9269 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9270 vty_out(vty, "---------------------%s", VTY_NEWLINE);
9271 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
9272 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9273 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
9274 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST);
9275 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9276 vty_out(vty, "-----------------%s", VTY_NEWLINE);
9277 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_MPLS_VPN);
9278 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9279 vty_out(vty, "-------------------%s", VTY_NEWLINE);
9280 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_ENCAP);
9281
9282 return CMD_SUCCESS;
9283}
Michael Lambert95cbbd22010-07-23 14:43:04 -04009284
9285DEFUN (show_bgp_instance_ipv6_safi_rsclient_summary,
9286 show_bgp_instance_ipv6_safi_rsclient_summary_cmd,
9287 "show bgp view WORD ipv6 (unicast|multicast) rsclient summary",
9288 SHOW_STR
9289 BGP_STR
9290 "BGP view\n"
9291 "View name\n"
9292 "Address family\n"
9293 "Address Family modifier\n"
9294 "Address Family modifier\n"
9295 "Information about Route Server Clients\n"
9296 "Summary of all Route Server Clients\n")
9297{
9298 safi_t safi;
9299
9300 if (argc == 2) {
9301 safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
9302 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, safi);
9303 } else {
9304 safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
9305 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, safi);
9306 }
9307}
9308
9309ALIAS (show_bgp_instance_ipv6_safi_rsclient_summary,
9310 show_bgp_ipv6_safi_rsclient_summary_cmd,
9311 "show bgp ipv6 (unicast|multicast) rsclient summary",
9312 SHOW_STR
9313 BGP_STR
Lou Berger651b4022016-01-12 13:42:07 -05009314 IPV6_STR
Michael Lambert95cbbd22010-07-23 14:43:04 -04009315 "Address Family modifier\n"
9316 "Address Family modifier\n"
9317 "Information about Route Server Clients\n"
9318 "Summary of all Route Server Clients\n")
9319
paul718e3742002-12-13 20:15:29 +00009320/* Redistribute VTY commands. */
9321
paul718e3742002-12-13 20:15:29 +00009322DEFUN (bgp_redistribute_ipv4,
9323 bgp_redistribute_ipv4_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009324 "redistribute " QUAGGA_IP_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00009325 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009326 QUAGGA_IP_REDIST_HELP_STR_BGPD)
paul718e3742002-12-13 20:15:29 +00009327{
9328 int type;
9329
David Lampartere0ca5fd2009-09-16 01:52:42 +02009330 type = proto_redistnum (AFI_IP, argv[0]);
9331 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009332 {
9333 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9334 return CMD_WARNING;
9335 }
9336 return bgp_redistribute_set (vty->index, AFI_IP, type);
9337}
9338
9339DEFUN (bgp_redistribute_ipv4_rmap,
9340 bgp_redistribute_ipv4_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009341 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00009342 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009343 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009344 "Route map reference\n"
9345 "Pointer to route-map entries\n")
9346{
9347 int type;
9348
David Lampartere0ca5fd2009-09-16 01:52:42 +02009349 type = proto_redistnum (AFI_IP, argv[0]);
9350 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009351 {
9352 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9353 return CMD_WARNING;
9354 }
9355
9356 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]);
9357 return bgp_redistribute_set (vty->index, AFI_IP, type);
9358}
9359
9360DEFUN (bgp_redistribute_ipv4_metric,
9361 bgp_redistribute_ipv4_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009362 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009363 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009364 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009365 "Metric for redistributed routes\n"
9366 "Default metric\n")
9367{
9368 int type;
9369 u_int32_t metric;
9370
David Lampartere0ca5fd2009-09-16 01:52:42 +02009371 type = proto_redistnum (AFI_IP, argv[0]);
9372 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009373 {
9374 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9375 return CMD_WARNING;
9376 }
9377 VTY_GET_INTEGER ("metric", metric, argv[1]);
9378
9379 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
9380 return bgp_redistribute_set (vty->index, AFI_IP, type);
9381}
9382
9383DEFUN (bgp_redistribute_ipv4_rmap_metric,
9384 bgp_redistribute_ipv4_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009385 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009386 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009387 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009388 "Route map reference\n"
9389 "Pointer to route-map entries\n"
9390 "Metric for redistributed routes\n"
9391 "Default metric\n")
9392{
9393 int type;
9394 u_int32_t metric;
9395
David Lampartere0ca5fd2009-09-16 01:52:42 +02009396 type = proto_redistnum (AFI_IP, argv[0]);
9397 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009398 {
9399 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9400 return CMD_WARNING;
9401 }
9402 VTY_GET_INTEGER ("metric", metric, argv[2]);
9403
9404 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]);
9405 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
9406 return bgp_redistribute_set (vty->index, AFI_IP, type);
9407}
9408
9409DEFUN (bgp_redistribute_ipv4_metric_rmap,
9410 bgp_redistribute_ipv4_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009411 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00009412 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009413 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009414 "Metric for redistributed routes\n"
9415 "Default metric\n"
9416 "Route map reference\n"
9417 "Pointer to route-map entries\n")
9418{
9419 int type;
9420 u_int32_t metric;
9421
David Lampartere0ca5fd2009-09-16 01:52:42 +02009422 type = proto_redistnum (AFI_IP, argv[0]);
9423 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009424 {
9425 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9426 return CMD_WARNING;
9427 }
9428 VTY_GET_INTEGER ("metric", metric, argv[1]);
9429
9430 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
9431 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[2]);
9432 return bgp_redistribute_set (vty->index, AFI_IP, type);
9433}
9434
9435DEFUN (no_bgp_redistribute_ipv4,
9436 no_bgp_redistribute_ipv4_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009437 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00009438 NO_STR
9439 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009440 QUAGGA_IP_REDIST_HELP_STR_BGPD)
paul718e3742002-12-13 20:15:29 +00009441{
9442 int type;
9443
David Lampartere0ca5fd2009-09-16 01:52:42 +02009444 type = proto_redistnum (AFI_IP, argv[0]);
9445 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009446 {
9447 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9448 return CMD_WARNING;
9449 }
9450
9451 return bgp_redistribute_unset (vty->index, AFI_IP, type);
9452}
9453
9454DEFUN (no_bgp_redistribute_ipv4_rmap,
9455 no_bgp_redistribute_ipv4_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009456 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00009457 NO_STR
9458 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009459 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009460 "Route map reference\n"
9461 "Pointer to route-map entries\n")
9462{
9463 int type;
9464
David Lampartere0ca5fd2009-09-16 01:52:42 +02009465 type = proto_redistnum (AFI_IP, argv[0]);
9466 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009467 {
9468 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9469 return CMD_WARNING;
9470 }
9471
9472 bgp_redistribute_routemap_unset (vty->index, AFI_IP, type);
9473 return CMD_SUCCESS;
9474}
9475
9476DEFUN (no_bgp_redistribute_ipv4_metric,
9477 no_bgp_redistribute_ipv4_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009478 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009479 NO_STR
9480 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009481 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009482 "Metric for redistributed routes\n"
9483 "Default metric\n")
9484{
9485 int type;
9486
David Lampartere0ca5fd2009-09-16 01:52:42 +02009487 type = proto_redistnum (AFI_IP, argv[0]);
9488 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009489 {
9490 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9491 return CMD_WARNING;
9492 }
9493
9494 bgp_redistribute_metric_unset (vty->index, AFI_IP, type);
9495 return CMD_SUCCESS;
9496}
9497
9498DEFUN (no_bgp_redistribute_ipv4_rmap_metric,
9499 no_bgp_redistribute_ipv4_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009500 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009501 NO_STR
9502 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009503 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009504 "Route map reference\n"
9505 "Pointer to route-map entries\n"
9506 "Metric for redistributed routes\n"
9507 "Default metric\n")
9508{
9509 int type;
9510
David Lampartere0ca5fd2009-09-16 01:52:42 +02009511 type = proto_redistnum (AFI_IP, argv[0]);
9512 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009513 {
9514 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9515 return CMD_WARNING;
9516 }
9517
9518 bgp_redistribute_metric_unset (vty->index, AFI_IP, type);
9519 bgp_redistribute_routemap_unset (vty->index, AFI_IP, type);
9520 return CMD_SUCCESS;
9521}
9522
9523ALIAS (no_bgp_redistribute_ipv4_rmap_metric,
9524 no_bgp_redistribute_ipv4_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009525 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00009526 NO_STR
9527 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009528 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009529 "Metric for redistributed routes\n"
9530 "Default metric\n"
9531 "Route map reference\n"
9532 "Pointer to route-map entries\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02009533
paul718e3742002-12-13 20:15:29 +00009534DEFUN (bgp_redistribute_ipv6,
9535 bgp_redistribute_ipv6_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009536 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00009537 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009538 QUAGGA_IP6_REDIST_HELP_STR_BGPD)
paul718e3742002-12-13 20:15:29 +00009539{
9540 int type;
9541
David Lampartere0ca5fd2009-09-16 01:52:42 +02009542 type = proto_redistnum (AFI_IP6, argv[0]);
9543 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009544 {
9545 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9546 return CMD_WARNING;
9547 }
9548
9549 return bgp_redistribute_set (vty->index, AFI_IP6, type);
9550}
9551
9552DEFUN (bgp_redistribute_ipv6_rmap,
9553 bgp_redistribute_ipv6_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009554 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00009555 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009556 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009557 "Route map reference\n"
9558 "Pointer to route-map entries\n")
9559{
9560 int type;
9561
David Lampartere0ca5fd2009-09-16 01:52:42 +02009562 type = proto_redistnum (AFI_IP6, argv[0]);
9563 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009564 {
9565 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9566 return CMD_WARNING;
9567 }
9568
9569 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]);
9570 return bgp_redistribute_set (vty->index, AFI_IP6, type);
9571}
9572
9573DEFUN (bgp_redistribute_ipv6_metric,
9574 bgp_redistribute_ipv6_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009575 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009576 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009577 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009578 "Metric for redistributed routes\n"
9579 "Default metric\n")
9580{
9581 int type;
9582 u_int32_t metric;
9583
David Lampartere0ca5fd2009-09-16 01:52:42 +02009584 type = proto_redistnum (AFI_IP6, argv[0]);
9585 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009586 {
9587 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9588 return CMD_WARNING;
9589 }
9590 VTY_GET_INTEGER ("metric", metric, argv[1]);
9591
9592 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
9593 return bgp_redistribute_set (vty->index, AFI_IP6, type);
9594}
9595
9596DEFUN (bgp_redistribute_ipv6_rmap_metric,
9597 bgp_redistribute_ipv6_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009598 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009599 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009600 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009601 "Route map reference\n"
9602 "Pointer to route-map entries\n"
9603 "Metric for redistributed routes\n"
9604 "Default metric\n")
9605{
9606 int type;
9607 u_int32_t metric;
9608
David Lampartere0ca5fd2009-09-16 01:52:42 +02009609 type = proto_redistnum (AFI_IP6, argv[0]);
9610 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009611 {
9612 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9613 return CMD_WARNING;
9614 }
9615 VTY_GET_INTEGER ("metric", metric, argv[2]);
9616
9617 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]);
9618 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
9619 return bgp_redistribute_set (vty->index, AFI_IP6, type);
9620}
9621
9622DEFUN (bgp_redistribute_ipv6_metric_rmap,
9623 bgp_redistribute_ipv6_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009624 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00009625 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009626 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009627 "Metric for redistributed routes\n"
9628 "Default metric\n"
9629 "Route map reference\n"
9630 "Pointer to route-map entries\n")
9631{
9632 int type;
9633 u_int32_t metric;
9634
David Lampartere0ca5fd2009-09-16 01:52:42 +02009635 type = proto_redistnum (AFI_IP6, argv[0]);
9636 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009637 {
9638 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9639 return CMD_WARNING;
9640 }
9641 VTY_GET_INTEGER ("metric", metric, argv[1]);
9642
9643 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
9644 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[2]);
9645 return bgp_redistribute_set (vty->index, AFI_IP6, type);
9646}
9647
9648DEFUN (no_bgp_redistribute_ipv6,
9649 no_bgp_redistribute_ipv6_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009650 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00009651 NO_STR
9652 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009653 QUAGGA_IP6_REDIST_HELP_STR_BGPD)
paul718e3742002-12-13 20:15:29 +00009654{
9655 int type;
9656
David Lampartere0ca5fd2009-09-16 01:52:42 +02009657 type = proto_redistnum (AFI_IP6, argv[0]);
9658 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009659 {
9660 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9661 return CMD_WARNING;
9662 }
9663
9664 return bgp_redistribute_unset (vty->index, AFI_IP6, type);
9665}
9666
9667DEFUN (no_bgp_redistribute_ipv6_rmap,
9668 no_bgp_redistribute_ipv6_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009669 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00009670 NO_STR
9671 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009672 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009673 "Route map reference\n"
9674 "Pointer to route-map entries\n")
9675{
9676 int type;
9677
David Lampartere0ca5fd2009-09-16 01:52:42 +02009678 type = proto_redistnum (AFI_IP6, argv[0]);
9679 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009680 {
9681 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9682 return CMD_WARNING;
9683 }
9684
9685 bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type);
9686 return CMD_SUCCESS;
9687}
9688
9689DEFUN (no_bgp_redistribute_ipv6_metric,
9690 no_bgp_redistribute_ipv6_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009691 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009692 NO_STR
9693 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009694 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009695 "Metric for redistributed routes\n"
9696 "Default metric\n")
9697{
9698 int type;
9699
David Lampartere0ca5fd2009-09-16 01:52:42 +02009700 type = proto_redistnum (AFI_IP6, argv[0]);
9701 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009702 {
9703 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9704 return CMD_WARNING;
9705 }
9706
9707 bgp_redistribute_metric_unset (vty->index, AFI_IP6, type);
9708 return CMD_SUCCESS;
9709}
9710
9711DEFUN (no_bgp_redistribute_ipv6_rmap_metric,
9712 no_bgp_redistribute_ipv6_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009713 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009714 NO_STR
9715 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009716 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009717 "Route map reference\n"
9718 "Pointer to route-map entries\n"
9719 "Metric for redistributed routes\n"
9720 "Default metric\n")
9721{
9722 int type;
9723
David Lampartere0ca5fd2009-09-16 01:52:42 +02009724 type = proto_redistnum (AFI_IP6, argv[0]);
9725 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009726 {
9727 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9728 return CMD_WARNING;
9729 }
9730
9731 bgp_redistribute_metric_unset (vty->index, AFI_IP6, type);
9732 bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type);
9733 return CMD_SUCCESS;
9734}
9735
9736ALIAS (no_bgp_redistribute_ipv6_rmap_metric,
9737 no_bgp_redistribute_ipv6_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009738 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00009739 NO_STR
9740 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009741 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009742 "Metric for redistributed routes\n"
9743 "Default metric\n"
9744 "Route map reference\n"
9745 "Pointer to route-map entries\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02009746
paul718e3742002-12-13 20:15:29 +00009747int
9748bgp_config_write_redistribute (struct vty *vty, struct bgp *bgp, afi_t afi,
9749 safi_t safi, int *write)
9750{
9751 int i;
paul718e3742002-12-13 20:15:29 +00009752
9753 /* Unicast redistribution only. */
9754 if (safi != SAFI_UNICAST)
9755 return 0;
9756
9757 for (i = 0; i < ZEBRA_ROUTE_MAX; i++)
9758 {
9759 /* Redistribute BGP does not make sense. */
9760 if (bgp->redist[afi][i] && i != ZEBRA_ROUTE_BGP)
9761 {
9762 /* Display "address-family" when it is not yet diplayed. */
9763 bgp_config_write_family_header (vty, afi, safi, write);
9764
9765 /* "redistribute" configuration. */
ajsf52d13c2005-10-01 17:38:06 +00009766 vty_out (vty, " redistribute %s", zebra_route_string(i));
paul718e3742002-12-13 20:15:29 +00009767
9768 if (bgp->redist_metric_flag[afi][i])
Jorge Boncompte [DTI2]ddc943d2012-04-13 13:46:07 +02009769 vty_out (vty, " metric %u", bgp->redist_metric[afi][i]);
paul718e3742002-12-13 20:15:29 +00009770
9771 if (bgp->rmap[afi][i].name)
9772 vty_out (vty, " route-map %s", bgp->rmap[afi][i].name);
9773
9774 vty_out (vty, "%s", VTY_NEWLINE);
9775 }
9776 }
9777 return *write;
9778}
David Lamparter6b0655a2014-06-04 06:53:35 +02009779
paul718e3742002-12-13 20:15:29 +00009780/* BGP node structure. */
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009781static struct cmd_node bgp_node =
paul718e3742002-12-13 20:15:29 +00009782{
9783 BGP_NODE,
9784 "%s(config-router)# ",
9785 1,
9786};
9787
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009788static struct cmd_node bgp_ipv4_unicast_node =
paul718e3742002-12-13 20:15:29 +00009789{
9790 BGP_IPV4_NODE,
9791 "%s(config-router-af)# ",
9792 1,
9793};
9794
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009795static struct cmd_node bgp_ipv4_multicast_node =
paul718e3742002-12-13 20:15:29 +00009796{
9797 BGP_IPV4M_NODE,
9798 "%s(config-router-af)# ",
9799 1,
9800};
9801
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009802static struct cmd_node bgp_ipv6_unicast_node =
paul718e3742002-12-13 20:15:29 +00009803{
9804 BGP_IPV6_NODE,
9805 "%s(config-router-af)# ",
9806 1,
9807};
9808
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009809static struct cmd_node bgp_ipv6_multicast_node =
paul25ffbdc2005-08-22 22:42:08 +00009810{
9811 BGP_IPV6M_NODE,
9812 "%s(config-router-af)# ",
9813 1,
9814};
9815
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009816static struct cmd_node bgp_vpnv4_node =
paul718e3742002-12-13 20:15:29 +00009817{
9818 BGP_VPNV4_NODE,
9819 "%s(config-router-af)# ",
9820 1
9821};
David Lamparter6b0655a2014-06-04 06:53:35 +02009822
Lou Berger13c378d2016-01-12 13:41:56 -05009823static struct cmd_node bgp_vpnv6_node =
9824{
9825 BGP_VPNV6_NODE,
9826 "%s(config-router-af-vpnv6)# ",
9827 1
9828};
9829
Lou Bergera3fda882016-01-12 13:42:04 -05009830static struct cmd_node bgp_encap_node =
9831{
9832 BGP_ENCAP_NODE,
9833 "%s(config-router-af-encap)# ",
9834 1
9835};
9836
9837static struct cmd_node bgp_encapv6_node =
9838{
9839 BGP_ENCAPV6_NODE,
9840 "%s(config-router-af-encapv6)# ",
9841 1
9842};
9843
paul1f8ae702005-09-09 23:49:49 +00009844static void community_list_vty (void);
9845
paul718e3742002-12-13 20:15:29 +00009846void
paul94f2b392005-06-28 12:44:16 +00009847bgp_vty_init (void)
paul718e3742002-12-13 20:15:29 +00009848{
paul718e3742002-12-13 20:15:29 +00009849 /* Install bgp top node. */
9850 install_node (&bgp_node, bgp_config_write);
9851 install_node (&bgp_ipv4_unicast_node, NULL);
9852 install_node (&bgp_ipv4_multicast_node, NULL);
9853 install_node (&bgp_ipv6_unicast_node, NULL);
paul25ffbdc2005-08-22 22:42:08 +00009854 install_node (&bgp_ipv6_multicast_node, NULL);
paul718e3742002-12-13 20:15:29 +00009855 install_node (&bgp_vpnv4_node, NULL);
Lou Berger13c378d2016-01-12 13:41:56 -05009856 install_node (&bgp_vpnv6_node, NULL);
Lou Bergera3fda882016-01-12 13:42:04 -05009857 install_node (&bgp_encap_node, NULL);
9858 install_node (&bgp_encapv6_node, NULL);
paul718e3742002-12-13 20:15:29 +00009859
9860 /* Install default VTY commands to new nodes. */
9861 install_default (BGP_NODE);
9862 install_default (BGP_IPV4_NODE);
9863 install_default (BGP_IPV4M_NODE);
9864 install_default (BGP_IPV6_NODE);
paul25ffbdc2005-08-22 22:42:08 +00009865 install_default (BGP_IPV6M_NODE);
paul718e3742002-12-13 20:15:29 +00009866 install_default (BGP_VPNV4_NODE);
Lou Berger13c378d2016-01-12 13:41:56 -05009867 install_default (BGP_VPNV6_NODE);
Lou Bergera3fda882016-01-12 13:42:04 -05009868 install_default (BGP_ENCAP_NODE);
9869 install_default (BGP_ENCAPV6_NODE);
paul718e3742002-12-13 20:15:29 +00009870
9871 /* "bgp multiple-instance" commands. */
9872 install_element (CONFIG_NODE, &bgp_multiple_instance_cmd);
9873 install_element (CONFIG_NODE, &no_bgp_multiple_instance_cmd);
9874
9875 /* "bgp config-type" commands. */
9876 install_element (CONFIG_NODE, &bgp_config_type_cmd);
9877 install_element (CONFIG_NODE, &no_bgp_config_type_cmd);
9878
9879 /* Dummy commands (Currently not supported) */
9880 install_element (BGP_NODE, &no_synchronization_cmd);
9881 install_element (BGP_NODE, &no_auto_summary_cmd);
9882
9883 /* "router bgp" commands. */
9884 install_element (CONFIG_NODE, &router_bgp_cmd);
9885 install_element (CONFIG_NODE, &router_bgp_view_cmd);
9886
9887 /* "no router bgp" commands. */
9888 install_element (CONFIG_NODE, &no_router_bgp_cmd);
9889 install_element (CONFIG_NODE, &no_router_bgp_view_cmd);
9890
9891 /* "bgp router-id" commands. */
9892 install_element (BGP_NODE, &bgp_router_id_cmd);
9893 install_element (BGP_NODE, &no_bgp_router_id_cmd);
9894 install_element (BGP_NODE, &no_bgp_router_id_val_cmd);
9895
9896 /* "bgp cluster-id" commands. */
9897 install_element (BGP_NODE, &bgp_cluster_id_cmd);
9898 install_element (BGP_NODE, &bgp_cluster_id32_cmd);
9899 install_element (BGP_NODE, &no_bgp_cluster_id_cmd);
9900 install_element (BGP_NODE, &no_bgp_cluster_id_arg_cmd);
9901
9902 /* "bgp confederation" commands. */
9903 install_element (BGP_NODE, &bgp_confederation_identifier_cmd);
9904 install_element (BGP_NODE, &no_bgp_confederation_identifier_cmd);
9905 install_element (BGP_NODE, &no_bgp_confederation_identifier_arg_cmd);
9906
9907 /* "bgp confederation peers" commands. */
9908 install_element (BGP_NODE, &bgp_confederation_peers_cmd);
9909 install_element (BGP_NODE, &no_bgp_confederation_peers_cmd);
9910
Josh Bailey165b5ff2011-07-20 20:43:22 -07009911 /* "maximum-paths" commands. */
9912 install_element (BGP_NODE, &bgp_maxpaths_cmd);
9913 install_element (BGP_NODE, &no_bgp_maxpaths_cmd);
9914 install_element (BGP_NODE, &no_bgp_maxpaths_arg_cmd);
9915 install_element (BGP_IPV4_NODE, &bgp_maxpaths_cmd);
9916 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_cmd);
9917 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_arg_cmd);
9918 install_element (BGP_NODE, &bgp_maxpaths_ibgp_cmd);
9919 install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_cmd);
9920 install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_arg_cmd);
9921 install_element (BGP_IPV4_NODE, &bgp_maxpaths_ibgp_cmd);
9922 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_cmd);
9923 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_arg_cmd);
9924
paul718e3742002-12-13 20:15:29 +00009925 /* "timers bgp" commands. */
9926 install_element (BGP_NODE, &bgp_timers_cmd);
9927 install_element (BGP_NODE, &no_bgp_timers_cmd);
9928 install_element (BGP_NODE, &no_bgp_timers_arg_cmd);
9929
9930 /* "bgp client-to-client reflection" commands */
9931 install_element (BGP_NODE, &no_bgp_client_to_client_reflection_cmd);
9932 install_element (BGP_NODE, &bgp_client_to_client_reflection_cmd);
9933
9934 /* "bgp always-compare-med" commands */
9935 install_element (BGP_NODE, &bgp_always_compare_med_cmd);
9936 install_element (BGP_NODE, &no_bgp_always_compare_med_cmd);
9937
9938 /* "bgp deterministic-med" commands */
9939 install_element (BGP_NODE, &bgp_deterministic_med_cmd);
9940 install_element (BGP_NODE, &no_bgp_deterministic_med_cmd);
hasso538621f2004-05-21 09:31:30 +00009941
hasso538621f2004-05-21 09:31:30 +00009942 /* "bgp graceful-restart" commands */
9943 install_element (BGP_NODE, &bgp_graceful_restart_cmd);
9944 install_element (BGP_NODE, &no_bgp_graceful_restart_cmd);
hasso93406d82005-02-02 14:40:33 +00009945 install_element (BGP_NODE, &bgp_graceful_restart_stalepath_time_cmd);
9946 install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_cmd);
9947 install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_val_cmd);
Philippe Guibert4afa3dd2016-05-24 16:52:02 +02009948 install_element (BGP_NODE, &bgp_graceful_restart_restart_time_cmd);
9949 install_element (BGP_NODE, &no_bgp_graceful_restart_restart_time_cmd);
9950 install_element (BGP_NODE, &no_bgp_graceful_restart_restart_time_val_cmd);
paul718e3742002-12-13 20:15:29 +00009951
9952 /* "bgp fast-external-failover" commands */
9953 install_element (BGP_NODE, &bgp_fast_external_failover_cmd);
9954 install_element (BGP_NODE, &no_bgp_fast_external_failover_cmd);
9955
9956 /* "bgp enforce-first-as" commands */
9957 install_element (BGP_NODE, &bgp_enforce_first_as_cmd);
9958 install_element (BGP_NODE, &no_bgp_enforce_first_as_cmd);
9959
9960 /* "bgp bestpath compare-routerid" commands */
9961 install_element (BGP_NODE, &bgp_bestpath_compare_router_id_cmd);
9962 install_element (BGP_NODE, &no_bgp_bestpath_compare_router_id_cmd);
9963
9964 /* "bgp bestpath as-path ignore" commands */
9965 install_element (BGP_NODE, &bgp_bestpath_aspath_ignore_cmd);
9966 install_element (BGP_NODE, &no_bgp_bestpath_aspath_ignore_cmd);
9967
hasso68118452005-04-08 15:40:36 +00009968 /* "bgp bestpath as-path confed" commands */
9969 install_element (BGP_NODE, &bgp_bestpath_aspath_confed_cmd);
9970 install_element (BGP_NODE, &no_bgp_bestpath_aspath_confed_cmd);
9971
Pradosh Mohapatra2fdd4552013-09-07 07:02:36 +00009972 /* "bgp bestpath as-path multipath-relax" commands */
9973 install_element (BGP_NODE, &bgp_bestpath_aspath_multipath_relax_cmd);
9974 install_element (BGP_NODE, &no_bgp_bestpath_aspath_multipath_relax_cmd);
9975
paul848973c2003-08-13 00:32:49 +00009976 /* "bgp log-neighbor-changes" commands */
9977 install_element (BGP_NODE, &bgp_log_neighbor_changes_cmd);
9978 install_element (BGP_NODE, &no_bgp_log_neighbor_changes_cmd);
9979
paul718e3742002-12-13 20:15:29 +00009980 /* "bgp bestpath med" commands */
9981 install_element (BGP_NODE, &bgp_bestpath_med_cmd);
9982 install_element (BGP_NODE, &bgp_bestpath_med2_cmd);
9983 install_element (BGP_NODE, &bgp_bestpath_med3_cmd);
9984 install_element (BGP_NODE, &no_bgp_bestpath_med_cmd);
9985 install_element (BGP_NODE, &no_bgp_bestpath_med2_cmd);
9986 install_element (BGP_NODE, &no_bgp_bestpath_med3_cmd);
9987
9988 /* "no bgp default ipv4-unicast" commands. */
9989 install_element (BGP_NODE, &no_bgp_default_ipv4_unicast_cmd);
9990 install_element (BGP_NODE, &bgp_default_ipv4_unicast_cmd);
9991
9992 /* "bgp network import-check" commands. */
9993 install_element (BGP_NODE, &bgp_network_import_check_cmd);
9994 install_element (BGP_NODE, &no_bgp_network_import_check_cmd);
9995
9996 /* "bgp default local-preference" commands. */
9997 install_element (BGP_NODE, &bgp_default_local_preference_cmd);
9998 install_element (BGP_NODE, &no_bgp_default_local_preference_cmd);
9999 install_element (BGP_NODE, &no_bgp_default_local_preference_val_cmd);
10000
10001 /* "neighbor remote-as" commands. */
10002 install_element (BGP_NODE, &neighbor_remote_as_cmd);
10003 install_element (BGP_NODE, &no_neighbor_cmd);
10004 install_element (BGP_NODE, &no_neighbor_remote_as_cmd);
10005
10006 /* "neighbor peer-group" commands. */
10007 install_element (BGP_NODE, &neighbor_peer_group_cmd);
10008 install_element (BGP_NODE, &no_neighbor_peer_group_cmd);
10009 install_element (BGP_NODE, &no_neighbor_peer_group_remote_as_cmd);
10010
10011 /* "neighbor local-as" commands. */
10012 install_element (BGP_NODE, &neighbor_local_as_cmd);
10013 install_element (BGP_NODE, &neighbor_local_as_no_prepend_cmd);
Andrew Certain9d3f9702012-11-07 23:50:07 +000010014 install_element (BGP_NODE, &neighbor_local_as_no_prepend_replace_as_cmd);
paul718e3742002-12-13 20:15:29 +000010015 install_element (BGP_NODE, &no_neighbor_local_as_cmd);
10016 install_element (BGP_NODE, &no_neighbor_local_as_val_cmd);
10017 install_element (BGP_NODE, &no_neighbor_local_as_val2_cmd);
Andrew Certain9d3f9702012-11-07 23:50:07 +000010018 install_element (BGP_NODE, &no_neighbor_local_as_val3_cmd);
paul718e3742002-12-13 20:15:29 +000010019
Paul Jakma0df7c912008-07-21 21:02:49 +000010020 /* "neighbor password" commands. */
10021 install_element (BGP_NODE, &neighbor_password_cmd);
10022 install_element (BGP_NODE, &no_neighbor_password_cmd);
10023
paul718e3742002-12-13 20:15:29 +000010024 /* "neighbor activate" commands. */
10025 install_element (BGP_NODE, &neighbor_activate_cmd);
10026 install_element (BGP_IPV4_NODE, &neighbor_activate_cmd);
10027 install_element (BGP_IPV4M_NODE, &neighbor_activate_cmd);
10028 install_element (BGP_IPV6_NODE, &neighbor_activate_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010029 install_element (BGP_IPV6M_NODE, &neighbor_activate_cmd);
paul718e3742002-12-13 20:15:29 +000010030 install_element (BGP_VPNV4_NODE, &neighbor_activate_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010031 install_element (BGP_VPNV6_NODE, &neighbor_activate_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010032 install_element (BGP_ENCAP_NODE, &neighbor_activate_cmd);
10033 install_element (BGP_ENCAPV6_NODE, &neighbor_activate_cmd);
paul718e3742002-12-13 20:15:29 +000010034
10035 /* "no neighbor activate" commands. */
10036 install_element (BGP_NODE, &no_neighbor_activate_cmd);
10037 install_element (BGP_IPV4_NODE, &no_neighbor_activate_cmd);
10038 install_element (BGP_IPV4M_NODE, &no_neighbor_activate_cmd);
10039 install_element (BGP_IPV6_NODE, &no_neighbor_activate_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010040 install_element (BGP_IPV6M_NODE, &no_neighbor_activate_cmd);
paul718e3742002-12-13 20:15:29 +000010041 install_element (BGP_VPNV4_NODE, &no_neighbor_activate_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010042 install_element (BGP_VPNV6_NODE, &no_neighbor_activate_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010043 install_element (BGP_ENCAP_NODE, &no_neighbor_activate_cmd);
10044 install_element (BGP_ENCAPV6_NODE, &no_neighbor_activate_cmd);
paul718e3742002-12-13 20:15:29 +000010045
10046 /* "neighbor peer-group set" commands. */
10047 install_element (BGP_NODE, &neighbor_set_peer_group_cmd);
10048 install_element (BGP_IPV4_NODE, &neighbor_set_peer_group_cmd);
10049 install_element (BGP_IPV4M_NODE, &neighbor_set_peer_group_cmd);
10050 install_element (BGP_IPV6_NODE, &neighbor_set_peer_group_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010051 install_element (BGP_IPV6M_NODE, &neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +000010052 install_element (BGP_VPNV4_NODE, &neighbor_set_peer_group_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010053 install_element (BGP_VPNV6_NODE, &neighbor_set_peer_group_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010054 install_element (BGP_ENCAP_NODE, &neighbor_set_peer_group_cmd);
10055 install_element (BGP_ENCAPV6_NODE, &neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +000010056
paul718e3742002-12-13 20:15:29 +000010057 /* "no neighbor peer-group unset" commands. */
10058 install_element (BGP_NODE, &no_neighbor_set_peer_group_cmd);
10059 install_element (BGP_IPV4_NODE, &no_neighbor_set_peer_group_cmd);
10060 install_element (BGP_IPV4M_NODE, &no_neighbor_set_peer_group_cmd);
10061 install_element (BGP_IPV6_NODE, &no_neighbor_set_peer_group_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010062 install_element (BGP_IPV6M_NODE, &no_neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +000010063 install_element (BGP_VPNV4_NODE, &no_neighbor_set_peer_group_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010064 install_element (BGP_VPNV6_NODE, &no_neighbor_set_peer_group_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010065 install_element (BGP_ENCAP_NODE, &no_neighbor_set_peer_group_cmd);
10066 install_element (BGP_ENCAPV6_NODE, &no_neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +000010067
paul718e3742002-12-13 20:15:29 +000010068 /* "neighbor softreconfiguration inbound" commands.*/
10069 install_element (BGP_NODE, &neighbor_soft_reconfiguration_cmd);
10070 install_element (BGP_NODE, &no_neighbor_soft_reconfiguration_cmd);
10071 install_element (BGP_IPV4_NODE, &neighbor_soft_reconfiguration_cmd);
10072 install_element (BGP_IPV4_NODE, &no_neighbor_soft_reconfiguration_cmd);
10073 install_element (BGP_IPV4M_NODE, &neighbor_soft_reconfiguration_cmd);
10074 install_element (BGP_IPV4M_NODE, &no_neighbor_soft_reconfiguration_cmd);
10075 install_element (BGP_IPV6_NODE, &neighbor_soft_reconfiguration_cmd);
10076 install_element (BGP_IPV6_NODE, &no_neighbor_soft_reconfiguration_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010077 install_element (BGP_IPV6M_NODE, &neighbor_soft_reconfiguration_cmd);
10078 install_element (BGP_IPV6M_NODE, &no_neighbor_soft_reconfiguration_cmd);
paula58545b2003-07-12 21:43:01 +000010079 install_element (BGP_VPNV4_NODE, &neighbor_soft_reconfiguration_cmd);
10080 install_element (BGP_VPNV4_NODE, &no_neighbor_soft_reconfiguration_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010081 install_element (BGP_VPNV6_NODE, &neighbor_soft_reconfiguration_cmd);
10082 install_element (BGP_VPNV6_NODE, &no_neighbor_soft_reconfiguration_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010083 install_element (BGP_ENCAP_NODE, &neighbor_soft_reconfiguration_cmd);
10084 install_element (BGP_ENCAP_NODE, &no_neighbor_soft_reconfiguration_cmd);
10085 install_element (BGP_ENCAPV6_NODE, &neighbor_soft_reconfiguration_cmd);
10086 install_element (BGP_ENCAPV6_NODE, &no_neighbor_soft_reconfiguration_cmd);
paul718e3742002-12-13 20:15:29 +000010087
10088 /* "neighbor attribute-unchanged" commands. */
10089 install_element (BGP_NODE, &neighbor_attr_unchanged_cmd);
10090 install_element (BGP_NODE, &neighbor_attr_unchanged1_cmd);
10091 install_element (BGP_NODE, &neighbor_attr_unchanged2_cmd);
10092 install_element (BGP_NODE, &neighbor_attr_unchanged3_cmd);
10093 install_element (BGP_NODE, &neighbor_attr_unchanged4_cmd);
10094 install_element (BGP_NODE, &neighbor_attr_unchanged5_cmd);
10095 install_element (BGP_NODE, &neighbor_attr_unchanged6_cmd);
10096 install_element (BGP_NODE, &neighbor_attr_unchanged7_cmd);
10097 install_element (BGP_NODE, &neighbor_attr_unchanged8_cmd);
10098 install_element (BGP_NODE, &neighbor_attr_unchanged9_cmd);
10099 install_element (BGP_NODE, &neighbor_attr_unchanged10_cmd);
10100 install_element (BGP_NODE, &no_neighbor_attr_unchanged_cmd);
10101 install_element (BGP_NODE, &no_neighbor_attr_unchanged1_cmd);
10102 install_element (BGP_NODE, &no_neighbor_attr_unchanged2_cmd);
10103 install_element (BGP_NODE, &no_neighbor_attr_unchanged3_cmd);
10104 install_element (BGP_NODE, &no_neighbor_attr_unchanged4_cmd);
10105 install_element (BGP_NODE, &no_neighbor_attr_unchanged5_cmd);
10106 install_element (BGP_NODE, &no_neighbor_attr_unchanged6_cmd);
10107 install_element (BGP_NODE, &no_neighbor_attr_unchanged7_cmd);
10108 install_element (BGP_NODE, &no_neighbor_attr_unchanged8_cmd);
10109 install_element (BGP_NODE, &no_neighbor_attr_unchanged9_cmd);
10110 install_element (BGP_NODE, &no_neighbor_attr_unchanged10_cmd);
10111 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged_cmd);
10112 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged1_cmd);
10113 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged2_cmd);
10114 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged3_cmd);
10115 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged4_cmd);
10116 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged5_cmd);
10117 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged6_cmd);
10118 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged7_cmd);
10119 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged8_cmd);
10120 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged9_cmd);
10121 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged10_cmd);
10122 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged_cmd);
10123 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged1_cmd);
10124 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged2_cmd);
10125 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged3_cmd);
10126 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged4_cmd);
10127 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged5_cmd);
10128 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged6_cmd);
10129 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged7_cmd);
10130 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged8_cmd);
10131 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged9_cmd);
10132 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged10_cmd);
10133 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged_cmd);
10134 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged1_cmd);
10135 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged2_cmd);
10136 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged3_cmd);
10137 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged4_cmd);
10138 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged5_cmd);
10139 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged6_cmd);
10140 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged7_cmd);
10141 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged8_cmd);
10142 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged9_cmd);
10143 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged10_cmd);
10144 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged_cmd);
10145 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged1_cmd);
10146 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged2_cmd);
10147 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged3_cmd);
10148 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged4_cmd);
10149 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged5_cmd);
10150 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged6_cmd);
10151 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged7_cmd);
10152 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged8_cmd);
10153 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged9_cmd);
10154 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged10_cmd);
10155 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged_cmd);
10156 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged1_cmd);
10157 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged2_cmd);
10158 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged3_cmd);
10159 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged4_cmd);
10160 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged5_cmd);
10161 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged6_cmd);
10162 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged7_cmd);
10163 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged8_cmd);
10164 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged9_cmd);
10165 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged10_cmd);
10166 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged_cmd);
10167 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged1_cmd);
10168 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged2_cmd);
10169 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged3_cmd);
10170 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged4_cmd);
10171 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged5_cmd);
10172 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged6_cmd);
10173 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged7_cmd);
10174 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged8_cmd);
10175 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged9_cmd);
10176 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged10_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010177 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged_cmd);
10178 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged1_cmd);
10179 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged2_cmd);
10180 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged3_cmd);
10181 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged4_cmd);
10182 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged5_cmd);
10183 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged6_cmd);
10184 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged7_cmd);
10185 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged8_cmd);
10186 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged9_cmd);
10187 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged10_cmd);
10188 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged_cmd);
10189 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged1_cmd);
10190 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged2_cmd);
10191 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged3_cmd);
10192 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged4_cmd);
10193 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged5_cmd);
10194 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged6_cmd);
10195 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged7_cmd);
10196 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged8_cmd);
10197 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged9_cmd);
10198 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged10_cmd);
paul718e3742002-12-13 20:15:29 +000010199 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged_cmd);
10200 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged1_cmd);
10201 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged2_cmd);
10202 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged3_cmd);
10203 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged4_cmd);
10204 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged5_cmd);
10205 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged6_cmd);
10206 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged7_cmd);
10207 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged8_cmd);
10208 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged9_cmd);
10209 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged10_cmd);
10210 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged_cmd);
10211 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged1_cmd);
10212 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged2_cmd);
10213 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged3_cmd);
10214 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged4_cmd);
10215 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged5_cmd);
10216 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged6_cmd);
10217 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged7_cmd);
10218 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged8_cmd);
10219 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged9_cmd);
10220 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged10_cmd);
10221
Lou Berger13c378d2016-01-12 13:41:56 -050010222 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged_cmd);
10223 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged1_cmd);
10224 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged2_cmd);
10225 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged3_cmd);
10226 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged4_cmd);
10227 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged5_cmd);
10228 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged6_cmd);
10229 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged7_cmd);
10230 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged8_cmd);
10231 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged9_cmd);
10232 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged10_cmd);
10233 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged_cmd);
10234 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged1_cmd);
10235 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged2_cmd);
10236 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged3_cmd);
10237 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged4_cmd);
10238 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged5_cmd);
10239 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged6_cmd);
10240 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged7_cmd);
10241 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged8_cmd);
10242 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged9_cmd);
10243 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged10_cmd);
10244
Lou Bergera3fda882016-01-12 13:42:04 -050010245 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged_cmd);
10246 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged1_cmd);
10247 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged2_cmd);
10248 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged3_cmd);
10249 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged4_cmd);
10250 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged5_cmd);
10251 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged6_cmd);
10252 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged7_cmd);
10253 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged8_cmd);
10254 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged9_cmd);
10255 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged10_cmd);
10256 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged_cmd);
10257 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged1_cmd);
10258 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged2_cmd);
10259 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged3_cmd);
10260 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged4_cmd);
10261 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged5_cmd);
10262 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged6_cmd);
10263 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged7_cmd);
10264 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged8_cmd);
10265 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged9_cmd);
10266 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged10_cmd);
10267
10268 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged_cmd);
10269 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged1_cmd);
10270 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged2_cmd);
10271 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged3_cmd);
10272 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged4_cmd);
10273 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged5_cmd);
10274 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged6_cmd);
10275 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged7_cmd);
10276 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged8_cmd);
10277 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged9_cmd);
10278 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged10_cmd);
10279 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged_cmd);
10280 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged1_cmd);
10281 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged2_cmd);
10282 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged3_cmd);
10283 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged4_cmd);
10284 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged5_cmd);
10285 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged6_cmd);
10286 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged7_cmd);
10287 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged8_cmd);
10288 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged9_cmd);
10289 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged10_cmd);
10290
paulfee0f4c2004-09-13 05:12:46 +000010291 /* "nexthop-local unchanged" commands */
10292 install_element (BGP_IPV6_NODE, &neighbor_nexthop_local_unchanged_cmd);
10293 install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_local_unchanged_cmd);
10294
paul718e3742002-12-13 20:15:29 +000010295 /* "transparent-as" and "transparent-nexthop" for old version
10296 compatibility. */
10297 install_element (BGP_NODE, &neighbor_transparent_as_cmd);
10298 install_element (BGP_NODE, &neighbor_transparent_nexthop_cmd);
10299
10300 /* "neighbor next-hop-self" commands. */
10301 install_element (BGP_NODE, &neighbor_nexthop_self_cmd);
10302 install_element (BGP_NODE, &no_neighbor_nexthop_self_cmd);
10303 install_element (BGP_IPV4_NODE, &neighbor_nexthop_self_cmd);
10304 install_element (BGP_IPV4_NODE, &no_neighbor_nexthop_self_cmd);
10305 install_element (BGP_IPV4M_NODE, &neighbor_nexthop_self_cmd);
10306 install_element (BGP_IPV4M_NODE, &no_neighbor_nexthop_self_cmd);
10307 install_element (BGP_IPV6_NODE, &neighbor_nexthop_self_cmd);
10308 install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_self_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010309 install_element (BGP_IPV6M_NODE, &neighbor_nexthop_self_cmd);
10310 install_element (BGP_IPV6M_NODE, &no_neighbor_nexthop_self_cmd);
paul718e3742002-12-13 20:15:29 +000010311 install_element (BGP_VPNV4_NODE, &neighbor_nexthop_self_cmd);
10312 install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010313 install_element (BGP_VPNV6_NODE, &neighbor_nexthop_self_cmd);
10314 install_element (BGP_VPNV6_NODE, &no_neighbor_nexthop_self_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010315 install_element (BGP_ENCAP_NODE, &neighbor_nexthop_self_cmd);
10316 install_element (BGP_ENCAP_NODE, &no_neighbor_nexthop_self_cmd);
10317 install_element (BGP_ENCAPV6_NODE, &neighbor_nexthop_self_cmd);
10318 install_element (BGP_ENCAPV6_NODE, &no_neighbor_nexthop_self_cmd);
paul718e3742002-12-13 20:15:29 +000010319
10320 /* "neighbor remove-private-AS" commands. */
10321 install_element (BGP_NODE, &neighbor_remove_private_as_cmd);
10322 install_element (BGP_NODE, &no_neighbor_remove_private_as_cmd);
10323 install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_cmd);
10324 install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_cmd);
10325 install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_cmd);
10326 install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_cmd);
10327 install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_cmd);
10328 install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010329 install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_cmd);
10330 install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_cmd);
paul718e3742002-12-13 20:15:29 +000010331 install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_cmd);
10332 install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010333 install_element (BGP_VPNV6_NODE, &neighbor_remove_private_as_cmd);
10334 install_element (BGP_VPNV6_NODE, &no_neighbor_remove_private_as_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010335 install_element (BGP_ENCAP_NODE, &neighbor_remove_private_as_cmd);
10336 install_element (BGP_ENCAP_NODE, &no_neighbor_remove_private_as_cmd);
10337 install_element (BGP_ENCAPV6_NODE, &neighbor_remove_private_as_cmd);
10338 install_element (BGP_ENCAPV6_NODE, &no_neighbor_remove_private_as_cmd);
paul718e3742002-12-13 20:15:29 +000010339
10340 /* "neighbor send-community" commands.*/
10341 install_element (BGP_NODE, &neighbor_send_community_cmd);
10342 install_element (BGP_NODE, &neighbor_send_community_type_cmd);
10343 install_element (BGP_NODE, &no_neighbor_send_community_cmd);
10344 install_element (BGP_NODE, &no_neighbor_send_community_type_cmd);
10345 install_element (BGP_IPV4_NODE, &neighbor_send_community_cmd);
10346 install_element (BGP_IPV4_NODE, &neighbor_send_community_type_cmd);
10347 install_element (BGP_IPV4_NODE, &no_neighbor_send_community_cmd);
10348 install_element (BGP_IPV4_NODE, &no_neighbor_send_community_type_cmd);
10349 install_element (BGP_IPV4M_NODE, &neighbor_send_community_cmd);
10350 install_element (BGP_IPV4M_NODE, &neighbor_send_community_type_cmd);
10351 install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_cmd);
10352 install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_type_cmd);
10353 install_element (BGP_IPV6_NODE, &neighbor_send_community_cmd);
10354 install_element (BGP_IPV6_NODE, &neighbor_send_community_type_cmd);
10355 install_element (BGP_IPV6_NODE, &no_neighbor_send_community_cmd);
10356 install_element (BGP_IPV6_NODE, &no_neighbor_send_community_type_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010357 install_element (BGP_IPV6M_NODE, &neighbor_send_community_cmd);
10358 install_element (BGP_IPV6M_NODE, &neighbor_send_community_type_cmd);
10359 install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_cmd);
10360 install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_type_cmd);
paul718e3742002-12-13 20:15:29 +000010361 install_element (BGP_VPNV4_NODE, &neighbor_send_community_cmd);
10362 install_element (BGP_VPNV4_NODE, &neighbor_send_community_type_cmd);
10363 install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_cmd);
10364 install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_type_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010365 install_element (BGP_VPNV6_NODE, &neighbor_send_community_cmd);
10366 install_element (BGP_VPNV6_NODE, &neighbor_send_community_type_cmd);
10367 install_element (BGP_VPNV6_NODE, &no_neighbor_send_community_cmd);
10368 install_element (BGP_VPNV6_NODE, &no_neighbor_send_community_type_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010369 install_element (BGP_ENCAP_NODE, &neighbor_send_community_cmd);
10370 install_element (BGP_ENCAP_NODE, &neighbor_send_community_type_cmd);
10371 install_element (BGP_ENCAP_NODE, &no_neighbor_send_community_cmd);
10372 install_element (BGP_ENCAP_NODE, &no_neighbor_send_community_type_cmd);
10373 install_element (BGP_ENCAPV6_NODE, &neighbor_send_community_cmd);
10374 install_element (BGP_ENCAPV6_NODE, &neighbor_send_community_type_cmd);
10375 install_element (BGP_ENCAPV6_NODE, &no_neighbor_send_community_cmd);
10376 install_element (BGP_ENCAPV6_NODE, &no_neighbor_send_community_type_cmd);
paul718e3742002-12-13 20:15:29 +000010377
10378 /* "neighbor route-reflector" commands.*/
10379 install_element (BGP_NODE, &neighbor_route_reflector_client_cmd);
10380 install_element (BGP_NODE, &no_neighbor_route_reflector_client_cmd);
10381 install_element (BGP_IPV4_NODE, &neighbor_route_reflector_client_cmd);
10382 install_element (BGP_IPV4_NODE, &no_neighbor_route_reflector_client_cmd);
10383 install_element (BGP_IPV4M_NODE, &neighbor_route_reflector_client_cmd);
10384 install_element (BGP_IPV4M_NODE, &no_neighbor_route_reflector_client_cmd);
10385 install_element (BGP_IPV6_NODE, &neighbor_route_reflector_client_cmd);
10386 install_element (BGP_IPV6_NODE, &no_neighbor_route_reflector_client_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010387 install_element (BGP_IPV6M_NODE, &neighbor_route_reflector_client_cmd);
10388 install_element (BGP_IPV6M_NODE, &no_neighbor_route_reflector_client_cmd);
paul718e3742002-12-13 20:15:29 +000010389 install_element (BGP_VPNV4_NODE, &neighbor_route_reflector_client_cmd);
10390 install_element (BGP_VPNV4_NODE, &no_neighbor_route_reflector_client_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010391 install_element (BGP_VPNV6_NODE, &neighbor_route_reflector_client_cmd);
10392 install_element (BGP_VPNV6_NODE, &no_neighbor_route_reflector_client_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010393 install_element (BGP_ENCAP_NODE, &neighbor_route_reflector_client_cmd);
10394 install_element (BGP_ENCAP_NODE, &no_neighbor_route_reflector_client_cmd);
10395 install_element (BGP_ENCAPV6_NODE, &neighbor_route_reflector_client_cmd);
10396 install_element (BGP_ENCAPV6_NODE, &no_neighbor_route_reflector_client_cmd);
paul718e3742002-12-13 20:15:29 +000010397
10398 /* "neighbor route-server" commands.*/
10399 install_element (BGP_NODE, &neighbor_route_server_client_cmd);
10400 install_element (BGP_NODE, &no_neighbor_route_server_client_cmd);
10401 install_element (BGP_IPV4_NODE, &neighbor_route_server_client_cmd);
10402 install_element (BGP_IPV4_NODE, &no_neighbor_route_server_client_cmd);
10403 install_element (BGP_IPV4M_NODE, &neighbor_route_server_client_cmd);
10404 install_element (BGP_IPV4M_NODE, &no_neighbor_route_server_client_cmd);
10405 install_element (BGP_IPV6_NODE, &neighbor_route_server_client_cmd);
10406 install_element (BGP_IPV6_NODE, &no_neighbor_route_server_client_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010407 install_element (BGP_IPV6M_NODE, &neighbor_route_server_client_cmd);
10408 install_element (BGP_IPV6M_NODE, &no_neighbor_route_server_client_cmd);
paul718e3742002-12-13 20:15:29 +000010409 install_element (BGP_VPNV4_NODE, &neighbor_route_server_client_cmd);
10410 install_element (BGP_VPNV4_NODE, &no_neighbor_route_server_client_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010411 install_element (BGP_VPNV6_NODE, &neighbor_route_server_client_cmd);
10412 install_element (BGP_VPNV6_NODE, &no_neighbor_route_server_client_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010413 install_element (BGP_ENCAP_NODE, &neighbor_route_server_client_cmd);
10414 install_element (BGP_ENCAP_NODE, &no_neighbor_route_server_client_cmd);
10415 install_element (BGP_ENCAPV6_NODE, &neighbor_route_server_client_cmd);
10416 install_element (BGP_ENCAPV6_NODE, &no_neighbor_route_server_client_cmd);
paul718e3742002-12-13 20:15:29 +000010417
10418 /* "neighbor passive" commands. */
10419 install_element (BGP_NODE, &neighbor_passive_cmd);
10420 install_element (BGP_NODE, &no_neighbor_passive_cmd);
10421
10422 /* "neighbor shutdown" commands. */
10423 install_element (BGP_NODE, &neighbor_shutdown_cmd);
10424 install_element (BGP_NODE, &no_neighbor_shutdown_cmd);
10425
hassoc9502432005-02-01 22:01:48 +000010426 /* Deprecated "neighbor capability route-refresh" commands.*/
paul718e3742002-12-13 20:15:29 +000010427 install_element (BGP_NODE, &neighbor_capability_route_refresh_cmd);
10428 install_element (BGP_NODE, &no_neighbor_capability_route_refresh_cmd);
10429
10430 /* "neighbor capability orf prefix-list" commands.*/
10431 install_element (BGP_NODE, &neighbor_capability_orf_prefix_cmd);
10432 install_element (BGP_NODE, &no_neighbor_capability_orf_prefix_cmd);
10433 install_element (BGP_IPV4_NODE, &neighbor_capability_orf_prefix_cmd);
10434 install_element (BGP_IPV4_NODE, &no_neighbor_capability_orf_prefix_cmd);
10435 install_element (BGP_IPV4M_NODE, &neighbor_capability_orf_prefix_cmd);
10436 install_element (BGP_IPV4M_NODE, &no_neighbor_capability_orf_prefix_cmd);
10437 install_element (BGP_IPV6_NODE, &neighbor_capability_orf_prefix_cmd);
10438 install_element (BGP_IPV6_NODE, &no_neighbor_capability_orf_prefix_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010439 install_element (BGP_IPV6M_NODE, &neighbor_capability_orf_prefix_cmd);
10440 install_element (BGP_IPV6M_NODE, &no_neighbor_capability_orf_prefix_cmd);
paul718e3742002-12-13 20:15:29 +000010441
10442 /* "neighbor capability dynamic" commands.*/
10443 install_element (BGP_NODE, &neighbor_capability_dynamic_cmd);
10444 install_element (BGP_NODE, &no_neighbor_capability_dynamic_cmd);
10445
10446 /* "neighbor dont-capability-negotiate" commands. */
10447 install_element (BGP_NODE, &neighbor_dont_capability_negotiate_cmd);
10448 install_element (BGP_NODE, &no_neighbor_dont_capability_negotiate_cmd);
10449
10450 /* "neighbor ebgp-multihop" commands. */
10451 install_element (BGP_NODE, &neighbor_ebgp_multihop_cmd);
10452 install_element (BGP_NODE, &neighbor_ebgp_multihop_ttl_cmd);
10453 install_element (BGP_NODE, &no_neighbor_ebgp_multihop_cmd);
10454 install_element (BGP_NODE, &no_neighbor_ebgp_multihop_ttl_cmd);
10455
hasso6ffd2072005-02-02 14:50:11 +000010456 /* "neighbor disable-connected-check" commands. */
10457 install_element (BGP_NODE, &neighbor_disable_connected_check_cmd);
10458 install_element (BGP_NODE, &no_neighbor_disable_connected_check_cmd);
paul718e3742002-12-13 20:15:29 +000010459 install_element (BGP_NODE, &neighbor_enforce_multihop_cmd);
10460 install_element (BGP_NODE, &no_neighbor_enforce_multihop_cmd);
10461
10462 /* "neighbor description" commands. */
10463 install_element (BGP_NODE, &neighbor_description_cmd);
10464 install_element (BGP_NODE, &no_neighbor_description_cmd);
10465 install_element (BGP_NODE, &no_neighbor_description_val_cmd);
10466
10467 /* "neighbor update-source" commands. "*/
10468 install_element (BGP_NODE, &neighbor_update_source_cmd);
10469 install_element (BGP_NODE, &no_neighbor_update_source_cmd);
10470
10471 /* "neighbor default-originate" commands. */
10472 install_element (BGP_NODE, &neighbor_default_originate_cmd);
10473 install_element (BGP_NODE, &neighbor_default_originate_rmap_cmd);
10474 install_element (BGP_NODE, &no_neighbor_default_originate_cmd);
10475 install_element (BGP_NODE, &no_neighbor_default_originate_rmap_cmd);
10476 install_element (BGP_IPV4_NODE, &neighbor_default_originate_cmd);
10477 install_element (BGP_IPV4_NODE, &neighbor_default_originate_rmap_cmd);
10478 install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_cmd);
10479 install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_rmap_cmd);
10480 install_element (BGP_IPV4M_NODE, &neighbor_default_originate_cmd);
10481 install_element (BGP_IPV4M_NODE, &neighbor_default_originate_rmap_cmd);
10482 install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_cmd);
10483 install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_rmap_cmd);
10484 install_element (BGP_IPV6_NODE, &neighbor_default_originate_cmd);
10485 install_element (BGP_IPV6_NODE, &neighbor_default_originate_rmap_cmd);
10486 install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_cmd);
10487 install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_rmap_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010488 install_element (BGP_IPV6M_NODE, &neighbor_default_originate_cmd);
10489 install_element (BGP_IPV6M_NODE, &neighbor_default_originate_rmap_cmd);
10490 install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_cmd);
10491 install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_rmap_cmd);
paul718e3742002-12-13 20:15:29 +000010492
10493 /* "neighbor port" commands. */
10494 install_element (BGP_NODE, &neighbor_port_cmd);
10495 install_element (BGP_NODE, &no_neighbor_port_cmd);
10496 install_element (BGP_NODE, &no_neighbor_port_val_cmd);
10497
10498 /* "neighbor weight" commands. */
10499 install_element (BGP_NODE, &neighbor_weight_cmd);
10500 install_element (BGP_NODE, &no_neighbor_weight_cmd);
10501 install_element (BGP_NODE, &no_neighbor_weight_val_cmd);
10502
10503 /* "neighbor override-capability" commands. */
10504 install_element (BGP_NODE, &neighbor_override_capability_cmd);
10505 install_element (BGP_NODE, &no_neighbor_override_capability_cmd);
10506
10507 /* "neighbor strict-capability-match" commands. */
10508 install_element (BGP_NODE, &neighbor_strict_capability_cmd);
10509 install_element (BGP_NODE, &no_neighbor_strict_capability_cmd);
10510
10511 /* "neighbor timers" commands. */
10512 install_element (BGP_NODE, &neighbor_timers_cmd);
10513 install_element (BGP_NODE, &no_neighbor_timers_cmd);
10514
10515 /* "neighbor timers connect" commands. */
10516 install_element (BGP_NODE, &neighbor_timers_connect_cmd);
10517 install_element (BGP_NODE, &no_neighbor_timers_connect_cmd);
10518 install_element (BGP_NODE, &no_neighbor_timers_connect_val_cmd);
10519
10520 /* "neighbor advertisement-interval" commands. */
10521 install_element (BGP_NODE, &neighbor_advertise_interval_cmd);
10522 install_element (BGP_NODE, &no_neighbor_advertise_interval_cmd);
10523 install_element (BGP_NODE, &no_neighbor_advertise_interval_val_cmd);
10524
10525 /* "neighbor version" commands. */
10526 install_element (BGP_NODE, &neighbor_version_cmd);
paul718e3742002-12-13 20:15:29 +000010527
10528 /* "neighbor interface" commands. */
10529 install_element (BGP_NODE, &neighbor_interface_cmd);
10530 install_element (BGP_NODE, &no_neighbor_interface_cmd);
10531
10532 /* "neighbor distribute" commands. */
10533 install_element (BGP_NODE, &neighbor_distribute_list_cmd);
10534 install_element (BGP_NODE, &no_neighbor_distribute_list_cmd);
10535 install_element (BGP_IPV4_NODE, &neighbor_distribute_list_cmd);
10536 install_element (BGP_IPV4_NODE, &no_neighbor_distribute_list_cmd);
10537 install_element (BGP_IPV4M_NODE, &neighbor_distribute_list_cmd);
10538 install_element (BGP_IPV4M_NODE, &no_neighbor_distribute_list_cmd);
10539 install_element (BGP_IPV6_NODE, &neighbor_distribute_list_cmd);
10540 install_element (BGP_IPV6_NODE, &no_neighbor_distribute_list_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010541 install_element (BGP_IPV6M_NODE, &neighbor_distribute_list_cmd);
10542 install_element (BGP_IPV6M_NODE, &no_neighbor_distribute_list_cmd);
paul718e3742002-12-13 20:15:29 +000010543 install_element (BGP_VPNV4_NODE, &neighbor_distribute_list_cmd);
10544 install_element (BGP_VPNV4_NODE, &no_neighbor_distribute_list_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010545 install_element (BGP_VPNV6_NODE, &neighbor_distribute_list_cmd);
10546 install_element (BGP_VPNV6_NODE, &no_neighbor_distribute_list_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010547 install_element (BGP_ENCAP_NODE, &neighbor_distribute_list_cmd);
10548 install_element (BGP_ENCAP_NODE, &no_neighbor_distribute_list_cmd);
10549 install_element (BGP_ENCAPV6_NODE, &neighbor_distribute_list_cmd);
10550 install_element (BGP_ENCAPV6_NODE, &no_neighbor_distribute_list_cmd);
paul718e3742002-12-13 20:15:29 +000010551
10552 /* "neighbor prefix-list" commands. */
10553 install_element (BGP_NODE, &neighbor_prefix_list_cmd);
10554 install_element (BGP_NODE, &no_neighbor_prefix_list_cmd);
10555 install_element (BGP_IPV4_NODE, &neighbor_prefix_list_cmd);
10556 install_element (BGP_IPV4_NODE, &no_neighbor_prefix_list_cmd);
10557 install_element (BGP_IPV4M_NODE, &neighbor_prefix_list_cmd);
10558 install_element (BGP_IPV4M_NODE, &no_neighbor_prefix_list_cmd);
10559 install_element (BGP_IPV6_NODE, &neighbor_prefix_list_cmd);
10560 install_element (BGP_IPV6_NODE, &no_neighbor_prefix_list_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010561 install_element (BGP_IPV6M_NODE, &neighbor_prefix_list_cmd);
10562 install_element (BGP_IPV6M_NODE, &no_neighbor_prefix_list_cmd);
paul718e3742002-12-13 20:15:29 +000010563 install_element (BGP_VPNV4_NODE, &neighbor_prefix_list_cmd);
10564 install_element (BGP_VPNV4_NODE, &no_neighbor_prefix_list_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010565 install_element (BGP_VPNV6_NODE, &neighbor_prefix_list_cmd);
10566 install_element (BGP_VPNV6_NODE, &no_neighbor_prefix_list_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010567 install_element (BGP_ENCAP_NODE, &neighbor_prefix_list_cmd);
10568 install_element (BGP_ENCAP_NODE, &no_neighbor_prefix_list_cmd);
10569 install_element (BGP_ENCAPV6_NODE, &neighbor_prefix_list_cmd);
10570 install_element (BGP_ENCAPV6_NODE, &no_neighbor_prefix_list_cmd);
paul718e3742002-12-13 20:15:29 +000010571
10572 /* "neighbor filter-list" commands. */
10573 install_element (BGP_NODE, &neighbor_filter_list_cmd);
10574 install_element (BGP_NODE, &no_neighbor_filter_list_cmd);
10575 install_element (BGP_IPV4_NODE, &neighbor_filter_list_cmd);
10576 install_element (BGP_IPV4_NODE, &no_neighbor_filter_list_cmd);
10577 install_element (BGP_IPV4M_NODE, &neighbor_filter_list_cmd);
10578 install_element (BGP_IPV4M_NODE, &no_neighbor_filter_list_cmd);
10579 install_element (BGP_IPV6_NODE, &neighbor_filter_list_cmd);
10580 install_element (BGP_IPV6_NODE, &no_neighbor_filter_list_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010581 install_element (BGP_IPV6M_NODE, &neighbor_filter_list_cmd);
10582 install_element (BGP_IPV6M_NODE, &no_neighbor_filter_list_cmd);
paul718e3742002-12-13 20:15:29 +000010583 install_element (BGP_VPNV4_NODE, &neighbor_filter_list_cmd);
10584 install_element (BGP_VPNV4_NODE, &no_neighbor_filter_list_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010585 install_element (BGP_VPNV6_NODE, &neighbor_filter_list_cmd);
10586 install_element (BGP_VPNV6_NODE, &no_neighbor_filter_list_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010587 install_element (BGP_ENCAP_NODE, &neighbor_filter_list_cmd);
10588 install_element (BGP_ENCAP_NODE, &no_neighbor_filter_list_cmd);
10589 install_element (BGP_ENCAPV6_NODE, &neighbor_filter_list_cmd);
10590 install_element (BGP_ENCAPV6_NODE, &no_neighbor_filter_list_cmd);
paul718e3742002-12-13 20:15:29 +000010591
10592 /* "neighbor route-map" commands. */
10593 install_element (BGP_NODE, &neighbor_route_map_cmd);
10594 install_element (BGP_NODE, &no_neighbor_route_map_cmd);
10595 install_element (BGP_IPV4_NODE, &neighbor_route_map_cmd);
10596 install_element (BGP_IPV4_NODE, &no_neighbor_route_map_cmd);
10597 install_element (BGP_IPV4M_NODE, &neighbor_route_map_cmd);
10598 install_element (BGP_IPV4M_NODE, &no_neighbor_route_map_cmd);
10599 install_element (BGP_IPV6_NODE, &neighbor_route_map_cmd);
10600 install_element (BGP_IPV6_NODE, &no_neighbor_route_map_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010601 install_element (BGP_IPV6M_NODE, &neighbor_route_map_cmd);
10602 install_element (BGP_IPV6M_NODE, &no_neighbor_route_map_cmd);
paul718e3742002-12-13 20:15:29 +000010603 install_element (BGP_VPNV4_NODE, &neighbor_route_map_cmd);
10604 install_element (BGP_VPNV4_NODE, &no_neighbor_route_map_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010605 install_element (BGP_VPNV6_NODE, &neighbor_route_map_cmd);
10606 install_element (BGP_VPNV6_NODE, &no_neighbor_route_map_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010607 install_element (BGP_ENCAP_NODE, &neighbor_route_map_cmd);
10608 install_element (BGP_ENCAP_NODE, &no_neighbor_route_map_cmd);
10609 install_element (BGP_ENCAPV6_NODE, &neighbor_route_map_cmd);
10610 install_element (BGP_ENCAPV6_NODE, &no_neighbor_route_map_cmd);
paul718e3742002-12-13 20:15:29 +000010611
10612 /* "neighbor unsuppress-map" commands. */
10613 install_element (BGP_NODE, &neighbor_unsuppress_map_cmd);
10614 install_element (BGP_NODE, &no_neighbor_unsuppress_map_cmd);
10615 install_element (BGP_IPV4_NODE, &neighbor_unsuppress_map_cmd);
10616 install_element (BGP_IPV4_NODE, &no_neighbor_unsuppress_map_cmd);
10617 install_element (BGP_IPV4M_NODE, &neighbor_unsuppress_map_cmd);
10618 install_element (BGP_IPV4M_NODE, &no_neighbor_unsuppress_map_cmd);
10619 install_element (BGP_IPV6_NODE, &neighbor_unsuppress_map_cmd);
10620 install_element (BGP_IPV6_NODE, &no_neighbor_unsuppress_map_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010621 install_element (BGP_IPV6M_NODE, &neighbor_unsuppress_map_cmd);
10622 install_element (BGP_IPV6M_NODE, &no_neighbor_unsuppress_map_cmd);
paula58545b2003-07-12 21:43:01 +000010623 install_element (BGP_VPNV4_NODE, &neighbor_unsuppress_map_cmd);
Lou Berger82dd7072016-01-12 13:41:57 -050010624 install_element (BGP_VPNV4_NODE, &no_neighbor_unsuppress_map_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010625 install_element (BGP_VPNV6_NODE, &neighbor_unsuppress_map_cmd);
Lou Berger82dd7072016-01-12 13:41:57 -050010626 install_element (BGP_VPNV6_NODE, &no_neighbor_unsuppress_map_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010627 install_element (BGP_ENCAP_NODE, &neighbor_unsuppress_map_cmd);
10628 install_element (BGP_ENCAP_NODE, &no_neighbor_unsuppress_map_cmd);
10629 install_element (BGP_ENCAPV6_NODE, &neighbor_unsuppress_map_cmd);
10630 install_element (BGP_ENCAPV6_NODE, &no_neighbor_unsuppress_map_cmd);
paul718e3742002-12-13 20:15:29 +000010631
10632 /* "neighbor maximum-prefix" commands. */
10633 install_element (BGP_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +000010634 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +000010635 install_element (BGP_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +000010636 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +000010637 install_element (BGP_NODE, &neighbor_maximum_prefix_restart_cmd);
10638 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010639 install_element (BGP_NODE, &no_neighbor_maximum_prefix_cmd);
10640 install_element (BGP_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +000010641 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10642 install_element (BGP_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10643 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10644 install_element (BGP_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10645 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010646 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +000010647 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +000010648 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +000010649 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +000010650 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_restart_cmd);
10651 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010652 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_cmd);
10653 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +000010654 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10655 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10656 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10657 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10658 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010659 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +000010660 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +000010661 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +000010662 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +000010663 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_restart_cmd);
10664 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010665 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_cmd);
10666 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +000010667 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10668 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10669 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10670 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10671 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010672 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +000010673 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +000010674 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +000010675 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +000010676 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_restart_cmd);
10677 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010678 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_cmd);
10679 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +000010680 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10681 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10682 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10683 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10684 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010685 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_cmd);
10686 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_cmd);
10687 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_warning_cmd);
10688 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
10689 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_restart_cmd);
10690 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
10691 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_cmd);
10692 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_val_cmd);
10693 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10694 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10695 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10696 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10697 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010698 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +000010699 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +000010700 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +000010701 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +000010702 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_restart_cmd);
10703 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010704 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_cmd);
10705 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +000010706 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10707 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10708 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10709 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10710 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010711
Lou Berger13c378d2016-01-12 13:41:56 -050010712 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_cmd);
10713 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_threshold_cmd);
10714 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_warning_cmd);
10715 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
10716 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_restart_cmd);
10717 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
10718 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_cmd);
10719 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_val_cmd);
10720 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10721 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10722 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10723 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10724 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
10725
Lou Bergera3fda882016-01-12 13:42:04 -050010726 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_cmd);
10727 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_threshold_cmd);
10728 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_warning_cmd);
10729 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
10730 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_restart_cmd);
10731 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
10732 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_cmd);
10733 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_val_cmd);
10734 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10735 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10736 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10737 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10738 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
10739
10740 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_cmd);
10741 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_threshold_cmd);
10742 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_warning_cmd);
10743 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
10744 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_restart_cmd);
10745 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
10746 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_cmd);
10747 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_val_cmd);
10748 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10749 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10750 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10751 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10752 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
10753
paul718e3742002-12-13 20:15:29 +000010754 /* "neighbor allowas-in" */
10755 install_element (BGP_NODE, &neighbor_allowas_in_cmd);
10756 install_element (BGP_NODE, &neighbor_allowas_in_arg_cmd);
10757 install_element (BGP_NODE, &no_neighbor_allowas_in_cmd);
10758 install_element (BGP_IPV4_NODE, &neighbor_allowas_in_cmd);
10759 install_element (BGP_IPV4_NODE, &neighbor_allowas_in_arg_cmd);
10760 install_element (BGP_IPV4_NODE, &no_neighbor_allowas_in_cmd);
10761 install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_cmd);
10762 install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_arg_cmd);
10763 install_element (BGP_IPV4M_NODE, &no_neighbor_allowas_in_cmd);
10764 install_element (BGP_IPV6_NODE, &neighbor_allowas_in_cmd);
10765 install_element (BGP_IPV6_NODE, &neighbor_allowas_in_arg_cmd);
10766 install_element (BGP_IPV6_NODE, &no_neighbor_allowas_in_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010767 install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_cmd);
10768 install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_arg_cmd);
10769 install_element (BGP_IPV6M_NODE, &no_neighbor_allowas_in_cmd);
paul718e3742002-12-13 20:15:29 +000010770 install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_cmd);
10771 install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_arg_cmd);
10772 install_element (BGP_VPNV4_NODE, &no_neighbor_allowas_in_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010773 install_element (BGP_VPNV6_NODE, &neighbor_allowas_in_cmd);
10774 install_element (BGP_VPNV6_NODE, &neighbor_allowas_in_arg_cmd);
10775 install_element (BGP_VPNV6_NODE, &no_neighbor_allowas_in_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010776 install_element (BGP_ENCAP_NODE, &neighbor_allowas_in_cmd);
10777 install_element (BGP_ENCAP_NODE, &neighbor_allowas_in_arg_cmd);
10778 install_element (BGP_ENCAP_NODE, &no_neighbor_allowas_in_cmd);
10779 install_element (BGP_ENCAPV6_NODE, &neighbor_allowas_in_cmd);
10780 install_element (BGP_ENCAPV6_NODE, &neighbor_allowas_in_arg_cmd);
10781 install_element (BGP_ENCAPV6_NODE, &no_neighbor_allowas_in_cmd);
paul718e3742002-12-13 20:15:29 +000010782
10783 /* address-family commands. */
10784 install_element (BGP_NODE, &address_family_ipv4_cmd);
10785 install_element (BGP_NODE, &address_family_ipv4_safi_cmd);
paul718e3742002-12-13 20:15:29 +000010786 install_element (BGP_NODE, &address_family_ipv6_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010787 install_element (BGP_NODE, &address_family_ipv6_safi_cmd);
paul718e3742002-12-13 20:15:29 +000010788 install_element (BGP_NODE, &address_family_vpnv4_cmd);
10789 install_element (BGP_NODE, &address_family_vpnv4_unicast_cmd);
10790
Lou Berger13c378d2016-01-12 13:41:56 -050010791 install_element (BGP_NODE, &address_family_vpnv6_cmd);
10792 install_element (BGP_NODE, &address_family_vpnv6_unicast_cmd);
10793
Lou Bergera3fda882016-01-12 13:42:04 -050010794 install_element (BGP_NODE, &address_family_encap_cmd);
10795 install_element (BGP_NODE, &address_family_encapv4_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010796 install_element (BGP_NODE, &address_family_encapv6_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010797
paul718e3742002-12-13 20:15:29 +000010798 /* "exit-address-family" command. */
10799 install_element (BGP_IPV4_NODE, &exit_address_family_cmd);
10800 install_element (BGP_IPV4M_NODE, &exit_address_family_cmd);
10801 install_element (BGP_IPV6_NODE, &exit_address_family_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010802 install_element (BGP_IPV6M_NODE, &exit_address_family_cmd);
paul718e3742002-12-13 20:15:29 +000010803 install_element (BGP_VPNV4_NODE, &exit_address_family_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010804 install_element (BGP_VPNV6_NODE, &exit_address_family_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010805 install_element (BGP_ENCAP_NODE, &exit_address_family_cmd);
10806 install_element (BGP_ENCAPV6_NODE, &exit_address_family_cmd);
paul718e3742002-12-13 20:15:29 +000010807
10808 /* "clear ip bgp commands" */
10809 install_element (ENABLE_NODE, &clear_ip_bgp_all_cmd);
10810 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_cmd);
10811 install_element (ENABLE_NODE, &clear_ip_bgp_as_cmd);
10812 install_element (ENABLE_NODE, &clear_ip_bgp_peer_cmd);
10813 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_cmd);
10814 install_element (ENABLE_NODE, &clear_ip_bgp_external_cmd);
paul718e3742002-12-13 20:15:29 +000010815 install_element (ENABLE_NODE, &clear_bgp_all_cmd);
10816 install_element (ENABLE_NODE, &clear_bgp_instance_all_cmd);
10817 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_cmd);
10818 install_element (ENABLE_NODE, &clear_bgp_peer_cmd);
10819 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_cmd);
10820 install_element (ENABLE_NODE, &clear_bgp_peer_group_cmd);
10821 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_cmd);
10822 install_element (ENABLE_NODE, &clear_bgp_external_cmd);
10823 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_cmd);
10824 install_element (ENABLE_NODE, &clear_bgp_as_cmd);
10825 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_cmd);
paul718e3742002-12-13 20:15:29 +000010826
10827 /* "clear ip bgp neighbor soft in" */
10828 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_in_cmd);
10829 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_in_cmd);
10830 install_element (ENABLE_NODE, &clear_ip_bgp_all_in_cmd);
10831 install_element (ENABLE_NODE, &clear_ip_bgp_all_in_prefix_filter_cmd);
10832 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_in_prefix_filter_cmd);
10833 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_in_cmd);
10834 install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_cmd);
10835 install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_prefix_filter_cmd);
10836 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_in_cmd);
10837 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_cmd);
10838 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_prefix_filter_cmd);
10839 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_in_cmd);
10840 install_element (ENABLE_NODE, &clear_ip_bgp_external_in_cmd);
10841 install_element (ENABLE_NODE, &clear_ip_bgp_external_in_prefix_filter_cmd);
10842 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_in_cmd);
10843 install_element (ENABLE_NODE, &clear_ip_bgp_as_in_cmd);
10844 install_element (ENABLE_NODE, &clear_ip_bgp_as_in_prefix_filter_cmd);
10845 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_in_cmd);
10846 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_in_cmd);
10847 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_cmd);
10848 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_prefix_filter_cmd);
10849 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd);
10850 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_in_cmd);
10851 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_cmd);
10852 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd);
10853 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_in_cmd);
10854 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_cmd);
10855 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd);
10856 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_in_cmd);
10857 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_cmd);
10858 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_prefix_filter_cmd);
10859 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_in_cmd);
10860 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_cmd);
10861 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_prefix_filter_cmd);
10862 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_in_cmd);
10863 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_in_cmd);
10864 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_in_cmd);
10865 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_in_cmd);
10866 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_in_cmd);
10867 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_in_cmd);
Lou Berger298cc2f2016-01-12 13:42:02 -050010868 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_soft_in_cmd);
10869 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_in_cmd);
10870 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_soft_in_cmd);
10871 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_in_cmd);
10872 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_soft_in_cmd);
10873 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_in_cmd);
paul718e3742002-12-13 20:15:29 +000010874 install_element (ENABLE_NODE, &clear_bgp_all_soft_in_cmd);
10875 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_in_cmd);
10876 install_element (ENABLE_NODE, &clear_bgp_all_in_cmd);
10877 install_element (ENABLE_NODE, &clear_bgp_all_in_prefix_filter_cmd);
10878 install_element (ENABLE_NODE, &clear_bgp_peer_soft_in_cmd);
10879 install_element (ENABLE_NODE, &clear_bgp_peer_in_cmd);
10880 install_element (ENABLE_NODE, &clear_bgp_peer_in_prefix_filter_cmd);
10881 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_in_cmd);
10882 install_element (ENABLE_NODE, &clear_bgp_peer_group_in_cmd);
10883 install_element (ENABLE_NODE, &clear_bgp_peer_group_in_prefix_filter_cmd);
10884 install_element (ENABLE_NODE, &clear_bgp_external_soft_in_cmd);
10885 install_element (ENABLE_NODE, &clear_bgp_external_in_cmd);
10886 install_element (ENABLE_NODE, &clear_bgp_external_in_prefix_filter_cmd);
10887 install_element (ENABLE_NODE, &clear_bgp_as_soft_in_cmd);
10888 install_element (ENABLE_NODE, &clear_bgp_as_in_cmd);
10889 install_element (ENABLE_NODE, &clear_bgp_as_in_prefix_filter_cmd);
10890 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_in_cmd);
10891 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_cmd);
10892 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_prefix_filter_cmd);
10893 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_in_cmd);
10894 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_cmd);
10895 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_prefix_filter_cmd);
10896 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_in_cmd);
10897 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_cmd);
10898 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_prefix_filter_cmd);
10899 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_in_cmd);
10900 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_cmd);
10901 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_prefix_filter_cmd);
10902 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_in_cmd);
10903 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_cmd);
10904 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_prefix_filter_cmd);
paul718e3742002-12-13 20:15:29 +000010905
10906 /* "clear ip bgp neighbor soft out" */
10907 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_out_cmd);
10908 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_out_cmd);
10909 install_element (ENABLE_NODE, &clear_ip_bgp_all_out_cmd);
10910 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_out_cmd);
10911 install_element (ENABLE_NODE, &clear_ip_bgp_peer_out_cmd);
10912 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_out_cmd);
10913 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_out_cmd);
10914 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_out_cmd);
10915 install_element (ENABLE_NODE, &clear_ip_bgp_external_out_cmd);
10916 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_out_cmd);
10917 install_element (ENABLE_NODE, &clear_ip_bgp_as_out_cmd);
10918 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_out_cmd);
10919 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_out_cmd);
10920 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_out_cmd);
10921 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_out_cmd);
10922 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_out_cmd);
10923 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_out_cmd);
10924 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_out_cmd);
10925 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_out_cmd);
10926 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_out_cmd);
10927 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_out_cmd);
10928 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_out_cmd);
10929 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_out_cmd);
10930 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_out_cmd);
10931 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_out_cmd);
10932 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_out_cmd);
10933 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_out_cmd);
10934 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_out_cmd);
Lou Berger298cc2f2016-01-12 13:42:02 -050010935 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_soft_out_cmd);
10936 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_out_cmd);
10937 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_soft_out_cmd);
10938 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_out_cmd);
10939 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_soft_out_cmd);
10940 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_out_cmd);
paul718e3742002-12-13 20:15:29 +000010941 install_element (ENABLE_NODE, &clear_bgp_all_soft_out_cmd);
10942 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_out_cmd);
10943 install_element (ENABLE_NODE, &clear_bgp_all_out_cmd);
10944 install_element (ENABLE_NODE, &clear_bgp_peer_soft_out_cmd);
10945 install_element (ENABLE_NODE, &clear_bgp_peer_out_cmd);
10946 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_out_cmd);
10947 install_element (ENABLE_NODE, &clear_bgp_peer_group_out_cmd);
10948 install_element (ENABLE_NODE, &clear_bgp_external_soft_out_cmd);
10949 install_element (ENABLE_NODE, &clear_bgp_external_out_cmd);
10950 install_element (ENABLE_NODE, &clear_bgp_as_soft_out_cmd);
10951 install_element (ENABLE_NODE, &clear_bgp_as_out_cmd);
10952 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_out_cmd);
10953 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_out_cmd);
10954 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_out_cmd);
10955 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_out_cmd);
10956 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_out_cmd);
10957 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_out_cmd);
10958 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_out_cmd);
10959 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_out_cmd);
10960 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_out_cmd);
10961 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_out_cmd);
paul718e3742002-12-13 20:15:29 +000010962
10963 /* "clear ip bgp neighbor soft" */
10964 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_cmd);
10965 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_cmd);
10966 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_cmd);
10967 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_cmd);
10968 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_cmd);
10969 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_cmd);
10970 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_cmd);
10971 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_cmd);
10972 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_cmd);
10973 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_cmd);
10974 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_cmd);
10975 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_cmd);
10976 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_cmd);
10977 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_cmd);
10978 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_cmd);
Lou Berger298cc2f2016-01-12 13:42:02 -050010979 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_soft_cmd);
10980 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_soft_cmd);
10981 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_soft_cmd);
paul718e3742002-12-13 20:15:29 +000010982 install_element (ENABLE_NODE, &clear_bgp_all_soft_cmd);
10983 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_cmd);
10984 install_element (ENABLE_NODE, &clear_bgp_peer_soft_cmd);
10985 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_cmd);
10986 install_element (ENABLE_NODE, &clear_bgp_external_soft_cmd);
10987 install_element (ENABLE_NODE, &clear_bgp_as_soft_cmd);
10988 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_cmd);
10989 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_cmd);
10990 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_cmd);
10991 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_cmd);
10992 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_cmd);
paul718e3742002-12-13 20:15:29 +000010993
paulfee0f4c2004-09-13 05:12:46 +000010994 /* "clear ip bgp neighbor rsclient" */
10995 install_element (ENABLE_NODE, &clear_ip_bgp_all_rsclient_cmd);
10996 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_rsclient_cmd);
10997 install_element (ENABLE_NODE, &clear_ip_bgp_peer_rsclient_cmd);
10998 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_rsclient_cmd);
paulfee0f4c2004-09-13 05:12:46 +000010999 install_element (ENABLE_NODE, &clear_bgp_all_rsclient_cmd);
11000 install_element (ENABLE_NODE, &clear_bgp_instance_all_rsclient_cmd);
11001 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_rsclient_cmd);
11002 install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_all_rsclient_cmd);
11003 install_element (ENABLE_NODE, &clear_bgp_peer_rsclient_cmd);
11004 install_element (ENABLE_NODE, &clear_bgp_instance_peer_rsclient_cmd);
11005 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_rsclient_cmd);
11006 install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_peer_rsclient_cmd);
paulfee0f4c2004-09-13 05:12:46 +000011007
paul718e3742002-12-13 20:15:29 +000011008 /* "show ip bgp summary" commands. */
paul718e3742002-12-13 20:15:29 +000011009 install_element (VIEW_NODE, &show_bgp_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011010 install_element (RESTRICTED_NODE, &show_bgp_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011011
11012 install_element (VIEW_NODE, &show_bgp_summary_1w_cmd);
11013 install_element (RESTRICTED_NODE, &show_bgp_summary_1w_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011014
11015 install_element (VIEW_NODE, &show_bgp_ipv4_safi_summary_cmd);
11016 install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_summary_cmd);
11017 install_element (VIEW_NODE, &show_bgp_instance_ipv4_summary_cmd);
11018
11019 install_element (VIEW_NODE, &show_bgp_ipv4_vpn_summary_cmd);
11020 install_element (VIEW_NODE, &show_bgp_ipv4_encap_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011021 install_element (VIEW_NODE, &show_bgp_ipv6_vpn_summary_cmd);
11022 install_element (VIEW_NODE, &show_bgp_ipv6_encap_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011023
paul718e3742002-12-13 20:15:29 +000011024 install_element (VIEW_NODE, &show_bgp_instance_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040011025 install_element (VIEW_NODE, &show_bgp_ipv6_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000011026 install_element (VIEW_NODE, &show_bgp_instance_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040011027 install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_summary_cmd);
Donald Sharp68b45cc2016-03-11 14:27:13 -050011028
Michael Lambert95cbbd22010-07-23 14:43:04 -040011029 install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011030 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040011031 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011032
11033 install_element (RESTRICTED_NODE, &show_bgp_ipv4_vpn_summary_cmd);
11034 install_element (RESTRICTED_NODE, &show_bgp_ipv4_encap_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011035 install_element (RESTRICTED_NODE, &show_bgp_ipv6_vpn_summary_cmd);
11036 install_element (RESTRICTED_NODE, &show_bgp_ipv6_encap_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011037
Paul Jakma62687ff2008-08-23 14:27:06 +010011038 install_element (RESTRICTED_NODE, &show_bgp_instance_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040011039 install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010011040 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040011041 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000011042
11043 /* "show ip bgp neighbors" commands. */
paulbb46e942003-10-24 19:02:03 +000011044 install_element (VIEW_NODE, &show_bgp_instance_neighbors_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011045
11046 install_element (VIEW_NODE, &show_bgp_neighbors_cmd);
11047 install_element (VIEW_NODE, &show_bgp_neighbors_peer_cmd);
11048 install_element (VIEW_NODE, &show_bgp_instance_neighbors_peer_cmd);
11049 install_element (RESTRICTED_NODE, &show_bgp_neighbors_peer_cmd);
11050 install_element (RESTRICTED_NODE, &show_bgp_instance_neighbors_peer_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011051 install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_cmd);
11052 install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
11053 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
Donald Sharp68b45cc2016-03-11 14:27:13 -050011054 install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_cmd);
11055 install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
paul718e3742002-12-13 20:15:29 +000011056
paulfee0f4c2004-09-13 05:12:46 +000011057 /* "show ip bgp rsclient" commands. */
Michael Lambert95cbbd22010-07-23 14:43:04 -040011058 install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd);
11059 install_element (VIEW_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040011060 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd);
11061 install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000011062
paulfee0f4c2004-09-13 05:12:46 +000011063 install_element (VIEW_NODE, &show_bgp_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000011064 install_element (VIEW_NODE, &show_bgp_instance_rsclient_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011065 install_element (RESTRICTED_NODE, &show_bgp_rsclient_summary_cmd);
11066 install_element (RESTRICTED_NODE, &show_bgp_instance_rsclient_summary_cmd);
Donald Sharp68b45cc2016-03-11 14:27:13 -050011067
11068 install_element (VIEW_NODE, &show_bgp_rsclient_summary_cmd);
11069 install_element (VIEW_NODE, &show_bgp_instance_rsclient_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011070 install_element (VIEW_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000011071 install_element (VIEW_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040011072 install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd);
11073 install_element (VIEW_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010011074 install_element (RESTRICTED_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010011075 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040011076 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd);
11077 install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000011078
paul718e3742002-12-13 20:15:29 +000011079 /* "show ip bgp paths" commands. */
Lou Berger651b4022016-01-12 13:42:07 -050011080 install_element (VIEW_NODE, &show_bgp_ipv4_paths_cmd);
paul718e3742002-12-13 20:15:29 +000011081
11082 /* "show ip bgp community" commands. */
11083 install_element (VIEW_NODE, &show_ip_bgp_community_info_cmd);
paul718e3742002-12-13 20:15:29 +000011084
11085 /* "show ip bgp attribute-info" commands. */
11086 install_element (VIEW_NODE, &show_ip_bgp_attr_info_cmd);
paul718e3742002-12-13 20:15:29 +000011087
11088 /* "redistribute" commands. */
11089 install_element (BGP_NODE, &bgp_redistribute_ipv4_cmd);
11090 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_cmd);
11091 install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_cmd);
11092 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_cmd);
11093 install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_cmd);
11094 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_cmd);
11095 install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_metric_cmd);
11096 install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_rmap_cmd);
11097 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_metric_cmd);
11098 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_rmap_cmd);
paul718e3742002-12-13 20:15:29 +000011099 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_cmd);
11100 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_cmd);
11101 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_cmd);
11102 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_cmd);
11103 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_cmd);
11104 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_cmd);
11105 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_metric_cmd);
11106 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_rmap_cmd);
11107 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_metric_cmd);
11108 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_rmap_cmd);
paul718e3742002-12-13 20:15:29 +000011109
Nick Hilliardfa411a22011-03-23 15:33:17 +000011110 /* ttl_security commands */
11111 install_element (BGP_NODE, &neighbor_ttl_security_cmd);
11112 install_element (BGP_NODE, &no_neighbor_ttl_security_cmd);
11113
Paul Jakma4bf6a362006-03-30 14:05:23 +000011114 /* "show bgp memory" commands. */
11115 install_element (VIEW_NODE, &show_bgp_memory_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010011116 install_element (RESTRICTED_NODE, &show_bgp_memory_cmd);
Paul Jakma4bf6a362006-03-30 14:05:23 +000011117
Michael Lamberte0081f72008-11-16 20:12:04 +000011118 /* "show bgp views" commands. */
11119 install_element (VIEW_NODE, &show_bgp_views_cmd);
11120 install_element (RESTRICTED_NODE, &show_bgp_views_cmd);
Donald Sharp68b45cc2016-03-11 14:27:13 -050011121
11122 /* "show bgp views" commands. */
11123 install_element (VIEW_NODE, &show_bgp_views_cmd);
Lou Bergerf9b6c392016-01-12 13:42:09 -050011124
11125 /* non afi/safi forms of commands */
11126 install_element (VIEW_NODE, &show_ip_bgp_summary_cmd);
11127 install_element (VIEW_NODE, &show_ip_bgp_instance_summary_cmd);
11128 install_element (VIEW_NODE, &show_ip_bgp_ipv4_summary_cmd);
11129 install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
11130 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
11131 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
11132 install_element (VIEW_NODE, &show_bgp_ipv6_summary_cmd);
11133 install_element (RESTRICTED_NODE, &show_ip_bgp_summary_cmd);
11134 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_summary_cmd);
11135 install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_summary_cmd);
11136 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
11137 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
11138 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
11139 install_element (RESTRICTED_NODE, &show_bgp_ipv6_summary_cmd);
Lou Bergerf9b6c392016-01-12 13:42:09 -050011140 install_element (VIEW_NODE, &show_ip_bgp_neighbors_cmd);
11141 install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_cmd);
11142 install_element (VIEW_NODE, &show_ip_bgp_neighbors_peer_cmd);
11143 install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
11144 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd);
11145 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd);
11146 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
11147 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
11148 install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_cmd);
11149 install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
11150 install_element (RESTRICTED_NODE, &show_ip_bgp_neighbors_peer_cmd);
11151 install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
11152 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
11153 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
11154 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
Lou Bergerf9b6c392016-01-12 13:42:09 -050011155 install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_cmd);
11156 install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
11157 install_element (RESTRICTED_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
Donald Sharp68b45cc2016-03-11 14:27:13 -050011158 install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_cmd);
11159 install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
Lou Bergerf9b6c392016-01-12 13:42:09 -050011160 install_element (VIEW_NODE, &show_ipv6_bgp_summary_cmd);
11161 install_element (VIEW_NODE, &show_ipv6_mbgp_summary_cmd);
Lou Bergerf9b6c392016-01-12 13:42:09 -050011162 install_element (VIEW_NODE, &show_ip_bgp_rsclient_summary_cmd);
11163 install_element (VIEW_NODE, &show_ip_bgp_instance_rsclient_summary_cmd);
11164 install_element (VIEW_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd);
11165 install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd);
11166 install_element (RESTRICTED_NODE, &show_ip_bgp_rsclient_summary_cmd);
11167 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_rsclient_summary_cmd);
11168 install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd);
11169 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd);
11170 install_element (ENABLE_NODE, &show_ip_bgp_rsclient_summary_cmd);
Lou Bergerf9b6c392016-01-12 13:42:09 -050011171 install_element (VIEW_NODE, &show_ip_bgp_paths_cmd);
11172 install_element (VIEW_NODE, &show_ip_bgp_ipv4_paths_cmd);
paul718e3742002-12-13 20:15:29 +000011173 /* Community-list. */
11174 community_list_vty ();
11175}
David Lamparter6b0655a2014-06-04 06:53:35 +020011176
paul718e3742002-12-13 20:15:29 +000011177#include "memory.h"
11178#include "bgp_regex.h"
11179#include "bgp_clist.h"
11180#include "bgp_ecommunity.h"
11181
11182/* VTY functions. */
11183
11184/* Direction value to string conversion. */
paul94f2b392005-06-28 12:44:16 +000011185static const char *
paul718e3742002-12-13 20:15:29 +000011186community_direct_str (int direct)
11187{
11188 switch (direct)
11189 {
11190 case COMMUNITY_DENY:
11191 return "deny";
paul718e3742002-12-13 20:15:29 +000011192 case COMMUNITY_PERMIT:
11193 return "permit";
paul718e3742002-12-13 20:15:29 +000011194 default:
11195 return "unknown";
paul718e3742002-12-13 20:15:29 +000011196 }
11197}
11198
11199/* Display error string. */
paul94f2b392005-06-28 12:44:16 +000011200static void
paul718e3742002-12-13 20:15:29 +000011201community_list_perror (struct vty *vty, int ret)
11202{
11203 switch (ret)
11204 {
11205 case COMMUNITY_LIST_ERR_CANT_FIND_LIST:
Denis Ovsienkob7292942010-12-08 18:51:37 +030011206 vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000011207 break;
11208 case COMMUNITY_LIST_ERR_MALFORMED_VAL:
11209 vty_out (vty, "%% Malformed community-list value%s", VTY_NEWLINE);
11210 break;
11211 case COMMUNITY_LIST_ERR_STANDARD_CONFLICT:
11212 vty_out (vty, "%% Community name conflict, previously defined as standard community%s", VTY_NEWLINE);
11213 break;
11214 case COMMUNITY_LIST_ERR_EXPANDED_CONFLICT:
11215 vty_out (vty, "%% Community name conflict, previously defined as expanded community%s", VTY_NEWLINE);
11216 break;
11217 }
11218}
11219
11220/* VTY interface for community_set() function. */
paul94f2b392005-06-28 12:44:16 +000011221static int
paulfd79ac92004-10-13 05:06:08 +000011222community_list_set_vty (struct vty *vty, int argc, const char **argv,
11223 int style, int reject_all_digit_name)
paul718e3742002-12-13 20:15:29 +000011224{
11225 int ret;
11226 int direct;
11227 char *str;
11228
11229 /* Check the list type. */
11230 if (strncmp (argv[1], "p", 1) == 0)
11231 direct = COMMUNITY_PERMIT;
11232 else if (strncmp (argv[1], "d", 1) == 0)
11233 direct = COMMUNITY_DENY;
11234 else
11235 {
11236 vty_out (vty, "%% Matching condition must be permit or deny%s",
11237 VTY_NEWLINE);
11238 return CMD_WARNING;
11239 }
11240
11241 /* All digit name check. */
11242 if (reject_all_digit_name && all_digit (argv[0]))
11243 {
11244 vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE);
11245 return CMD_WARNING;
11246 }
11247
11248 /* Concat community string argument. */
11249 if (argc > 1)
11250 str = argv_concat (argv, argc, 2);
11251 else
11252 str = NULL;
11253
11254 /* When community_list_set() return nevetive value, it means
11255 malformed community string. */
11256 ret = community_list_set (bgp_clist, argv[0], str, direct, style);
11257
11258 /* Free temporary community list string allocated by
11259 argv_concat(). */
11260 if (str)
11261 XFREE (MTYPE_TMP, str);
11262
11263 if (ret < 0)
11264 {
11265 /* Display error string. */
11266 community_list_perror (vty, ret);
11267 return CMD_WARNING;
11268 }
11269
11270 return CMD_SUCCESS;
11271}
11272
paul718e3742002-12-13 20:15:29 +000011273/* Communiyt-list entry delete. */
paul94f2b392005-06-28 12:44:16 +000011274static int
hassofee6e4e2005-02-02 16:29:31 +000011275community_list_unset_vty (struct vty *vty, int argc, const char **argv,
11276 int style)
paul718e3742002-12-13 20:15:29 +000011277{
11278 int ret;
hassofee6e4e2005-02-02 16:29:31 +000011279 int direct = 0;
11280 char *str = NULL;
paul718e3742002-12-13 20:15:29 +000011281
hassofee6e4e2005-02-02 16:29:31 +000011282 if (argc > 1)
paul718e3742002-12-13 20:15:29 +000011283 {
hassofee6e4e2005-02-02 16:29:31 +000011284 /* Check the list direct. */
11285 if (strncmp (argv[1], "p", 1) == 0)
11286 direct = COMMUNITY_PERMIT;
11287 else if (strncmp (argv[1], "d", 1) == 0)
11288 direct = COMMUNITY_DENY;
11289 else
11290 {
11291 vty_out (vty, "%% Matching condition must be permit or deny%s",
11292 VTY_NEWLINE);
11293 return CMD_WARNING;
11294 }
paul718e3742002-12-13 20:15:29 +000011295
hassofee6e4e2005-02-02 16:29:31 +000011296 /* Concat community string argument. */
11297 str = argv_concat (argv, argc, 2);
11298 }
paul718e3742002-12-13 20:15:29 +000011299
11300 /* Unset community list. */
11301 ret = community_list_unset (bgp_clist, argv[0], str, direct, style);
11302
11303 /* Free temporary community list string allocated by
11304 argv_concat(). */
hassofee6e4e2005-02-02 16:29:31 +000011305 if (str)
11306 XFREE (MTYPE_TMP, str);
paul718e3742002-12-13 20:15:29 +000011307
11308 if (ret < 0)
11309 {
11310 community_list_perror (vty, ret);
11311 return CMD_WARNING;
11312 }
11313
11314 return CMD_SUCCESS;
11315}
11316
11317/* "community-list" keyword help string. */
11318#define COMMUNITY_LIST_STR "Add a community list entry\n"
11319#define COMMUNITY_VAL_STR "Community number in aa:nn format or internet|local-AS|no-advertise|no-export\n"
11320
paul718e3742002-12-13 20:15:29 +000011321DEFUN (ip_community_list_standard,
11322 ip_community_list_standard_cmd,
11323 "ip community-list <1-99> (deny|permit) .AA:NN",
11324 IP_STR
11325 COMMUNITY_LIST_STR
11326 "Community list number (standard)\n"
11327 "Specify community to reject\n"
11328 "Specify community to accept\n"
11329 COMMUNITY_VAL_STR)
11330{
11331 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0);
11332}
11333
11334ALIAS (ip_community_list_standard,
11335 ip_community_list_standard2_cmd,
11336 "ip community-list <1-99> (deny|permit)",
11337 IP_STR
11338 COMMUNITY_LIST_STR
11339 "Community list number (standard)\n"
11340 "Specify community to reject\n"
11341 "Specify community to accept\n")
11342
11343DEFUN (ip_community_list_expanded,
11344 ip_community_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000011345 "ip community-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000011346 IP_STR
11347 COMMUNITY_LIST_STR
11348 "Community list number (expanded)\n"
11349 "Specify community to reject\n"
11350 "Specify community to accept\n"
11351 "An ordered list as a regular-expression\n")
11352{
11353 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0);
11354}
11355
11356DEFUN (ip_community_list_name_standard,
11357 ip_community_list_name_standard_cmd,
11358 "ip community-list standard WORD (deny|permit) .AA:NN",
11359 IP_STR
11360 COMMUNITY_LIST_STR
11361 "Add a standard community-list entry\n"
11362 "Community list name\n"
11363 "Specify community to reject\n"
11364 "Specify community to accept\n"
11365 COMMUNITY_VAL_STR)
11366{
11367 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1);
11368}
11369
11370ALIAS (ip_community_list_name_standard,
11371 ip_community_list_name_standard2_cmd,
11372 "ip community-list standard WORD (deny|permit)",
11373 IP_STR
11374 COMMUNITY_LIST_STR
11375 "Add a standard community-list entry\n"
11376 "Community list name\n"
11377 "Specify community to reject\n"
11378 "Specify community to accept\n")
11379
11380DEFUN (ip_community_list_name_expanded,
11381 ip_community_list_name_expanded_cmd,
11382 "ip community-list expanded WORD (deny|permit) .LINE",
11383 IP_STR
11384 COMMUNITY_LIST_STR
11385 "Add an expanded community-list entry\n"
11386 "Community list name\n"
11387 "Specify community to reject\n"
11388 "Specify community to accept\n"
11389 "An ordered list as a regular-expression\n")
11390{
11391 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1);
11392}
11393
hassofee6e4e2005-02-02 16:29:31 +000011394DEFUN (no_ip_community_list_standard_all,
11395 no_ip_community_list_standard_all_cmd,
11396 "no ip community-list <1-99>",
paul718e3742002-12-13 20:15:29 +000011397 NO_STR
11398 IP_STR
11399 COMMUNITY_LIST_STR
hassofee6e4e2005-02-02 16:29:31 +000011400 "Community list number (standard)\n")
paul718e3742002-12-13 20:15:29 +000011401{
hassofee6e4e2005-02-02 16:29:31 +000011402 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
paul718e3742002-12-13 20:15:29 +000011403}
11404
hassofee6e4e2005-02-02 16:29:31 +000011405DEFUN (no_ip_community_list_expanded_all,
11406 no_ip_community_list_expanded_all_cmd,
11407 "no ip community-list <100-500>",
11408 NO_STR
11409 IP_STR
11410 COMMUNITY_LIST_STR
11411 "Community list number (expanded)\n")
11412{
11413 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
11414}
11415
11416DEFUN (no_ip_community_list_name_standard_all,
11417 no_ip_community_list_name_standard_all_cmd,
11418 "no ip community-list standard WORD",
paul718e3742002-12-13 20:15:29 +000011419 NO_STR
11420 IP_STR
11421 COMMUNITY_LIST_STR
11422 "Add a standard community-list entry\n"
paul718e3742002-12-13 20:15:29 +000011423 "Community list name\n")
11424{
hassofee6e4e2005-02-02 16:29:31 +000011425 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
paul718e3742002-12-13 20:15:29 +000011426}
11427
hassofee6e4e2005-02-02 16:29:31 +000011428DEFUN (no_ip_community_list_name_expanded_all,
11429 no_ip_community_list_name_expanded_all_cmd,
11430 "no ip community-list expanded WORD",
paul718e3742002-12-13 20:15:29 +000011431 NO_STR
11432 IP_STR
11433 COMMUNITY_LIST_STR
hassofee6e4e2005-02-02 16:29:31 +000011434 "Add an expanded community-list entry\n"
11435 "Community list name\n")
paul718e3742002-12-13 20:15:29 +000011436{
hassofee6e4e2005-02-02 16:29:31 +000011437 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
paul718e3742002-12-13 20:15:29 +000011438}
11439
11440DEFUN (no_ip_community_list_standard,
11441 no_ip_community_list_standard_cmd,
11442 "no ip community-list <1-99> (deny|permit) .AA:NN",
11443 NO_STR
11444 IP_STR
11445 COMMUNITY_LIST_STR
11446 "Community list number (standard)\n"
11447 "Specify community to reject\n"
11448 "Specify community to accept\n"
11449 COMMUNITY_VAL_STR)
11450{
11451 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
11452}
11453
11454DEFUN (no_ip_community_list_expanded,
11455 no_ip_community_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000011456 "no ip community-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000011457 NO_STR
11458 IP_STR
11459 COMMUNITY_LIST_STR
11460 "Community list number (expanded)\n"
11461 "Specify community to reject\n"
11462 "Specify community to accept\n"
11463 "An ordered list as a regular-expression\n")
11464{
11465 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
11466}
11467
11468DEFUN (no_ip_community_list_name_standard,
11469 no_ip_community_list_name_standard_cmd,
11470 "no ip community-list standard WORD (deny|permit) .AA:NN",
11471 NO_STR
11472 IP_STR
11473 COMMUNITY_LIST_STR
11474 "Specify a standard community-list\n"
11475 "Community list name\n"
11476 "Specify community to reject\n"
11477 "Specify community to accept\n"
11478 COMMUNITY_VAL_STR)
11479{
11480 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
11481}
11482
11483DEFUN (no_ip_community_list_name_expanded,
11484 no_ip_community_list_name_expanded_cmd,
11485 "no ip community-list expanded WORD (deny|permit) .LINE",
11486 NO_STR
11487 IP_STR
11488 COMMUNITY_LIST_STR
11489 "Specify an expanded community-list\n"
11490 "Community list name\n"
11491 "Specify community to reject\n"
11492 "Specify community to accept\n"
11493 "An ordered list as a regular-expression\n")
11494{
11495 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
11496}
11497
paul94f2b392005-06-28 12:44:16 +000011498static void
paul718e3742002-12-13 20:15:29 +000011499community_list_show (struct vty *vty, struct community_list *list)
11500{
11501 struct community_entry *entry;
11502
11503 for (entry = list->head; entry; entry = entry->next)
11504 {
11505 if (entry == list->head)
11506 {
11507 if (all_digit (list->name))
11508 vty_out (vty, "Community %s list %s%s",
11509 entry->style == COMMUNITY_LIST_STANDARD ?
11510 "standard" : "(expanded) access",
11511 list->name, VTY_NEWLINE);
11512 else
11513 vty_out (vty, "Named Community %s list %s%s",
11514 entry->style == COMMUNITY_LIST_STANDARD ?
11515 "standard" : "expanded",
11516 list->name, VTY_NEWLINE);
11517 }
11518 if (entry->any)
11519 vty_out (vty, " %s%s",
11520 community_direct_str (entry->direct), VTY_NEWLINE);
11521 else
11522 vty_out (vty, " %s %s%s",
11523 community_direct_str (entry->direct),
11524 entry->style == COMMUNITY_LIST_STANDARD
11525 ? community_str (entry->u.com) : entry->config,
11526 VTY_NEWLINE);
11527 }
11528}
11529
11530DEFUN (show_ip_community_list,
11531 show_ip_community_list_cmd,
11532 "show ip community-list",
11533 SHOW_STR
11534 IP_STR
11535 "List community-list\n")
11536{
11537 struct community_list *list;
11538 struct community_list_master *cm;
11539
hassofee6e4e2005-02-02 16:29:31 +000011540 cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011541 if (! cm)
11542 return CMD_SUCCESS;
11543
11544 for (list = cm->num.head; list; list = list->next)
11545 community_list_show (vty, list);
11546
11547 for (list = cm->str.head; list; list = list->next)
11548 community_list_show (vty, list);
11549
11550 return CMD_SUCCESS;
11551}
11552
11553DEFUN (show_ip_community_list_arg,
11554 show_ip_community_list_arg_cmd,
hassofee6e4e2005-02-02 16:29:31 +000011555 "show ip community-list (<1-500>|WORD)",
paul718e3742002-12-13 20:15:29 +000011556 SHOW_STR
11557 IP_STR
11558 "List community-list\n"
11559 "Community-list number\n"
11560 "Community-list name\n")
11561{
11562 struct community_list *list;
11563
hassofee6e4e2005-02-02 16:29:31 +000011564 list = community_list_lookup (bgp_clist, argv[0], COMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011565 if (! list)
11566 {
Denis Ovsienkob7292942010-12-08 18:51:37 +030011567 vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000011568 return CMD_WARNING;
11569 }
11570
11571 community_list_show (vty, list);
11572
11573 return CMD_SUCCESS;
11574}
David Lamparter6b0655a2014-06-04 06:53:35 +020011575
paul94f2b392005-06-28 12:44:16 +000011576static int
paulfd79ac92004-10-13 05:06:08 +000011577extcommunity_list_set_vty (struct vty *vty, int argc, const char **argv,
11578 int style, int reject_all_digit_name)
paul718e3742002-12-13 20:15:29 +000011579{
11580 int ret;
11581 int direct;
11582 char *str;
11583
11584 /* Check the list type. */
11585 if (strncmp (argv[1], "p", 1) == 0)
11586 direct = COMMUNITY_PERMIT;
11587 else if (strncmp (argv[1], "d", 1) == 0)
11588 direct = COMMUNITY_DENY;
11589 else
11590 {
11591 vty_out (vty, "%% Matching condition must be permit or deny%s",
11592 VTY_NEWLINE);
11593 return CMD_WARNING;
11594 }
11595
11596 /* All digit name check. */
11597 if (reject_all_digit_name && all_digit (argv[0]))
11598 {
11599 vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE);
11600 return CMD_WARNING;
11601 }
11602
11603 /* Concat community string argument. */
11604 if (argc > 1)
11605 str = argv_concat (argv, argc, 2);
11606 else
11607 str = NULL;
11608
11609 ret = extcommunity_list_set (bgp_clist, argv[0], str, direct, style);
11610
11611 /* Free temporary community list string allocated by
11612 argv_concat(). */
11613 if (str)
11614 XFREE (MTYPE_TMP, str);
11615
11616 if (ret < 0)
11617 {
11618 community_list_perror (vty, ret);
11619 return CMD_WARNING;
11620 }
11621 return CMD_SUCCESS;
11622}
11623
paul94f2b392005-06-28 12:44:16 +000011624static int
hassofee6e4e2005-02-02 16:29:31 +000011625extcommunity_list_unset_vty (struct vty *vty, int argc, const char **argv,
11626 int style)
paul718e3742002-12-13 20:15:29 +000011627{
11628 int ret;
hassofee6e4e2005-02-02 16:29:31 +000011629 int direct = 0;
11630 char *str = NULL;
paul718e3742002-12-13 20:15:29 +000011631
hassofee6e4e2005-02-02 16:29:31 +000011632 if (argc > 1)
paul718e3742002-12-13 20:15:29 +000011633 {
hassofee6e4e2005-02-02 16:29:31 +000011634 /* Check the list direct. */
11635 if (strncmp (argv[1], "p", 1) == 0)
11636 direct = COMMUNITY_PERMIT;
11637 else if (strncmp (argv[1], "d", 1) == 0)
11638 direct = COMMUNITY_DENY;
11639 else
11640 {
11641 vty_out (vty, "%% Matching condition must be permit or deny%s",
11642 VTY_NEWLINE);
11643 return CMD_WARNING;
11644 }
11645
11646 /* Concat community string argument. */
11647 str = argv_concat (argv, argc, 2);
paul718e3742002-12-13 20:15:29 +000011648 }
paul718e3742002-12-13 20:15:29 +000011649
11650 /* Unset community list. */
11651 ret = extcommunity_list_unset (bgp_clist, argv[0], str, direct, style);
11652
11653 /* Free temporary community list string allocated by
11654 argv_concat(). */
hassofee6e4e2005-02-02 16:29:31 +000011655 if (str)
11656 XFREE (MTYPE_TMP, str);
paul718e3742002-12-13 20:15:29 +000011657
11658 if (ret < 0)
11659 {
11660 community_list_perror (vty, ret);
11661 return CMD_WARNING;
11662 }
11663
11664 return CMD_SUCCESS;
11665}
11666
11667/* "extcommunity-list" keyword help string. */
11668#define EXTCOMMUNITY_LIST_STR "Add a extended community list entry\n"
11669#define EXTCOMMUNITY_VAL_STR "Extended community attribute in 'rt aa:nn_or_IPaddr:nn' OR 'soo aa:nn_or_IPaddr:nn' format\n"
11670
11671DEFUN (ip_extcommunity_list_standard,
11672 ip_extcommunity_list_standard_cmd,
11673 "ip extcommunity-list <1-99> (deny|permit) .AA:NN",
11674 IP_STR
11675 EXTCOMMUNITY_LIST_STR
11676 "Extended Community list number (standard)\n"
11677 "Specify community to reject\n"
11678 "Specify community to accept\n"
11679 EXTCOMMUNITY_VAL_STR)
11680{
11681 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0);
11682}
11683
11684ALIAS (ip_extcommunity_list_standard,
11685 ip_extcommunity_list_standard2_cmd,
11686 "ip extcommunity-list <1-99> (deny|permit)",
11687 IP_STR
11688 EXTCOMMUNITY_LIST_STR
11689 "Extended Community list number (standard)\n"
11690 "Specify community to reject\n"
11691 "Specify community to accept\n")
11692
11693DEFUN (ip_extcommunity_list_expanded,
11694 ip_extcommunity_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000011695 "ip extcommunity-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000011696 IP_STR
11697 EXTCOMMUNITY_LIST_STR
11698 "Extended Community list number (expanded)\n"
11699 "Specify community to reject\n"
11700 "Specify community to accept\n"
11701 "An ordered list as a regular-expression\n")
11702{
11703 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0);
11704}
11705
11706DEFUN (ip_extcommunity_list_name_standard,
11707 ip_extcommunity_list_name_standard_cmd,
11708 "ip extcommunity-list standard WORD (deny|permit) .AA:NN",
11709 IP_STR
11710 EXTCOMMUNITY_LIST_STR
11711 "Specify standard extcommunity-list\n"
11712 "Extended Community list name\n"
11713 "Specify community to reject\n"
11714 "Specify community to accept\n"
11715 EXTCOMMUNITY_VAL_STR)
11716{
11717 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1);
11718}
11719
11720ALIAS (ip_extcommunity_list_name_standard,
11721 ip_extcommunity_list_name_standard2_cmd,
11722 "ip extcommunity-list standard WORD (deny|permit)",
11723 IP_STR
11724 EXTCOMMUNITY_LIST_STR
11725 "Specify standard extcommunity-list\n"
11726 "Extended Community list name\n"
11727 "Specify community to reject\n"
11728 "Specify community to accept\n")
11729
11730DEFUN (ip_extcommunity_list_name_expanded,
11731 ip_extcommunity_list_name_expanded_cmd,
11732 "ip extcommunity-list expanded WORD (deny|permit) .LINE",
11733 IP_STR
11734 EXTCOMMUNITY_LIST_STR
11735 "Specify expanded extcommunity-list\n"
11736 "Extended Community list name\n"
11737 "Specify community to reject\n"
11738 "Specify community to accept\n"
11739 "An ordered list as a regular-expression\n")
11740{
11741 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1);
11742}
11743
hassofee6e4e2005-02-02 16:29:31 +000011744DEFUN (no_ip_extcommunity_list_standard_all,
11745 no_ip_extcommunity_list_standard_all_cmd,
11746 "no ip extcommunity-list <1-99>",
paul718e3742002-12-13 20:15:29 +000011747 NO_STR
11748 IP_STR
11749 EXTCOMMUNITY_LIST_STR
hassofee6e4e2005-02-02 16:29:31 +000011750 "Extended Community list number (standard)\n")
paul718e3742002-12-13 20:15:29 +000011751{
hassofee6e4e2005-02-02 16:29:31 +000011752 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
paul718e3742002-12-13 20:15:29 +000011753}
11754
hassofee6e4e2005-02-02 16:29:31 +000011755DEFUN (no_ip_extcommunity_list_expanded_all,
11756 no_ip_extcommunity_list_expanded_all_cmd,
11757 "no ip extcommunity-list <100-500>",
11758 NO_STR
11759 IP_STR
11760 EXTCOMMUNITY_LIST_STR
11761 "Extended Community list number (expanded)\n")
11762{
11763 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
11764}
11765
11766DEFUN (no_ip_extcommunity_list_name_standard_all,
11767 no_ip_extcommunity_list_name_standard_all_cmd,
11768 "no ip extcommunity-list standard WORD",
paul718e3742002-12-13 20:15:29 +000011769 NO_STR
11770 IP_STR
11771 EXTCOMMUNITY_LIST_STR
11772 "Specify standard extcommunity-list\n"
hassofee6e4e2005-02-02 16:29:31 +000011773 "Extended Community list name\n")
11774{
11775 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
11776}
11777
11778DEFUN (no_ip_extcommunity_list_name_expanded_all,
11779 no_ip_extcommunity_list_name_expanded_all_cmd,
11780 "no ip extcommunity-list expanded WORD",
11781 NO_STR
11782 IP_STR
11783 EXTCOMMUNITY_LIST_STR
paul718e3742002-12-13 20:15:29 +000011784 "Specify expanded extcommunity-list\n"
11785 "Extended Community list name\n")
11786{
hassofee6e4e2005-02-02 16:29:31 +000011787 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
paul718e3742002-12-13 20:15:29 +000011788}
11789
11790DEFUN (no_ip_extcommunity_list_standard,
11791 no_ip_extcommunity_list_standard_cmd,
11792 "no ip extcommunity-list <1-99> (deny|permit) .AA:NN",
11793 NO_STR
11794 IP_STR
11795 EXTCOMMUNITY_LIST_STR
11796 "Extended Community list number (standard)\n"
11797 "Specify community to reject\n"
11798 "Specify community to accept\n"
11799 EXTCOMMUNITY_VAL_STR)
11800{
11801 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
11802}
11803
11804DEFUN (no_ip_extcommunity_list_expanded,
11805 no_ip_extcommunity_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000011806 "no ip extcommunity-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000011807 NO_STR
11808 IP_STR
11809 EXTCOMMUNITY_LIST_STR
11810 "Extended Community list number (expanded)\n"
11811 "Specify community to reject\n"
11812 "Specify community to accept\n"
11813 "An ordered list as a regular-expression\n")
11814{
11815 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
11816}
11817
11818DEFUN (no_ip_extcommunity_list_name_standard,
11819 no_ip_extcommunity_list_name_standard_cmd,
11820 "no ip extcommunity-list standard WORD (deny|permit) .AA:NN",
11821 NO_STR
11822 IP_STR
11823 EXTCOMMUNITY_LIST_STR
11824 "Specify standard extcommunity-list\n"
11825 "Extended Community list name\n"
11826 "Specify community to reject\n"
11827 "Specify community to accept\n"
11828 EXTCOMMUNITY_VAL_STR)
11829{
11830 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
11831}
11832
11833DEFUN (no_ip_extcommunity_list_name_expanded,
11834 no_ip_extcommunity_list_name_expanded_cmd,
11835 "no ip extcommunity-list expanded WORD (deny|permit) .LINE",
11836 NO_STR
11837 IP_STR
11838 EXTCOMMUNITY_LIST_STR
11839 "Specify expanded extcommunity-list\n"
11840 "Community list name\n"
11841 "Specify community to reject\n"
11842 "Specify community to accept\n"
11843 "An ordered list as a regular-expression\n")
11844{
11845 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
11846}
11847
paul94f2b392005-06-28 12:44:16 +000011848static void
paul718e3742002-12-13 20:15:29 +000011849extcommunity_list_show (struct vty *vty, struct community_list *list)
11850{
11851 struct community_entry *entry;
11852
11853 for (entry = list->head; entry; entry = entry->next)
11854 {
11855 if (entry == list->head)
11856 {
11857 if (all_digit (list->name))
11858 vty_out (vty, "Extended community %s list %s%s",
11859 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
11860 "standard" : "(expanded) access",
11861 list->name, VTY_NEWLINE);
11862 else
11863 vty_out (vty, "Named extended community %s list %s%s",
11864 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
11865 "standard" : "expanded",
11866 list->name, VTY_NEWLINE);
11867 }
11868 if (entry->any)
11869 vty_out (vty, " %s%s",
11870 community_direct_str (entry->direct), VTY_NEWLINE);
11871 else
11872 vty_out (vty, " %s %s%s",
11873 community_direct_str (entry->direct),
11874 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
11875 entry->u.ecom->str : entry->config,
11876 VTY_NEWLINE);
11877 }
11878}
11879
11880DEFUN (show_ip_extcommunity_list,
11881 show_ip_extcommunity_list_cmd,
11882 "show ip extcommunity-list",
11883 SHOW_STR
11884 IP_STR
11885 "List extended-community list\n")
11886{
11887 struct community_list *list;
11888 struct community_list_master *cm;
11889
hassofee6e4e2005-02-02 16:29:31 +000011890 cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011891 if (! cm)
11892 return CMD_SUCCESS;
11893
11894 for (list = cm->num.head; list; list = list->next)
11895 extcommunity_list_show (vty, list);
11896
11897 for (list = cm->str.head; list; list = list->next)
11898 extcommunity_list_show (vty, list);
11899
11900 return CMD_SUCCESS;
11901}
11902
11903DEFUN (show_ip_extcommunity_list_arg,
11904 show_ip_extcommunity_list_arg_cmd,
hassofee6e4e2005-02-02 16:29:31 +000011905 "show ip extcommunity-list (<1-500>|WORD)",
paul718e3742002-12-13 20:15:29 +000011906 SHOW_STR
11907 IP_STR
11908 "List extended-community list\n"
11909 "Extcommunity-list number\n"
11910 "Extcommunity-list name\n")
11911{
11912 struct community_list *list;
11913
hassofee6e4e2005-02-02 16:29:31 +000011914 list = community_list_lookup (bgp_clist, argv[0], EXTCOMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011915 if (! list)
11916 {
Denis Ovsienkob7292942010-12-08 18:51:37 +030011917 vty_out (vty, "%% Can't find extcommunity-list%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000011918 return CMD_WARNING;
11919 }
11920
11921 extcommunity_list_show (vty, list);
11922
11923 return CMD_SUCCESS;
11924}
David Lamparter6b0655a2014-06-04 06:53:35 +020011925
paul718e3742002-12-13 20:15:29 +000011926/* Return configuration string of community-list entry. */
paulfd79ac92004-10-13 05:06:08 +000011927static const char *
paul718e3742002-12-13 20:15:29 +000011928community_list_config_str (struct community_entry *entry)
11929{
paulfd79ac92004-10-13 05:06:08 +000011930 const char *str;
paul718e3742002-12-13 20:15:29 +000011931
11932 if (entry->any)
11933 str = "";
11934 else
11935 {
11936 if (entry->style == COMMUNITY_LIST_STANDARD)
11937 str = community_str (entry->u.com);
11938 else
11939 str = entry->config;
11940 }
11941 return str;
11942}
11943
11944/* Display community-list and extcommunity-list configuration. */
paul94f2b392005-06-28 12:44:16 +000011945static int
paul718e3742002-12-13 20:15:29 +000011946community_list_config_write (struct vty *vty)
11947{
11948 struct community_list *list;
11949 struct community_entry *entry;
11950 struct community_list_master *cm;
11951 int write = 0;
11952
11953 /* Community-list. */
hassofee6e4e2005-02-02 16:29:31 +000011954 cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011955
11956 for (list = cm->num.head; list; list = list->next)
11957 for (entry = list->head; entry; entry = entry->next)
11958 {
hassofee6e4e2005-02-02 16:29:31 +000011959 vty_out (vty, "ip community-list %s %s %s%s",
11960 list->name, community_direct_str (entry->direct),
11961 community_list_config_str (entry),
11962 VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000011963 write++;
11964 }
11965 for (list = cm->str.head; list; list = list->next)
11966 for (entry = list->head; entry; entry = entry->next)
11967 {
11968 vty_out (vty, "ip community-list %s %s %s %s%s",
11969 entry->style == COMMUNITY_LIST_STANDARD
11970 ? "standard" : "expanded",
11971 list->name, community_direct_str (entry->direct),
11972 community_list_config_str (entry),
11973 VTY_NEWLINE);
11974 write++;
11975 }
11976
11977 /* Extcommunity-list. */
hassofee6e4e2005-02-02 16:29:31 +000011978 cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011979
11980 for (list = cm->num.head; list; list = list->next)
11981 for (entry = list->head; entry; entry = entry->next)
11982 {
hassofee6e4e2005-02-02 16:29:31 +000011983 vty_out (vty, "ip extcommunity-list %s %s %s%s",
11984 list->name, community_direct_str (entry->direct),
11985 community_list_config_str (entry), VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000011986 write++;
11987 }
11988 for (list = cm->str.head; list; list = list->next)
11989 for (entry = list->head; entry; entry = entry->next)
11990 {
11991 vty_out (vty, "ip extcommunity-list %s %s %s %s%s",
11992 entry->style == EXTCOMMUNITY_LIST_STANDARD
11993 ? "standard" : "expanded",
11994 list->name, community_direct_str (entry->direct),
11995 community_list_config_str (entry), VTY_NEWLINE);
11996 write++;
11997 }
11998 return write;
11999}
12000
Stephen Hemminger7fc626d2008-12-01 11:10:34 -080012001static struct cmd_node community_list_node =
paul718e3742002-12-13 20:15:29 +000012002{
12003 COMMUNITY_LIST_NODE,
12004 "",
12005 1 /* Export to vtysh. */
12006};
12007
paul94f2b392005-06-28 12:44:16 +000012008static void
12009community_list_vty (void)
paul718e3742002-12-13 20:15:29 +000012010{
12011 install_node (&community_list_node, community_list_config_write);
12012
12013 /* Community-list. */
paul718e3742002-12-13 20:15:29 +000012014 install_element (CONFIG_NODE, &ip_community_list_standard_cmd);
12015 install_element (CONFIG_NODE, &ip_community_list_standard2_cmd);
12016 install_element (CONFIG_NODE, &ip_community_list_expanded_cmd);
12017 install_element (CONFIG_NODE, &ip_community_list_name_standard_cmd);
12018 install_element (CONFIG_NODE, &ip_community_list_name_standard2_cmd);
12019 install_element (CONFIG_NODE, &ip_community_list_name_expanded_cmd);
hassofee6e4e2005-02-02 16:29:31 +000012020 install_element (CONFIG_NODE, &no_ip_community_list_standard_all_cmd);
12021 install_element (CONFIG_NODE, &no_ip_community_list_expanded_all_cmd);
12022 install_element (CONFIG_NODE, &no_ip_community_list_name_standard_all_cmd);
12023 install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_all_cmd);
paul718e3742002-12-13 20:15:29 +000012024 install_element (CONFIG_NODE, &no_ip_community_list_standard_cmd);
12025 install_element (CONFIG_NODE, &no_ip_community_list_expanded_cmd);
12026 install_element (CONFIG_NODE, &no_ip_community_list_name_standard_cmd);
12027 install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_cmd);
12028 install_element (VIEW_NODE, &show_ip_community_list_cmd);
12029 install_element (VIEW_NODE, &show_ip_community_list_arg_cmd);
12030 install_element (ENABLE_NODE, &show_ip_community_list_cmd);
12031 install_element (ENABLE_NODE, &show_ip_community_list_arg_cmd);
12032
12033 /* Extcommunity-list. */
12034 install_element (CONFIG_NODE, &ip_extcommunity_list_standard_cmd);
12035 install_element (CONFIG_NODE, &ip_extcommunity_list_standard2_cmd);
12036 install_element (CONFIG_NODE, &ip_extcommunity_list_expanded_cmd);
12037 install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard_cmd);
12038 install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard2_cmd);
12039 install_element (CONFIG_NODE, &ip_extcommunity_list_name_expanded_cmd);
hassofee6e4e2005-02-02 16:29:31 +000012040 install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_all_cmd);
12041 install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_all_cmd);
12042 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_all_cmd);
12043 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_all_cmd);
paul718e3742002-12-13 20:15:29 +000012044 install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_cmd);
12045 install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_cmd);
12046 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_cmd);
12047 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_cmd);
12048 install_element (VIEW_NODE, &show_ip_extcommunity_list_cmd);
12049 install_element (VIEW_NODE, &show_ip_extcommunity_list_arg_cmd);
12050 install_element (ENABLE_NODE, &show_ip_extcommunity_list_cmd);
12051 install_element (ENABLE_NODE, &show_ip_extcommunity_list_arg_cmd);
12052}