blob: cd3d9a0d0c9362f131f50ec70a6c5b01a79ae277 [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
Pradosh Mohapatraaf309fa2015-11-09 20:21:47 -05007355 vty_out (vty, "%5u %7d %7d %8d %4d %4d ",
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,
Pradosh Mohapatraaf309fa2015-11-09 20:21:47 -05007362 0, 0,
7363 peer->sync[afi][safi]->update.count +
7364 peer->sync[afi][safi]->withdraw.count);
paul718e3742002-12-13 20:15:29 +00007365
7366 vty_out (vty, "%8s",
7367 peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN));
7368
7369 if (peer->status == Established)
7370 {
7371 vty_out (vty, " %8ld", peer->pcount[afi][safi]);
7372 }
7373 else
7374 {
7375 if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN))
7376 vty_out (vty, " Idle (Admin)");
7377 else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW))
7378 vty_out (vty, " Idle (PfxCt)");
7379 else
7380 vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, peer->status));
7381 }
7382
7383 vty_out (vty, "%s", VTY_NEWLINE);
7384 }
7385 }
7386
7387 if (count)
7388 vty_out (vty, "%sTotal number of neighbors %d%s", VTY_NEWLINE,
7389 count, VTY_NEWLINE);
7390 else
7391 vty_out (vty, "No %s neighbor is configured%s",
7392 afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE);
7393 return CMD_SUCCESS;
7394}
7395
paul94f2b392005-06-28 12:44:16 +00007396static int
paulfd79ac92004-10-13 05:06:08 +00007397bgp_show_summary_vty (struct vty *vty, const char *name,
7398 afi_t afi, safi_t safi)
paul718e3742002-12-13 20:15:29 +00007399{
7400 struct bgp *bgp;
7401
7402 if (name)
7403 {
7404 bgp = bgp_lookup_by_name (name);
7405
7406 if (! bgp)
7407 {
7408 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
7409 return CMD_WARNING;
7410 }
7411
7412 bgp_show_summary (vty, bgp, afi, safi);
7413 return CMD_SUCCESS;
7414 }
7415
7416 bgp = bgp_get_default ();
7417
7418 if (bgp)
7419 bgp_show_summary (vty, bgp, afi, safi);
7420
7421 return CMD_SUCCESS;
7422}
7423
7424/* `show ip bgp summary' commands. */
Lou Bergerf9b6c392016-01-12 13:42:09 -05007425DEFUN (show_ip_bgp_summary,
7426 show_ip_bgp_summary_cmd,
7427 "show ip bgp summary",
7428 SHOW_STR
7429 IP_STR
7430 BGP_STR
7431 "Summary of BGP neighbor status\n")
7432{
7433 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
7434}
7435
7436DEFUN (show_ip_bgp_instance_summary,
7437 show_ip_bgp_instance_summary_cmd,
7438 "show ip bgp view WORD summary",
7439 SHOW_STR
7440 IP_STR
7441 BGP_STR
7442 "BGP view\n"
7443 "View name\n"
7444 "Summary of BGP neighbor status\n")
7445{
7446 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
7447}
7448
7449DEFUN (show_ip_bgp_ipv4_summary,
7450 show_ip_bgp_ipv4_summary_cmd,
7451 "show ip bgp ipv4 (unicast|multicast) summary",
7452 SHOW_STR
7453 IP_STR
7454 BGP_STR
7455 "Address family\n"
7456 "Address Family modifier\n"
7457 "Address Family modifier\n"
7458 "Summary of BGP neighbor status\n")
7459{
7460 if (strncmp (argv[0], "m", 1) == 0)
7461 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
7462
7463 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
7464}
7465
7466DEFUN (show_ip_bgp_instance_ipv4_summary,
7467 show_ip_bgp_instance_ipv4_summary_cmd,
7468 "show ip bgp view WORD ipv4 (unicast|multicast) summary",
7469 SHOW_STR
7470 IP_STR
7471 BGP_STR
7472 "BGP view\n"
7473 "View name\n"
7474 "Address family\n"
7475 "Address Family modifier\n"
7476 "Address Family modifier\n"
7477 "Summary of BGP neighbor status\n")
7478{
7479 if (strncmp (argv[1], "m", 1) == 0)
7480 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
7481 else
7482 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
7483}
7484
7485DEFUN (show_ip_bgp_vpnv4_all_summary,
7486 show_ip_bgp_vpnv4_all_summary_cmd,
7487 "show ip bgp vpnv4 all summary",
7488 SHOW_STR
7489 IP_STR
7490 BGP_STR
7491 "Display VPNv4 NLRI specific information\n"
7492 "Display information about all VPNv4 NLRIs\n"
7493 "Summary of BGP neighbor status\n")
7494{
7495 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
7496}
7497
7498DEFUN (show_ip_bgp_vpnv4_rd_summary,
7499 show_ip_bgp_vpnv4_rd_summary_cmd,
7500 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn summary",
7501 SHOW_STR
7502 IP_STR
7503 BGP_STR
7504 "Display VPNv4 NLRI specific information\n"
7505 "Display information for a route distinguisher\n"
7506 "VPN Route Distinguisher\n"
7507 "Summary of BGP neighbor status\n")
7508{
7509 int ret;
7510 struct prefix_rd prd;
7511
7512 ret = str2prefix_rd (argv[0], &prd);
7513 if (! ret)
7514 {
7515 vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
7516 return CMD_WARNING;
7517 }
7518
7519 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
7520}
7521
Lou Berger651b4022016-01-12 13:42:07 -05007522DEFUN (show_bgp_ipv4_safi_summary,
7523 show_bgp_ipv4_safi_summary_cmd,
7524 "show bgp ipv4 (unicast|multicast) summary",
paul718e3742002-12-13 20:15:29 +00007525 SHOW_STR
paul718e3742002-12-13 20:15:29 +00007526 BGP_STR
7527 "Address family\n"
7528 "Address Family modifier\n"
7529 "Address Family modifier\n"
7530 "Summary of BGP neighbor status\n")
7531{
7532 if (strncmp (argv[0], "m", 1) == 0)
7533 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
7534
7535 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
7536}
7537
Lou Berger651b4022016-01-12 13:42:07 -05007538DEFUN (show_bgp_instance_ipv4_safi_summary,
7539 show_bgp_instance_ipv4_safi_summary_cmd,
7540 "show bgp view WORD ipv4 (unicast|multicast) summary",
Michael Lambert95cbbd22010-07-23 14:43:04 -04007541 SHOW_STR
7542 BGP_STR
paul718e3742002-12-13 20:15:29 +00007543 "BGP view\n"
7544 "View name\n"
7545 "Address family\n"
7546 "Address Family modifier\n"
7547 "Address Family modifier\n"
7548 "Summary of BGP neighbor status\n")
7549{
7550 if (strncmp (argv[1], "m", 1) == 0)
7551 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
7552 else
7553 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
7554}
7555
Lou Berger651b4022016-01-12 13:42:07 -05007556DEFUN (show_bgp_ipv4_vpn_summary,
7557 show_bgp_ipv4_vpn_summary_cmd,
7558 "show bgp ipv4 vpn summary",
Michael Lambert95cbbd22010-07-23 14:43:04 -04007559 SHOW_STR
7560 BGP_STR
Lou Berger651b4022016-01-12 13:42:07 -05007561 "IPv4\n"
7562 "Display VPN NLRI specific information\n"
paul718e3742002-12-13 20:15:29 +00007563 "Summary of BGP neighbor status\n")
7564{
7565 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
7566}
7567
Lou Berger651b4022016-01-12 13:42:07 -05007568/* `show ip bgp summary' commands. */
7569DEFUN (show_bgp_ipv6_vpn_summary,
7570 show_bgp_ipv6_vpn_summary_cmd,
7571 "show bgp ipv6 vpn summary",
paul718e3742002-12-13 20:15:29 +00007572 SHOW_STR
7573 BGP_STR
Lou Berger651b4022016-01-12 13:42:07 -05007574 "IPv6\n"
7575 "Display VPN NLRI specific information\n"
paul718e3742002-12-13 20:15:29 +00007576 "Summary of BGP neighbor status\n")
7577{
Lou Berger651b4022016-01-12 13:42:07 -05007578 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MPLS_VPN);
paul718e3742002-12-13 20:15:29 +00007579}
Lou Berger651b4022016-01-12 13:42:07 -05007580
7581DEFUN (show_bgp_ipv4_encap_summary,
7582 show_bgp_ipv4_encap_summary_cmd,
7583 "show bgp ipv4 encap summary",
7584 SHOW_STR
7585 BGP_STR
7586 "IPv4\n"
7587 "Display ENCAP NLRI specific information\n"
7588 "Summary of BGP neighbor status\n")
7589{
7590 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_ENCAP);
7591}
7592
Lou Berger651b4022016-01-12 13:42:07 -05007593DEFUN (show_bgp_ipv6_encap_summary,
7594 show_bgp_ipv6_encap_summary_cmd,
7595 "show bgp ipv6 encap summary",
7596 SHOW_STR
7597 BGP_STR
7598 "IPv6\n"
7599 "Display ENCAP NLRI specific information\n"
7600 "Summary of BGP neighbor status\n")
7601{
7602 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_ENCAP);
7603}
7604
paul718e3742002-12-13 20:15:29 +00007605DEFUN (show_bgp_instance_summary,
7606 show_bgp_instance_summary_cmd,
7607 "show bgp view WORD summary",
7608 SHOW_STR
7609 BGP_STR
7610 "BGP view\n"
7611 "View name\n"
7612 "Summary of BGP neighbor status\n")
7613{
Lou Berger651b4022016-01-12 13:42:07 -05007614 vty_out(vty, "%sIPv4 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7615 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7616 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
7617 vty_out(vty, "%sIPv4 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7618 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7619 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
7620 vty_out(vty, "%sIPv4 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7621 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7622 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MPLS_VPN);
7623 vty_out(vty, "%sIPv4 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7624 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7625 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_ENCAP);
7626
Lou Berger651b4022016-01-12 13:42:07 -05007627 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7628 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7629 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
7630 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7631 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7632 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST);
7633 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7634 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7635 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MPLS_VPN);
7636 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7637 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7638 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_ENCAP);
Lou Berger205e6742016-01-12 13:42:11 -05007639
Lou Berger651b4022016-01-12 13:42:07 -05007640 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00007641}
7642
Lou Berger651b4022016-01-12 13:42:07 -05007643DEFUN (show_bgp_instance_ipv4_summary,
7644 show_bgp_instance_ipv4_summary_cmd,
7645 "show bgp view WORD ipv4 summary",
paul718e3742002-12-13 20:15:29 +00007646 SHOW_STR
7647 BGP_STR
Lou Berger651b4022016-01-12 13:42:07 -05007648 IP_STR
7649 "Address Family modifier\n"
7650 "Address Family modifier\n"
7651 "BGP view\n"
7652 "View name\n"
paul718e3742002-12-13 20:15:29 +00007653 "Summary of BGP neighbor status\n")
Lou Berger651b4022016-01-12 13:42:07 -05007654{
7655 vty_out(vty, "%sIPv4 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7656 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7657 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
7658 vty_out(vty, "%sIPv4 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7659 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7660 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
7661 vty_out(vty, "%sIPv4 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7662 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7663 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MPLS_VPN);
7664 vty_out(vty, "%sIPv4 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7665 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7666 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_ENCAP);
paul718e3742002-12-13 20:15:29 +00007667
Lou Berger651b4022016-01-12 13:42:07 -05007668 return CMD_SUCCESS;
7669}
7670
Lou Berger651b4022016-01-12 13:42:07 -05007671DEFUN (show_bgp_instance_ipv6_summary,
paul718e3742002-12-13 20:15:29 +00007672 show_bgp_instance_ipv6_summary_cmd,
7673 "show bgp view WORD ipv6 summary",
7674 SHOW_STR
7675 BGP_STR
Lou Berger651b4022016-01-12 13:42:07 -05007676 IPV6_STR
7677 "Address Family modifier\n"
7678 "Address Family modifier\n"
paul718e3742002-12-13 20:15:29 +00007679 "BGP view\n"
7680 "View name\n"
paul718e3742002-12-13 20:15:29 +00007681 "Summary of BGP neighbor status\n")
Lou Berger651b4022016-01-12 13:42:07 -05007682{
7683 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7684 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7685 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
7686 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7687 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7688 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST);
7689 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7690 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7691 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MPLS_VPN);
7692 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7693 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7694 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_ENCAP);
7695
7696 return CMD_SUCCESS;
7697}
paul718e3742002-12-13 20:15:29 +00007698
Michael Lambert95cbbd22010-07-23 14:43:04 -04007699DEFUN (show_bgp_ipv6_safi_summary,
7700 show_bgp_ipv6_safi_summary_cmd,
7701 "show bgp ipv6 (unicast|multicast) summary",
7702 SHOW_STR
7703 BGP_STR
7704 "Address family\n"
7705 "Address Family modifier\n"
7706 "Address Family modifier\n"
7707 "Summary of BGP neighbor status\n")
7708{
7709 if (strncmp (argv[0], "m", 1) == 0)
7710 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
7711
7712 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
7713}
7714
7715DEFUN (show_bgp_instance_ipv6_safi_summary,
7716 show_bgp_instance_ipv6_safi_summary_cmd,
7717 "show bgp view WORD ipv6 (unicast|multicast) summary",
7718 SHOW_STR
7719 BGP_STR
7720 "BGP view\n"
7721 "View name\n"
7722 "Address family\n"
7723 "Address Family modifier\n"
7724 "Address Family modifier\n"
7725 "Summary of BGP neighbor status\n")
7726{
7727 if (strncmp (argv[1], "m", 1) == 0)
7728 return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST);
7729
7730 return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
7731}
7732
Lou Bergerf9b6c392016-01-12 13:42:09 -05007733/* old command */
7734DEFUN (show_ipv6_bgp_summary,
7735 show_ipv6_bgp_summary_cmd,
7736 "show ipv6 bgp summary",
7737 SHOW_STR
7738 IPV6_STR
7739 BGP_STR
7740 "Summary of BGP neighbor status\n")
7741{
7742 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
7743}
7744
7745/* old command */
7746DEFUN (show_ipv6_mbgp_summary,
7747 show_ipv6_mbgp_summary_cmd,
7748 "show ipv6 mbgp summary",
7749 SHOW_STR
7750 IPV6_STR
7751 MBGP_STR
7752 "Summary of BGP neighbor status\n")
7753{
7754 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
7755}
Lou Berger651b4022016-01-12 13:42:07 -05007756
7757/* variations of show bgp [...] summary */
7758
7759/* This one is for the 0-keyword variant */
7760DEFUN (show_bgp_summary,
7761 show_bgp_summary_cmd,
7762 "show bgp summary",
paul718e3742002-12-13 20:15:29 +00007763 SHOW_STR
paul718e3742002-12-13 20:15:29 +00007764 BGP_STR
7765 "Summary of BGP neighbor status\n")
7766{
Lou Berger651b4022016-01-12 13:42:07 -05007767 vty_out(vty, "%sIPv4 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7768 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7769 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
7770 vty_out(vty, "%sIPv4 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7771 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7772 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
7773 vty_out(vty, "%sIPv4 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7774 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7775 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
7776 vty_out(vty, "%sIPv4 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7777 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7778 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_ENCAP);
7779
Lou Berger651b4022016-01-12 13:42:07 -05007780 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7781 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7782 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
7783 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7784 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7785 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
7786 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7787 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7788 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MPLS_VPN);
7789 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7790 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7791 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_ENCAP);
Lou Berger205e6742016-01-12 13:42:11 -05007792
Lou Berger651b4022016-01-12 13:42:07 -05007793 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00007794}
7795
Lou Bergerf9b6c392016-01-12 13:42:09 -05007796ALIAS (show_bgp_summary,
7797 show_bgp_ipv6_summary_cmd,
7798 "show bgp ipv6 summary",
7799 SHOW_STR
7800 BGP_STR
7801 "Address family\n"
7802 "Summary of BGP neighbor status\n")
7803
Lou Berger651b4022016-01-12 13:42:07 -05007804DEFUN (show_bgp_summary_1w,
7805 show_bgp_summary_1w_cmd,
Lou Berger651b4022016-01-12 13:42:07 -05007806 "show bgp (ipv4|ipv6|unicast|multicast|vpn|encap) summary",
paul718e3742002-12-13 20:15:29 +00007807 SHOW_STR
Lou Berger651b4022016-01-12 13:42:07 -05007808 BGP_STR
7809 IP_STR
Lou Berger651b4022016-01-12 13:42:07 -05007810 IP6_STR
Lou Berger651b4022016-01-12 13:42:07 -05007811 "Address Family modifier\n"
7812 "Address Family modifier\n"
7813 "Address Family modifier\n"
7814 "Address Family modifier\n"
paul718e3742002-12-13 20:15:29 +00007815 "Summary of BGP neighbor status\n")
7816{
Lou Berger651b4022016-01-12 13:42:07 -05007817 if (strcmp (argv[0], "ipv4") == 0) {
7818 vty_out(vty, "%sIPv4 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7819 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7820 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
7821 vty_out(vty, "%sIPv4 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7822 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7823 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
7824 vty_out(vty, "%sIPv4 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7825 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7826 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
7827 vty_out(vty, "%sIPv4 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7828 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7829 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_ENCAP);
7830 return CMD_SUCCESS;
7831 }
Lou Berger205e6742016-01-12 13:42:11 -05007832
Lou Berger651b4022016-01-12 13:42:07 -05007833 if (strcmp (argv[0], "ipv6") == 0) {
7834 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7835 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7836 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
7837 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7838 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7839 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
7840 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7841 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7842 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MPLS_VPN);
7843 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7844 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7845 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_ENCAP);
7846 return CMD_SUCCESS;
7847 }
Lou Berger205e6742016-01-12 13:42:11 -05007848
Lou Berger651b4022016-01-12 13:42:07 -05007849 if (strcmp (argv[0], "unicast") == 0) {
7850 vty_out(vty, "IPv4 Unicast Summary:%s", VTY_NEWLINE);
7851 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7852 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
Lou Berger651b4022016-01-12 13:42:07 -05007853 vty_out(vty, "%s", VTY_NEWLINE);
7854 vty_out(vty, "IPv6 Unicast Summary:%s", VTY_NEWLINE);
7855 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7856 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
Lou Berger651b4022016-01-12 13:42:07 -05007857 return CMD_SUCCESS;
7858 }
7859 if (strcmp (argv[0], "multicast") == 0) {
7860 vty_out(vty, "IPv4 Multicast Summary:%s", VTY_NEWLINE);
7861 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7862 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
Lou Berger651b4022016-01-12 13:42:07 -05007863 vty_out(vty, "%s", VTY_NEWLINE);
7864 vty_out(vty, "IPv6 Multicast Summary:%s", VTY_NEWLINE);
7865 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7866 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
Lou Berger651b4022016-01-12 13:42:07 -05007867 return CMD_SUCCESS;
7868 }
7869 if (strcmp (argv[0], "vpn") == 0) {
7870 vty_out(vty, "IPv4 VPN Summary:%s", VTY_NEWLINE);
7871 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7872 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
Lou Berger651b4022016-01-12 13:42:07 -05007873 vty_out(vty, "%s", VTY_NEWLINE);
7874 vty_out(vty, "IPv6 VPN Summary:%s", VTY_NEWLINE);
7875 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7876 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MPLS_VPN);
Lou Berger651b4022016-01-12 13:42:07 -05007877 return CMD_SUCCESS;
7878 }
7879 if (strcmp (argv[0], "encap") == 0) {
7880 vty_out(vty, "IPv4 Encap Summary:%s", VTY_NEWLINE);
7881 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7882 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_ENCAP);
Lou Berger651b4022016-01-12 13:42:07 -05007883 vty_out(vty, "%s", VTY_NEWLINE);
7884 vty_out(vty, "IPv6 Encap Summary:%s", VTY_NEWLINE);
7885 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7886 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_ENCAP);
Lou Berger651b4022016-01-12 13:42:07 -05007887 return CMD_SUCCESS;
7888 }
7889 vty_out(vty, "Unknown keyword: %s%s", argv[0], VTY_NEWLINE);
7890 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00007891}
Lou Berger651b4022016-01-12 13:42:07 -05007892
7893
David Lamparter6b0655a2014-06-04 06:53:35 +02007894
paulfd79ac92004-10-13 05:06:08 +00007895const char *
hasso538621f2004-05-21 09:31:30 +00007896afi_safi_print (afi_t afi, safi_t safi)
7897{
7898 if (afi == AFI_IP && safi == SAFI_UNICAST)
7899 return "IPv4 Unicast";
7900 else if (afi == AFI_IP && safi == SAFI_MULTICAST)
7901 return "IPv4 Multicast";
7902 else if (afi == AFI_IP && safi == SAFI_MPLS_VPN)
Lou Berger9da04bc2016-01-12 13:41:55 -05007903 return "VPN-IPv4 Unicast";
Lou Bergera3fda882016-01-12 13:42:04 -05007904 else if (afi == AFI_IP && safi == SAFI_ENCAP)
7905 return "ENCAP-IPv4 Unicast";
hasso538621f2004-05-21 09:31:30 +00007906 else if (afi == AFI_IP6 && safi == SAFI_UNICAST)
7907 return "IPv6 Unicast";
7908 else if (afi == AFI_IP6 && safi == SAFI_MULTICAST)
7909 return "IPv6 Multicast";
Lou Berger9da04bc2016-01-12 13:41:55 -05007910 else if (afi == AFI_IP6 && safi == SAFI_MPLS_VPN)
7911 return "VPN-IPv6 Unicast";
Lou Bergera3fda882016-01-12 13:42:04 -05007912 else if (afi == AFI_IP6 && safi == SAFI_ENCAP)
7913 return "ENCAP-IPv6 Unicast";
hasso538621f2004-05-21 09:31:30 +00007914 else
7915 return "Unknown";
7916}
7917
paul718e3742002-12-13 20:15:29 +00007918/* Show BGP peer's information. */
7919enum show_type
7920{
7921 show_all,
7922 show_peer
7923};
7924
paul94f2b392005-06-28 12:44:16 +00007925static void
paul718e3742002-12-13 20:15:29 +00007926bgp_show_peer_afi_orf_cap (struct vty *vty, struct peer *p,
7927 afi_t afi, safi_t safi,
7928 u_int16_t adv_smcap, u_int16_t adv_rmcap,
7929 u_int16_t rcv_smcap, u_int16_t rcv_rmcap)
7930{
7931 /* Send-Mode */
7932 if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap)
7933 || CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap))
7934 {
7935 vty_out (vty, " Send-mode: ");
7936 if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap))
7937 vty_out (vty, "advertised");
7938 if (CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap))
7939 vty_out (vty, "%sreceived",
7940 CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) ?
7941 ", " : "");
7942 vty_out (vty, "%s", VTY_NEWLINE);
7943 }
7944
7945 /* Receive-Mode */
7946 if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap)
7947 || CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap))
7948 {
7949 vty_out (vty, " Receive-mode: ");
7950 if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap))
7951 vty_out (vty, "advertised");
7952 if (CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap))
7953 vty_out (vty, "%sreceived",
7954 CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) ?
7955 ", " : "");
7956 vty_out (vty, "%s", VTY_NEWLINE);
7957 }
7958}
7959
paul94f2b392005-06-28 12:44:16 +00007960static void
paul718e3742002-12-13 20:15:29 +00007961bgp_show_peer_afi (struct vty *vty, struct peer *p, afi_t afi, safi_t safi)
7962{
7963 struct bgp_filter *filter;
7964 char orf_pfx_name[BUFSIZ];
7965 int orf_pfx_count;
7966
7967 filter = &p->filter[afi][safi];
7968
hasso538621f2004-05-21 09:31:30 +00007969 vty_out (vty, " For address family: %s%s", afi_safi_print (afi, safi),
paul718e3742002-12-13 20:15:29 +00007970 VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00007971
paul718e3742002-12-13 20:15:29 +00007972 if (p->af_group[afi][safi])
7973 vty_out (vty, " %s peer-group member%s", p->group->name, VTY_NEWLINE);
7974
7975 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
7976 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
7977 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)
7978 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
7979 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV)
7980 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
7981 vty_out (vty, " AF-dependant capabilities:%s", VTY_NEWLINE);
7982
7983 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
7984 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
7985 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
7986 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV))
7987 {
7988 vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
7989 ORF_TYPE_PREFIX, VTY_NEWLINE);
7990 bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
7991 PEER_CAP_ORF_PREFIX_SM_ADV,
7992 PEER_CAP_ORF_PREFIX_RM_ADV,
7993 PEER_CAP_ORF_PREFIX_SM_RCV,
7994 PEER_CAP_ORF_PREFIX_RM_RCV);
7995 }
7996 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
7997 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)
7998 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
7999 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
8000 {
8001 vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
8002 ORF_TYPE_PREFIX_OLD, VTY_NEWLINE);
8003 bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
8004 PEER_CAP_ORF_PREFIX_SM_ADV,
8005 PEER_CAP_ORF_PREFIX_RM_ADV,
8006 PEER_CAP_ORF_PREFIX_SM_OLD_RCV,
8007 PEER_CAP_ORF_PREFIX_RM_OLD_RCV);
8008 }
8009
8010 sprintf (orf_pfx_name, "%s.%d.%d", p->host, afi, safi);
8011 orf_pfx_count = prefix_bgp_show_prefix_list (NULL, afi, orf_pfx_name);
8012
8013 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND)
8014 || orf_pfx_count)
8015 {
8016 vty_out (vty, " Outbound Route Filter (ORF):");
8017 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND))
8018 vty_out (vty, " sent;");
8019 if (orf_pfx_count)
8020 vty_out (vty, " received (%d entries)", orf_pfx_count);
8021 vty_out (vty, "%s", VTY_NEWLINE);
8022 }
8023 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH))
8024 vty_out (vty, " First update is deferred until ORF or ROUTE-REFRESH is received%s", VTY_NEWLINE);
8025
8026 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT))
8027 vty_out (vty, " Route-Reflector Client%s", VTY_NEWLINE);
8028 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT))
8029 vty_out (vty, " Route-Server Client%s", VTY_NEWLINE);
8030 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG))
8031 vty_out (vty, " Inbound soft reconfiguration allowed%s", VTY_NEWLINE);
8032 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS))
8033 vty_out (vty, " Private AS number removed from updates to this neighbor%s", VTY_NEWLINE);
8034 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF))
8035 vty_out (vty, " NEXT_HOP is always this router%s", VTY_NEWLINE);
8036 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED))
8037 vty_out (vty, " AS_PATH is propagated unchanged to this neighbor%s", VTY_NEWLINE);
8038 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED))
8039 vty_out (vty, " NEXT_HOP is propagated unchanged to this neighbor%s", VTY_NEWLINE);
8040 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED))
8041 vty_out (vty, " MED is propagated unchanged to this neighbor%s", VTY_NEWLINE);
8042 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
8043 || CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
8044 {
8045 vty_out (vty, " Community attribute sent to this neighbor");
8046 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
8047 && CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
hasso538621f2004-05-21 09:31:30 +00008048 vty_out (vty, "(both)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008049 else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
hasso538621f2004-05-21 09:31:30 +00008050 vty_out (vty, "(extended)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008051 else
hasso538621f2004-05-21 09:31:30 +00008052 vty_out (vty, "(standard)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008053 }
8054 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE))
8055 {
8056 vty_out (vty, " Default information originate,");
8057
8058 if (p->default_rmap[afi][safi].name)
8059 vty_out (vty, " default route-map %s%s,",
8060 p->default_rmap[afi][safi].map ? "*" : "",
8061 p->default_rmap[afi][safi].name);
8062 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_DEFAULT_ORIGINATE))
8063 vty_out (vty, " default sent%s", VTY_NEWLINE);
8064 else
8065 vty_out (vty, " default not sent%s", VTY_NEWLINE);
8066 }
8067
8068 if (filter->plist[FILTER_IN].name
8069 || filter->dlist[FILTER_IN].name
8070 || filter->aslist[FILTER_IN].name
paulfee0f4c2004-09-13 05:12:46 +00008071 || filter->map[RMAP_IN].name)
paul718e3742002-12-13 20:15:29 +00008072 vty_out (vty, " Inbound path policy configured%s", VTY_NEWLINE);
8073 if (filter->plist[FILTER_OUT].name
8074 || filter->dlist[FILTER_OUT].name
8075 || filter->aslist[FILTER_OUT].name
paulfee0f4c2004-09-13 05:12:46 +00008076 || filter->map[RMAP_OUT].name
paul718e3742002-12-13 20:15:29 +00008077 || filter->usmap.name)
8078 vty_out (vty, " Outbound path policy configured%s", VTY_NEWLINE);
paulfee0f4c2004-09-13 05:12:46 +00008079 if (filter->map[RMAP_IMPORT].name)
8080 vty_out (vty, " Import policy for this RS-client configured%s", VTY_NEWLINE);
8081 if (filter->map[RMAP_EXPORT].name)
8082 vty_out (vty, " Export policy for this RS-client configured%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008083
8084 /* prefix-list */
8085 if (filter->plist[FILTER_IN].name)
8086 vty_out (vty, " Incoming update prefix filter list is %s%s%s",
8087 filter->plist[FILTER_IN].plist ? "*" : "",
8088 filter->plist[FILTER_IN].name,
8089 VTY_NEWLINE);
8090 if (filter->plist[FILTER_OUT].name)
8091 vty_out (vty, " Outgoing update prefix filter list is %s%s%s",
8092 filter->plist[FILTER_OUT].plist ? "*" : "",
8093 filter->plist[FILTER_OUT].name,
8094 VTY_NEWLINE);
8095
8096 /* distribute-list */
8097 if (filter->dlist[FILTER_IN].name)
8098 vty_out (vty, " Incoming update network filter list is %s%s%s",
8099 filter->dlist[FILTER_IN].alist ? "*" : "",
8100 filter->dlist[FILTER_IN].name,
8101 VTY_NEWLINE);
8102 if (filter->dlist[FILTER_OUT].name)
8103 vty_out (vty, " Outgoing update network filter list is %s%s%s",
8104 filter->dlist[FILTER_OUT].alist ? "*" : "",
8105 filter->dlist[FILTER_OUT].name,
8106 VTY_NEWLINE);
8107
8108 /* filter-list. */
8109 if (filter->aslist[FILTER_IN].name)
8110 vty_out (vty, " Incoming update AS path filter list is %s%s%s",
8111 filter->aslist[FILTER_IN].aslist ? "*" : "",
8112 filter->aslist[FILTER_IN].name,
8113 VTY_NEWLINE);
8114 if (filter->aslist[FILTER_OUT].name)
8115 vty_out (vty, " Outgoing update AS path filter list is %s%s%s",
8116 filter->aslist[FILTER_OUT].aslist ? "*" : "",
8117 filter->aslist[FILTER_OUT].name,
8118 VTY_NEWLINE);
8119
8120 /* route-map. */
paulfee0f4c2004-09-13 05:12:46 +00008121 if (filter->map[RMAP_IN].name)
paul718e3742002-12-13 20:15:29 +00008122 vty_out (vty, " Route map for incoming advertisements is %s%s%s",
paulfee0f4c2004-09-13 05:12:46 +00008123 filter->map[RMAP_IN].map ? "*" : "",
8124 filter->map[RMAP_IN].name,
paul718e3742002-12-13 20:15:29 +00008125 VTY_NEWLINE);
paulfee0f4c2004-09-13 05:12:46 +00008126 if (filter->map[RMAP_OUT].name)
paul718e3742002-12-13 20:15:29 +00008127 vty_out (vty, " Route map for outgoing advertisements is %s%s%s",
paulfee0f4c2004-09-13 05:12:46 +00008128 filter->map[RMAP_OUT].map ? "*" : "",
8129 filter->map[RMAP_OUT].name,
8130 VTY_NEWLINE);
8131 if (filter->map[RMAP_IMPORT].name)
8132 vty_out (vty, " Route map for advertisements going into this RS-client's table is %s%s%s",
8133 filter->map[RMAP_IMPORT].map ? "*" : "",
8134 filter->map[RMAP_IMPORT].name,
8135 VTY_NEWLINE);
8136 if (filter->map[RMAP_EXPORT].name)
8137 vty_out (vty, " Route map for advertisements coming from this RS-client is %s%s%s",
8138 filter->map[RMAP_EXPORT].map ? "*" : "",
8139 filter->map[RMAP_EXPORT].name,
paul718e3742002-12-13 20:15:29 +00008140 VTY_NEWLINE);
8141
8142 /* unsuppress-map */
8143 if (filter->usmap.name)
8144 vty_out (vty, " Route map for selective unsuppress is %s%s%s",
8145 filter->usmap.map ? "*" : "",
8146 filter->usmap.name, VTY_NEWLINE);
8147
8148 /* Receive prefix count */
hassoe0701b72004-05-20 09:19:34 +00008149 vty_out (vty, " %ld accepted prefixes%s", p->pcount[afi][safi], VTY_NEWLINE);
8150
paul718e3742002-12-13 20:15:29 +00008151 /* Maximum prefix */
8152 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX))
8153 {
hasso0a486e52005-02-01 20:57:17 +00008154 vty_out (vty, " Maximum prefixes allowed %ld%s%s", p->pmax[afi][safi],
paul718e3742002-12-13 20:15:29 +00008155 CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING)
hasso0a486e52005-02-01 20:57:17 +00008156 ? " (warning-only)" : "", VTY_NEWLINE);
8157 vty_out (vty, " Threshold for warning message %d%%",
8158 p->pmax_threshold[afi][safi]);
8159 if (p->pmax_restart[afi][safi])
8160 vty_out (vty, ", restart interval %d min", p->pmax_restart[afi][safi]);
8161 vty_out (vty, "%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008162 }
paul718e3742002-12-13 20:15:29 +00008163
8164 vty_out (vty, "%s", VTY_NEWLINE);
8165}
8166
paul94f2b392005-06-28 12:44:16 +00008167static void
paul718e3742002-12-13 20:15:29 +00008168bgp_show_peer (struct vty *vty, struct peer *p)
8169{
8170 struct bgp *bgp;
8171 char buf1[BUFSIZ];
8172 char timebuf[BGP_UPTIME_LEN];
hasso538621f2004-05-21 09:31:30 +00008173 afi_t afi;
8174 safi_t safi;
paul718e3742002-12-13 20:15:29 +00008175
8176 bgp = p->bgp;
8177
8178 /* Configured IP address. */
8179 vty_out (vty, "BGP neighbor is %s, ", p->host);
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04008180 vty_out (vty, "remote AS %u, ", p->as);
Andrew Certain9d3f9702012-11-07 23:50:07 +00008181 vty_out (vty, "local AS %u%s%s, ",
paul718e3742002-12-13 20:15:29 +00008182 p->change_local_as ? p->change_local_as : p->local_as,
8183 CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND) ?
Andrew Certain9d3f9702012-11-07 23:50:07 +00008184 " no-prepend" : "",
8185 CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_REPLACE_AS) ?
8186 " replace-as" : "");
paul718e3742002-12-13 20:15:29 +00008187 vty_out (vty, "%s link%s",
8188 p->as == p->local_as ? "internal" : "external",
8189 VTY_NEWLINE);
8190
8191 /* Description. */
8192 if (p->desc)
8193 vty_out (vty, " Description: %s%s", p->desc, VTY_NEWLINE);
8194
8195 /* Peer-group */
8196 if (p->group)
8197 vty_out (vty, " Member of peer-group %s for session parameters%s",
8198 p->group->name, VTY_NEWLINE);
8199
8200 /* Administrative shutdown. */
8201 if (CHECK_FLAG (p->flags, PEER_FLAG_SHUTDOWN))
8202 vty_out (vty, " Administratively shut down%s", VTY_NEWLINE);
8203
8204 /* BGP Version. */
8205 vty_out (vty, " BGP version 4");
paul718e3742002-12-13 20:15:29 +00008206 vty_out (vty, ", remote router ID %s%s",
8207 inet_ntop (AF_INET, &p->remote_id, buf1, BUFSIZ),
8208 VTY_NEWLINE);
8209
8210 /* Confederation */
hassoe0701b72004-05-20 09:19:34 +00008211 if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION)
8212 && bgp_confederation_peers_check (bgp, p->as))
paul718e3742002-12-13 20:15:29 +00008213 vty_out (vty, " Neighbor under common administration%s", VTY_NEWLINE);
8214
8215 /* Status. */
8216 vty_out (vty, " BGP state = %s",
8217 LOOKUP (bgp_status_msg, p->status));
8218 if (p->status == Established)
8219 vty_out (vty, ", up for %8s",
8220 peer_uptime (p->uptime, timebuf, BGP_UPTIME_LEN));
hasso93406d82005-02-02 14:40:33 +00008221 else if (p->status == Active)
8222 {
8223 if (CHECK_FLAG (p->flags, PEER_FLAG_PASSIVE))
8224 vty_out (vty, " (passive)");
8225 else if (CHECK_FLAG (p->sflags, PEER_STATUS_NSF_WAIT))
8226 vty_out (vty, " (NSF passive)");
8227 }
paul718e3742002-12-13 20:15:29 +00008228 vty_out (vty, "%s", VTY_NEWLINE);
8229
8230 /* read timer */
8231 vty_out (vty, " Last read %s", peer_uptime (p->readtime, timebuf, BGP_UPTIME_LEN));
8232
8233 /* Configured timer values. */
8234 vty_out (vty, ", hold time is %d, keepalive interval is %d seconds%s",
8235 p->v_holdtime, p->v_keepalive, VTY_NEWLINE);
8236 if (CHECK_FLAG (p->config, PEER_CONFIG_TIMER))
8237 {
8238 vty_out (vty, " Configured hold time is %d", p->holdtime);
8239 vty_out (vty, ", keepalive interval is %d seconds%s",
8240 p->keepalive, VTY_NEWLINE);
8241 }
hasso93406d82005-02-02 14:40:33 +00008242
paul718e3742002-12-13 20:15:29 +00008243 /* Capability. */
8244 if (p->status == Established)
8245 {
hasso538621f2004-05-21 09:31:30 +00008246 if (p->cap
paul718e3742002-12-13 20:15:29 +00008247 || p->afc_adv[AFI_IP][SAFI_UNICAST]
8248 || p->afc_recv[AFI_IP][SAFI_UNICAST]
8249 || p->afc_adv[AFI_IP][SAFI_MULTICAST]
8250 || p->afc_recv[AFI_IP][SAFI_MULTICAST]
paul718e3742002-12-13 20:15:29 +00008251 || p->afc_adv[AFI_IP6][SAFI_UNICAST]
8252 || p->afc_recv[AFI_IP6][SAFI_UNICAST]
8253 || p->afc_adv[AFI_IP6][SAFI_MULTICAST]
8254 || p->afc_recv[AFI_IP6][SAFI_MULTICAST]
Lou Berger9da04bc2016-01-12 13:41:55 -05008255 || p->afc_adv[AFI_IP6][SAFI_MPLS_VPN]
8256 || p->afc_recv[AFI_IP6][SAFI_MPLS_VPN]
Lou Bergera3fda882016-01-12 13:42:04 -05008257 || p->afc_adv[AFI_IP6][SAFI_ENCAP]
8258 || p->afc_recv[AFI_IP6][SAFI_ENCAP]
Lou Bergera3fda882016-01-12 13:42:04 -05008259 || p->afc_adv[AFI_IP][SAFI_ENCAP]
8260 || p->afc_recv[AFI_IP][SAFI_ENCAP]
paul718e3742002-12-13 20:15:29 +00008261 || p->afc_adv[AFI_IP][SAFI_MPLS_VPN]
8262 || p->afc_recv[AFI_IP][SAFI_MPLS_VPN])
8263 {
8264 vty_out (vty, " Neighbor capabilities:%s", VTY_NEWLINE);
8265
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00008266 /* AS4 */
8267 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV)
8268 || CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV))
8269 {
8270 vty_out (vty, " 4 Byte AS:");
8271 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV))
8272 vty_out (vty, " advertised");
8273 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV))
8274 vty_out (vty, " %sreceived",
8275 CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV) ? "and " : "");
8276 vty_out (vty, "%s", VTY_NEWLINE);
8277 }
paul718e3742002-12-13 20:15:29 +00008278 /* Dynamic */
8279 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)
8280 || CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV))
8281 {
8282 vty_out (vty, " Dynamic:");
8283 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV))
8284 vty_out (vty, " advertised");
8285 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV))
hasso538621f2004-05-21 09:31:30 +00008286 vty_out (vty, " %sreceived",
8287 CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV) ? "and " : "");
paul718e3742002-12-13 20:15:29 +00008288 vty_out (vty, "%s", VTY_NEWLINE);
8289 }
8290
8291 /* Route Refresh */
8292 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV)
8293 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)
8294 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
8295 {
8296 vty_out (vty, " Route refresh:");
8297 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV))
8298 vty_out (vty, " advertised");
8299 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)
8300 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
hasso538621f2004-05-21 09:31:30 +00008301 vty_out (vty, " %sreceived(%s)",
8302 CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) ? "and " : "",
8303 (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)
8304 && CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)) ?
8305 "old & new" : CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) ? "old" : "new");
8306
paul718e3742002-12-13 20:15:29 +00008307 vty_out (vty, "%s", VTY_NEWLINE);
8308 }
8309
hasso538621f2004-05-21 09:31:30 +00008310 /* Multiprotocol Extensions */
8311 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
8312 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
8313 if (p->afc_adv[afi][safi] || p->afc_recv[afi][safi])
paul718e3742002-12-13 20:15:29 +00008314 {
hasso538621f2004-05-21 09:31:30 +00008315 vty_out (vty, " Address family %s:", afi_safi_print (afi, safi));
8316 if (p->afc_adv[afi][safi])
8317 vty_out (vty, " advertised");
8318 if (p->afc_recv[afi][safi])
8319 vty_out (vty, " %sreceived", p->afc_adv[afi][safi] ? "and " : "");
8320 vty_out (vty, "%s", VTY_NEWLINE);
8321 }
8322
8323 /* Gracefull Restart */
8324 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)
8325 || CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
paul718e3742002-12-13 20:15:29 +00008326 {
hasso538621f2004-05-21 09:31:30 +00008327 vty_out (vty, " Graceful Restart Capabilty:");
8328 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
paul718e3742002-12-13 20:15:29 +00008329 vty_out (vty, " advertised");
hasso538621f2004-05-21 09:31:30 +00008330 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
8331 vty_out (vty, " %sreceived",
8332 CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV) ? "and " : "");
paul718e3742002-12-13 20:15:29 +00008333 vty_out (vty, "%s", VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00008334
8335 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
paul718e3742002-12-13 20:15:29 +00008336 {
hasso538621f2004-05-21 09:31:30 +00008337 int restart_af_count = 0;
8338
8339 vty_out (vty, " Remote Restart timer is %d seconds%s",
hasso93406d82005-02-02 14:40:33 +00008340 p->v_gr_restart, VTY_NEWLINE);
8341 vty_out (vty, " Address families by peer:%s ", VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00008342
8343 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
8344 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
8345 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_RCV))
8346 {
hasso93406d82005-02-02 14:40:33 +00008347 vty_out (vty, "%s%s(%s)", restart_af_count ? ", " : "",
8348 afi_safi_print (afi, safi),
8349 CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_PRESERVE_RCV) ?
8350 "preserved" : "not preserved");
hasso538621f2004-05-21 09:31:30 +00008351 restart_af_count++;
hasso93406d82005-02-02 14:40:33 +00008352 }
hasso538621f2004-05-21 09:31:30 +00008353 if (! restart_af_count)
8354 vty_out (vty, "none");
8355 vty_out (vty, "%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008356 }
paul718e3742002-12-13 20:15:29 +00008357 }
paul718e3742002-12-13 20:15:29 +00008358 }
8359 }
8360
hasso93406d82005-02-02 14:40:33 +00008361 /* graceful restart information */
8362 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)
8363 || p->t_gr_restart
8364 || p->t_gr_stale)
8365 {
8366 int eor_send_af_count = 0;
8367 int eor_receive_af_count = 0;
8368
8369 vty_out (vty, " Graceful restart informations:%s", VTY_NEWLINE);
8370 if (p->status == Established)
8371 {
8372 vty_out (vty, " End-of-RIB send: ");
8373 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
8374 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
8375 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_SEND))
8376 {
8377 vty_out (vty, "%s%s", eor_send_af_count ? ", " : "",
8378 afi_safi_print (afi, safi));
8379 eor_send_af_count++;
8380 }
8381 vty_out (vty, "%s", VTY_NEWLINE);
8382
8383 vty_out (vty, " End-of-RIB received: ");
8384 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
8385 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
8386 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_RECEIVED))
8387 {
8388 vty_out (vty, "%s%s", eor_receive_af_count ? ", " : "",
8389 afi_safi_print (afi, safi));
8390 eor_receive_af_count++;
8391 }
8392 vty_out (vty, "%s", VTY_NEWLINE);
8393 }
8394
8395 if (p->t_gr_restart)
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00008396 vty_out (vty, " The remaining time of restart timer is %ld%s",
8397 thread_timer_remain_second (p->t_gr_restart), VTY_NEWLINE);
8398
hasso93406d82005-02-02 14:40:33 +00008399 if (p->t_gr_stale)
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00008400 vty_out (vty, " The remaining time of stalepath timer is %ld%s",
8401 thread_timer_remain_second (p->t_gr_stale), VTY_NEWLINE);
hasso93406d82005-02-02 14:40:33 +00008402 }
8403
paul718e3742002-12-13 20:15:29 +00008404 /* Packet counts. */
hasso93406d82005-02-02 14:40:33 +00008405 vty_out (vty, " Message statistics:%s", VTY_NEWLINE);
8406 vty_out (vty, " Inq depth is 0%s", VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00008407 vty_out (vty, " Outq depth is %lu%s", (unsigned long) p->obuf->count, VTY_NEWLINE);
hasso93406d82005-02-02 14:40:33 +00008408 vty_out (vty, " Sent Rcvd%s", VTY_NEWLINE);
8409 vty_out (vty, " Opens: %10d %10d%s", p->open_out, p->open_in, VTY_NEWLINE);
8410 vty_out (vty, " Notifications: %10d %10d%s", p->notify_out, p->notify_in, VTY_NEWLINE);
8411 vty_out (vty, " Updates: %10d %10d%s", p->update_out, p->update_in, VTY_NEWLINE);
8412 vty_out (vty, " Keepalives: %10d %10d%s", p->keepalive_out, p->keepalive_in, VTY_NEWLINE);
8413 vty_out (vty, " Route Refresh: %10d %10d%s", p->refresh_out, p->refresh_in, VTY_NEWLINE);
8414 vty_out (vty, " Capability: %10d %10d%s", p->dynamic_cap_out, p->dynamic_cap_in, VTY_NEWLINE);
8415 vty_out (vty, " Total: %10d %10d%s", p->open_out + p->notify_out +
8416 p->update_out + p->keepalive_out + p->refresh_out + p->dynamic_cap_out,
8417 p->open_in + p->notify_in + p->update_in + p->keepalive_in + p->refresh_in +
8418 p->dynamic_cap_in, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008419
8420 /* advertisement-interval */
8421 vty_out (vty, " Minimum time between advertisement runs is %d seconds%s",
8422 p->v_routeadv, VTY_NEWLINE);
8423
8424 /* Update-source. */
8425 if (p->update_if || p->update_source)
8426 {
8427 vty_out (vty, " Update source is ");
8428 if (p->update_if)
8429 vty_out (vty, "%s", p->update_if);
8430 else if (p->update_source)
8431 vty_out (vty, "%s",
8432 sockunion2str (p->update_source, buf1, SU_ADDRSTRLEN));
8433 vty_out (vty, "%s", VTY_NEWLINE);
8434 }
8435
8436 /* Default weight */
8437 if (CHECK_FLAG (p->config, PEER_CONFIG_WEIGHT))
8438 vty_out (vty, " Default weight %d%s", p->weight,
8439 VTY_NEWLINE);
8440
8441 vty_out (vty, "%s", VTY_NEWLINE);
8442
8443 /* Address Family Information */
hasso538621f2004-05-21 09:31:30 +00008444 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
8445 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
8446 if (p->afc[afi][safi])
8447 bgp_show_peer_afi (vty, p, afi, safi);
paul718e3742002-12-13 20:15:29 +00008448
8449 vty_out (vty, " Connections established %d; dropped %d%s",
8450 p->established, p->dropped,
8451 VTY_NEWLINE);
8452
hassoe0701b72004-05-20 09:19:34 +00008453 if (! p->dropped)
8454 vty_out (vty, " Last reset never%s", VTY_NEWLINE);
8455 else
8456 vty_out (vty, " Last reset %s, due to %s%s",
8457 peer_uptime (p->resettime, timebuf, BGP_UPTIME_LEN),
8458 peer_down_str[(int) p->last_reset], VTY_NEWLINE);
paul848973c2003-08-13 00:32:49 +00008459
paul718e3742002-12-13 20:15:29 +00008460 if (CHECK_FLAG (p->sflags, PEER_STATUS_PREFIX_OVERFLOW))
8461 {
8462 vty_out (vty, " Peer had exceeded the max. no. of prefixes configured.%s", VTY_NEWLINE);
hasso0a486e52005-02-01 20:57:17 +00008463
8464 if (p->t_pmax_restart)
8465 vty_out (vty, " Reduce the no. of prefix from %s, will restart in %ld seconds%s",
8466 p->host, thread_timer_remain_second (p->t_pmax_restart),
8467 VTY_NEWLINE);
8468 else
8469 vty_out (vty, " Reduce the no. of prefix and clear ip bgp %s to restore peering%s",
8470 p->host, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008471 }
8472
Stephen Hemmingerf5a48272011-03-24 17:30:21 +00008473 /* EBGP Multihop and GTSM */
Jorge Boncompte [DTI2]6d85b152012-05-07 16:52:54 +00008474 if (p->sort != BGP_PEER_IBGP)
Stephen Hemmingerf5a48272011-03-24 17:30:21 +00008475 {
8476 if (p->gtsm_hops > 0)
8477 vty_out (vty, " External BGP neighbor may be up to %d hops away.%s",
8478 p->gtsm_hops, VTY_NEWLINE);
8479 else if (p->ttl > 1)
8480 vty_out (vty, " External BGP neighbor may be up to %d hops away.%s",
8481 p->ttl, VTY_NEWLINE);
8482 }
Pradosh Mohapatra5d804b42013-09-12 03:37:07 +00008483 else
8484 {
8485 if (p->gtsm_hops > 0)
8486 vty_out (vty, " Internal BGP neighbor may be up to %d hops away.%s",
8487 p->gtsm_hops, VTY_NEWLINE);
8488 }
paul718e3742002-12-13 20:15:29 +00008489
8490 /* Local address. */
8491 if (p->su_local)
8492 {
hasso93406d82005-02-02 14:40:33 +00008493 vty_out (vty, "Local host: %s, Local port: %d%s",
paul718e3742002-12-13 20:15:29 +00008494 sockunion2str (p->su_local, buf1, SU_ADDRSTRLEN),
8495 ntohs (p->su_local->sin.sin_port),
paul718e3742002-12-13 20:15:29 +00008496 VTY_NEWLINE);
8497 }
8498
8499 /* Remote address. */
8500 if (p->su_remote)
8501 {
8502 vty_out (vty, "Foreign host: %s, Foreign port: %d%s",
8503 sockunion2str (p->su_remote, buf1, SU_ADDRSTRLEN),
8504 ntohs (p->su_remote->sin.sin_port),
8505 VTY_NEWLINE);
8506 }
8507
8508 /* Nexthop display. */
8509 if (p->su_local)
8510 {
8511 vty_out (vty, "Nexthop: %s%s",
8512 inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ),
8513 VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008514 vty_out (vty, "Nexthop global: %s%s",
8515 inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ),
8516 VTY_NEWLINE);
8517 vty_out (vty, "Nexthop local: %s%s",
8518 inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ),
8519 VTY_NEWLINE);
8520 vty_out (vty, "BGP connection: %s%s",
8521 p->shared_network ? "shared network" : "non shared network",
8522 VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008523 }
8524
Timo Teräsef757702015-04-29 09:43:04 +03008525 /* TCP metrics. */
8526 if (p->status == Established && p->rtt)
8527 vty_out (vty, "Estimated round trip time: %d ms%s",
8528 p->rtt, VTY_NEWLINE);
8529
paul718e3742002-12-13 20:15:29 +00008530 /* Timer information. */
8531 if (p->t_start)
8532 vty_out (vty, "Next start timer due in %ld seconds%s",
8533 thread_timer_remain_second (p->t_start), VTY_NEWLINE);
8534 if (p->t_connect)
8535 vty_out (vty, "Next connect timer due in %ld seconds%s",
8536 thread_timer_remain_second (p->t_connect), VTY_NEWLINE);
8537
8538 vty_out (vty, "Read thread: %s Write thread: %s%s",
8539 p->t_read ? "on" : "off",
8540 p->t_write ? "on" : "off",
8541 VTY_NEWLINE);
8542
8543 if (p->notify.code == BGP_NOTIFY_OPEN_ERR
8544 && p->notify.subcode == BGP_NOTIFY_OPEN_UNSUP_CAPBL)
8545 bgp_capability_vty_out (vty, p);
8546
8547 vty_out (vty, "%s", VTY_NEWLINE);
8548}
8549
paul94f2b392005-06-28 12:44:16 +00008550static int
paul718e3742002-12-13 20:15:29 +00008551bgp_show_neighbor (struct vty *vty, struct bgp *bgp,
8552 enum show_type type, union sockunion *su)
8553{
paul1eb8ef22005-04-07 07:30:20 +00008554 struct listnode *node, *nnode;
paul718e3742002-12-13 20:15:29 +00008555 struct peer *peer;
8556 int find = 0;
8557
paul1eb8ef22005-04-07 07:30:20 +00008558 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00008559 {
8560 switch (type)
8561 {
8562 case show_all:
8563 bgp_show_peer (vty, peer);
8564 break;
8565 case show_peer:
8566 if (sockunion_same (&peer->su, su))
8567 {
8568 find = 1;
8569 bgp_show_peer (vty, peer);
8570 }
8571 break;
8572 }
8573 }
8574
8575 if (type == show_peer && ! find)
8576 vty_out (vty, "%% No such neighbor%s", VTY_NEWLINE);
8577
8578 return CMD_SUCCESS;
8579}
8580
paul94f2b392005-06-28 12:44:16 +00008581static int
paulfd79ac92004-10-13 05:06:08 +00008582bgp_show_neighbor_vty (struct vty *vty, const char *name,
8583 enum show_type type, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00008584{
8585 int ret;
8586 struct bgp *bgp;
8587 union sockunion su;
8588
8589 if (ip_str)
8590 {
8591 ret = str2sockunion (ip_str, &su);
8592 if (ret < 0)
8593 {
8594 vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE);
8595 return CMD_WARNING;
8596 }
8597 }
8598
8599 if (name)
8600 {
8601 bgp = bgp_lookup_by_name (name);
8602
8603 if (! bgp)
8604 {
8605 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
8606 return CMD_WARNING;
8607 }
8608
8609 bgp_show_neighbor (vty, bgp, type, &su);
8610
8611 return CMD_SUCCESS;
8612 }
8613
8614 bgp = bgp_get_default ();
8615
8616 if (bgp)
8617 bgp_show_neighbor (vty, bgp, type, &su);
8618
8619 return CMD_SUCCESS;
8620}
8621
Lou Bergerf9b6c392016-01-12 13:42:09 -05008622/* "show ip bgp neighbors" commands. */DEFUN (show_ip_bgp_neighbors,
8623 show_ip_bgp_neighbors_cmd,
8624 "show ip bgp neighbors",
8625 SHOW_STR
8626 IP_STR
8627 BGP_STR
8628 "Detailed information on TCP and BGP neighbor connections\n")
8629{
8630 return bgp_show_neighbor_vty (vty, NULL, show_all, NULL);
8631}
8632
8633ALIAS (show_ip_bgp_neighbors,
8634 show_ip_bgp_ipv4_neighbors_cmd,
8635 "show ip bgp ipv4 (unicast|multicast) neighbors",
8636 SHOW_STR
8637 IP_STR
8638 BGP_STR
8639 "Address family\n"
8640 "Address Family modifier\n"
8641 "Address Family modifier\n"
8642 "Detailed information on TCP and BGP neighbor connections\n")
8643
8644ALIAS (show_ip_bgp_neighbors,
8645 show_ip_bgp_vpnv4_all_neighbors_cmd,
8646 "show ip bgp vpnv4 all neighbors",
8647 SHOW_STR
8648 IP_STR
8649 BGP_STR
8650 "Display VPNv4 NLRI specific information\n"
8651 "Display information about all VPNv4 NLRIs\n"
8652 "Detailed information on TCP and BGP neighbor connections\n")
8653
8654ALIAS (show_ip_bgp_neighbors,
8655 show_ip_bgp_vpnv4_rd_neighbors_cmd,
8656 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors",
8657 SHOW_STR
8658 IP_STR
8659 BGP_STR
8660 "Display VPNv4 NLRI specific information\n"
8661 "Display information for a route distinguisher\n"
8662 "VPN Route Distinguisher\n"
8663 "Detailed information on TCP and BGP neighbor connections\n")
8664
8665ALIAS (show_ip_bgp_neighbors,
8666 show_bgp_ipv6_neighbors_cmd,
8667 "show bgp ipv6 neighbors",
8668 SHOW_STR
8669 BGP_STR
8670 "Address family\n"
8671 "Detailed information on TCP and BGP neighbor connections\n")
8672
8673DEFUN (show_ip_bgp_neighbors_peer,
8674 show_ip_bgp_neighbors_peer_cmd,
8675 "show ip bgp neighbors (A.B.C.D|X:X::X:X)",
8676 SHOW_STR
8677 IP_STR
8678 BGP_STR
8679 "Detailed information on TCP and BGP neighbor connections\n"
8680 "Neighbor to display information about\n"
8681 "Neighbor to display information about\n")
8682{
8683 return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 1]);
8684}
8685
8686ALIAS (show_ip_bgp_neighbors_peer,
8687 show_ip_bgp_ipv4_neighbors_peer_cmd,
8688 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X)",
8689 SHOW_STR
8690 IP_STR
8691 BGP_STR
8692 "Address family\n"
8693 "Address Family modifier\n"
8694 "Address Family modifier\n"
8695 "Detailed information on TCP and BGP neighbor connections\n"
8696 "Neighbor to display information about\n"
8697 "Neighbor to display information about\n")
8698
8699ALIAS (show_ip_bgp_neighbors_peer,
8700 show_ip_bgp_vpnv4_all_neighbors_peer_cmd,
8701 "show ip bgp vpnv4 all neighbors A.B.C.D",
8702 SHOW_STR
8703 IP_STR
8704 BGP_STR
8705 "Display VPNv4 NLRI specific information\n"
8706 "Display information about all VPNv4 NLRIs\n"
8707 "Detailed information on TCP and BGP neighbor connections\n"
8708 "Neighbor to display information about\n")
8709
8710ALIAS (show_ip_bgp_neighbors_peer,
8711 show_ip_bgp_vpnv4_rd_neighbors_peer_cmd,
8712 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D",
8713 SHOW_STR
8714 IP_STR
8715 BGP_STR
8716 "Display VPNv4 NLRI specific information\n"
8717 "Display information about all VPNv4 NLRIs\n"
8718 "Detailed information on TCP and BGP neighbor connections\n"
8719 "Neighbor to display information about\n")
8720
8721ALIAS (show_ip_bgp_neighbors_peer,
8722 show_bgp_ipv6_neighbors_peer_cmd,
8723 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X)",
8724 SHOW_STR
8725 BGP_STR
8726 "Address family\n"
8727 "Detailed information on TCP and BGP neighbor connections\n"
8728 "Neighbor to display information about\n"
8729 "Neighbor to display information about\n")
8730
8731DEFUN (show_ip_bgp_instance_neighbors,
8732 show_ip_bgp_instance_neighbors_cmd,
8733 "show ip bgp view WORD neighbors",
8734 SHOW_STR
8735 IP_STR
8736 BGP_STR
8737 "BGP view\n"
8738 "View name\n"
8739 "Detailed information on TCP and BGP neighbor connections\n")
8740{
8741 return bgp_show_neighbor_vty (vty, argv[0], show_all, NULL);
8742}
8743
8744ALIAS (show_ip_bgp_instance_neighbors,
8745 show_bgp_instance_ipv6_neighbors_cmd,
8746 "show bgp view WORD ipv6 neighbors",
8747 SHOW_STR
8748 BGP_STR
8749 "BGP view\n"
8750 "View name\n"
8751 "Address family\n"
8752 "Detailed information on TCP and BGP neighbor connections\n")
8753
8754DEFUN (show_ip_bgp_instance_neighbors_peer,
8755 show_ip_bgp_instance_neighbors_peer_cmd,
8756 "show ip bgp view WORD neighbors (A.B.C.D|X:X::X:X)",
8757 SHOW_STR
8758 IP_STR
8759 BGP_STR
8760 "BGP view\n"
8761 "View name\n"
8762 "Detailed information on TCP and BGP neighbor connections\n"
8763 "Neighbor to display information about\n"
8764 "Neighbor to display information about\n")
8765{
8766 return bgp_show_neighbor_vty (vty, argv[0], show_peer, argv[1]);
8767}
8768
8769/* Show BGP's AS paths internal data. There are both `show ip bgp
8770 paths' and `show ip mbgp paths'. Those functions results are the
8771 same.*/
8772DEFUN (show_ip_bgp_paths,
8773 show_ip_bgp_paths_cmd,
8774 "show ip bgp paths",
8775 SHOW_STR
8776 IP_STR
8777 BGP_STR
8778 "Path information\n")
8779{
8780 vty_out (vty, "Address Refcnt Path%s", VTY_NEWLINE);
8781 aspath_print_all_vty (vty);
8782 return CMD_SUCCESS;
8783}
8784
8785DEFUN (show_ip_bgp_ipv4_paths,
8786 show_ip_bgp_ipv4_paths_cmd,
8787 "show ip bgp ipv4 (unicast|multicast) paths",
8788 SHOW_STR
8789 IP_STR
8790 BGP_STR
8791 "Address family\n"
8792 "Address Family modifier\n"
8793 "Address Family modifier\n"
8794 "Path information\n")
8795{
8796 vty_out (vty, "Address Refcnt Path\r\n");
8797 aspath_print_all_vty (vty);
8798
8799 return CMD_SUCCESS;
8800}
8801
Lou Berger651b4022016-01-12 13:42:07 -05008802DEFUN (show_bgp_neighbors,
8803 show_bgp_neighbors_cmd,
8804 "show bgp neighbors",
paul718e3742002-12-13 20:15:29 +00008805 SHOW_STR
paul718e3742002-12-13 20:15:29 +00008806 BGP_STR
8807 "Detailed information on TCP and BGP neighbor connections\n")
8808{
8809 return bgp_show_neighbor_vty (vty, NULL, show_all, NULL);
8810}
8811
Lou Berger651b4022016-01-12 13:42:07 -05008812DEFUN (show_bgp_neighbors_peer,
8813 show_bgp_neighbors_peer_cmd,
Lou Berger651b4022016-01-12 13:42:07 -05008814 "show bgp neighbors (A.B.C.D|X:X::X:X)",
paul718e3742002-12-13 20:15:29 +00008815 SHOW_STR
paul718e3742002-12-13 20:15:29 +00008816 BGP_STR
8817 "Detailed information on TCP and BGP neighbor connections\n"
8818 "Neighbor to display information about\n"
8819 "Neighbor to display information about\n")
8820{
8821 return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 1]);
8822}
8823
Lou Berger651b4022016-01-12 13:42:07 -05008824DEFUN (show_bgp_instance_neighbors,
8825 show_bgp_instance_neighbors_cmd,
8826 "show bgp view WORD neighbors",
paul718e3742002-12-13 20:15:29 +00008827 SHOW_STR
paul718e3742002-12-13 20:15:29 +00008828 BGP_STR
8829 "BGP view\n"
8830 "View name\n"
8831 "Detailed information on TCP and BGP neighbor connections\n")
8832{
8833 return bgp_show_neighbor_vty (vty, argv[0], show_all, NULL);
8834}
8835
Lou Berger651b4022016-01-12 13:42:07 -05008836DEFUN (show_bgp_instance_neighbors_peer,
8837 show_bgp_instance_neighbors_peer_cmd,
Lou Berger651b4022016-01-12 13:42:07 -05008838 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X)",
paul718e3742002-12-13 20:15:29 +00008839 SHOW_STR
paul718e3742002-12-13 20:15:29 +00008840 BGP_STR
8841 "BGP view\n"
8842 "View name\n"
8843 "Detailed information on TCP and BGP neighbor connections\n"
8844 "Neighbor to display information about\n"
8845 "Neighbor to display information about\n")
8846{
8847 return bgp_show_neighbor_vty (vty, argv[0], show_peer, argv[1]);
8848}
paulbb46e942003-10-24 19:02:03 +00008849
Lou Berger651b4022016-01-12 13:42:07 -05008850ALIAS (show_bgp_instance_neighbors_peer,
paulbb46e942003-10-24 19:02:03 +00008851 show_bgp_instance_ipv6_neighbors_peer_cmd,
8852 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X)",
8853 SHOW_STR
8854 BGP_STR
8855 "BGP view\n"
8856 "View name\n"
8857 "Address family\n"
8858 "Detailed information on TCP and BGP neighbor connections\n"
8859 "Neighbor to display information about\n"
8860 "Neighbor to display information about\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02008861
paul718e3742002-12-13 20:15:29 +00008862/* Show BGP's AS paths internal data. There are both `show ip bgp
8863 paths' and `show ip mbgp paths'. Those functions results are the
8864 same.*/
Lou Berger651b4022016-01-12 13:42:07 -05008865DEFUN (show_bgp_ipv4_paths,
8866 show_bgp_ipv4_paths_cmd,
8867 "show bgp paths",
paul718e3742002-12-13 20:15:29 +00008868 SHOW_STR
paul718e3742002-12-13 20:15:29 +00008869 BGP_STR
8870 "Path information\n")
8871{
8872 vty_out (vty, "Address Refcnt Path%s", VTY_NEWLINE);
8873 aspath_print_all_vty (vty);
8874 return CMD_SUCCESS;
8875}
8876
paul718e3742002-12-13 20:15:29 +00008877#include "hash.h"
8878
paul94f2b392005-06-28 12:44:16 +00008879static void
paul718e3742002-12-13 20:15:29 +00008880community_show_all_iterator (struct hash_backet *backet, struct vty *vty)
8881{
8882 struct community *com;
8883
8884 com = (struct community *) backet->data;
David Lampartereed3c482015-03-03 08:51:53 +01008885 vty_out (vty, "[%p] (%ld) %s%s", (void *)backet, com->refcnt,
paul718e3742002-12-13 20:15:29 +00008886 community_str (com), VTY_NEWLINE);
8887}
8888
8889/* Show BGP's community internal data. */
8890DEFUN (show_ip_bgp_community_info,
8891 show_ip_bgp_community_info_cmd,
8892 "show ip bgp community-info",
8893 SHOW_STR
8894 IP_STR
8895 BGP_STR
8896 "List all bgp community information\n")
8897{
8898 vty_out (vty, "Address Refcnt Community%s", VTY_NEWLINE);
8899
8900 hash_iterate (community_hash (),
8901 (void (*) (struct hash_backet *, void *))
8902 community_show_all_iterator,
8903 vty);
8904
8905 return CMD_SUCCESS;
8906}
8907
8908DEFUN (show_ip_bgp_attr_info,
8909 show_ip_bgp_attr_info_cmd,
8910 "show ip bgp attribute-info",
8911 SHOW_STR
8912 IP_STR
8913 BGP_STR
8914 "List all bgp attribute information\n")
8915{
8916 attr_show_all (vty);
8917 return CMD_SUCCESS;
8918}
David Lamparter6b0655a2014-06-04 06:53:35 +02008919
paul94f2b392005-06-28 12:44:16 +00008920static int
paulfee0f4c2004-09-13 05:12:46 +00008921bgp_write_rsclient_summary (struct vty *vty, struct peer *rsclient,
8922 afi_t afi, safi_t safi)
8923{
8924 char timebuf[BGP_UPTIME_LEN];
8925 char rmbuf[14];
paulfd79ac92004-10-13 05:06:08 +00008926 const char *rmname;
paulfee0f4c2004-09-13 05:12:46 +00008927 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00008928 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00008929 int len;
8930 int count = 0;
8931
8932 if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_GROUP))
8933 {
paul1eb8ef22005-04-07 07:30:20 +00008934 for (ALL_LIST_ELEMENTS (rsclient->group->peer, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00008935 {
8936 count++;
8937 bgp_write_rsclient_summary (vty, peer, afi, safi);
8938 }
8939 return count;
8940 }
8941
8942 len = vty_out (vty, "%s", rsclient->host);
8943 len = 16 - len;
8944
8945 if (len < 1)
8946 vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " ");
8947 else
8948 vty_out (vty, "%*s", len, " ");
8949
hasso3d515fd2005-02-01 21:30:04 +00008950 vty_out (vty, "4 ");
paulfee0f4c2004-09-13 05:12:46 +00008951
Milan Kociancb4fc592014-12-01 12:48:25 +00008952 vty_out (vty, "%10u ", rsclient->as);
paulfee0f4c2004-09-13 05:12:46 +00008953
8954 rmname = ROUTE_MAP_EXPORT_NAME(&rsclient->filter[afi][safi]);
8955 if ( rmname && strlen (rmname) > 13 )
8956 {
8957 sprintf (rmbuf, "%13s", "...");
8958 rmname = strncpy (rmbuf, rmname, 10);
8959 }
8960 else if (! rmname)
8961 rmname = "<none>";
8962 vty_out (vty, " %13s ", rmname);
8963
8964 rmname = ROUTE_MAP_IMPORT_NAME(&rsclient->filter[afi][safi]);
8965 if ( rmname && strlen (rmname) > 13 )
8966 {
8967 sprintf (rmbuf, "%13s", "...");
8968 rmname = strncpy (rmbuf, rmname, 10);
8969 }
8970 else if (! rmname)
8971 rmname = "<none>";
8972 vty_out (vty, " %13s ", rmname);
8973
8974 vty_out (vty, "%8s", peer_uptime (rsclient->uptime, timebuf, BGP_UPTIME_LEN));
8975
8976 if (CHECK_FLAG (rsclient->flags, PEER_FLAG_SHUTDOWN))
8977 vty_out (vty, " Idle (Admin)");
8978 else if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_PREFIX_OVERFLOW))
8979 vty_out (vty, " Idle (PfxCt)");
8980 else
8981 vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, rsclient->status));
8982
8983 vty_out (vty, "%s", VTY_NEWLINE);
8984
8985 return 1;
8986}
8987
paul94f2b392005-06-28 12:44:16 +00008988static int
paulfd79ac92004-10-13 05:06:08 +00008989bgp_show_rsclient_summary (struct vty *vty, struct bgp *bgp,
8990 afi_t afi, safi_t safi)
paulfee0f4c2004-09-13 05:12:46 +00008991{
8992 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00008993 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00008994 int count = 0;
8995
8996 /* Header string for each address family. */
Milan Kociancb4fc592014-12-01 12:48:25 +00008997 static char header[] = "Neighbor V AS Export-Policy Import-Policy Up/Down State";
paulfee0f4c2004-09-13 05:12:46 +00008998
paul1eb8ef22005-04-07 07:30:20 +00008999 for (ALL_LIST_ELEMENTS (bgp->rsclient, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00009000 {
9001 if (peer->afc[afi][safi] &&
9002 CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT))
9003 {
9004 if (! count)
9005 {
9006 vty_out (vty,
9007 "Route Server's BGP router identifier %s%s",
9008 inet_ntoa (bgp->router_id), VTY_NEWLINE);
9009 vty_out (vty,
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04009010 "Route Server's local AS number %u%s", bgp->as,
paulfee0f4c2004-09-13 05:12:46 +00009011 VTY_NEWLINE);
9012
9013 vty_out (vty, "%s", VTY_NEWLINE);
9014 vty_out (vty, "%s%s", header, VTY_NEWLINE);
9015 }
9016
9017 count += bgp_write_rsclient_summary (vty, peer, afi, safi);
9018 }
9019 }
9020
9021 if (count)
9022 vty_out (vty, "%sTotal number of Route Server Clients %d%s", VTY_NEWLINE,
9023 count, VTY_NEWLINE);
9024 else
9025 vty_out (vty, "No %s Route Server Client is configured%s",
9026 afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE);
9027
9028 return CMD_SUCCESS;
9029}
9030
paul94f2b392005-06-28 12:44:16 +00009031static int
paulfd79ac92004-10-13 05:06:08 +00009032bgp_show_rsclient_summary_vty (struct vty *vty, const char *name,
9033 afi_t afi, safi_t safi)
paulfee0f4c2004-09-13 05:12:46 +00009034{
9035 struct bgp *bgp;
9036
9037 if (name)
9038 {
9039 bgp = bgp_lookup_by_name (name);
9040
9041 if (! bgp)
9042 {
9043 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
9044 return CMD_WARNING;
9045 }
9046
9047 bgp_show_rsclient_summary (vty, bgp, afi, safi);
9048 return CMD_SUCCESS;
9049 }
9050
9051 bgp = bgp_get_default ();
9052
9053 if (bgp)
9054 bgp_show_rsclient_summary (vty, bgp, afi, safi);
9055
9056 return CMD_SUCCESS;
9057}
9058
9059/* 'show bgp rsclient' commands. */
Lou Bergerf9b6c392016-01-12 13:42:09 -05009060DEFUN (show_ip_bgp_rsclient_summary,
9061 show_ip_bgp_rsclient_summary_cmd,
9062 "show ip bgp rsclient summary",
9063 SHOW_STR
9064 IP_STR
9065 BGP_STR
9066 "Information about Route Server Clients\n"
9067 "Summary of all Route Server Clients\n")
9068{
9069 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
9070}
9071
9072DEFUN (show_ip_bgp_instance_rsclient_summary,
9073 show_ip_bgp_instance_rsclient_summary_cmd,
9074 "show ip bgp view WORD rsclient summary",
9075 SHOW_STR
9076 IP_STR
9077 BGP_STR
9078 "BGP view\n"
9079 "View name\n"
9080 "Information about Route Server Clients\n"
9081 "Summary of all Route Server Clients\n")
9082{
9083 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
9084}
9085
9086DEFUN (show_ip_bgp_ipv4_rsclient_summary,
9087 show_ip_bgp_ipv4_rsclient_summary_cmd,
9088 "show ip bgp ipv4 (unicast|multicast) rsclient summary",
9089 SHOW_STR
9090 IP_STR
9091 BGP_STR
9092 "Address family\n"
9093 "Address Family modifier\n"
9094 "Address Family modifier\n"
9095 "Information about Route Server Clients\n"
9096 "Summary of all Route Server Clients\n")
9097{
9098 if (strncmp (argv[0], "m", 1) == 0)
9099 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
9100
9101 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
9102}
9103
9104DEFUN (show_ip_bgp_instance_ipv4_rsclient_summary,
9105 show_ip_bgp_instance_ipv4_rsclient_summary_cmd,
9106 "show ip bgp view WORD ipv4 (unicast|multicast) rsclient summary",
9107 SHOW_STR
9108 IP_STR
9109 BGP_STR
9110 "BGP view\n"
9111 "View name\n"
9112 "Address family\n"
9113 "Address Family modifier\n"
9114 "Address Family modifier\n"
9115 "Information about Route Server Clients\n"
9116 "Summary of all Route Server Clients\n")
9117{
9118 if (strncmp (argv[1], "m", 1) == 0)
9119 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
9120
9121 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
9122}
paulfee0f4c2004-09-13 05:12:46 +00009123
Michael Lambert95cbbd22010-07-23 14:43:04 -04009124DEFUN (show_bgp_instance_ipv4_safi_rsclient_summary,
9125 show_bgp_instance_ipv4_safi_rsclient_summary_cmd,
9126 "show bgp view WORD ipv4 (unicast|multicast) rsclient summary",
9127 SHOW_STR
9128 BGP_STR
9129 "BGP view\n"
9130 "View name\n"
9131 "Address family\n"
9132 "Address Family modifier\n"
9133 "Address Family modifier\n"
9134 "Information about Route Server Clients\n"
9135 "Summary of all Route Server Clients\n")
9136{
9137 safi_t safi;
9138
9139 if (argc == 2) {
9140 safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
9141 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, safi);
9142 } else {
9143 safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
9144 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, safi);
9145 }
9146}
9147
9148ALIAS (show_bgp_instance_ipv4_safi_rsclient_summary,
9149 show_bgp_ipv4_safi_rsclient_summary_cmd,
9150 "show bgp ipv4 (unicast|multicast) rsclient summary",
9151 SHOW_STR
9152 BGP_STR
9153 "Address family\n"
9154 "Address Family modifier\n"
9155 "Address Family modifier\n"
9156 "Information about Route Server Clients\n"
9157 "Summary of all Route Server Clients\n")
9158
paulfee0f4c2004-09-13 05:12:46 +00009159DEFUN (show_bgp_rsclient_summary,
9160 show_bgp_rsclient_summary_cmd,
9161 "show bgp rsclient summary",
9162 SHOW_STR
9163 BGP_STR
9164 "Information about Route Server Clients\n"
9165 "Summary of all Route Server Clients\n")
9166{
Lou Berger651b4022016-01-12 13:42:07 -05009167 vty_out(vty, "%sIPv4 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9168 vty_out(vty, "---------------------%s", VTY_NEWLINE);
9169 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
9170 vty_out(vty, "%sIPv4 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9171 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
9172 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
9173 vty_out(vty, "%sIPv4 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9174 vty_out(vty, "-----------------%s", VTY_NEWLINE);
9175 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
9176 vty_out(vty, "%sIPv4 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9177 vty_out(vty, "-------------------%s", VTY_NEWLINE);
9178 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_ENCAP);
9179
Lou Berger651b4022016-01-12 13:42:07 -05009180 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9181 vty_out(vty, "---------------------%s", VTY_NEWLINE);
9182 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
9183 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9184 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
9185 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
9186 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9187 vty_out(vty, "-----------------%s", VTY_NEWLINE);
9188 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_MPLS_VPN);
9189 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9190 vty_out(vty, "-------------------%s", VTY_NEWLINE);
9191 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_ENCAP);
Lou Berger205e6742016-01-12 13:42:11 -05009192
Lou Berger651b4022016-01-12 13:42:07 -05009193 return CMD_SUCCESS;
paulfee0f4c2004-09-13 05:12:46 +00009194}
9195
9196DEFUN (show_bgp_instance_rsclient_summary,
9197 show_bgp_instance_rsclient_summary_cmd,
9198 "show bgp view WORD rsclient summary",
9199 SHOW_STR
9200 BGP_STR
9201 "BGP view\n"
9202 "View name\n"
9203 "Information about Route Server Clients\n"
9204 "Summary of all Route Server Clients\n")
9205{
Lou Berger651b4022016-01-12 13:42:07 -05009206 vty_out(vty, "%sIPv4 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9207 vty_out(vty, "---------------------%s", VTY_NEWLINE);
9208 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
9209 vty_out(vty, "%sIPv4 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9210 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
9211 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
9212 vty_out(vty, "%sIPv4 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9213 vty_out(vty, "-----------------%s", VTY_NEWLINE);
9214 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_MPLS_VPN);
9215 vty_out(vty, "%sIPv4 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9216 vty_out(vty, "-------------------%s", VTY_NEWLINE);
9217 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_ENCAP);
9218
Lou Berger651b4022016-01-12 13:42:07 -05009219 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9220 vty_out(vty, "---------------------%s", VTY_NEWLINE);
9221 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
9222 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9223 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
9224 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST);
9225 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9226 vty_out(vty, "-----------------%s", VTY_NEWLINE);
9227 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_MPLS_VPN);
9228 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9229 vty_out(vty, "-------------------%s", VTY_NEWLINE);
9230 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_ENCAP);
Lou Berger205e6742016-01-12 13:42:11 -05009231
Lou Berger651b4022016-01-12 13:42:07 -05009232 return CMD_SUCCESS;
paulfee0f4c2004-09-13 05:12:46 +00009233}
9234
Lou Berger651b4022016-01-12 13:42:07 -05009235DEFUN (show_bgp_ipv6_rsclient_summary,
paulfee0f4c2004-09-13 05:12:46 +00009236 show_bgp_ipv6_rsclient_summary_cmd,
9237 "show bgp ipv6 rsclient summary",
9238 SHOW_STR
9239 BGP_STR
9240 "Address family\n"
9241 "Information about Route Server Clients\n"
9242 "Summary of all Route Server Clients\n")
Lou Berger651b4022016-01-12 13:42:07 -05009243{
9244 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9245 vty_out(vty, "---------------------%s", VTY_NEWLINE);
9246 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
9247 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9248 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
9249 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
9250 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9251 vty_out(vty, "-----------------%s", VTY_NEWLINE);
9252 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_MPLS_VPN);
9253 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9254 vty_out(vty, "-------------------%s", VTY_NEWLINE);
9255 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_ENCAP);
paulfee0f4c2004-09-13 05:12:46 +00009256
Lou Berger651b4022016-01-12 13:42:07 -05009257 return CMD_SUCCESS;
9258}
9259
9260DEFUN (show_bgp_instance_ipv6_rsclient_summary,
paulfee0f4c2004-09-13 05:12:46 +00009261 show_bgp_instance_ipv6_rsclient_summary_cmd,
9262 "show bgp view WORD ipv6 rsclient summary",
9263 SHOW_STR
9264 BGP_STR
9265 "BGP view\n"
9266 "View name\n"
9267 "Address family\n"
9268 "Information about Route Server Clients\n"
9269 "Summary of all Route Server Clients\n")
Lou Berger651b4022016-01-12 13:42:07 -05009270{
9271 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9272 vty_out(vty, "---------------------%s", VTY_NEWLINE);
9273 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
9274 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9275 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
9276 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST);
9277 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9278 vty_out(vty, "-----------------%s", VTY_NEWLINE);
9279 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_MPLS_VPN);
9280 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9281 vty_out(vty, "-------------------%s", VTY_NEWLINE);
9282 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_ENCAP);
9283
9284 return CMD_SUCCESS;
9285}
Michael Lambert95cbbd22010-07-23 14:43:04 -04009286
9287DEFUN (show_bgp_instance_ipv6_safi_rsclient_summary,
9288 show_bgp_instance_ipv6_safi_rsclient_summary_cmd,
9289 "show bgp view WORD ipv6 (unicast|multicast) rsclient summary",
9290 SHOW_STR
9291 BGP_STR
9292 "BGP view\n"
9293 "View name\n"
9294 "Address family\n"
9295 "Address Family modifier\n"
9296 "Address Family modifier\n"
9297 "Information about Route Server Clients\n"
9298 "Summary of all Route Server Clients\n")
9299{
9300 safi_t safi;
9301
9302 if (argc == 2) {
9303 safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
9304 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, safi);
9305 } else {
9306 safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
9307 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, safi);
9308 }
9309}
9310
9311ALIAS (show_bgp_instance_ipv6_safi_rsclient_summary,
9312 show_bgp_ipv6_safi_rsclient_summary_cmd,
9313 "show bgp ipv6 (unicast|multicast) rsclient summary",
9314 SHOW_STR
9315 BGP_STR
Lou Berger651b4022016-01-12 13:42:07 -05009316 IPV6_STR
Michael Lambert95cbbd22010-07-23 14:43:04 -04009317 "Address Family modifier\n"
9318 "Address Family modifier\n"
9319 "Information about Route Server Clients\n"
9320 "Summary of all Route Server Clients\n")
9321
paul718e3742002-12-13 20:15:29 +00009322/* Redistribute VTY commands. */
9323
paul718e3742002-12-13 20:15:29 +00009324DEFUN (bgp_redistribute_ipv4,
9325 bgp_redistribute_ipv4_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009326 "redistribute " QUAGGA_IP_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00009327 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009328 QUAGGA_IP_REDIST_HELP_STR_BGPD)
paul718e3742002-12-13 20:15:29 +00009329{
9330 int type;
9331
David Lampartere0ca5fd2009-09-16 01:52:42 +02009332 type = proto_redistnum (AFI_IP, argv[0]);
9333 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009334 {
9335 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9336 return CMD_WARNING;
9337 }
9338 return bgp_redistribute_set (vty->index, AFI_IP, type);
9339}
9340
9341DEFUN (bgp_redistribute_ipv4_rmap,
9342 bgp_redistribute_ipv4_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009343 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00009344 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009345 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009346 "Route map reference\n"
9347 "Pointer to route-map entries\n")
9348{
9349 int type;
9350
David Lampartere0ca5fd2009-09-16 01:52:42 +02009351 type = proto_redistnum (AFI_IP, argv[0]);
9352 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009353 {
9354 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9355 return CMD_WARNING;
9356 }
9357
9358 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]);
9359 return bgp_redistribute_set (vty->index, AFI_IP, type);
9360}
9361
9362DEFUN (bgp_redistribute_ipv4_metric,
9363 bgp_redistribute_ipv4_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009364 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009365 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009366 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009367 "Metric for redistributed routes\n"
9368 "Default metric\n")
9369{
9370 int type;
9371 u_int32_t metric;
9372
David Lampartere0ca5fd2009-09-16 01:52:42 +02009373 type = proto_redistnum (AFI_IP, argv[0]);
9374 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009375 {
9376 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9377 return CMD_WARNING;
9378 }
9379 VTY_GET_INTEGER ("metric", metric, argv[1]);
9380
9381 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
9382 return bgp_redistribute_set (vty->index, AFI_IP, type);
9383}
9384
9385DEFUN (bgp_redistribute_ipv4_rmap_metric,
9386 bgp_redistribute_ipv4_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009387 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009388 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009389 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009390 "Route map reference\n"
9391 "Pointer to route-map entries\n"
9392 "Metric for redistributed routes\n"
9393 "Default metric\n")
9394{
9395 int type;
9396 u_int32_t metric;
9397
David Lampartere0ca5fd2009-09-16 01:52:42 +02009398 type = proto_redistnum (AFI_IP, argv[0]);
9399 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009400 {
9401 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9402 return CMD_WARNING;
9403 }
9404 VTY_GET_INTEGER ("metric", metric, argv[2]);
9405
9406 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]);
9407 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
9408 return bgp_redistribute_set (vty->index, AFI_IP, type);
9409}
9410
9411DEFUN (bgp_redistribute_ipv4_metric_rmap,
9412 bgp_redistribute_ipv4_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009413 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00009414 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009415 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009416 "Metric for redistributed routes\n"
9417 "Default metric\n"
9418 "Route map reference\n"
9419 "Pointer to route-map entries\n")
9420{
9421 int type;
9422 u_int32_t metric;
9423
David Lampartere0ca5fd2009-09-16 01:52:42 +02009424 type = proto_redistnum (AFI_IP, argv[0]);
9425 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009426 {
9427 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9428 return CMD_WARNING;
9429 }
9430 VTY_GET_INTEGER ("metric", metric, argv[1]);
9431
9432 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
9433 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[2]);
9434 return bgp_redistribute_set (vty->index, AFI_IP, type);
9435}
9436
9437DEFUN (no_bgp_redistribute_ipv4,
9438 no_bgp_redistribute_ipv4_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009439 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00009440 NO_STR
9441 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009442 QUAGGA_IP_REDIST_HELP_STR_BGPD)
paul718e3742002-12-13 20:15:29 +00009443{
9444 int type;
9445
David Lampartere0ca5fd2009-09-16 01:52:42 +02009446 type = proto_redistnum (AFI_IP, argv[0]);
9447 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009448 {
9449 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9450 return CMD_WARNING;
9451 }
9452
9453 return bgp_redistribute_unset (vty->index, AFI_IP, type);
9454}
9455
9456DEFUN (no_bgp_redistribute_ipv4_rmap,
9457 no_bgp_redistribute_ipv4_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009458 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00009459 NO_STR
9460 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009461 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009462 "Route map reference\n"
9463 "Pointer to route-map entries\n")
9464{
9465 int type;
9466
David Lampartere0ca5fd2009-09-16 01:52:42 +02009467 type = proto_redistnum (AFI_IP, argv[0]);
9468 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009469 {
9470 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9471 return CMD_WARNING;
9472 }
9473
9474 bgp_redistribute_routemap_unset (vty->index, AFI_IP, type);
9475 return CMD_SUCCESS;
9476}
9477
9478DEFUN (no_bgp_redistribute_ipv4_metric,
9479 no_bgp_redistribute_ipv4_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009480 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009481 NO_STR
9482 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009483 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009484 "Metric for redistributed routes\n"
9485 "Default metric\n")
9486{
9487 int type;
9488
David Lampartere0ca5fd2009-09-16 01:52:42 +02009489 type = proto_redistnum (AFI_IP, argv[0]);
9490 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009491 {
9492 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9493 return CMD_WARNING;
9494 }
9495
9496 bgp_redistribute_metric_unset (vty->index, AFI_IP, type);
9497 return CMD_SUCCESS;
9498}
9499
9500DEFUN (no_bgp_redistribute_ipv4_rmap_metric,
9501 no_bgp_redistribute_ipv4_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009502 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009503 NO_STR
9504 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009505 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009506 "Route map reference\n"
9507 "Pointer to route-map entries\n"
9508 "Metric for redistributed routes\n"
9509 "Default metric\n")
9510{
9511 int type;
9512
David Lampartere0ca5fd2009-09-16 01:52:42 +02009513 type = proto_redistnum (AFI_IP, argv[0]);
9514 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009515 {
9516 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9517 return CMD_WARNING;
9518 }
9519
9520 bgp_redistribute_metric_unset (vty->index, AFI_IP, type);
9521 bgp_redistribute_routemap_unset (vty->index, AFI_IP, type);
9522 return CMD_SUCCESS;
9523}
9524
9525ALIAS (no_bgp_redistribute_ipv4_rmap_metric,
9526 no_bgp_redistribute_ipv4_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009527 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00009528 NO_STR
9529 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009530 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009531 "Metric for redistributed routes\n"
9532 "Default metric\n"
9533 "Route map reference\n"
9534 "Pointer to route-map entries\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02009535
paul718e3742002-12-13 20:15:29 +00009536DEFUN (bgp_redistribute_ipv6,
9537 bgp_redistribute_ipv6_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009538 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00009539 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009540 QUAGGA_IP6_REDIST_HELP_STR_BGPD)
paul718e3742002-12-13 20:15:29 +00009541{
9542 int type;
9543
David Lampartere0ca5fd2009-09-16 01:52:42 +02009544 type = proto_redistnum (AFI_IP6, argv[0]);
9545 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009546 {
9547 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9548 return CMD_WARNING;
9549 }
9550
9551 return bgp_redistribute_set (vty->index, AFI_IP6, type);
9552}
9553
9554DEFUN (bgp_redistribute_ipv6_rmap,
9555 bgp_redistribute_ipv6_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009556 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00009557 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009558 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009559 "Route map reference\n"
9560 "Pointer to route-map entries\n")
9561{
9562 int type;
9563
David Lampartere0ca5fd2009-09-16 01:52:42 +02009564 type = proto_redistnum (AFI_IP6, argv[0]);
9565 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009566 {
9567 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9568 return CMD_WARNING;
9569 }
9570
9571 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]);
9572 return bgp_redistribute_set (vty->index, AFI_IP6, type);
9573}
9574
9575DEFUN (bgp_redistribute_ipv6_metric,
9576 bgp_redistribute_ipv6_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009577 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009578 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009579 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009580 "Metric for redistributed routes\n"
9581 "Default metric\n")
9582{
9583 int type;
9584 u_int32_t metric;
9585
David Lampartere0ca5fd2009-09-16 01:52:42 +02009586 type = proto_redistnum (AFI_IP6, argv[0]);
9587 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009588 {
9589 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9590 return CMD_WARNING;
9591 }
9592 VTY_GET_INTEGER ("metric", metric, argv[1]);
9593
9594 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
9595 return bgp_redistribute_set (vty->index, AFI_IP6, type);
9596}
9597
9598DEFUN (bgp_redistribute_ipv6_rmap_metric,
9599 bgp_redistribute_ipv6_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009600 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009601 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009602 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009603 "Route map reference\n"
9604 "Pointer to route-map entries\n"
9605 "Metric for redistributed routes\n"
9606 "Default metric\n")
9607{
9608 int type;
9609 u_int32_t metric;
9610
David Lampartere0ca5fd2009-09-16 01:52:42 +02009611 type = proto_redistnum (AFI_IP6, argv[0]);
9612 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009613 {
9614 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9615 return CMD_WARNING;
9616 }
9617 VTY_GET_INTEGER ("metric", metric, argv[2]);
9618
9619 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]);
9620 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
9621 return bgp_redistribute_set (vty->index, AFI_IP6, type);
9622}
9623
9624DEFUN (bgp_redistribute_ipv6_metric_rmap,
9625 bgp_redistribute_ipv6_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009626 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00009627 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009628 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009629 "Metric for redistributed routes\n"
9630 "Default metric\n"
9631 "Route map reference\n"
9632 "Pointer to route-map entries\n")
9633{
9634 int type;
9635 u_int32_t metric;
9636
David Lampartere0ca5fd2009-09-16 01:52:42 +02009637 type = proto_redistnum (AFI_IP6, argv[0]);
9638 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009639 {
9640 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9641 return CMD_WARNING;
9642 }
9643 VTY_GET_INTEGER ("metric", metric, argv[1]);
9644
9645 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
9646 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[2]);
9647 return bgp_redistribute_set (vty->index, AFI_IP6, type);
9648}
9649
9650DEFUN (no_bgp_redistribute_ipv6,
9651 no_bgp_redistribute_ipv6_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009652 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00009653 NO_STR
9654 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009655 QUAGGA_IP6_REDIST_HELP_STR_BGPD)
paul718e3742002-12-13 20:15:29 +00009656{
9657 int type;
9658
David Lampartere0ca5fd2009-09-16 01:52:42 +02009659 type = proto_redistnum (AFI_IP6, argv[0]);
9660 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009661 {
9662 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9663 return CMD_WARNING;
9664 }
9665
9666 return bgp_redistribute_unset (vty->index, AFI_IP6, type);
9667}
9668
9669DEFUN (no_bgp_redistribute_ipv6_rmap,
9670 no_bgp_redistribute_ipv6_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009671 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00009672 NO_STR
9673 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009674 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009675 "Route map reference\n"
9676 "Pointer to route-map entries\n")
9677{
9678 int type;
9679
David Lampartere0ca5fd2009-09-16 01:52:42 +02009680 type = proto_redistnum (AFI_IP6, argv[0]);
9681 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009682 {
9683 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9684 return CMD_WARNING;
9685 }
9686
9687 bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type);
9688 return CMD_SUCCESS;
9689}
9690
9691DEFUN (no_bgp_redistribute_ipv6_metric,
9692 no_bgp_redistribute_ipv6_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009693 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009694 NO_STR
9695 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009696 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009697 "Metric for redistributed routes\n"
9698 "Default metric\n")
9699{
9700 int type;
9701
David Lampartere0ca5fd2009-09-16 01:52:42 +02009702 type = proto_redistnum (AFI_IP6, argv[0]);
9703 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009704 {
9705 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9706 return CMD_WARNING;
9707 }
9708
9709 bgp_redistribute_metric_unset (vty->index, AFI_IP6, type);
9710 return CMD_SUCCESS;
9711}
9712
9713DEFUN (no_bgp_redistribute_ipv6_rmap_metric,
9714 no_bgp_redistribute_ipv6_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009715 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009716 NO_STR
9717 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009718 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009719 "Route map reference\n"
9720 "Pointer to route-map entries\n"
9721 "Metric for redistributed routes\n"
9722 "Default metric\n")
9723{
9724 int type;
9725
David Lampartere0ca5fd2009-09-16 01:52:42 +02009726 type = proto_redistnum (AFI_IP6, argv[0]);
9727 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009728 {
9729 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9730 return CMD_WARNING;
9731 }
9732
9733 bgp_redistribute_metric_unset (vty->index, AFI_IP6, type);
9734 bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type);
9735 return CMD_SUCCESS;
9736}
9737
9738ALIAS (no_bgp_redistribute_ipv6_rmap_metric,
9739 no_bgp_redistribute_ipv6_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009740 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00009741 NO_STR
9742 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009743 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009744 "Metric for redistributed routes\n"
9745 "Default metric\n"
9746 "Route map reference\n"
9747 "Pointer to route-map entries\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02009748
paul718e3742002-12-13 20:15:29 +00009749int
9750bgp_config_write_redistribute (struct vty *vty, struct bgp *bgp, afi_t afi,
9751 safi_t safi, int *write)
9752{
9753 int i;
paul718e3742002-12-13 20:15:29 +00009754
9755 /* Unicast redistribution only. */
9756 if (safi != SAFI_UNICAST)
9757 return 0;
9758
9759 for (i = 0; i < ZEBRA_ROUTE_MAX; i++)
9760 {
9761 /* Redistribute BGP does not make sense. */
9762 if (bgp->redist[afi][i] && i != ZEBRA_ROUTE_BGP)
9763 {
9764 /* Display "address-family" when it is not yet diplayed. */
9765 bgp_config_write_family_header (vty, afi, safi, write);
9766
9767 /* "redistribute" configuration. */
ajsf52d13c2005-10-01 17:38:06 +00009768 vty_out (vty, " redistribute %s", zebra_route_string(i));
paul718e3742002-12-13 20:15:29 +00009769
9770 if (bgp->redist_metric_flag[afi][i])
Jorge Boncompte [DTI2]ddc943d2012-04-13 13:46:07 +02009771 vty_out (vty, " metric %u", bgp->redist_metric[afi][i]);
paul718e3742002-12-13 20:15:29 +00009772
9773 if (bgp->rmap[afi][i].name)
9774 vty_out (vty, " route-map %s", bgp->rmap[afi][i].name);
9775
9776 vty_out (vty, "%s", VTY_NEWLINE);
9777 }
9778 }
9779 return *write;
9780}
David Lamparter6b0655a2014-06-04 06:53:35 +02009781
paul718e3742002-12-13 20:15:29 +00009782/* BGP node structure. */
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009783static struct cmd_node bgp_node =
paul718e3742002-12-13 20:15:29 +00009784{
9785 BGP_NODE,
9786 "%s(config-router)# ",
9787 1,
9788};
9789
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009790static struct cmd_node bgp_ipv4_unicast_node =
paul718e3742002-12-13 20:15:29 +00009791{
9792 BGP_IPV4_NODE,
9793 "%s(config-router-af)# ",
9794 1,
9795};
9796
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009797static struct cmd_node bgp_ipv4_multicast_node =
paul718e3742002-12-13 20:15:29 +00009798{
9799 BGP_IPV4M_NODE,
9800 "%s(config-router-af)# ",
9801 1,
9802};
9803
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009804static struct cmd_node bgp_ipv6_unicast_node =
paul718e3742002-12-13 20:15:29 +00009805{
9806 BGP_IPV6_NODE,
9807 "%s(config-router-af)# ",
9808 1,
9809};
9810
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009811static struct cmd_node bgp_ipv6_multicast_node =
paul25ffbdc2005-08-22 22:42:08 +00009812{
9813 BGP_IPV6M_NODE,
9814 "%s(config-router-af)# ",
9815 1,
9816};
9817
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009818static struct cmd_node bgp_vpnv4_node =
paul718e3742002-12-13 20:15:29 +00009819{
9820 BGP_VPNV4_NODE,
9821 "%s(config-router-af)# ",
9822 1
9823};
David Lamparter6b0655a2014-06-04 06:53:35 +02009824
Lou Berger13c378d2016-01-12 13:41:56 -05009825static struct cmd_node bgp_vpnv6_node =
9826{
9827 BGP_VPNV6_NODE,
9828 "%s(config-router-af-vpnv6)# ",
9829 1
9830};
9831
Lou Bergera3fda882016-01-12 13:42:04 -05009832static struct cmd_node bgp_encap_node =
9833{
9834 BGP_ENCAP_NODE,
9835 "%s(config-router-af-encap)# ",
9836 1
9837};
9838
9839static struct cmd_node bgp_encapv6_node =
9840{
9841 BGP_ENCAPV6_NODE,
9842 "%s(config-router-af-encapv6)# ",
9843 1
9844};
9845
paul1f8ae702005-09-09 23:49:49 +00009846static void community_list_vty (void);
9847
paul718e3742002-12-13 20:15:29 +00009848void
paul94f2b392005-06-28 12:44:16 +00009849bgp_vty_init (void)
paul718e3742002-12-13 20:15:29 +00009850{
paul718e3742002-12-13 20:15:29 +00009851 /* Install bgp top node. */
9852 install_node (&bgp_node, bgp_config_write);
9853 install_node (&bgp_ipv4_unicast_node, NULL);
9854 install_node (&bgp_ipv4_multicast_node, NULL);
9855 install_node (&bgp_ipv6_unicast_node, NULL);
paul25ffbdc2005-08-22 22:42:08 +00009856 install_node (&bgp_ipv6_multicast_node, NULL);
paul718e3742002-12-13 20:15:29 +00009857 install_node (&bgp_vpnv4_node, NULL);
Lou Berger13c378d2016-01-12 13:41:56 -05009858 install_node (&bgp_vpnv6_node, NULL);
Lou Bergera3fda882016-01-12 13:42:04 -05009859 install_node (&bgp_encap_node, NULL);
9860 install_node (&bgp_encapv6_node, NULL);
paul718e3742002-12-13 20:15:29 +00009861
9862 /* Install default VTY commands to new nodes. */
9863 install_default (BGP_NODE);
9864 install_default (BGP_IPV4_NODE);
9865 install_default (BGP_IPV4M_NODE);
9866 install_default (BGP_IPV6_NODE);
paul25ffbdc2005-08-22 22:42:08 +00009867 install_default (BGP_IPV6M_NODE);
paul718e3742002-12-13 20:15:29 +00009868 install_default (BGP_VPNV4_NODE);
Lou Berger13c378d2016-01-12 13:41:56 -05009869 install_default (BGP_VPNV6_NODE);
Lou Bergera3fda882016-01-12 13:42:04 -05009870 install_default (BGP_ENCAP_NODE);
9871 install_default (BGP_ENCAPV6_NODE);
paul718e3742002-12-13 20:15:29 +00009872
9873 /* "bgp multiple-instance" commands. */
9874 install_element (CONFIG_NODE, &bgp_multiple_instance_cmd);
9875 install_element (CONFIG_NODE, &no_bgp_multiple_instance_cmd);
9876
9877 /* "bgp config-type" commands. */
9878 install_element (CONFIG_NODE, &bgp_config_type_cmd);
9879 install_element (CONFIG_NODE, &no_bgp_config_type_cmd);
9880
9881 /* Dummy commands (Currently not supported) */
9882 install_element (BGP_NODE, &no_synchronization_cmd);
9883 install_element (BGP_NODE, &no_auto_summary_cmd);
9884
9885 /* "router bgp" commands. */
9886 install_element (CONFIG_NODE, &router_bgp_cmd);
9887 install_element (CONFIG_NODE, &router_bgp_view_cmd);
9888
9889 /* "no router bgp" commands. */
9890 install_element (CONFIG_NODE, &no_router_bgp_cmd);
9891 install_element (CONFIG_NODE, &no_router_bgp_view_cmd);
9892
9893 /* "bgp router-id" commands. */
9894 install_element (BGP_NODE, &bgp_router_id_cmd);
9895 install_element (BGP_NODE, &no_bgp_router_id_cmd);
9896 install_element (BGP_NODE, &no_bgp_router_id_val_cmd);
9897
9898 /* "bgp cluster-id" commands. */
9899 install_element (BGP_NODE, &bgp_cluster_id_cmd);
9900 install_element (BGP_NODE, &bgp_cluster_id32_cmd);
9901 install_element (BGP_NODE, &no_bgp_cluster_id_cmd);
9902 install_element (BGP_NODE, &no_bgp_cluster_id_arg_cmd);
9903
9904 /* "bgp confederation" commands. */
9905 install_element (BGP_NODE, &bgp_confederation_identifier_cmd);
9906 install_element (BGP_NODE, &no_bgp_confederation_identifier_cmd);
9907 install_element (BGP_NODE, &no_bgp_confederation_identifier_arg_cmd);
9908
9909 /* "bgp confederation peers" commands. */
9910 install_element (BGP_NODE, &bgp_confederation_peers_cmd);
9911 install_element (BGP_NODE, &no_bgp_confederation_peers_cmd);
9912
Josh Bailey165b5ff2011-07-20 20:43:22 -07009913 /* "maximum-paths" commands. */
9914 install_element (BGP_NODE, &bgp_maxpaths_cmd);
9915 install_element (BGP_NODE, &no_bgp_maxpaths_cmd);
9916 install_element (BGP_NODE, &no_bgp_maxpaths_arg_cmd);
9917 install_element (BGP_IPV4_NODE, &bgp_maxpaths_cmd);
9918 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_cmd);
9919 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_arg_cmd);
Ayan Banerjeeb8d1f712015-11-09 20:14:54 -05009920 install_element (BGP_IPV6_NODE, &bgp_maxpaths_cmd);
9921 install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_cmd);
9922 install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_arg_cmd);
Josh Bailey165b5ff2011-07-20 20:43:22 -07009923 install_element (BGP_NODE, &bgp_maxpaths_ibgp_cmd);
9924 install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_cmd);
9925 install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_arg_cmd);
9926 install_element (BGP_IPV4_NODE, &bgp_maxpaths_ibgp_cmd);
9927 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_cmd);
9928 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_arg_cmd);
Ayan Banerjeeb8d1f712015-11-09 20:14:54 -05009929 install_element (BGP_IPV6_NODE, &bgp_maxpaths_ibgp_cmd);
9930 install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_ibgp_cmd);
9931 install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_ibgp_arg_cmd);
Josh Bailey165b5ff2011-07-20 20:43:22 -07009932
paul718e3742002-12-13 20:15:29 +00009933 /* "timers bgp" commands. */
9934 install_element (BGP_NODE, &bgp_timers_cmd);
9935 install_element (BGP_NODE, &no_bgp_timers_cmd);
9936 install_element (BGP_NODE, &no_bgp_timers_arg_cmd);
9937
9938 /* "bgp client-to-client reflection" commands */
9939 install_element (BGP_NODE, &no_bgp_client_to_client_reflection_cmd);
9940 install_element (BGP_NODE, &bgp_client_to_client_reflection_cmd);
9941
9942 /* "bgp always-compare-med" commands */
9943 install_element (BGP_NODE, &bgp_always_compare_med_cmd);
9944 install_element (BGP_NODE, &no_bgp_always_compare_med_cmd);
9945
9946 /* "bgp deterministic-med" commands */
9947 install_element (BGP_NODE, &bgp_deterministic_med_cmd);
9948 install_element (BGP_NODE, &no_bgp_deterministic_med_cmd);
hasso538621f2004-05-21 09:31:30 +00009949
hasso538621f2004-05-21 09:31:30 +00009950 /* "bgp graceful-restart" commands */
9951 install_element (BGP_NODE, &bgp_graceful_restart_cmd);
9952 install_element (BGP_NODE, &no_bgp_graceful_restart_cmd);
hasso93406d82005-02-02 14:40:33 +00009953 install_element (BGP_NODE, &bgp_graceful_restart_stalepath_time_cmd);
9954 install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_cmd);
9955 install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_val_cmd);
Philippe Guibert4afa3dd2016-05-24 16:52:02 +02009956 install_element (BGP_NODE, &bgp_graceful_restart_restart_time_cmd);
9957 install_element (BGP_NODE, &no_bgp_graceful_restart_restart_time_cmd);
9958 install_element (BGP_NODE, &no_bgp_graceful_restart_restart_time_val_cmd);
paul718e3742002-12-13 20:15:29 +00009959
9960 /* "bgp fast-external-failover" commands */
9961 install_element (BGP_NODE, &bgp_fast_external_failover_cmd);
9962 install_element (BGP_NODE, &no_bgp_fast_external_failover_cmd);
9963
9964 /* "bgp enforce-first-as" commands */
9965 install_element (BGP_NODE, &bgp_enforce_first_as_cmd);
9966 install_element (BGP_NODE, &no_bgp_enforce_first_as_cmd);
9967
9968 /* "bgp bestpath compare-routerid" commands */
9969 install_element (BGP_NODE, &bgp_bestpath_compare_router_id_cmd);
9970 install_element (BGP_NODE, &no_bgp_bestpath_compare_router_id_cmd);
9971
9972 /* "bgp bestpath as-path ignore" commands */
9973 install_element (BGP_NODE, &bgp_bestpath_aspath_ignore_cmd);
9974 install_element (BGP_NODE, &no_bgp_bestpath_aspath_ignore_cmd);
9975
hasso68118452005-04-08 15:40:36 +00009976 /* "bgp bestpath as-path confed" commands */
9977 install_element (BGP_NODE, &bgp_bestpath_aspath_confed_cmd);
9978 install_element (BGP_NODE, &no_bgp_bestpath_aspath_confed_cmd);
9979
Pradosh Mohapatra2fdd4552013-09-07 07:02:36 +00009980 /* "bgp bestpath as-path multipath-relax" commands */
9981 install_element (BGP_NODE, &bgp_bestpath_aspath_multipath_relax_cmd);
9982 install_element (BGP_NODE, &no_bgp_bestpath_aspath_multipath_relax_cmd);
9983
paul848973c2003-08-13 00:32:49 +00009984 /* "bgp log-neighbor-changes" commands */
9985 install_element (BGP_NODE, &bgp_log_neighbor_changes_cmd);
9986 install_element (BGP_NODE, &no_bgp_log_neighbor_changes_cmd);
9987
paul718e3742002-12-13 20:15:29 +00009988 /* "bgp bestpath med" commands */
9989 install_element (BGP_NODE, &bgp_bestpath_med_cmd);
9990 install_element (BGP_NODE, &bgp_bestpath_med2_cmd);
9991 install_element (BGP_NODE, &bgp_bestpath_med3_cmd);
9992 install_element (BGP_NODE, &no_bgp_bestpath_med_cmd);
9993 install_element (BGP_NODE, &no_bgp_bestpath_med2_cmd);
9994 install_element (BGP_NODE, &no_bgp_bestpath_med3_cmd);
9995
9996 /* "no bgp default ipv4-unicast" commands. */
9997 install_element (BGP_NODE, &no_bgp_default_ipv4_unicast_cmd);
9998 install_element (BGP_NODE, &bgp_default_ipv4_unicast_cmd);
9999
10000 /* "bgp network import-check" commands. */
10001 install_element (BGP_NODE, &bgp_network_import_check_cmd);
10002 install_element (BGP_NODE, &no_bgp_network_import_check_cmd);
10003
10004 /* "bgp default local-preference" commands. */
10005 install_element (BGP_NODE, &bgp_default_local_preference_cmd);
10006 install_element (BGP_NODE, &no_bgp_default_local_preference_cmd);
10007 install_element (BGP_NODE, &no_bgp_default_local_preference_val_cmd);
10008
10009 /* "neighbor remote-as" commands. */
10010 install_element (BGP_NODE, &neighbor_remote_as_cmd);
10011 install_element (BGP_NODE, &no_neighbor_cmd);
10012 install_element (BGP_NODE, &no_neighbor_remote_as_cmd);
10013
10014 /* "neighbor peer-group" commands. */
10015 install_element (BGP_NODE, &neighbor_peer_group_cmd);
10016 install_element (BGP_NODE, &no_neighbor_peer_group_cmd);
10017 install_element (BGP_NODE, &no_neighbor_peer_group_remote_as_cmd);
10018
10019 /* "neighbor local-as" commands. */
10020 install_element (BGP_NODE, &neighbor_local_as_cmd);
10021 install_element (BGP_NODE, &neighbor_local_as_no_prepend_cmd);
Andrew Certain9d3f9702012-11-07 23:50:07 +000010022 install_element (BGP_NODE, &neighbor_local_as_no_prepend_replace_as_cmd);
paul718e3742002-12-13 20:15:29 +000010023 install_element (BGP_NODE, &no_neighbor_local_as_cmd);
10024 install_element (BGP_NODE, &no_neighbor_local_as_val_cmd);
10025 install_element (BGP_NODE, &no_neighbor_local_as_val2_cmd);
Andrew Certain9d3f9702012-11-07 23:50:07 +000010026 install_element (BGP_NODE, &no_neighbor_local_as_val3_cmd);
paul718e3742002-12-13 20:15:29 +000010027
Paul Jakma0df7c912008-07-21 21:02:49 +000010028 /* "neighbor password" commands. */
10029 install_element (BGP_NODE, &neighbor_password_cmd);
10030 install_element (BGP_NODE, &no_neighbor_password_cmd);
10031
paul718e3742002-12-13 20:15:29 +000010032 /* "neighbor activate" commands. */
10033 install_element (BGP_NODE, &neighbor_activate_cmd);
10034 install_element (BGP_IPV4_NODE, &neighbor_activate_cmd);
10035 install_element (BGP_IPV4M_NODE, &neighbor_activate_cmd);
10036 install_element (BGP_IPV6_NODE, &neighbor_activate_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010037 install_element (BGP_IPV6M_NODE, &neighbor_activate_cmd);
paul718e3742002-12-13 20:15:29 +000010038 install_element (BGP_VPNV4_NODE, &neighbor_activate_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010039 install_element (BGP_VPNV6_NODE, &neighbor_activate_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010040 install_element (BGP_ENCAP_NODE, &neighbor_activate_cmd);
10041 install_element (BGP_ENCAPV6_NODE, &neighbor_activate_cmd);
paul718e3742002-12-13 20:15:29 +000010042
10043 /* "no neighbor activate" commands. */
10044 install_element (BGP_NODE, &no_neighbor_activate_cmd);
10045 install_element (BGP_IPV4_NODE, &no_neighbor_activate_cmd);
10046 install_element (BGP_IPV4M_NODE, &no_neighbor_activate_cmd);
10047 install_element (BGP_IPV6_NODE, &no_neighbor_activate_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010048 install_element (BGP_IPV6M_NODE, &no_neighbor_activate_cmd);
paul718e3742002-12-13 20:15:29 +000010049 install_element (BGP_VPNV4_NODE, &no_neighbor_activate_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010050 install_element (BGP_VPNV6_NODE, &no_neighbor_activate_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010051 install_element (BGP_ENCAP_NODE, &no_neighbor_activate_cmd);
10052 install_element (BGP_ENCAPV6_NODE, &no_neighbor_activate_cmd);
paul718e3742002-12-13 20:15:29 +000010053
10054 /* "neighbor peer-group set" commands. */
10055 install_element (BGP_NODE, &neighbor_set_peer_group_cmd);
10056 install_element (BGP_IPV4_NODE, &neighbor_set_peer_group_cmd);
10057 install_element (BGP_IPV4M_NODE, &neighbor_set_peer_group_cmd);
10058 install_element (BGP_IPV6_NODE, &neighbor_set_peer_group_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010059 install_element (BGP_IPV6M_NODE, &neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +000010060 install_element (BGP_VPNV4_NODE, &neighbor_set_peer_group_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010061 install_element (BGP_VPNV6_NODE, &neighbor_set_peer_group_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010062 install_element (BGP_ENCAP_NODE, &neighbor_set_peer_group_cmd);
10063 install_element (BGP_ENCAPV6_NODE, &neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +000010064
paul718e3742002-12-13 20:15:29 +000010065 /* "no neighbor peer-group unset" commands. */
10066 install_element (BGP_NODE, &no_neighbor_set_peer_group_cmd);
10067 install_element (BGP_IPV4_NODE, &no_neighbor_set_peer_group_cmd);
10068 install_element (BGP_IPV4M_NODE, &no_neighbor_set_peer_group_cmd);
10069 install_element (BGP_IPV6_NODE, &no_neighbor_set_peer_group_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010070 install_element (BGP_IPV6M_NODE, &no_neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +000010071 install_element (BGP_VPNV4_NODE, &no_neighbor_set_peer_group_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010072 install_element (BGP_VPNV6_NODE, &no_neighbor_set_peer_group_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010073 install_element (BGP_ENCAP_NODE, &no_neighbor_set_peer_group_cmd);
10074 install_element (BGP_ENCAPV6_NODE, &no_neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +000010075
paul718e3742002-12-13 20:15:29 +000010076 /* "neighbor softreconfiguration inbound" commands.*/
10077 install_element (BGP_NODE, &neighbor_soft_reconfiguration_cmd);
10078 install_element (BGP_NODE, &no_neighbor_soft_reconfiguration_cmd);
10079 install_element (BGP_IPV4_NODE, &neighbor_soft_reconfiguration_cmd);
10080 install_element (BGP_IPV4_NODE, &no_neighbor_soft_reconfiguration_cmd);
10081 install_element (BGP_IPV4M_NODE, &neighbor_soft_reconfiguration_cmd);
10082 install_element (BGP_IPV4M_NODE, &no_neighbor_soft_reconfiguration_cmd);
10083 install_element (BGP_IPV6_NODE, &neighbor_soft_reconfiguration_cmd);
10084 install_element (BGP_IPV6_NODE, &no_neighbor_soft_reconfiguration_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010085 install_element (BGP_IPV6M_NODE, &neighbor_soft_reconfiguration_cmd);
10086 install_element (BGP_IPV6M_NODE, &no_neighbor_soft_reconfiguration_cmd);
paula58545b2003-07-12 21:43:01 +000010087 install_element (BGP_VPNV4_NODE, &neighbor_soft_reconfiguration_cmd);
10088 install_element (BGP_VPNV4_NODE, &no_neighbor_soft_reconfiguration_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010089 install_element (BGP_VPNV6_NODE, &neighbor_soft_reconfiguration_cmd);
10090 install_element (BGP_VPNV6_NODE, &no_neighbor_soft_reconfiguration_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010091 install_element (BGP_ENCAP_NODE, &neighbor_soft_reconfiguration_cmd);
10092 install_element (BGP_ENCAP_NODE, &no_neighbor_soft_reconfiguration_cmd);
10093 install_element (BGP_ENCAPV6_NODE, &neighbor_soft_reconfiguration_cmd);
10094 install_element (BGP_ENCAPV6_NODE, &no_neighbor_soft_reconfiguration_cmd);
paul718e3742002-12-13 20:15:29 +000010095
10096 /* "neighbor attribute-unchanged" commands. */
10097 install_element (BGP_NODE, &neighbor_attr_unchanged_cmd);
10098 install_element (BGP_NODE, &neighbor_attr_unchanged1_cmd);
10099 install_element (BGP_NODE, &neighbor_attr_unchanged2_cmd);
10100 install_element (BGP_NODE, &neighbor_attr_unchanged3_cmd);
10101 install_element (BGP_NODE, &neighbor_attr_unchanged4_cmd);
10102 install_element (BGP_NODE, &neighbor_attr_unchanged5_cmd);
10103 install_element (BGP_NODE, &neighbor_attr_unchanged6_cmd);
10104 install_element (BGP_NODE, &neighbor_attr_unchanged7_cmd);
10105 install_element (BGP_NODE, &neighbor_attr_unchanged8_cmd);
10106 install_element (BGP_NODE, &neighbor_attr_unchanged9_cmd);
10107 install_element (BGP_NODE, &neighbor_attr_unchanged10_cmd);
10108 install_element (BGP_NODE, &no_neighbor_attr_unchanged_cmd);
10109 install_element (BGP_NODE, &no_neighbor_attr_unchanged1_cmd);
10110 install_element (BGP_NODE, &no_neighbor_attr_unchanged2_cmd);
10111 install_element (BGP_NODE, &no_neighbor_attr_unchanged3_cmd);
10112 install_element (BGP_NODE, &no_neighbor_attr_unchanged4_cmd);
10113 install_element (BGP_NODE, &no_neighbor_attr_unchanged5_cmd);
10114 install_element (BGP_NODE, &no_neighbor_attr_unchanged6_cmd);
10115 install_element (BGP_NODE, &no_neighbor_attr_unchanged7_cmd);
10116 install_element (BGP_NODE, &no_neighbor_attr_unchanged8_cmd);
10117 install_element (BGP_NODE, &no_neighbor_attr_unchanged9_cmd);
10118 install_element (BGP_NODE, &no_neighbor_attr_unchanged10_cmd);
10119 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged_cmd);
10120 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged1_cmd);
10121 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged2_cmd);
10122 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged3_cmd);
10123 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged4_cmd);
10124 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged5_cmd);
10125 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged6_cmd);
10126 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged7_cmd);
10127 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged8_cmd);
10128 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged9_cmd);
10129 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged10_cmd);
10130 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged_cmd);
10131 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged1_cmd);
10132 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged2_cmd);
10133 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged3_cmd);
10134 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged4_cmd);
10135 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged5_cmd);
10136 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged6_cmd);
10137 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged7_cmd);
10138 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged8_cmd);
10139 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged9_cmd);
10140 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged10_cmd);
10141 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged_cmd);
10142 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged1_cmd);
10143 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged2_cmd);
10144 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged3_cmd);
10145 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged4_cmd);
10146 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged5_cmd);
10147 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged6_cmd);
10148 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged7_cmd);
10149 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged8_cmd);
10150 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged9_cmd);
10151 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged10_cmd);
10152 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged_cmd);
10153 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged1_cmd);
10154 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged2_cmd);
10155 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged3_cmd);
10156 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged4_cmd);
10157 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged5_cmd);
10158 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged6_cmd);
10159 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged7_cmd);
10160 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged8_cmd);
10161 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged9_cmd);
10162 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged10_cmd);
10163 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged_cmd);
10164 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged1_cmd);
10165 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged2_cmd);
10166 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged3_cmd);
10167 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged4_cmd);
10168 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged5_cmd);
10169 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged6_cmd);
10170 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged7_cmd);
10171 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged8_cmd);
10172 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged9_cmd);
10173 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged10_cmd);
10174 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged_cmd);
10175 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged1_cmd);
10176 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged2_cmd);
10177 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged3_cmd);
10178 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged4_cmd);
10179 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged5_cmd);
10180 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged6_cmd);
10181 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged7_cmd);
10182 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged8_cmd);
10183 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged9_cmd);
10184 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged10_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010185 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged_cmd);
10186 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged1_cmd);
10187 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged2_cmd);
10188 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged3_cmd);
10189 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged4_cmd);
10190 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged5_cmd);
10191 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged6_cmd);
10192 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged7_cmd);
10193 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged8_cmd);
10194 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged9_cmd);
10195 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged10_cmd);
10196 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged_cmd);
10197 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged1_cmd);
10198 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged2_cmd);
10199 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged3_cmd);
10200 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged4_cmd);
10201 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged5_cmd);
10202 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged6_cmd);
10203 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged7_cmd);
10204 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged8_cmd);
10205 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged9_cmd);
10206 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged10_cmd);
paul718e3742002-12-13 20:15:29 +000010207 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged_cmd);
10208 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged1_cmd);
10209 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged2_cmd);
10210 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged3_cmd);
10211 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged4_cmd);
10212 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged5_cmd);
10213 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged6_cmd);
10214 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged7_cmd);
10215 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged8_cmd);
10216 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged9_cmd);
10217 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged10_cmd);
10218 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged_cmd);
10219 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged1_cmd);
10220 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged2_cmd);
10221 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged3_cmd);
10222 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged4_cmd);
10223 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged5_cmd);
10224 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged6_cmd);
10225 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged7_cmd);
10226 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged8_cmd);
10227 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged9_cmd);
10228 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged10_cmd);
10229
Lou Berger13c378d2016-01-12 13:41:56 -050010230 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged_cmd);
10231 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged1_cmd);
10232 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged2_cmd);
10233 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged3_cmd);
10234 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged4_cmd);
10235 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged5_cmd);
10236 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged6_cmd);
10237 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged7_cmd);
10238 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged8_cmd);
10239 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged9_cmd);
10240 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged10_cmd);
10241 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged_cmd);
10242 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged1_cmd);
10243 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged2_cmd);
10244 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged3_cmd);
10245 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged4_cmd);
10246 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged5_cmd);
10247 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged6_cmd);
10248 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged7_cmd);
10249 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged8_cmd);
10250 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged9_cmd);
10251 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged10_cmd);
10252
Lou Bergera3fda882016-01-12 13:42:04 -050010253 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged_cmd);
10254 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged1_cmd);
10255 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged2_cmd);
10256 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged3_cmd);
10257 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged4_cmd);
10258 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged5_cmd);
10259 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged6_cmd);
10260 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged7_cmd);
10261 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged8_cmd);
10262 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged9_cmd);
10263 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged10_cmd);
10264 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged_cmd);
10265 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged1_cmd);
10266 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged2_cmd);
10267 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged3_cmd);
10268 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged4_cmd);
10269 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged5_cmd);
10270 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged6_cmd);
10271 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged7_cmd);
10272 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged8_cmd);
10273 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged9_cmd);
10274 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged10_cmd);
10275
10276 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged_cmd);
10277 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged1_cmd);
10278 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged2_cmd);
10279 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged3_cmd);
10280 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged4_cmd);
10281 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged5_cmd);
10282 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged6_cmd);
10283 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged7_cmd);
10284 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged8_cmd);
10285 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged9_cmd);
10286 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged10_cmd);
10287 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged_cmd);
10288 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged1_cmd);
10289 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged2_cmd);
10290 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged3_cmd);
10291 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged4_cmd);
10292 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged5_cmd);
10293 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged6_cmd);
10294 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged7_cmd);
10295 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged8_cmd);
10296 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged9_cmd);
10297 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged10_cmd);
10298
paulfee0f4c2004-09-13 05:12:46 +000010299 /* "nexthop-local unchanged" commands */
10300 install_element (BGP_IPV6_NODE, &neighbor_nexthop_local_unchanged_cmd);
10301 install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_local_unchanged_cmd);
10302
paul718e3742002-12-13 20:15:29 +000010303 /* "transparent-as" and "transparent-nexthop" for old version
10304 compatibility. */
10305 install_element (BGP_NODE, &neighbor_transparent_as_cmd);
10306 install_element (BGP_NODE, &neighbor_transparent_nexthop_cmd);
10307
10308 /* "neighbor next-hop-self" commands. */
10309 install_element (BGP_NODE, &neighbor_nexthop_self_cmd);
10310 install_element (BGP_NODE, &no_neighbor_nexthop_self_cmd);
10311 install_element (BGP_IPV4_NODE, &neighbor_nexthop_self_cmd);
10312 install_element (BGP_IPV4_NODE, &no_neighbor_nexthop_self_cmd);
10313 install_element (BGP_IPV4M_NODE, &neighbor_nexthop_self_cmd);
10314 install_element (BGP_IPV4M_NODE, &no_neighbor_nexthop_self_cmd);
10315 install_element (BGP_IPV6_NODE, &neighbor_nexthop_self_cmd);
10316 install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_self_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010317 install_element (BGP_IPV6M_NODE, &neighbor_nexthop_self_cmd);
10318 install_element (BGP_IPV6M_NODE, &no_neighbor_nexthop_self_cmd);
paul718e3742002-12-13 20:15:29 +000010319 install_element (BGP_VPNV4_NODE, &neighbor_nexthop_self_cmd);
10320 install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010321 install_element (BGP_VPNV6_NODE, &neighbor_nexthop_self_cmd);
10322 install_element (BGP_VPNV6_NODE, &no_neighbor_nexthop_self_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010323 install_element (BGP_ENCAP_NODE, &neighbor_nexthop_self_cmd);
10324 install_element (BGP_ENCAP_NODE, &no_neighbor_nexthop_self_cmd);
10325 install_element (BGP_ENCAPV6_NODE, &neighbor_nexthop_self_cmd);
10326 install_element (BGP_ENCAPV6_NODE, &no_neighbor_nexthop_self_cmd);
paul718e3742002-12-13 20:15:29 +000010327
10328 /* "neighbor remove-private-AS" commands. */
10329 install_element (BGP_NODE, &neighbor_remove_private_as_cmd);
10330 install_element (BGP_NODE, &no_neighbor_remove_private_as_cmd);
10331 install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_cmd);
10332 install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_cmd);
10333 install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_cmd);
10334 install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_cmd);
10335 install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_cmd);
10336 install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010337 install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_cmd);
10338 install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_cmd);
paul718e3742002-12-13 20:15:29 +000010339 install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_cmd);
10340 install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010341 install_element (BGP_VPNV6_NODE, &neighbor_remove_private_as_cmd);
10342 install_element (BGP_VPNV6_NODE, &no_neighbor_remove_private_as_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010343 install_element (BGP_ENCAP_NODE, &neighbor_remove_private_as_cmd);
10344 install_element (BGP_ENCAP_NODE, &no_neighbor_remove_private_as_cmd);
10345 install_element (BGP_ENCAPV6_NODE, &neighbor_remove_private_as_cmd);
10346 install_element (BGP_ENCAPV6_NODE, &no_neighbor_remove_private_as_cmd);
paul718e3742002-12-13 20:15:29 +000010347
10348 /* "neighbor send-community" commands.*/
10349 install_element (BGP_NODE, &neighbor_send_community_cmd);
10350 install_element (BGP_NODE, &neighbor_send_community_type_cmd);
10351 install_element (BGP_NODE, &no_neighbor_send_community_cmd);
10352 install_element (BGP_NODE, &no_neighbor_send_community_type_cmd);
10353 install_element (BGP_IPV4_NODE, &neighbor_send_community_cmd);
10354 install_element (BGP_IPV4_NODE, &neighbor_send_community_type_cmd);
10355 install_element (BGP_IPV4_NODE, &no_neighbor_send_community_cmd);
10356 install_element (BGP_IPV4_NODE, &no_neighbor_send_community_type_cmd);
10357 install_element (BGP_IPV4M_NODE, &neighbor_send_community_cmd);
10358 install_element (BGP_IPV4M_NODE, &neighbor_send_community_type_cmd);
10359 install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_cmd);
10360 install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_type_cmd);
10361 install_element (BGP_IPV6_NODE, &neighbor_send_community_cmd);
10362 install_element (BGP_IPV6_NODE, &neighbor_send_community_type_cmd);
10363 install_element (BGP_IPV6_NODE, &no_neighbor_send_community_cmd);
10364 install_element (BGP_IPV6_NODE, &no_neighbor_send_community_type_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010365 install_element (BGP_IPV6M_NODE, &neighbor_send_community_cmd);
10366 install_element (BGP_IPV6M_NODE, &neighbor_send_community_type_cmd);
10367 install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_cmd);
10368 install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_type_cmd);
paul718e3742002-12-13 20:15:29 +000010369 install_element (BGP_VPNV4_NODE, &neighbor_send_community_cmd);
10370 install_element (BGP_VPNV4_NODE, &neighbor_send_community_type_cmd);
10371 install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_cmd);
10372 install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_type_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010373 install_element (BGP_VPNV6_NODE, &neighbor_send_community_cmd);
10374 install_element (BGP_VPNV6_NODE, &neighbor_send_community_type_cmd);
10375 install_element (BGP_VPNV6_NODE, &no_neighbor_send_community_cmd);
10376 install_element (BGP_VPNV6_NODE, &no_neighbor_send_community_type_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010377 install_element (BGP_ENCAP_NODE, &neighbor_send_community_cmd);
10378 install_element (BGP_ENCAP_NODE, &neighbor_send_community_type_cmd);
10379 install_element (BGP_ENCAP_NODE, &no_neighbor_send_community_cmd);
10380 install_element (BGP_ENCAP_NODE, &no_neighbor_send_community_type_cmd);
10381 install_element (BGP_ENCAPV6_NODE, &neighbor_send_community_cmd);
10382 install_element (BGP_ENCAPV6_NODE, &neighbor_send_community_type_cmd);
10383 install_element (BGP_ENCAPV6_NODE, &no_neighbor_send_community_cmd);
10384 install_element (BGP_ENCAPV6_NODE, &no_neighbor_send_community_type_cmd);
paul718e3742002-12-13 20:15:29 +000010385
10386 /* "neighbor route-reflector" commands.*/
10387 install_element (BGP_NODE, &neighbor_route_reflector_client_cmd);
10388 install_element (BGP_NODE, &no_neighbor_route_reflector_client_cmd);
10389 install_element (BGP_IPV4_NODE, &neighbor_route_reflector_client_cmd);
10390 install_element (BGP_IPV4_NODE, &no_neighbor_route_reflector_client_cmd);
10391 install_element (BGP_IPV4M_NODE, &neighbor_route_reflector_client_cmd);
10392 install_element (BGP_IPV4M_NODE, &no_neighbor_route_reflector_client_cmd);
10393 install_element (BGP_IPV6_NODE, &neighbor_route_reflector_client_cmd);
10394 install_element (BGP_IPV6_NODE, &no_neighbor_route_reflector_client_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010395 install_element (BGP_IPV6M_NODE, &neighbor_route_reflector_client_cmd);
10396 install_element (BGP_IPV6M_NODE, &no_neighbor_route_reflector_client_cmd);
paul718e3742002-12-13 20:15:29 +000010397 install_element (BGP_VPNV4_NODE, &neighbor_route_reflector_client_cmd);
10398 install_element (BGP_VPNV4_NODE, &no_neighbor_route_reflector_client_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010399 install_element (BGP_VPNV6_NODE, &neighbor_route_reflector_client_cmd);
10400 install_element (BGP_VPNV6_NODE, &no_neighbor_route_reflector_client_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010401 install_element (BGP_ENCAP_NODE, &neighbor_route_reflector_client_cmd);
10402 install_element (BGP_ENCAP_NODE, &no_neighbor_route_reflector_client_cmd);
10403 install_element (BGP_ENCAPV6_NODE, &neighbor_route_reflector_client_cmd);
10404 install_element (BGP_ENCAPV6_NODE, &no_neighbor_route_reflector_client_cmd);
paul718e3742002-12-13 20:15:29 +000010405
10406 /* "neighbor route-server" commands.*/
10407 install_element (BGP_NODE, &neighbor_route_server_client_cmd);
10408 install_element (BGP_NODE, &no_neighbor_route_server_client_cmd);
10409 install_element (BGP_IPV4_NODE, &neighbor_route_server_client_cmd);
10410 install_element (BGP_IPV4_NODE, &no_neighbor_route_server_client_cmd);
10411 install_element (BGP_IPV4M_NODE, &neighbor_route_server_client_cmd);
10412 install_element (BGP_IPV4M_NODE, &no_neighbor_route_server_client_cmd);
10413 install_element (BGP_IPV6_NODE, &neighbor_route_server_client_cmd);
10414 install_element (BGP_IPV6_NODE, &no_neighbor_route_server_client_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010415 install_element (BGP_IPV6M_NODE, &neighbor_route_server_client_cmd);
10416 install_element (BGP_IPV6M_NODE, &no_neighbor_route_server_client_cmd);
paul718e3742002-12-13 20:15:29 +000010417 install_element (BGP_VPNV4_NODE, &neighbor_route_server_client_cmd);
10418 install_element (BGP_VPNV4_NODE, &no_neighbor_route_server_client_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010419 install_element (BGP_VPNV6_NODE, &neighbor_route_server_client_cmd);
10420 install_element (BGP_VPNV6_NODE, &no_neighbor_route_server_client_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010421 install_element (BGP_ENCAP_NODE, &neighbor_route_server_client_cmd);
10422 install_element (BGP_ENCAP_NODE, &no_neighbor_route_server_client_cmd);
10423 install_element (BGP_ENCAPV6_NODE, &neighbor_route_server_client_cmd);
10424 install_element (BGP_ENCAPV6_NODE, &no_neighbor_route_server_client_cmd);
paul718e3742002-12-13 20:15:29 +000010425
10426 /* "neighbor passive" commands. */
10427 install_element (BGP_NODE, &neighbor_passive_cmd);
10428 install_element (BGP_NODE, &no_neighbor_passive_cmd);
10429
10430 /* "neighbor shutdown" commands. */
10431 install_element (BGP_NODE, &neighbor_shutdown_cmd);
10432 install_element (BGP_NODE, &no_neighbor_shutdown_cmd);
10433
hassoc9502432005-02-01 22:01:48 +000010434 /* Deprecated "neighbor capability route-refresh" commands.*/
paul718e3742002-12-13 20:15:29 +000010435 install_element (BGP_NODE, &neighbor_capability_route_refresh_cmd);
10436 install_element (BGP_NODE, &no_neighbor_capability_route_refresh_cmd);
10437
10438 /* "neighbor capability orf prefix-list" commands.*/
10439 install_element (BGP_NODE, &neighbor_capability_orf_prefix_cmd);
10440 install_element (BGP_NODE, &no_neighbor_capability_orf_prefix_cmd);
10441 install_element (BGP_IPV4_NODE, &neighbor_capability_orf_prefix_cmd);
10442 install_element (BGP_IPV4_NODE, &no_neighbor_capability_orf_prefix_cmd);
10443 install_element (BGP_IPV4M_NODE, &neighbor_capability_orf_prefix_cmd);
10444 install_element (BGP_IPV4M_NODE, &no_neighbor_capability_orf_prefix_cmd);
10445 install_element (BGP_IPV6_NODE, &neighbor_capability_orf_prefix_cmd);
10446 install_element (BGP_IPV6_NODE, &no_neighbor_capability_orf_prefix_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010447 install_element (BGP_IPV6M_NODE, &neighbor_capability_orf_prefix_cmd);
10448 install_element (BGP_IPV6M_NODE, &no_neighbor_capability_orf_prefix_cmd);
paul718e3742002-12-13 20:15:29 +000010449
10450 /* "neighbor capability dynamic" commands.*/
10451 install_element (BGP_NODE, &neighbor_capability_dynamic_cmd);
10452 install_element (BGP_NODE, &no_neighbor_capability_dynamic_cmd);
10453
10454 /* "neighbor dont-capability-negotiate" commands. */
10455 install_element (BGP_NODE, &neighbor_dont_capability_negotiate_cmd);
10456 install_element (BGP_NODE, &no_neighbor_dont_capability_negotiate_cmd);
10457
10458 /* "neighbor ebgp-multihop" commands. */
10459 install_element (BGP_NODE, &neighbor_ebgp_multihop_cmd);
10460 install_element (BGP_NODE, &neighbor_ebgp_multihop_ttl_cmd);
10461 install_element (BGP_NODE, &no_neighbor_ebgp_multihop_cmd);
10462 install_element (BGP_NODE, &no_neighbor_ebgp_multihop_ttl_cmd);
10463
hasso6ffd2072005-02-02 14:50:11 +000010464 /* "neighbor disable-connected-check" commands. */
10465 install_element (BGP_NODE, &neighbor_disable_connected_check_cmd);
10466 install_element (BGP_NODE, &no_neighbor_disable_connected_check_cmd);
paul718e3742002-12-13 20:15:29 +000010467 install_element (BGP_NODE, &neighbor_enforce_multihop_cmd);
10468 install_element (BGP_NODE, &no_neighbor_enforce_multihop_cmd);
10469
10470 /* "neighbor description" commands. */
10471 install_element (BGP_NODE, &neighbor_description_cmd);
10472 install_element (BGP_NODE, &no_neighbor_description_cmd);
10473 install_element (BGP_NODE, &no_neighbor_description_val_cmd);
10474
10475 /* "neighbor update-source" commands. "*/
10476 install_element (BGP_NODE, &neighbor_update_source_cmd);
10477 install_element (BGP_NODE, &no_neighbor_update_source_cmd);
10478
10479 /* "neighbor default-originate" commands. */
10480 install_element (BGP_NODE, &neighbor_default_originate_cmd);
10481 install_element (BGP_NODE, &neighbor_default_originate_rmap_cmd);
10482 install_element (BGP_NODE, &no_neighbor_default_originate_cmd);
10483 install_element (BGP_NODE, &no_neighbor_default_originate_rmap_cmd);
10484 install_element (BGP_IPV4_NODE, &neighbor_default_originate_cmd);
10485 install_element (BGP_IPV4_NODE, &neighbor_default_originate_rmap_cmd);
10486 install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_cmd);
10487 install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_rmap_cmd);
10488 install_element (BGP_IPV4M_NODE, &neighbor_default_originate_cmd);
10489 install_element (BGP_IPV4M_NODE, &neighbor_default_originate_rmap_cmd);
10490 install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_cmd);
10491 install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_rmap_cmd);
10492 install_element (BGP_IPV6_NODE, &neighbor_default_originate_cmd);
10493 install_element (BGP_IPV6_NODE, &neighbor_default_originate_rmap_cmd);
10494 install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_cmd);
10495 install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_rmap_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010496 install_element (BGP_IPV6M_NODE, &neighbor_default_originate_cmd);
10497 install_element (BGP_IPV6M_NODE, &neighbor_default_originate_rmap_cmd);
10498 install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_cmd);
10499 install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_rmap_cmd);
paul718e3742002-12-13 20:15:29 +000010500
10501 /* "neighbor port" commands. */
10502 install_element (BGP_NODE, &neighbor_port_cmd);
10503 install_element (BGP_NODE, &no_neighbor_port_cmd);
10504 install_element (BGP_NODE, &no_neighbor_port_val_cmd);
10505
10506 /* "neighbor weight" commands. */
10507 install_element (BGP_NODE, &neighbor_weight_cmd);
10508 install_element (BGP_NODE, &no_neighbor_weight_cmd);
10509 install_element (BGP_NODE, &no_neighbor_weight_val_cmd);
10510
10511 /* "neighbor override-capability" commands. */
10512 install_element (BGP_NODE, &neighbor_override_capability_cmd);
10513 install_element (BGP_NODE, &no_neighbor_override_capability_cmd);
10514
10515 /* "neighbor strict-capability-match" commands. */
10516 install_element (BGP_NODE, &neighbor_strict_capability_cmd);
10517 install_element (BGP_NODE, &no_neighbor_strict_capability_cmd);
10518
10519 /* "neighbor timers" commands. */
10520 install_element (BGP_NODE, &neighbor_timers_cmd);
10521 install_element (BGP_NODE, &no_neighbor_timers_cmd);
10522
10523 /* "neighbor timers connect" commands. */
10524 install_element (BGP_NODE, &neighbor_timers_connect_cmd);
10525 install_element (BGP_NODE, &no_neighbor_timers_connect_cmd);
10526 install_element (BGP_NODE, &no_neighbor_timers_connect_val_cmd);
10527
10528 /* "neighbor advertisement-interval" commands. */
10529 install_element (BGP_NODE, &neighbor_advertise_interval_cmd);
10530 install_element (BGP_NODE, &no_neighbor_advertise_interval_cmd);
10531 install_element (BGP_NODE, &no_neighbor_advertise_interval_val_cmd);
10532
10533 /* "neighbor version" commands. */
10534 install_element (BGP_NODE, &neighbor_version_cmd);
paul718e3742002-12-13 20:15:29 +000010535
10536 /* "neighbor interface" commands. */
10537 install_element (BGP_NODE, &neighbor_interface_cmd);
10538 install_element (BGP_NODE, &no_neighbor_interface_cmd);
10539
10540 /* "neighbor distribute" commands. */
10541 install_element (BGP_NODE, &neighbor_distribute_list_cmd);
10542 install_element (BGP_NODE, &no_neighbor_distribute_list_cmd);
10543 install_element (BGP_IPV4_NODE, &neighbor_distribute_list_cmd);
10544 install_element (BGP_IPV4_NODE, &no_neighbor_distribute_list_cmd);
10545 install_element (BGP_IPV4M_NODE, &neighbor_distribute_list_cmd);
10546 install_element (BGP_IPV4M_NODE, &no_neighbor_distribute_list_cmd);
10547 install_element (BGP_IPV6_NODE, &neighbor_distribute_list_cmd);
10548 install_element (BGP_IPV6_NODE, &no_neighbor_distribute_list_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010549 install_element (BGP_IPV6M_NODE, &neighbor_distribute_list_cmd);
10550 install_element (BGP_IPV6M_NODE, &no_neighbor_distribute_list_cmd);
paul718e3742002-12-13 20:15:29 +000010551 install_element (BGP_VPNV4_NODE, &neighbor_distribute_list_cmd);
10552 install_element (BGP_VPNV4_NODE, &no_neighbor_distribute_list_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010553 install_element (BGP_VPNV6_NODE, &neighbor_distribute_list_cmd);
10554 install_element (BGP_VPNV6_NODE, &no_neighbor_distribute_list_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010555 install_element (BGP_ENCAP_NODE, &neighbor_distribute_list_cmd);
10556 install_element (BGP_ENCAP_NODE, &no_neighbor_distribute_list_cmd);
10557 install_element (BGP_ENCAPV6_NODE, &neighbor_distribute_list_cmd);
10558 install_element (BGP_ENCAPV6_NODE, &no_neighbor_distribute_list_cmd);
paul718e3742002-12-13 20:15:29 +000010559
10560 /* "neighbor prefix-list" commands. */
10561 install_element (BGP_NODE, &neighbor_prefix_list_cmd);
10562 install_element (BGP_NODE, &no_neighbor_prefix_list_cmd);
10563 install_element (BGP_IPV4_NODE, &neighbor_prefix_list_cmd);
10564 install_element (BGP_IPV4_NODE, &no_neighbor_prefix_list_cmd);
10565 install_element (BGP_IPV4M_NODE, &neighbor_prefix_list_cmd);
10566 install_element (BGP_IPV4M_NODE, &no_neighbor_prefix_list_cmd);
10567 install_element (BGP_IPV6_NODE, &neighbor_prefix_list_cmd);
10568 install_element (BGP_IPV6_NODE, &no_neighbor_prefix_list_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010569 install_element (BGP_IPV6M_NODE, &neighbor_prefix_list_cmd);
10570 install_element (BGP_IPV6M_NODE, &no_neighbor_prefix_list_cmd);
paul718e3742002-12-13 20:15:29 +000010571 install_element (BGP_VPNV4_NODE, &neighbor_prefix_list_cmd);
10572 install_element (BGP_VPNV4_NODE, &no_neighbor_prefix_list_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010573 install_element (BGP_VPNV6_NODE, &neighbor_prefix_list_cmd);
10574 install_element (BGP_VPNV6_NODE, &no_neighbor_prefix_list_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010575 install_element (BGP_ENCAP_NODE, &neighbor_prefix_list_cmd);
10576 install_element (BGP_ENCAP_NODE, &no_neighbor_prefix_list_cmd);
10577 install_element (BGP_ENCAPV6_NODE, &neighbor_prefix_list_cmd);
10578 install_element (BGP_ENCAPV6_NODE, &no_neighbor_prefix_list_cmd);
paul718e3742002-12-13 20:15:29 +000010579
10580 /* "neighbor filter-list" commands. */
10581 install_element (BGP_NODE, &neighbor_filter_list_cmd);
10582 install_element (BGP_NODE, &no_neighbor_filter_list_cmd);
10583 install_element (BGP_IPV4_NODE, &neighbor_filter_list_cmd);
10584 install_element (BGP_IPV4_NODE, &no_neighbor_filter_list_cmd);
10585 install_element (BGP_IPV4M_NODE, &neighbor_filter_list_cmd);
10586 install_element (BGP_IPV4M_NODE, &no_neighbor_filter_list_cmd);
10587 install_element (BGP_IPV6_NODE, &neighbor_filter_list_cmd);
10588 install_element (BGP_IPV6_NODE, &no_neighbor_filter_list_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010589 install_element (BGP_IPV6M_NODE, &neighbor_filter_list_cmd);
10590 install_element (BGP_IPV6M_NODE, &no_neighbor_filter_list_cmd);
paul718e3742002-12-13 20:15:29 +000010591 install_element (BGP_VPNV4_NODE, &neighbor_filter_list_cmd);
10592 install_element (BGP_VPNV4_NODE, &no_neighbor_filter_list_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010593 install_element (BGP_VPNV6_NODE, &neighbor_filter_list_cmd);
10594 install_element (BGP_VPNV6_NODE, &no_neighbor_filter_list_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010595 install_element (BGP_ENCAP_NODE, &neighbor_filter_list_cmd);
10596 install_element (BGP_ENCAP_NODE, &no_neighbor_filter_list_cmd);
10597 install_element (BGP_ENCAPV6_NODE, &neighbor_filter_list_cmd);
10598 install_element (BGP_ENCAPV6_NODE, &no_neighbor_filter_list_cmd);
paul718e3742002-12-13 20:15:29 +000010599
10600 /* "neighbor route-map" commands. */
10601 install_element (BGP_NODE, &neighbor_route_map_cmd);
10602 install_element (BGP_NODE, &no_neighbor_route_map_cmd);
10603 install_element (BGP_IPV4_NODE, &neighbor_route_map_cmd);
10604 install_element (BGP_IPV4_NODE, &no_neighbor_route_map_cmd);
10605 install_element (BGP_IPV4M_NODE, &neighbor_route_map_cmd);
10606 install_element (BGP_IPV4M_NODE, &no_neighbor_route_map_cmd);
10607 install_element (BGP_IPV6_NODE, &neighbor_route_map_cmd);
10608 install_element (BGP_IPV6_NODE, &no_neighbor_route_map_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010609 install_element (BGP_IPV6M_NODE, &neighbor_route_map_cmd);
10610 install_element (BGP_IPV6M_NODE, &no_neighbor_route_map_cmd);
paul718e3742002-12-13 20:15:29 +000010611 install_element (BGP_VPNV4_NODE, &neighbor_route_map_cmd);
10612 install_element (BGP_VPNV4_NODE, &no_neighbor_route_map_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010613 install_element (BGP_VPNV6_NODE, &neighbor_route_map_cmd);
10614 install_element (BGP_VPNV6_NODE, &no_neighbor_route_map_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010615 install_element (BGP_ENCAP_NODE, &neighbor_route_map_cmd);
10616 install_element (BGP_ENCAP_NODE, &no_neighbor_route_map_cmd);
10617 install_element (BGP_ENCAPV6_NODE, &neighbor_route_map_cmd);
10618 install_element (BGP_ENCAPV6_NODE, &no_neighbor_route_map_cmd);
paul718e3742002-12-13 20:15:29 +000010619
10620 /* "neighbor unsuppress-map" commands. */
10621 install_element (BGP_NODE, &neighbor_unsuppress_map_cmd);
10622 install_element (BGP_NODE, &no_neighbor_unsuppress_map_cmd);
10623 install_element (BGP_IPV4_NODE, &neighbor_unsuppress_map_cmd);
10624 install_element (BGP_IPV4_NODE, &no_neighbor_unsuppress_map_cmd);
10625 install_element (BGP_IPV4M_NODE, &neighbor_unsuppress_map_cmd);
10626 install_element (BGP_IPV4M_NODE, &no_neighbor_unsuppress_map_cmd);
10627 install_element (BGP_IPV6_NODE, &neighbor_unsuppress_map_cmd);
10628 install_element (BGP_IPV6_NODE, &no_neighbor_unsuppress_map_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010629 install_element (BGP_IPV6M_NODE, &neighbor_unsuppress_map_cmd);
10630 install_element (BGP_IPV6M_NODE, &no_neighbor_unsuppress_map_cmd);
paula58545b2003-07-12 21:43:01 +000010631 install_element (BGP_VPNV4_NODE, &neighbor_unsuppress_map_cmd);
Lou Berger82dd7072016-01-12 13:41:57 -050010632 install_element (BGP_VPNV4_NODE, &no_neighbor_unsuppress_map_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010633 install_element (BGP_VPNV6_NODE, &neighbor_unsuppress_map_cmd);
Lou Berger82dd7072016-01-12 13:41:57 -050010634 install_element (BGP_VPNV6_NODE, &no_neighbor_unsuppress_map_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010635 install_element (BGP_ENCAP_NODE, &neighbor_unsuppress_map_cmd);
10636 install_element (BGP_ENCAP_NODE, &no_neighbor_unsuppress_map_cmd);
10637 install_element (BGP_ENCAPV6_NODE, &neighbor_unsuppress_map_cmd);
10638 install_element (BGP_ENCAPV6_NODE, &no_neighbor_unsuppress_map_cmd);
paul718e3742002-12-13 20:15:29 +000010639
10640 /* "neighbor maximum-prefix" commands. */
10641 install_element (BGP_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +000010642 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +000010643 install_element (BGP_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +000010644 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +000010645 install_element (BGP_NODE, &neighbor_maximum_prefix_restart_cmd);
10646 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010647 install_element (BGP_NODE, &no_neighbor_maximum_prefix_cmd);
10648 install_element (BGP_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +000010649 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10650 install_element (BGP_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10651 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10652 install_element (BGP_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10653 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010654 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +000010655 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +000010656 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +000010657 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +000010658 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_restart_cmd);
10659 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010660 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_cmd);
10661 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +000010662 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10663 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10664 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10665 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10666 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010667 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +000010668 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +000010669 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +000010670 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +000010671 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_restart_cmd);
10672 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010673 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_cmd);
10674 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +000010675 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10676 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10677 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10678 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10679 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010680 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +000010681 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +000010682 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +000010683 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +000010684 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_restart_cmd);
10685 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010686 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_cmd);
10687 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +000010688 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10689 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10690 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10691 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10692 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010693 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_cmd);
10694 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_cmd);
10695 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_warning_cmd);
10696 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
10697 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_restart_cmd);
10698 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
10699 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_cmd);
10700 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_val_cmd);
10701 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10702 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10703 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10704 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10705 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010706 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +000010707 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +000010708 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +000010709 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +000010710 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_restart_cmd);
10711 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010712 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_cmd);
10713 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +000010714 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10715 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10716 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10717 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10718 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010719
Lou Berger13c378d2016-01-12 13:41:56 -050010720 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_cmd);
10721 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_threshold_cmd);
10722 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_warning_cmd);
10723 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
10724 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_restart_cmd);
10725 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
10726 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_cmd);
10727 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_val_cmd);
10728 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10729 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10730 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10731 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10732 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
10733
Lou Bergera3fda882016-01-12 13:42:04 -050010734 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_cmd);
10735 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_threshold_cmd);
10736 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_warning_cmd);
10737 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
10738 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_restart_cmd);
10739 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
10740 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_cmd);
10741 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_val_cmd);
10742 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10743 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10744 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10745 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10746 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
10747
10748 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_cmd);
10749 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_threshold_cmd);
10750 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_warning_cmd);
10751 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
10752 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_restart_cmd);
10753 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
10754 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_cmd);
10755 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_val_cmd);
10756 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10757 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10758 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10759 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10760 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
10761
paul718e3742002-12-13 20:15:29 +000010762 /* "neighbor allowas-in" */
10763 install_element (BGP_NODE, &neighbor_allowas_in_cmd);
10764 install_element (BGP_NODE, &neighbor_allowas_in_arg_cmd);
10765 install_element (BGP_NODE, &no_neighbor_allowas_in_cmd);
10766 install_element (BGP_IPV4_NODE, &neighbor_allowas_in_cmd);
10767 install_element (BGP_IPV4_NODE, &neighbor_allowas_in_arg_cmd);
10768 install_element (BGP_IPV4_NODE, &no_neighbor_allowas_in_cmd);
10769 install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_cmd);
10770 install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_arg_cmd);
10771 install_element (BGP_IPV4M_NODE, &no_neighbor_allowas_in_cmd);
10772 install_element (BGP_IPV6_NODE, &neighbor_allowas_in_cmd);
10773 install_element (BGP_IPV6_NODE, &neighbor_allowas_in_arg_cmd);
10774 install_element (BGP_IPV6_NODE, &no_neighbor_allowas_in_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010775 install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_cmd);
10776 install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_arg_cmd);
10777 install_element (BGP_IPV6M_NODE, &no_neighbor_allowas_in_cmd);
paul718e3742002-12-13 20:15:29 +000010778 install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_cmd);
10779 install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_arg_cmd);
10780 install_element (BGP_VPNV4_NODE, &no_neighbor_allowas_in_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010781 install_element (BGP_VPNV6_NODE, &neighbor_allowas_in_cmd);
10782 install_element (BGP_VPNV6_NODE, &neighbor_allowas_in_arg_cmd);
10783 install_element (BGP_VPNV6_NODE, &no_neighbor_allowas_in_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010784 install_element (BGP_ENCAP_NODE, &neighbor_allowas_in_cmd);
10785 install_element (BGP_ENCAP_NODE, &neighbor_allowas_in_arg_cmd);
10786 install_element (BGP_ENCAP_NODE, &no_neighbor_allowas_in_cmd);
10787 install_element (BGP_ENCAPV6_NODE, &neighbor_allowas_in_cmd);
10788 install_element (BGP_ENCAPV6_NODE, &neighbor_allowas_in_arg_cmd);
10789 install_element (BGP_ENCAPV6_NODE, &no_neighbor_allowas_in_cmd);
paul718e3742002-12-13 20:15:29 +000010790
10791 /* address-family commands. */
10792 install_element (BGP_NODE, &address_family_ipv4_cmd);
10793 install_element (BGP_NODE, &address_family_ipv4_safi_cmd);
paul718e3742002-12-13 20:15:29 +000010794 install_element (BGP_NODE, &address_family_ipv6_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010795 install_element (BGP_NODE, &address_family_ipv6_safi_cmd);
paul718e3742002-12-13 20:15:29 +000010796 install_element (BGP_NODE, &address_family_vpnv4_cmd);
10797 install_element (BGP_NODE, &address_family_vpnv4_unicast_cmd);
10798
Lou Berger13c378d2016-01-12 13:41:56 -050010799 install_element (BGP_NODE, &address_family_vpnv6_cmd);
10800 install_element (BGP_NODE, &address_family_vpnv6_unicast_cmd);
10801
Lou Bergera3fda882016-01-12 13:42:04 -050010802 install_element (BGP_NODE, &address_family_encap_cmd);
10803 install_element (BGP_NODE, &address_family_encapv4_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010804 install_element (BGP_NODE, &address_family_encapv6_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010805
paul718e3742002-12-13 20:15:29 +000010806 /* "exit-address-family" command. */
10807 install_element (BGP_IPV4_NODE, &exit_address_family_cmd);
10808 install_element (BGP_IPV4M_NODE, &exit_address_family_cmd);
10809 install_element (BGP_IPV6_NODE, &exit_address_family_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010810 install_element (BGP_IPV6M_NODE, &exit_address_family_cmd);
paul718e3742002-12-13 20:15:29 +000010811 install_element (BGP_VPNV4_NODE, &exit_address_family_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010812 install_element (BGP_VPNV6_NODE, &exit_address_family_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010813 install_element (BGP_ENCAP_NODE, &exit_address_family_cmd);
10814 install_element (BGP_ENCAPV6_NODE, &exit_address_family_cmd);
paul718e3742002-12-13 20:15:29 +000010815
10816 /* "clear ip bgp commands" */
10817 install_element (ENABLE_NODE, &clear_ip_bgp_all_cmd);
10818 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_cmd);
10819 install_element (ENABLE_NODE, &clear_ip_bgp_as_cmd);
10820 install_element (ENABLE_NODE, &clear_ip_bgp_peer_cmd);
10821 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_cmd);
10822 install_element (ENABLE_NODE, &clear_ip_bgp_external_cmd);
paul718e3742002-12-13 20:15:29 +000010823 install_element (ENABLE_NODE, &clear_bgp_all_cmd);
10824 install_element (ENABLE_NODE, &clear_bgp_instance_all_cmd);
10825 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_cmd);
10826 install_element (ENABLE_NODE, &clear_bgp_peer_cmd);
10827 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_cmd);
10828 install_element (ENABLE_NODE, &clear_bgp_peer_group_cmd);
10829 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_cmd);
10830 install_element (ENABLE_NODE, &clear_bgp_external_cmd);
10831 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_cmd);
10832 install_element (ENABLE_NODE, &clear_bgp_as_cmd);
10833 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_cmd);
paul718e3742002-12-13 20:15:29 +000010834
10835 /* "clear ip bgp neighbor soft in" */
10836 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_in_cmd);
10837 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_in_cmd);
10838 install_element (ENABLE_NODE, &clear_ip_bgp_all_in_cmd);
10839 install_element (ENABLE_NODE, &clear_ip_bgp_all_in_prefix_filter_cmd);
10840 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_in_prefix_filter_cmd);
10841 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_in_cmd);
10842 install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_cmd);
10843 install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_prefix_filter_cmd);
10844 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_in_cmd);
10845 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_cmd);
10846 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_prefix_filter_cmd);
10847 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_in_cmd);
10848 install_element (ENABLE_NODE, &clear_ip_bgp_external_in_cmd);
10849 install_element (ENABLE_NODE, &clear_ip_bgp_external_in_prefix_filter_cmd);
10850 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_in_cmd);
10851 install_element (ENABLE_NODE, &clear_ip_bgp_as_in_cmd);
10852 install_element (ENABLE_NODE, &clear_ip_bgp_as_in_prefix_filter_cmd);
10853 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_in_cmd);
10854 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_in_cmd);
10855 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_cmd);
10856 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_prefix_filter_cmd);
10857 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd);
10858 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_in_cmd);
10859 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_cmd);
10860 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd);
10861 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_in_cmd);
10862 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_cmd);
10863 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd);
10864 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_in_cmd);
10865 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_cmd);
10866 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_prefix_filter_cmd);
10867 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_in_cmd);
10868 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_cmd);
10869 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_prefix_filter_cmd);
10870 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_in_cmd);
10871 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_in_cmd);
10872 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_in_cmd);
10873 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_in_cmd);
10874 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_in_cmd);
10875 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_in_cmd);
Lou Berger298cc2f2016-01-12 13:42:02 -050010876 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_soft_in_cmd);
10877 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_in_cmd);
10878 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_soft_in_cmd);
10879 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_in_cmd);
10880 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_soft_in_cmd);
10881 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_in_cmd);
paul718e3742002-12-13 20:15:29 +000010882 install_element (ENABLE_NODE, &clear_bgp_all_soft_in_cmd);
10883 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_in_cmd);
10884 install_element (ENABLE_NODE, &clear_bgp_all_in_cmd);
10885 install_element (ENABLE_NODE, &clear_bgp_all_in_prefix_filter_cmd);
10886 install_element (ENABLE_NODE, &clear_bgp_peer_soft_in_cmd);
10887 install_element (ENABLE_NODE, &clear_bgp_peer_in_cmd);
10888 install_element (ENABLE_NODE, &clear_bgp_peer_in_prefix_filter_cmd);
10889 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_in_cmd);
10890 install_element (ENABLE_NODE, &clear_bgp_peer_group_in_cmd);
10891 install_element (ENABLE_NODE, &clear_bgp_peer_group_in_prefix_filter_cmd);
10892 install_element (ENABLE_NODE, &clear_bgp_external_soft_in_cmd);
10893 install_element (ENABLE_NODE, &clear_bgp_external_in_cmd);
10894 install_element (ENABLE_NODE, &clear_bgp_external_in_prefix_filter_cmd);
10895 install_element (ENABLE_NODE, &clear_bgp_as_soft_in_cmd);
10896 install_element (ENABLE_NODE, &clear_bgp_as_in_cmd);
10897 install_element (ENABLE_NODE, &clear_bgp_as_in_prefix_filter_cmd);
10898 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_in_cmd);
10899 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_cmd);
10900 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_prefix_filter_cmd);
10901 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_in_cmd);
10902 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_cmd);
10903 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_prefix_filter_cmd);
10904 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_in_cmd);
10905 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_cmd);
10906 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_prefix_filter_cmd);
10907 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_in_cmd);
10908 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_cmd);
10909 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_prefix_filter_cmd);
10910 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_in_cmd);
10911 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_cmd);
10912 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_prefix_filter_cmd);
paul718e3742002-12-13 20:15:29 +000010913
10914 /* "clear ip bgp neighbor soft out" */
10915 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_out_cmd);
10916 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_out_cmd);
10917 install_element (ENABLE_NODE, &clear_ip_bgp_all_out_cmd);
10918 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_out_cmd);
10919 install_element (ENABLE_NODE, &clear_ip_bgp_peer_out_cmd);
10920 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_out_cmd);
10921 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_out_cmd);
10922 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_out_cmd);
10923 install_element (ENABLE_NODE, &clear_ip_bgp_external_out_cmd);
10924 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_out_cmd);
10925 install_element (ENABLE_NODE, &clear_ip_bgp_as_out_cmd);
10926 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_out_cmd);
10927 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_out_cmd);
10928 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_out_cmd);
10929 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_out_cmd);
10930 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_out_cmd);
10931 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_out_cmd);
10932 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_out_cmd);
10933 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_out_cmd);
10934 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_out_cmd);
10935 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_out_cmd);
10936 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_out_cmd);
10937 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_out_cmd);
10938 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_out_cmd);
10939 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_out_cmd);
10940 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_out_cmd);
10941 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_out_cmd);
10942 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_out_cmd);
Lou Berger298cc2f2016-01-12 13:42:02 -050010943 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_soft_out_cmd);
10944 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_out_cmd);
10945 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_soft_out_cmd);
10946 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_out_cmd);
10947 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_soft_out_cmd);
10948 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_out_cmd);
paul718e3742002-12-13 20:15:29 +000010949 install_element (ENABLE_NODE, &clear_bgp_all_soft_out_cmd);
10950 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_out_cmd);
10951 install_element (ENABLE_NODE, &clear_bgp_all_out_cmd);
10952 install_element (ENABLE_NODE, &clear_bgp_peer_soft_out_cmd);
10953 install_element (ENABLE_NODE, &clear_bgp_peer_out_cmd);
10954 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_out_cmd);
10955 install_element (ENABLE_NODE, &clear_bgp_peer_group_out_cmd);
10956 install_element (ENABLE_NODE, &clear_bgp_external_soft_out_cmd);
10957 install_element (ENABLE_NODE, &clear_bgp_external_out_cmd);
10958 install_element (ENABLE_NODE, &clear_bgp_as_soft_out_cmd);
10959 install_element (ENABLE_NODE, &clear_bgp_as_out_cmd);
10960 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_out_cmd);
10961 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_out_cmd);
10962 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_out_cmd);
10963 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_out_cmd);
10964 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_out_cmd);
10965 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_out_cmd);
10966 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_out_cmd);
10967 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_out_cmd);
10968 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_out_cmd);
10969 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_out_cmd);
paul718e3742002-12-13 20:15:29 +000010970
10971 /* "clear ip bgp neighbor soft" */
10972 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_cmd);
10973 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_cmd);
10974 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_cmd);
10975 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_cmd);
10976 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_cmd);
10977 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_cmd);
10978 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_cmd);
10979 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_cmd);
10980 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_cmd);
10981 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_cmd);
10982 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_cmd);
10983 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_cmd);
10984 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_cmd);
10985 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_cmd);
10986 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_cmd);
Lou Berger298cc2f2016-01-12 13:42:02 -050010987 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_soft_cmd);
10988 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_soft_cmd);
10989 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_soft_cmd);
paul718e3742002-12-13 20:15:29 +000010990 install_element (ENABLE_NODE, &clear_bgp_all_soft_cmd);
10991 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_cmd);
10992 install_element (ENABLE_NODE, &clear_bgp_peer_soft_cmd);
10993 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_cmd);
10994 install_element (ENABLE_NODE, &clear_bgp_external_soft_cmd);
10995 install_element (ENABLE_NODE, &clear_bgp_as_soft_cmd);
10996 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_cmd);
10997 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_cmd);
10998 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_cmd);
10999 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_cmd);
11000 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_cmd);
paul718e3742002-12-13 20:15:29 +000011001
paulfee0f4c2004-09-13 05:12:46 +000011002 /* "clear ip bgp neighbor rsclient" */
11003 install_element (ENABLE_NODE, &clear_ip_bgp_all_rsclient_cmd);
11004 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_rsclient_cmd);
11005 install_element (ENABLE_NODE, &clear_ip_bgp_peer_rsclient_cmd);
11006 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_rsclient_cmd);
paulfee0f4c2004-09-13 05:12:46 +000011007 install_element (ENABLE_NODE, &clear_bgp_all_rsclient_cmd);
11008 install_element (ENABLE_NODE, &clear_bgp_instance_all_rsclient_cmd);
11009 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_rsclient_cmd);
11010 install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_all_rsclient_cmd);
11011 install_element (ENABLE_NODE, &clear_bgp_peer_rsclient_cmd);
11012 install_element (ENABLE_NODE, &clear_bgp_instance_peer_rsclient_cmd);
11013 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_rsclient_cmd);
11014 install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_peer_rsclient_cmd);
paulfee0f4c2004-09-13 05:12:46 +000011015
paul718e3742002-12-13 20:15:29 +000011016 /* "show ip bgp summary" commands. */
paul718e3742002-12-13 20:15:29 +000011017 install_element (VIEW_NODE, &show_bgp_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011018 install_element (RESTRICTED_NODE, &show_bgp_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011019
11020 install_element (VIEW_NODE, &show_bgp_summary_1w_cmd);
11021 install_element (RESTRICTED_NODE, &show_bgp_summary_1w_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011022
11023 install_element (VIEW_NODE, &show_bgp_ipv4_safi_summary_cmd);
11024 install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_summary_cmd);
11025 install_element (VIEW_NODE, &show_bgp_instance_ipv4_summary_cmd);
11026
11027 install_element (VIEW_NODE, &show_bgp_ipv4_vpn_summary_cmd);
11028 install_element (VIEW_NODE, &show_bgp_ipv4_encap_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011029 install_element (VIEW_NODE, &show_bgp_ipv6_vpn_summary_cmd);
11030 install_element (VIEW_NODE, &show_bgp_ipv6_encap_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011031
paul718e3742002-12-13 20:15:29 +000011032 install_element (VIEW_NODE, &show_bgp_instance_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040011033 install_element (VIEW_NODE, &show_bgp_ipv6_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000011034 install_element (VIEW_NODE, &show_bgp_instance_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040011035 install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_summary_cmd);
Donald Sharp68b45cc2016-03-11 14:27:13 -050011036
Michael Lambert95cbbd22010-07-23 14:43:04 -040011037 install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011038 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040011039 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011040
11041 install_element (RESTRICTED_NODE, &show_bgp_ipv4_vpn_summary_cmd);
11042 install_element (RESTRICTED_NODE, &show_bgp_ipv4_encap_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011043 install_element (RESTRICTED_NODE, &show_bgp_ipv6_vpn_summary_cmd);
11044 install_element (RESTRICTED_NODE, &show_bgp_ipv6_encap_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011045
Paul Jakma62687ff2008-08-23 14:27:06 +010011046 install_element (RESTRICTED_NODE, &show_bgp_instance_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040011047 install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010011048 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040011049 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000011050
11051 /* "show ip bgp neighbors" commands. */
paulbb46e942003-10-24 19:02:03 +000011052 install_element (VIEW_NODE, &show_bgp_instance_neighbors_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011053
11054 install_element (VIEW_NODE, &show_bgp_neighbors_cmd);
11055 install_element (VIEW_NODE, &show_bgp_neighbors_peer_cmd);
11056 install_element (VIEW_NODE, &show_bgp_instance_neighbors_peer_cmd);
11057 install_element (RESTRICTED_NODE, &show_bgp_neighbors_peer_cmd);
11058 install_element (RESTRICTED_NODE, &show_bgp_instance_neighbors_peer_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011059 install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_cmd);
11060 install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
11061 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
paul718e3742002-12-13 20:15:29 +000011062
paulfee0f4c2004-09-13 05:12:46 +000011063 /* "show ip bgp rsclient" commands. */
Michael Lambert95cbbd22010-07-23 14:43:04 -040011064 install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd);
11065 install_element (VIEW_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040011066 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd);
11067 install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000011068
paulfee0f4c2004-09-13 05:12:46 +000011069 install_element (VIEW_NODE, &show_bgp_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000011070 install_element (VIEW_NODE, &show_bgp_instance_rsclient_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011071 install_element (RESTRICTED_NODE, &show_bgp_rsclient_summary_cmd);
11072 install_element (RESTRICTED_NODE, &show_bgp_instance_rsclient_summary_cmd);
Donald Sharp68b45cc2016-03-11 14:27:13 -050011073
Lou Berger651b4022016-01-12 13:42:07 -050011074 install_element (VIEW_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000011075 install_element (VIEW_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040011076 install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd);
11077 install_element (VIEW_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010011078 install_element (RESTRICTED_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010011079 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040011080 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd);
11081 install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000011082
paul718e3742002-12-13 20:15:29 +000011083 /* "show ip bgp paths" commands. */
Lou Berger651b4022016-01-12 13:42:07 -050011084 install_element (VIEW_NODE, &show_bgp_ipv4_paths_cmd);
paul718e3742002-12-13 20:15:29 +000011085
11086 /* "show ip bgp community" commands. */
11087 install_element (VIEW_NODE, &show_ip_bgp_community_info_cmd);
paul718e3742002-12-13 20:15:29 +000011088
11089 /* "show ip bgp attribute-info" commands. */
11090 install_element (VIEW_NODE, &show_ip_bgp_attr_info_cmd);
paul718e3742002-12-13 20:15:29 +000011091
11092 /* "redistribute" commands. */
11093 install_element (BGP_NODE, &bgp_redistribute_ipv4_cmd);
11094 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_cmd);
11095 install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_cmd);
11096 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_cmd);
11097 install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_cmd);
11098 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_cmd);
11099 install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_metric_cmd);
11100 install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_rmap_cmd);
11101 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_metric_cmd);
11102 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_rmap_cmd);
paul718e3742002-12-13 20:15:29 +000011103 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_cmd);
11104 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_cmd);
11105 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_cmd);
11106 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_cmd);
11107 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_cmd);
11108 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_cmd);
11109 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_metric_cmd);
11110 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_rmap_cmd);
11111 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_metric_cmd);
11112 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_rmap_cmd);
paul718e3742002-12-13 20:15:29 +000011113
Nick Hilliardfa411a22011-03-23 15:33:17 +000011114 /* ttl_security commands */
11115 install_element (BGP_NODE, &neighbor_ttl_security_cmd);
11116 install_element (BGP_NODE, &no_neighbor_ttl_security_cmd);
11117
Paul Jakma4bf6a362006-03-30 14:05:23 +000011118 /* "show bgp memory" commands. */
11119 install_element (VIEW_NODE, &show_bgp_memory_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010011120 install_element (RESTRICTED_NODE, &show_bgp_memory_cmd);
Paul Jakma4bf6a362006-03-30 14:05:23 +000011121
Michael Lamberte0081f72008-11-16 20:12:04 +000011122 /* "show bgp views" commands. */
11123 install_element (VIEW_NODE, &show_bgp_views_cmd);
11124 install_element (RESTRICTED_NODE, &show_bgp_views_cmd);
Donald Sharp68b45cc2016-03-11 14:27:13 -050011125
Lou Bergerf9b6c392016-01-12 13:42:09 -050011126 /* non afi/safi forms of commands */
11127 install_element (VIEW_NODE, &show_ip_bgp_summary_cmd);
11128 install_element (VIEW_NODE, &show_ip_bgp_instance_summary_cmd);
11129 install_element (VIEW_NODE, &show_ip_bgp_ipv4_summary_cmd);
11130 install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
11131 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
11132 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
11133 install_element (VIEW_NODE, &show_bgp_ipv6_summary_cmd);
11134 install_element (RESTRICTED_NODE, &show_ip_bgp_summary_cmd);
11135 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_summary_cmd);
11136 install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_summary_cmd);
11137 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
11138 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
11139 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
11140 install_element (RESTRICTED_NODE, &show_bgp_ipv6_summary_cmd);
Lou Bergerf9b6c392016-01-12 13:42:09 -050011141 install_element (VIEW_NODE, &show_ip_bgp_neighbors_cmd);
11142 install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_cmd);
11143 install_element (VIEW_NODE, &show_ip_bgp_neighbors_peer_cmd);
11144 install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
11145 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd);
11146 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd);
11147 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
11148 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
11149 install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_cmd);
11150 install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
11151 install_element (RESTRICTED_NODE, &show_ip_bgp_neighbors_peer_cmd);
11152 install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
11153 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
11154 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
11155 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
Lou Bergerf9b6c392016-01-12 13:42:09 -050011156 install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_cmd);
11157 install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
11158 install_element (RESTRICTED_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
Lou Bergerf9b6c392016-01-12 13:42:09 -050011159 install_element (VIEW_NODE, &show_ipv6_bgp_summary_cmd);
11160 install_element (VIEW_NODE, &show_ipv6_mbgp_summary_cmd);
Lou Bergerf9b6c392016-01-12 13:42:09 -050011161 install_element (VIEW_NODE, &show_ip_bgp_rsclient_summary_cmd);
11162 install_element (VIEW_NODE, &show_ip_bgp_instance_rsclient_summary_cmd);
11163 install_element (VIEW_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd);
11164 install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd);
11165 install_element (RESTRICTED_NODE, &show_ip_bgp_rsclient_summary_cmd);
11166 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_rsclient_summary_cmd);
11167 install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd);
11168 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd);
Lou Bergerf9b6c392016-01-12 13:42:09 -050011169 install_element (VIEW_NODE, &show_ip_bgp_paths_cmd);
11170 install_element (VIEW_NODE, &show_ip_bgp_ipv4_paths_cmd);
paul718e3742002-12-13 20:15:29 +000011171 /* Community-list. */
11172 community_list_vty ();
11173}
David Lamparter6b0655a2014-06-04 06:53:35 +020011174
paul718e3742002-12-13 20:15:29 +000011175#include "memory.h"
11176#include "bgp_regex.h"
11177#include "bgp_clist.h"
11178#include "bgp_ecommunity.h"
11179
11180/* VTY functions. */
11181
11182/* Direction value to string conversion. */
paul94f2b392005-06-28 12:44:16 +000011183static const char *
paul718e3742002-12-13 20:15:29 +000011184community_direct_str (int direct)
11185{
11186 switch (direct)
11187 {
11188 case COMMUNITY_DENY:
11189 return "deny";
paul718e3742002-12-13 20:15:29 +000011190 case COMMUNITY_PERMIT:
11191 return "permit";
paul718e3742002-12-13 20:15:29 +000011192 default:
11193 return "unknown";
paul718e3742002-12-13 20:15:29 +000011194 }
11195}
11196
11197/* Display error string. */
paul94f2b392005-06-28 12:44:16 +000011198static void
paul718e3742002-12-13 20:15:29 +000011199community_list_perror (struct vty *vty, int ret)
11200{
11201 switch (ret)
11202 {
11203 case COMMUNITY_LIST_ERR_CANT_FIND_LIST:
Denis Ovsienkob7292942010-12-08 18:51:37 +030011204 vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000011205 break;
11206 case COMMUNITY_LIST_ERR_MALFORMED_VAL:
11207 vty_out (vty, "%% Malformed community-list value%s", VTY_NEWLINE);
11208 break;
11209 case COMMUNITY_LIST_ERR_STANDARD_CONFLICT:
11210 vty_out (vty, "%% Community name conflict, previously defined as standard community%s", VTY_NEWLINE);
11211 break;
11212 case COMMUNITY_LIST_ERR_EXPANDED_CONFLICT:
11213 vty_out (vty, "%% Community name conflict, previously defined as expanded community%s", VTY_NEWLINE);
11214 break;
11215 }
11216}
11217
11218/* VTY interface for community_set() function. */
paul94f2b392005-06-28 12:44:16 +000011219static int
paulfd79ac92004-10-13 05:06:08 +000011220community_list_set_vty (struct vty *vty, int argc, const char **argv,
11221 int style, int reject_all_digit_name)
paul718e3742002-12-13 20:15:29 +000011222{
11223 int ret;
11224 int direct;
11225 char *str;
11226
11227 /* Check the list type. */
11228 if (strncmp (argv[1], "p", 1) == 0)
11229 direct = COMMUNITY_PERMIT;
11230 else if (strncmp (argv[1], "d", 1) == 0)
11231 direct = COMMUNITY_DENY;
11232 else
11233 {
11234 vty_out (vty, "%% Matching condition must be permit or deny%s",
11235 VTY_NEWLINE);
11236 return CMD_WARNING;
11237 }
11238
11239 /* All digit name check. */
11240 if (reject_all_digit_name && all_digit (argv[0]))
11241 {
11242 vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE);
11243 return CMD_WARNING;
11244 }
11245
11246 /* Concat community string argument. */
11247 if (argc > 1)
11248 str = argv_concat (argv, argc, 2);
11249 else
11250 str = NULL;
11251
11252 /* When community_list_set() return nevetive value, it means
11253 malformed community string. */
11254 ret = community_list_set (bgp_clist, argv[0], str, direct, style);
11255
11256 /* Free temporary community list string allocated by
11257 argv_concat(). */
11258 if (str)
11259 XFREE (MTYPE_TMP, str);
11260
11261 if (ret < 0)
11262 {
11263 /* Display error string. */
11264 community_list_perror (vty, ret);
11265 return CMD_WARNING;
11266 }
11267
11268 return CMD_SUCCESS;
11269}
11270
paul718e3742002-12-13 20:15:29 +000011271/* Communiyt-list entry delete. */
paul94f2b392005-06-28 12:44:16 +000011272static int
hassofee6e4e2005-02-02 16:29:31 +000011273community_list_unset_vty (struct vty *vty, int argc, const char **argv,
11274 int style)
paul718e3742002-12-13 20:15:29 +000011275{
11276 int ret;
hassofee6e4e2005-02-02 16:29:31 +000011277 int direct = 0;
11278 char *str = NULL;
paul718e3742002-12-13 20:15:29 +000011279
hassofee6e4e2005-02-02 16:29:31 +000011280 if (argc > 1)
paul718e3742002-12-13 20:15:29 +000011281 {
hassofee6e4e2005-02-02 16:29:31 +000011282 /* Check the list direct. */
11283 if (strncmp (argv[1], "p", 1) == 0)
11284 direct = COMMUNITY_PERMIT;
11285 else if (strncmp (argv[1], "d", 1) == 0)
11286 direct = COMMUNITY_DENY;
11287 else
11288 {
11289 vty_out (vty, "%% Matching condition must be permit or deny%s",
11290 VTY_NEWLINE);
11291 return CMD_WARNING;
11292 }
paul718e3742002-12-13 20:15:29 +000011293
hassofee6e4e2005-02-02 16:29:31 +000011294 /* Concat community string argument. */
11295 str = argv_concat (argv, argc, 2);
11296 }
paul718e3742002-12-13 20:15:29 +000011297
11298 /* Unset community list. */
11299 ret = community_list_unset (bgp_clist, argv[0], str, direct, style);
11300
11301 /* Free temporary community list string allocated by
11302 argv_concat(). */
hassofee6e4e2005-02-02 16:29:31 +000011303 if (str)
11304 XFREE (MTYPE_TMP, str);
paul718e3742002-12-13 20:15:29 +000011305
11306 if (ret < 0)
11307 {
11308 community_list_perror (vty, ret);
11309 return CMD_WARNING;
11310 }
11311
11312 return CMD_SUCCESS;
11313}
11314
11315/* "community-list" keyword help string. */
11316#define COMMUNITY_LIST_STR "Add a community list entry\n"
11317#define COMMUNITY_VAL_STR "Community number in aa:nn format or internet|local-AS|no-advertise|no-export\n"
11318
paul718e3742002-12-13 20:15:29 +000011319DEFUN (ip_community_list_standard,
11320 ip_community_list_standard_cmd,
11321 "ip community-list <1-99> (deny|permit) .AA:NN",
11322 IP_STR
11323 COMMUNITY_LIST_STR
11324 "Community list number (standard)\n"
11325 "Specify community to reject\n"
11326 "Specify community to accept\n"
11327 COMMUNITY_VAL_STR)
11328{
11329 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0);
11330}
11331
11332ALIAS (ip_community_list_standard,
11333 ip_community_list_standard2_cmd,
11334 "ip community-list <1-99> (deny|permit)",
11335 IP_STR
11336 COMMUNITY_LIST_STR
11337 "Community list number (standard)\n"
11338 "Specify community to reject\n"
11339 "Specify community to accept\n")
11340
11341DEFUN (ip_community_list_expanded,
11342 ip_community_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000011343 "ip community-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000011344 IP_STR
11345 COMMUNITY_LIST_STR
11346 "Community list number (expanded)\n"
11347 "Specify community to reject\n"
11348 "Specify community to accept\n"
11349 "An ordered list as a regular-expression\n")
11350{
11351 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0);
11352}
11353
11354DEFUN (ip_community_list_name_standard,
11355 ip_community_list_name_standard_cmd,
11356 "ip community-list standard WORD (deny|permit) .AA:NN",
11357 IP_STR
11358 COMMUNITY_LIST_STR
11359 "Add a standard community-list entry\n"
11360 "Community list name\n"
11361 "Specify community to reject\n"
11362 "Specify community to accept\n"
11363 COMMUNITY_VAL_STR)
11364{
11365 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1);
11366}
11367
11368ALIAS (ip_community_list_name_standard,
11369 ip_community_list_name_standard2_cmd,
11370 "ip community-list standard WORD (deny|permit)",
11371 IP_STR
11372 COMMUNITY_LIST_STR
11373 "Add a standard community-list entry\n"
11374 "Community list name\n"
11375 "Specify community to reject\n"
11376 "Specify community to accept\n")
11377
11378DEFUN (ip_community_list_name_expanded,
11379 ip_community_list_name_expanded_cmd,
11380 "ip community-list expanded WORD (deny|permit) .LINE",
11381 IP_STR
11382 COMMUNITY_LIST_STR
11383 "Add an expanded community-list entry\n"
11384 "Community list name\n"
11385 "Specify community to reject\n"
11386 "Specify community to accept\n"
11387 "An ordered list as a regular-expression\n")
11388{
11389 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1);
11390}
11391
hassofee6e4e2005-02-02 16:29:31 +000011392DEFUN (no_ip_community_list_standard_all,
11393 no_ip_community_list_standard_all_cmd,
11394 "no ip community-list <1-99>",
paul718e3742002-12-13 20:15:29 +000011395 NO_STR
11396 IP_STR
11397 COMMUNITY_LIST_STR
hassofee6e4e2005-02-02 16:29:31 +000011398 "Community list number (standard)\n")
paul718e3742002-12-13 20:15:29 +000011399{
hassofee6e4e2005-02-02 16:29:31 +000011400 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
paul718e3742002-12-13 20:15:29 +000011401}
11402
hassofee6e4e2005-02-02 16:29:31 +000011403DEFUN (no_ip_community_list_expanded_all,
11404 no_ip_community_list_expanded_all_cmd,
11405 "no ip community-list <100-500>",
11406 NO_STR
11407 IP_STR
11408 COMMUNITY_LIST_STR
11409 "Community list number (expanded)\n")
11410{
11411 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
11412}
11413
11414DEFUN (no_ip_community_list_name_standard_all,
11415 no_ip_community_list_name_standard_all_cmd,
11416 "no ip community-list standard WORD",
paul718e3742002-12-13 20:15:29 +000011417 NO_STR
11418 IP_STR
11419 COMMUNITY_LIST_STR
11420 "Add a standard community-list entry\n"
paul718e3742002-12-13 20:15:29 +000011421 "Community list name\n")
11422{
hassofee6e4e2005-02-02 16:29:31 +000011423 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
paul718e3742002-12-13 20:15:29 +000011424}
11425
hassofee6e4e2005-02-02 16:29:31 +000011426DEFUN (no_ip_community_list_name_expanded_all,
11427 no_ip_community_list_name_expanded_all_cmd,
11428 "no ip community-list expanded WORD",
paul718e3742002-12-13 20:15:29 +000011429 NO_STR
11430 IP_STR
11431 COMMUNITY_LIST_STR
hassofee6e4e2005-02-02 16:29:31 +000011432 "Add an expanded community-list entry\n"
11433 "Community list name\n")
paul718e3742002-12-13 20:15:29 +000011434{
hassofee6e4e2005-02-02 16:29:31 +000011435 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
paul718e3742002-12-13 20:15:29 +000011436}
11437
11438DEFUN (no_ip_community_list_standard,
11439 no_ip_community_list_standard_cmd,
11440 "no ip community-list <1-99> (deny|permit) .AA:NN",
11441 NO_STR
11442 IP_STR
11443 COMMUNITY_LIST_STR
11444 "Community list number (standard)\n"
11445 "Specify community to reject\n"
11446 "Specify community to accept\n"
11447 COMMUNITY_VAL_STR)
11448{
11449 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
11450}
11451
11452DEFUN (no_ip_community_list_expanded,
11453 no_ip_community_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000011454 "no ip community-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000011455 NO_STR
11456 IP_STR
11457 COMMUNITY_LIST_STR
11458 "Community list number (expanded)\n"
11459 "Specify community to reject\n"
11460 "Specify community to accept\n"
11461 "An ordered list as a regular-expression\n")
11462{
11463 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
11464}
11465
11466DEFUN (no_ip_community_list_name_standard,
11467 no_ip_community_list_name_standard_cmd,
11468 "no ip community-list standard WORD (deny|permit) .AA:NN",
11469 NO_STR
11470 IP_STR
11471 COMMUNITY_LIST_STR
11472 "Specify a standard community-list\n"
11473 "Community list name\n"
11474 "Specify community to reject\n"
11475 "Specify community to accept\n"
11476 COMMUNITY_VAL_STR)
11477{
11478 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
11479}
11480
11481DEFUN (no_ip_community_list_name_expanded,
11482 no_ip_community_list_name_expanded_cmd,
11483 "no ip community-list expanded WORD (deny|permit) .LINE",
11484 NO_STR
11485 IP_STR
11486 COMMUNITY_LIST_STR
11487 "Specify an expanded community-list\n"
11488 "Community list name\n"
11489 "Specify community to reject\n"
11490 "Specify community to accept\n"
11491 "An ordered list as a regular-expression\n")
11492{
11493 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
11494}
11495
paul94f2b392005-06-28 12:44:16 +000011496static void
paul718e3742002-12-13 20:15:29 +000011497community_list_show (struct vty *vty, struct community_list *list)
11498{
11499 struct community_entry *entry;
11500
11501 for (entry = list->head; entry; entry = entry->next)
11502 {
11503 if (entry == list->head)
11504 {
11505 if (all_digit (list->name))
11506 vty_out (vty, "Community %s list %s%s",
11507 entry->style == COMMUNITY_LIST_STANDARD ?
11508 "standard" : "(expanded) access",
11509 list->name, VTY_NEWLINE);
11510 else
11511 vty_out (vty, "Named Community %s list %s%s",
11512 entry->style == COMMUNITY_LIST_STANDARD ?
11513 "standard" : "expanded",
11514 list->name, VTY_NEWLINE);
11515 }
11516 if (entry->any)
11517 vty_out (vty, " %s%s",
11518 community_direct_str (entry->direct), VTY_NEWLINE);
11519 else
11520 vty_out (vty, " %s %s%s",
11521 community_direct_str (entry->direct),
11522 entry->style == COMMUNITY_LIST_STANDARD
11523 ? community_str (entry->u.com) : entry->config,
11524 VTY_NEWLINE);
11525 }
11526}
11527
11528DEFUN (show_ip_community_list,
11529 show_ip_community_list_cmd,
11530 "show ip community-list",
11531 SHOW_STR
11532 IP_STR
11533 "List community-list\n")
11534{
11535 struct community_list *list;
11536 struct community_list_master *cm;
11537
hassofee6e4e2005-02-02 16:29:31 +000011538 cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011539 if (! cm)
11540 return CMD_SUCCESS;
11541
11542 for (list = cm->num.head; list; list = list->next)
11543 community_list_show (vty, list);
11544
11545 for (list = cm->str.head; list; list = list->next)
11546 community_list_show (vty, list);
11547
11548 return CMD_SUCCESS;
11549}
11550
11551DEFUN (show_ip_community_list_arg,
11552 show_ip_community_list_arg_cmd,
hassofee6e4e2005-02-02 16:29:31 +000011553 "show ip community-list (<1-500>|WORD)",
paul718e3742002-12-13 20:15:29 +000011554 SHOW_STR
11555 IP_STR
11556 "List community-list\n"
11557 "Community-list number\n"
11558 "Community-list name\n")
11559{
11560 struct community_list *list;
11561
hassofee6e4e2005-02-02 16:29:31 +000011562 list = community_list_lookup (bgp_clist, argv[0], COMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011563 if (! list)
11564 {
Denis Ovsienkob7292942010-12-08 18:51:37 +030011565 vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000011566 return CMD_WARNING;
11567 }
11568
11569 community_list_show (vty, list);
11570
11571 return CMD_SUCCESS;
11572}
David Lamparter6b0655a2014-06-04 06:53:35 +020011573
paul94f2b392005-06-28 12:44:16 +000011574static int
paulfd79ac92004-10-13 05:06:08 +000011575extcommunity_list_set_vty (struct vty *vty, int argc, const char **argv,
11576 int style, int reject_all_digit_name)
paul718e3742002-12-13 20:15:29 +000011577{
11578 int ret;
11579 int direct;
11580 char *str;
11581
11582 /* Check the list type. */
11583 if (strncmp (argv[1], "p", 1) == 0)
11584 direct = COMMUNITY_PERMIT;
11585 else if (strncmp (argv[1], "d", 1) == 0)
11586 direct = COMMUNITY_DENY;
11587 else
11588 {
11589 vty_out (vty, "%% Matching condition must be permit or deny%s",
11590 VTY_NEWLINE);
11591 return CMD_WARNING;
11592 }
11593
11594 /* All digit name check. */
11595 if (reject_all_digit_name && all_digit (argv[0]))
11596 {
11597 vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE);
11598 return CMD_WARNING;
11599 }
11600
11601 /* Concat community string argument. */
11602 if (argc > 1)
11603 str = argv_concat (argv, argc, 2);
11604 else
11605 str = NULL;
11606
11607 ret = extcommunity_list_set (bgp_clist, argv[0], str, direct, style);
11608
11609 /* Free temporary community list string allocated by
11610 argv_concat(). */
11611 if (str)
11612 XFREE (MTYPE_TMP, str);
11613
11614 if (ret < 0)
11615 {
11616 community_list_perror (vty, ret);
11617 return CMD_WARNING;
11618 }
11619 return CMD_SUCCESS;
11620}
11621
paul94f2b392005-06-28 12:44:16 +000011622static int
hassofee6e4e2005-02-02 16:29:31 +000011623extcommunity_list_unset_vty (struct vty *vty, int argc, const char **argv,
11624 int style)
paul718e3742002-12-13 20:15:29 +000011625{
11626 int ret;
hassofee6e4e2005-02-02 16:29:31 +000011627 int direct = 0;
11628 char *str = NULL;
paul718e3742002-12-13 20:15:29 +000011629
hassofee6e4e2005-02-02 16:29:31 +000011630 if (argc > 1)
paul718e3742002-12-13 20:15:29 +000011631 {
hassofee6e4e2005-02-02 16:29:31 +000011632 /* Check the list direct. */
11633 if (strncmp (argv[1], "p", 1) == 0)
11634 direct = COMMUNITY_PERMIT;
11635 else if (strncmp (argv[1], "d", 1) == 0)
11636 direct = COMMUNITY_DENY;
11637 else
11638 {
11639 vty_out (vty, "%% Matching condition must be permit or deny%s",
11640 VTY_NEWLINE);
11641 return CMD_WARNING;
11642 }
11643
11644 /* Concat community string argument. */
11645 str = argv_concat (argv, argc, 2);
paul718e3742002-12-13 20:15:29 +000011646 }
paul718e3742002-12-13 20:15:29 +000011647
11648 /* Unset community list. */
11649 ret = extcommunity_list_unset (bgp_clist, argv[0], str, direct, style);
11650
11651 /* Free temporary community list string allocated by
11652 argv_concat(). */
hassofee6e4e2005-02-02 16:29:31 +000011653 if (str)
11654 XFREE (MTYPE_TMP, str);
paul718e3742002-12-13 20:15:29 +000011655
11656 if (ret < 0)
11657 {
11658 community_list_perror (vty, ret);
11659 return CMD_WARNING;
11660 }
11661
11662 return CMD_SUCCESS;
11663}
11664
11665/* "extcommunity-list" keyword help string. */
11666#define EXTCOMMUNITY_LIST_STR "Add a extended community list entry\n"
11667#define EXTCOMMUNITY_VAL_STR "Extended community attribute in 'rt aa:nn_or_IPaddr:nn' OR 'soo aa:nn_or_IPaddr:nn' format\n"
11668
11669DEFUN (ip_extcommunity_list_standard,
11670 ip_extcommunity_list_standard_cmd,
11671 "ip extcommunity-list <1-99> (deny|permit) .AA:NN",
11672 IP_STR
11673 EXTCOMMUNITY_LIST_STR
11674 "Extended Community list number (standard)\n"
11675 "Specify community to reject\n"
11676 "Specify community to accept\n"
11677 EXTCOMMUNITY_VAL_STR)
11678{
11679 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0);
11680}
11681
11682ALIAS (ip_extcommunity_list_standard,
11683 ip_extcommunity_list_standard2_cmd,
11684 "ip extcommunity-list <1-99> (deny|permit)",
11685 IP_STR
11686 EXTCOMMUNITY_LIST_STR
11687 "Extended Community list number (standard)\n"
11688 "Specify community to reject\n"
11689 "Specify community to accept\n")
11690
11691DEFUN (ip_extcommunity_list_expanded,
11692 ip_extcommunity_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000011693 "ip extcommunity-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000011694 IP_STR
11695 EXTCOMMUNITY_LIST_STR
11696 "Extended Community list number (expanded)\n"
11697 "Specify community to reject\n"
11698 "Specify community to accept\n"
11699 "An ordered list as a regular-expression\n")
11700{
11701 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0);
11702}
11703
11704DEFUN (ip_extcommunity_list_name_standard,
11705 ip_extcommunity_list_name_standard_cmd,
11706 "ip extcommunity-list standard WORD (deny|permit) .AA:NN",
11707 IP_STR
11708 EXTCOMMUNITY_LIST_STR
11709 "Specify standard extcommunity-list\n"
11710 "Extended Community list name\n"
11711 "Specify community to reject\n"
11712 "Specify community to accept\n"
11713 EXTCOMMUNITY_VAL_STR)
11714{
11715 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1);
11716}
11717
11718ALIAS (ip_extcommunity_list_name_standard,
11719 ip_extcommunity_list_name_standard2_cmd,
11720 "ip extcommunity-list standard WORD (deny|permit)",
11721 IP_STR
11722 EXTCOMMUNITY_LIST_STR
11723 "Specify standard extcommunity-list\n"
11724 "Extended Community list name\n"
11725 "Specify community to reject\n"
11726 "Specify community to accept\n")
11727
11728DEFUN (ip_extcommunity_list_name_expanded,
11729 ip_extcommunity_list_name_expanded_cmd,
11730 "ip extcommunity-list expanded WORD (deny|permit) .LINE",
11731 IP_STR
11732 EXTCOMMUNITY_LIST_STR
11733 "Specify expanded extcommunity-list\n"
11734 "Extended Community list name\n"
11735 "Specify community to reject\n"
11736 "Specify community to accept\n"
11737 "An ordered list as a regular-expression\n")
11738{
11739 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1);
11740}
11741
hassofee6e4e2005-02-02 16:29:31 +000011742DEFUN (no_ip_extcommunity_list_standard_all,
11743 no_ip_extcommunity_list_standard_all_cmd,
11744 "no ip extcommunity-list <1-99>",
paul718e3742002-12-13 20:15:29 +000011745 NO_STR
11746 IP_STR
11747 EXTCOMMUNITY_LIST_STR
hassofee6e4e2005-02-02 16:29:31 +000011748 "Extended Community list number (standard)\n")
paul718e3742002-12-13 20:15:29 +000011749{
hassofee6e4e2005-02-02 16:29:31 +000011750 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
paul718e3742002-12-13 20:15:29 +000011751}
11752
hassofee6e4e2005-02-02 16:29:31 +000011753DEFUN (no_ip_extcommunity_list_expanded_all,
11754 no_ip_extcommunity_list_expanded_all_cmd,
11755 "no ip extcommunity-list <100-500>",
11756 NO_STR
11757 IP_STR
11758 EXTCOMMUNITY_LIST_STR
11759 "Extended Community list number (expanded)\n")
11760{
11761 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
11762}
11763
11764DEFUN (no_ip_extcommunity_list_name_standard_all,
11765 no_ip_extcommunity_list_name_standard_all_cmd,
11766 "no ip extcommunity-list standard WORD",
paul718e3742002-12-13 20:15:29 +000011767 NO_STR
11768 IP_STR
11769 EXTCOMMUNITY_LIST_STR
11770 "Specify standard extcommunity-list\n"
hassofee6e4e2005-02-02 16:29:31 +000011771 "Extended Community list name\n")
11772{
11773 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
11774}
11775
11776DEFUN (no_ip_extcommunity_list_name_expanded_all,
11777 no_ip_extcommunity_list_name_expanded_all_cmd,
11778 "no ip extcommunity-list expanded WORD",
11779 NO_STR
11780 IP_STR
11781 EXTCOMMUNITY_LIST_STR
paul718e3742002-12-13 20:15:29 +000011782 "Specify expanded extcommunity-list\n"
11783 "Extended Community list name\n")
11784{
hassofee6e4e2005-02-02 16:29:31 +000011785 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
paul718e3742002-12-13 20:15:29 +000011786}
11787
11788DEFUN (no_ip_extcommunity_list_standard,
11789 no_ip_extcommunity_list_standard_cmd,
11790 "no ip extcommunity-list <1-99> (deny|permit) .AA:NN",
11791 NO_STR
11792 IP_STR
11793 EXTCOMMUNITY_LIST_STR
11794 "Extended Community list number (standard)\n"
11795 "Specify community to reject\n"
11796 "Specify community to accept\n"
11797 EXTCOMMUNITY_VAL_STR)
11798{
11799 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
11800}
11801
11802DEFUN (no_ip_extcommunity_list_expanded,
11803 no_ip_extcommunity_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000011804 "no ip extcommunity-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000011805 NO_STR
11806 IP_STR
11807 EXTCOMMUNITY_LIST_STR
11808 "Extended Community list number (expanded)\n"
11809 "Specify community to reject\n"
11810 "Specify community to accept\n"
11811 "An ordered list as a regular-expression\n")
11812{
11813 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
11814}
11815
11816DEFUN (no_ip_extcommunity_list_name_standard,
11817 no_ip_extcommunity_list_name_standard_cmd,
11818 "no ip extcommunity-list standard WORD (deny|permit) .AA:NN",
11819 NO_STR
11820 IP_STR
11821 EXTCOMMUNITY_LIST_STR
11822 "Specify standard extcommunity-list\n"
11823 "Extended Community list name\n"
11824 "Specify community to reject\n"
11825 "Specify community to accept\n"
11826 EXTCOMMUNITY_VAL_STR)
11827{
11828 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
11829}
11830
11831DEFUN (no_ip_extcommunity_list_name_expanded,
11832 no_ip_extcommunity_list_name_expanded_cmd,
11833 "no ip extcommunity-list expanded WORD (deny|permit) .LINE",
11834 NO_STR
11835 IP_STR
11836 EXTCOMMUNITY_LIST_STR
11837 "Specify expanded extcommunity-list\n"
11838 "Community list name\n"
11839 "Specify community to reject\n"
11840 "Specify community to accept\n"
11841 "An ordered list as a regular-expression\n")
11842{
11843 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
11844}
11845
paul94f2b392005-06-28 12:44:16 +000011846static void
paul718e3742002-12-13 20:15:29 +000011847extcommunity_list_show (struct vty *vty, struct community_list *list)
11848{
11849 struct community_entry *entry;
11850
11851 for (entry = list->head; entry; entry = entry->next)
11852 {
11853 if (entry == list->head)
11854 {
11855 if (all_digit (list->name))
11856 vty_out (vty, "Extended community %s list %s%s",
11857 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
11858 "standard" : "(expanded) access",
11859 list->name, VTY_NEWLINE);
11860 else
11861 vty_out (vty, "Named extended community %s list %s%s",
11862 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
11863 "standard" : "expanded",
11864 list->name, VTY_NEWLINE);
11865 }
11866 if (entry->any)
11867 vty_out (vty, " %s%s",
11868 community_direct_str (entry->direct), VTY_NEWLINE);
11869 else
11870 vty_out (vty, " %s %s%s",
11871 community_direct_str (entry->direct),
11872 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
11873 entry->u.ecom->str : entry->config,
11874 VTY_NEWLINE);
11875 }
11876}
11877
11878DEFUN (show_ip_extcommunity_list,
11879 show_ip_extcommunity_list_cmd,
11880 "show ip extcommunity-list",
11881 SHOW_STR
11882 IP_STR
11883 "List extended-community list\n")
11884{
11885 struct community_list *list;
11886 struct community_list_master *cm;
11887
hassofee6e4e2005-02-02 16:29:31 +000011888 cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011889 if (! cm)
11890 return CMD_SUCCESS;
11891
11892 for (list = cm->num.head; list; list = list->next)
11893 extcommunity_list_show (vty, list);
11894
11895 for (list = cm->str.head; list; list = list->next)
11896 extcommunity_list_show (vty, list);
11897
11898 return CMD_SUCCESS;
11899}
11900
11901DEFUN (show_ip_extcommunity_list_arg,
11902 show_ip_extcommunity_list_arg_cmd,
hassofee6e4e2005-02-02 16:29:31 +000011903 "show ip extcommunity-list (<1-500>|WORD)",
paul718e3742002-12-13 20:15:29 +000011904 SHOW_STR
11905 IP_STR
11906 "List extended-community list\n"
11907 "Extcommunity-list number\n"
11908 "Extcommunity-list name\n")
11909{
11910 struct community_list *list;
11911
hassofee6e4e2005-02-02 16:29:31 +000011912 list = community_list_lookup (bgp_clist, argv[0], EXTCOMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011913 if (! list)
11914 {
Denis Ovsienkob7292942010-12-08 18:51:37 +030011915 vty_out (vty, "%% Can't find extcommunity-list%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000011916 return CMD_WARNING;
11917 }
11918
11919 extcommunity_list_show (vty, list);
11920
11921 return CMD_SUCCESS;
11922}
David Lamparter6b0655a2014-06-04 06:53:35 +020011923
paul718e3742002-12-13 20:15:29 +000011924/* Return configuration string of community-list entry. */
paulfd79ac92004-10-13 05:06:08 +000011925static const char *
paul718e3742002-12-13 20:15:29 +000011926community_list_config_str (struct community_entry *entry)
11927{
paulfd79ac92004-10-13 05:06:08 +000011928 const char *str;
paul718e3742002-12-13 20:15:29 +000011929
11930 if (entry->any)
11931 str = "";
11932 else
11933 {
11934 if (entry->style == COMMUNITY_LIST_STANDARD)
11935 str = community_str (entry->u.com);
11936 else
11937 str = entry->config;
11938 }
11939 return str;
11940}
11941
11942/* Display community-list and extcommunity-list configuration. */
paul94f2b392005-06-28 12:44:16 +000011943static int
paul718e3742002-12-13 20:15:29 +000011944community_list_config_write (struct vty *vty)
11945{
11946 struct community_list *list;
11947 struct community_entry *entry;
11948 struct community_list_master *cm;
11949 int write = 0;
11950
11951 /* Community-list. */
hassofee6e4e2005-02-02 16:29:31 +000011952 cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011953
11954 for (list = cm->num.head; list; list = list->next)
11955 for (entry = list->head; entry; entry = entry->next)
11956 {
hassofee6e4e2005-02-02 16:29:31 +000011957 vty_out (vty, "ip community-list %s %s %s%s",
11958 list->name, community_direct_str (entry->direct),
11959 community_list_config_str (entry),
11960 VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000011961 write++;
11962 }
11963 for (list = cm->str.head; list; list = list->next)
11964 for (entry = list->head; entry; entry = entry->next)
11965 {
11966 vty_out (vty, "ip community-list %s %s %s %s%s",
11967 entry->style == COMMUNITY_LIST_STANDARD
11968 ? "standard" : "expanded",
11969 list->name, community_direct_str (entry->direct),
11970 community_list_config_str (entry),
11971 VTY_NEWLINE);
11972 write++;
11973 }
11974
11975 /* Extcommunity-list. */
hassofee6e4e2005-02-02 16:29:31 +000011976 cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011977
11978 for (list = cm->num.head; list; list = list->next)
11979 for (entry = list->head; entry; entry = entry->next)
11980 {
hassofee6e4e2005-02-02 16:29:31 +000011981 vty_out (vty, "ip extcommunity-list %s %s %s%s",
11982 list->name, community_direct_str (entry->direct),
11983 community_list_config_str (entry), VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000011984 write++;
11985 }
11986 for (list = cm->str.head; list; list = list->next)
11987 for (entry = list->head; entry; entry = entry->next)
11988 {
11989 vty_out (vty, "ip extcommunity-list %s %s %s %s%s",
11990 entry->style == EXTCOMMUNITY_LIST_STANDARD
11991 ? "standard" : "expanded",
11992 list->name, community_direct_str (entry->direct),
11993 community_list_config_str (entry), VTY_NEWLINE);
11994 write++;
11995 }
11996 return write;
11997}
11998
Stephen Hemminger7fc626d2008-12-01 11:10:34 -080011999static struct cmd_node community_list_node =
paul718e3742002-12-13 20:15:29 +000012000{
12001 COMMUNITY_LIST_NODE,
12002 "",
12003 1 /* Export to vtysh. */
12004};
12005
paul94f2b392005-06-28 12:44:16 +000012006static void
12007community_list_vty (void)
paul718e3742002-12-13 20:15:29 +000012008{
12009 install_node (&community_list_node, community_list_config_write);
12010
12011 /* Community-list. */
paul718e3742002-12-13 20:15:29 +000012012 install_element (CONFIG_NODE, &ip_community_list_standard_cmd);
12013 install_element (CONFIG_NODE, &ip_community_list_standard2_cmd);
12014 install_element (CONFIG_NODE, &ip_community_list_expanded_cmd);
12015 install_element (CONFIG_NODE, &ip_community_list_name_standard_cmd);
12016 install_element (CONFIG_NODE, &ip_community_list_name_standard2_cmd);
12017 install_element (CONFIG_NODE, &ip_community_list_name_expanded_cmd);
hassofee6e4e2005-02-02 16:29:31 +000012018 install_element (CONFIG_NODE, &no_ip_community_list_standard_all_cmd);
12019 install_element (CONFIG_NODE, &no_ip_community_list_expanded_all_cmd);
12020 install_element (CONFIG_NODE, &no_ip_community_list_name_standard_all_cmd);
12021 install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_all_cmd);
paul718e3742002-12-13 20:15:29 +000012022 install_element (CONFIG_NODE, &no_ip_community_list_standard_cmd);
12023 install_element (CONFIG_NODE, &no_ip_community_list_expanded_cmd);
12024 install_element (CONFIG_NODE, &no_ip_community_list_name_standard_cmd);
12025 install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_cmd);
12026 install_element (VIEW_NODE, &show_ip_community_list_cmd);
12027 install_element (VIEW_NODE, &show_ip_community_list_arg_cmd);
paul718e3742002-12-13 20:15:29 +000012028
12029 /* Extcommunity-list. */
12030 install_element (CONFIG_NODE, &ip_extcommunity_list_standard_cmd);
12031 install_element (CONFIG_NODE, &ip_extcommunity_list_standard2_cmd);
12032 install_element (CONFIG_NODE, &ip_extcommunity_list_expanded_cmd);
12033 install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard_cmd);
12034 install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard2_cmd);
12035 install_element (CONFIG_NODE, &ip_extcommunity_list_name_expanded_cmd);
hassofee6e4e2005-02-02 16:29:31 +000012036 install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_all_cmd);
12037 install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_all_cmd);
12038 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_all_cmd);
12039 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_all_cmd);
paul718e3742002-12-13 20:15:29 +000012040 install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_cmd);
12041 install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_cmd);
12042 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_cmd);
12043 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_cmd);
12044 install_element (VIEW_NODE, &show_ip_extcommunity_list_cmd);
12045 install_element (VIEW_NODE, &show_ip_extcommunity_list_arg_cmd);
paul718e3742002-12-13 20:15:29 +000012046}