blob: 6db3dcb1cdfabd1d1c0d9365d4f00c1f8f6eda5c [file] [log] [blame]
paul718e3742002-12-13 20:15:29 +00001/* BGP VTY interface.
2 Copyright (C) 1996, 97, 98, 99, 2000 Kunihiro Ishiguro
3
4This file is part of GNU Zebra.
5
6GNU Zebra is free software; you can redistribute it and/or modify it
7under the terms of the GNU General Public License as published by the
8Free Software Foundation; either version 2, or (at your option) any
9later version.
10
11GNU Zebra is distributed in the hope that it will be useful, but
12WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with GNU Zebra; see the file COPYING. If not, write to the Free
18Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
1902111-1307, USA. */
20
21#include <zebra.h>
22
23#include "command.h"
24#include "prefix.h"
25#include "plist.h"
26#include "buffer.h"
27#include "linklist.h"
28#include "stream.h"
29#include "thread.h"
30#include "log.h"
ajs3b8b1852005-01-29 18:19:13 +000031#include "memory.h"
Paul Jakma4bf6a362006-03-30 14:05:23 +000032#include "hash.h"
Donald Sharp04907292016-01-07 10:03:01 -050033#include "filter.h"
paul718e3742002-12-13 20:15:29 +000034
35#include "bgpd/bgpd.h"
Paul Jakma4bf6a362006-03-30 14:05:23 +000036#include "bgpd/bgp_advertise.h"
paul718e3742002-12-13 20:15:29 +000037#include "bgpd/bgp_attr.h"
38#include "bgpd/bgp_aspath.h"
39#include "bgpd/bgp_community.h"
Paul Jakma4bf6a362006-03-30 14:05:23 +000040#include "bgpd/bgp_ecommunity.h"
41#include "bgpd/bgp_damp.h"
paul718e3742002-12-13 20:15:29 +000042#include "bgpd/bgp_debug.h"
hassoe0701b72004-05-20 09:19:34 +000043#include "bgpd/bgp_fsm.h"
paul718e3742002-12-13 20:15:29 +000044#include "bgpd/bgp_mplsvpn.h"
Paul Jakma4bf6a362006-03-30 14:05:23 +000045#include "bgpd/bgp_nexthop.h"
paul718e3742002-12-13 20:15:29 +000046#include "bgpd/bgp_open.h"
Paul Jakma4bf6a362006-03-30 14:05:23 +000047#include "bgpd/bgp_regex.h"
paul718e3742002-12-13 20:15:29 +000048#include "bgpd/bgp_route.h"
49#include "bgpd/bgp_zebra.h"
paulfee0f4c2004-09-13 05:12:46 +000050#include "bgpd/bgp_table.h"
paul94f2b392005-06-28 12:44:16 +000051#include "bgpd/bgp_vty.h"
Josh Bailey165b5ff2011-07-20 20:43:22 -070052#include "bgpd/bgp_mpath.h"
paul718e3742002-12-13 20:15:29 +000053
hasso18a6dce2004-10-03 18:18:34 +000054extern struct in_addr router_id_zebra;
55
paul718e3742002-12-13 20:15:29 +000056/* Utility function to get address family from current node. */
57afi_t
58bgp_node_afi (struct vty *vty)
59{
Lou Berger135ca152016-01-12 13:42:05 -050060 afi_t afi;
Lou Berger13c378d2016-01-12 13:41:56 -050061 switch (vty->node)
62 {
63 case BGP_IPV6_NODE:
64 case BGP_IPV6M_NODE:
65 case BGP_VPNV6_NODE:
Lou Bergera3fda882016-01-12 13:42:04 -050066 case BGP_ENCAPV6_NODE:
Lou Berger135ca152016-01-12 13:42:05 -050067 afi = AFI_IP6;
68 break;
69 default:
70 afi = AFI_IP;
Lou Berger13c378d2016-01-12 13:41:56 -050071 break;
72 }
Lou Berger135ca152016-01-12 13:42:05 -050073 return afi;
paul718e3742002-12-13 20:15:29 +000074}
75
76/* Utility function to get subsequent address family from current
77 node. */
78safi_t
79bgp_node_safi (struct vty *vty)
80{
Lou Berger135ca152016-01-12 13:42:05 -050081 safi_t safi;
82 switch (vty->node)
83 {
84 case BGP_ENCAP_NODE:
85 case BGP_ENCAPV6_NODE:
86 safi = SAFI_ENCAP;
87 break;
88 case BGP_VPNV4_NODE:
89 case BGP_VPNV6_NODE:
90 safi = SAFI_MPLS_VPN;
91 break;
92 case BGP_IPV4M_NODE:
93 case BGP_IPV6M_NODE:
94 safi = SAFI_MULTICAST;
95 break;
96 default:
97 safi = SAFI_UNICAST;
98 break;
99 }
100 return safi;
paul718e3742002-12-13 20:15:29 +0000101}
102
Lou Bergera3fda882016-01-12 13:42:04 -0500103int
104bgp_parse_afi(const char *str, afi_t *afi)
105{
106 if (!strcmp(str, "ipv4")) {
107 *afi = AFI_IP;
108 return 0;
109 }
Lou Bergera3fda882016-01-12 13:42:04 -0500110 if (!strcmp(str, "ipv6")) {
111 *afi = AFI_IP6;
112 return 0;
113 }
Lou Bergera3fda882016-01-12 13:42:04 -0500114 return -1;
115}
116
117int
118bgp_parse_safi(const char *str, safi_t *safi)
119{
120 if (!strcmp(str, "encap")) {
121 *safi = SAFI_ENCAP;
122 return 0;
123 }
124 if (!strcmp(str, "multicast")) {
125 *safi = SAFI_MULTICAST;
126 return 0;
127 }
128 if (!strcmp(str, "unicast")) {
129 *safi = SAFI_UNICAST;
130 return 0;
131 }
132 if (!strcmp(str, "vpn")) {
133 *safi = SAFI_MPLS_VPN;
134 return 0;
135 }
136 return -1;
137}
138
paul94f2b392005-06-28 12:44:16 +0000139static int
paul718e3742002-12-13 20:15:29 +0000140peer_address_self_check (union sockunion *su)
141{
142 struct interface *ifp = NULL;
143
144 if (su->sa.sa_family == AF_INET)
145 ifp = if_lookup_by_ipv4_exact (&su->sin.sin_addr);
paul718e3742002-12-13 20:15:29 +0000146 else if (su->sa.sa_family == AF_INET6)
147 ifp = if_lookup_by_ipv6_exact (&su->sin6.sin6_addr);
paul718e3742002-12-13 20:15:29 +0000148
149 if (ifp)
150 return 1;
151
152 return 0;
153}
154
155/* Utility function for looking up peer from VTY. */
paul94f2b392005-06-28 12:44:16 +0000156static struct peer *
paulfd79ac92004-10-13 05:06:08 +0000157peer_lookup_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +0000158{
159 int ret;
160 struct bgp *bgp;
161 union sockunion su;
162 struct peer *peer;
163
164 bgp = vty->index;
165
166 ret = str2sockunion (ip_str, &su);
167 if (ret < 0)
168 {
169 vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE);
170 return NULL;
171 }
172
173 peer = peer_lookup (bgp, &su);
174 if (! peer)
175 {
176 vty_out (vty, "%% Specify remote-as or peer-group commands first%s", VTY_NEWLINE);
177 return NULL;
178 }
179 return peer;
180}
181
182/* Utility function for looking up peer or peer group. */
paul94f2b392005-06-28 12:44:16 +0000183static struct peer *
paulfd79ac92004-10-13 05:06:08 +0000184peer_and_group_lookup_vty (struct vty *vty, const char *peer_str)
paul718e3742002-12-13 20:15:29 +0000185{
186 int ret;
187 struct bgp *bgp;
188 union sockunion su;
189 struct peer *peer;
190 struct peer_group *group;
191
192 bgp = vty->index;
193
194 ret = str2sockunion (peer_str, &su);
195 if (ret == 0)
196 {
197 peer = peer_lookup (bgp, &su);
198 if (peer)
199 return peer;
200 }
201 else
202 {
203 group = peer_group_lookup (bgp, peer_str);
204 if (group)
205 return group->conf;
206 }
207
208 vty_out (vty, "%% Specify remote-as or peer-group commands first%s",
209 VTY_NEWLINE);
210
211 return NULL;
212}
213
paul94f2b392005-06-28 12:44:16 +0000214static int
paul718e3742002-12-13 20:15:29 +0000215bgp_vty_return (struct vty *vty, int ret)
216{
paulfd79ac92004-10-13 05:06:08 +0000217 const char *str = NULL;
paul718e3742002-12-13 20:15:29 +0000218
219 switch (ret)
220 {
221 case BGP_ERR_INVALID_VALUE:
222 str = "Invalid value";
223 break;
224 case BGP_ERR_INVALID_FLAG:
225 str = "Invalid flag";
226 break;
227 case BGP_ERR_PEER_INACTIVE:
228 str = "Activate the neighbor for the address family first";
229 break;
230 case BGP_ERR_INVALID_FOR_PEER_GROUP_MEMBER:
231 str = "Invalid command for a peer-group member";
232 break;
233 case BGP_ERR_PEER_GROUP_SHUTDOWN:
234 str = "Peer-group has been shutdown. Activate the peer-group first";
235 break;
236 case BGP_ERR_PEER_GROUP_HAS_THE_FLAG:
237 str = "This peer is a peer-group member. Please change peer-group configuration";
238 break;
239 case BGP_ERR_PEER_FLAG_CONFLICT:
240 str = "Can't set override-capability and strict-capability-match at the same time";
241 break;
242 case BGP_ERR_PEER_GROUP_MEMBER_EXISTS:
243 str = "No activate for peergroup can be given only if peer-group has no members";
244 break;
245 case BGP_ERR_PEER_BELONGS_TO_GROUP:
246 str = "No activate for an individual peer-group member is invalid";
247 break;
248 case BGP_ERR_PEER_GROUP_AF_UNCONFIGURED:
249 str = "Activate the peer-group for the address family first";
250 break;
251 case BGP_ERR_PEER_GROUP_NO_REMOTE_AS:
252 str = "Specify remote-as or peer-group remote AS first";
253 break;
254 case BGP_ERR_PEER_GROUP_CANT_CHANGE:
255 str = "Cannot change the peer-group. Deconfigure first";
256 break;
257 case BGP_ERR_PEER_GROUP_MISMATCH:
258 str = "Cannot have different peer-group for the neighbor";
259 break;
260 case BGP_ERR_PEER_FILTER_CONFLICT:
261 str = "Prefix/distribute list can not co-exist";
262 break;
263 case BGP_ERR_NOT_INTERNAL_PEER:
264 str = "Invalid command. Not an internal neighbor";
265 break;
266 case BGP_ERR_REMOVE_PRIVATE_AS:
267 str = "Private AS cannot be removed for IBGP peers";
268 break;
269 case BGP_ERR_LOCAL_AS_ALLOWED_ONLY_FOR_EBGP:
270 str = "Local-AS allowed only for EBGP peers";
271 break;
272 case BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS:
273 str = "Cannot have local-as same as BGP AS number";
274 break;
Paul Jakma0df7c912008-07-21 21:02:49 +0000275 case BGP_ERR_TCPSIG_FAILED:
276 str = "Error while applying TCP-Sig to session(s)";
277 break;
Nick Hilliardfa411a22011-03-23 15:33:17 +0000278 case BGP_ERR_NO_EBGP_MULTIHOP_WITH_TTLHACK:
279 str = "ebgp-multihop and ttl-security cannot be configured together";
280 break;
Stephen Hemmingerf5a48272011-03-24 17:30:21 +0000281 case BGP_ERR_NO_IBGP_WITH_TTLHACK:
282 str = "ttl-security only allowed for EBGP peers";
283 break;
paul718e3742002-12-13 20:15:29 +0000284 }
285 if (str)
286 {
287 vty_out (vty, "%% %s%s", str, VTY_NEWLINE);
288 return CMD_WARNING;
289 }
290 return CMD_SUCCESS;
291}
292
293/* BGP global configuration. */
294
295DEFUN (bgp_multiple_instance_func,
296 bgp_multiple_instance_cmd,
297 "bgp multiple-instance",
298 BGP_STR
299 "Enable bgp multiple instance\n")
300{
301 bgp_option_set (BGP_OPT_MULTIPLE_INSTANCE);
302 return CMD_SUCCESS;
303}
304
305DEFUN (no_bgp_multiple_instance,
306 no_bgp_multiple_instance_cmd,
307 "no bgp multiple-instance",
308 NO_STR
309 BGP_STR
310 "BGP multiple instance\n")
311{
312 int ret;
313
314 ret = bgp_option_unset (BGP_OPT_MULTIPLE_INSTANCE);
315 if (ret < 0)
316 {
317 vty_out (vty, "%% There are more than two BGP instances%s", VTY_NEWLINE);
318 return CMD_WARNING;
319 }
320 return CMD_SUCCESS;
321}
322
323DEFUN (bgp_config_type,
324 bgp_config_type_cmd,
325 "bgp config-type (cisco|zebra)",
326 BGP_STR
327 "Configuration type\n"
328 "cisco\n"
329 "zebra\n")
330{
331 if (strncmp (argv[0], "c", 1) == 0)
332 bgp_option_set (BGP_OPT_CONFIG_CISCO);
333 else
334 bgp_option_unset (BGP_OPT_CONFIG_CISCO);
335
336 return CMD_SUCCESS;
337}
338
339DEFUN (no_bgp_config_type,
340 no_bgp_config_type_cmd,
341 "no bgp config-type",
342 NO_STR
343 BGP_STR
344 "Display configuration type\n")
345{
346 bgp_option_unset (BGP_OPT_CONFIG_CISCO);
347 return CMD_SUCCESS;
348}
349
350DEFUN (no_synchronization,
351 no_synchronization_cmd,
352 "no synchronization",
353 NO_STR
354 "Perform IGP synchronization\n")
355{
356 return CMD_SUCCESS;
357}
358
359DEFUN (no_auto_summary,
360 no_auto_summary_cmd,
361 "no auto-summary",
362 NO_STR
363 "Enable automatic network number summarization\n")
364{
365 return CMD_SUCCESS;
366}
hasso3d515fd2005-02-01 21:30:04 +0000367
368DEFUN_DEPRECATED (neighbor_version,
369 neighbor_version_cmd,
370 NEIGHBOR_CMD "version (4|4-)",
371 NEIGHBOR_STR
372 NEIGHBOR_ADDR_STR
373 "Set the BGP version to match a neighbor\n"
374 "Neighbor's BGP version\n")
375{
376 return CMD_SUCCESS;
377}
David Lamparter6b0655a2014-06-04 06:53:35 +0200378
paul718e3742002-12-13 20:15:29 +0000379/* "router bgp" commands. */
380DEFUN (router_bgp,
381 router_bgp_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000382 "router bgp " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000383 ROUTER_STR
384 BGP_STR
385 AS_STR)
386{
387 int ret;
388 as_t as;
389 struct bgp *bgp;
paulfd79ac92004-10-13 05:06:08 +0000390 const char *name = NULL;
paul718e3742002-12-13 20:15:29 +0000391
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000392 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +0000393
394 if (argc == 2)
395 name = argv[1];
396
397 ret = bgp_get (&bgp, &as, name);
398 switch (ret)
399 {
400 case BGP_ERR_MULTIPLE_INSTANCE_NOT_SET:
401 vty_out (vty, "Please specify 'bgp multiple-instance' first%s",
402 VTY_NEWLINE);
403 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +0000404 case BGP_ERR_AS_MISMATCH:
Denis Ovsienkoaea339f2009-04-30 17:16:22 +0400405 vty_out (vty, "BGP is already running; AS is %u%s", as, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +0000406 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +0000407 case BGP_ERR_INSTANCE_MISMATCH:
408 vty_out (vty, "BGP view name and AS number mismatch%s", VTY_NEWLINE);
Denis Ovsienkoaea339f2009-04-30 17:16:22 +0400409 vty_out (vty, "BGP instance is already running; AS is %u%s",
paul718e3742002-12-13 20:15:29 +0000410 as, VTY_NEWLINE);
411 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +0000412 }
413
414 vty->node = BGP_NODE;
415 vty->index = bgp;
416
417 return CMD_SUCCESS;
418}
419
420ALIAS (router_bgp,
421 router_bgp_view_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000422 "router bgp " CMD_AS_RANGE " view WORD",
paul718e3742002-12-13 20:15:29 +0000423 ROUTER_STR
424 BGP_STR
425 AS_STR
426 "BGP view\n"
427 "view name\n")
David Lamparter6b0655a2014-06-04 06:53:35 +0200428
paul718e3742002-12-13 20:15:29 +0000429/* "no router bgp" commands. */
430DEFUN (no_router_bgp,
431 no_router_bgp_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000432 "no router bgp " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000433 NO_STR
434 ROUTER_STR
435 BGP_STR
436 AS_STR)
437{
438 as_t as;
439 struct bgp *bgp;
paulfd79ac92004-10-13 05:06:08 +0000440 const char *name = NULL;
paul718e3742002-12-13 20:15:29 +0000441
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000442 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +0000443
444 if (argc == 2)
445 name = argv[1];
446
447 /* Lookup bgp structure. */
448 bgp = bgp_lookup (as, name);
449 if (! bgp)
450 {
451 vty_out (vty, "%% Can't find BGP instance%s", VTY_NEWLINE);
452 return CMD_WARNING;
453 }
454
455 bgp_delete (bgp);
456
457 return CMD_SUCCESS;
458}
459
460ALIAS (no_router_bgp,
461 no_router_bgp_view_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000462 "no router bgp " CMD_AS_RANGE " view WORD",
paul718e3742002-12-13 20:15:29 +0000463 NO_STR
464 ROUTER_STR
465 BGP_STR
466 AS_STR
467 "BGP view\n"
468 "view name\n")
David Lamparter6b0655a2014-06-04 06:53:35 +0200469
paul718e3742002-12-13 20:15:29 +0000470/* BGP router-id. */
471
472DEFUN (bgp_router_id,
473 bgp_router_id_cmd,
474 "bgp router-id A.B.C.D",
475 BGP_STR
476 "Override configured router identifier\n"
477 "Manually configured router identifier\n")
478{
479 int ret;
480 struct in_addr id;
481 struct bgp *bgp;
482
483 bgp = vty->index;
484
485 ret = inet_aton (argv[0], &id);
486 if (! ret)
487 {
488 vty_out (vty, "%% Malformed bgp router identifier%s", VTY_NEWLINE);
489 return CMD_WARNING;
490 }
491
hasso18a6dce2004-10-03 18:18:34 +0000492 bgp->router_id_static = id;
paul718e3742002-12-13 20:15:29 +0000493 bgp_router_id_set (bgp, &id);
494
495 return CMD_SUCCESS;
496}
497
498DEFUN (no_bgp_router_id,
499 no_bgp_router_id_cmd,
500 "no bgp router-id",
501 NO_STR
502 BGP_STR
503 "Override configured router identifier\n")
504{
505 int ret;
506 struct in_addr id;
507 struct bgp *bgp;
508
509 bgp = vty->index;
510
511 if (argc == 1)
512 {
513 ret = inet_aton (argv[0], &id);
514 if (! ret)
515 {
516 vty_out (vty, "%% Malformed BGP router identifier%s", VTY_NEWLINE);
517 return CMD_WARNING;
518 }
519
hasso18a6dce2004-10-03 18:18:34 +0000520 if (! IPV4_ADDR_SAME (&bgp->router_id_static, &id))
paul718e3742002-12-13 20:15:29 +0000521 {
522 vty_out (vty, "%% BGP router-id doesn't match%s", VTY_NEWLINE);
523 return CMD_WARNING;
524 }
525 }
526
hasso18a6dce2004-10-03 18:18:34 +0000527 bgp->router_id_static.s_addr = 0;
528 bgp_router_id_set (bgp, &router_id_zebra);
paul718e3742002-12-13 20:15:29 +0000529
530 return CMD_SUCCESS;
531}
532
533ALIAS (no_bgp_router_id,
534 no_bgp_router_id_val_cmd,
535 "no bgp router-id A.B.C.D",
536 NO_STR
537 BGP_STR
538 "Override configured router identifier\n"
539 "Manually configured router identifier\n")
David Lamparter6b0655a2014-06-04 06:53:35 +0200540
paul718e3742002-12-13 20:15:29 +0000541/* BGP Cluster ID. */
542
543DEFUN (bgp_cluster_id,
544 bgp_cluster_id_cmd,
545 "bgp cluster-id A.B.C.D",
546 BGP_STR
547 "Configure Route-Reflector Cluster-id\n"
548 "Route-Reflector Cluster-id in IP address format\n")
549{
550 int ret;
551 struct bgp *bgp;
552 struct in_addr cluster;
553
554 bgp = vty->index;
555
556 ret = inet_aton (argv[0], &cluster);
557 if (! ret)
558 {
559 vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE);
560 return CMD_WARNING;
561 }
562
563 bgp_cluster_id_set (bgp, &cluster);
564
565 return CMD_SUCCESS;
566}
567
568ALIAS (bgp_cluster_id,
569 bgp_cluster_id32_cmd,
570 "bgp cluster-id <1-4294967295>",
571 BGP_STR
572 "Configure Route-Reflector Cluster-id\n"
573 "Route-Reflector Cluster-id as 32 bit quantity\n")
574
575DEFUN (no_bgp_cluster_id,
576 no_bgp_cluster_id_cmd,
577 "no bgp cluster-id",
578 NO_STR
579 BGP_STR
580 "Configure Route-Reflector Cluster-id\n")
581{
582 int ret;
583 struct bgp *bgp;
584 struct in_addr cluster;
585
586 bgp = vty->index;
587
588 if (argc == 1)
589 {
590 ret = inet_aton (argv[0], &cluster);
591 if (! ret)
592 {
593 vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE);
594 return CMD_WARNING;
595 }
596 }
597
598 bgp_cluster_id_unset (bgp);
599
600 return CMD_SUCCESS;
601}
602
603ALIAS (no_bgp_cluster_id,
604 no_bgp_cluster_id_arg_cmd,
605 "no bgp cluster-id A.B.C.D",
606 NO_STR
607 BGP_STR
608 "Configure Route-Reflector Cluster-id\n"
609 "Route-Reflector Cluster-id in IP address format\n")
David Lamparter6b0655a2014-06-04 06:53:35 +0200610
paul718e3742002-12-13 20:15:29 +0000611DEFUN (bgp_confederation_identifier,
612 bgp_confederation_identifier_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000613 "bgp confederation identifier " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000614 "BGP specific commands\n"
615 "AS confederation parameters\n"
616 "AS number\n"
617 "Set routing domain confederation AS\n")
618{
619 struct bgp *bgp;
620 as_t as;
621
622 bgp = vty->index;
623
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000624 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +0000625
626 bgp_confederation_id_set (bgp, as);
627
628 return CMD_SUCCESS;
629}
630
631DEFUN (no_bgp_confederation_identifier,
632 no_bgp_confederation_identifier_cmd,
633 "no bgp confederation identifier",
634 NO_STR
635 "BGP specific commands\n"
636 "AS confederation parameters\n"
637 "AS number\n")
638{
639 struct bgp *bgp;
Paul Jakma7aa9dce2014-09-19 14:42:23 +0100640 as_t as __attribute__((unused)); /* Dummy for VTY_GET_INTEGER_RANGE */
paul718e3742002-12-13 20:15:29 +0000641
642 bgp = vty->index;
643
644 if (argc == 1)
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000645 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +0000646
647 bgp_confederation_id_unset (bgp);
648
649 return CMD_SUCCESS;
650}
651
652ALIAS (no_bgp_confederation_identifier,
653 no_bgp_confederation_identifier_arg_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000654 "no bgp confederation identifier " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000655 NO_STR
656 "BGP specific commands\n"
657 "AS confederation parameters\n"
658 "AS number\n"
659 "Set routing domain confederation AS\n")
David Lamparter6b0655a2014-06-04 06:53:35 +0200660
paul718e3742002-12-13 20:15:29 +0000661DEFUN (bgp_confederation_peers,
662 bgp_confederation_peers_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000663 "bgp confederation peers ." CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000664 "BGP specific commands\n"
665 "AS confederation parameters\n"
666 "Peer ASs in BGP confederation\n"
667 AS_STR)
668{
669 struct bgp *bgp;
670 as_t as;
671 int i;
672
673 bgp = vty->index;
674
675 for (i = 0; i < argc; i++)
676 {
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000677 VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +0000678
679 if (bgp->as == as)
680 {
681 vty_out (vty, "%% Local member-AS not allowed in confed peer list%s",
682 VTY_NEWLINE);
683 continue;
684 }
685
686 bgp_confederation_peers_add (bgp, as);
687 }
688 return CMD_SUCCESS;
689}
690
691DEFUN (no_bgp_confederation_peers,
692 no_bgp_confederation_peers_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000693 "no bgp confederation peers ." CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000694 NO_STR
695 "BGP specific commands\n"
696 "AS confederation parameters\n"
697 "Peer ASs in BGP confederation\n"
698 AS_STR)
699{
700 struct bgp *bgp;
701 as_t as;
702 int i;
703
704 bgp = vty->index;
705
706 for (i = 0; i < argc; i++)
707 {
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000708 VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX);
709
paul718e3742002-12-13 20:15:29 +0000710 bgp_confederation_peers_remove (bgp, as);
711 }
712 return CMD_SUCCESS;
713}
David Lamparter6b0655a2014-06-04 06:53:35 +0200714
Josh Bailey165b5ff2011-07-20 20:43:22 -0700715/* Maximum-paths configuration */
716DEFUN (bgp_maxpaths,
717 bgp_maxpaths_cmd,
Donald Sharpecc1a132015-12-09 08:24:47 -0500718 "maximum-paths " CMD_RANGE_STR(1, MULTIPATH_NUM),
Josh Bailey165b5ff2011-07-20 20:43:22 -0700719 "Forward packets over multiple paths\n"
720 "Number of paths\n")
721{
722 struct bgp *bgp;
723 u_int16_t maxpaths;
724 int ret;
725
726 bgp = vty->index;
727
728 VTY_GET_INTEGER_RANGE ("maximum-paths", maxpaths, argv[0], 1, 255);
729
730 ret = bgp_maximum_paths_set (bgp, bgp_node_afi (vty), bgp_node_safi(vty),
731 BGP_PEER_EBGP, maxpaths);
732 if (ret < 0)
733 {
734 vty_out (vty,
735 "%% Failed to set maximum-paths %u for afi %u, safi %u%s",
736 maxpaths, bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE);
737 return CMD_WARNING;
738 }
739
740 return CMD_SUCCESS;
741}
742
743DEFUN (bgp_maxpaths_ibgp,
744 bgp_maxpaths_ibgp_cmd,
Donald Sharpecc1a132015-12-09 08:24:47 -0500745 "maximum-paths ibgp " CMD_RANGE_STR(1, MULTIPATH_NUM),
Josh Bailey165b5ff2011-07-20 20:43:22 -0700746 "Forward packets over multiple paths\n"
747 "iBGP-multipath\n"
748 "Number of paths\n")
749{
750 struct bgp *bgp;
751 u_int16_t maxpaths;
752 int ret;
753
754 bgp = vty->index;
755
756 VTY_GET_INTEGER_RANGE ("maximum-paths", maxpaths, argv[0], 1, 255);
757
758 ret = bgp_maximum_paths_set (bgp, bgp_node_afi (vty), bgp_node_safi(vty),
759 BGP_PEER_IBGP, maxpaths);
760 if (ret < 0)
761 {
762 vty_out (vty,
763 "%% Failed to set maximum-paths ibgp %u for afi %u, safi %u%s",
764 maxpaths, bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE);
765 return CMD_WARNING;
766 }
767
768 return CMD_SUCCESS;
769}
770
771DEFUN (no_bgp_maxpaths,
772 no_bgp_maxpaths_cmd,
773 "no maximum-paths",
774 NO_STR
775 "Forward packets over multiple paths\n"
776 "Number of paths\n")
777{
778 struct bgp *bgp;
779 int ret;
780
781 bgp = vty->index;
782
783 ret = bgp_maximum_paths_unset (bgp, bgp_node_afi (vty), bgp_node_safi(vty),
784 BGP_PEER_EBGP);
785 if (ret < 0)
786 {
787 vty_out (vty,
788 "%% Failed to unset maximum-paths for afi %u, safi %u%s",
789 bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE);
790 return CMD_WARNING;
791 }
792
793 return CMD_SUCCESS;
794}
795
796ALIAS (no_bgp_maxpaths,
797 no_bgp_maxpaths_arg_cmd,
Donald Sharpecc1a132015-12-09 08:24:47 -0500798 "no maximum-paths " CMD_RANGE_STR(1, MULTIPATH_NUM),
Josh Bailey165b5ff2011-07-20 20:43:22 -0700799 NO_STR
800 "Forward packets over multiple paths\n"
801 "Number of paths\n")
802
803DEFUN (no_bgp_maxpaths_ibgp,
804 no_bgp_maxpaths_ibgp_cmd,
805 "no maximum-paths ibgp",
806 NO_STR
807 "Forward packets over multiple paths\n"
808 "iBGP-multipath\n"
809 "Number of paths\n")
810{
811 struct bgp *bgp;
812 int ret;
813
814 bgp = vty->index;
815
816 ret = bgp_maximum_paths_unset (bgp, bgp_node_afi (vty), bgp_node_safi(vty),
817 BGP_PEER_IBGP);
818 if (ret < 0)
819 {
820 vty_out (vty,
821 "%% Failed to unset maximum-paths ibgp for afi %u, safi %u%s",
822 bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE);
823 return CMD_WARNING;
824 }
825
826 return CMD_SUCCESS;
827}
828
829ALIAS (no_bgp_maxpaths_ibgp,
830 no_bgp_maxpaths_ibgp_arg_cmd,
Donald Sharpecc1a132015-12-09 08:24:47 -0500831 "no maximum-paths ibgp " CMD_RANGE_STR(1, MULTIPATH_NUM),
Josh Bailey165b5ff2011-07-20 20:43:22 -0700832 NO_STR
833 "Forward packets over multiple paths\n"
834 "iBGP-multipath\n"
835 "Number of paths\n")
836
837int
838bgp_config_write_maxpaths (struct vty *vty, struct bgp *bgp, afi_t afi,
839 safi_t safi, int *write)
840{
841 if (bgp->maxpaths[afi][safi].maxpaths_ebgp != BGP_DEFAULT_MAXPATHS)
842 {
843 bgp_config_write_family_header (vty, afi, safi, write);
844 vty_out (vty, " maximum-paths %d%s",
845 bgp->maxpaths[afi][safi].maxpaths_ebgp, VTY_NEWLINE);
846 }
847
848 if (bgp->maxpaths[afi][safi].maxpaths_ibgp != BGP_DEFAULT_MAXPATHS)
849 {
850 bgp_config_write_family_header (vty, afi, safi, write);
851 vty_out (vty, " maximum-paths ibgp %d%s",
852 bgp->maxpaths[afi][safi].maxpaths_ibgp, VTY_NEWLINE);
853 }
854
855 return 0;
856}
David Lamparter6b0655a2014-06-04 06:53:35 +0200857
paul718e3742002-12-13 20:15:29 +0000858/* BGP timers. */
859
860DEFUN (bgp_timers,
861 bgp_timers_cmd,
862 "timers bgp <0-65535> <0-65535>",
863 "Adjust routing timers\n"
864 "BGP timers\n"
865 "Keepalive interval\n"
866 "Holdtime\n")
867{
868 struct bgp *bgp;
869 unsigned long keepalive = 0;
870 unsigned long holdtime = 0;
871
872 bgp = vty->index;
873
874 VTY_GET_INTEGER ("keepalive", keepalive, argv[0]);
875 VTY_GET_INTEGER ("holdtime", holdtime, argv[1]);
876
877 /* Holdtime value check. */
878 if (holdtime < 3 && holdtime != 0)
879 {
880 vty_out (vty, "%% hold time value must be either 0 or greater than 3%s",
881 VTY_NEWLINE);
882 return CMD_WARNING;
883 }
884
885 bgp_timers_set (bgp, keepalive, holdtime);
886
887 return CMD_SUCCESS;
888}
889
890DEFUN (no_bgp_timers,
891 no_bgp_timers_cmd,
892 "no timers bgp",
893 NO_STR
894 "Adjust routing timers\n"
895 "BGP timers\n")
896{
897 struct bgp *bgp;
898
899 bgp = vty->index;
900 bgp_timers_unset (bgp);
901
902 return CMD_SUCCESS;
903}
904
905ALIAS (no_bgp_timers,
906 no_bgp_timers_arg_cmd,
907 "no timers bgp <0-65535> <0-65535>",
908 NO_STR
909 "Adjust routing timers\n"
910 "BGP timers\n"
911 "Keepalive interval\n"
912 "Holdtime\n")
David Lamparter6b0655a2014-06-04 06:53:35 +0200913
paul718e3742002-12-13 20:15:29 +0000914DEFUN (bgp_client_to_client_reflection,
915 bgp_client_to_client_reflection_cmd,
916 "bgp client-to-client reflection",
917 "BGP specific commands\n"
918 "Configure client to client route reflection\n"
919 "reflection of routes allowed\n")
920{
921 struct bgp *bgp;
922
923 bgp = vty->index;
924 bgp_flag_unset (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT);
925 return CMD_SUCCESS;
926}
927
928DEFUN (no_bgp_client_to_client_reflection,
929 no_bgp_client_to_client_reflection_cmd,
930 "no bgp client-to-client reflection",
931 NO_STR
932 "BGP specific commands\n"
933 "Configure client to client route reflection\n"
934 "reflection of routes allowed\n")
935{
936 struct bgp *bgp;
937
938 bgp = vty->index;
939 bgp_flag_set (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT);
940 return CMD_SUCCESS;
941}
942
943/* "bgp always-compare-med" configuration. */
944DEFUN (bgp_always_compare_med,
945 bgp_always_compare_med_cmd,
946 "bgp always-compare-med",
947 "BGP specific commands\n"
948 "Allow comparing MED from different neighbors\n")
949{
950 struct bgp *bgp;
951
952 bgp = vty->index;
953 bgp_flag_set (bgp, BGP_FLAG_ALWAYS_COMPARE_MED);
954 return CMD_SUCCESS;
955}
956
957DEFUN (no_bgp_always_compare_med,
958 no_bgp_always_compare_med_cmd,
959 "no bgp always-compare-med",
960 NO_STR
961 "BGP specific commands\n"
962 "Allow comparing MED from different neighbors\n")
963{
964 struct bgp *bgp;
965
966 bgp = vty->index;
967 bgp_flag_unset (bgp, BGP_FLAG_ALWAYS_COMPARE_MED);
968 return CMD_SUCCESS;
969}
David Lamparter6b0655a2014-06-04 06:53:35 +0200970
paul718e3742002-12-13 20:15:29 +0000971/* "bgp deterministic-med" configuration. */
972DEFUN (bgp_deterministic_med,
973 bgp_deterministic_med_cmd,
974 "bgp deterministic-med",
975 "BGP specific commands\n"
976 "Pick the best-MED path among paths advertised from the neighboring AS\n")
977{
978 struct bgp *bgp;
979
980 bgp = vty->index;
981 bgp_flag_set (bgp, BGP_FLAG_DETERMINISTIC_MED);
982 return CMD_SUCCESS;
983}
984
985DEFUN (no_bgp_deterministic_med,
986 no_bgp_deterministic_med_cmd,
987 "no bgp deterministic-med",
988 NO_STR
989 "BGP specific commands\n"
990 "Pick the best-MED path among paths advertised from the neighboring AS\n")
991{
992 struct bgp *bgp;
993
994 bgp = vty->index;
995 bgp_flag_unset (bgp, BGP_FLAG_DETERMINISTIC_MED);
996 return CMD_SUCCESS;
997}
hasso538621f2004-05-21 09:31:30 +0000998
999/* "bgp graceful-restart" configuration. */
1000DEFUN (bgp_graceful_restart,
1001 bgp_graceful_restart_cmd,
1002 "bgp graceful-restart",
1003 "BGP specific commands\n"
1004 "Graceful restart capability parameters\n")
1005{
1006 struct bgp *bgp;
1007
1008 bgp = vty->index;
1009 bgp_flag_set (bgp, BGP_FLAG_GRACEFUL_RESTART);
1010 return CMD_SUCCESS;
1011}
1012
1013DEFUN (no_bgp_graceful_restart,
1014 no_bgp_graceful_restart_cmd,
1015 "no bgp graceful-restart",
1016 NO_STR
1017 "BGP specific commands\n"
1018 "Graceful restart capability parameters\n")
1019{
1020 struct bgp *bgp;
1021
1022 bgp = vty->index;
1023 bgp_flag_unset (bgp, BGP_FLAG_GRACEFUL_RESTART);
1024 return CMD_SUCCESS;
1025}
1026
hasso93406d82005-02-02 14:40:33 +00001027DEFUN (bgp_graceful_restart_stalepath_time,
1028 bgp_graceful_restart_stalepath_time_cmd,
1029 "bgp graceful-restart stalepath-time <1-3600>",
1030 "BGP specific commands\n"
1031 "Graceful restart capability parameters\n"
1032 "Set the max time to hold onto restarting peer's stale paths\n"
1033 "Delay value (seconds)\n")
1034{
1035 struct bgp *bgp;
1036 u_int32_t stalepath;
1037
1038 bgp = vty->index;
1039 if (! bgp)
1040 return CMD_WARNING;
1041
1042 VTY_GET_INTEGER_RANGE ("stalepath-time", stalepath, argv[0], 1, 3600);
1043 bgp->stalepath_time = stalepath;
1044 return CMD_SUCCESS;
1045}
1046
1047DEFUN (no_bgp_graceful_restart_stalepath_time,
1048 no_bgp_graceful_restart_stalepath_time_cmd,
1049 "no bgp graceful-restart stalepath-time",
1050 NO_STR
1051 "BGP specific commands\n"
1052 "Graceful restart capability parameters\n"
1053 "Set the max time to hold onto restarting peer's stale paths\n")
1054{
1055 struct bgp *bgp;
1056
1057 bgp = vty->index;
1058 if (! bgp)
1059 return CMD_WARNING;
1060
1061 bgp->stalepath_time = BGP_DEFAULT_STALEPATH_TIME;
1062 return CMD_SUCCESS;
1063}
1064
1065ALIAS (no_bgp_graceful_restart_stalepath_time,
1066 no_bgp_graceful_restart_stalepath_time_val_cmd,
1067 "no bgp graceful-restart stalepath-time <1-3600>",
1068 NO_STR
1069 "BGP specific commands\n"
1070 "Graceful restart capability parameters\n"
1071 "Set the max time to hold onto restarting peer's stale paths\n"
1072 "Delay value (seconds)\n")
1073
paul718e3742002-12-13 20:15:29 +00001074/* "bgp fast-external-failover" configuration. */
1075DEFUN (bgp_fast_external_failover,
1076 bgp_fast_external_failover_cmd,
1077 "bgp fast-external-failover",
1078 BGP_STR
1079 "Immediately reset session if a link to a directly connected external peer goes down\n")
1080{
1081 struct bgp *bgp;
1082
1083 bgp = vty->index;
1084 bgp_flag_unset (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER);
1085 return CMD_SUCCESS;
1086}
1087
1088DEFUN (no_bgp_fast_external_failover,
1089 no_bgp_fast_external_failover_cmd,
1090 "no bgp fast-external-failover",
1091 NO_STR
1092 BGP_STR
1093 "Immediately reset session if a link to a directly connected external peer goes down\n")
1094{
1095 struct bgp *bgp;
1096
1097 bgp = vty->index;
1098 bgp_flag_set (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER);
1099 return CMD_SUCCESS;
1100}
David Lamparter6b0655a2014-06-04 06:53:35 +02001101
paul718e3742002-12-13 20:15:29 +00001102/* "bgp enforce-first-as" configuration. */
1103DEFUN (bgp_enforce_first_as,
1104 bgp_enforce_first_as_cmd,
1105 "bgp enforce-first-as",
1106 BGP_STR
1107 "Enforce the first AS for EBGP routes\n")
1108{
1109 struct bgp *bgp;
1110
1111 bgp = vty->index;
1112 bgp_flag_set (bgp, BGP_FLAG_ENFORCE_FIRST_AS);
1113 return CMD_SUCCESS;
1114}
1115
1116DEFUN (no_bgp_enforce_first_as,
1117 no_bgp_enforce_first_as_cmd,
1118 "no bgp enforce-first-as",
1119 NO_STR
1120 BGP_STR
1121 "Enforce the first AS for EBGP routes\n")
1122{
1123 struct bgp *bgp;
1124
1125 bgp = vty->index;
1126 bgp_flag_unset (bgp, BGP_FLAG_ENFORCE_FIRST_AS);
1127 return CMD_SUCCESS;
1128}
David Lamparter6b0655a2014-06-04 06:53:35 +02001129
paul718e3742002-12-13 20:15:29 +00001130/* "bgp bestpath compare-routerid" configuration. */
1131DEFUN (bgp_bestpath_compare_router_id,
1132 bgp_bestpath_compare_router_id_cmd,
1133 "bgp bestpath compare-routerid",
1134 "BGP specific commands\n"
1135 "Change the default bestpath selection\n"
1136 "Compare router-id for identical EBGP paths\n")
1137{
1138 struct bgp *bgp;
1139
1140 bgp = vty->index;
1141 bgp_flag_set (bgp, BGP_FLAG_COMPARE_ROUTER_ID);
1142 return CMD_SUCCESS;
1143}
1144
1145DEFUN (no_bgp_bestpath_compare_router_id,
1146 no_bgp_bestpath_compare_router_id_cmd,
1147 "no bgp bestpath compare-routerid",
1148 NO_STR
1149 "BGP specific commands\n"
1150 "Change the default bestpath selection\n"
1151 "Compare router-id for identical EBGP paths\n")
1152{
1153 struct bgp *bgp;
1154
1155 bgp = vty->index;
1156 bgp_flag_unset (bgp, BGP_FLAG_COMPARE_ROUTER_ID);
1157 return CMD_SUCCESS;
1158}
David Lamparter6b0655a2014-06-04 06:53:35 +02001159
paul718e3742002-12-13 20:15:29 +00001160/* "bgp bestpath as-path ignore" configuration. */
1161DEFUN (bgp_bestpath_aspath_ignore,
1162 bgp_bestpath_aspath_ignore_cmd,
1163 "bgp bestpath as-path ignore",
1164 "BGP specific commands\n"
1165 "Change the default bestpath selection\n"
1166 "AS-path attribute\n"
1167 "Ignore as-path length in selecting a route\n")
1168{
1169 struct bgp *bgp;
1170
1171 bgp = vty->index;
1172 bgp_flag_set (bgp, BGP_FLAG_ASPATH_IGNORE);
1173 return CMD_SUCCESS;
1174}
1175
1176DEFUN (no_bgp_bestpath_aspath_ignore,
1177 no_bgp_bestpath_aspath_ignore_cmd,
1178 "no bgp bestpath as-path ignore",
1179 NO_STR
1180 "BGP specific commands\n"
1181 "Change the default bestpath selection\n"
1182 "AS-path attribute\n"
1183 "Ignore as-path length in selecting a route\n")
1184{
1185 struct bgp *bgp;
1186
1187 bgp = vty->index;
1188 bgp_flag_unset (bgp, BGP_FLAG_ASPATH_IGNORE);
1189 return CMD_SUCCESS;
1190}
David Lamparter6b0655a2014-06-04 06:53:35 +02001191
hasso68118452005-04-08 15:40:36 +00001192/* "bgp bestpath as-path confed" configuration. */
1193DEFUN (bgp_bestpath_aspath_confed,
1194 bgp_bestpath_aspath_confed_cmd,
1195 "bgp bestpath as-path confed",
1196 "BGP specific commands\n"
1197 "Change the default bestpath selection\n"
1198 "AS-path attribute\n"
1199 "Compare path lengths including confederation sets & sequences in selecting a route\n")
1200{
1201 struct bgp *bgp;
1202
1203 bgp = vty->index;
1204 bgp_flag_set (bgp, BGP_FLAG_ASPATH_CONFED);
1205 return CMD_SUCCESS;
1206}
1207
1208DEFUN (no_bgp_bestpath_aspath_confed,
1209 no_bgp_bestpath_aspath_confed_cmd,
1210 "no bgp bestpath as-path confed",
1211 NO_STR
1212 "BGP specific commands\n"
1213 "Change the default bestpath selection\n"
1214 "AS-path attribute\n"
1215 "Compare path lengths including confederation sets & sequences in selecting a route\n")
1216{
1217 struct bgp *bgp;
1218
1219 bgp = vty->index;
1220 bgp_flag_unset (bgp, BGP_FLAG_ASPATH_CONFED);
1221 return CMD_SUCCESS;
1222}
David Lamparter6b0655a2014-06-04 06:53:35 +02001223
Pradosh Mohapatra2fdd4552013-09-07 07:02:36 +00001224/* "bgp bestpath as-path multipath-relax" configuration. */
1225DEFUN (bgp_bestpath_aspath_multipath_relax,
1226 bgp_bestpath_aspath_multipath_relax_cmd,
1227 "bgp bestpath as-path multipath-relax",
1228 "BGP specific commands\n"
1229 "Change the default bestpath selection\n"
1230 "AS-path attribute\n"
1231 "Allow load sharing across routes that have different AS paths (but same length)\n")
1232{
1233 struct bgp *bgp;
1234
1235 bgp = vty->index;
1236 bgp_flag_set (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX);
1237 return CMD_SUCCESS;
1238}
1239
1240DEFUN (no_bgp_bestpath_aspath_multipath_relax,
1241 no_bgp_bestpath_aspath_multipath_relax_cmd,
1242 "no bgp bestpath as-path multipath-relax",
1243 NO_STR
1244 "BGP specific commands\n"
1245 "Change the default bestpath selection\n"
1246 "AS-path attribute\n"
1247 "Allow load sharing across routes that have different AS paths (but same length)\n")
1248{
1249 struct bgp *bgp;
1250
1251 bgp = vty->index;
1252 bgp_flag_unset (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX);
1253 return CMD_SUCCESS;
1254}
David Lamparter6b0655a2014-06-04 06:53:35 +02001255
paul848973c2003-08-13 00:32:49 +00001256/* "bgp log-neighbor-changes" configuration. */
1257DEFUN (bgp_log_neighbor_changes,
1258 bgp_log_neighbor_changes_cmd,
1259 "bgp log-neighbor-changes",
1260 "BGP specific commands\n"
1261 "Log neighbor up/down and reset reason\n")
1262{
1263 struct bgp *bgp;
1264
1265 bgp = vty->index;
1266 bgp_flag_set (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES);
1267 return CMD_SUCCESS;
1268}
1269
1270DEFUN (no_bgp_log_neighbor_changes,
1271 no_bgp_log_neighbor_changes_cmd,
1272 "no bgp log-neighbor-changes",
1273 NO_STR
1274 "BGP specific commands\n"
1275 "Log neighbor up/down and reset reason\n")
1276{
1277 struct bgp *bgp;
1278
1279 bgp = vty->index;
1280 bgp_flag_unset (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES);
1281 return CMD_SUCCESS;
1282}
David Lamparter6b0655a2014-06-04 06:53:35 +02001283
paul718e3742002-12-13 20:15:29 +00001284/* "bgp bestpath med" configuration. */
1285DEFUN (bgp_bestpath_med,
1286 bgp_bestpath_med_cmd,
1287 "bgp bestpath med (confed|missing-as-worst)",
1288 "BGP specific commands\n"
1289 "Change the default bestpath selection\n"
1290 "MED attribute\n"
1291 "Compare MED among confederation paths\n"
1292 "Treat missing MED as the least preferred one\n")
1293{
1294 struct bgp *bgp;
1295
1296 bgp = vty->index;
1297
1298 if (strncmp (argv[0], "confed", 1) == 0)
1299 bgp_flag_set (bgp, BGP_FLAG_MED_CONFED);
1300 else
1301 bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1302
1303 return CMD_SUCCESS;
1304}
1305
1306DEFUN (bgp_bestpath_med2,
1307 bgp_bestpath_med2_cmd,
1308 "bgp bestpath med confed missing-as-worst",
1309 "BGP specific commands\n"
1310 "Change the default bestpath selection\n"
1311 "MED attribute\n"
1312 "Compare MED among confederation paths\n"
1313 "Treat missing MED as the least preferred one\n")
1314{
1315 struct bgp *bgp;
1316
1317 bgp = vty->index;
1318 bgp_flag_set (bgp, BGP_FLAG_MED_CONFED);
1319 bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1320 return CMD_SUCCESS;
1321}
1322
1323ALIAS (bgp_bestpath_med2,
1324 bgp_bestpath_med3_cmd,
1325 "bgp bestpath med missing-as-worst confed",
1326 "BGP specific commands\n"
1327 "Change the default bestpath selection\n"
1328 "MED attribute\n"
1329 "Treat missing MED as the least preferred one\n"
1330 "Compare MED among confederation paths\n")
1331
1332DEFUN (no_bgp_bestpath_med,
1333 no_bgp_bestpath_med_cmd,
1334 "no bgp bestpath med (confed|missing-as-worst)",
1335 NO_STR
1336 "BGP specific commands\n"
1337 "Change the default bestpath selection\n"
1338 "MED attribute\n"
1339 "Compare MED among confederation paths\n"
1340 "Treat missing MED as the least preferred one\n")
1341{
1342 struct bgp *bgp;
1343
1344 bgp = vty->index;
1345
1346 if (strncmp (argv[0], "confed", 1) == 0)
1347 bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED);
1348 else
1349 bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1350
1351 return CMD_SUCCESS;
1352}
1353
1354DEFUN (no_bgp_bestpath_med2,
1355 no_bgp_bestpath_med2_cmd,
1356 "no bgp bestpath med confed missing-as-worst",
1357 NO_STR
1358 "BGP specific commands\n"
1359 "Change the default bestpath selection\n"
1360 "MED attribute\n"
1361 "Compare MED among confederation paths\n"
1362 "Treat missing MED as the least preferred one\n")
1363{
1364 struct bgp *bgp;
1365
1366 bgp = vty->index;
1367 bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED);
1368 bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1369 return CMD_SUCCESS;
1370}
1371
1372ALIAS (no_bgp_bestpath_med2,
1373 no_bgp_bestpath_med3_cmd,
1374 "no bgp bestpath med missing-as-worst confed",
1375 NO_STR
1376 "BGP specific commands\n"
1377 "Change the default bestpath selection\n"
1378 "MED attribute\n"
1379 "Treat missing MED as the least preferred one\n"
1380 "Compare MED among confederation paths\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02001381
paul718e3742002-12-13 20:15:29 +00001382/* "no bgp default ipv4-unicast". */
1383DEFUN (no_bgp_default_ipv4_unicast,
1384 no_bgp_default_ipv4_unicast_cmd,
1385 "no bgp default ipv4-unicast",
1386 NO_STR
1387 "BGP specific commands\n"
1388 "Configure BGP defaults\n"
1389 "Activate ipv4-unicast for a peer by default\n")
1390{
1391 struct bgp *bgp;
1392
1393 bgp = vty->index;
1394 bgp_flag_set (bgp, BGP_FLAG_NO_DEFAULT_IPV4);
1395 return CMD_SUCCESS;
1396}
1397
1398DEFUN (bgp_default_ipv4_unicast,
1399 bgp_default_ipv4_unicast_cmd,
1400 "bgp default ipv4-unicast",
1401 "BGP specific commands\n"
1402 "Configure BGP defaults\n"
1403 "Activate ipv4-unicast for a peer by default\n")
1404{
1405 struct bgp *bgp;
1406
1407 bgp = vty->index;
1408 bgp_flag_unset (bgp, BGP_FLAG_NO_DEFAULT_IPV4);
1409 return CMD_SUCCESS;
1410}
David Lamparter6b0655a2014-06-04 06:53:35 +02001411
paul718e3742002-12-13 20:15:29 +00001412/* "bgp import-check" configuration. */
1413DEFUN (bgp_network_import_check,
1414 bgp_network_import_check_cmd,
1415 "bgp network import-check",
1416 "BGP specific commands\n"
1417 "BGP network command\n"
1418 "Check BGP network route exists in IGP\n")
1419{
1420 struct bgp *bgp;
1421
1422 bgp = vty->index;
1423 bgp_flag_set (bgp, BGP_FLAG_IMPORT_CHECK);
1424 return CMD_SUCCESS;
1425}
1426
1427DEFUN (no_bgp_network_import_check,
1428 no_bgp_network_import_check_cmd,
1429 "no bgp network import-check",
1430 NO_STR
1431 "BGP specific commands\n"
1432 "BGP network command\n"
1433 "Check BGP network route exists in IGP\n")
1434{
1435 struct bgp *bgp;
1436
1437 bgp = vty->index;
1438 bgp_flag_unset (bgp, BGP_FLAG_IMPORT_CHECK);
1439 return CMD_SUCCESS;
1440}
David Lamparter6b0655a2014-06-04 06:53:35 +02001441
paul718e3742002-12-13 20:15:29 +00001442DEFUN (bgp_default_local_preference,
1443 bgp_default_local_preference_cmd,
1444 "bgp default local-preference <0-4294967295>",
1445 "BGP specific commands\n"
1446 "Configure BGP defaults\n"
1447 "local preference (higher=more preferred)\n"
1448 "Configure default local preference value\n")
1449{
1450 struct bgp *bgp;
1451 u_int32_t local_pref;
1452
1453 bgp = vty->index;
1454
1455 VTY_GET_INTEGER ("local preference", local_pref, argv[0]);
1456
1457 bgp_default_local_preference_set (bgp, local_pref);
1458
1459 return CMD_SUCCESS;
1460}
1461
1462DEFUN (no_bgp_default_local_preference,
1463 no_bgp_default_local_preference_cmd,
1464 "no bgp default local-preference",
1465 NO_STR
1466 "BGP specific commands\n"
1467 "Configure BGP defaults\n"
1468 "local preference (higher=more preferred)\n")
1469{
1470 struct bgp *bgp;
1471
1472 bgp = vty->index;
1473 bgp_default_local_preference_unset (bgp);
1474 return CMD_SUCCESS;
1475}
1476
1477ALIAS (no_bgp_default_local_preference,
1478 no_bgp_default_local_preference_val_cmd,
1479 "no bgp default local-preference <0-4294967295>",
1480 NO_STR
1481 "BGP specific commands\n"
1482 "Configure BGP defaults\n"
1483 "local preference (higher=more preferred)\n"
1484 "Configure default local preference value\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02001485
paul718e3742002-12-13 20:15:29 +00001486static int
paulfd79ac92004-10-13 05:06:08 +00001487peer_remote_as_vty (struct vty *vty, const char *peer_str,
1488 const char *as_str, afi_t afi, safi_t safi)
paul718e3742002-12-13 20:15:29 +00001489{
1490 int ret;
1491 struct bgp *bgp;
1492 as_t as;
1493 union sockunion su;
1494
1495 bgp = vty->index;
1496
1497 /* Get AS number. */
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00001498 VTY_GET_INTEGER_RANGE ("AS", as, as_str, 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +00001499
1500 /* If peer is peer group, call proper function. */
1501 ret = str2sockunion (peer_str, &su);
1502 if (ret < 0)
1503 {
1504 ret = peer_group_remote_as (bgp, peer_str, &as);
1505 if (ret < 0)
1506 {
1507 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1508 return CMD_WARNING;
1509 }
1510 return CMD_SUCCESS;
1511 }
1512
1513 if (peer_address_self_check (&su))
1514 {
1515 vty_out (vty, "%% Can not configure the local system as neighbor%s",
1516 VTY_NEWLINE);
1517 return CMD_WARNING;
1518 }
1519
1520 ret = peer_remote_as (bgp, &su, &as, afi, safi);
1521
1522 /* This peer belongs to peer group. */
1523 switch (ret)
1524 {
1525 case BGP_ERR_PEER_GROUP_MEMBER:
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04001526 vty_out (vty, "%% Peer-group AS %u. Cannot configure remote-as for member%s", as, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00001527 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00001528 case BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT:
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04001529 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 +00001530 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00001531 }
1532 return bgp_vty_return (vty, ret);
1533}
1534
1535DEFUN (neighbor_remote_as,
1536 neighbor_remote_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001537 NEIGHBOR_CMD2 "remote-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001538 NEIGHBOR_STR
1539 NEIGHBOR_ADDR_STR2
1540 "Specify a BGP neighbor\n"
1541 AS_STR)
1542{
1543 return peer_remote_as_vty (vty, argv[0], argv[1], AFI_IP, SAFI_UNICAST);
1544}
David Lamparter6b0655a2014-06-04 06:53:35 +02001545
paul718e3742002-12-13 20:15:29 +00001546DEFUN (neighbor_peer_group,
1547 neighbor_peer_group_cmd,
1548 "neighbor WORD peer-group",
1549 NEIGHBOR_STR
1550 "Neighbor tag\n"
1551 "Configure peer-group\n")
1552{
1553 struct bgp *bgp;
1554 struct peer_group *group;
1555
1556 bgp = vty->index;
1557
1558 group = peer_group_get (bgp, argv[0]);
1559 if (! group)
1560 return CMD_WARNING;
1561
1562 return CMD_SUCCESS;
1563}
1564
1565DEFUN (no_neighbor,
1566 no_neighbor_cmd,
1567 NO_NEIGHBOR_CMD2,
1568 NO_STR
1569 NEIGHBOR_STR
1570 NEIGHBOR_ADDR_STR2)
1571{
1572 int ret;
1573 union sockunion su;
1574 struct peer_group *group;
1575 struct peer *peer;
1576
1577 ret = str2sockunion (argv[0], &su);
1578 if (ret < 0)
1579 {
1580 group = peer_group_lookup (vty->index, argv[0]);
1581 if (group)
1582 peer_group_delete (group);
1583 else
1584 {
1585 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1586 return CMD_WARNING;
1587 }
1588 }
1589 else
1590 {
1591 peer = peer_lookup (vty->index, &su);
1592 if (peer)
paul200df112005-06-01 11:17:05 +00001593 peer_delete (peer);
paul718e3742002-12-13 20:15:29 +00001594 }
1595
1596 return CMD_SUCCESS;
1597}
1598
1599ALIAS (no_neighbor,
1600 no_neighbor_remote_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001601 NO_NEIGHBOR_CMD "remote-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001602 NO_STR
1603 NEIGHBOR_STR
1604 NEIGHBOR_ADDR_STR
1605 "Specify a BGP neighbor\n"
1606 AS_STR)
1607
1608DEFUN (no_neighbor_peer_group,
1609 no_neighbor_peer_group_cmd,
1610 "no neighbor WORD peer-group",
1611 NO_STR
1612 NEIGHBOR_STR
1613 "Neighbor tag\n"
1614 "Configure peer-group\n")
1615{
1616 struct peer_group *group;
1617
1618 group = peer_group_lookup (vty->index, argv[0]);
1619 if (group)
1620 peer_group_delete (group);
1621 else
1622 {
1623 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1624 return CMD_WARNING;
1625 }
1626 return CMD_SUCCESS;
1627}
1628
1629DEFUN (no_neighbor_peer_group_remote_as,
1630 no_neighbor_peer_group_remote_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001631 "no neighbor WORD remote-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001632 NO_STR
1633 NEIGHBOR_STR
1634 "Neighbor tag\n"
1635 "Specify a BGP neighbor\n"
1636 AS_STR)
1637{
1638 struct peer_group *group;
1639
1640 group = peer_group_lookup (vty->index, argv[0]);
1641 if (group)
1642 peer_group_remote_as_delete (group);
1643 else
1644 {
1645 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1646 return CMD_WARNING;
1647 }
1648 return CMD_SUCCESS;
1649}
David Lamparter6b0655a2014-06-04 06:53:35 +02001650
paul718e3742002-12-13 20:15:29 +00001651DEFUN (neighbor_local_as,
1652 neighbor_local_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001653 NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001654 NEIGHBOR_STR
1655 NEIGHBOR_ADDR_STR2
1656 "Specify a local-as number\n"
1657 "AS number used as local AS\n")
1658{
1659 struct peer *peer;
1660 int ret;
1661
1662 peer = peer_and_group_lookup_vty (vty, argv[0]);
1663 if (! peer)
1664 return CMD_WARNING;
1665
Andrew Certain9d3f9702012-11-07 23:50:07 +00001666 ret = peer_local_as_set (peer, atoi (argv[1]), 0, 0);
paul718e3742002-12-13 20:15:29 +00001667 return bgp_vty_return (vty, ret);
1668}
1669
1670DEFUN (neighbor_local_as_no_prepend,
1671 neighbor_local_as_no_prepend_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001672 NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend",
paul718e3742002-12-13 20:15:29 +00001673 NEIGHBOR_STR
1674 NEIGHBOR_ADDR_STR2
1675 "Specify a local-as number\n"
1676 "AS number used as local AS\n"
1677 "Do not prepend local-as to updates from ebgp peers\n")
1678{
1679 struct peer *peer;
1680 int ret;
1681
1682 peer = peer_and_group_lookup_vty (vty, argv[0]);
1683 if (! peer)
1684 return CMD_WARNING;
1685
Andrew Certain9d3f9702012-11-07 23:50:07 +00001686 ret = peer_local_as_set (peer, atoi (argv[1]), 1, 0);
paul718e3742002-12-13 20:15:29 +00001687 return bgp_vty_return (vty, ret);
1688}
1689
Andrew Certain9d3f9702012-11-07 23:50:07 +00001690DEFUN (neighbor_local_as_no_prepend_replace_as,
1691 neighbor_local_as_no_prepend_replace_as_cmd,
1692 NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as",
1693 NEIGHBOR_STR
1694 NEIGHBOR_ADDR_STR2
1695 "Specify a local-as number\n"
1696 "AS number used as local AS\n"
1697 "Do not prepend local-as to updates from ebgp peers\n"
1698 "Do not prepend local-as to updates from ibgp peers\n")
1699{
1700 struct peer *peer;
1701 int ret;
1702
1703 peer = peer_and_group_lookup_vty (vty, argv[0]);
1704 if (! peer)
1705 return CMD_WARNING;
1706
1707 ret = peer_local_as_set (peer, atoi (argv[1]), 1, 1);
1708 return bgp_vty_return (vty, ret);
1709}
1710
1711
paul718e3742002-12-13 20:15:29 +00001712DEFUN (no_neighbor_local_as,
1713 no_neighbor_local_as_cmd,
1714 NO_NEIGHBOR_CMD2 "local-as",
1715 NO_STR
1716 NEIGHBOR_STR
1717 NEIGHBOR_ADDR_STR2
1718 "Specify a local-as number\n")
1719{
1720 struct peer *peer;
1721 int ret;
1722
1723 peer = peer_and_group_lookup_vty (vty, argv[0]);
1724 if (! peer)
1725 return CMD_WARNING;
1726
1727 ret = peer_local_as_unset (peer);
1728 return bgp_vty_return (vty, ret);
1729}
1730
1731ALIAS (no_neighbor_local_as,
1732 no_neighbor_local_as_val_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001733 NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001734 NO_STR
1735 NEIGHBOR_STR
1736 NEIGHBOR_ADDR_STR2
1737 "Specify a local-as number\n"
1738 "AS number used as local AS\n")
1739
1740ALIAS (no_neighbor_local_as,
1741 no_neighbor_local_as_val2_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001742 NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend",
paul718e3742002-12-13 20:15:29 +00001743 NO_STR
1744 NEIGHBOR_STR
1745 NEIGHBOR_ADDR_STR2
1746 "Specify a local-as number\n"
1747 "AS number used as local AS\n"
1748 "Do not prepend local-as to updates from ebgp peers\n")
Andrew Certain9d3f9702012-11-07 23:50:07 +00001749
1750ALIAS (no_neighbor_local_as,
1751 no_neighbor_local_as_val3_cmd,
1752 NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as",
1753 NO_STR
1754 NEIGHBOR_STR
1755 NEIGHBOR_ADDR_STR2
1756 "Specify a local-as number\n"
1757 "AS number used as local AS\n"
1758 "Do not prepend local-as to updates from ebgp peers\n"
1759 "Do not prepend local-as to updates from ibgp peers\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02001760
Paul Jakma0df7c912008-07-21 21:02:49 +00001761DEFUN (neighbor_password,
1762 neighbor_password_cmd,
1763 NEIGHBOR_CMD2 "password LINE",
1764 NEIGHBOR_STR
1765 NEIGHBOR_ADDR_STR2
1766 "Set a password\n"
1767 "The password\n")
1768{
1769 struct peer *peer;
1770 int ret;
1771
1772 peer = peer_and_group_lookup_vty (vty, argv[0]);
1773 if (! peer)
1774 return CMD_WARNING;
1775
1776 ret = peer_password_set (peer, argv[1]);
1777 return bgp_vty_return (vty, ret);
1778}
1779
1780DEFUN (no_neighbor_password,
1781 no_neighbor_password_cmd,
1782 NO_NEIGHBOR_CMD2 "password",
1783 NO_STR
1784 NEIGHBOR_STR
1785 NEIGHBOR_ADDR_STR2
1786 "Set a password\n")
1787{
1788 struct peer *peer;
1789 int ret;
1790
1791 peer = peer_and_group_lookup_vty (vty, argv[0]);
1792 if (! peer)
1793 return CMD_WARNING;
1794
1795 ret = peer_password_unset (peer);
1796 return bgp_vty_return (vty, ret);
1797}
David Lamparter6b0655a2014-06-04 06:53:35 +02001798
paul718e3742002-12-13 20:15:29 +00001799DEFUN (neighbor_activate,
1800 neighbor_activate_cmd,
1801 NEIGHBOR_CMD2 "activate",
1802 NEIGHBOR_STR
1803 NEIGHBOR_ADDR_STR2
1804 "Enable the Address Family for this Neighbor\n")
1805{
1806 struct peer *peer;
1807
1808 peer = peer_and_group_lookup_vty (vty, argv[0]);
1809 if (! peer)
1810 return CMD_WARNING;
1811
1812 peer_activate (peer, bgp_node_afi (vty), bgp_node_safi (vty));
1813
1814 return CMD_SUCCESS;
1815}
1816
1817DEFUN (no_neighbor_activate,
1818 no_neighbor_activate_cmd,
1819 NO_NEIGHBOR_CMD2 "activate",
1820 NO_STR
1821 NEIGHBOR_STR
1822 NEIGHBOR_ADDR_STR2
1823 "Enable the Address Family for this Neighbor\n")
1824{
1825 int ret;
1826 struct peer *peer;
1827
1828 /* Lookup peer. */
1829 peer = peer_and_group_lookup_vty (vty, argv[0]);
1830 if (! peer)
1831 return CMD_WARNING;
1832
1833 ret = peer_deactivate (peer, bgp_node_afi (vty), bgp_node_safi (vty));
1834
1835 return bgp_vty_return (vty, ret);
1836}
David Lamparter6b0655a2014-06-04 06:53:35 +02001837
paul718e3742002-12-13 20:15:29 +00001838DEFUN (neighbor_set_peer_group,
1839 neighbor_set_peer_group_cmd,
1840 NEIGHBOR_CMD "peer-group WORD",
1841 NEIGHBOR_STR
1842 NEIGHBOR_ADDR_STR
1843 "Member of the peer-group\n"
1844 "peer-group name\n")
1845{
1846 int ret;
1847 as_t as;
1848 union sockunion su;
1849 struct bgp *bgp;
1850 struct peer_group *group;
1851
1852 bgp = vty->index;
1853
1854 ret = str2sockunion (argv[0], &su);
1855 if (ret < 0)
1856 {
1857 vty_out (vty, "%% Malformed address: %s%s", argv[0], VTY_NEWLINE);
1858 return CMD_WARNING;
1859 }
1860
1861 group = peer_group_lookup (bgp, argv[1]);
1862 if (! group)
1863 {
1864 vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE);
1865 return CMD_WARNING;
1866 }
1867
1868 if (peer_address_self_check (&su))
1869 {
1870 vty_out (vty, "%% Can not configure the local system as neighbor%s",
1871 VTY_NEWLINE);
1872 return CMD_WARNING;
1873 }
1874
1875 ret = peer_group_bind (bgp, &su, group, bgp_node_afi (vty),
1876 bgp_node_safi (vty), &as);
1877
1878 if (ret == BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT)
1879 {
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04001880 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 +00001881 return CMD_WARNING;
1882 }
1883
1884 return bgp_vty_return (vty, ret);
1885}
1886
1887DEFUN (no_neighbor_set_peer_group,
1888 no_neighbor_set_peer_group_cmd,
1889 NO_NEIGHBOR_CMD "peer-group WORD",
1890 NO_STR
1891 NEIGHBOR_STR
1892 NEIGHBOR_ADDR_STR
1893 "Member of the peer-group\n"
1894 "peer-group name\n")
1895{
1896 int ret;
1897 struct bgp *bgp;
1898 struct peer *peer;
1899 struct peer_group *group;
1900
1901 bgp = vty->index;
1902
1903 peer = peer_lookup_vty (vty, argv[0]);
1904 if (! peer)
1905 return CMD_WARNING;
1906
1907 group = peer_group_lookup (bgp, argv[1]);
1908 if (! group)
1909 {
1910 vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE);
1911 return CMD_WARNING;
1912 }
1913
1914 ret = peer_group_unbind (bgp, peer, group, bgp_node_afi (vty),
1915 bgp_node_safi (vty));
1916
1917 return bgp_vty_return (vty, ret);
1918}
David Lamparter6b0655a2014-06-04 06:53:35 +02001919
paul94f2b392005-06-28 12:44:16 +00001920static int
paulfd79ac92004-10-13 05:06:08 +00001921peer_flag_modify_vty (struct vty *vty, const char *ip_str,
1922 u_int16_t flag, int set)
paul718e3742002-12-13 20:15:29 +00001923{
1924 int ret;
1925 struct peer *peer;
1926
1927 peer = peer_and_group_lookup_vty (vty, ip_str);
1928 if (! peer)
1929 return CMD_WARNING;
1930
1931 if (set)
1932 ret = peer_flag_set (peer, flag);
1933 else
1934 ret = peer_flag_unset (peer, flag);
1935
1936 return bgp_vty_return (vty, ret);
1937}
1938
paul94f2b392005-06-28 12:44:16 +00001939static int
paulfd79ac92004-10-13 05:06:08 +00001940peer_flag_set_vty (struct vty *vty, const char *ip_str, u_int16_t flag)
paul718e3742002-12-13 20:15:29 +00001941{
1942 return peer_flag_modify_vty (vty, ip_str, flag, 1);
1943}
1944
paul94f2b392005-06-28 12:44:16 +00001945static int
paulfd79ac92004-10-13 05:06:08 +00001946peer_flag_unset_vty (struct vty *vty, const char *ip_str, u_int16_t flag)
paul718e3742002-12-13 20:15:29 +00001947{
1948 return peer_flag_modify_vty (vty, ip_str, flag, 0);
1949}
1950
1951/* neighbor passive. */
1952DEFUN (neighbor_passive,
1953 neighbor_passive_cmd,
1954 NEIGHBOR_CMD2 "passive",
1955 NEIGHBOR_STR
1956 NEIGHBOR_ADDR_STR2
1957 "Don't send open messages to this neighbor\n")
1958{
1959 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_PASSIVE);
1960}
1961
1962DEFUN (no_neighbor_passive,
1963 no_neighbor_passive_cmd,
1964 NO_NEIGHBOR_CMD2 "passive",
1965 NO_STR
1966 NEIGHBOR_STR
1967 NEIGHBOR_ADDR_STR2
1968 "Don't send open messages to this neighbor\n")
1969{
1970 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_PASSIVE);
1971}
David Lamparter6b0655a2014-06-04 06:53:35 +02001972
paul718e3742002-12-13 20:15:29 +00001973/* neighbor shutdown. */
1974DEFUN (neighbor_shutdown,
1975 neighbor_shutdown_cmd,
1976 NEIGHBOR_CMD2 "shutdown",
1977 NEIGHBOR_STR
1978 NEIGHBOR_ADDR_STR2
1979 "Administratively shut down this neighbor\n")
1980{
1981 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_SHUTDOWN);
1982}
1983
1984DEFUN (no_neighbor_shutdown,
1985 no_neighbor_shutdown_cmd,
1986 NO_NEIGHBOR_CMD2 "shutdown",
1987 NO_STR
1988 NEIGHBOR_STR
1989 NEIGHBOR_ADDR_STR2
1990 "Administratively shut down this neighbor\n")
1991{
1992 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_SHUTDOWN);
1993}
David Lamparter6b0655a2014-06-04 06:53:35 +02001994
hassoc9502432005-02-01 22:01:48 +00001995/* Deprecated neighbor capability route-refresh. */
1996DEFUN_DEPRECATED (neighbor_capability_route_refresh,
1997 neighbor_capability_route_refresh_cmd,
1998 NEIGHBOR_CMD2 "capability route-refresh",
1999 NEIGHBOR_STR
2000 NEIGHBOR_ADDR_STR2
2001 "Advertise capability to the peer\n"
2002 "Advertise route-refresh capability to this neighbor\n")
paul718e3742002-12-13 20:15:29 +00002003{
hassoc9502432005-02-01 22:01:48 +00002004 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00002005}
2006
hassoc9502432005-02-01 22:01:48 +00002007DEFUN_DEPRECATED (no_neighbor_capability_route_refresh,
2008 no_neighbor_capability_route_refresh_cmd,
2009 NO_NEIGHBOR_CMD2 "capability route-refresh",
2010 NO_STR
2011 NEIGHBOR_STR
2012 NEIGHBOR_ADDR_STR2
2013 "Advertise capability to the peer\n"
2014 "Advertise route-refresh capability to this neighbor\n")
paul718e3742002-12-13 20:15:29 +00002015{
hassoc9502432005-02-01 22:01:48 +00002016 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00002017}
David Lamparter6b0655a2014-06-04 06:53:35 +02002018
paul718e3742002-12-13 20:15:29 +00002019/* neighbor capability dynamic. */
2020DEFUN (neighbor_capability_dynamic,
2021 neighbor_capability_dynamic_cmd,
2022 NEIGHBOR_CMD2 "capability dynamic",
2023 NEIGHBOR_STR
2024 NEIGHBOR_ADDR_STR2
2025 "Advertise capability to the peer\n"
2026 "Advertise dynamic capability to this neighbor\n")
2027{
2028 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY);
2029}
2030
2031DEFUN (no_neighbor_capability_dynamic,
2032 no_neighbor_capability_dynamic_cmd,
2033 NO_NEIGHBOR_CMD2 "capability dynamic",
2034 NO_STR
2035 NEIGHBOR_STR
2036 NEIGHBOR_ADDR_STR2
2037 "Advertise capability to the peer\n"
2038 "Advertise dynamic capability to this neighbor\n")
2039{
2040 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY);
2041}
David Lamparter6b0655a2014-06-04 06:53:35 +02002042
paul718e3742002-12-13 20:15:29 +00002043/* neighbor dont-capability-negotiate */
2044DEFUN (neighbor_dont_capability_negotiate,
2045 neighbor_dont_capability_negotiate_cmd,
2046 NEIGHBOR_CMD2 "dont-capability-negotiate",
2047 NEIGHBOR_STR
2048 NEIGHBOR_ADDR_STR2
2049 "Do not perform capability negotiation\n")
2050{
2051 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY);
2052}
2053
2054DEFUN (no_neighbor_dont_capability_negotiate,
2055 no_neighbor_dont_capability_negotiate_cmd,
2056 NO_NEIGHBOR_CMD2 "dont-capability-negotiate",
2057 NO_STR
2058 NEIGHBOR_STR
2059 NEIGHBOR_ADDR_STR2
2060 "Do not perform capability negotiation\n")
2061{
2062 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY);
2063}
David Lamparter6b0655a2014-06-04 06:53:35 +02002064
paul94f2b392005-06-28 12:44:16 +00002065static int
paulfd79ac92004-10-13 05:06:08 +00002066peer_af_flag_modify_vty (struct vty *vty, const char *peer_str, afi_t afi,
paulfee0f4c2004-09-13 05:12:46 +00002067 safi_t safi, u_int32_t flag, int set)
paul718e3742002-12-13 20:15:29 +00002068{
2069 int ret;
2070 struct peer *peer;
2071
2072 peer = peer_and_group_lookup_vty (vty, peer_str);
2073 if (! peer)
2074 return CMD_WARNING;
2075
2076 if (set)
2077 ret = peer_af_flag_set (peer, afi, safi, flag);
2078 else
2079 ret = peer_af_flag_unset (peer, afi, safi, flag);
2080
2081 return bgp_vty_return (vty, ret);
2082}
2083
paul94f2b392005-06-28 12:44:16 +00002084static int
paulfd79ac92004-10-13 05:06:08 +00002085peer_af_flag_set_vty (struct vty *vty, const char *peer_str, afi_t afi,
paulfee0f4c2004-09-13 05:12:46 +00002086 safi_t safi, u_int32_t flag)
paul718e3742002-12-13 20:15:29 +00002087{
2088 return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 1);
2089}
2090
paul94f2b392005-06-28 12:44:16 +00002091static int
paulfd79ac92004-10-13 05:06:08 +00002092peer_af_flag_unset_vty (struct vty *vty, const char *peer_str, afi_t afi,
paulfee0f4c2004-09-13 05:12:46 +00002093 safi_t safi, u_int32_t flag)
paul718e3742002-12-13 20:15:29 +00002094{
2095 return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 0);
2096}
David Lamparter6b0655a2014-06-04 06:53:35 +02002097
paul718e3742002-12-13 20:15:29 +00002098/* neighbor capability orf prefix-list. */
2099DEFUN (neighbor_capability_orf_prefix,
2100 neighbor_capability_orf_prefix_cmd,
2101 NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)",
2102 NEIGHBOR_STR
2103 NEIGHBOR_ADDR_STR2
2104 "Advertise capability to the peer\n"
2105 "Advertise ORF capability to the peer\n"
2106 "Advertise prefixlist ORF capability to this neighbor\n"
2107 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
2108 "Capability to RECEIVE the ORF from this neighbor\n"
2109 "Capability to SEND the ORF to this neighbor\n")
2110{
2111 u_int16_t flag = 0;
2112
2113 if (strncmp (argv[1], "s", 1) == 0)
2114 flag = PEER_FLAG_ORF_PREFIX_SM;
2115 else if (strncmp (argv[1], "r", 1) == 0)
2116 flag = PEER_FLAG_ORF_PREFIX_RM;
2117 else if (strncmp (argv[1], "b", 1) == 0)
2118 flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM;
2119 else
2120 return CMD_WARNING;
2121
2122 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2123 bgp_node_safi (vty), flag);
2124}
2125
2126DEFUN (no_neighbor_capability_orf_prefix,
2127 no_neighbor_capability_orf_prefix_cmd,
2128 NO_NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)",
2129 NO_STR
2130 NEIGHBOR_STR
2131 NEIGHBOR_ADDR_STR2
2132 "Advertise capability to the peer\n"
2133 "Advertise ORF capability to the peer\n"
2134 "Advertise prefixlist ORF capability to this neighbor\n"
2135 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
2136 "Capability to RECEIVE the ORF from this neighbor\n"
2137 "Capability to SEND the ORF to this neighbor\n")
2138{
2139 u_int16_t flag = 0;
2140
2141 if (strncmp (argv[1], "s", 1) == 0)
2142 flag = PEER_FLAG_ORF_PREFIX_SM;
2143 else if (strncmp (argv[1], "r", 1) == 0)
2144 flag = PEER_FLAG_ORF_PREFIX_RM;
2145 else if (strncmp (argv[1], "b", 1) == 0)
2146 flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM;
2147 else
2148 return CMD_WARNING;
2149
2150 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2151 bgp_node_safi (vty), flag);
2152}
David Lamparter6b0655a2014-06-04 06:53:35 +02002153
paul718e3742002-12-13 20:15:29 +00002154/* neighbor next-hop-self. */
2155DEFUN (neighbor_nexthop_self,
2156 neighbor_nexthop_self_cmd,
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002157 NEIGHBOR_CMD2 "next-hop-self {all}",
paul718e3742002-12-13 20:15:29 +00002158 NEIGHBOR_STR
2159 NEIGHBOR_ADDR_STR2
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002160 "Disable the next hop calculation for this neighbor\n"
2161 "Apply also to ibgp-learned routes when acting as a route reflector\n")
paul718e3742002-12-13 20:15:29 +00002162{
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002163 u_int32_t flags = PEER_FLAG_NEXTHOP_SELF, unset = 0;
2164 int rc;
2165
2166 /* Check if "all" is specified */
2167 if (argv[1] != NULL)
2168 flags |= PEER_FLAG_NEXTHOP_SELF_ALL;
2169 else
2170 unset |= PEER_FLAG_NEXTHOP_SELF_ALL;
2171
2172 rc = peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2173 bgp_node_safi (vty), flags);
2174 if ( rc == CMD_SUCCESS && unset )
2175 rc = peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2176 bgp_node_safi (vty), unset);
2177 return rc;
paul718e3742002-12-13 20:15:29 +00002178}
2179
2180DEFUN (no_neighbor_nexthop_self,
2181 no_neighbor_nexthop_self_cmd,
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002182 NO_NEIGHBOR_CMD2 "next-hop-self {all}",
paul718e3742002-12-13 20:15:29 +00002183 NO_STR
2184 NEIGHBOR_STR
2185 NEIGHBOR_ADDR_STR2
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002186 "Disable the next hop calculation for this neighbor\n"
2187 "Apply also to ibgp-learned routes when acting as a route reflector\n")
paul718e3742002-12-13 20:15:29 +00002188{
2189 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002190 bgp_node_safi (vty),
2191 PEER_FLAG_NEXTHOP_SELF|PEER_FLAG_NEXTHOP_SELF_ALL);
paul718e3742002-12-13 20:15:29 +00002192}
David Lamparter6b0655a2014-06-04 06:53:35 +02002193
paul718e3742002-12-13 20:15:29 +00002194/* neighbor remove-private-AS. */
2195DEFUN (neighbor_remove_private_as,
2196 neighbor_remove_private_as_cmd,
2197 NEIGHBOR_CMD2 "remove-private-AS",
2198 NEIGHBOR_STR
2199 NEIGHBOR_ADDR_STR2
2200 "Remove private AS number from outbound updates\n")
2201{
2202 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2203 bgp_node_safi (vty),
2204 PEER_FLAG_REMOVE_PRIVATE_AS);
2205}
2206
2207DEFUN (no_neighbor_remove_private_as,
2208 no_neighbor_remove_private_as_cmd,
2209 NO_NEIGHBOR_CMD2 "remove-private-AS",
2210 NO_STR
2211 NEIGHBOR_STR
2212 NEIGHBOR_ADDR_STR2
2213 "Remove private AS number from outbound updates\n")
2214{
2215 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2216 bgp_node_safi (vty),
2217 PEER_FLAG_REMOVE_PRIVATE_AS);
2218}
David Lamparter6b0655a2014-06-04 06:53:35 +02002219
paul718e3742002-12-13 20:15:29 +00002220/* neighbor send-community. */
2221DEFUN (neighbor_send_community,
2222 neighbor_send_community_cmd,
2223 NEIGHBOR_CMD2 "send-community",
2224 NEIGHBOR_STR
2225 NEIGHBOR_ADDR_STR2
2226 "Send Community attribute to this neighbor\n")
2227{
2228 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2229 bgp_node_safi (vty),
2230 PEER_FLAG_SEND_COMMUNITY);
2231}
2232
2233DEFUN (no_neighbor_send_community,
2234 no_neighbor_send_community_cmd,
2235 NO_NEIGHBOR_CMD2 "send-community",
2236 NO_STR
2237 NEIGHBOR_STR
2238 NEIGHBOR_ADDR_STR2
2239 "Send Community attribute to this neighbor\n")
2240{
2241 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2242 bgp_node_safi (vty),
2243 PEER_FLAG_SEND_COMMUNITY);
2244}
David Lamparter6b0655a2014-06-04 06:53:35 +02002245
paul718e3742002-12-13 20:15:29 +00002246/* neighbor send-community extended. */
2247DEFUN (neighbor_send_community_type,
2248 neighbor_send_community_type_cmd,
2249 NEIGHBOR_CMD2 "send-community (both|extended|standard)",
2250 NEIGHBOR_STR
2251 NEIGHBOR_ADDR_STR2
2252 "Send Community attribute to this neighbor\n"
2253 "Send Standard and Extended Community attributes\n"
2254 "Send Extended Community attributes\n"
2255 "Send Standard Community attributes\n")
2256{
2257 if (strncmp (argv[1], "s", 1) == 0)
2258 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2259 bgp_node_safi (vty),
2260 PEER_FLAG_SEND_COMMUNITY);
2261 if (strncmp (argv[1], "e", 1) == 0)
2262 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2263 bgp_node_safi (vty),
2264 PEER_FLAG_SEND_EXT_COMMUNITY);
2265
2266 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2267 bgp_node_safi (vty),
2268 (PEER_FLAG_SEND_COMMUNITY|
2269 PEER_FLAG_SEND_EXT_COMMUNITY));
2270}
2271
2272DEFUN (no_neighbor_send_community_type,
2273 no_neighbor_send_community_type_cmd,
2274 NO_NEIGHBOR_CMD2 "send-community (both|extended|standard)",
2275 NO_STR
2276 NEIGHBOR_STR
2277 NEIGHBOR_ADDR_STR2
2278 "Send Community attribute to this neighbor\n"
2279 "Send Standard and Extended Community attributes\n"
2280 "Send Extended Community attributes\n"
2281 "Send Standard Community attributes\n")
2282{
2283 if (strncmp (argv[1], "s", 1) == 0)
2284 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2285 bgp_node_safi (vty),
2286 PEER_FLAG_SEND_COMMUNITY);
2287 if (strncmp (argv[1], "e", 1) == 0)
2288 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2289 bgp_node_safi (vty),
2290 PEER_FLAG_SEND_EXT_COMMUNITY);
2291
2292 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2293 bgp_node_safi (vty),
2294 (PEER_FLAG_SEND_COMMUNITY |
2295 PEER_FLAG_SEND_EXT_COMMUNITY));
2296}
David Lamparter6b0655a2014-06-04 06:53:35 +02002297
paul718e3742002-12-13 20:15:29 +00002298/* neighbor soft-reconfig. */
2299DEFUN (neighbor_soft_reconfiguration,
2300 neighbor_soft_reconfiguration_cmd,
2301 NEIGHBOR_CMD2 "soft-reconfiguration inbound",
2302 NEIGHBOR_STR
2303 NEIGHBOR_ADDR_STR2
2304 "Per neighbor soft reconfiguration\n"
2305 "Allow inbound soft reconfiguration for this neighbor\n")
2306{
2307 return peer_af_flag_set_vty (vty, argv[0],
2308 bgp_node_afi (vty), bgp_node_safi (vty),
2309 PEER_FLAG_SOFT_RECONFIG);
2310}
2311
2312DEFUN (no_neighbor_soft_reconfiguration,
2313 no_neighbor_soft_reconfiguration_cmd,
2314 NO_NEIGHBOR_CMD2 "soft-reconfiguration inbound",
2315 NO_STR
2316 NEIGHBOR_STR
2317 NEIGHBOR_ADDR_STR2
2318 "Per neighbor soft reconfiguration\n"
2319 "Allow inbound soft reconfiguration for this neighbor\n")
2320{
2321 return peer_af_flag_unset_vty (vty, argv[0],
2322 bgp_node_afi (vty), bgp_node_safi (vty),
2323 PEER_FLAG_SOFT_RECONFIG);
2324}
David Lamparter6b0655a2014-06-04 06:53:35 +02002325
paul718e3742002-12-13 20:15:29 +00002326DEFUN (neighbor_route_reflector_client,
2327 neighbor_route_reflector_client_cmd,
2328 NEIGHBOR_CMD2 "route-reflector-client",
2329 NEIGHBOR_STR
2330 NEIGHBOR_ADDR_STR2
2331 "Configure a neighbor as Route Reflector client\n")
2332{
2333 struct peer *peer;
2334
2335
2336 peer = peer_and_group_lookup_vty (vty, argv[0]);
2337 if (! peer)
2338 return CMD_WARNING;
2339
2340 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2341 bgp_node_safi (vty),
2342 PEER_FLAG_REFLECTOR_CLIENT);
2343}
2344
2345DEFUN (no_neighbor_route_reflector_client,
2346 no_neighbor_route_reflector_client_cmd,
2347 NO_NEIGHBOR_CMD2 "route-reflector-client",
2348 NO_STR
2349 NEIGHBOR_STR
2350 NEIGHBOR_ADDR_STR2
2351 "Configure a neighbor as Route Reflector client\n")
2352{
2353 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2354 bgp_node_safi (vty),
2355 PEER_FLAG_REFLECTOR_CLIENT);
2356}
David Lamparter6b0655a2014-06-04 06:53:35 +02002357
paul94f2b392005-06-28 12:44:16 +00002358static int
paulfd79ac92004-10-13 05:06:08 +00002359peer_rsclient_set_vty (struct vty *vty, const char *peer_str,
2360 int afi, int safi)
paulfee0f4c2004-09-13 05:12:46 +00002361{
2362 int ret;
2363 struct bgp *bgp;
2364 struct peer *peer;
2365 struct peer_group *group;
paul1eb8ef22005-04-07 07:30:20 +00002366 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00002367 struct bgp_filter *pfilter;
2368 struct bgp_filter *gfilter;
Chris Caputo228da422009-07-18 05:44:03 +00002369 int locked_and_added = 0;
paulfee0f4c2004-09-13 05:12:46 +00002370
2371 bgp = vty->index;
2372
2373 peer = peer_and_group_lookup_vty (vty, peer_str);
2374 if ( ! peer )
2375 return CMD_WARNING;
2376
2377 /* If it is already a RS-Client, don't do anything. */
2378 if ( CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) )
2379 return CMD_SUCCESS;
2380
2381 if ( ! peer_rsclient_active (peer) )
paul200df112005-06-01 11:17:05 +00002382 {
2383 peer = peer_lock (peer); /* rsclient peer list reference */
2384 listnode_add_sort (bgp->rsclient, peer);
Chris Caputo228da422009-07-18 05:44:03 +00002385 locked_and_added = 1;
paul200df112005-06-01 11:17:05 +00002386 }
paulfee0f4c2004-09-13 05:12:46 +00002387
2388 ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2389 if (ret < 0)
Chris Caputo228da422009-07-18 05:44:03 +00002390 {
2391 if (locked_and_added)
2392 {
2393 listnode_delete (bgp->rsclient, peer);
2394 peer_unlock (peer); /* rsclient peer list reference */
2395 }
2396
2397 return bgp_vty_return (vty, ret);
2398 }
paulfee0f4c2004-09-13 05:12:46 +00002399
Paul Jakma64e580a2006-02-21 01:09:01 +00002400 peer->rib[afi][safi] = bgp_table_init (afi, safi);
paulfee0f4c2004-09-13 05:12:46 +00002401 peer->rib[afi][safi]->type = BGP_TABLE_RSCLIENT;
Chris Caputo228da422009-07-18 05:44:03 +00002402 /* RIB peer reference. Released when table is free'd in bgp_table_free. */
2403 peer->rib[afi][safi]->owner = peer_lock (peer);
paulfee0f4c2004-09-13 05:12:46 +00002404
2405 /* Check for existing 'network' and 'redistribute' routes. */
2406 bgp_check_local_routes_rsclient (peer, afi, safi);
2407
2408 /* Check for routes for peers configured with 'soft-reconfiguration'. */
2409 bgp_soft_reconfig_rsclient (peer, afi, safi);
2410
2411 if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP))
2412 {
2413 group = peer->group;
2414 gfilter = &peer->filter[afi][safi];
2415
paul1eb8ef22005-04-07 07:30:20 +00002416 for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00002417 {
2418 pfilter = &peer->filter[afi][safi];
2419
2420 /* Members of a non-RS-Client group should not be RS-Clients, as that
2421 is checked when the become part of the peer-group */
2422 ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2423 if (ret < 0)
2424 return bgp_vty_return (vty, ret);
2425
2426 /* Make peer's RIB point to group's RIB. */
2427 peer->rib[afi][safi] = group->conf->rib[afi][safi];
2428
2429 /* Import policy. */
2430 if (pfilter->map[RMAP_IMPORT].name)
2431 free (pfilter->map[RMAP_IMPORT].name);
2432 if (gfilter->map[RMAP_IMPORT].name)
2433 {
2434 pfilter->map[RMAP_IMPORT].name = strdup (gfilter->map[RMAP_IMPORT].name);
2435 pfilter->map[RMAP_IMPORT].map = gfilter->map[RMAP_IMPORT].map;
2436 }
2437 else
2438 {
2439 pfilter->map[RMAP_IMPORT].name = NULL;
2440 pfilter->map[RMAP_IMPORT].map =NULL;
2441 }
2442
2443 /* Export policy. */
2444 if (gfilter->map[RMAP_EXPORT].name && ! pfilter->map[RMAP_EXPORT].name)
2445 {
2446 pfilter->map[RMAP_EXPORT].name = strdup (gfilter->map[RMAP_EXPORT].name);
2447 pfilter->map[RMAP_EXPORT].map = gfilter->map[RMAP_EXPORT].map;
2448 }
2449 }
2450 }
2451 return CMD_SUCCESS;
2452}
2453
paul94f2b392005-06-28 12:44:16 +00002454static int
paulfd79ac92004-10-13 05:06:08 +00002455peer_rsclient_unset_vty (struct vty *vty, const char *peer_str,
2456 int afi, int safi)
paulfee0f4c2004-09-13 05:12:46 +00002457{
2458 int ret;
2459 struct bgp *bgp;
2460 struct peer *peer;
2461 struct peer_group *group;
paul1eb8ef22005-04-07 07:30:20 +00002462 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00002463
2464 bgp = vty->index;
2465
2466 peer = peer_and_group_lookup_vty (vty, peer_str);
2467 if ( ! peer )
2468 return CMD_WARNING;
2469
2470 /* If it is not a RS-Client, don't do anything. */
2471 if ( ! CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) )
2472 return CMD_SUCCESS;
2473
2474 if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP))
2475 {
2476 group = peer->group;
2477
paul1eb8ef22005-04-07 07:30:20 +00002478 for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00002479 {
2480 ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2481 if (ret < 0)
2482 return bgp_vty_return (vty, ret);
2483
2484 peer->rib[afi][safi] = NULL;
2485 }
2486
2487 peer = group->conf;
2488 }
2489
2490 ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2491 if (ret < 0)
2492 return bgp_vty_return (vty, ret);
2493
2494 if ( ! peer_rsclient_active (peer) )
paul200df112005-06-01 11:17:05 +00002495 {
Chris Caputo228da422009-07-18 05:44:03 +00002496 bgp_clear_route (peer, afi, safi, BGP_CLEAR_ROUTE_MY_RSCLIENT);
paul200df112005-06-01 11:17:05 +00002497 listnode_delete (bgp->rsclient, peer);
Chris Caputo228da422009-07-18 05:44:03 +00002498 peer_unlock (peer); /* peer bgp rsclient reference */
paul200df112005-06-01 11:17:05 +00002499 }
paulfee0f4c2004-09-13 05:12:46 +00002500
Paul Jakmab608d5b2008-07-02 02:12:07 +00002501 bgp_table_finish (&peer->rib[bgp_node_afi(vty)][bgp_node_safi(vty)]);
paulfee0f4c2004-09-13 05:12:46 +00002502
2503 return CMD_SUCCESS;
2504}
David Lamparter6b0655a2014-06-04 06:53:35 +02002505
paul718e3742002-12-13 20:15:29 +00002506/* neighbor route-server-client. */
2507DEFUN (neighbor_route_server_client,
2508 neighbor_route_server_client_cmd,
2509 NEIGHBOR_CMD2 "route-server-client",
2510 NEIGHBOR_STR
2511 NEIGHBOR_ADDR_STR2
2512 "Configure a neighbor as Route Server client\n")
2513{
paulfee0f4c2004-09-13 05:12:46 +00002514 return peer_rsclient_set_vty (vty, argv[0], bgp_node_afi(vty),
2515 bgp_node_safi(vty));
paul718e3742002-12-13 20:15:29 +00002516}
2517
2518DEFUN (no_neighbor_route_server_client,
2519 no_neighbor_route_server_client_cmd,
2520 NO_NEIGHBOR_CMD2 "route-server-client",
2521 NO_STR
2522 NEIGHBOR_STR
2523 NEIGHBOR_ADDR_STR2
2524 "Configure a neighbor as Route Server client\n")
2525{
paulfee0f4c2004-09-13 05:12:46 +00002526 return peer_rsclient_unset_vty (vty, argv[0], bgp_node_afi(vty),
2527 bgp_node_safi(vty));
2528}
David Lamparter6b0655a2014-06-04 06:53:35 +02002529
paulfee0f4c2004-09-13 05:12:46 +00002530DEFUN (neighbor_nexthop_local_unchanged,
2531 neighbor_nexthop_local_unchanged_cmd,
2532 NEIGHBOR_CMD2 "nexthop-local unchanged",
2533 NEIGHBOR_STR
2534 NEIGHBOR_ADDR_STR2
2535 "Configure treatment of outgoing link-local nexthop attribute\n"
2536 "Leave link-local nexthop unchanged for this peer\n")
2537{
2538 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2539 bgp_node_safi (vty),
2540 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED );
2541}
David Lamparter6b0655a2014-06-04 06:53:35 +02002542
paulfee0f4c2004-09-13 05:12:46 +00002543DEFUN (no_neighbor_nexthop_local_unchanged,
2544 no_neighbor_nexthop_local_unchanged_cmd,
2545 NO_NEIGHBOR_CMD2 "nexthop-local unchanged",
2546 NO_STR
2547 NEIGHBOR_STR
2548 NEIGHBOR_ADDR_STR2
2549 "Configure treatment of outgoing link-local-nexthop attribute\n"
2550 "Leave link-local nexthop unchanged for this peer\n")
2551{
paul718e3742002-12-13 20:15:29 +00002552 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2553 bgp_node_safi (vty),
paulfee0f4c2004-09-13 05:12:46 +00002554 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED );
paul718e3742002-12-13 20:15:29 +00002555}
David Lamparter6b0655a2014-06-04 06:53:35 +02002556
paul718e3742002-12-13 20:15:29 +00002557DEFUN (neighbor_attr_unchanged,
2558 neighbor_attr_unchanged_cmd,
2559 NEIGHBOR_CMD2 "attribute-unchanged",
2560 NEIGHBOR_STR
2561 NEIGHBOR_ADDR_STR2
2562 "BGP attribute is propagated unchanged to this neighbor\n")
2563{
2564 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2565 bgp_node_safi (vty),
2566 (PEER_FLAG_AS_PATH_UNCHANGED |
2567 PEER_FLAG_NEXTHOP_UNCHANGED |
2568 PEER_FLAG_MED_UNCHANGED));
2569}
2570
2571DEFUN (neighbor_attr_unchanged1,
2572 neighbor_attr_unchanged1_cmd,
2573 NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)",
2574 NEIGHBOR_STR
2575 NEIGHBOR_ADDR_STR2
2576 "BGP attribute is propagated unchanged to this neighbor\n"
2577 "As-path attribute\n"
2578 "Nexthop attribute\n"
2579 "Med attribute\n")
2580{
2581 u_int16_t flags = 0;
2582
2583 if (strncmp (argv[1], "as-path", 1) == 0)
2584 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2585 else if (strncmp (argv[1], "next-hop", 1) == 0)
2586 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2587 else if (strncmp (argv[1], "med", 1) == 0)
2588 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2589
2590 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2591 bgp_node_safi (vty), flags);
2592}
2593
2594DEFUN (neighbor_attr_unchanged2,
2595 neighbor_attr_unchanged2_cmd,
2596 NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)",
2597 NEIGHBOR_STR
2598 NEIGHBOR_ADDR_STR2
2599 "BGP attribute is propagated unchanged to this neighbor\n"
2600 "As-path attribute\n"
2601 "Nexthop attribute\n"
2602 "Med attribute\n")
2603{
2604 u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED;
2605
2606 if (strncmp (argv[1], "next-hop", 1) == 0)
2607 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2608 else if (strncmp (argv[1], "med", 1) == 0)
2609 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2610
2611 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2612 bgp_node_safi (vty), flags);
2613
2614}
2615
2616DEFUN (neighbor_attr_unchanged3,
2617 neighbor_attr_unchanged3_cmd,
2618 NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)",
2619 NEIGHBOR_STR
2620 NEIGHBOR_ADDR_STR2
2621 "BGP attribute is propagated unchanged to this neighbor\n"
2622 "Nexthop attribute\n"
2623 "As-path attribute\n"
2624 "Med attribute\n")
2625{
2626 u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED;
2627
2628 if (strncmp (argv[1], "as-path", 1) == 0)
2629 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2630 else if (strncmp (argv[1], "med", 1) == 0)
2631 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2632
2633 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2634 bgp_node_safi (vty), flags);
2635}
2636
2637DEFUN (neighbor_attr_unchanged4,
2638 neighbor_attr_unchanged4_cmd,
2639 NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)",
2640 NEIGHBOR_STR
2641 NEIGHBOR_ADDR_STR2
2642 "BGP attribute is propagated unchanged to this neighbor\n"
2643 "Med attribute\n"
2644 "As-path attribute\n"
2645 "Nexthop attribute\n")
2646{
2647 u_int16_t flags = PEER_FLAG_MED_UNCHANGED;
2648
2649 if (strncmp (argv[1], "as-path", 1) == 0)
2650 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2651 else if (strncmp (argv[1], "next-hop", 1) == 0)
2652 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2653
2654 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2655 bgp_node_safi (vty), flags);
2656}
2657
2658ALIAS (neighbor_attr_unchanged,
2659 neighbor_attr_unchanged5_cmd,
2660 NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med",
2661 NEIGHBOR_STR
2662 NEIGHBOR_ADDR_STR2
2663 "BGP attribute is propagated unchanged to this neighbor\n"
2664 "As-path attribute\n"
2665 "Nexthop attribute\n"
2666 "Med attribute\n")
2667
2668ALIAS (neighbor_attr_unchanged,
2669 neighbor_attr_unchanged6_cmd,
2670 NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop",
2671 NEIGHBOR_STR
2672 NEIGHBOR_ADDR_STR2
2673 "BGP attribute is propagated unchanged to this neighbor\n"
2674 "As-path attribute\n"
2675 "Med attribute\n"
2676 "Nexthop attribute\n")
2677
2678ALIAS (neighbor_attr_unchanged,
2679 neighbor_attr_unchanged7_cmd,
2680 NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path",
2681 NEIGHBOR_STR
2682 NEIGHBOR_ADDR_STR2
2683 "BGP attribute is propagated unchanged to this neighbor\n"
2684 "Nexthop attribute\n"
2685 "Med attribute\n"
2686 "As-path attribute\n")
2687
2688ALIAS (neighbor_attr_unchanged,
2689 neighbor_attr_unchanged8_cmd,
2690 NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med",
2691 NEIGHBOR_STR
2692 NEIGHBOR_ADDR_STR2
2693 "BGP attribute is propagated unchanged to this neighbor\n"
2694 "Nexthop attribute\n"
2695 "As-path attribute\n"
2696 "Med attribute\n")
2697
2698ALIAS (neighbor_attr_unchanged,
2699 neighbor_attr_unchanged9_cmd,
2700 NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path",
2701 NEIGHBOR_STR
2702 NEIGHBOR_ADDR_STR2
2703 "BGP attribute is propagated unchanged to this neighbor\n"
2704 "Med attribute\n"
2705 "Nexthop attribute\n"
2706 "As-path attribute\n")
2707
2708ALIAS (neighbor_attr_unchanged,
2709 neighbor_attr_unchanged10_cmd,
2710 NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop",
2711 NEIGHBOR_STR
2712 NEIGHBOR_ADDR_STR2
2713 "BGP attribute is propagated unchanged to this neighbor\n"
2714 "Med attribute\n"
2715 "As-path attribute\n"
2716 "Nexthop attribute\n")
2717
2718DEFUN (no_neighbor_attr_unchanged,
2719 no_neighbor_attr_unchanged_cmd,
2720 NO_NEIGHBOR_CMD2 "attribute-unchanged",
2721 NO_STR
2722 NEIGHBOR_STR
2723 NEIGHBOR_ADDR_STR2
2724 "BGP attribute is propagated unchanged to this neighbor\n")
2725{
2726 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2727 bgp_node_safi (vty),
2728 (PEER_FLAG_AS_PATH_UNCHANGED |
2729 PEER_FLAG_NEXTHOP_UNCHANGED |
2730 PEER_FLAG_MED_UNCHANGED));
2731}
2732
2733DEFUN (no_neighbor_attr_unchanged1,
2734 no_neighbor_attr_unchanged1_cmd,
2735 NO_NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)",
2736 NO_STR
2737 NEIGHBOR_STR
2738 NEIGHBOR_ADDR_STR2
2739 "BGP attribute is propagated unchanged to this neighbor\n"
2740 "As-path attribute\n"
2741 "Nexthop attribute\n"
2742 "Med attribute\n")
2743{
2744 u_int16_t flags = 0;
2745
2746 if (strncmp (argv[1], "as-path", 1) == 0)
2747 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2748 else if (strncmp (argv[1], "next-hop", 1) == 0)
2749 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2750 else if (strncmp (argv[1], "med", 1) == 0)
2751 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2752
2753 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2754 bgp_node_safi (vty), flags);
2755}
2756
2757DEFUN (no_neighbor_attr_unchanged2,
2758 no_neighbor_attr_unchanged2_cmd,
2759 NO_NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)",
2760 NO_STR
2761 NEIGHBOR_STR
2762 NEIGHBOR_ADDR_STR2
2763 "BGP attribute is propagated unchanged to this neighbor\n"
2764 "As-path attribute\n"
2765 "Nexthop attribute\n"
2766 "Med attribute\n")
2767{
2768 u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED;
2769
2770 if (strncmp (argv[1], "next-hop", 1) == 0)
2771 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2772 else if (strncmp (argv[1], "med", 1) == 0)
2773 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2774
2775 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2776 bgp_node_safi (vty), flags);
2777}
2778
2779DEFUN (no_neighbor_attr_unchanged3,
2780 no_neighbor_attr_unchanged3_cmd,
2781 NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)",
2782 NO_STR
2783 NEIGHBOR_STR
2784 NEIGHBOR_ADDR_STR2
2785 "BGP attribute is propagated unchanged to this neighbor\n"
2786 "Nexthop attribute\n"
2787 "As-path attribute\n"
2788 "Med attribute\n")
2789{
2790 u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED;
2791
2792 if (strncmp (argv[1], "as-path", 1) == 0)
2793 SET_FLAG (flags, PEER_FLAG_AS_PATH_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_unchanged4,
2802 no_neighbor_attr_unchanged4_cmd,
2803 NO_NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)",
2804 NO_STR
2805 NEIGHBOR_STR
2806 NEIGHBOR_ADDR_STR2
2807 "BGP attribute is propagated unchanged to this neighbor\n"
2808 "Med attribute\n"
2809 "As-path attribute\n"
2810 "Nexthop attribute\n")
2811{
2812 u_int16_t flags = PEER_FLAG_MED_UNCHANGED;
2813
2814 if (strncmp (argv[1], "as-path", 1) == 0)
2815 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2816 else if (strncmp (argv[1], "next-hop", 1) == 0)
2817 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2818
2819 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2820 bgp_node_safi (vty), flags);
2821}
2822
2823ALIAS (no_neighbor_attr_unchanged,
2824 no_neighbor_attr_unchanged5_cmd,
2825 NO_NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med",
2826 NO_STR
2827 NEIGHBOR_STR
2828 NEIGHBOR_ADDR_STR2
2829 "BGP attribute is propagated unchanged to this neighbor\n"
2830 "As-path attribute\n"
2831 "Nexthop attribute\n"
2832 "Med attribute\n")
2833
2834ALIAS (no_neighbor_attr_unchanged,
2835 no_neighbor_attr_unchanged6_cmd,
2836 NO_NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop",
2837 NO_STR
2838 NEIGHBOR_STR
2839 NEIGHBOR_ADDR_STR2
2840 "BGP attribute is propagated unchanged to this neighbor\n"
2841 "As-path attribute\n"
2842 "Med attribute\n"
2843 "Nexthop attribute\n")
2844
2845ALIAS (no_neighbor_attr_unchanged,
2846 no_neighbor_attr_unchanged7_cmd,
2847 NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path",
2848 NO_STR
2849 NEIGHBOR_STR
2850 NEIGHBOR_ADDR_STR2
2851 "BGP attribute is propagated unchanged to this neighbor\n"
2852 "Nexthop attribute\n"
2853 "Med attribute\n"
2854 "As-path attribute\n")
2855
2856ALIAS (no_neighbor_attr_unchanged,
2857 no_neighbor_attr_unchanged8_cmd,
2858 NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med",
2859 NO_STR
2860 NEIGHBOR_STR
2861 NEIGHBOR_ADDR_STR2
2862 "BGP attribute is propagated unchanged to this neighbor\n"
2863 "Nexthop attribute\n"
2864 "As-path attribute\n"
2865 "Med attribute\n")
2866
2867ALIAS (no_neighbor_attr_unchanged,
2868 no_neighbor_attr_unchanged9_cmd,
2869 NO_NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path",
2870 NO_STR
2871 NEIGHBOR_STR
2872 NEIGHBOR_ADDR_STR2
2873 "BGP attribute is propagated unchanged to this neighbor\n"
2874 "Med attribute\n"
2875 "Nexthop attribute\n"
2876 "As-path attribute\n")
2877
2878ALIAS (no_neighbor_attr_unchanged,
2879 no_neighbor_attr_unchanged10_cmd,
2880 NO_NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop",
2881 NO_STR
2882 NEIGHBOR_STR
2883 NEIGHBOR_ADDR_STR2
2884 "BGP attribute is propagated unchanged to this neighbor\n"
2885 "Med attribute\n"
2886 "As-path attribute\n"
2887 "Nexthop attribute\n")
2888
2889/* For old version Zebra compatibility. */
hassodd4c5932005-02-02 17:15:34 +00002890DEFUN_DEPRECATED (neighbor_transparent_as,
2891 neighbor_transparent_as_cmd,
2892 NEIGHBOR_CMD "transparent-as",
2893 NEIGHBOR_STR
2894 NEIGHBOR_ADDR_STR
2895 "Do not append my AS number even peer is EBGP peer\n")
paul718e3742002-12-13 20:15:29 +00002896{
2897 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2898 bgp_node_safi (vty),
2899 PEER_FLAG_AS_PATH_UNCHANGED);
2900}
2901
hassodd4c5932005-02-02 17:15:34 +00002902DEFUN_DEPRECATED (neighbor_transparent_nexthop,
2903 neighbor_transparent_nexthop_cmd,
2904 NEIGHBOR_CMD "transparent-nexthop",
2905 NEIGHBOR_STR
2906 NEIGHBOR_ADDR_STR
2907 "Do not change nexthop even peer is EBGP peer\n")
paul718e3742002-12-13 20:15:29 +00002908{
2909 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2910 bgp_node_safi (vty),
2911 PEER_FLAG_NEXTHOP_UNCHANGED);
2912}
David Lamparter6b0655a2014-06-04 06:53:35 +02002913
paul718e3742002-12-13 20:15:29 +00002914/* EBGP multihop configuration. */
paul94f2b392005-06-28 12:44:16 +00002915static int
paulfd79ac92004-10-13 05:06:08 +00002916peer_ebgp_multihop_set_vty (struct vty *vty, const char *ip_str,
2917 const char *ttl_str)
paul718e3742002-12-13 20:15:29 +00002918{
2919 struct peer *peer;
paulfd79ac92004-10-13 05:06:08 +00002920 unsigned int ttl;
paul718e3742002-12-13 20:15:29 +00002921
2922 peer = peer_and_group_lookup_vty (vty, ip_str);
2923 if (! peer)
2924 return CMD_WARNING;
2925
2926 if (! ttl_str)
2927 ttl = TTL_MAX;
2928 else
2929 VTY_GET_INTEGER_RANGE ("TTL", ttl, ttl_str, 1, 255);
2930
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00002931 return bgp_vty_return (vty, peer_ebgp_multihop_set (peer, ttl));
paul718e3742002-12-13 20:15:29 +00002932}
2933
paul94f2b392005-06-28 12:44:16 +00002934static int
paulfd79ac92004-10-13 05:06:08 +00002935peer_ebgp_multihop_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00002936{
2937 struct peer *peer;
2938
2939 peer = peer_and_group_lookup_vty (vty, ip_str);
2940 if (! peer)
2941 return CMD_WARNING;
2942
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00002943 return bgp_vty_return (vty, peer_ebgp_multihop_unset (peer));
paul718e3742002-12-13 20:15:29 +00002944}
2945
2946/* neighbor ebgp-multihop. */
2947DEFUN (neighbor_ebgp_multihop,
2948 neighbor_ebgp_multihop_cmd,
2949 NEIGHBOR_CMD2 "ebgp-multihop",
2950 NEIGHBOR_STR
2951 NEIGHBOR_ADDR_STR2
2952 "Allow EBGP neighbors not on directly connected networks\n")
2953{
2954 return peer_ebgp_multihop_set_vty (vty, argv[0], NULL);
2955}
2956
2957DEFUN (neighbor_ebgp_multihop_ttl,
2958 neighbor_ebgp_multihop_ttl_cmd,
2959 NEIGHBOR_CMD2 "ebgp-multihop <1-255>",
2960 NEIGHBOR_STR
2961 NEIGHBOR_ADDR_STR2
2962 "Allow EBGP neighbors not on directly connected networks\n"
2963 "maximum hop count\n")
2964{
2965 return peer_ebgp_multihop_set_vty (vty, argv[0], argv[1]);
2966}
2967
2968DEFUN (no_neighbor_ebgp_multihop,
2969 no_neighbor_ebgp_multihop_cmd,
2970 NO_NEIGHBOR_CMD2 "ebgp-multihop",
2971 NO_STR
2972 NEIGHBOR_STR
2973 NEIGHBOR_ADDR_STR2
2974 "Allow EBGP neighbors not on directly connected networks\n")
2975{
2976 return peer_ebgp_multihop_unset_vty (vty, argv[0]);
2977}
2978
2979ALIAS (no_neighbor_ebgp_multihop,
2980 no_neighbor_ebgp_multihop_ttl_cmd,
2981 NO_NEIGHBOR_CMD2 "ebgp-multihop <1-255>",
2982 NO_STR
2983 NEIGHBOR_STR
2984 NEIGHBOR_ADDR_STR2
2985 "Allow EBGP neighbors not on directly connected networks\n"
2986 "maximum hop count\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02002987
hasso6ffd2072005-02-02 14:50:11 +00002988/* disable-connected-check */
2989DEFUN (neighbor_disable_connected_check,
2990 neighbor_disable_connected_check_cmd,
2991 NEIGHBOR_CMD2 "disable-connected-check",
2992 NEIGHBOR_STR
2993 NEIGHBOR_ADDR_STR2
2994 "one-hop away EBGP peer using loopback address\n")
2995{
2996 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK);
2997}
2998
2999DEFUN (no_neighbor_disable_connected_check,
3000 no_neighbor_disable_connected_check_cmd,
3001 NO_NEIGHBOR_CMD2 "disable-connected-check",
3002 NO_STR
3003 NEIGHBOR_STR
3004 NEIGHBOR_ADDR_STR2
3005 "one-hop away EBGP peer using loopback address\n")
3006{
3007 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK);
3008}
3009
paul718e3742002-12-13 20:15:29 +00003010/* Enforce multihop. */
hasso6ffd2072005-02-02 14:50:11 +00003011ALIAS (neighbor_disable_connected_check,
paul718e3742002-12-13 20:15:29 +00003012 neighbor_enforce_multihop_cmd,
3013 NEIGHBOR_CMD2 "enforce-multihop",
3014 NEIGHBOR_STR
3015 NEIGHBOR_ADDR_STR2
paule8e19462006-01-19 20:16:55 +00003016 "Enforce EBGP neighbors perform multihop\n")
paul718e3742002-12-13 20:15:29 +00003017
hasso6ffd2072005-02-02 14:50:11 +00003018/* Enforce multihop. */
3019ALIAS (no_neighbor_disable_connected_check,
paul718e3742002-12-13 20:15:29 +00003020 no_neighbor_enforce_multihop_cmd,
3021 NO_NEIGHBOR_CMD2 "enforce-multihop",
3022 NO_STR
3023 NEIGHBOR_STR
3024 NEIGHBOR_ADDR_STR2
paule8e19462006-01-19 20:16:55 +00003025 "Enforce EBGP neighbors perform multihop\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003026
paul718e3742002-12-13 20:15:29 +00003027DEFUN (neighbor_description,
3028 neighbor_description_cmd,
3029 NEIGHBOR_CMD2 "description .LINE",
3030 NEIGHBOR_STR
3031 NEIGHBOR_ADDR_STR2
3032 "Neighbor specific description\n"
3033 "Up to 80 characters describing this neighbor\n")
3034{
3035 struct peer *peer;
paul718e3742002-12-13 20:15:29 +00003036 char *str;
paul718e3742002-12-13 20:15:29 +00003037
3038 peer = peer_and_group_lookup_vty (vty, argv[0]);
3039 if (! peer)
3040 return CMD_WARNING;
3041
3042 if (argc == 1)
3043 return CMD_SUCCESS;
3044
ajs3b8b1852005-01-29 18:19:13 +00003045 str = argv_concat(argv, argc, 1);
paul718e3742002-12-13 20:15:29 +00003046
3047 peer_description_set (peer, str);
3048
ajs3b8b1852005-01-29 18:19:13 +00003049 XFREE (MTYPE_TMP, str);
paul718e3742002-12-13 20:15:29 +00003050
3051 return CMD_SUCCESS;
3052}
3053
3054DEFUN (no_neighbor_description,
3055 no_neighbor_description_cmd,
3056 NO_NEIGHBOR_CMD2 "description",
3057 NO_STR
3058 NEIGHBOR_STR
3059 NEIGHBOR_ADDR_STR2
3060 "Neighbor specific description\n")
3061{
3062 struct peer *peer;
3063
3064 peer = peer_and_group_lookup_vty (vty, argv[0]);
3065 if (! peer)
3066 return CMD_WARNING;
3067
3068 peer_description_unset (peer);
3069
3070 return CMD_SUCCESS;
3071}
3072
3073ALIAS (no_neighbor_description,
3074 no_neighbor_description_val_cmd,
3075 NO_NEIGHBOR_CMD2 "description .LINE",
3076 NO_STR
3077 NEIGHBOR_STR
3078 NEIGHBOR_ADDR_STR2
3079 "Neighbor specific description\n"
3080 "Up to 80 characters describing this neighbor\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003081
paul718e3742002-12-13 20:15:29 +00003082/* Neighbor update-source. */
paul94f2b392005-06-28 12:44:16 +00003083static int
paulfd79ac92004-10-13 05:06:08 +00003084peer_update_source_vty (struct vty *vty, const char *peer_str,
3085 const char *source_str)
paul718e3742002-12-13 20:15:29 +00003086{
3087 struct peer *peer;
paul718e3742002-12-13 20:15:29 +00003088
3089 peer = peer_and_group_lookup_vty (vty, peer_str);
3090 if (! peer)
3091 return CMD_WARNING;
3092
3093 if (source_str)
3094 {
Jorge Boncompte [DTI2]c63b83f2012-04-10 16:57:24 +02003095 union sockunion su;
3096 int ret = str2sockunion (source_str, &su);
3097
3098 if (ret == 0)
3099 peer_update_source_addr_set (peer, &su);
paul718e3742002-12-13 20:15:29 +00003100 else
3101 peer_update_source_if_set (peer, source_str);
3102 }
3103 else
3104 peer_update_source_unset (peer);
3105
3106 return CMD_SUCCESS;
3107}
3108
Paul Jakma9a1a3312009-07-27 12:27:55 +01003109#define BGP_UPDATE_SOURCE_STR "(A.B.C.D|X:X::X:X|WORD)"
Paul Jakma369688c2006-05-23 22:27:55 +00003110#define BGP_UPDATE_SOURCE_HELP_STR \
3111 "IPv4 address\n" \
Paul Jakma9a1a3312009-07-27 12:27:55 +01003112 "IPv6 address\n" \
3113 "Interface name (requires zebra to be running)\n"
Paul Jakma369688c2006-05-23 22:27:55 +00003114
paul718e3742002-12-13 20:15:29 +00003115DEFUN (neighbor_update_source,
3116 neighbor_update_source_cmd,
Paul Jakma369688c2006-05-23 22:27:55 +00003117 NEIGHBOR_CMD2 "update-source " BGP_UPDATE_SOURCE_STR,
paul718e3742002-12-13 20:15:29 +00003118 NEIGHBOR_STR
3119 NEIGHBOR_ADDR_STR2
3120 "Source of routing updates\n"
Paul Jakma369688c2006-05-23 22:27:55 +00003121 BGP_UPDATE_SOURCE_HELP_STR)
paul718e3742002-12-13 20:15:29 +00003122{
3123 return peer_update_source_vty (vty, argv[0], argv[1]);
3124}
3125
3126DEFUN (no_neighbor_update_source,
3127 no_neighbor_update_source_cmd,
3128 NO_NEIGHBOR_CMD2 "update-source",
3129 NO_STR
3130 NEIGHBOR_STR
3131 NEIGHBOR_ADDR_STR2
Paul Jakma369688c2006-05-23 22:27:55 +00003132 "Source of routing updates\n")
paul718e3742002-12-13 20:15:29 +00003133{
3134 return peer_update_source_vty (vty, argv[0], NULL);
3135}
David Lamparter6b0655a2014-06-04 06:53:35 +02003136
paul94f2b392005-06-28 12:44:16 +00003137static int
paulfd79ac92004-10-13 05:06:08 +00003138peer_default_originate_set_vty (struct vty *vty, const char *peer_str,
3139 afi_t afi, safi_t safi,
3140 const char *rmap, int set)
paul718e3742002-12-13 20:15:29 +00003141{
3142 int ret;
3143 struct peer *peer;
3144
3145 peer = peer_and_group_lookup_vty (vty, peer_str);
3146 if (! peer)
3147 return CMD_WARNING;
3148
3149 if (set)
3150 ret = peer_default_originate_set (peer, afi, safi, rmap);
3151 else
3152 ret = peer_default_originate_unset (peer, afi, safi);
3153
3154 return bgp_vty_return (vty, ret);
3155}
3156
3157/* neighbor default-originate. */
3158DEFUN (neighbor_default_originate,
3159 neighbor_default_originate_cmd,
3160 NEIGHBOR_CMD2 "default-originate",
3161 NEIGHBOR_STR
3162 NEIGHBOR_ADDR_STR2
3163 "Originate default route to this neighbor\n")
3164{
3165 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
3166 bgp_node_safi (vty), NULL, 1);
3167}
3168
3169DEFUN (neighbor_default_originate_rmap,
3170 neighbor_default_originate_rmap_cmd,
3171 NEIGHBOR_CMD2 "default-originate route-map WORD",
3172 NEIGHBOR_STR
3173 NEIGHBOR_ADDR_STR2
3174 "Originate default route to this neighbor\n"
3175 "Route-map to specify criteria to originate default\n"
3176 "route-map name\n")
3177{
3178 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
3179 bgp_node_safi (vty), argv[1], 1);
3180}
3181
3182DEFUN (no_neighbor_default_originate,
3183 no_neighbor_default_originate_cmd,
3184 NO_NEIGHBOR_CMD2 "default-originate",
3185 NO_STR
3186 NEIGHBOR_STR
3187 NEIGHBOR_ADDR_STR2
3188 "Originate default route to this neighbor\n")
3189{
3190 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
3191 bgp_node_safi (vty), NULL, 0);
3192}
3193
3194ALIAS (no_neighbor_default_originate,
3195 no_neighbor_default_originate_rmap_cmd,
3196 NO_NEIGHBOR_CMD2 "default-originate route-map WORD",
3197 NO_STR
3198 NEIGHBOR_STR
3199 NEIGHBOR_ADDR_STR2
3200 "Originate default route to this neighbor\n"
3201 "Route-map to specify criteria to originate default\n"
3202 "route-map name\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003203
paul718e3742002-12-13 20:15:29 +00003204/* Set neighbor's BGP port. */
paul94f2b392005-06-28 12:44:16 +00003205static int
paulfd79ac92004-10-13 05:06:08 +00003206peer_port_vty (struct vty *vty, const char *ip_str, int afi,
3207 const char *port_str)
paul718e3742002-12-13 20:15:29 +00003208{
3209 struct peer *peer;
3210 u_int16_t port;
3211 struct servent *sp;
3212
3213 peer = peer_lookup_vty (vty, ip_str);
3214 if (! peer)
3215 return CMD_WARNING;
3216
3217 if (! port_str)
3218 {
3219 sp = getservbyname ("bgp", "tcp");
3220 port = (sp == NULL) ? BGP_PORT_DEFAULT : ntohs (sp->s_port);
3221 }
3222 else
3223 {
3224 VTY_GET_INTEGER("port", port, port_str);
3225 }
3226
3227 peer_port_set (peer, port);
3228
3229 return CMD_SUCCESS;
3230}
3231
hassof4184462005-02-01 20:13:16 +00003232/* Set specified peer's BGP port. */
paul718e3742002-12-13 20:15:29 +00003233DEFUN (neighbor_port,
3234 neighbor_port_cmd,
3235 NEIGHBOR_CMD "port <0-65535>",
3236 NEIGHBOR_STR
3237 NEIGHBOR_ADDR_STR
3238 "Neighbor's BGP port\n"
3239 "TCP port number\n")
3240{
3241 return peer_port_vty (vty, argv[0], AFI_IP, argv[1]);
3242}
3243
3244DEFUN (no_neighbor_port,
3245 no_neighbor_port_cmd,
3246 NO_NEIGHBOR_CMD "port",
3247 NO_STR
3248 NEIGHBOR_STR
3249 NEIGHBOR_ADDR_STR
3250 "Neighbor's BGP port\n")
3251{
3252 return peer_port_vty (vty, argv[0], AFI_IP, NULL);
3253}
3254
3255ALIAS (no_neighbor_port,
3256 no_neighbor_port_val_cmd,
3257 NO_NEIGHBOR_CMD "port <0-65535>",
3258 NO_STR
3259 NEIGHBOR_STR
3260 NEIGHBOR_ADDR_STR
3261 "Neighbor's BGP port\n"
3262 "TCP port number\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003263
paul718e3742002-12-13 20:15:29 +00003264/* neighbor weight. */
paul94f2b392005-06-28 12:44:16 +00003265static int
paulfd79ac92004-10-13 05:06:08 +00003266peer_weight_set_vty (struct vty *vty, const char *ip_str,
3267 const char *weight_str)
paul718e3742002-12-13 20:15:29 +00003268{
paul718e3742002-12-13 20:15:29 +00003269 struct peer *peer;
3270 unsigned long weight;
3271
3272 peer = peer_and_group_lookup_vty (vty, ip_str);
3273 if (! peer)
3274 return CMD_WARNING;
3275
3276 VTY_GET_INTEGER_RANGE("weight", weight, weight_str, 0, 65535);
3277
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003278 return bgp_vty_return (vty, peer_weight_set (peer, weight));
paul718e3742002-12-13 20:15:29 +00003279}
3280
paul94f2b392005-06-28 12:44:16 +00003281static int
paulfd79ac92004-10-13 05:06:08 +00003282peer_weight_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00003283{
3284 struct peer *peer;
3285
3286 peer = peer_and_group_lookup_vty (vty, ip_str);
3287 if (! peer)
3288 return CMD_WARNING;
3289
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003290 return bgp_vty_return (vty, peer_weight_unset (peer));
paul718e3742002-12-13 20:15:29 +00003291}
3292
3293DEFUN (neighbor_weight,
3294 neighbor_weight_cmd,
3295 NEIGHBOR_CMD2 "weight <0-65535>",
3296 NEIGHBOR_STR
3297 NEIGHBOR_ADDR_STR2
3298 "Set default weight for routes from this neighbor\n"
3299 "default weight\n")
3300{
3301 return peer_weight_set_vty (vty, argv[0], argv[1]);
3302}
3303
3304DEFUN (no_neighbor_weight,
3305 no_neighbor_weight_cmd,
3306 NO_NEIGHBOR_CMD2 "weight",
3307 NO_STR
3308 NEIGHBOR_STR
3309 NEIGHBOR_ADDR_STR2
3310 "Set default weight for routes from this neighbor\n")
3311{
3312 return peer_weight_unset_vty (vty, argv[0]);
3313}
3314
3315ALIAS (no_neighbor_weight,
3316 no_neighbor_weight_val_cmd,
3317 NO_NEIGHBOR_CMD2 "weight <0-65535>",
3318 NO_STR
3319 NEIGHBOR_STR
3320 NEIGHBOR_ADDR_STR2
3321 "Set default weight for routes from this neighbor\n"
3322 "default weight\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003323
paul718e3742002-12-13 20:15:29 +00003324/* Override capability negotiation. */
3325DEFUN (neighbor_override_capability,
3326 neighbor_override_capability_cmd,
3327 NEIGHBOR_CMD2 "override-capability",
3328 NEIGHBOR_STR
3329 NEIGHBOR_ADDR_STR2
3330 "Override capability negotiation result\n")
3331{
3332 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY);
3333}
3334
3335DEFUN (no_neighbor_override_capability,
3336 no_neighbor_override_capability_cmd,
3337 NO_NEIGHBOR_CMD2 "override-capability",
3338 NO_STR
3339 NEIGHBOR_STR
3340 NEIGHBOR_ADDR_STR2
3341 "Override capability negotiation result\n")
3342{
3343 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY);
3344}
David Lamparter6b0655a2014-06-04 06:53:35 +02003345
paul718e3742002-12-13 20:15:29 +00003346DEFUN (neighbor_strict_capability,
3347 neighbor_strict_capability_cmd,
3348 NEIGHBOR_CMD "strict-capability-match",
3349 NEIGHBOR_STR
3350 NEIGHBOR_ADDR_STR
3351 "Strict capability negotiation match\n")
3352{
3353 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH);
3354}
3355
3356DEFUN (no_neighbor_strict_capability,
3357 no_neighbor_strict_capability_cmd,
3358 NO_NEIGHBOR_CMD "strict-capability-match",
3359 NO_STR
3360 NEIGHBOR_STR
3361 NEIGHBOR_ADDR_STR
3362 "Strict capability negotiation match\n")
3363{
3364 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH);
3365}
David Lamparter6b0655a2014-06-04 06:53:35 +02003366
paul94f2b392005-06-28 12:44:16 +00003367static int
paulfd79ac92004-10-13 05:06:08 +00003368peer_timers_set_vty (struct vty *vty, const char *ip_str,
3369 const char *keep_str, const char *hold_str)
paul718e3742002-12-13 20:15:29 +00003370{
3371 int ret;
3372 struct peer *peer;
3373 u_int32_t keepalive;
3374 u_int32_t holdtime;
3375
3376 peer = peer_and_group_lookup_vty (vty, ip_str);
3377 if (! peer)
3378 return CMD_WARNING;
3379
3380 VTY_GET_INTEGER_RANGE ("Keepalive", keepalive, keep_str, 0, 65535);
3381 VTY_GET_INTEGER_RANGE ("Holdtime", holdtime, hold_str, 0, 65535);
3382
3383 ret = peer_timers_set (peer, keepalive, holdtime);
3384
3385 return bgp_vty_return (vty, ret);
3386}
David Lamparter6b0655a2014-06-04 06:53:35 +02003387
paul94f2b392005-06-28 12:44:16 +00003388static int
paulfd79ac92004-10-13 05:06:08 +00003389peer_timers_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00003390{
3391 int ret;
3392 struct peer *peer;
3393
3394 peer = peer_lookup_vty (vty, ip_str);
3395 if (! peer)
3396 return CMD_WARNING;
3397
3398 ret = peer_timers_unset (peer);
3399
3400 return bgp_vty_return (vty, ret);
3401}
3402
3403DEFUN (neighbor_timers,
3404 neighbor_timers_cmd,
3405 NEIGHBOR_CMD2 "timers <0-65535> <0-65535>",
3406 NEIGHBOR_STR
3407 NEIGHBOR_ADDR_STR2
3408 "BGP per neighbor timers\n"
3409 "Keepalive interval\n"
3410 "Holdtime\n")
3411{
3412 return peer_timers_set_vty (vty, argv[0], argv[1], argv[2]);
3413}
3414
3415DEFUN (no_neighbor_timers,
3416 no_neighbor_timers_cmd,
3417 NO_NEIGHBOR_CMD2 "timers",
3418 NO_STR
3419 NEIGHBOR_STR
3420 NEIGHBOR_ADDR_STR2
3421 "BGP per neighbor timers\n")
3422{
3423 return peer_timers_unset_vty (vty, argv[0]);
3424}
David Lamparter6b0655a2014-06-04 06:53:35 +02003425
paul94f2b392005-06-28 12:44:16 +00003426static int
paulfd79ac92004-10-13 05:06:08 +00003427peer_timers_connect_set_vty (struct vty *vty, const char *ip_str,
3428 const char *time_str)
paul718e3742002-12-13 20:15:29 +00003429{
paul718e3742002-12-13 20:15:29 +00003430 struct peer *peer;
3431 u_int32_t connect;
3432
Daniel Walton0d7435f2015-10-22 11:35:20 +03003433 peer = peer_and_group_lookup_vty (vty, ip_str);
paul718e3742002-12-13 20:15:29 +00003434 if (! peer)
3435 return CMD_WARNING;
3436
3437 VTY_GET_INTEGER_RANGE ("Connect time", connect, time_str, 0, 65535);
3438
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003439 return bgp_vty_return (vty, peer_timers_connect_set (peer, connect));
paul718e3742002-12-13 20:15:29 +00003440}
3441
paul94f2b392005-06-28 12:44:16 +00003442static int
paulfd79ac92004-10-13 05:06:08 +00003443peer_timers_connect_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00003444{
paul718e3742002-12-13 20:15:29 +00003445 struct peer *peer;
3446
3447 peer = peer_and_group_lookup_vty (vty, ip_str);
3448 if (! peer)
3449 return CMD_WARNING;
3450
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003451 return bgp_vty_return (vty, peer_timers_connect_unset (peer));
paul718e3742002-12-13 20:15:29 +00003452}
3453
3454DEFUN (neighbor_timers_connect,
3455 neighbor_timers_connect_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003456 NEIGHBOR_CMD2 "timers connect <1-65535>",
paul718e3742002-12-13 20:15:29 +00003457 NEIGHBOR_STR
Daniel Walton0d7435f2015-10-22 11:35:20 +03003458 NEIGHBOR_ADDR_STR2
paul718e3742002-12-13 20:15:29 +00003459 "BGP per neighbor timers\n"
3460 "BGP connect timer\n"
3461 "Connect timer\n")
3462{
3463 return peer_timers_connect_set_vty (vty, argv[0], argv[1]);
3464}
3465
3466DEFUN (no_neighbor_timers_connect,
3467 no_neighbor_timers_connect_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003468 NO_NEIGHBOR_CMD2 "timers connect",
paul718e3742002-12-13 20:15:29 +00003469 NO_STR
3470 NEIGHBOR_STR
Daniel Walton0d7435f2015-10-22 11:35:20 +03003471 NEIGHBOR_ADDR_STR2
paul718e3742002-12-13 20:15:29 +00003472 "BGP per neighbor timers\n"
3473 "BGP connect timer\n")
3474{
3475 return peer_timers_connect_unset_vty (vty, argv[0]);
3476}
3477
3478ALIAS (no_neighbor_timers_connect,
3479 no_neighbor_timers_connect_val_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003480 NO_NEIGHBOR_CMD2 "timers connect <1-65535>",
paul718e3742002-12-13 20:15:29 +00003481 NO_STR
3482 NEIGHBOR_STR
Daniel Walton0d7435f2015-10-22 11:35:20 +03003483 NEIGHBOR_ADDR_STR2
paul718e3742002-12-13 20:15:29 +00003484 "BGP per neighbor timers\n"
3485 "BGP connect timer\n"
3486 "Connect timer\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003487
paul94f2b392005-06-28 12:44:16 +00003488static int
paulfd79ac92004-10-13 05:06:08 +00003489peer_advertise_interval_vty (struct vty *vty, const char *ip_str,
3490 const char *time_str, int set)
paul718e3742002-12-13 20:15:29 +00003491{
3492 int ret;
3493 struct peer *peer;
3494 u_int32_t routeadv = 0;
3495
Daniel Walton0d7435f2015-10-22 11:35:20 +03003496 peer = peer_and_group_lookup_vty (vty, ip_str);
paul718e3742002-12-13 20:15:29 +00003497 if (! peer)
3498 return CMD_WARNING;
3499
3500 if (time_str)
3501 VTY_GET_INTEGER_RANGE ("advertise interval", routeadv, time_str, 0, 600);
3502
3503 if (set)
3504 ret = peer_advertise_interval_set (peer, routeadv);
3505 else
3506 ret = peer_advertise_interval_unset (peer);
3507
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003508 return bgp_vty_return (vty, ret);
paul718e3742002-12-13 20:15:29 +00003509}
3510
3511DEFUN (neighbor_advertise_interval,
3512 neighbor_advertise_interval_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003513 NEIGHBOR_CMD2 "advertisement-interval <0-600>",
paul718e3742002-12-13 20:15:29 +00003514 NEIGHBOR_STR
Daniel Walton0d7435f2015-10-22 11:35:20 +03003515 NEIGHBOR_ADDR_STR2
paul718e3742002-12-13 20:15:29 +00003516 "Minimum interval between sending BGP routing updates\n"
3517 "time in seconds\n")
3518{
3519 return peer_advertise_interval_vty (vty, argv[0], argv[1], 1);
3520}
3521
3522DEFUN (no_neighbor_advertise_interval,
3523 no_neighbor_advertise_interval_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003524 NO_NEIGHBOR_CMD2 "advertisement-interval",
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 "Minimum interval between sending BGP routing updates\n")
3529{
3530 return peer_advertise_interval_vty (vty, argv[0], NULL, 0);
3531}
3532
3533ALIAS (no_neighbor_advertise_interval,
3534 no_neighbor_advertise_interval_val_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003535 NO_NEIGHBOR_CMD2 "advertisement-interval <0-600>",
paul718e3742002-12-13 20:15:29 +00003536 NO_STR
3537 NEIGHBOR_STR
Daniel Walton0d7435f2015-10-22 11:35:20 +03003538 NEIGHBOR_ADDR_STR2
paul718e3742002-12-13 20:15:29 +00003539 "Minimum interval between sending BGP routing updates\n"
3540 "time in seconds\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003541
paul718e3742002-12-13 20:15:29 +00003542/* neighbor interface */
paul94f2b392005-06-28 12:44:16 +00003543static int
paulfd79ac92004-10-13 05:06:08 +00003544peer_interface_vty (struct vty *vty, const char *ip_str, const char *str)
paul718e3742002-12-13 20:15:29 +00003545{
3546 int ret;
3547 struct peer *peer;
3548
3549 peer = peer_lookup_vty (vty, ip_str);
3550 if (! peer)
3551 return CMD_WARNING;
3552
3553 if (str)
3554 ret = peer_interface_set (peer, str);
3555 else
3556 ret = peer_interface_unset (peer);
3557
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003558 return bgp_vty_return (vty, ret);
paul718e3742002-12-13 20:15:29 +00003559}
3560
3561DEFUN (neighbor_interface,
3562 neighbor_interface_cmd,
3563 NEIGHBOR_CMD "interface WORD",
3564 NEIGHBOR_STR
3565 NEIGHBOR_ADDR_STR
3566 "Interface\n"
3567 "Interface name\n")
3568{
3569 return peer_interface_vty (vty, argv[0], argv[1]);
3570}
3571
3572DEFUN (no_neighbor_interface,
3573 no_neighbor_interface_cmd,
3574 NO_NEIGHBOR_CMD "interface WORD",
3575 NO_STR
3576 NEIGHBOR_STR
3577 NEIGHBOR_ADDR_STR
3578 "Interface\n"
3579 "Interface name\n")
3580{
3581 return peer_interface_vty (vty, argv[0], NULL);
3582}
David Lamparter6b0655a2014-06-04 06:53:35 +02003583
paul718e3742002-12-13 20:15:29 +00003584/* Set distribute list to the peer. */
paul94f2b392005-06-28 12:44:16 +00003585static int
paulfd79ac92004-10-13 05:06:08 +00003586peer_distribute_set_vty (struct vty *vty, const char *ip_str,
3587 afi_t afi, safi_t safi,
3588 const char *name_str, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003589{
3590 int ret;
3591 struct peer *peer;
3592 int direct = FILTER_IN;
3593
3594 peer = peer_and_group_lookup_vty (vty, ip_str);
3595 if (! peer)
3596 return CMD_WARNING;
3597
3598 /* Check filter direction. */
3599 if (strncmp (direct_str, "i", 1) == 0)
3600 direct = FILTER_IN;
3601 else if (strncmp (direct_str, "o", 1) == 0)
3602 direct = FILTER_OUT;
3603
3604 ret = peer_distribute_set (peer, afi, safi, direct, name_str);
3605
3606 return bgp_vty_return (vty, ret);
3607}
3608
paul94f2b392005-06-28 12:44:16 +00003609static int
paulfd79ac92004-10-13 05:06:08 +00003610peer_distribute_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
3611 safi_t safi, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003612{
3613 int ret;
3614 struct peer *peer;
3615 int direct = FILTER_IN;
3616
3617 peer = peer_and_group_lookup_vty (vty, ip_str);
3618 if (! peer)
3619 return CMD_WARNING;
3620
3621 /* Check filter direction. */
3622 if (strncmp (direct_str, "i", 1) == 0)
3623 direct = FILTER_IN;
3624 else if (strncmp (direct_str, "o", 1) == 0)
3625 direct = FILTER_OUT;
3626
3627 ret = peer_distribute_unset (peer, afi, safi, direct);
3628
3629 return bgp_vty_return (vty, ret);
3630}
3631
3632DEFUN (neighbor_distribute_list,
3633 neighbor_distribute_list_cmd,
3634 NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)",
3635 NEIGHBOR_STR
3636 NEIGHBOR_ADDR_STR2
3637 "Filter updates to/from this neighbor\n"
3638 "IP access-list number\n"
3639 "IP access-list number (expanded range)\n"
3640 "IP Access-list name\n"
3641 "Filter incoming updates\n"
3642 "Filter outgoing updates\n")
3643{
3644 return peer_distribute_set_vty (vty, argv[0], bgp_node_afi (vty),
3645 bgp_node_safi (vty), argv[1], argv[2]);
3646}
3647
3648DEFUN (no_neighbor_distribute_list,
3649 no_neighbor_distribute_list_cmd,
3650 NO_NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)",
3651 NO_STR
3652 NEIGHBOR_STR
3653 NEIGHBOR_ADDR_STR2
3654 "Filter updates to/from this neighbor\n"
3655 "IP access-list number\n"
3656 "IP access-list number (expanded range)\n"
3657 "IP Access-list name\n"
3658 "Filter incoming updates\n"
3659 "Filter outgoing updates\n")
3660{
3661 return peer_distribute_unset_vty (vty, argv[0], bgp_node_afi (vty),
3662 bgp_node_safi (vty), argv[2]);
3663}
David Lamparter6b0655a2014-06-04 06:53:35 +02003664
paul718e3742002-12-13 20:15:29 +00003665/* Set prefix list to the peer. */
paul94f2b392005-06-28 12:44:16 +00003666static int
paulfd79ac92004-10-13 05:06:08 +00003667peer_prefix_list_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
3668 safi_t safi, const char *name_str,
3669 const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003670{
3671 int ret;
3672 struct peer *peer;
3673 int direct = FILTER_IN;
3674
3675 peer = peer_and_group_lookup_vty (vty, ip_str);
3676 if (! peer)
3677 return CMD_WARNING;
3678
3679 /* Check filter direction. */
3680 if (strncmp (direct_str, "i", 1) == 0)
3681 direct = FILTER_IN;
3682 else if (strncmp (direct_str, "o", 1) == 0)
3683 direct = FILTER_OUT;
3684
3685 ret = peer_prefix_list_set (peer, afi, safi, direct, name_str);
3686
3687 return bgp_vty_return (vty, ret);
3688}
3689
paul94f2b392005-06-28 12:44:16 +00003690static int
paulfd79ac92004-10-13 05:06:08 +00003691peer_prefix_list_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
3692 safi_t safi, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003693{
3694 int ret;
3695 struct peer *peer;
3696 int direct = FILTER_IN;
3697
3698 peer = peer_and_group_lookup_vty (vty, ip_str);
3699 if (! peer)
3700 return CMD_WARNING;
3701
3702 /* Check filter direction. */
3703 if (strncmp (direct_str, "i", 1) == 0)
3704 direct = FILTER_IN;
3705 else if (strncmp (direct_str, "o", 1) == 0)
3706 direct = FILTER_OUT;
3707
3708 ret = peer_prefix_list_unset (peer, afi, safi, direct);
3709
3710 return bgp_vty_return (vty, ret);
3711}
3712
3713DEFUN (neighbor_prefix_list,
3714 neighbor_prefix_list_cmd,
3715 NEIGHBOR_CMD2 "prefix-list WORD (in|out)",
3716 NEIGHBOR_STR
3717 NEIGHBOR_ADDR_STR2
3718 "Filter updates to/from this neighbor\n"
3719 "Name of a prefix list\n"
3720 "Filter incoming updates\n"
3721 "Filter outgoing updates\n")
3722{
3723 return peer_prefix_list_set_vty (vty, argv[0], bgp_node_afi (vty),
3724 bgp_node_safi (vty), argv[1], argv[2]);
3725}
3726
3727DEFUN (no_neighbor_prefix_list,
3728 no_neighbor_prefix_list_cmd,
3729 NO_NEIGHBOR_CMD2 "prefix-list WORD (in|out)",
3730 NO_STR
3731 NEIGHBOR_STR
3732 NEIGHBOR_ADDR_STR2
3733 "Filter updates to/from this neighbor\n"
3734 "Name of a prefix list\n"
3735 "Filter incoming updates\n"
3736 "Filter outgoing updates\n")
3737{
3738 return peer_prefix_list_unset_vty (vty, argv[0], bgp_node_afi (vty),
3739 bgp_node_safi (vty), argv[2]);
3740}
David Lamparter6b0655a2014-06-04 06:53:35 +02003741
paul94f2b392005-06-28 12:44:16 +00003742static int
paulfd79ac92004-10-13 05:06:08 +00003743peer_aslist_set_vty (struct vty *vty, const char *ip_str,
3744 afi_t afi, safi_t safi,
3745 const char *name_str, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003746{
3747 int ret;
3748 struct peer *peer;
3749 int direct = FILTER_IN;
3750
3751 peer = peer_and_group_lookup_vty (vty, ip_str);
3752 if (! peer)
3753 return CMD_WARNING;
3754
3755 /* Check filter direction. */
3756 if (strncmp (direct_str, "i", 1) == 0)
3757 direct = FILTER_IN;
3758 else if (strncmp (direct_str, "o", 1) == 0)
3759 direct = FILTER_OUT;
3760
3761 ret = peer_aslist_set (peer, afi, safi, direct, name_str);
3762
3763 return bgp_vty_return (vty, ret);
3764}
3765
paul94f2b392005-06-28 12:44:16 +00003766static int
paulfd79ac92004-10-13 05:06:08 +00003767peer_aslist_unset_vty (struct vty *vty, const char *ip_str,
3768 afi_t afi, safi_t safi,
3769 const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003770{
3771 int ret;
3772 struct peer *peer;
3773 int direct = FILTER_IN;
3774
3775 peer = peer_and_group_lookup_vty (vty, ip_str);
3776 if (! peer)
3777 return CMD_WARNING;
3778
3779 /* Check filter direction. */
3780 if (strncmp (direct_str, "i", 1) == 0)
3781 direct = FILTER_IN;
3782 else if (strncmp (direct_str, "o", 1) == 0)
3783 direct = FILTER_OUT;
3784
3785 ret = peer_aslist_unset (peer, afi, safi, direct);
3786
3787 return bgp_vty_return (vty, ret);
3788}
3789
3790DEFUN (neighbor_filter_list,
3791 neighbor_filter_list_cmd,
3792 NEIGHBOR_CMD2 "filter-list WORD (in|out)",
3793 NEIGHBOR_STR
3794 NEIGHBOR_ADDR_STR2
3795 "Establish BGP filters\n"
3796 "AS path access-list name\n"
3797 "Filter incoming routes\n"
3798 "Filter outgoing routes\n")
3799{
3800 return peer_aslist_set_vty (vty, argv[0], bgp_node_afi (vty),
3801 bgp_node_safi (vty), argv[1], argv[2]);
3802}
3803
3804DEFUN (no_neighbor_filter_list,
3805 no_neighbor_filter_list_cmd,
3806 NO_NEIGHBOR_CMD2 "filter-list WORD (in|out)",
3807 NO_STR
3808 NEIGHBOR_STR
3809 NEIGHBOR_ADDR_STR2
3810 "Establish BGP filters\n"
3811 "AS path access-list name\n"
3812 "Filter incoming routes\n"
3813 "Filter outgoing routes\n")
3814{
3815 return peer_aslist_unset_vty (vty, argv[0], bgp_node_afi (vty),
3816 bgp_node_safi (vty), argv[2]);
3817}
David Lamparter6b0655a2014-06-04 06:53:35 +02003818
paul718e3742002-12-13 20:15:29 +00003819/* Set route-map to the peer. */
paul94f2b392005-06-28 12:44:16 +00003820static int
paulfd79ac92004-10-13 05:06:08 +00003821peer_route_map_set_vty (struct vty *vty, const char *ip_str,
3822 afi_t afi, safi_t safi,
3823 const char *name_str, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003824{
3825 int ret;
3826 struct peer *peer;
paulfee0f4c2004-09-13 05:12:46 +00003827 int direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003828
3829 peer = peer_and_group_lookup_vty (vty, ip_str);
3830 if (! peer)
3831 return CMD_WARNING;
3832
3833 /* Check filter direction. */
paulfee0f4c2004-09-13 05:12:46 +00003834 if (strncmp (direct_str, "in", 2) == 0)
3835 direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003836 else if (strncmp (direct_str, "o", 1) == 0)
paulfee0f4c2004-09-13 05:12:46 +00003837 direct = RMAP_OUT;
3838 else if (strncmp (direct_str, "im", 2) == 0)
3839 direct = RMAP_IMPORT;
3840 else if (strncmp (direct_str, "e", 1) == 0)
3841 direct = RMAP_EXPORT;
paul718e3742002-12-13 20:15:29 +00003842
3843 ret = peer_route_map_set (peer, afi, safi, direct, name_str);
3844
3845 return bgp_vty_return (vty, ret);
3846}
3847
paul94f2b392005-06-28 12:44:16 +00003848static int
paulfd79ac92004-10-13 05:06:08 +00003849peer_route_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
3850 safi_t safi, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003851{
3852 int ret;
3853 struct peer *peer;
paulfee0f4c2004-09-13 05:12:46 +00003854 int direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003855
3856 peer = peer_and_group_lookup_vty (vty, ip_str);
3857 if (! peer)
3858 return CMD_WARNING;
3859
3860 /* Check filter direction. */
paulfee0f4c2004-09-13 05:12:46 +00003861 if (strncmp (direct_str, "in", 2) == 0)
3862 direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003863 else if (strncmp (direct_str, "o", 1) == 0)
paulfee0f4c2004-09-13 05:12:46 +00003864 direct = RMAP_OUT;
3865 else if (strncmp (direct_str, "im", 2) == 0)
3866 direct = RMAP_IMPORT;
3867 else if (strncmp (direct_str, "e", 1) == 0)
3868 direct = RMAP_EXPORT;
paul718e3742002-12-13 20:15:29 +00003869
3870 ret = peer_route_map_unset (peer, afi, safi, direct);
3871
3872 return bgp_vty_return (vty, ret);
3873}
3874
3875DEFUN (neighbor_route_map,
3876 neighbor_route_map_cmd,
paulfee0f4c2004-09-13 05:12:46 +00003877 NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)",
paul718e3742002-12-13 20:15:29 +00003878 NEIGHBOR_STR
3879 NEIGHBOR_ADDR_STR2
3880 "Apply route map to neighbor\n"
3881 "Name of route map\n"
3882 "Apply map to incoming routes\n"
paulfee0f4c2004-09-13 05:12:46 +00003883 "Apply map to outbound routes\n"
3884 "Apply map to routes going into a Route-Server client's table\n"
3885 "Apply map to routes coming from a Route-Server client")
paul718e3742002-12-13 20:15:29 +00003886{
3887 return peer_route_map_set_vty (vty, argv[0], bgp_node_afi (vty),
3888 bgp_node_safi (vty), argv[1], argv[2]);
3889}
3890
3891DEFUN (no_neighbor_route_map,
3892 no_neighbor_route_map_cmd,
paulfee0f4c2004-09-13 05:12:46 +00003893 NO_NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)",
paul718e3742002-12-13 20:15:29 +00003894 NO_STR
3895 NEIGHBOR_STR
3896 NEIGHBOR_ADDR_STR2
3897 "Apply route map to neighbor\n"
3898 "Name of route map\n"
3899 "Apply map to incoming routes\n"
paulfee0f4c2004-09-13 05:12:46 +00003900 "Apply map to outbound routes\n"
3901 "Apply map to routes going into a Route-Server client's table\n"
3902 "Apply map to routes coming from a Route-Server client")
paul718e3742002-12-13 20:15:29 +00003903{
3904 return peer_route_map_unset_vty (vty, argv[0], bgp_node_afi (vty),
3905 bgp_node_safi (vty), argv[2]);
3906}
David Lamparter6b0655a2014-06-04 06:53:35 +02003907
paul718e3742002-12-13 20:15:29 +00003908/* Set unsuppress-map to the peer. */
paul94f2b392005-06-28 12:44:16 +00003909static int
paulfd79ac92004-10-13 05:06:08 +00003910peer_unsuppress_map_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
3911 safi_t safi, const char *name_str)
paul718e3742002-12-13 20:15:29 +00003912{
3913 int ret;
3914 struct peer *peer;
3915
3916 peer = peer_and_group_lookup_vty (vty, ip_str);
3917 if (! peer)
3918 return CMD_WARNING;
3919
3920 ret = peer_unsuppress_map_set (peer, afi, safi, name_str);
3921
3922 return bgp_vty_return (vty, ret);
3923}
3924
3925/* Unset route-map from the peer. */
paul94f2b392005-06-28 12:44:16 +00003926static int
paulfd79ac92004-10-13 05:06:08 +00003927peer_unsuppress_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
paul718e3742002-12-13 20:15:29 +00003928 safi_t safi)
3929{
3930 int ret;
3931 struct peer *peer;
3932
3933 peer = peer_and_group_lookup_vty (vty, ip_str);
3934 if (! peer)
3935 return CMD_WARNING;
3936
3937 ret = peer_unsuppress_map_unset (peer, afi, safi);
3938
3939 return bgp_vty_return (vty, ret);
3940}
3941
3942DEFUN (neighbor_unsuppress_map,
3943 neighbor_unsuppress_map_cmd,
3944 NEIGHBOR_CMD2 "unsuppress-map WORD",
3945 NEIGHBOR_STR
3946 NEIGHBOR_ADDR_STR2
3947 "Route-map to selectively unsuppress suppressed routes\n"
3948 "Name of route map\n")
3949{
3950 return peer_unsuppress_map_set_vty (vty, argv[0], bgp_node_afi (vty),
3951 bgp_node_safi (vty), argv[1]);
3952}
3953
3954DEFUN (no_neighbor_unsuppress_map,
3955 no_neighbor_unsuppress_map_cmd,
3956 NO_NEIGHBOR_CMD2 "unsuppress-map WORD",
3957 NO_STR
3958 NEIGHBOR_STR
3959 NEIGHBOR_ADDR_STR2
3960 "Route-map to selectively unsuppress suppressed routes\n"
3961 "Name of route map\n")
3962{
3963 return peer_unsuppress_map_unset_vty (vty, argv[0], bgp_node_afi (vty),
3964 bgp_node_safi (vty));
3965}
David Lamparter6b0655a2014-06-04 06:53:35 +02003966
paul94f2b392005-06-28 12:44:16 +00003967static int
paulfd79ac92004-10-13 05:06:08 +00003968peer_maximum_prefix_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
3969 safi_t safi, const char *num_str,
hasso0a486e52005-02-01 20:57:17 +00003970 const char *threshold_str, int warning,
3971 const char *restart_str)
paul718e3742002-12-13 20:15:29 +00003972{
3973 int ret;
3974 struct peer *peer;
3975 u_int32_t max;
hassoe0701b72004-05-20 09:19:34 +00003976 u_char threshold;
hasso0a486e52005-02-01 20:57:17 +00003977 u_int16_t restart;
paul718e3742002-12-13 20:15:29 +00003978
3979 peer = peer_and_group_lookup_vty (vty, ip_str);
3980 if (! peer)
3981 return CMD_WARNING;
3982
Denis Ovsienkoe6ec1c32011-09-10 21:50:53 +04003983 VTY_GET_INTEGER ("maximum number", max, num_str);
hassoe0701b72004-05-20 09:19:34 +00003984 if (threshold_str)
3985 threshold = atoi (threshold_str);
3986 else
3987 threshold = MAXIMUM_PREFIX_THRESHOLD_DEFAULT;
paul718e3742002-12-13 20:15:29 +00003988
hasso0a486e52005-02-01 20:57:17 +00003989 if (restart_str)
3990 restart = atoi (restart_str);
3991 else
3992 restart = 0;
3993
3994 ret = peer_maximum_prefix_set (peer, afi, safi, max, threshold, warning, restart);
paul718e3742002-12-13 20:15:29 +00003995
3996 return bgp_vty_return (vty, ret);
3997}
3998
paul94f2b392005-06-28 12:44:16 +00003999static int
paulfd79ac92004-10-13 05:06:08 +00004000peer_maximum_prefix_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
paul718e3742002-12-13 20:15:29 +00004001 safi_t safi)
4002{
4003 int ret;
4004 struct peer *peer;
4005
4006 peer = peer_and_group_lookup_vty (vty, ip_str);
4007 if (! peer)
4008 return CMD_WARNING;
4009
4010 ret = peer_maximum_prefix_unset (peer, afi, safi);
4011
4012 return bgp_vty_return (vty, ret);
4013}
4014
4015/* Maximum number of prefix configuration. prefix count is different
4016 for each peer configuration. So this configuration can be set for
4017 each peer configuration. */
4018DEFUN (neighbor_maximum_prefix,
4019 neighbor_maximum_prefix_cmd,
4020 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>",
4021 NEIGHBOR_STR
4022 NEIGHBOR_ADDR_STR2
4023 "Maximum number of prefix accept from this peer\n"
4024 "maximum no. of prefix limit\n")
4025{
4026 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00004027 bgp_node_safi (vty), argv[1], NULL, 0,
4028 NULL);
paul718e3742002-12-13 20:15:29 +00004029}
4030
hassoe0701b72004-05-20 09:19:34 +00004031DEFUN (neighbor_maximum_prefix_threshold,
4032 neighbor_maximum_prefix_threshold_cmd,
4033 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100>",
4034 NEIGHBOR_STR
4035 NEIGHBOR_ADDR_STR2
4036 "Maximum number of prefix accept from this peer\n"
4037 "maximum no. of prefix limit\n"
4038 "Threshold value (%) at which to generate a warning msg\n")
4039{
4040 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00004041 bgp_node_safi (vty), argv[1], argv[2], 0,
4042 NULL);
4043}
hassoe0701b72004-05-20 09:19:34 +00004044
paul718e3742002-12-13 20:15:29 +00004045DEFUN (neighbor_maximum_prefix_warning,
4046 neighbor_maximum_prefix_warning_cmd,
4047 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
4048 NEIGHBOR_STR
4049 NEIGHBOR_ADDR_STR2
4050 "Maximum number of prefix accept from this peer\n"
4051 "maximum no. of prefix limit\n"
4052 "Only give warning message when limit is exceeded\n")
4053{
4054 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00004055 bgp_node_safi (vty), argv[1], NULL, 1,
4056 NULL);
paul718e3742002-12-13 20:15:29 +00004057}
4058
hassoe0701b72004-05-20 09:19:34 +00004059DEFUN (neighbor_maximum_prefix_threshold_warning,
4060 neighbor_maximum_prefix_threshold_warning_cmd,
4061 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only",
4062 NEIGHBOR_STR
4063 NEIGHBOR_ADDR_STR2
4064 "Maximum number of prefix accept from this peer\n"
4065 "maximum no. of prefix limit\n"
4066 "Threshold value (%) at which to generate a warning msg\n"
4067 "Only give warning message when limit is exceeded\n")
4068{
4069 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00004070 bgp_node_safi (vty), argv[1], argv[2], 1, NULL);
4071}
4072
4073DEFUN (neighbor_maximum_prefix_restart,
4074 neighbor_maximum_prefix_restart_cmd,
4075 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>",
4076 NEIGHBOR_STR
4077 NEIGHBOR_ADDR_STR2
4078 "Maximum number of prefix accept from this peer\n"
4079 "maximum no. of prefix limit\n"
4080 "Restart bgp connection after limit is exceeded\n"
4081 "Restart interval in minutes")
4082{
4083 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
4084 bgp_node_safi (vty), argv[1], NULL, 0, argv[2]);
4085}
4086
4087DEFUN (neighbor_maximum_prefix_threshold_restart,
4088 neighbor_maximum_prefix_threshold_restart_cmd,
4089 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>",
4090 NEIGHBOR_STR
4091 NEIGHBOR_ADDR_STR2
4092 "Maximum number of prefix accept from this peer\n"
4093 "maximum no. of prefix limit\n"
4094 "Threshold value (%) at which to generate a warning msg\n"
4095 "Restart bgp connection after limit is exceeded\n"
4096 "Restart interval in minutes")
4097{
4098 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
4099 bgp_node_safi (vty), argv[1], argv[2], 0, argv[3]);
4100}
hassoe0701b72004-05-20 09:19:34 +00004101
paul718e3742002-12-13 20:15:29 +00004102DEFUN (no_neighbor_maximum_prefix,
4103 no_neighbor_maximum_prefix_cmd,
4104 NO_NEIGHBOR_CMD2 "maximum-prefix",
4105 NO_STR
4106 NEIGHBOR_STR
4107 NEIGHBOR_ADDR_STR2
4108 "Maximum number of prefix accept from this peer\n")
4109{
4110 return peer_maximum_prefix_unset_vty (vty, argv[0], bgp_node_afi (vty),
4111 bgp_node_safi (vty));
4112}
4113
4114ALIAS (no_neighbor_maximum_prefix,
4115 no_neighbor_maximum_prefix_val_cmd,
4116 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>",
4117 NO_STR
4118 NEIGHBOR_STR
4119 NEIGHBOR_ADDR_STR2
4120 "Maximum number of prefix accept from this peer\n"
4121 "maximum no. of prefix limit\n")
4122
4123ALIAS (no_neighbor_maximum_prefix,
hasso0a486e52005-02-01 20:57:17 +00004124 no_neighbor_maximum_prefix_threshold_cmd,
4125 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
4126 NO_STR
4127 NEIGHBOR_STR
4128 NEIGHBOR_ADDR_STR2
4129 "Maximum number of prefix accept from this peer\n"
4130 "maximum no. of prefix limit\n"
4131 "Threshold value (%) at which to generate a warning msg\n")
4132
4133ALIAS (no_neighbor_maximum_prefix,
4134 no_neighbor_maximum_prefix_warning_cmd,
4135 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
4136 NO_STR
4137 NEIGHBOR_STR
4138 NEIGHBOR_ADDR_STR2
4139 "Maximum number of prefix accept from this peer\n"
4140 "maximum no. of prefix limit\n"
paule8e19462006-01-19 20:16:55 +00004141 "Only give warning message when limit is exceeded\n")
hasso0a486e52005-02-01 20:57:17 +00004142
4143ALIAS (no_neighbor_maximum_prefix,
4144 no_neighbor_maximum_prefix_threshold_warning_cmd,
hassoe0701b72004-05-20 09:19:34 +00004145 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only",
4146 NO_STR
4147 NEIGHBOR_STR
4148 NEIGHBOR_ADDR_STR2
4149 "Maximum number of prefix accept from this peer\n"
4150 "maximum no. of prefix limit\n"
4151 "Threshold value (%) at which to generate a warning msg\n"
paule8e19462006-01-19 20:16:55 +00004152 "Only give warning message when limit is exceeded\n")
hassoe0701b72004-05-20 09:19:34 +00004153
4154ALIAS (no_neighbor_maximum_prefix,
hasso0a486e52005-02-01 20:57:17 +00004155 no_neighbor_maximum_prefix_restart_cmd,
4156 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>",
paul718e3742002-12-13 20:15:29 +00004157 NO_STR
4158 NEIGHBOR_STR
4159 NEIGHBOR_ADDR_STR2
4160 "Maximum number of prefix accept from this peer\n"
4161 "maximum no. of prefix limit\n"
hasso0a486e52005-02-01 20:57:17 +00004162 "Restart bgp connection after limit is exceeded\n"
4163 "Restart interval in minutes")
4164
4165ALIAS (no_neighbor_maximum_prefix,
4166 no_neighbor_maximum_prefix_threshold_restart_cmd,
4167 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>",
4168 NO_STR
4169 NEIGHBOR_STR
4170 NEIGHBOR_ADDR_STR2
4171 "Maximum number of prefix accept from this peer\n"
4172 "maximum no. of prefix limit\n"
4173 "Threshold value (%) at which to generate a warning msg\n"
4174 "Restart bgp connection after limit is exceeded\n"
4175 "Restart interval in minutes")
David Lamparter6b0655a2014-06-04 06:53:35 +02004176
paul718e3742002-12-13 20:15:29 +00004177/* "neighbor allowas-in" */
4178DEFUN (neighbor_allowas_in,
4179 neighbor_allowas_in_cmd,
4180 NEIGHBOR_CMD2 "allowas-in",
4181 NEIGHBOR_STR
4182 NEIGHBOR_ADDR_STR2
4183 "Accept as-path with my AS present in it\n")
4184{
4185 int ret;
4186 struct peer *peer;
paulfd79ac92004-10-13 05:06:08 +00004187 unsigned int allow_num;
paul718e3742002-12-13 20:15:29 +00004188
4189 peer = peer_and_group_lookup_vty (vty, argv[0]);
4190 if (! peer)
4191 return CMD_WARNING;
4192
4193 if (argc == 1)
4194 allow_num = 3;
4195 else
4196 VTY_GET_INTEGER_RANGE ("AS number", allow_num, argv[1], 1, 10);
4197
4198 ret = peer_allowas_in_set (peer, bgp_node_afi (vty), bgp_node_safi (vty),
4199 allow_num);
4200
4201 return bgp_vty_return (vty, ret);
4202}
4203
4204ALIAS (neighbor_allowas_in,
4205 neighbor_allowas_in_arg_cmd,
4206 NEIGHBOR_CMD2 "allowas-in <1-10>",
4207 NEIGHBOR_STR
4208 NEIGHBOR_ADDR_STR2
4209 "Accept as-path with my AS present in it\n"
4210 "Number of occurances of AS number\n")
4211
4212DEFUN (no_neighbor_allowas_in,
4213 no_neighbor_allowas_in_cmd,
4214 NO_NEIGHBOR_CMD2 "allowas-in",
4215 NO_STR
4216 NEIGHBOR_STR
4217 NEIGHBOR_ADDR_STR2
4218 "allow local ASN appears in aspath attribute\n")
4219{
4220 int ret;
4221 struct peer *peer;
4222
4223 peer = peer_and_group_lookup_vty (vty, argv[0]);
4224 if (! peer)
4225 return CMD_WARNING;
4226
4227 ret = peer_allowas_in_unset (peer, bgp_node_afi (vty), bgp_node_safi (vty));
4228
4229 return bgp_vty_return (vty, ret);
4230}
David Lamparter6b0655a2014-06-04 06:53:35 +02004231
Nick Hilliardfa411a22011-03-23 15:33:17 +00004232DEFUN (neighbor_ttl_security,
4233 neighbor_ttl_security_cmd,
4234 NEIGHBOR_CMD2 "ttl-security hops <1-254>",
4235 NEIGHBOR_STR
4236 NEIGHBOR_ADDR_STR2
4237 "Specify the maximum number of hops to the BGP peer\n")
4238{
4239 struct peer *peer;
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00004240 int gtsm_hops;
Nick Hilliardfa411a22011-03-23 15:33:17 +00004241
4242 peer = peer_and_group_lookup_vty (vty, argv[0]);
4243 if (! peer)
4244 return CMD_WARNING;
4245
4246 VTY_GET_INTEGER_RANGE ("", gtsm_hops, argv[1], 1, 254);
4247
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00004248 return bgp_vty_return (vty, peer_ttl_security_hops_set (peer, gtsm_hops));
Nick Hilliardfa411a22011-03-23 15:33:17 +00004249}
4250
4251DEFUN (no_neighbor_ttl_security,
4252 no_neighbor_ttl_security_cmd,
4253 NO_NEIGHBOR_CMD2 "ttl-security hops <1-254>",
4254 NO_STR
4255 NEIGHBOR_STR
4256 NEIGHBOR_ADDR_STR2
4257 "Specify the maximum number of hops to the BGP peer\n")
4258{
4259 struct peer *peer;
Nick Hilliardfa411a22011-03-23 15:33:17 +00004260
4261 peer = peer_and_group_lookup_vty (vty, argv[0]);
4262 if (! peer)
4263 return CMD_WARNING;
4264
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00004265 return bgp_vty_return (vty, peer_ttl_security_hops_unset (peer));
Nick Hilliardfa411a22011-03-23 15:33:17 +00004266}
David Lamparter6b0655a2014-06-04 06:53:35 +02004267
paul718e3742002-12-13 20:15:29 +00004268/* Address family configuration. */
4269DEFUN (address_family_ipv4,
4270 address_family_ipv4_cmd,
4271 "address-family ipv4",
4272 "Enter Address Family command mode\n"
4273 "Address family\n")
4274{
4275 vty->node = BGP_IPV4_NODE;
4276 return CMD_SUCCESS;
4277}
4278
4279DEFUN (address_family_ipv4_safi,
4280 address_family_ipv4_safi_cmd,
4281 "address-family ipv4 (unicast|multicast)",
4282 "Enter Address Family command mode\n"
4283 "Address family\n"
4284 "Address Family modifier\n"
4285 "Address Family modifier\n")
4286{
4287 if (strncmp (argv[0], "m", 1) == 0)
4288 vty->node = BGP_IPV4M_NODE;
4289 else
4290 vty->node = BGP_IPV4_NODE;
4291
4292 return CMD_SUCCESS;
4293}
4294
paul25ffbdc2005-08-22 22:42:08 +00004295DEFUN (address_family_ipv6,
4296 address_family_ipv6_cmd,
4297 "address-family ipv6",
paul718e3742002-12-13 20:15:29 +00004298 "Enter Address Family command mode\n"
paul25ffbdc2005-08-22 22:42:08 +00004299 "Address family\n")
paul718e3742002-12-13 20:15:29 +00004300{
4301 vty->node = BGP_IPV6_NODE;
4302 return CMD_SUCCESS;
4303}
4304
paul25ffbdc2005-08-22 22:42:08 +00004305DEFUN (address_family_ipv6_safi,
4306 address_family_ipv6_safi_cmd,
4307 "address-family ipv6 (unicast|multicast)",
paul718e3742002-12-13 20:15:29 +00004308 "Enter Address Family command mode\n"
paul25ffbdc2005-08-22 22:42:08 +00004309 "Address family\n"
4310 "Address Family modifier\n"
4311 "Address Family modifier\n")
4312{
4313 if (strncmp (argv[0], "m", 1) == 0)
4314 vty->node = BGP_IPV6M_NODE;
4315 else
4316 vty->node = BGP_IPV6_NODE;
4317
4318 return CMD_SUCCESS;
4319}
paul718e3742002-12-13 20:15:29 +00004320
4321DEFUN (address_family_vpnv4,
4322 address_family_vpnv4_cmd,
4323 "address-family vpnv4",
4324 "Enter Address Family command mode\n"
4325 "Address family\n")
4326{
4327 vty->node = BGP_VPNV4_NODE;
4328 return CMD_SUCCESS;
4329}
4330
4331ALIAS (address_family_vpnv4,
4332 address_family_vpnv4_unicast_cmd,
4333 "address-family vpnv4 unicast",
4334 "Enter Address Family command mode\n"
4335 "Address family\n"
4336 "Address Family Modifier\n")
4337
Lou Berger13c378d2016-01-12 13:41:56 -05004338DEFUN (address_family_vpnv6,
4339 address_family_vpnv6_cmd,
4340 "address-family vpnv6",
4341 "Enter Address Family command mode\n"
4342 "Address family\n")
4343{
4344 vty->node = BGP_VPNV6_NODE;
4345 return CMD_SUCCESS;
4346}
4347
4348ALIAS (address_family_vpnv6,
4349 address_family_vpnv6_unicast_cmd,
4350 "address-family vpnv6 unicast",
4351 "Enter Address Family command mode\n"
4352 "Address family\n"
4353 "Address Family Modifier\n")
4354
Lou Bergera3fda882016-01-12 13:42:04 -05004355DEFUN (address_family_encap,
4356 address_family_encap_cmd,
4357 "address-family encap",
4358 "Enter Address Family command mode\n"
4359 "Address family\n")
4360{
4361 vty->node = BGP_ENCAP_NODE;
4362 return CMD_SUCCESS;
4363}
4364
4365ALIAS (address_family_encap,
4366 address_family_encapv4_cmd,
4367 "address-family encapv4",
4368 "Enter Address Family command mode\n"
4369 "Address family\n")
4370
4371DEFUN (address_family_encapv6,
4372 address_family_encapv6_cmd,
4373 "address-family encapv6",
4374 "Enter Address Family command mode\n"
4375 "Address family\n")
4376{
4377 vty->node = BGP_ENCAPV6_NODE;
4378 return CMD_SUCCESS;
4379}
4380
paul718e3742002-12-13 20:15:29 +00004381DEFUN (exit_address_family,
4382 exit_address_family_cmd,
4383 "exit-address-family",
4384 "Exit from Address Family configuration mode\n")
4385{
Lou Bergera3fda882016-01-12 13:42:04 -05004386 /* should match list in command.c:config_exit */
hassoa8a80d52005-04-09 13:07:47 +00004387 if (vty->node == BGP_IPV4_NODE
Lou Bergera3fda882016-01-12 13:42:04 -05004388 || vty->node == BGP_ENCAP_NODE
4389 || vty->node == BGP_ENCAPV6_NODE
hassoa8a80d52005-04-09 13:07:47 +00004390 || vty->node == BGP_IPV4M_NODE
paul718e3742002-12-13 20:15:29 +00004391 || vty->node == BGP_VPNV4_NODE
Lou Berger13c378d2016-01-12 13:41:56 -05004392 || vty->node == BGP_VPNV6_NODE
paul25ffbdc2005-08-22 22:42:08 +00004393 || vty->node == BGP_IPV6_NODE
4394 || vty->node == BGP_IPV6M_NODE)
paul718e3742002-12-13 20:15:29 +00004395 vty->node = BGP_NODE;
4396 return CMD_SUCCESS;
4397}
David Lamparter6b0655a2014-06-04 06:53:35 +02004398
paul718e3742002-12-13 20:15:29 +00004399/* BGP clear sort. */
4400enum clear_sort
4401{
4402 clear_all,
4403 clear_peer,
4404 clear_group,
4405 clear_external,
4406 clear_as
4407};
4408
paul94f2b392005-06-28 12:44:16 +00004409static void
paul718e3742002-12-13 20:15:29 +00004410bgp_clear_vty_error (struct vty *vty, struct peer *peer, afi_t afi,
4411 safi_t safi, int error)
4412{
4413 switch (error)
4414 {
4415 case BGP_ERR_AF_UNCONFIGURED:
4416 vty_out (vty,
4417 "%%BGP: Enable %s %s address family for the neighbor %s%s",
4418 afi == AFI_IP6 ? "IPv6" : safi == SAFI_MPLS_VPN ? "VPNv4" : "IPv4",
4419 safi == SAFI_MULTICAST ? "Multicast" : "Unicast",
4420 peer->host, VTY_NEWLINE);
4421 break;
4422 case BGP_ERR_SOFT_RECONFIG_UNCONFIGURED:
4423 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);
4424 break;
4425 default:
4426 break;
4427 }
4428}
4429
4430/* `clear ip bgp' functions. */
paul94f2b392005-06-28 12:44:16 +00004431static int
paul718e3742002-12-13 20:15:29 +00004432bgp_clear (struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi,
paulfd79ac92004-10-13 05:06:08 +00004433 enum clear_sort sort,enum bgp_clear_type stype, const char *arg)
paul718e3742002-12-13 20:15:29 +00004434{
4435 int ret;
4436 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00004437 struct listnode *node, *nnode;
paul718e3742002-12-13 20:15:29 +00004438
4439 /* Clear all neighbors. */
4440 if (sort == clear_all)
4441 {
paul1eb8ef22005-04-07 07:30:20 +00004442 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004443 {
4444 if (stype == BGP_CLEAR_SOFT_NONE)
4445 ret = peer_clear (peer);
4446 else
4447 ret = peer_clear_soft (peer, afi, safi, stype);
4448
4449 if (ret < 0)
4450 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4451 }
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004452 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004453 }
4454
4455 /* Clear specified neighbors. */
4456 if (sort == clear_peer)
4457 {
4458 union sockunion su;
4459 int ret;
4460
4461 /* Make sockunion for lookup. */
4462 ret = str2sockunion (arg, &su);
4463 if (ret < 0)
4464 {
4465 vty_out (vty, "Malformed address: %s%s", arg, VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004466 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00004467 }
4468 peer = peer_lookup (bgp, &su);
4469 if (! peer)
4470 {
4471 vty_out (vty, "%%BGP: Unknown neighbor - \"%s\"%s", arg, VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004472 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00004473 }
4474
4475 if (stype == BGP_CLEAR_SOFT_NONE)
4476 ret = peer_clear (peer);
4477 else
4478 ret = peer_clear_soft (peer, afi, safi, stype);
4479
4480 if (ret < 0)
4481 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4482
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004483 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004484 }
4485
4486 /* Clear all peer-group members. */
4487 if (sort == clear_group)
4488 {
4489 struct peer_group *group;
4490
4491 group = peer_group_lookup (bgp, arg);
4492 if (! group)
4493 {
4494 vty_out (vty, "%%BGP: No such peer-group %s%s", arg, VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004495 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00004496 }
4497
paul1eb8ef22005-04-07 07:30:20 +00004498 for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004499 {
4500 if (stype == BGP_CLEAR_SOFT_NONE)
4501 {
4502 ret = peer_clear (peer);
4503 continue;
4504 }
4505
4506 if (! peer->af_group[afi][safi])
4507 continue;
4508
4509 ret = peer_clear_soft (peer, afi, safi, stype);
4510
4511 if (ret < 0)
4512 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4513 }
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004514 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004515 }
4516
4517 if (sort == clear_external)
4518 {
paul1eb8ef22005-04-07 07:30:20 +00004519 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004520 {
Jorge Boncompte [DTI2]6d85b152012-05-07 16:52:54 +00004521 if (peer->sort == BGP_PEER_IBGP)
paul718e3742002-12-13 20:15:29 +00004522 continue;
4523
4524 if (stype == BGP_CLEAR_SOFT_NONE)
4525 ret = peer_clear (peer);
4526 else
4527 ret = peer_clear_soft (peer, afi, safi, stype);
4528
4529 if (ret < 0)
4530 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4531 }
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004532 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004533 }
4534
4535 if (sort == clear_as)
4536 {
4537 as_t as;
paul718e3742002-12-13 20:15:29 +00004538 int find = 0;
4539
Ulrich Weberbde12e32011-11-16 19:32:12 +04004540 VTY_GET_INTEGER_RANGE ("AS", as, arg, 1, BGP_AS4_MAX);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004541
paul1eb8ef22005-04-07 07:30:20 +00004542 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004543 {
4544 if (peer->as != as)
4545 continue;
4546
4547 find = 1;
4548 if (stype == BGP_CLEAR_SOFT_NONE)
4549 ret = peer_clear (peer);
4550 else
4551 ret = peer_clear_soft (peer, afi, safi, stype);
4552
4553 if (ret < 0)
4554 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4555 }
4556 if (! find)
4557 vty_out (vty, "%%BGP: No peer is configured with AS %s%s", arg,
4558 VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004559 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004560 }
4561
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004562 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004563}
4564
paul94f2b392005-06-28 12:44:16 +00004565static int
paulfd79ac92004-10-13 05:06:08 +00004566bgp_clear_vty (struct vty *vty, const char *name, afi_t afi, safi_t safi,
4567 enum clear_sort sort, enum bgp_clear_type stype,
4568 const char *arg)
paul718e3742002-12-13 20:15:29 +00004569{
paul718e3742002-12-13 20:15:29 +00004570 struct bgp *bgp;
4571
4572 /* BGP structure lookup. */
4573 if (name)
4574 {
4575 bgp = bgp_lookup_by_name (name);
4576 if (bgp == NULL)
4577 {
4578 vty_out (vty, "Can't find BGP view %s%s", name, VTY_NEWLINE);
4579 return CMD_WARNING;
4580 }
4581 }
4582 else
4583 {
4584 bgp = bgp_get_default ();
4585 if (bgp == NULL)
4586 {
4587 vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE);
4588 return CMD_WARNING;
4589 }
4590 }
4591
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004592 return bgp_clear (vty, bgp, afi, safi, sort, stype, arg);
paul718e3742002-12-13 20:15:29 +00004593}
4594
4595DEFUN (clear_ip_bgp_all,
4596 clear_ip_bgp_all_cmd,
4597 "clear ip bgp *",
4598 CLEAR_STR
4599 IP_STR
4600 BGP_STR
4601 "Clear all peers\n")
4602{
4603 if (argc == 1)
4604 return bgp_clear_vty (vty, argv[0], 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL);
4605
4606 return bgp_clear_vty (vty, NULL, 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL);
4607}
4608
4609ALIAS (clear_ip_bgp_all,
4610 clear_bgp_all_cmd,
4611 "clear bgp *",
4612 CLEAR_STR
4613 BGP_STR
4614 "Clear all peers\n")
4615
4616ALIAS (clear_ip_bgp_all,
4617 clear_bgp_ipv6_all_cmd,
4618 "clear bgp ipv6 *",
4619 CLEAR_STR
4620 BGP_STR
4621 "Address family\n"
4622 "Clear all peers\n")
4623
4624ALIAS (clear_ip_bgp_all,
4625 clear_ip_bgp_instance_all_cmd,
4626 "clear ip bgp view WORD *",
4627 CLEAR_STR
4628 IP_STR
4629 BGP_STR
4630 "BGP view\n"
4631 "view name\n"
4632 "Clear all peers\n")
4633
4634ALIAS (clear_ip_bgp_all,
4635 clear_bgp_instance_all_cmd,
4636 "clear bgp view WORD *",
4637 CLEAR_STR
4638 BGP_STR
4639 "BGP view\n"
4640 "view name\n"
4641 "Clear all peers\n")
4642
4643DEFUN (clear_ip_bgp_peer,
4644 clear_ip_bgp_peer_cmd,
4645 "clear ip bgp (A.B.C.D|X:X::X:X)",
4646 CLEAR_STR
4647 IP_STR
4648 BGP_STR
4649 "BGP neighbor IP address to clear\n"
4650 "BGP IPv6 neighbor to clear\n")
4651{
4652 return bgp_clear_vty (vty, NULL, 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[0]);
4653}
4654
4655ALIAS (clear_ip_bgp_peer,
4656 clear_bgp_peer_cmd,
4657 "clear bgp (A.B.C.D|X:X::X:X)",
4658 CLEAR_STR
4659 BGP_STR
4660 "BGP neighbor address to clear\n"
4661 "BGP IPv6 neighbor to clear\n")
4662
4663ALIAS (clear_ip_bgp_peer,
4664 clear_bgp_ipv6_peer_cmd,
4665 "clear bgp ipv6 (A.B.C.D|X:X::X:X)",
4666 CLEAR_STR
4667 BGP_STR
4668 "Address family\n"
4669 "BGP neighbor address to clear\n"
4670 "BGP IPv6 neighbor to clear\n")
4671
4672DEFUN (clear_ip_bgp_peer_group,
4673 clear_ip_bgp_peer_group_cmd,
4674 "clear ip bgp peer-group WORD",
4675 CLEAR_STR
4676 IP_STR
4677 BGP_STR
4678 "Clear all members of peer-group\n"
4679 "BGP peer-group name\n")
4680{
4681 return bgp_clear_vty (vty, NULL, 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[0]);
4682}
4683
4684ALIAS (clear_ip_bgp_peer_group,
4685 clear_bgp_peer_group_cmd,
4686 "clear bgp peer-group WORD",
4687 CLEAR_STR
4688 BGP_STR
4689 "Clear all members of peer-group\n"
4690 "BGP peer-group name\n")
4691
4692ALIAS (clear_ip_bgp_peer_group,
4693 clear_bgp_ipv6_peer_group_cmd,
4694 "clear bgp ipv6 peer-group WORD",
4695 CLEAR_STR
4696 BGP_STR
4697 "Address family\n"
4698 "Clear all members of peer-group\n"
4699 "BGP peer-group name\n")
4700
4701DEFUN (clear_ip_bgp_external,
4702 clear_ip_bgp_external_cmd,
4703 "clear ip bgp external",
4704 CLEAR_STR
4705 IP_STR
4706 BGP_STR
4707 "Clear all external peers\n")
4708{
4709 return bgp_clear_vty (vty, NULL, 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL);
4710}
4711
4712ALIAS (clear_ip_bgp_external,
4713 clear_bgp_external_cmd,
4714 "clear bgp external",
4715 CLEAR_STR
4716 BGP_STR
4717 "Clear all external peers\n")
4718
4719ALIAS (clear_ip_bgp_external,
4720 clear_bgp_ipv6_external_cmd,
4721 "clear bgp ipv6 external",
4722 CLEAR_STR
4723 BGP_STR
4724 "Address family\n"
4725 "Clear all external peers\n")
4726
4727DEFUN (clear_ip_bgp_as,
4728 clear_ip_bgp_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00004729 "clear ip bgp " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00004730 CLEAR_STR
4731 IP_STR
4732 BGP_STR
4733 "Clear peers with the AS number\n")
4734{
4735 return bgp_clear_vty (vty, NULL, 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[0]);
4736}
4737
4738ALIAS (clear_ip_bgp_as,
4739 clear_bgp_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00004740 "clear bgp " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00004741 CLEAR_STR
4742 BGP_STR
4743 "Clear peers with the AS number\n")
4744
4745ALIAS (clear_ip_bgp_as,
4746 clear_bgp_ipv6_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00004747 "clear bgp ipv6 " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00004748 CLEAR_STR
4749 BGP_STR
4750 "Address family\n"
4751 "Clear peers with the AS number\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02004752
paul718e3742002-12-13 20:15:29 +00004753/* Outbound soft-reconfiguration */
4754DEFUN (clear_ip_bgp_all_soft_out,
4755 clear_ip_bgp_all_soft_out_cmd,
4756 "clear ip bgp * soft out",
4757 CLEAR_STR
4758 IP_STR
4759 BGP_STR
4760 "Clear all peers\n"
4761 "Soft reconfig\n"
4762 "Soft reconfig outbound update\n")
4763{
4764 if (argc == 1)
4765 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
4766 BGP_CLEAR_SOFT_OUT, NULL);
4767
4768 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
4769 BGP_CLEAR_SOFT_OUT, NULL);
4770}
4771
4772ALIAS (clear_ip_bgp_all_soft_out,
4773 clear_ip_bgp_all_out_cmd,
4774 "clear ip bgp * out",
4775 CLEAR_STR
4776 IP_STR
4777 BGP_STR
4778 "Clear all peers\n"
4779 "Soft reconfig outbound update\n")
4780
4781ALIAS (clear_ip_bgp_all_soft_out,
4782 clear_ip_bgp_instance_all_soft_out_cmd,
4783 "clear ip bgp view WORD * soft out",
4784 CLEAR_STR
4785 IP_STR
4786 BGP_STR
4787 "BGP view\n"
4788 "view name\n"
4789 "Clear all peers\n"
4790 "Soft reconfig\n"
4791 "Soft reconfig outbound update\n")
4792
4793DEFUN (clear_ip_bgp_all_ipv4_soft_out,
4794 clear_ip_bgp_all_ipv4_soft_out_cmd,
4795 "clear ip bgp * ipv4 (unicast|multicast) soft out",
4796 CLEAR_STR
4797 IP_STR
4798 BGP_STR
4799 "Clear all peers\n"
4800 "Address family\n"
4801 "Address Family modifier\n"
4802 "Address Family modifier\n"
4803 "Soft reconfig\n"
4804 "Soft reconfig outbound update\n")
4805{
4806 if (strncmp (argv[0], "m", 1) == 0)
4807 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
4808 BGP_CLEAR_SOFT_OUT, NULL);
4809
4810 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
4811 BGP_CLEAR_SOFT_OUT, NULL);
4812}
4813
4814ALIAS (clear_ip_bgp_all_ipv4_soft_out,
4815 clear_ip_bgp_all_ipv4_out_cmd,
4816 "clear ip bgp * ipv4 (unicast|multicast) out",
4817 CLEAR_STR
4818 IP_STR
4819 BGP_STR
4820 "Clear all peers\n"
4821 "Address family\n"
4822 "Address Family modifier\n"
4823 "Address Family modifier\n"
4824 "Soft reconfig outbound update\n")
4825
4826DEFUN (clear_ip_bgp_instance_all_ipv4_soft_out,
4827 clear_ip_bgp_instance_all_ipv4_soft_out_cmd,
4828 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft out",
4829 CLEAR_STR
4830 IP_STR
4831 BGP_STR
4832 "BGP view\n"
4833 "view name\n"
4834 "Clear all peers\n"
4835 "Address family\n"
4836 "Address Family modifier\n"
4837 "Address Family modifier\n"
4838 "Soft reconfig outbound update\n")
4839{
4840 if (strncmp (argv[1], "m", 1) == 0)
4841 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
4842 BGP_CLEAR_SOFT_OUT, NULL);
4843
4844 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
4845 BGP_CLEAR_SOFT_OUT, NULL);
4846}
4847
4848DEFUN (clear_ip_bgp_all_vpnv4_soft_out,
4849 clear_ip_bgp_all_vpnv4_soft_out_cmd,
4850 "clear ip bgp * vpnv4 unicast soft out",
4851 CLEAR_STR
4852 IP_STR
4853 BGP_STR
4854 "Clear all peers\n"
4855 "Address family\n"
4856 "Address Family Modifier\n"
4857 "Soft reconfig\n"
4858 "Soft reconfig outbound update\n")
4859{
4860 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
4861 BGP_CLEAR_SOFT_OUT, NULL);
4862}
4863
4864ALIAS (clear_ip_bgp_all_vpnv4_soft_out,
4865 clear_ip_bgp_all_vpnv4_out_cmd,
4866 "clear ip bgp * vpnv4 unicast out",
4867 CLEAR_STR
4868 IP_STR
4869 BGP_STR
4870 "Clear all peers\n"
4871 "Address family\n"
4872 "Address Family Modifier\n"
4873 "Soft reconfig outbound update\n")
4874
Lou Berger298cc2f2016-01-12 13:42:02 -05004875DEFUN (clear_ip_bgp_all_encap_soft_out,
4876 clear_ip_bgp_all_encap_soft_out_cmd,
4877 "clear ip bgp * encap unicast soft out",
4878 CLEAR_STR
4879 IP_STR
4880 BGP_STR
4881 "Clear all peers\n"
4882 "Address family\n"
4883 "Address Family Modifier\n"
4884 "Soft reconfig\n"
4885 "Soft reconfig outbound update\n")
4886{
4887 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_all,
4888 BGP_CLEAR_SOFT_OUT, NULL);
4889}
4890
4891ALIAS (clear_ip_bgp_all_encap_soft_out,
4892 clear_ip_bgp_all_encap_out_cmd,
4893 "clear ip bgp * encap unicast out",
4894 CLEAR_STR
4895 IP_STR
4896 BGP_STR
4897 "Clear all peers\n"
4898 "Address family\n"
4899 "Address Family Modifier\n"
4900 "Soft reconfig outbound update\n")
4901
paul718e3742002-12-13 20:15:29 +00004902DEFUN (clear_bgp_all_soft_out,
4903 clear_bgp_all_soft_out_cmd,
4904 "clear bgp * soft out",
4905 CLEAR_STR
4906 BGP_STR
4907 "Clear all peers\n"
4908 "Soft reconfig\n"
4909 "Soft reconfig outbound update\n")
4910{
4911 if (argc == 1)
4912 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
4913 BGP_CLEAR_SOFT_OUT, NULL);
4914
4915 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
4916 BGP_CLEAR_SOFT_OUT, NULL);
4917}
4918
4919ALIAS (clear_bgp_all_soft_out,
4920 clear_bgp_instance_all_soft_out_cmd,
4921 "clear bgp view WORD * soft out",
4922 CLEAR_STR
4923 BGP_STR
4924 "BGP view\n"
4925 "view name\n"
4926 "Clear all peers\n"
4927 "Soft reconfig\n"
4928 "Soft reconfig outbound update\n")
4929
4930ALIAS (clear_bgp_all_soft_out,
4931 clear_bgp_all_out_cmd,
4932 "clear bgp * out",
4933 CLEAR_STR
4934 BGP_STR
4935 "Clear all peers\n"
4936 "Soft reconfig outbound update\n")
4937
4938ALIAS (clear_bgp_all_soft_out,
4939 clear_bgp_ipv6_all_soft_out_cmd,
4940 "clear bgp ipv6 * soft out",
4941 CLEAR_STR
4942 BGP_STR
4943 "Address family\n"
4944 "Clear all peers\n"
4945 "Soft reconfig\n"
4946 "Soft reconfig outbound update\n")
4947
4948ALIAS (clear_bgp_all_soft_out,
4949 clear_bgp_ipv6_all_out_cmd,
4950 "clear bgp ipv6 * out",
4951 CLEAR_STR
4952 BGP_STR
4953 "Address family\n"
4954 "Clear all peers\n"
4955 "Soft reconfig outbound update\n")
4956
4957DEFUN (clear_ip_bgp_peer_soft_out,
4958 clear_ip_bgp_peer_soft_out_cmd,
4959 "clear ip bgp A.B.C.D soft out",
4960 CLEAR_STR
4961 IP_STR
4962 BGP_STR
4963 "BGP neighbor address to clear\n"
4964 "Soft reconfig\n"
4965 "Soft reconfig outbound update\n")
4966{
4967 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
4968 BGP_CLEAR_SOFT_OUT, argv[0]);
4969}
4970
4971ALIAS (clear_ip_bgp_peer_soft_out,
4972 clear_ip_bgp_peer_out_cmd,
4973 "clear ip bgp A.B.C.D out",
4974 CLEAR_STR
4975 IP_STR
4976 BGP_STR
4977 "BGP neighbor address to clear\n"
4978 "Soft reconfig outbound update\n")
4979
4980DEFUN (clear_ip_bgp_peer_ipv4_soft_out,
4981 clear_ip_bgp_peer_ipv4_soft_out_cmd,
4982 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft out",
4983 CLEAR_STR
4984 IP_STR
4985 BGP_STR
4986 "BGP neighbor address to clear\n"
4987 "Address family\n"
4988 "Address Family modifier\n"
4989 "Address Family modifier\n"
4990 "Soft reconfig\n"
4991 "Soft reconfig outbound update\n")
4992{
4993 if (strncmp (argv[1], "m", 1) == 0)
4994 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
4995 BGP_CLEAR_SOFT_OUT, argv[0]);
4996
4997 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
4998 BGP_CLEAR_SOFT_OUT, argv[0]);
4999}
5000
5001ALIAS (clear_ip_bgp_peer_ipv4_soft_out,
5002 clear_ip_bgp_peer_ipv4_out_cmd,
5003 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) out",
5004 CLEAR_STR
5005 IP_STR
5006 BGP_STR
5007 "BGP neighbor address to clear\n"
5008 "Address family\n"
5009 "Address Family modifier\n"
5010 "Address Family modifier\n"
5011 "Soft reconfig outbound update\n")
5012
5013DEFUN (clear_ip_bgp_peer_vpnv4_soft_out,
5014 clear_ip_bgp_peer_vpnv4_soft_out_cmd,
5015 "clear ip bgp A.B.C.D vpnv4 unicast soft out",
5016 CLEAR_STR
5017 IP_STR
5018 BGP_STR
5019 "BGP neighbor address to clear\n"
5020 "Address family\n"
5021 "Address Family Modifier\n"
5022 "Soft reconfig\n"
5023 "Soft reconfig outbound update\n")
5024{
5025 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
5026 BGP_CLEAR_SOFT_OUT, argv[0]);
5027}
5028
5029ALIAS (clear_ip_bgp_peer_vpnv4_soft_out,
5030 clear_ip_bgp_peer_vpnv4_out_cmd,
5031 "clear ip bgp A.B.C.D vpnv4 unicast out",
5032 CLEAR_STR
5033 IP_STR
5034 BGP_STR
5035 "BGP neighbor address to clear\n"
5036 "Address family\n"
5037 "Address Family Modifier\n"
5038 "Soft reconfig outbound update\n")
5039
Lou Berger298cc2f2016-01-12 13:42:02 -05005040DEFUN (clear_ip_bgp_peer_encap_soft_out,
5041 clear_ip_bgp_peer_encap_soft_out_cmd,
5042 "clear ip bgp A.B.C.D encap unicast soft out",
5043 CLEAR_STR
5044 IP_STR
5045 BGP_STR
5046 "BGP neighbor address to clear\n"
5047 "Address family\n"
5048 "Address Family Modifier\n"
5049 "Soft reconfig\n"
5050 "Soft reconfig outbound update\n")
5051{
5052 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_peer,
5053 BGP_CLEAR_SOFT_OUT, argv[0]);
5054}
5055
5056ALIAS (clear_ip_bgp_peer_encap_soft_out,
5057 clear_ip_bgp_peer_encap_out_cmd,
5058 "clear ip bgp A.B.C.D encap unicast out",
5059 CLEAR_STR
5060 IP_STR
5061 BGP_STR
5062 "BGP neighbor address to clear\n"
5063 "Address family\n"
5064 "Address Family Modifier\n"
5065 "Soft reconfig outbound update\n")
5066
paul718e3742002-12-13 20:15:29 +00005067DEFUN (clear_bgp_peer_soft_out,
5068 clear_bgp_peer_soft_out_cmd,
5069 "clear bgp (A.B.C.D|X:X::X:X) soft out",
5070 CLEAR_STR
5071 BGP_STR
5072 "BGP neighbor address to clear\n"
5073 "BGP IPv6 neighbor to clear\n"
5074 "Soft reconfig\n"
5075 "Soft reconfig outbound update\n")
5076{
5077 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
5078 BGP_CLEAR_SOFT_OUT, argv[0]);
5079}
5080
5081ALIAS (clear_bgp_peer_soft_out,
5082 clear_bgp_ipv6_peer_soft_out_cmd,
5083 "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft out",
5084 CLEAR_STR
5085 BGP_STR
5086 "Address family\n"
5087 "BGP neighbor address to clear\n"
5088 "BGP IPv6 neighbor to clear\n"
5089 "Soft reconfig\n"
5090 "Soft reconfig outbound update\n")
5091
5092ALIAS (clear_bgp_peer_soft_out,
5093 clear_bgp_peer_out_cmd,
5094 "clear bgp (A.B.C.D|X:X::X:X) out",
5095 CLEAR_STR
5096 BGP_STR
5097 "BGP neighbor address to clear\n"
5098 "BGP IPv6 neighbor to clear\n"
5099 "Soft reconfig outbound update\n")
5100
5101ALIAS (clear_bgp_peer_soft_out,
5102 clear_bgp_ipv6_peer_out_cmd,
5103 "clear bgp ipv6 (A.B.C.D|X:X::X:X) out",
5104 CLEAR_STR
5105 BGP_STR
5106 "Address family\n"
5107 "BGP neighbor address to clear\n"
5108 "BGP IPv6 neighbor to clear\n"
5109 "Soft reconfig outbound update\n")
5110
5111DEFUN (clear_ip_bgp_peer_group_soft_out,
5112 clear_ip_bgp_peer_group_soft_out_cmd,
5113 "clear ip bgp peer-group WORD soft out",
5114 CLEAR_STR
5115 IP_STR
5116 BGP_STR
5117 "Clear all members of peer-group\n"
5118 "BGP peer-group name\n"
5119 "Soft reconfig\n"
5120 "Soft reconfig outbound update\n")
5121{
5122 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5123 BGP_CLEAR_SOFT_OUT, argv[0]);
5124}
5125
5126ALIAS (clear_ip_bgp_peer_group_soft_out,
5127 clear_ip_bgp_peer_group_out_cmd,
5128 "clear ip bgp peer-group WORD out",
5129 CLEAR_STR
5130 IP_STR
5131 BGP_STR
5132 "Clear all members of peer-group\n"
5133 "BGP peer-group name\n"
5134 "Soft reconfig outbound update\n")
5135
5136DEFUN (clear_ip_bgp_peer_group_ipv4_soft_out,
5137 clear_ip_bgp_peer_group_ipv4_soft_out_cmd,
5138 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft out",
5139 CLEAR_STR
5140 IP_STR
5141 BGP_STR
5142 "Clear all members of peer-group\n"
5143 "BGP peer-group name\n"
5144 "Address family\n"
5145 "Address Family modifier\n"
5146 "Address Family modifier\n"
5147 "Soft reconfig\n"
5148 "Soft reconfig outbound update\n")
5149{
5150 if (strncmp (argv[1], "m", 1) == 0)
5151 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
5152 BGP_CLEAR_SOFT_OUT, argv[0]);
5153
5154 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5155 BGP_CLEAR_SOFT_OUT, argv[0]);
5156}
5157
5158ALIAS (clear_ip_bgp_peer_group_ipv4_soft_out,
5159 clear_ip_bgp_peer_group_ipv4_out_cmd,
5160 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) out",
5161 CLEAR_STR
5162 IP_STR
5163 BGP_STR
5164 "Clear all members of peer-group\n"
5165 "BGP peer-group name\n"
5166 "Address family\n"
5167 "Address Family modifier\n"
5168 "Address Family modifier\n"
5169 "Soft reconfig outbound update\n")
5170
5171DEFUN (clear_bgp_peer_group_soft_out,
5172 clear_bgp_peer_group_soft_out_cmd,
5173 "clear bgp peer-group WORD soft out",
5174 CLEAR_STR
5175 BGP_STR
5176 "Clear all members of peer-group\n"
5177 "BGP peer-group name\n"
5178 "Soft reconfig\n"
5179 "Soft reconfig outbound update\n")
5180{
5181 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
5182 BGP_CLEAR_SOFT_OUT, argv[0]);
5183}
5184
5185ALIAS (clear_bgp_peer_group_soft_out,
5186 clear_bgp_ipv6_peer_group_soft_out_cmd,
5187 "clear bgp ipv6 peer-group WORD soft out",
5188 CLEAR_STR
5189 BGP_STR
5190 "Address family\n"
5191 "Clear all members of peer-group\n"
5192 "BGP peer-group name\n"
5193 "Soft reconfig\n"
5194 "Soft reconfig outbound update\n")
5195
5196ALIAS (clear_bgp_peer_group_soft_out,
5197 clear_bgp_peer_group_out_cmd,
5198 "clear bgp peer-group WORD out",
5199 CLEAR_STR
5200 BGP_STR
5201 "Clear all members of peer-group\n"
5202 "BGP peer-group name\n"
5203 "Soft reconfig outbound update\n")
5204
5205ALIAS (clear_bgp_peer_group_soft_out,
5206 clear_bgp_ipv6_peer_group_out_cmd,
5207 "clear bgp ipv6 peer-group WORD out",
5208 CLEAR_STR
5209 BGP_STR
5210 "Address family\n"
5211 "Clear all members of peer-group\n"
5212 "BGP peer-group name\n"
5213 "Soft reconfig outbound update\n")
5214
5215DEFUN (clear_ip_bgp_external_soft_out,
5216 clear_ip_bgp_external_soft_out_cmd,
5217 "clear ip bgp external soft out",
5218 CLEAR_STR
5219 IP_STR
5220 BGP_STR
5221 "Clear all external peers\n"
5222 "Soft reconfig\n"
5223 "Soft reconfig outbound update\n")
5224{
5225 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5226 BGP_CLEAR_SOFT_OUT, NULL);
5227}
5228
5229ALIAS (clear_ip_bgp_external_soft_out,
5230 clear_ip_bgp_external_out_cmd,
5231 "clear ip bgp external out",
5232 CLEAR_STR
5233 IP_STR
5234 BGP_STR
5235 "Clear all external peers\n"
5236 "Soft reconfig outbound update\n")
5237
5238DEFUN (clear_ip_bgp_external_ipv4_soft_out,
5239 clear_ip_bgp_external_ipv4_soft_out_cmd,
5240 "clear ip bgp external ipv4 (unicast|multicast) soft out",
5241 CLEAR_STR
5242 IP_STR
5243 BGP_STR
5244 "Clear all external peers\n"
5245 "Address family\n"
5246 "Address Family modifier\n"
5247 "Address Family modifier\n"
5248 "Soft reconfig\n"
5249 "Soft reconfig outbound update\n")
5250{
5251 if (strncmp (argv[0], "m", 1) == 0)
5252 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
5253 BGP_CLEAR_SOFT_OUT, NULL);
5254
5255 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5256 BGP_CLEAR_SOFT_OUT, NULL);
5257}
5258
5259ALIAS (clear_ip_bgp_external_ipv4_soft_out,
5260 clear_ip_bgp_external_ipv4_out_cmd,
5261 "clear ip bgp external ipv4 (unicast|multicast) out",
5262 CLEAR_STR
5263 IP_STR
5264 BGP_STR
5265 "Clear all external peers\n"
5266 "Address family\n"
5267 "Address Family modifier\n"
5268 "Address Family modifier\n"
5269 "Soft reconfig outbound update\n")
5270
5271DEFUN (clear_bgp_external_soft_out,
5272 clear_bgp_external_soft_out_cmd,
5273 "clear bgp external soft out",
5274 CLEAR_STR
5275 BGP_STR
5276 "Clear all external peers\n"
5277 "Soft reconfig\n"
5278 "Soft reconfig outbound update\n")
5279{
5280 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
5281 BGP_CLEAR_SOFT_OUT, NULL);
5282}
5283
5284ALIAS (clear_bgp_external_soft_out,
5285 clear_bgp_ipv6_external_soft_out_cmd,
5286 "clear bgp ipv6 external soft out",
5287 CLEAR_STR
5288 BGP_STR
5289 "Address family\n"
5290 "Clear all external peers\n"
5291 "Soft reconfig\n"
5292 "Soft reconfig outbound update\n")
5293
5294ALIAS (clear_bgp_external_soft_out,
5295 clear_bgp_external_out_cmd,
5296 "clear bgp external out",
5297 CLEAR_STR
5298 BGP_STR
5299 "Clear all external peers\n"
5300 "Soft reconfig outbound update\n")
5301
5302ALIAS (clear_bgp_external_soft_out,
5303 clear_bgp_ipv6_external_out_cmd,
5304 "clear bgp ipv6 external WORD out",
5305 CLEAR_STR
5306 BGP_STR
5307 "Address family\n"
5308 "Clear all external peers\n"
5309 "Soft reconfig outbound update\n")
5310
5311DEFUN (clear_ip_bgp_as_soft_out,
5312 clear_ip_bgp_as_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005313 "clear ip bgp " CMD_AS_RANGE " soft out",
paul718e3742002-12-13 20:15:29 +00005314 CLEAR_STR
5315 IP_STR
5316 BGP_STR
5317 "Clear peers with the AS number\n"
5318 "Soft reconfig\n"
5319 "Soft reconfig outbound update\n")
5320{
5321 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
5322 BGP_CLEAR_SOFT_OUT, argv[0]);
5323}
5324
5325ALIAS (clear_ip_bgp_as_soft_out,
5326 clear_ip_bgp_as_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005327 "clear ip bgp " CMD_AS_RANGE " out",
paul718e3742002-12-13 20:15:29 +00005328 CLEAR_STR
5329 IP_STR
5330 BGP_STR
5331 "Clear peers with the AS number\n"
5332 "Soft reconfig outbound update\n")
5333
5334DEFUN (clear_ip_bgp_as_ipv4_soft_out,
5335 clear_ip_bgp_as_ipv4_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005336 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft out",
paul718e3742002-12-13 20:15:29 +00005337 CLEAR_STR
5338 IP_STR
5339 BGP_STR
5340 "Clear peers with the AS number\n"
5341 "Address family\n"
5342 "Address Family modifier\n"
5343 "Address Family modifier\n"
5344 "Soft reconfig\n"
5345 "Soft reconfig outbound update\n")
5346{
5347 if (strncmp (argv[1], "m", 1) == 0)
5348 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
5349 BGP_CLEAR_SOFT_OUT, argv[0]);
5350
5351 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
5352 BGP_CLEAR_SOFT_OUT, argv[0]);
5353}
5354
5355ALIAS (clear_ip_bgp_as_ipv4_soft_out,
5356 clear_ip_bgp_as_ipv4_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005357 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) 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 "Address family\n"
5363 "Address Family modifier\n"
5364 "Address Family modifier\n"
5365 "Soft reconfig outbound update\n")
5366
5367DEFUN (clear_ip_bgp_as_vpnv4_soft_out,
5368 clear_ip_bgp_as_vpnv4_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005369 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft out",
paul718e3742002-12-13 20:15:29 +00005370 CLEAR_STR
5371 IP_STR
5372 BGP_STR
5373 "Clear peers with the AS number\n"
5374 "Address family\n"
5375 "Address Family modifier\n"
5376 "Soft reconfig\n"
5377 "Soft reconfig outbound update\n")
5378{
5379 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
5380 BGP_CLEAR_SOFT_OUT, argv[0]);
5381}
5382
5383ALIAS (clear_ip_bgp_as_vpnv4_soft_out,
5384 clear_ip_bgp_as_vpnv4_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005385 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast out",
paul718e3742002-12-13 20:15:29 +00005386 CLEAR_STR
5387 IP_STR
5388 BGP_STR
5389 "Clear peers with the AS number\n"
5390 "Address family\n"
5391 "Address Family modifier\n"
5392 "Soft reconfig outbound update\n")
5393
Lou Berger298cc2f2016-01-12 13:42:02 -05005394DEFUN (clear_ip_bgp_as_encap_soft_out,
5395 clear_ip_bgp_as_encap_soft_out_cmd,
5396 "clear ip bgp " CMD_AS_RANGE " encap unicast soft out",
5397 CLEAR_STR
5398 IP_STR
5399 BGP_STR
5400 "Clear peers with the AS number\n"
5401 "Address family\n"
5402 "Address Family modifier\n"
5403 "Soft reconfig\n"
5404 "Soft reconfig outbound update\n")
5405{
5406 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_as,
5407 BGP_CLEAR_SOFT_OUT, argv[0]);
5408}
5409
5410ALIAS (clear_ip_bgp_as_encap_soft_out,
5411 clear_ip_bgp_as_encap_out_cmd,
5412 "clear ip bgp " CMD_AS_RANGE " encap unicast out",
5413 CLEAR_STR
5414 IP_STR
5415 BGP_STR
5416 "Clear peers with the AS number\n"
5417 "Address family\n"
5418 "Address Family modifier\n"
5419 "Soft reconfig outbound update\n")
5420
paul718e3742002-12-13 20:15:29 +00005421DEFUN (clear_bgp_as_soft_out,
5422 clear_bgp_as_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005423 "clear bgp " CMD_AS_RANGE " soft out",
paul718e3742002-12-13 20:15:29 +00005424 CLEAR_STR
5425 BGP_STR
5426 "Clear peers with the AS number\n"
5427 "Soft reconfig\n"
5428 "Soft reconfig outbound update\n")
5429{
5430 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
5431 BGP_CLEAR_SOFT_OUT, argv[0]);
5432}
5433
5434ALIAS (clear_bgp_as_soft_out,
5435 clear_bgp_ipv6_as_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005436 "clear bgp ipv6 " CMD_AS_RANGE " soft out",
paul718e3742002-12-13 20:15:29 +00005437 CLEAR_STR
5438 BGP_STR
5439 "Address family\n"
5440 "Clear peers with the AS number\n"
5441 "Soft reconfig\n"
5442 "Soft reconfig outbound update\n")
5443
5444ALIAS (clear_bgp_as_soft_out,
5445 clear_bgp_as_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005446 "clear bgp " CMD_AS_RANGE " out",
paul718e3742002-12-13 20:15:29 +00005447 CLEAR_STR
5448 BGP_STR
5449 "Clear peers with the AS number\n"
5450 "Soft reconfig outbound update\n")
5451
5452ALIAS (clear_bgp_as_soft_out,
5453 clear_bgp_ipv6_as_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005454 "clear bgp ipv6 " CMD_AS_RANGE " out",
paul718e3742002-12-13 20:15:29 +00005455 CLEAR_STR
5456 BGP_STR
5457 "Address family\n"
5458 "Clear peers with the AS number\n"
5459 "Soft reconfig outbound update\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02005460
paul718e3742002-12-13 20:15:29 +00005461/* Inbound soft-reconfiguration */
5462DEFUN (clear_ip_bgp_all_soft_in,
5463 clear_ip_bgp_all_soft_in_cmd,
5464 "clear ip bgp * soft in",
5465 CLEAR_STR
5466 IP_STR
5467 BGP_STR
5468 "Clear all peers\n"
5469 "Soft reconfig\n"
5470 "Soft reconfig inbound update\n")
5471{
5472 if (argc == 1)
5473 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5474 BGP_CLEAR_SOFT_IN, NULL);
5475
5476 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5477 BGP_CLEAR_SOFT_IN, NULL);
5478}
5479
5480ALIAS (clear_ip_bgp_all_soft_in,
5481 clear_ip_bgp_instance_all_soft_in_cmd,
5482 "clear ip bgp view WORD * soft in",
5483 CLEAR_STR
5484 IP_STR
5485 BGP_STR
5486 "BGP view\n"
5487 "view name\n"
5488 "Clear all peers\n"
5489 "Soft reconfig\n"
5490 "Soft reconfig inbound update\n")
5491
5492ALIAS (clear_ip_bgp_all_soft_in,
5493 clear_ip_bgp_all_in_cmd,
5494 "clear ip bgp * in",
5495 CLEAR_STR
5496 IP_STR
5497 BGP_STR
5498 "Clear all peers\n"
5499 "Soft reconfig inbound update\n")
5500
5501DEFUN (clear_ip_bgp_all_in_prefix_filter,
5502 clear_ip_bgp_all_in_prefix_filter_cmd,
5503 "clear ip bgp * in prefix-filter",
5504 CLEAR_STR
5505 IP_STR
5506 BGP_STR
5507 "Clear all peers\n"
5508 "Soft reconfig inbound update\n"
5509 "Push out prefix-list ORF and do inbound soft reconfig\n")
5510{
5511 if (argc== 1)
5512 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5513 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5514
5515 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5516 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5517}
5518
5519ALIAS (clear_ip_bgp_all_in_prefix_filter,
5520 clear_ip_bgp_instance_all_in_prefix_filter_cmd,
5521 "clear ip bgp view WORD * in prefix-filter",
5522 CLEAR_STR
5523 IP_STR
5524 BGP_STR
5525 "BGP view\n"
5526 "view name\n"
5527 "Clear all peers\n"
5528 "Soft reconfig inbound update\n"
5529 "Push out prefix-list ORF and do inbound soft reconfig\n")
5530
5531
5532DEFUN (clear_ip_bgp_all_ipv4_soft_in,
5533 clear_ip_bgp_all_ipv4_soft_in_cmd,
5534 "clear ip bgp * ipv4 (unicast|multicast) soft in",
5535 CLEAR_STR
5536 IP_STR
5537 BGP_STR
5538 "Clear all peers\n"
5539 "Address family\n"
5540 "Address Family modifier\n"
5541 "Address Family modifier\n"
5542 "Soft reconfig\n"
5543 "Soft reconfig inbound update\n")
5544{
5545 if (strncmp (argv[0], "m", 1) == 0)
5546 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
5547 BGP_CLEAR_SOFT_IN, NULL);
5548
5549 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5550 BGP_CLEAR_SOFT_IN, NULL);
5551}
5552
5553ALIAS (clear_ip_bgp_all_ipv4_soft_in,
5554 clear_ip_bgp_all_ipv4_in_cmd,
5555 "clear ip bgp * ipv4 (unicast|multicast) in",
5556 CLEAR_STR
5557 IP_STR
5558 BGP_STR
5559 "Clear all peers\n"
5560 "Address family\n"
5561 "Address Family modifier\n"
5562 "Address Family modifier\n"
5563 "Soft reconfig inbound update\n")
5564
5565DEFUN (clear_ip_bgp_instance_all_ipv4_soft_in,
5566 clear_ip_bgp_instance_all_ipv4_soft_in_cmd,
5567 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft in",
5568 CLEAR_STR
5569 IP_STR
5570 BGP_STR
5571 "BGP view\n"
5572 "view name\n"
5573 "Clear all peers\n"
5574 "Address family\n"
5575 "Address Family modifier\n"
5576 "Address Family modifier\n"
5577 "Soft reconfig\n"
5578 "Soft reconfig inbound update\n")
5579{
5580 if (strncmp (argv[1], "m", 1) == 0)
5581 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
5582 BGP_CLEAR_SOFT_IN, NULL);
5583
5584 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5585 BGP_CLEAR_SOFT_IN, NULL);
5586}
5587
5588DEFUN (clear_ip_bgp_all_ipv4_in_prefix_filter,
5589 clear_ip_bgp_all_ipv4_in_prefix_filter_cmd,
5590 "clear ip bgp * ipv4 (unicast|multicast) in prefix-filter",
5591 CLEAR_STR
5592 IP_STR
5593 BGP_STR
5594 "Clear all peers\n"
5595 "Address family\n"
5596 "Address Family modifier\n"
5597 "Address Family modifier\n"
5598 "Soft reconfig inbound update\n"
5599 "Push out prefix-list ORF and do inbound soft reconfig\n")
5600{
5601 if (strncmp (argv[0], "m", 1) == 0)
5602 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
5603 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5604
5605 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5606 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5607}
5608
5609DEFUN (clear_ip_bgp_instance_all_ipv4_in_prefix_filter,
5610 clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd,
5611 "clear ip bgp view WORD * ipv4 (unicast|multicast) in prefix-filter",
5612 CLEAR_STR
5613 IP_STR
5614 BGP_STR
5615 "Clear all peers\n"
5616 "Address family\n"
5617 "Address Family modifier\n"
5618 "Address Family modifier\n"
5619 "Soft reconfig inbound update\n"
5620 "Push out prefix-list ORF and do inbound soft reconfig\n")
5621{
5622 if (strncmp (argv[1], "m", 1) == 0)
5623 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
5624 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5625
5626 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5627 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5628}
5629
5630DEFUN (clear_ip_bgp_all_vpnv4_soft_in,
5631 clear_ip_bgp_all_vpnv4_soft_in_cmd,
5632 "clear ip bgp * vpnv4 unicast soft in",
5633 CLEAR_STR
5634 IP_STR
5635 BGP_STR
5636 "Clear all peers\n"
5637 "Address family\n"
5638 "Address Family Modifier\n"
5639 "Soft reconfig\n"
5640 "Soft reconfig inbound update\n")
5641{
5642 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
5643 BGP_CLEAR_SOFT_IN, NULL);
5644}
5645
5646ALIAS (clear_ip_bgp_all_vpnv4_soft_in,
5647 clear_ip_bgp_all_vpnv4_in_cmd,
5648 "clear ip bgp * vpnv4 unicast in",
5649 CLEAR_STR
5650 IP_STR
5651 BGP_STR
5652 "Clear all peers\n"
5653 "Address family\n"
5654 "Address Family Modifier\n"
5655 "Soft reconfig inbound update\n")
5656
Lou Berger298cc2f2016-01-12 13:42:02 -05005657DEFUN (clear_ip_bgp_all_encap_soft_in,
5658 clear_ip_bgp_all_encap_soft_in_cmd,
5659 "clear ip bgp * encap unicast soft in",
5660 CLEAR_STR
5661 IP_STR
5662 BGP_STR
5663 "Clear all peers\n"
5664 "Address family\n"
5665 "Address Family Modifier\n"
5666 "Soft reconfig\n"
5667 "Soft reconfig inbound update\n")
5668{
5669 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_all,
5670 BGP_CLEAR_SOFT_IN, NULL);
5671}
5672
5673ALIAS (clear_ip_bgp_all_encap_soft_in,
5674 clear_ip_bgp_all_encap_in_cmd,
5675 "clear ip bgp * encap unicast in",
5676 CLEAR_STR
5677 IP_STR
5678 BGP_STR
5679 "Clear all peers\n"
5680 "Address family\n"
5681 "Address Family Modifier\n"
5682 "Soft reconfig inbound update\n")
5683
paul718e3742002-12-13 20:15:29 +00005684DEFUN (clear_bgp_all_soft_in,
5685 clear_bgp_all_soft_in_cmd,
5686 "clear bgp * soft in",
5687 CLEAR_STR
5688 BGP_STR
5689 "Clear all peers\n"
5690 "Soft reconfig\n"
5691 "Soft reconfig inbound update\n")
5692{
5693 if (argc == 1)
5694 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
5695 BGP_CLEAR_SOFT_IN, NULL);
5696
5697 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
5698 BGP_CLEAR_SOFT_IN, NULL);
5699}
5700
5701ALIAS (clear_bgp_all_soft_in,
5702 clear_bgp_instance_all_soft_in_cmd,
5703 "clear bgp view WORD * soft in",
5704 CLEAR_STR
5705 BGP_STR
5706 "BGP view\n"
5707 "view name\n"
5708 "Clear all peers\n"
5709 "Soft reconfig\n"
5710 "Soft reconfig inbound update\n")
5711
5712ALIAS (clear_bgp_all_soft_in,
5713 clear_bgp_ipv6_all_soft_in_cmd,
5714 "clear bgp ipv6 * soft in",
5715 CLEAR_STR
5716 BGP_STR
5717 "Address family\n"
5718 "Clear all peers\n"
5719 "Soft reconfig\n"
5720 "Soft reconfig inbound update\n")
5721
5722ALIAS (clear_bgp_all_soft_in,
5723 clear_bgp_all_in_cmd,
5724 "clear bgp * in",
5725 CLEAR_STR
5726 BGP_STR
5727 "Clear all peers\n"
5728 "Soft reconfig inbound update\n")
5729
5730ALIAS (clear_bgp_all_soft_in,
5731 clear_bgp_ipv6_all_in_cmd,
5732 "clear bgp ipv6 * in",
5733 CLEAR_STR
5734 BGP_STR
5735 "Address family\n"
5736 "Clear all peers\n"
5737 "Soft reconfig inbound update\n")
5738
5739DEFUN (clear_bgp_all_in_prefix_filter,
5740 clear_bgp_all_in_prefix_filter_cmd,
5741 "clear bgp * in prefix-filter",
5742 CLEAR_STR
5743 BGP_STR
5744 "Clear all peers\n"
5745 "Soft reconfig inbound update\n"
5746 "Push out prefix-list ORF and do inbound soft reconfig\n")
5747{
5748 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
5749 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5750}
5751
5752ALIAS (clear_bgp_all_in_prefix_filter,
5753 clear_bgp_ipv6_all_in_prefix_filter_cmd,
5754 "clear bgp ipv6 * in prefix-filter",
5755 CLEAR_STR
5756 BGP_STR
5757 "Address family\n"
5758 "Clear all peers\n"
5759 "Soft reconfig inbound update\n"
5760 "Push out prefix-list ORF and do inbound soft reconfig\n")
5761
5762DEFUN (clear_ip_bgp_peer_soft_in,
5763 clear_ip_bgp_peer_soft_in_cmd,
5764 "clear ip bgp A.B.C.D soft in",
5765 CLEAR_STR
5766 IP_STR
5767 BGP_STR
5768 "BGP neighbor address to clear\n"
5769 "Soft reconfig\n"
5770 "Soft reconfig inbound update\n")
5771{
5772 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5773 BGP_CLEAR_SOFT_IN, argv[0]);
5774}
5775
5776ALIAS (clear_ip_bgp_peer_soft_in,
5777 clear_ip_bgp_peer_in_cmd,
5778 "clear ip bgp A.B.C.D in",
5779 CLEAR_STR
5780 IP_STR
5781 BGP_STR
5782 "BGP neighbor address to clear\n"
5783 "Soft reconfig inbound update\n")
5784
5785DEFUN (clear_ip_bgp_peer_in_prefix_filter,
5786 clear_ip_bgp_peer_in_prefix_filter_cmd,
5787 "clear ip bgp A.B.C.D in prefix-filter",
5788 CLEAR_STR
5789 IP_STR
5790 BGP_STR
5791 "BGP neighbor address to clear\n"
5792 "Soft reconfig inbound update\n"
5793 "Push out the existing ORF prefix-list\n")
5794{
5795 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5796 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5797}
5798
5799DEFUN (clear_ip_bgp_peer_ipv4_soft_in,
5800 clear_ip_bgp_peer_ipv4_soft_in_cmd,
5801 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft in",
5802 CLEAR_STR
5803 IP_STR
5804 BGP_STR
5805 "BGP neighbor address to clear\n"
5806 "Address family\n"
5807 "Address Family modifier\n"
5808 "Address Family modifier\n"
5809 "Soft reconfig\n"
5810 "Soft reconfig inbound update\n")
5811{
5812 if (strncmp (argv[1], "m", 1) == 0)
5813 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
5814 BGP_CLEAR_SOFT_IN, argv[0]);
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_ipv4_soft_in,
5821 clear_ip_bgp_peer_ipv4_in_cmd,
5822 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in",
5823 CLEAR_STR
5824 IP_STR
5825 BGP_STR
5826 "BGP neighbor address to clear\n"
5827 "Address family\n"
5828 "Address Family modifier\n"
5829 "Address Family modifier\n"
5830 "Soft reconfig inbound update\n")
5831
5832DEFUN (clear_ip_bgp_peer_ipv4_in_prefix_filter,
5833 clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd,
5834 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in prefix-filter",
5835 CLEAR_STR
5836 IP_STR
5837 BGP_STR
5838 "BGP neighbor address to clear\n"
5839 "Address family\n"
5840 "Address Family modifier\n"
5841 "Address Family modifier\n"
5842 "Soft reconfig inbound update\n"
5843 "Push out the existing ORF prefix-list\n")
5844{
5845 if (strncmp (argv[1], "m", 1) == 0)
5846 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
5847 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5848
5849 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5850 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5851}
5852
5853DEFUN (clear_ip_bgp_peer_vpnv4_soft_in,
5854 clear_ip_bgp_peer_vpnv4_soft_in_cmd,
5855 "clear ip bgp A.B.C.D vpnv4 unicast soft in",
5856 CLEAR_STR
5857 IP_STR
5858 BGP_STR
5859 "BGP neighbor address to clear\n"
5860 "Address family\n"
5861 "Address Family Modifier\n"
5862 "Soft reconfig\n"
5863 "Soft reconfig inbound update\n")
5864{
5865 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
5866 BGP_CLEAR_SOFT_IN, argv[0]);
5867}
5868
5869ALIAS (clear_ip_bgp_peer_vpnv4_soft_in,
5870 clear_ip_bgp_peer_vpnv4_in_cmd,
5871 "clear ip bgp A.B.C.D vpnv4 unicast in",
5872 CLEAR_STR
5873 IP_STR
5874 BGP_STR
5875 "BGP neighbor address to clear\n"
5876 "Address family\n"
5877 "Address Family Modifier\n"
5878 "Soft reconfig inbound update\n")
5879
Lou Berger298cc2f2016-01-12 13:42:02 -05005880DEFUN (clear_ip_bgp_peer_encap_soft_in,
5881 clear_ip_bgp_peer_encap_soft_in_cmd,
5882 "clear ip bgp A.B.C.D encap unicast soft in",
5883 CLEAR_STR
5884 IP_STR
5885 BGP_STR
5886 "BGP neighbor address to clear\n"
5887 "Address family\n"
5888 "Address Family Modifier\n"
5889 "Soft reconfig\n"
5890 "Soft reconfig inbound update\n")
5891{
5892 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_peer,
5893 BGP_CLEAR_SOFT_IN, argv[0]);
5894}
5895
5896ALIAS (clear_ip_bgp_peer_encap_soft_in,
5897 clear_ip_bgp_peer_encap_in_cmd,
5898 "clear ip bgp A.B.C.D encap unicast in",
5899 CLEAR_STR
5900 IP_STR
5901 BGP_STR
5902 "BGP neighbor address to clear\n"
5903 "Address family\n"
5904 "Address Family Modifier\n"
5905 "Soft reconfig inbound update\n")
5906
paul718e3742002-12-13 20:15:29 +00005907DEFUN (clear_bgp_peer_soft_in,
5908 clear_bgp_peer_soft_in_cmd,
5909 "clear bgp (A.B.C.D|X:X::X:X) soft in",
5910 CLEAR_STR
5911 BGP_STR
5912 "BGP neighbor address to clear\n"
5913 "BGP IPv6 neighbor to clear\n"
5914 "Soft reconfig\n"
5915 "Soft reconfig inbound update\n")
5916{
5917 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
5918 BGP_CLEAR_SOFT_IN, argv[0]);
5919}
5920
5921ALIAS (clear_bgp_peer_soft_in,
5922 clear_bgp_ipv6_peer_soft_in_cmd,
5923 "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft in",
5924 CLEAR_STR
5925 BGP_STR
5926 "Address family\n"
5927 "BGP neighbor address to clear\n"
5928 "BGP IPv6 neighbor to clear\n"
5929 "Soft reconfig\n"
5930 "Soft reconfig inbound update\n")
5931
5932ALIAS (clear_bgp_peer_soft_in,
5933 clear_bgp_peer_in_cmd,
5934 "clear bgp (A.B.C.D|X:X::X:X) in",
5935 CLEAR_STR
5936 BGP_STR
5937 "BGP neighbor address to clear\n"
5938 "BGP IPv6 neighbor to clear\n"
5939 "Soft reconfig inbound update\n")
5940
5941ALIAS (clear_bgp_peer_soft_in,
5942 clear_bgp_ipv6_peer_in_cmd,
5943 "clear bgp ipv6 (A.B.C.D|X:X::X:X) in",
5944 CLEAR_STR
5945 BGP_STR
5946 "Address family\n"
5947 "BGP neighbor address to clear\n"
5948 "BGP IPv6 neighbor to clear\n"
5949 "Soft reconfig inbound update\n")
5950
5951DEFUN (clear_bgp_peer_in_prefix_filter,
5952 clear_bgp_peer_in_prefix_filter_cmd,
5953 "clear bgp (A.B.C.D|X:X::X:X) in prefix-filter",
5954 CLEAR_STR
5955 BGP_STR
5956 "BGP neighbor address to clear\n"
5957 "BGP IPv6 neighbor to clear\n"
5958 "Soft reconfig inbound update\n"
5959 "Push out the existing ORF prefix-list\n")
5960{
5961 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
5962 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5963}
5964
5965ALIAS (clear_bgp_peer_in_prefix_filter,
5966 clear_bgp_ipv6_peer_in_prefix_filter_cmd,
5967 "clear bgp ipv6 (A.B.C.D|X:X::X:X) in prefix-filter",
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 inbound update\n"
5974 "Push out the existing ORF prefix-list\n")
5975
5976DEFUN (clear_ip_bgp_peer_group_soft_in,
5977 clear_ip_bgp_peer_group_soft_in_cmd,
5978 "clear ip bgp peer-group WORD soft in",
5979 CLEAR_STR
5980 IP_STR
5981 BGP_STR
5982 "Clear all members of peer-group\n"
5983 "BGP peer-group name\n"
5984 "Soft reconfig\n"
5985 "Soft reconfig inbound update\n")
5986{
5987 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5988 BGP_CLEAR_SOFT_IN, argv[0]);
5989}
5990
5991ALIAS (clear_ip_bgp_peer_group_soft_in,
5992 clear_ip_bgp_peer_group_in_cmd,
5993 "clear ip bgp peer-group WORD in",
5994 CLEAR_STR
5995 IP_STR
5996 BGP_STR
5997 "Clear all members of peer-group\n"
5998 "BGP peer-group name\n"
5999 "Soft reconfig inbound update\n")
6000
6001DEFUN (clear_ip_bgp_peer_group_in_prefix_filter,
6002 clear_ip_bgp_peer_group_in_prefix_filter_cmd,
6003 "clear ip bgp peer-group WORD in prefix-filter",
6004 CLEAR_STR
6005 IP_STR
6006 BGP_STR
6007 "Clear all members of peer-group\n"
6008 "BGP peer-group name\n"
6009 "Soft reconfig inbound update\n"
6010 "Push out prefix-list ORF and do inbound soft reconfig\n")
6011{
6012 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6013 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6014}
6015
6016DEFUN (clear_ip_bgp_peer_group_ipv4_soft_in,
6017 clear_ip_bgp_peer_group_ipv4_soft_in_cmd,
6018 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft in",
6019 CLEAR_STR
6020 IP_STR
6021 BGP_STR
6022 "Clear all members of peer-group\n"
6023 "BGP peer-group name\n"
6024 "Address family\n"
6025 "Address Family modifier\n"
6026 "Address Family modifier\n"
6027 "Soft reconfig\n"
6028 "Soft reconfig inbound update\n")
6029{
6030 if (strncmp (argv[1], "m", 1) == 0)
6031 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
6032 BGP_CLEAR_SOFT_IN, argv[0]);
6033
6034 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6035 BGP_CLEAR_SOFT_IN, argv[0]);
6036}
6037
6038ALIAS (clear_ip_bgp_peer_group_ipv4_soft_in,
6039 clear_ip_bgp_peer_group_ipv4_in_cmd,
6040 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in",
6041 CLEAR_STR
6042 IP_STR
6043 BGP_STR
6044 "Clear all members of peer-group\n"
6045 "BGP peer-group name\n"
6046 "Address family\n"
6047 "Address Family modifier\n"
6048 "Address Family modifier\n"
6049 "Soft reconfig inbound update\n")
6050
6051DEFUN (clear_ip_bgp_peer_group_ipv4_in_prefix_filter,
6052 clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd,
6053 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in prefix-filter",
6054 CLEAR_STR
6055 IP_STR
6056 BGP_STR
6057 "Clear all members of peer-group\n"
6058 "BGP peer-group name\n"
6059 "Address family\n"
6060 "Address Family modifier\n"
6061 "Address Family modifier\n"
6062 "Soft reconfig inbound update\n"
6063 "Push out prefix-list ORF and do inbound soft reconfig\n")
6064{
6065 if (strncmp (argv[1], "m", 1) == 0)
6066 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
6067 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6068
6069 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6070 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6071}
6072
6073DEFUN (clear_bgp_peer_group_soft_in,
6074 clear_bgp_peer_group_soft_in_cmd,
6075 "clear bgp peer-group WORD soft in",
6076 CLEAR_STR
6077 BGP_STR
6078 "Clear all members of peer-group\n"
6079 "BGP peer-group name\n"
6080 "Soft reconfig\n"
6081 "Soft reconfig inbound update\n")
6082{
6083 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
6084 BGP_CLEAR_SOFT_IN, argv[0]);
6085}
6086
6087ALIAS (clear_bgp_peer_group_soft_in,
6088 clear_bgp_ipv6_peer_group_soft_in_cmd,
6089 "clear bgp ipv6 peer-group WORD soft in",
6090 CLEAR_STR
6091 BGP_STR
6092 "Address family\n"
6093 "Clear all members of peer-group\n"
6094 "BGP peer-group name\n"
6095 "Soft reconfig\n"
6096 "Soft reconfig inbound update\n")
6097
6098ALIAS (clear_bgp_peer_group_soft_in,
6099 clear_bgp_peer_group_in_cmd,
6100 "clear bgp peer-group WORD in",
6101 CLEAR_STR
6102 BGP_STR
6103 "Clear all members of peer-group\n"
6104 "BGP peer-group name\n"
6105 "Soft reconfig inbound update\n")
6106
6107ALIAS (clear_bgp_peer_group_soft_in,
6108 clear_bgp_ipv6_peer_group_in_cmd,
6109 "clear bgp ipv6 peer-group WORD in",
6110 CLEAR_STR
6111 BGP_STR
6112 "Address family\n"
6113 "Clear all members of peer-group\n"
6114 "BGP peer-group name\n"
6115 "Soft reconfig inbound update\n")
6116
6117DEFUN (clear_bgp_peer_group_in_prefix_filter,
6118 clear_bgp_peer_group_in_prefix_filter_cmd,
6119 "clear bgp peer-group WORD in prefix-filter",
6120 CLEAR_STR
6121 BGP_STR
6122 "Clear all members of peer-group\n"
6123 "BGP peer-group name\n"
6124 "Soft reconfig inbound update\n"
6125 "Push out prefix-list ORF and do inbound soft reconfig\n")
6126{
6127 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
6128 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6129}
6130
6131ALIAS (clear_bgp_peer_group_in_prefix_filter,
6132 clear_bgp_ipv6_peer_group_in_prefix_filter_cmd,
6133 "clear bgp ipv6 peer-group WORD in prefix-filter",
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 inbound update\n"
6140 "Push out prefix-list ORF and do inbound soft reconfig\n")
6141
6142DEFUN (clear_ip_bgp_external_soft_in,
6143 clear_ip_bgp_external_soft_in_cmd,
6144 "clear ip bgp external soft in",
6145 CLEAR_STR
6146 IP_STR
6147 BGP_STR
6148 "Clear all external peers\n"
6149 "Soft reconfig\n"
6150 "Soft reconfig inbound update\n")
6151{
6152 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6153 BGP_CLEAR_SOFT_IN, NULL);
6154}
6155
6156ALIAS (clear_ip_bgp_external_soft_in,
6157 clear_ip_bgp_external_in_cmd,
6158 "clear ip bgp external in",
6159 CLEAR_STR
6160 IP_STR
6161 BGP_STR
6162 "Clear all external peers\n"
6163 "Soft reconfig inbound update\n")
6164
6165DEFUN (clear_ip_bgp_external_in_prefix_filter,
6166 clear_ip_bgp_external_in_prefix_filter_cmd,
6167 "clear ip bgp external in prefix-filter",
6168 CLEAR_STR
6169 IP_STR
6170 BGP_STR
6171 "Clear all external peers\n"
6172 "Soft reconfig inbound update\n"
6173 "Push out prefix-list ORF and do inbound soft reconfig\n")
6174{
6175 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6176 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
6177}
6178
6179DEFUN (clear_ip_bgp_external_ipv4_soft_in,
6180 clear_ip_bgp_external_ipv4_soft_in_cmd,
6181 "clear ip bgp external ipv4 (unicast|multicast) soft in",
6182 CLEAR_STR
6183 IP_STR
6184 BGP_STR
6185 "Clear all external peers\n"
6186 "Address family\n"
6187 "Address Family modifier\n"
6188 "Address Family modifier\n"
6189 "Soft reconfig\n"
6190 "Soft reconfig inbound update\n")
6191{
6192 if (strncmp (argv[0], "m", 1) == 0)
6193 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
6194 BGP_CLEAR_SOFT_IN, NULL);
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_ipv4_soft_in,
6201 clear_ip_bgp_external_ipv4_in_cmd,
6202 "clear ip bgp external ipv4 (unicast|multicast) in",
6203 CLEAR_STR
6204 IP_STR
6205 BGP_STR
6206 "Clear all external peers\n"
6207 "Address family\n"
6208 "Address Family modifier\n"
6209 "Address Family modifier\n"
6210 "Soft reconfig inbound update\n")
6211
6212DEFUN (clear_ip_bgp_external_ipv4_in_prefix_filter,
6213 clear_ip_bgp_external_ipv4_in_prefix_filter_cmd,
6214 "clear ip bgp external ipv4 (unicast|multicast) in prefix-filter",
6215 CLEAR_STR
6216 IP_STR
6217 BGP_STR
6218 "Clear all external peers\n"
6219 "Address family\n"
6220 "Address Family modifier\n"
6221 "Address Family modifier\n"
6222 "Soft reconfig inbound update\n"
6223 "Push out prefix-list ORF and do inbound soft reconfig\n")
6224{
6225 if (strncmp (argv[0], "m", 1) == 0)
6226 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
6227 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
6228
6229 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6230 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
6231}
6232
6233DEFUN (clear_bgp_external_soft_in,
6234 clear_bgp_external_soft_in_cmd,
6235 "clear bgp external soft in",
6236 CLEAR_STR
6237 BGP_STR
6238 "Clear all external peers\n"
6239 "Soft reconfig\n"
6240 "Soft reconfig inbound update\n")
6241{
6242 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
6243 BGP_CLEAR_SOFT_IN, NULL);
6244}
6245
6246ALIAS (clear_bgp_external_soft_in,
6247 clear_bgp_ipv6_external_soft_in_cmd,
6248 "clear bgp ipv6 external soft in",
6249 CLEAR_STR
6250 BGP_STR
6251 "Address family\n"
6252 "Clear all external peers\n"
6253 "Soft reconfig\n"
6254 "Soft reconfig inbound update\n")
6255
6256ALIAS (clear_bgp_external_soft_in,
6257 clear_bgp_external_in_cmd,
6258 "clear bgp external in",
6259 CLEAR_STR
6260 BGP_STR
6261 "Clear all external peers\n"
6262 "Soft reconfig inbound update\n")
6263
6264ALIAS (clear_bgp_external_soft_in,
6265 clear_bgp_ipv6_external_in_cmd,
6266 "clear bgp ipv6 external WORD in",
6267 CLEAR_STR
6268 BGP_STR
6269 "Address family\n"
6270 "Clear all external peers\n"
6271 "Soft reconfig inbound update\n")
6272
6273DEFUN (clear_bgp_external_in_prefix_filter,
6274 clear_bgp_external_in_prefix_filter_cmd,
6275 "clear bgp external in prefix-filter",
6276 CLEAR_STR
6277 BGP_STR
6278 "Clear all external peers\n"
6279 "Soft reconfig inbound update\n"
6280 "Push out prefix-list ORF and do inbound soft reconfig\n")
6281{
6282 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
6283 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
6284}
6285
6286ALIAS (clear_bgp_external_in_prefix_filter,
6287 clear_bgp_ipv6_external_in_prefix_filter_cmd,
6288 "clear bgp ipv6 external in prefix-filter",
6289 CLEAR_STR
6290 BGP_STR
6291 "Address family\n"
6292 "Clear all external peers\n"
6293 "Soft reconfig inbound update\n"
6294 "Push out prefix-list ORF and do inbound soft reconfig\n")
6295
6296DEFUN (clear_ip_bgp_as_soft_in,
6297 clear_ip_bgp_as_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006298 "clear ip bgp " CMD_AS_RANGE " soft in",
paul718e3742002-12-13 20:15:29 +00006299 CLEAR_STR
6300 IP_STR
6301 BGP_STR
6302 "Clear peers with the AS number\n"
6303 "Soft reconfig\n"
6304 "Soft reconfig inbound update\n")
6305{
6306 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6307 BGP_CLEAR_SOFT_IN, argv[0]);
6308}
6309
6310ALIAS (clear_ip_bgp_as_soft_in,
6311 clear_ip_bgp_as_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006312 "clear ip bgp " CMD_AS_RANGE " in",
paul718e3742002-12-13 20:15:29 +00006313 CLEAR_STR
6314 IP_STR
6315 BGP_STR
6316 "Clear peers with the AS number\n"
6317 "Soft reconfig inbound update\n")
6318
6319DEFUN (clear_ip_bgp_as_in_prefix_filter,
6320 clear_ip_bgp_as_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006321 "clear ip bgp " CMD_AS_RANGE " in prefix-filter",
paul718e3742002-12-13 20:15:29 +00006322 CLEAR_STR
6323 IP_STR
6324 BGP_STR
6325 "Clear peers with the AS number\n"
6326 "Soft reconfig inbound update\n"
6327 "Push out prefix-list ORF and do inbound soft reconfig\n")
6328{
6329 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6330 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6331}
6332
6333DEFUN (clear_ip_bgp_as_ipv4_soft_in,
6334 clear_ip_bgp_as_ipv4_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006335 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft in",
paul718e3742002-12-13 20:15:29 +00006336 CLEAR_STR
6337 IP_STR
6338 BGP_STR
6339 "Clear peers with the AS number\n"
6340 "Address family\n"
6341 "Address Family modifier\n"
6342 "Address Family modifier\n"
6343 "Soft reconfig\n"
6344 "Soft reconfig inbound update\n")
6345{
6346 if (strncmp (argv[1], "m", 1) == 0)
6347 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
6348 BGP_CLEAR_SOFT_IN, argv[0]);
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_ipv4_soft_in,
6355 clear_ip_bgp_as_ipv4_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006356 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) 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 "Address family\n"
6362 "Address Family modifier\n"
6363 "Address Family modifier\n"
6364 "Soft reconfig inbound update\n")
6365
6366DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter,
6367 clear_ip_bgp_as_ipv4_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006368 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in prefix-filter",
paul718e3742002-12-13 20:15:29 +00006369 CLEAR_STR
6370 IP_STR
6371 BGP_STR
6372 "Clear peers with the AS number\n"
6373 "Address family\n"
6374 "Address Family modifier\n"
6375 "Address Family modifier\n"
6376 "Soft reconfig inbound update\n"
6377 "Push out prefix-list ORF and do inbound soft reconfig\n")
6378{
6379 if (strncmp (argv[1], "m", 1) == 0)
6380 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
6381 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6382
6383 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6384 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6385}
6386
6387DEFUN (clear_ip_bgp_as_vpnv4_soft_in,
6388 clear_ip_bgp_as_vpnv4_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006389 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft in",
paul718e3742002-12-13 20:15:29 +00006390 CLEAR_STR
6391 IP_STR
6392 BGP_STR
6393 "Clear peers with the AS number\n"
6394 "Address family\n"
6395 "Address Family modifier\n"
6396 "Soft reconfig\n"
6397 "Soft reconfig inbound update\n")
6398{
6399 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
6400 BGP_CLEAR_SOFT_IN, argv[0]);
6401}
6402
6403ALIAS (clear_ip_bgp_as_vpnv4_soft_in,
6404 clear_ip_bgp_as_vpnv4_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006405 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast in",
paul718e3742002-12-13 20:15:29 +00006406 CLEAR_STR
6407 IP_STR
6408 BGP_STR
6409 "Clear peers with the AS number\n"
6410 "Address family\n"
6411 "Address Family modifier\n"
6412 "Soft reconfig inbound update\n")
6413
Lou Berger298cc2f2016-01-12 13:42:02 -05006414DEFUN (clear_ip_bgp_as_encap_soft_in,
6415 clear_ip_bgp_as_encap_soft_in_cmd,
6416 "clear ip bgp " CMD_AS_RANGE " encap unicast soft in",
6417 CLEAR_STR
6418 IP_STR
6419 BGP_STR
6420 "Clear peers with the AS number\n"
6421 "Address family\n"
6422 "Address Family modifier\n"
6423 "Soft reconfig\n"
6424 "Soft reconfig inbound update\n")
6425{
6426 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_as,
6427 BGP_CLEAR_SOFT_IN, argv[0]);
6428}
6429
6430ALIAS (clear_ip_bgp_as_encap_soft_in,
6431 clear_ip_bgp_as_encap_in_cmd,
6432 "clear ip bgp " CMD_AS_RANGE " encap unicast in",
6433 CLEAR_STR
6434 IP_STR
6435 BGP_STR
6436 "Clear peers with the AS number\n"
6437 "Address family\n"
6438 "Address Family modifier\n"
6439 "Soft reconfig inbound update\n")
6440
paul718e3742002-12-13 20:15:29 +00006441DEFUN (clear_bgp_as_soft_in,
6442 clear_bgp_as_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006443 "clear bgp " CMD_AS_RANGE " soft in",
paul718e3742002-12-13 20:15:29 +00006444 CLEAR_STR
6445 BGP_STR
6446 "Clear peers with the AS number\n"
6447 "Soft reconfig\n"
6448 "Soft reconfig inbound update\n")
6449{
6450 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
6451 BGP_CLEAR_SOFT_IN, argv[0]);
6452}
6453
6454ALIAS (clear_bgp_as_soft_in,
6455 clear_bgp_ipv6_as_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006456 "clear bgp ipv6 " CMD_AS_RANGE " soft in",
paul718e3742002-12-13 20:15:29 +00006457 CLEAR_STR
6458 BGP_STR
6459 "Address family\n"
6460 "Clear peers with the AS number\n"
6461 "Soft reconfig\n"
6462 "Soft reconfig inbound update\n")
6463
6464ALIAS (clear_bgp_as_soft_in,
6465 clear_bgp_as_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006466 "clear bgp " CMD_AS_RANGE " in",
paul718e3742002-12-13 20:15:29 +00006467 CLEAR_STR
6468 BGP_STR
6469 "Clear peers with the AS number\n"
6470 "Soft reconfig inbound update\n")
6471
6472ALIAS (clear_bgp_as_soft_in,
6473 clear_bgp_ipv6_as_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006474 "clear bgp ipv6 " CMD_AS_RANGE " in",
paul718e3742002-12-13 20:15:29 +00006475 CLEAR_STR
6476 BGP_STR
6477 "Address family\n"
6478 "Clear peers with the AS number\n"
6479 "Soft reconfig inbound update\n")
6480
6481DEFUN (clear_bgp_as_in_prefix_filter,
6482 clear_bgp_as_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006483 "clear bgp " CMD_AS_RANGE " in prefix-filter",
paul718e3742002-12-13 20:15:29 +00006484 CLEAR_STR
6485 BGP_STR
6486 "Clear peers with the AS number\n"
6487 "Soft reconfig inbound update\n"
6488 "Push out prefix-list ORF and do inbound soft reconfig\n")
6489{
6490 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
6491 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6492}
6493
6494ALIAS (clear_bgp_as_in_prefix_filter,
6495 clear_bgp_ipv6_as_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006496 "clear bgp ipv6 " CMD_AS_RANGE " in prefix-filter",
paul718e3742002-12-13 20:15:29 +00006497 CLEAR_STR
6498 BGP_STR
6499 "Address family\n"
6500 "Clear peers with the AS number\n"
6501 "Soft reconfig inbound update\n"
6502 "Push out prefix-list ORF and do inbound soft reconfig\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02006503
paul718e3742002-12-13 20:15:29 +00006504/* Both soft-reconfiguration */
6505DEFUN (clear_ip_bgp_all_soft,
6506 clear_ip_bgp_all_soft_cmd,
6507 "clear ip bgp * soft",
6508 CLEAR_STR
6509 IP_STR
6510 BGP_STR
6511 "Clear all peers\n"
6512 "Soft reconfig\n")
6513{
6514 if (argc == 1)
6515 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
6516 BGP_CLEAR_SOFT_BOTH, NULL);
6517
6518 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6519 BGP_CLEAR_SOFT_BOTH, NULL);
6520}
6521
6522ALIAS (clear_ip_bgp_all_soft,
6523 clear_ip_bgp_instance_all_soft_cmd,
6524 "clear ip bgp view WORD * soft",
6525 CLEAR_STR
6526 IP_STR
6527 BGP_STR
6528 "BGP view\n"
6529 "view name\n"
6530 "Clear all peers\n"
6531 "Soft reconfig\n")
6532
6533
6534DEFUN (clear_ip_bgp_all_ipv4_soft,
6535 clear_ip_bgp_all_ipv4_soft_cmd,
6536 "clear ip bgp * ipv4 (unicast|multicast) soft",
6537 CLEAR_STR
6538 IP_STR
6539 BGP_STR
6540 "Clear all peers\n"
6541 "Address family\n"
6542 "Address Family Modifier\n"
6543 "Address Family Modifier\n"
6544 "Soft reconfig\n")
6545{
6546 if (strncmp (argv[0], "m", 1) == 0)
6547 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
6548 BGP_CLEAR_SOFT_BOTH, NULL);
6549
6550 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6551 BGP_CLEAR_SOFT_BOTH, NULL);
6552}
6553
6554DEFUN (clear_ip_bgp_instance_all_ipv4_soft,
6555 clear_ip_bgp_instance_all_ipv4_soft_cmd,
6556 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft",
6557 CLEAR_STR
6558 IP_STR
6559 BGP_STR
6560 "BGP view\n"
6561 "view name\n"
6562 "Clear all peers\n"
6563 "Address family\n"
6564 "Address Family Modifier\n"
6565 "Address Family Modifier\n"
6566 "Soft reconfig\n")
6567{
6568 if (strncmp (argv[1], "m", 1) == 0)
6569 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
6570 BGP_CLEAR_SOFT_BOTH, NULL);
6571
6572 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6573 BGP_CLEAR_SOFT_BOTH, NULL);
6574}
6575
6576DEFUN (clear_ip_bgp_all_vpnv4_soft,
6577 clear_ip_bgp_all_vpnv4_soft_cmd,
6578 "clear ip bgp * vpnv4 unicast soft",
6579 CLEAR_STR
6580 IP_STR
6581 BGP_STR
6582 "Clear all peers\n"
6583 "Address family\n"
6584 "Address Family Modifier\n"
6585 "Soft reconfig\n")
6586{
6587 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
6588 BGP_CLEAR_SOFT_BOTH, argv[0]);
6589}
6590
Lou Berger298cc2f2016-01-12 13:42:02 -05006591DEFUN (clear_ip_bgp_all_encap_soft,
6592 clear_ip_bgp_all_encap_soft_cmd,
6593 "clear ip bgp * encap unicast soft",
6594 CLEAR_STR
6595 IP_STR
6596 BGP_STR
6597 "Clear all peers\n"
6598 "Address family\n"
6599 "Address Family Modifier\n"
6600 "Soft reconfig\n")
6601{
6602 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_all,
6603 BGP_CLEAR_SOFT_BOTH, argv[0]);
6604}
6605
paul718e3742002-12-13 20:15:29 +00006606DEFUN (clear_bgp_all_soft,
6607 clear_bgp_all_soft_cmd,
6608 "clear bgp * soft",
6609 CLEAR_STR
6610 BGP_STR
6611 "Clear all peers\n"
6612 "Soft reconfig\n")
6613{
6614 if (argc == 1)
6615 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
6616 BGP_CLEAR_SOFT_BOTH, argv[0]);
6617
6618 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
6619 BGP_CLEAR_SOFT_BOTH, argv[0]);
6620}
6621
6622ALIAS (clear_bgp_all_soft,
6623 clear_bgp_instance_all_soft_cmd,
6624 "clear bgp view WORD * soft",
6625 CLEAR_STR
6626 BGP_STR
6627 "BGP view\n"
6628 "view name\n"
6629 "Clear all peers\n"
6630 "Soft reconfig\n")
6631
6632ALIAS (clear_bgp_all_soft,
6633 clear_bgp_ipv6_all_soft_cmd,
6634 "clear bgp ipv6 * soft",
6635 CLEAR_STR
6636 BGP_STR
6637 "Address family\n"
6638 "Clear all peers\n"
6639 "Soft reconfig\n")
6640
6641DEFUN (clear_ip_bgp_peer_soft,
6642 clear_ip_bgp_peer_soft_cmd,
6643 "clear ip bgp A.B.C.D soft",
6644 CLEAR_STR
6645 IP_STR
6646 BGP_STR
6647 "BGP neighbor address to clear\n"
6648 "Soft reconfig\n")
6649{
6650 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6651 BGP_CLEAR_SOFT_BOTH, argv[0]);
6652}
6653
6654DEFUN (clear_ip_bgp_peer_ipv4_soft,
6655 clear_ip_bgp_peer_ipv4_soft_cmd,
6656 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft",
6657 CLEAR_STR
6658 IP_STR
6659 BGP_STR
6660 "BGP neighbor address to clear\n"
6661 "Address family\n"
6662 "Address Family Modifier\n"
6663 "Address Family Modifier\n"
6664 "Soft reconfig\n")
6665{
6666 if (strncmp (argv[1], "m", 1) == 0)
6667 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
6668 BGP_CLEAR_SOFT_BOTH, argv[0]);
6669
6670 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6671 BGP_CLEAR_SOFT_BOTH, argv[0]);
6672}
6673
6674DEFUN (clear_ip_bgp_peer_vpnv4_soft,
6675 clear_ip_bgp_peer_vpnv4_soft_cmd,
6676 "clear ip bgp A.B.C.D vpnv4 unicast soft",
6677 CLEAR_STR
6678 IP_STR
6679 BGP_STR
6680 "BGP neighbor address to clear\n"
6681 "Address family\n"
6682 "Address Family Modifier\n"
6683 "Soft reconfig\n")
6684{
6685 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
6686 BGP_CLEAR_SOFT_BOTH, argv[0]);
6687}
6688
Lou Berger298cc2f2016-01-12 13:42:02 -05006689DEFUN (clear_ip_bgp_peer_encap_soft,
6690 clear_ip_bgp_peer_encap_soft_cmd,
6691 "clear ip bgp A.B.C.D encap unicast soft",
6692 CLEAR_STR
6693 IP_STR
6694 BGP_STR
6695 "BGP neighbor address to clear\n"
6696 "Address family\n"
6697 "Address Family Modifier\n"
6698 "Soft reconfig\n")
6699{
6700 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_peer,
6701 BGP_CLEAR_SOFT_BOTH, argv[0]);
6702}
6703
paul718e3742002-12-13 20:15:29 +00006704DEFUN (clear_bgp_peer_soft,
6705 clear_bgp_peer_soft_cmd,
6706 "clear bgp (A.B.C.D|X:X::X:X) soft",
6707 CLEAR_STR
6708 BGP_STR
6709 "BGP neighbor address to clear\n"
6710 "BGP IPv6 neighbor to clear\n"
6711 "Soft reconfig\n")
6712{
6713 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
6714 BGP_CLEAR_SOFT_BOTH, argv[0]);
6715}
6716
6717ALIAS (clear_bgp_peer_soft,
6718 clear_bgp_ipv6_peer_soft_cmd,
6719 "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft",
6720 CLEAR_STR
6721 BGP_STR
6722 "Address family\n"
6723 "BGP neighbor address to clear\n"
6724 "BGP IPv6 neighbor to clear\n"
6725 "Soft reconfig\n")
6726
6727DEFUN (clear_ip_bgp_peer_group_soft,
6728 clear_ip_bgp_peer_group_soft_cmd,
6729 "clear ip bgp peer-group WORD soft",
6730 CLEAR_STR
6731 IP_STR
6732 BGP_STR
6733 "Clear all members of peer-group\n"
6734 "BGP peer-group name\n"
6735 "Soft reconfig\n")
6736{
6737 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6738 BGP_CLEAR_SOFT_BOTH, argv[0]);
6739}
6740
6741DEFUN (clear_ip_bgp_peer_group_ipv4_soft,
6742 clear_ip_bgp_peer_group_ipv4_soft_cmd,
6743 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft",
6744 CLEAR_STR
6745 IP_STR
6746 BGP_STR
6747 "Clear all members of peer-group\n"
6748 "BGP peer-group name\n"
6749 "Address family\n"
6750 "Address Family modifier\n"
6751 "Address Family modifier\n"
6752 "Soft reconfig\n")
6753{
6754 if (strncmp (argv[1], "m", 1) == 0)
6755 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
6756 BGP_CLEAR_SOFT_BOTH, argv[0]);
6757
6758 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6759 BGP_CLEAR_SOFT_BOTH, argv[0]);
6760}
6761
6762DEFUN (clear_bgp_peer_group_soft,
6763 clear_bgp_peer_group_soft_cmd,
6764 "clear bgp peer-group WORD soft",
6765 CLEAR_STR
6766 BGP_STR
6767 "Clear all members of peer-group\n"
6768 "BGP peer-group name\n"
6769 "Soft reconfig\n")
6770{
6771 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
6772 BGP_CLEAR_SOFT_BOTH, argv[0]);
6773}
6774
6775ALIAS (clear_bgp_peer_group_soft,
6776 clear_bgp_ipv6_peer_group_soft_cmd,
6777 "clear bgp ipv6 peer-group WORD soft",
6778 CLEAR_STR
6779 BGP_STR
6780 "Address family\n"
6781 "Clear all members of peer-group\n"
6782 "BGP peer-group name\n"
6783 "Soft reconfig\n")
6784
6785DEFUN (clear_ip_bgp_external_soft,
6786 clear_ip_bgp_external_soft_cmd,
6787 "clear ip bgp external soft",
6788 CLEAR_STR
6789 IP_STR
6790 BGP_STR
6791 "Clear all external peers\n"
6792 "Soft reconfig\n")
6793{
6794 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6795 BGP_CLEAR_SOFT_BOTH, NULL);
6796}
6797
6798DEFUN (clear_ip_bgp_external_ipv4_soft,
6799 clear_ip_bgp_external_ipv4_soft_cmd,
6800 "clear ip bgp external ipv4 (unicast|multicast) soft",
6801 CLEAR_STR
6802 IP_STR
6803 BGP_STR
6804 "Clear all external peers\n"
6805 "Address family\n"
6806 "Address Family modifier\n"
6807 "Address Family modifier\n"
6808 "Soft reconfig\n")
6809{
6810 if (strncmp (argv[0], "m", 1) == 0)
6811 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
6812 BGP_CLEAR_SOFT_BOTH, NULL);
6813
6814 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6815 BGP_CLEAR_SOFT_BOTH, NULL);
6816}
6817
6818DEFUN (clear_bgp_external_soft,
6819 clear_bgp_external_soft_cmd,
6820 "clear bgp external soft",
6821 CLEAR_STR
6822 BGP_STR
6823 "Clear all external peers\n"
6824 "Soft reconfig\n")
6825{
6826 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
6827 BGP_CLEAR_SOFT_BOTH, NULL);
6828}
6829
6830ALIAS (clear_bgp_external_soft,
6831 clear_bgp_ipv6_external_soft_cmd,
6832 "clear bgp ipv6 external soft",
6833 CLEAR_STR
6834 BGP_STR
6835 "Address family\n"
6836 "Clear all external peers\n"
6837 "Soft reconfig\n")
6838
6839DEFUN (clear_ip_bgp_as_soft,
6840 clear_ip_bgp_as_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006841 "clear ip bgp " CMD_AS_RANGE " soft",
paul718e3742002-12-13 20:15:29 +00006842 CLEAR_STR
6843 IP_STR
6844 BGP_STR
6845 "Clear peers with the AS number\n"
6846 "Soft reconfig\n")
6847{
6848 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6849 BGP_CLEAR_SOFT_BOTH, argv[0]);
6850}
6851
6852DEFUN (clear_ip_bgp_as_ipv4_soft,
6853 clear_ip_bgp_as_ipv4_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006854 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft",
paul718e3742002-12-13 20:15:29 +00006855 CLEAR_STR
6856 IP_STR
6857 BGP_STR
6858 "Clear peers with the AS number\n"
6859 "Address family\n"
6860 "Address Family Modifier\n"
6861 "Address Family Modifier\n"
6862 "Soft reconfig\n")
6863{
6864 if (strncmp (argv[1], "m", 1) == 0)
6865 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
6866 BGP_CLEAR_SOFT_BOTH, argv[0]);
6867
6868 return bgp_clear_vty (vty, NULL,AFI_IP, SAFI_UNICAST, clear_as,
6869 BGP_CLEAR_SOFT_BOTH, argv[0]);
6870}
6871
6872DEFUN (clear_ip_bgp_as_vpnv4_soft,
6873 clear_ip_bgp_as_vpnv4_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006874 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft",
paul718e3742002-12-13 20:15:29 +00006875 CLEAR_STR
6876 IP_STR
6877 BGP_STR
6878 "Clear peers with the AS number\n"
6879 "Address family\n"
6880 "Address Family Modifier\n"
6881 "Soft reconfig\n")
6882{
6883 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
6884 BGP_CLEAR_SOFT_BOTH, argv[0]);
6885}
6886
Lou Berger298cc2f2016-01-12 13:42:02 -05006887DEFUN (clear_ip_bgp_as_encap_soft,
6888 clear_ip_bgp_as_encap_soft_cmd,
6889 "clear ip bgp " CMD_AS_RANGE " encap unicast soft",
6890 CLEAR_STR
6891 IP_STR
6892 BGP_STR
6893 "Clear peers with the AS number\n"
6894 "Address family\n"
6895 "Address Family Modifier\n"
6896 "Soft reconfig\n")
6897{
6898 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_as,
6899 BGP_CLEAR_SOFT_BOTH, argv[0]);
6900}
6901
paul718e3742002-12-13 20:15:29 +00006902DEFUN (clear_bgp_as_soft,
6903 clear_bgp_as_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006904 "clear bgp " CMD_AS_RANGE " soft",
paul718e3742002-12-13 20:15:29 +00006905 CLEAR_STR
6906 BGP_STR
6907 "Clear peers with the AS number\n"
6908 "Soft reconfig\n")
6909{
6910 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
6911 BGP_CLEAR_SOFT_BOTH, argv[0]);
6912}
6913
6914ALIAS (clear_bgp_as_soft,
6915 clear_bgp_ipv6_as_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006916 "clear bgp ipv6 " CMD_AS_RANGE " soft",
paul718e3742002-12-13 20:15:29 +00006917 CLEAR_STR
6918 BGP_STR
6919 "Address family\n"
6920 "Clear peers with the AS number\n"
6921 "Soft reconfig\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02006922
paulfee0f4c2004-09-13 05:12:46 +00006923/* RS-client soft reconfiguration. */
paulfee0f4c2004-09-13 05:12:46 +00006924DEFUN (clear_bgp_all_rsclient,
6925 clear_bgp_all_rsclient_cmd,
6926 "clear bgp * rsclient",
6927 CLEAR_STR
6928 BGP_STR
6929 "Clear all peers\n"
6930 "Soft reconfig for rsclient RIB\n")
6931{
6932 if (argc == 1)
6933 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
6934 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6935
6936 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
6937 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6938}
6939
6940ALIAS (clear_bgp_all_rsclient,
6941 clear_bgp_ipv6_all_rsclient_cmd,
6942 "clear bgp ipv6 * rsclient",
6943 CLEAR_STR
6944 BGP_STR
6945 "Address family\n"
6946 "Clear all peers\n"
6947 "Soft reconfig for rsclient RIB\n")
6948
6949ALIAS (clear_bgp_all_rsclient,
6950 clear_bgp_instance_all_rsclient_cmd,
6951 "clear bgp view WORD * rsclient",
6952 CLEAR_STR
6953 BGP_STR
6954 "BGP view\n"
6955 "view name\n"
6956 "Clear all peers\n"
6957 "Soft reconfig for rsclient RIB\n")
6958
6959ALIAS (clear_bgp_all_rsclient,
6960 clear_bgp_ipv6_instance_all_rsclient_cmd,
6961 "clear bgp ipv6 view WORD * rsclient",
6962 CLEAR_STR
6963 BGP_STR
6964 "Address family\n"
6965 "BGP view\n"
6966 "view name\n"
6967 "Clear all peers\n"
6968 "Soft reconfig for rsclient RIB\n")
paulfee0f4c2004-09-13 05:12:46 +00006969
6970DEFUN (clear_ip_bgp_all_rsclient,
6971 clear_ip_bgp_all_rsclient_cmd,
6972 "clear ip bgp * rsclient",
6973 CLEAR_STR
6974 IP_STR
6975 BGP_STR
6976 "Clear all peers\n"
6977 "Soft reconfig for rsclient RIB\n")
6978{
6979 if (argc == 1)
6980 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
6981 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6982
6983 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6984 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6985}
6986
6987ALIAS (clear_ip_bgp_all_rsclient,
6988 clear_ip_bgp_instance_all_rsclient_cmd,
6989 "clear ip bgp view WORD * rsclient",
6990 CLEAR_STR
6991 IP_STR
6992 BGP_STR
6993 "BGP view\n"
6994 "view name\n"
6995 "Clear all peers\n"
6996 "Soft reconfig for rsclient RIB\n")
6997
paulfee0f4c2004-09-13 05:12:46 +00006998DEFUN (clear_bgp_peer_rsclient,
6999 clear_bgp_peer_rsclient_cmd,
7000 "clear bgp (A.B.C.D|X:X::X:X) rsclient",
7001 CLEAR_STR
7002 BGP_STR
7003 "BGP neighbor IP address to clear\n"
7004 "BGP IPv6 neighbor to clear\n"
7005 "Soft reconfig for rsclient RIB\n")
7006{
7007 if (argc == 2)
7008 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_peer,
7009 BGP_CLEAR_SOFT_RSCLIENT, argv[1]);
7010
7011 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
7012 BGP_CLEAR_SOFT_RSCLIENT, argv[0]);
7013}
7014
7015ALIAS (clear_bgp_peer_rsclient,
7016 clear_bgp_ipv6_peer_rsclient_cmd,
7017 "clear bgp ipv6 (A.B.C.D|X:X::X:X) rsclient",
7018 CLEAR_STR
7019 BGP_STR
7020 "Address family\n"
7021 "BGP neighbor IP address to clear\n"
7022 "BGP IPv6 neighbor to clear\n"
7023 "Soft reconfig for rsclient RIB\n")
7024
7025ALIAS (clear_bgp_peer_rsclient,
7026 clear_bgp_instance_peer_rsclient_cmd,
7027 "clear bgp view WORD (A.B.C.D|X:X::X:X) rsclient",
7028 CLEAR_STR
7029 BGP_STR
7030 "BGP view\n"
7031 "view name\n"
7032 "BGP neighbor IP address to clear\n"
7033 "BGP IPv6 neighbor to clear\n"
7034 "Soft reconfig for rsclient RIB\n")
7035
7036ALIAS (clear_bgp_peer_rsclient,
7037 clear_bgp_ipv6_instance_peer_rsclient_cmd,
7038 "clear bgp ipv6 view WORD (A.B.C.D|X:X::X:X) rsclient",
7039 CLEAR_STR
7040 BGP_STR
7041 "Address family\n"
7042 "BGP view\n"
7043 "view name\n"
7044 "BGP neighbor IP address to clear\n"
7045 "BGP IPv6 neighbor to clear\n"
7046 "Soft reconfig for rsclient RIB\n")
paulfee0f4c2004-09-13 05:12:46 +00007047
7048DEFUN (clear_ip_bgp_peer_rsclient,
7049 clear_ip_bgp_peer_rsclient_cmd,
7050 "clear ip bgp (A.B.C.D|X:X::X:X) rsclient",
7051 CLEAR_STR
7052 IP_STR
7053 BGP_STR
7054 "BGP neighbor IP address to clear\n"
7055 "BGP IPv6 neighbor to clear\n"
7056 "Soft reconfig for rsclient RIB\n")
7057{
7058 if (argc == 2)
7059 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_peer,
7060 BGP_CLEAR_SOFT_RSCLIENT, argv[1]);
7061
7062 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
7063 BGP_CLEAR_SOFT_RSCLIENT, argv[0]);
7064}
7065
7066ALIAS (clear_ip_bgp_peer_rsclient,
7067 clear_ip_bgp_instance_peer_rsclient_cmd,
7068 "clear ip bgp view WORD (A.B.C.D|X:X::X:X) rsclient",
7069 CLEAR_STR
7070 IP_STR
7071 BGP_STR
7072 "BGP view\n"
7073 "view name\n"
7074 "BGP neighbor IP address to clear\n"
7075 "BGP IPv6 neighbor to clear\n"
7076 "Soft reconfig for rsclient RIB\n")
7077
Michael Lamberte0081f72008-11-16 20:12:04 +00007078DEFUN (show_bgp_views,
7079 show_bgp_views_cmd,
7080 "show bgp views",
7081 SHOW_STR
7082 BGP_STR
7083 "Show the defined BGP views\n")
7084{
7085 struct list *inst = bm->bgp;
7086 struct listnode *node;
7087 struct bgp *bgp;
7088
7089 if (!bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE))
7090 {
7091 vty_out (vty, "Multiple BGP views are not defined%s", VTY_NEWLINE);
7092 return CMD_WARNING;
7093 }
7094
7095 vty_out (vty, "Defined BGP views:%s", VTY_NEWLINE);
7096 for (ALL_LIST_ELEMENTS_RO(inst, node, bgp))
7097 vty_out (vty, "\t%s (AS%u)%s",
7098 bgp->name ? bgp->name : "(null)",
7099 bgp->as, VTY_NEWLINE);
7100
7101 return CMD_SUCCESS;
7102}
7103
Paul Jakma4bf6a362006-03-30 14:05:23 +00007104DEFUN (show_bgp_memory,
7105 show_bgp_memory_cmd,
7106 "show bgp memory",
7107 SHOW_STR
7108 BGP_STR
7109 "Global BGP memory statistics\n")
7110{
7111 char memstrbuf[MTYPE_MEMSTR_LEN];
7112 unsigned long count;
7113
7114 /* RIB related usage stats */
7115 count = mtype_stats_alloc (MTYPE_BGP_NODE);
7116 vty_out (vty, "%ld RIB nodes, using %s of memory%s", count,
7117 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7118 count * sizeof (struct bgp_node)),
7119 VTY_NEWLINE);
7120
7121 count = mtype_stats_alloc (MTYPE_BGP_ROUTE);
7122 vty_out (vty, "%ld BGP routes, using %s of memory%s", count,
7123 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7124 count * sizeof (struct bgp_info)),
7125 VTY_NEWLINE);
Paul Jakmafb982c22007-05-04 20:15:47 +00007126 if ((count = mtype_stats_alloc (MTYPE_BGP_ROUTE_EXTRA)))
7127 vty_out (vty, "%ld BGP route ancillaries, using %s of memory%s", count,
7128 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7129 count * sizeof (struct bgp_info_extra)),
7130 VTY_NEWLINE);
Paul Jakma4bf6a362006-03-30 14:05:23 +00007131
7132 if ((count = mtype_stats_alloc (MTYPE_BGP_STATIC)))
7133 vty_out (vty, "%ld Static routes, using %s of memory%s", count,
7134 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7135 count * sizeof (struct bgp_static)),
7136 VTY_NEWLINE);
7137
7138 /* Adj-In/Out */
7139 if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_IN)))
7140 vty_out (vty, "%ld Adj-In entries, using %s of memory%s", count,
7141 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7142 count * sizeof (struct bgp_adj_in)),
7143 VTY_NEWLINE);
7144 if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_OUT)))
7145 vty_out (vty, "%ld Adj-Out entries, using %s of memory%s", count,
7146 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7147 count * sizeof (struct bgp_adj_out)),
7148 VTY_NEWLINE);
7149
7150 if ((count = mtype_stats_alloc (MTYPE_BGP_NEXTHOP_CACHE)))
7151 vty_out (vty, "%ld Nexthop cache entries, using %s of memory%s", count,
7152 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7153 count * sizeof (struct bgp_nexthop_cache)),
7154 VTY_NEWLINE);
7155
7156 if ((count = mtype_stats_alloc (MTYPE_BGP_DAMP_INFO)))
7157 vty_out (vty, "%ld Dampening entries, using %s of memory%s", count,
7158 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7159 count * sizeof (struct bgp_damp_info)),
7160 VTY_NEWLINE);
7161
7162 /* Attributes */
7163 count = attr_count();
7164 vty_out (vty, "%ld BGP attributes, using %s of memory%s", count,
7165 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7166 count * sizeof(struct attr)),
7167 VTY_NEWLINE);
Paul Jakmafb982c22007-05-04 20:15:47 +00007168 if ((count = mtype_stats_alloc (MTYPE_ATTR_EXTRA)))
7169 vty_out (vty, "%ld BGP extra attributes, using %s of memory%s", count,
7170 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7171 count * sizeof(struct attr_extra)),
7172 VTY_NEWLINE);
Paul Jakma4bf6a362006-03-30 14:05:23 +00007173
7174 if ((count = attr_unknown_count()))
7175 vty_out (vty, "%ld unknown attributes%s", count, VTY_NEWLINE);
7176
7177 /* AS_PATH attributes */
7178 count = aspath_count ();
7179 vty_out (vty, "%ld BGP AS-PATH entries, using %s of memory%s", count,
7180 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7181 count * sizeof (struct aspath)),
7182 VTY_NEWLINE);
7183
7184 count = mtype_stats_alloc (MTYPE_AS_SEG);
7185 vty_out (vty, "%ld BGP AS-PATH segments, using %s of memory%s", count,
7186 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7187 count * sizeof (struct assegment)),
7188 VTY_NEWLINE);
7189
7190 /* Other attributes */
7191 if ((count = community_count ()))
7192 vty_out (vty, "%ld BGP community entries, using %s of memory%s", count,
7193 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7194 count * sizeof (struct community)),
7195 VTY_NEWLINE);
7196 if ((count = mtype_stats_alloc (MTYPE_ECOMMUNITY)))
7197 vty_out (vty, "%ld BGP community entries, using %s of memory%s", count,
7198 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7199 count * sizeof (struct ecommunity)),
7200 VTY_NEWLINE);
7201
7202 if ((count = mtype_stats_alloc (MTYPE_CLUSTER)))
7203 vty_out (vty, "%ld Cluster lists, using %s of memory%s", count,
7204 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7205 count * sizeof (struct cluster_list)),
7206 VTY_NEWLINE);
7207
7208 /* Peer related usage */
7209 count = mtype_stats_alloc (MTYPE_BGP_PEER);
7210 vty_out (vty, "%ld peers, using %s of memory%s", count,
7211 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7212 count * sizeof (struct peer)),
7213 VTY_NEWLINE);
7214
7215 if ((count = mtype_stats_alloc (MTYPE_PEER_GROUP)))
7216 vty_out (vty, "%ld peer groups, using %s of memory%s", count,
7217 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7218 count * sizeof (struct peer_group)),
7219 VTY_NEWLINE);
7220
7221 /* Other */
7222 if ((count = mtype_stats_alloc (MTYPE_HASH)))
7223 vty_out (vty, "%ld hash tables, using %s of memory%s", count,
7224 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7225 count * sizeof (struct hash)),
7226 VTY_NEWLINE);
7227 if ((count = mtype_stats_alloc (MTYPE_HASH_BACKET)))
7228 vty_out (vty, "%ld hash buckets, using %s of memory%s", count,
7229 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7230 count * sizeof (struct hash_backet)),
7231 VTY_NEWLINE);
7232 if ((count = mtype_stats_alloc (MTYPE_BGP_REGEXP)))
7233 vty_out (vty, "%ld compiled regexes, using %s of memory%s", count,
7234 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7235 count * sizeof (regex_t)),
7236 VTY_NEWLINE);
7237 return CMD_SUCCESS;
7238}
paulfee0f4c2004-09-13 05:12:46 +00007239
paul718e3742002-12-13 20:15:29 +00007240/* Show BGP peer's summary information. */
paul94f2b392005-06-28 12:44:16 +00007241static int
paul718e3742002-12-13 20:15:29 +00007242bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi)
7243{
7244 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00007245 struct listnode *node, *nnode;
Paul Jakma4bf6a362006-03-30 14:05:23 +00007246 unsigned int count = 0;
paul718e3742002-12-13 20:15:29 +00007247 char timebuf[BGP_UPTIME_LEN];
7248 int len;
7249
7250 /* Header string for each address family. */
Milan Kociancb4fc592014-12-01 12:48:25 +00007251 static char header[] = "Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd";
Paul Jakma4bf6a362006-03-30 14:05:23 +00007252
paul1eb8ef22005-04-07 07:30:20 +00007253 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00007254 {
7255 if (peer->afc[afi][safi])
7256 {
Paul Jakma4bf6a362006-03-30 14:05:23 +00007257 if (!count)
7258 {
7259 unsigned long ents;
7260 char memstrbuf[MTYPE_MEMSTR_LEN];
7261
7262 /* Usage summary and header */
7263 vty_out (vty,
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04007264 "BGP router identifier %s, local AS number %u%s",
Paul Jakma4bf6a362006-03-30 14:05:23 +00007265 inet_ntoa (bgp->router_id), bgp->as, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007266
Paul Jakma4bf6a362006-03-30 14:05:23 +00007267 ents = bgp_table_count (bgp->rib[afi][safi]);
7268 vty_out (vty, "RIB entries %ld, using %s of memory%s", ents,
7269 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7270 ents * sizeof (struct bgp_node)),
7271 VTY_NEWLINE);
7272
7273 /* Peer related usage */
7274 ents = listcount (bgp->peer);
7275 vty_out (vty, "Peers %ld, using %s of memory%s",
7276 ents,
7277 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7278 ents * sizeof (struct peer)),
7279 VTY_NEWLINE);
7280
7281 if ((ents = listcount (bgp->rsclient)))
7282 vty_out (vty, "RS-Client peers %ld, using %s of memory%s",
7283 ents,
7284 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7285 ents * sizeof (struct peer)),
7286 VTY_NEWLINE);
7287
7288 if ((ents = listcount (bgp->group)))
7289 vty_out (vty, "Peer groups %ld, using %s of memory%s", ents,
7290 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7291 ents * sizeof (struct peer_group)),
7292 VTY_NEWLINE);
7293
7294 if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING))
7295 vty_out (vty, "Dampening enabled.%s", VTY_NEWLINE);
7296 vty_out (vty, "%s", VTY_NEWLINE);
7297 vty_out (vty, "%s%s", header, VTY_NEWLINE);
7298 }
7299
paul718e3742002-12-13 20:15:29 +00007300 count++;
7301
7302 len = vty_out (vty, "%s", peer->host);
7303 len = 16 - len;
7304 if (len < 1)
7305 vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " ");
7306 else
7307 vty_out (vty, "%*s", len, " ");
7308
hasso3d515fd2005-02-01 21:30:04 +00007309 vty_out (vty, "4 ");
paul718e3742002-12-13 20:15:29 +00007310
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04007311 vty_out (vty, "%5u %7d %7d %8d %4d %4lu ",
paul718e3742002-12-13 20:15:29 +00007312 peer->as,
7313 peer->open_in + peer->update_in + peer->keepalive_in
7314 + peer->notify_in + peer->refresh_in + peer->dynamic_cap_in,
7315 peer->open_out + peer->update_out + peer->keepalive_out
7316 + peer->notify_out + peer->refresh_out
7317 + peer->dynamic_cap_out,
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00007318 0, 0, (unsigned long) peer->obuf->count);
paul718e3742002-12-13 20:15:29 +00007319
7320 vty_out (vty, "%8s",
7321 peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN));
7322
7323 if (peer->status == Established)
7324 {
7325 vty_out (vty, " %8ld", peer->pcount[afi][safi]);
7326 }
7327 else
7328 {
7329 if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN))
7330 vty_out (vty, " Idle (Admin)");
7331 else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW))
7332 vty_out (vty, " Idle (PfxCt)");
7333 else
7334 vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, peer->status));
7335 }
7336
7337 vty_out (vty, "%s", VTY_NEWLINE);
7338 }
7339 }
7340
7341 if (count)
7342 vty_out (vty, "%sTotal number of neighbors %d%s", VTY_NEWLINE,
7343 count, VTY_NEWLINE);
7344 else
7345 vty_out (vty, "No %s neighbor is configured%s",
7346 afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE);
7347 return CMD_SUCCESS;
7348}
7349
paul94f2b392005-06-28 12:44:16 +00007350static int
paulfd79ac92004-10-13 05:06:08 +00007351bgp_show_summary_vty (struct vty *vty, const char *name,
7352 afi_t afi, safi_t safi)
paul718e3742002-12-13 20:15:29 +00007353{
7354 struct bgp *bgp;
7355
7356 if (name)
7357 {
7358 bgp = bgp_lookup_by_name (name);
7359
7360 if (! bgp)
7361 {
7362 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
7363 return CMD_WARNING;
7364 }
7365
7366 bgp_show_summary (vty, bgp, afi, safi);
7367 return CMD_SUCCESS;
7368 }
7369
7370 bgp = bgp_get_default ();
7371
7372 if (bgp)
7373 bgp_show_summary (vty, bgp, afi, safi);
7374
7375 return CMD_SUCCESS;
7376}
7377
7378/* `show ip bgp summary' commands. */
Lou Bergerf9b6c392016-01-12 13:42:09 -05007379DEFUN (show_ip_bgp_summary,
7380 show_ip_bgp_summary_cmd,
7381 "show ip bgp summary",
7382 SHOW_STR
7383 IP_STR
7384 BGP_STR
7385 "Summary of BGP neighbor status\n")
7386{
7387 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
7388}
7389
7390DEFUN (show_ip_bgp_instance_summary,
7391 show_ip_bgp_instance_summary_cmd,
7392 "show ip bgp view WORD summary",
7393 SHOW_STR
7394 IP_STR
7395 BGP_STR
7396 "BGP view\n"
7397 "View name\n"
7398 "Summary of BGP neighbor status\n")
7399{
7400 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
7401}
7402
7403DEFUN (show_ip_bgp_ipv4_summary,
7404 show_ip_bgp_ipv4_summary_cmd,
7405 "show ip bgp ipv4 (unicast|multicast) summary",
7406 SHOW_STR
7407 IP_STR
7408 BGP_STR
7409 "Address family\n"
7410 "Address Family modifier\n"
7411 "Address Family modifier\n"
7412 "Summary of BGP neighbor status\n")
7413{
7414 if (strncmp (argv[0], "m", 1) == 0)
7415 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
7416
7417 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
7418}
7419
7420DEFUN (show_ip_bgp_instance_ipv4_summary,
7421 show_ip_bgp_instance_ipv4_summary_cmd,
7422 "show ip bgp view WORD ipv4 (unicast|multicast) summary",
7423 SHOW_STR
7424 IP_STR
7425 BGP_STR
7426 "BGP view\n"
7427 "View name\n"
7428 "Address family\n"
7429 "Address Family modifier\n"
7430 "Address Family modifier\n"
7431 "Summary of BGP neighbor status\n")
7432{
7433 if (strncmp (argv[1], "m", 1) == 0)
7434 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
7435 else
7436 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
7437}
7438
7439DEFUN (show_ip_bgp_vpnv4_all_summary,
7440 show_ip_bgp_vpnv4_all_summary_cmd,
7441 "show ip bgp vpnv4 all summary",
7442 SHOW_STR
7443 IP_STR
7444 BGP_STR
7445 "Display VPNv4 NLRI specific information\n"
7446 "Display information about all VPNv4 NLRIs\n"
7447 "Summary of BGP neighbor status\n")
7448{
7449 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
7450}
7451
7452DEFUN (show_ip_bgp_vpnv4_rd_summary,
7453 show_ip_bgp_vpnv4_rd_summary_cmd,
7454 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn summary",
7455 SHOW_STR
7456 IP_STR
7457 BGP_STR
7458 "Display VPNv4 NLRI specific information\n"
7459 "Display information for a route distinguisher\n"
7460 "VPN Route Distinguisher\n"
7461 "Summary of BGP neighbor status\n")
7462{
7463 int ret;
7464 struct prefix_rd prd;
7465
7466 ret = str2prefix_rd (argv[0], &prd);
7467 if (! ret)
7468 {
7469 vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
7470 return CMD_WARNING;
7471 }
7472
7473 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
7474}
7475
Lou Berger651b4022016-01-12 13:42:07 -05007476DEFUN (show_bgp_ipv4_safi_summary,
7477 show_bgp_ipv4_safi_summary_cmd,
7478 "show bgp ipv4 (unicast|multicast) summary",
paul718e3742002-12-13 20:15:29 +00007479 SHOW_STR
paul718e3742002-12-13 20:15:29 +00007480 BGP_STR
7481 "Address family\n"
7482 "Address Family modifier\n"
7483 "Address Family modifier\n"
7484 "Summary of BGP neighbor status\n")
7485{
7486 if (strncmp (argv[0], "m", 1) == 0)
7487 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
7488
7489 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
7490}
7491
Lou Berger651b4022016-01-12 13:42:07 -05007492DEFUN (show_bgp_instance_ipv4_safi_summary,
7493 show_bgp_instance_ipv4_safi_summary_cmd,
7494 "show bgp view WORD ipv4 (unicast|multicast) summary",
Michael Lambert95cbbd22010-07-23 14:43:04 -04007495 SHOW_STR
7496 BGP_STR
paul718e3742002-12-13 20:15:29 +00007497 "BGP view\n"
7498 "View name\n"
7499 "Address family\n"
7500 "Address Family modifier\n"
7501 "Address Family modifier\n"
7502 "Summary of BGP neighbor status\n")
7503{
7504 if (strncmp (argv[1], "m", 1) == 0)
7505 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
7506 else
7507 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
7508}
7509
Lou Berger651b4022016-01-12 13:42:07 -05007510DEFUN (show_bgp_ipv4_vpn_summary,
7511 show_bgp_ipv4_vpn_summary_cmd,
7512 "show bgp ipv4 vpn summary",
Michael Lambert95cbbd22010-07-23 14:43:04 -04007513 SHOW_STR
7514 BGP_STR
Lou Berger651b4022016-01-12 13:42:07 -05007515 "IPv4\n"
7516 "Display VPN NLRI specific information\n"
paul718e3742002-12-13 20:15:29 +00007517 "Summary of BGP neighbor status\n")
7518{
7519 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
7520}
7521
Lou Berger651b4022016-01-12 13:42:07 -05007522/* `show ip bgp summary' commands. */
7523DEFUN (show_bgp_ipv6_vpn_summary,
7524 show_bgp_ipv6_vpn_summary_cmd,
7525 "show bgp ipv6 vpn summary",
paul718e3742002-12-13 20:15:29 +00007526 SHOW_STR
7527 BGP_STR
Lou Berger651b4022016-01-12 13:42:07 -05007528 "IPv6\n"
7529 "Display VPN NLRI specific information\n"
paul718e3742002-12-13 20:15:29 +00007530 "Summary of BGP neighbor status\n")
7531{
Lou Berger651b4022016-01-12 13:42:07 -05007532 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MPLS_VPN);
paul718e3742002-12-13 20:15:29 +00007533}
Lou Berger651b4022016-01-12 13:42:07 -05007534
7535DEFUN (show_bgp_ipv4_encap_summary,
7536 show_bgp_ipv4_encap_summary_cmd,
7537 "show bgp ipv4 encap summary",
7538 SHOW_STR
7539 BGP_STR
7540 "IPv4\n"
7541 "Display ENCAP NLRI specific information\n"
7542 "Summary of BGP neighbor status\n")
7543{
7544 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_ENCAP);
7545}
7546
Lou Berger651b4022016-01-12 13:42:07 -05007547DEFUN (show_bgp_ipv6_encap_summary,
7548 show_bgp_ipv6_encap_summary_cmd,
7549 "show bgp ipv6 encap summary",
7550 SHOW_STR
7551 BGP_STR
7552 "IPv6\n"
7553 "Display ENCAP NLRI specific information\n"
7554 "Summary of BGP neighbor status\n")
7555{
7556 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_ENCAP);
7557}
7558
paul718e3742002-12-13 20:15:29 +00007559DEFUN (show_bgp_instance_summary,
7560 show_bgp_instance_summary_cmd,
7561 "show bgp view WORD summary",
7562 SHOW_STR
7563 BGP_STR
7564 "BGP view\n"
7565 "View name\n"
7566 "Summary of BGP neighbor status\n")
7567{
Lou Berger651b4022016-01-12 13:42:07 -05007568 vty_out(vty, "%sIPv4 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7569 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7570 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
7571 vty_out(vty, "%sIPv4 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7572 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7573 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
7574 vty_out(vty, "%sIPv4 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7575 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7576 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MPLS_VPN);
7577 vty_out(vty, "%sIPv4 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7578 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7579 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_ENCAP);
7580
Lou Berger651b4022016-01-12 13:42:07 -05007581 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7582 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7583 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
7584 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7585 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7586 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST);
7587 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7588 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7589 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MPLS_VPN);
7590 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7591 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7592 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_ENCAP);
Lou Berger205e6742016-01-12 13:42:11 -05007593
Lou Berger651b4022016-01-12 13:42:07 -05007594 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00007595}
7596
Lou Berger651b4022016-01-12 13:42:07 -05007597DEFUN (show_bgp_instance_ipv4_summary,
7598 show_bgp_instance_ipv4_summary_cmd,
7599 "show bgp view WORD ipv4 summary",
paul718e3742002-12-13 20:15:29 +00007600 SHOW_STR
7601 BGP_STR
Lou Berger651b4022016-01-12 13:42:07 -05007602 IP_STR
7603 "Address Family modifier\n"
7604 "Address Family modifier\n"
7605 "BGP view\n"
7606 "View name\n"
paul718e3742002-12-13 20:15:29 +00007607 "Summary of BGP neighbor status\n")
Lou Berger651b4022016-01-12 13:42:07 -05007608{
7609 vty_out(vty, "%sIPv4 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7610 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7611 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
7612 vty_out(vty, "%sIPv4 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7613 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7614 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
7615 vty_out(vty, "%sIPv4 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7616 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7617 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MPLS_VPN);
7618 vty_out(vty, "%sIPv4 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7619 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7620 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_ENCAP);
paul718e3742002-12-13 20:15:29 +00007621
Lou Berger651b4022016-01-12 13:42:07 -05007622 return CMD_SUCCESS;
7623}
7624
Lou Berger651b4022016-01-12 13:42:07 -05007625DEFUN (show_bgp_instance_ipv6_summary,
paul718e3742002-12-13 20:15:29 +00007626 show_bgp_instance_ipv6_summary_cmd,
7627 "show bgp view WORD ipv6 summary",
7628 SHOW_STR
7629 BGP_STR
Lou Berger651b4022016-01-12 13:42:07 -05007630 IPV6_STR
7631 "Address Family modifier\n"
7632 "Address Family modifier\n"
paul718e3742002-12-13 20:15:29 +00007633 "BGP view\n"
7634 "View name\n"
paul718e3742002-12-13 20:15:29 +00007635 "Summary of BGP neighbor status\n")
Lou Berger651b4022016-01-12 13:42:07 -05007636{
7637 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7638 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7639 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
7640 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7641 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7642 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST);
7643 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7644 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7645 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MPLS_VPN);
7646 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7647 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7648 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_ENCAP);
7649
7650 return CMD_SUCCESS;
7651}
paul718e3742002-12-13 20:15:29 +00007652
Michael Lambert95cbbd22010-07-23 14:43:04 -04007653DEFUN (show_bgp_ipv6_safi_summary,
7654 show_bgp_ipv6_safi_summary_cmd,
7655 "show bgp ipv6 (unicast|multicast) summary",
7656 SHOW_STR
7657 BGP_STR
7658 "Address family\n"
7659 "Address Family modifier\n"
7660 "Address Family modifier\n"
7661 "Summary of BGP neighbor status\n")
7662{
7663 if (strncmp (argv[0], "m", 1) == 0)
7664 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
7665
7666 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
7667}
7668
7669DEFUN (show_bgp_instance_ipv6_safi_summary,
7670 show_bgp_instance_ipv6_safi_summary_cmd,
7671 "show bgp view WORD ipv6 (unicast|multicast) summary",
7672 SHOW_STR
7673 BGP_STR
7674 "BGP view\n"
7675 "View name\n"
7676 "Address family\n"
7677 "Address Family modifier\n"
7678 "Address Family modifier\n"
7679 "Summary of BGP neighbor status\n")
7680{
7681 if (strncmp (argv[1], "m", 1) == 0)
7682 return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST);
7683
7684 return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
7685}
7686
Lou Bergerf9b6c392016-01-12 13:42:09 -05007687/* old command */
7688DEFUN (show_ipv6_bgp_summary,
7689 show_ipv6_bgp_summary_cmd,
7690 "show ipv6 bgp summary",
7691 SHOW_STR
7692 IPV6_STR
7693 BGP_STR
7694 "Summary of BGP neighbor status\n")
7695{
7696 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
7697}
7698
7699/* old command */
7700DEFUN (show_ipv6_mbgp_summary,
7701 show_ipv6_mbgp_summary_cmd,
7702 "show ipv6 mbgp summary",
7703 SHOW_STR
7704 IPV6_STR
7705 MBGP_STR
7706 "Summary of BGP neighbor status\n")
7707{
7708 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
7709}
Lou Berger651b4022016-01-12 13:42:07 -05007710
7711/* variations of show bgp [...] summary */
7712
7713/* This one is for the 0-keyword variant */
7714DEFUN (show_bgp_summary,
7715 show_bgp_summary_cmd,
7716 "show bgp summary",
paul718e3742002-12-13 20:15:29 +00007717 SHOW_STR
paul718e3742002-12-13 20:15:29 +00007718 BGP_STR
7719 "Summary of BGP neighbor status\n")
7720{
Lou Berger651b4022016-01-12 13:42:07 -05007721 vty_out(vty, "%sIPv4 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7722 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7723 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
7724 vty_out(vty, "%sIPv4 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7725 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7726 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
7727 vty_out(vty, "%sIPv4 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7728 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7729 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
7730 vty_out(vty, "%sIPv4 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7731 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7732 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_ENCAP);
7733
Lou Berger651b4022016-01-12 13:42:07 -05007734 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7735 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7736 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
7737 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7738 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7739 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
7740 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7741 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7742 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MPLS_VPN);
7743 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7744 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7745 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_ENCAP);
Lou Berger205e6742016-01-12 13:42:11 -05007746
Lou Berger651b4022016-01-12 13:42:07 -05007747 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00007748}
7749
Lou Bergerf9b6c392016-01-12 13:42:09 -05007750ALIAS (show_bgp_summary,
7751 show_bgp_ipv6_summary_cmd,
7752 "show bgp ipv6 summary",
7753 SHOW_STR
7754 BGP_STR
7755 "Address family\n"
7756 "Summary of BGP neighbor status\n")
7757
Lou Berger651b4022016-01-12 13:42:07 -05007758DEFUN (show_bgp_summary_1w,
7759 show_bgp_summary_1w_cmd,
Lou Berger651b4022016-01-12 13:42:07 -05007760 "show bgp (ipv4|ipv6|unicast|multicast|vpn|encap) summary",
paul718e3742002-12-13 20:15:29 +00007761 SHOW_STR
Lou Berger651b4022016-01-12 13:42:07 -05007762 BGP_STR
7763 IP_STR
Lou Berger651b4022016-01-12 13:42:07 -05007764 IP6_STR
Lou Berger651b4022016-01-12 13:42:07 -05007765 "Address Family modifier\n"
7766 "Address Family modifier\n"
7767 "Address Family modifier\n"
7768 "Address Family modifier\n"
paul718e3742002-12-13 20:15:29 +00007769 "Summary of BGP neighbor status\n")
7770{
Lou Berger651b4022016-01-12 13:42:07 -05007771 if (strcmp (argv[0], "ipv4") == 0) {
7772 vty_out(vty, "%sIPv4 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7773 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7774 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
7775 vty_out(vty, "%sIPv4 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7776 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7777 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
7778 vty_out(vty, "%sIPv4 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7779 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7780 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
7781 vty_out(vty, "%sIPv4 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7782 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7783 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_ENCAP);
7784 return CMD_SUCCESS;
7785 }
Lou Berger205e6742016-01-12 13:42:11 -05007786
Lou Berger651b4022016-01-12 13:42:07 -05007787 if (strcmp (argv[0], "ipv6") == 0) {
7788 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7789 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7790 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
7791 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7792 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7793 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
7794 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7795 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7796 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MPLS_VPN);
7797 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7798 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7799 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_ENCAP);
7800 return CMD_SUCCESS;
7801 }
Lou Berger205e6742016-01-12 13:42:11 -05007802
Lou Berger651b4022016-01-12 13:42:07 -05007803 if (strcmp (argv[0], "unicast") == 0) {
7804 vty_out(vty, "IPv4 Unicast Summary:%s", VTY_NEWLINE);
7805 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7806 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
Lou Berger651b4022016-01-12 13:42:07 -05007807 vty_out(vty, "%s", VTY_NEWLINE);
7808 vty_out(vty, "IPv6 Unicast Summary:%s", VTY_NEWLINE);
7809 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7810 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
Lou Berger651b4022016-01-12 13:42:07 -05007811 return CMD_SUCCESS;
7812 }
7813 if (strcmp (argv[0], "multicast") == 0) {
7814 vty_out(vty, "IPv4 Multicast Summary:%s", VTY_NEWLINE);
7815 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7816 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
Lou Berger651b4022016-01-12 13:42:07 -05007817 vty_out(vty, "%s", VTY_NEWLINE);
7818 vty_out(vty, "IPv6 Multicast Summary:%s", VTY_NEWLINE);
7819 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7820 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
Lou Berger651b4022016-01-12 13:42:07 -05007821 return CMD_SUCCESS;
7822 }
7823 if (strcmp (argv[0], "vpn") == 0) {
7824 vty_out(vty, "IPv4 VPN Summary:%s", VTY_NEWLINE);
7825 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7826 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
Lou Berger651b4022016-01-12 13:42:07 -05007827 vty_out(vty, "%s", VTY_NEWLINE);
7828 vty_out(vty, "IPv6 VPN Summary:%s", VTY_NEWLINE);
7829 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7830 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MPLS_VPN);
Lou Berger651b4022016-01-12 13:42:07 -05007831 return CMD_SUCCESS;
7832 }
7833 if (strcmp (argv[0], "encap") == 0) {
7834 vty_out(vty, "IPv4 Encap Summary:%s", VTY_NEWLINE);
7835 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7836 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_ENCAP);
Lou Berger651b4022016-01-12 13:42:07 -05007837 vty_out(vty, "%s", VTY_NEWLINE);
7838 vty_out(vty, "IPv6 Encap Summary:%s", VTY_NEWLINE);
7839 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7840 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_ENCAP);
Lou Berger651b4022016-01-12 13:42:07 -05007841 return CMD_SUCCESS;
7842 }
7843 vty_out(vty, "Unknown keyword: %s%s", argv[0], VTY_NEWLINE);
7844 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00007845}
Lou Berger651b4022016-01-12 13:42:07 -05007846
7847
David Lamparter6b0655a2014-06-04 06:53:35 +02007848
paulfd79ac92004-10-13 05:06:08 +00007849const char *
hasso538621f2004-05-21 09:31:30 +00007850afi_safi_print (afi_t afi, safi_t safi)
7851{
7852 if (afi == AFI_IP && safi == SAFI_UNICAST)
7853 return "IPv4 Unicast";
7854 else if (afi == AFI_IP && safi == SAFI_MULTICAST)
7855 return "IPv4 Multicast";
7856 else if (afi == AFI_IP && safi == SAFI_MPLS_VPN)
Lou Berger9da04bc2016-01-12 13:41:55 -05007857 return "VPN-IPv4 Unicast";
Lou Bergera3fda882016-01-12 13:42:04 -05007858 else if (afi == AFI_IP && safi == SAFI_ENCAP)
7859 return "ENCAP-IPv4 Unicast";
hasso538621f2004-05-21 09:31:30 +00007860 else if (afi == AFI_IP6 && safi == SAFI_UNICAST)
7861 return "IPv6 Unicast";
7862 else if (afi == AFI_IP6 && safi == SAFI_MULTICAST)
7863 return "IPv6 Multicast";
Lou Berger9da04bc2016-01-12 13:41:55 -05007864 else if (afi == AFI_IP6 && safi == SAFI_MPLS_VPN)
7865 return "VPN-IPv6 Unicast";
Lou Bergera3fda882016-01-12 13:42:04 -05007866 else if (afi == AFI_IP6 && safi == SAFI_ENCAP)
7867 return "ENCAP-IPv6 Unicast";
hasso538621f2004-05-21 09:31:30 +00007868 else
7869 return "Unknown";
7870}
7871
paul718e3742002-12-13 20:15:29 +00007872/* Show BGP peer's information. */
7873enum show_type
7874{
7875 show_all,
7876 show_peer
7877};
7878
paul94f2b392005-06-28 12:44:16 +00007879static void
paul718e3742002-12-13 20:15:29 +00007880bgp_show_peer_afi_orf_cap (struct vty *vty, struct peer *p,
7881 afi_t afi, safi_t safi,
7882 u_int16_t adv_smcap, u_int16_t adv_rmcap,
7883 u_int16_t rcv_smcap, u_int16_t rcv_rmcap)
7884{
7885 /* Send-Mode */
7886 if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap)
7887 || CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap))
7888 {
7889 vty_out (vty, " Send-mode: ");
7890 if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap))
7891 vty_out (vty, "advertised");
7892 if (CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap))
7893 vty_out (vty, "%sreceived",
7894 CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) ?
7895 ", " : "");
7896 vty_out (vty, "%s", VTY_NEWLINE);
7897 }
7898
7899 /* Receive-Mode */
7900 if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap)
7901 || CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap))
7902 {
7903 vty_out (vty, " Receive-mode: ");
7904 if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap))
7905 vty_out (vty, "advertised");
7906 if (CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap))
7907 vty_out (vty, "%sreceived",
7908 CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) ?
7909 ", " : "");
7910 vty_out (vty, "%s", VTY_NEWLINE);
7911 }
7912}
7913
paul94f2b392005-06-28 12:44:16 +00007914static void
paul718e3742002-12-13 20:15:29 +00007915bgp_show_peer_afi (struct vty *vty, struct peer *p, afi_t afi, safi_t safi)
7916{
7917 struct bgp_filter *filter;
7918 char orf_pfx_name[BUFSIZ];
7919 int orf_pfx_count;
7920
7921 filter = &p->filter[afi][safi];
7922
hasso538621f2004-05-21 09:31:30 +00007923 vty_out (vty, " For address family: %s%s", afi_safi_print (afi, safi),
paul718e3742002-12-13 20:15:29 +00007924 VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00007925
paul718e3742002-12-13 20:15:29 +00007926 if (p->af_group[afi][safi])
7927 vty_out (vty, " %s peer-group member%s", p->group->name, VTY_NEWLINE);
7928
7929 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
7930 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
7931 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)
7932 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
7933 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV)
7934 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
7935 vty_out (vty, " AF-dependant capabilities:%s", VTY_NEWLINE);
7936
7937 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
7938 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
7939 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
7940 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV))
7941 {
7942 vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
7943 ORF_TYPE_PREFIX, VTY_NEWLINE);
7944 bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
7945 PEER_CAP_ORF_PREFIX_SM_ADV,
7946 PEER_CAP_ORF_PREFIX_RM_ADV,
7947 PEER_CAP_ORF_PREFIX_SM_RCV,
7948 PEER_CAP_ORF_PREFIX_RM_RCV);
7949 }
7950 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
7951 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)
7952 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
7953 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
7954 {
7955 vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
7956 ORF_TYPE_PREFIX_OLD, VTY_NEWLINE);
7957 bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
7958 PEER_CAP_ORF_PREFIX_SM_ADV,
7959 PEER_CAP_ORF_PREFIX_RM_ADV,
7960 PEER_CAP_ORF_PREFIX_SM_OLD_RCV,
7961 PEER_CAP_ORF_PREFIX_RM_OLD_RCV);
7962 }
7963
7964 sprintf (orf_pfx_name, "%s.%d.%d", p->host, afi, safi);
7965 orf_pfx_count = prefix_bgp_show_prefix_list (NULL, afi, orf_pfx_name);
7966
7967 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND)
7968 || orf_pfx_count)
7969 {
7970 vty_out (vty, " Outbound Route Filter (ORF):");
7971 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND))
7972 vty_out (vty, " sent;");
7973 if (orf_pfx_count)
7974 vty_out (vty, " received (%d entries)", orf_pfx_count);
7975 vty_out (vty, "%s", VTY_NEWLINE);
7976 }
7977 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH))
7978 vty_out (vty, " First update is deferred until ORF or ROUTE-REFRESH is received%s", VTY_NEWLINE);
7979
7980 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT))
7981 vty_out (vty, " Route-Reflector Client%s", VTY_NEWLINE);
7982 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT))
7983 vty_out (vty, " Route-Server Client%s", VTY_NEWLINE);
7984 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG))
7985 vty_out (vty, " Inbound soft reconfiguration allowed%s", VTY_NEWLINE);
7986 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS))
7987 vty_out (vty, " Private AS number removed from updates to this neighbor%s", VTY_NEWLINE);
7988 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF))
7989 vty_out (vty, " NEXT_HOP is always this router%s", VTY_NEWLINE);
7990 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED))
7991 vty_out (vty, " AS_PATH is propagated unchanged to this neighbor%s", VTY_NEWLINE);
7992 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED))
7993 vty_out (vty, " NEXT_HOP is propagated unchanged to this neighbor%s", VTY_NEWLINE);
7994 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED))
7995 vty_out (vty, " MED is propagated unchanged to this neighbor%s", VTY_NEWLINE);
7996 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
7997 || CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
7998 {
7999 vty_out (vty, " Community attribute sent to this neighbor");
8000 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
8001 && CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
hasso538621f2004-05-21 09:31:30 +00008002 vty_out (vty, "(both)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008003 else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
hasso538621f2004-05-21 09:31:30 +00008004 vty_out (vty, "(extended)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008005 else
hasso538621f2004-05-21 09:31:30 +00008006 vty_out (vty, "(standard)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008007 }
8008 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE))
8009 {
8010 vty_out (vty, " Default information originate,");
8011
8012 if (p->default_rmap[afi][safi].name)
8013 vty_out (vty, " default route-map %s%s,",
8014 p->default_rmap[afi][safi].map ? "*" : "",
8015 p->default_rmap[afi][safi].name);
8016 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_DEFAULT_ORIGINATE))
8017 vty_out (vty, " default sent%s", VTY_NEWLINE);
8018 else
8019 vty_out (vty, " default not sent%s", VTY_NEWLINE);
8020 }
8021
8022 if (filter->plist[FILTER_IN].name
8023 || filter->dlist[FILTER_IN].name
8024 || filter->aslist[FILTER_IN].name
paulfee0f4c2004-09-13 05:12:46 +00008025 || filter->map[RMAP_IN].name)
paul718e3742002-12-13 20:15:29 +00008026 vty_out (vty, " Inbound path policy configured%s", VTY_NEWLINE);
8027 if (filter->plist[FILTER_OUT].name
8028 || filter->dlist[FILTER_OUT].name
8029 || filter->aslist[FILTER_OUT].name
paulfee0f4c2004-09-13 05:12:46 +00008030 || filter->map[RMAP_OUT].name
paul718e3742002-12-13 20:15:29 +00008031 || filter->usmap.name)
8032 vty_out (vty, " Outbound path policy configured%s", VTY_NEWLINE);
paulfee0f4c2004-09-13 05:12:46 +00008033 if (filter->map[RMAP_IMPORT].name)
8034 vty_out (vty, " Import policy for this RS-client configured%s", VTY_NEWLINE);
8035 if (filter->map[RMAP_EXPORT].name)
8036 vty_out (vty, " Export policy for this RS-client configured%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008037
8038 /* prefix-list */
8039 if (filter->plist[FILTER_IN].name)
8040 vty_out (vty, " Incoming update prefix filter list is %s%s%s",
8041 filter->plist[FILTER_IN].plist ? "*" : "",
8042 filter->plist[FILTER_IN].name,
8043 VTY_NEWLINE);
8044 if (filter->plist[FILTER_OUT].name)
8045 vty_out (vty, " Outgoing update prefix filter list is %s%s%s",
8046 filter->plist[FILTER_OUT].plist ? "*" : "",
8047 filter->plist[FILTER_OUT].name,
8048 VTY_NEWLINE);
8049
8050 /* distribute-list */
8051 if (filter->dlist[FILTER_IN].name)
8052 vty_out (vty, " Incoming update network filter list is %s%s%s",
8053 filter->dlist[FILTER_IN].alist ? "*" : "",
8054 filter->dlist[FILTER_IN].name,
8055 VTY_NEWLINE);
8056 if (filter->dlist[FILTER_OUT].name)
8057 vty_out (vty, " Outgoing update network filter list is %s%s%s",
8058 filter->dlist[FILTER_OUT].alist ? "*" : "",
8059 filter->dlist[FILTER_OUT].name,
8060 VTY_NEWLINE);
8061
8062 /* filter-list. */
8063 if (filter->aslist[FILTER_IN].name)
8064 vty_out (vty, " Incoming update AS path filter list is %s%s%s",
8065 filter->aslist[FILTER_IN].aslist ? "*" : "",
8066 filter->aslist[FILTER_IN].name,
8067 VTY_NEWLINE);
8068 if (filter->aslist[FILTER_OUT].name)
8069 vty_out (vty, " Outgoing update AS path filter list is %s%s%s",
8070 filter->aslist[FILTER_OUT].aslist ? "*" : "",
8071 filter->aslist[FILTER_OUT].name,
8072 VTY_NEWLINE);
8073
8074 /* route-map. */
paulfee0f4c2004-09-13 05:12:46 +00008075 if (filter->map[RMAP_IN].name)
paul718e3742002-12-13 20:15:29 +00008076 vty_out (vty, " Route map for incoming advertisements is %s%s%s",
paulfee0f4c2004-09-13 05:12:46 +00008077 filter->map[RMAP_IN].map ? "*" : "",
8078 filter->map[RMAP_IN].name,
paul718e3742002-12-13 20:15:29 +00008079 VTY_NEWLINE);
paulfee0f4c2004-09-13 05:12:46 +00008080 if (filter->map[RMAP_OUT].name)
paul718e3742002-12-13 20:15:29 +00008081 vty_out (vty, " Route map for outgoing advertisements is %s%s%s",
paulfee0f4c2004-09-13 05:12:46 +00008082 filter->map[RMAP_OUT].map ? "*" : "",
8083 filter->map[RMAP_OUT].name,
8084 VTY_NEWLINE);
8085 if (filter->map[RMAP_IMPORT].name)
8086 vty_out (vty, " Route map for advertisements going into this RS-client's table is %s%s%s",
8087 filter->map[RMAP_IMPORT].map ? "*" : "",
8088 filter->map[RMAP_IMPORT].name,
8089 VTY_NEWLINE);
8090 if (filter->map[RMAP_EXPORT].name)
8091 vty_out (vty, " Route map for advertisements coming from this RS-client is %s%s%s",
8092 filter->map[RMAP_EXPORT].map ? "*" : "",
8093 filter->map[RMAP_EXPORT].name,
paul718e3742002-12-13 20:15:29 +00008094 VTY_NEWLINE);
8095
8096 /* unsuppress-map */
8097 if (filter->usmap.name)
8098 vty_out (vty, " Route map for selective unsuppress is %s%s%s",
8099 filter->usmap.map ? "*" : "",
8100 filter->usmap.name, VTY_NEWLINE);
8101
8102 /* Receive prefix count */
hassoe0701b72004-05-20 09:19:34 +00008103 vty_out (vty, " %ld accepted prefixes%s", p->pcount[afi][safi], VTY_NEWLINE);
8104
paul718e3742002-12-13 20:15:29 +00008105 /* Maximum prefix */
8106 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX))
8107 {
hasso0a486e52005-02-01 20:57:17 +00008108 vty_out (vty, " Maximum prefixes allowed %ld%s%s", p->pmax[afi][safi],
paul718e3742002-12-13 20:15:29 +00008109 CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING)
hasso0a486e52005-02-01 20:57:17 +00008110 ? " (warning-only)" : "", VTY_NEWLINE);
8111 vty_out (vty, " Threshold for warning message %d%%",
8112 p->pmax_threshold[afi][safi]);
8113 if (p->pmax_restart[afi][safi])
8114 vty_out (vty, ", restart interval %d min", p->pmax_restart[afi][safi]);
8115 vty_out (vty, "%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008116 }
paul718e3742002-12-13 20:15:29 +00008117
8118 vty_out (vty, "%s", VTY_NEWLINE);
8119}
8120
paul94f2b392005-06-28 12:44:16 +00008121static void
paul718e3742002-12-13 20:15:29 +00008122bgp_show_peer (struct vty *vty, struct peer *p)
8123{
8124 struct bgp *bgp;
8125 char buf1[BUFSIZ];
8126 char timebuf[BGP_UPTIME_LEN];
hasso538621f2004-05-21 09:31:30 +00008127 afi_t afi;
8128 safi_t safi;
paul718e3742002-12-13 20:15:29 +00008129
8130 bgp = p->bgp;
8131
8132 /* Configured IP address. */
8133 vty_out (vty, "BGP neighbor is %s, ", p->host);
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04008134 vty_out (vty, "remote AS %u, ", p->as);
Andrew Certain9d3f9702012-11-07 23:50:07 +00008135 vty_out (vty, "local AS %u%s%s, ",
paul718e3742002-12-13 20:15:29 +00008136 p->change_local_as ? p->change_local_as : p->local_as,
8137 CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND) ?
Andrew Certain9d3f9702012-11-07 23:50:07 +00008138 " no-prepend" : "",
8139 CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_REPLACE_AS) ?
8140 " replace-as" : "");
paul718e3742002-12-13 20:15:29 +00008141 vty_out (vty, "%s link%s",
8142 p->as == p->local_as ? "internal" : "external",
8143 VTY_NEWLINE);
8144
8145 /* Description. */
8146 if (p->desc)
8147 vty_out (vty, " Description: %s%s", p->desc, VTY_NEWLINE);
8148
8149 /* Peer-group */
8150 if (p->group)
8151 vty_out (vty, " Member of peer-group %s for session parameters%s",
8152 p->group->name, VTY_NEWLINE);
8153
8154 /* Administrative shutdown. */
8155 if (CHECK_FLAG (p->flags, PEER_FLAG_SHUTDOWN))
8156 vty_out (vty, " Administratively shut down%s", VTY_NEWLINE);
8157
8158 /* BGP Version. */
8159 vty_out (vty, " BGP version 4");
paul718e3742002-12-13 20:15:29 +00008160 vty_out (vty, ", remote router ID %s%s",
8161 inet_ntop (AF_INET, &p->remote_id, buf1, BUFSIZ),
8162 VTY_NEWLINE);
8163
8164 /* Confederation */
hassoe0701b72004-05-20 09:19:34 +00008165 if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION)
8166 && bgp_confederation_peers_check (bgp, p->as))
paul718e3742002-12-13 20:15:29 +00008167 vty_out (vty, " Neighbor under common administration%s", VTY_NEWLINE);
8168
8169 /* Status. */
8170 vty_out (vty, " BGP state = %s",
8171 LOOKUP (bgp_status_msg, p->status));
8172 if (p->status == Established)
8173 vty_out (vty, ", up for %8s",
8174 peer_uptime (p->uptime, timebuf, BGP_UPTIME_LEN));
hasso93406d82005-02-02 14:40:33 +00008175 else if (p->status == Active)
8176 {
8177 if (CHECK_FLAG (p->flags, PEER_FLAG_PASSIVE))
8178 vty_out (vty, " (passive)");
8179 else if (CHECK_FLAG (p->sflags, PEER_STATUS_NSF_WAIT))
8180 vty_out (vty, " (NSF passive)");
8181 }
paul718e3742002-12-13 20:15:29 +00008182 vty_out (vty, "%s", VTY_NEWLINE);
8183
8184 /* read timer */
8185 vty_out (vty, " Last read %s", peer_uptime (p->readtime, timebuf, BGP_UPTIME_LEN));
8186
8187 /* Configured timer values. */
8188 vty_out (vty, ", hold time is %d, keepalive interval is %d seconds%s",
8189 p->v_holdtime, p->v_keepalive, VTY_NEWLINE);
8190 if (CHECK_FLAG (p->config, PEER_CONFIG_TIMER))
8191 {
8192 vty_out (vty, " Configured hold time is %d", p->holdtime);
8193 vty_out (vty, ", keepalive interval is %d seconds%s",
8194 p->keepalive, VTY_NEWLINE);
8195 }
hasso93406d82005-02-02 14:40:33 +00008196
paul718e3742002-12-13 20:15:29 +00008197 /* Capability. */
8198 if (p->status == Established)
8199 {
hasso538621f2004-05-21 09:31:30 +00008200 if (p->cap
paul718e3742002-12-13 20:15:29 +00008201 || p->afc_adv[AFI_IP][SAFI_UNICAST]
8202 || p->afc_recv[AFI_IP][SAFI_UNICAST]
8203 || p->afc_adv[AFI_IP][SAFI_MULTICAST]
8204 || p->afc_recv[AFI_IP][SAFI_MULTICAST]
paul718e3742002-12-13 20:15:29 +00008205 || p->afc_adv[AFI_IP6][SAFI_UNICAST]
8206 || p->afc_recv[AFI_IP6][SAFI_UNICAST]
8207 || p->afc_adv[AFI_IP6][SAFI_MULTICAST]
8208 || p->afc_recv[AFI_IP6][SAFI_MULTICAST]
Lou Berger9da04bc2016-01-12 13:41:55 -05008209 || p->afc_adv[AFI_IP6][SAFI_MPLS_VPN]
8210 || p->afc_recv[AFI_IP6][SAFI_MPLS_VPN]
Lou Bergera3fda882016-01-12 13:42:04 -05008211 || p->afc_adv[AFI_IP6][SAFI_ENCAP]
8212 || p->afc_recv[AFI_IP6][SAFI_ENCAP]
Lou Bergera3fda882016-01-12 13:42:04 -05008213 || p->afc_adv[AFI_IP][SAFI_ENCAP]
8214 || p->afc_recv[AFI_IP][SAFI_ENCAP]
paul718e3742002-12-13 20:15:29 +00008215 || p->afc_adv[AFI_IP][SAFI_MPLS_VPN]
8216 || p->afc_recv[AFI_IP][SAFI_MPLS_VPN])
8217 {
8218 vty_out (vty, " Neighbor capabilities:%s", VTY_NEWLINE);
8219
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00008220 /* AS4 */
8221 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV)
8222 || CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV))
8223 {
8224 vty_out (vty, " 4 Byte AS:");
8225 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV))
8226 vty_out (vty, " advertised");
8227 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV))
8228 vty_out (vty, " %sreceived",
8229 CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV) ? "and " : "");
8230 vty_out (vty, "%s", VTY_NEWLINE);
8231 }
paul718e3742002-12-13 20:15:29 +00008232 /* Dynamic */
8233 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)
8234 || CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV))
8235 {
8236 vty_out (vty, " Dynamic:");
8237 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV))
8238 vty_out (vty, " advertised");
8239 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV))
hasso538621f2004-05-21 09:31:30 +00008240 vty_out (vty, " %sreceived",
8241 CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV) ? "and " : "");
paul718e3742002-12-13 20:15:29 +00008242 vty_out (vty, "%s", VTY_NEWLINE);
8243 }
8244
8245 /* Route Refresh */
8246 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV)
8247 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)
8248 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
8249 {
8250 vty_out (vty, " Route refresh:");
8251 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV))
8252 vty_out (vty, " advertised");
8253 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)
8254 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
hasso538621f2004-05-21 09:31:30 +00008255 vty_out (vty, " %sreceived(%s)",
8256 CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) ? "and " : "",
8257 (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)
8258 && CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)) ?
8259 "old & new" : CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) ? "old" : "new");
8260
paul718e3742002-12-13 20:15:29 +00008261 vty_out (vty, "%s", VTY_NEWLINE);
8262 }
8263
hasso538621f2004-05-21 09:31:30 +00008264 /* Multiprotocol Extensions */
8265 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
8266 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
8267 if (p->afc_adv[afi][safi] || p->afc_recv[afi][safi])
paul718e3742002-12-13 20:15:29 +00008268 {
hasso538621f2004-05-21 09:31:30 +00008269 vty_out (vty, " Address family %s:", afi_safi_print (afi, safi));
8270 if (p->afc_adv[afi][safi])
8271 vty_out (vty, " advertised");
8272 if (p->afc_recv[afi][safi])
8273 vty_out (vty, " %sreceived", p->afc_adv[afi][safi] ? "and " : "");
8274 vty_out (vty, "%s", VTY_NEWLINE);
8275 }
8276
8277 /* Gracefull Restart */
8278 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)
8279 || CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
paul718e3742002-12-13 20:15:29 +00008280 {
hasso538621f2004-05-21 09:31:30 +00008281 vty_out (vty, " Graceful Restart Capabilty:");
8282 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
paul718e3742002-12-13 20:15:29 +00008283 vty_out (vty, " advertised");
hasso538621f2004-05-21 09:31:30 +00008284 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
8285 vty_out (vty, " %sreceived",
8286 CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV) ? "and " : "");
paul718e3742002-12-13 20:15:29 +00008287 vty_out (vty, "%s", VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00008288
8289 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
paul718e3742002-12-13 20:15:29 +00008290 {
hasso538621f2004-05-21 09:31:30 +00008291 int restart_af_count = 0;
8292
8293 vty_out (vty, " Remote Restart timer is %d seconds%s",
hasso93406d82005-02-02 14:40:33 +00008294 p->v_gr_restart, VTY_NEWLINE);
8295 vty_out (vty, " Address families by peer:%s ", VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00008296
8297 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
8298 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
8299 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_RCV))
8300 {
hasso93406d82005-02-02 14:40:33 +00008301 vty_out (vty, "%s%s(%s)", restart_af_count ? ", " : "",
8302 afi_safi_print (afi, safi),
8303 CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_PRESERVE_RCV) ?
8304 "preserved" : "not preserved");
hasso538621f2004-05-21 09:31:30 +00008305 restart_af_count++;
hasso93406d82005-02-02 14:40:33 +00008306 }
hasso538621f2004-05-21 09:31:30 +00008307 if (! restart_af_count)
8308 vty_out (vty, "none");
8309 vty_out (vty, "%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008310 }
paul718e3742002-12-13 20:15:29 +00008311 }
paul718e3742002-12-13 20:15:29 +00008312 }
8313 }
8314
hasso93406d82005-02-02 14:40:33 +00008315 /* graceful restart information */
8316 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)
8317 || p->t_gr_restart
8318 || p->t_gr_stale)
8319 {
8320 int eor_send_af_count = 0;
8321 int eor_receive_af_count = 0;
8322
8323 vty_out (vty, " Graceful restart informations:%s", VTY_NEWLINE);
8324 if (p->status == Established)
8325 {
8326 vty_out (vty, " End-of-RIB send: ");
8327 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
8328 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
8329 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_SEND))
8330 {
8331 vty_out (vty, "%s%s", eor_send_af_count ? ", " : "",
8332 afi_safi_print (afi, safi));
8333 eor_send_af_count++;
8334 }
8335 vty_out (vty, "%s", VTY_NEWLINE);
8336
8337 vty_out (vty, " End-of-RIB received: ");
8338 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
8339 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
8340 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_RECEIVED))
8341 {
8342 vty_out (vty, "%s%s", eor_receive_af_count ? ", " : "",
8343 afi_safi_print (afi, safi));
8344 eor_receive_af_count++;
8345 }
8346 vty_out (vty, "%s", VTY_NEWLINE);
8347 }
8348
8349 if (p->t_gr_restart)
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00008350 vty_out (vty, " The remaining time of restart timer is %ld%s",
8351 thread_timer_remain_second (p->t_gr_restart), VTY_NEWLINE);
8352
hasso93406d82005-02-02 14:40:33 +00008353 if (p->t_gr_stale)
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00008354 vty_out (vty, " The remaining time of stalepath timer is %ld%s",
8355 thread_timer_remain_second (p->t_gr_stale), VTY_NEWLINE);
hasso93406d82005-02-02 14:40:33 +00008356 }
8357
paul718e3742002-12-13 20:15:29 +00008358 /* Packet counts. */
hasso93406d82005-02-02 14:40:33 +00008359 vty_out (vty, " Message statistics:%s", VTY_NEWLINE);
8360 vty_out (vty, " Inq depth is 0%s", VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00008361 vty_out (vty, " Outq depth is %lu%s", (unsigned long) p->obuf->count, VTY_NEWLINE);
hasso93406d82005-02-02 14:40:33 +00008362 vty_out (vty, " Sent Rcvd%s", VTY_NEWLINE);
8363 vty_out (vty, " Opens: %10d %10d%s", p->open_out, p->open_in, VTY_NEWLINE);
8364 vty_out (vty, " Notifications: %10d %10d%s", p->notify_out, p->notify_in, VTY_NEWLINE);
8365 vty_out (vty, " Updates: %10d %10d%s", p->update_out, p->update_in, VTY_NEWLINE);
8366 vty_out (vty, " Keepalives: %10d %10d%s", p->keepalive_out, p->keepalive_in, VTY_NEWLINE);
8367 vty_out (vty, " Route Refresh: %10d %10d%s", p->refresh_out, p->refresh_in, VTY_NEWLINE);
8368 vty_out (vty, " Capability: %10d %10d%s", p->dynamic_cap_out, p->dynamic_cap_in, VTY_NEWLINE);
8369 vty_out (vty, " Total: %10d %10d%s", p->open_out + p->notify_out +
8370 p->update_out + p->keepalive_out + p->refresh_out + p->dynamic_cap_out,
8371 p->open_in + p->notify_in + p->update_in + p->keepalive_in + p->refresh_in +
8372 p->dynamic_cap_in, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008373
8374 /* advertisement-interval */
8375 vty_out (vty, " Minimum time between advertisement runs is %d seconds%s",
8376 p->v_routeadv, VTY_NEWLINE);
8377
8378 /* Update-source. */
8379 if (p->update_if || p->update_source)
8380 {
8381 vty_out (vty, " Update source is ");
8382 if (p->update_if)
8383 vty_out (vty, "%s", p->update_if);
8384 else if (p->update_source)
8385 vty_out (vty, "%s",
8386 sockunion2str (p->update_source, buf1, SU_ADDRSTRLEN));
8387 vty_out (vty, "%s", VTY_NEWLINE);
8388 }
8389
8390 /* Default weight */
8391 if (CHECK_FLAG (p->config, PEER_CONFIG_WEIGHT))
8392 vty_out (vty, " Default weight %d%s", p->weight,
8393 VTY_NEWLINE);
8394
8395 vty_out (vty, "%s", VTY_NEWLINE);
8396
8397 /* Address Family Information */
hasso538621f2004-05-21 09:31:30 +00008398 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
8399 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
8400 if (p->afc[afi][safi])
8401 bgp_show_peer_afi (vty, p, afi, safi);
paul718e3742002-12-13 20:15:29 +00008402
8403 vty_out (vty, " Connections established %d; dropped %d%s",
8404 p->established, p->dropped,
8405 VTY_NEWLINE);
8406
hassoe0701b72004-05-20 09:19:34 +00008407 if (! p->dropped)
8408 vty_out (vty, " Last reset never%s", VTY_NEWLINE);
8409 else
8410 vty_out (vty, " Last reset %s, due to %s%s",
8411 peer_uptime (p->resettime, timebuf, BGP_UPTIME_LEN),
8412 peer_down_str[(int) p->last_reset], VTY_NEWLINE);
paul848973c2003-08-13 00:32:49 +00008413
paul718e3742002-12-13 20:15:29 +00008414 if (CHECK_FLAG (p->sflags, PEER_STATUS_PREFIX_OVERFLOW))
8415 {
8416 vty_out (vty, " Peer had exceeded the max. no. of prefixes configured.%s", VTY_NEWLINE);
hasso0a486e52005-02-01 20:57:17 +00008417
8418 if (p->t_pmax_restart)
8419 vty_out (vty, " Reduce the no. of prefix from %s, will restart in %ld seconds%s",
8420 p->host, thread_timer_remain_second (p->t_pmax_restart),
8421 VTY_NEWLINE);
8422 else
8423 vty_out (vty, " Reduce the no. of prefix and clear ip bgp %s to restore peering%s",
8424 p->host, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008425 }
8426
Stephen Hemmingerf5a48272011-03-24 17:30:21 +00008427 /* EBGP Multihop and GTSM */
Jorge Boncompte [DTI2]6d85b152012-05-07 16:52:54 +00008428 if (p->sort != BGP_PEER_IBGP)
Stephen Hemmingerf5a48272011-03-24 17:30:21 +00008429 {
8430 if (p->gtsm_hops > 0)
8431 vty_out (vty, " External BGP neighbor may be up to %d hops away.%s",
8432 p->gtsm_hops, VTY_NEWLINE);
8433 else if (p->ttl > 1)
8434 vty_out (vty, " External BGP neighbor may be up to %d hops away.%s",
8435 p->ttl, VTY_NEWLINE);
8436 }
Pradosh Mohapatra5d804b42013-09-12 03:37:07 +00008437 else
8438 {
8439 if (p->gtsm_hops > 0)
8440 vty_out (vty, " Internal BGP neighbor may be up to %d hops away.%s",
8441 p->gtsm_hops, VTY_NEWLINE);
8442 }
paul718e3742002-12-13 20:15:29 +00008443
8444 /* Local address. */
8445 if (p->su_local)
8446 {
hasso93406d82005-02-02 14:40:33 +00008447 vty_out (vty, "Local host: %s, Local port: %d%s",
paul718e3742002-12-13 20:15:29 +00008448 sockunion2str (p->su_local, buf1, SU_ADDRSTRLEN),
8449 ntohs (p->su_local->sin.sin_port),
paul718e3742002-12-13 20:15:29 +00008450 VTY_NEWLINE);
8451 }
8452
8453 /* Remote address. */
8454 if (p->su_remote)
8455 {
8456 vty_out (vty, "Foreign host: %s, Foreign port: %d%s",
8457 sockunion2str (p->su_remote, buf1, SU_ADDRSTRLEN),
8458 ntohs (p->su_remote->sin.sin_port),
8459 VTY_NEWLINE);
8460 }
8461
8462 /* Nexthop display. */
8463 if (p->su_local)
8464 {
8465 vty_out (vty, "Nexthop: %s%s",
8466 inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ),
8467 VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008468 vty_out (vty, "Nexthop global: %s%s",
8469 inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ),
8470 VTY_NEWLINE);
8471 vty_out (vty, "Nexthop local: %s%s",
8472 inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ),
8473 VTY_NEWLINE);
8474 vty_out (vty, "BGP connection: %s%s",
8475 p->shared_network ? "shared network" : "non shared network",
8476 VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008477 }
8478
Timo Teräsef757702015-04-29 09:43:04 +03008479 /* TCP metrics. */
8480 if (p->status == Established && p->rtt)
8481 vty_out (vty, "Estimated round trip time: %d ms%s",
8482 p->rtt, VTY_NEWLINE);
8483
paul718e3742002-12-13 20:15:29 +00008484 /* Timer information. */
8485 if (p->t_start)
8486 vty_out (vty, "Next start timer due in %ld seconds%s",
8487 thread_timer_remain_second (p->t_start), VTY_NEWLINE);
8488 if (p->t_connect)
8489 vty_out (vty, "Next connect timer due in %ld seconds%s",
8490 thread_timer_remain_second (p->t_connect), VTY_NEWLINE);
8491
8492 vty_out (vty, "Read thread: %s Write thread: %s%s",
8493 p->t_read ? "on" : "off",
8494 p->t_write ? "on" : "off",
8495 VTY_NEWLINE);
8496
8497 if (p->notify.code == BGP_NOTIFY_OPEN_ERR
8498 && p->notify.subcode == BGP_NOTIFY_OPEN_UNSUP_CAPBL)
8499 bgp_capability_vty_out (vty, p);
8500
8501 vty_out (vty, "%s", VTY_NEWLINE);
8502}
8503
paul94f2b392005-06-28 12:44:16 +00008504static int
paul718e3742002-12-13 20:15:29 +00008505bgp_show_neighbor (struct vty *vty, struct bgp *bgp,
8506 enum show_type type, union sockunion *su)
8507{
paul1eb8ef22005-04-07 07:30:20 +00008508 struct listnode *node, *nnode;
paul718e3742002-12-13 20:15:29 +00008509 struct peer *peer;
8510 int find = 0;
8511
paul1eb8ef22005-04-07 07:30:20 +00008512 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00008513 {
8514 switch (type)
8515 {
8516 case show_all:
8517 bgp_show_peer (vty, peer);
8518 break;
8519 case show_peer:
8520 if (sockunion_same (&peer->su, su))
8521 {
8522 find = 1;
8523 bgp_show_peer (vty, peer);
8524 }
8525 break;
8526 }
8527 }
8528
8529 if (type == show_peer && ! find)
8530 vty_out (vty, "%% No such neighbor%s", VTY_NEWLINE);
8531
8532 return CMD_SUCCESS;
8533}
8534
paul94f2b392005-06-28 12:44:16 +00008535static int
paulfd79ac92004-10-13 05:06:08 +00008536bgp_show_neighbor_vty (struct vty *vty, const char *name,
8537 enum show_type type, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00008538{
8539 int ret;
8540 struct bgp *bgp;
8541 union sockunion su;
8542
8543 if (ip_str)
8544 {
8545 ret = str2sockunion (ip_str, &su);
8546 if (ret < 0)
8547 {
8548 vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE);
8549 return CMD_WARNING;
8550 }
8551 }
8552
8553 if (name)
8554 {
8555 bgp = bgp_lookup_by_name (name);
8556
8557 if (! bgp)
8558 {
8559 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
8560 return CMD_WARNING;
8561 }
8562
8563 bgp_show_neighbor (vty, bgp, type, &su);
8564
8565 return CMD_SUCCESS;
8566 }
8567
8568 bgp = bgp_get_default ();
8569
8570 if (bgp)
8571 bgp_show_neighbor (vty, bgp, type, &su);
8572
8573 return CMD_SUCCESS;
8574}
8575
Lou Bergerf9b6c392016-01-12 13:42:09 -05008576/* "show ip bgp neighbors" commands. */DEFUN (show_ip_bgp_neighbors,
8577 show_ip_bgp_neighbors_cmd,
8578 "show ip bgp neighbors",
8579 SHOW_STR
8580 IP_STR
8581 BGP_STR
8582 "Detailed information on TCP and BGP neighbor connections\n")
8583{
8584 return bgp_show_neighbor_vty (vty, NULL, show_all, NULL);
8585}
8586
8587ALIAS (show_ip_bgp_neighbors,
8588 show_ip_bgp_ipv4_neighbors_cmd,
8589 "show ip bgp ipv4 (unicast|multicast) neighbors",
8590 SHOW_STR
8591 IP_STR
8592 BGP_STR
8593 "Address family\n"
8594 "Address Family modifier\n"
8595 "Address Family modifier\n"
8596 "Detailed information on TCP and BGP neighbor connections\n")
8597
8598ALIAS (show_ip_bgp_neighbors,
8599 show_ip_bgp_vpnv4_all_neighbors_cmd,
8600 "show ip bgp vpnv4 all neighbors",
8601 SHOW_STR
8602 IP_STR
8603 BGP_STR
8604 "Display VPNv4 NLRI specific information\n"
8605 "Display information about all VPNv4 NLRIs\n"
8606 "Detailed information on TCP and BGP neighbor connections\n")
8607
8608ALIAS (show_ip_bgp_neighbors,
8609 show_ip_bgp_vpnv4_rd_neighbors_cmd,
8610 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors",
8611 SHOW_STR
8612 IP_STR
8613 BGP_STR
8614 "Display VPNv4 NLRI specific information\n"
8615 "Display information for a route distinguisher\n"
8616 "VPN Route Distinguisher\n"
8617 "Detailed information on TCP and BGP neighbor connections\n")
8618
8619ALIAS (show_ip_bgp_neighbors,
8620 show_bgp_ipv6_neighbors_cmd,
8621 "show bgp ipv6 neighbors",
8622 SHOW_STR
8623 BGP_STR
8624 "Address family\n"
8625 "Detailed information on TCP and BGP neighbor connections\n")
8626
8627DEFUN (show_ip_bgp_neighbors_peer,
8628 show_ip_bgp_neighbors_peer_cmd,
8629 "show ip bgp neighbors (A.B.C.D|X:X::X:X)",
8630 SHOW_STR
8631 IP_STR
8632 BGP_STR
8633 "Detailed information on TCP and BGP neighbor connections\n"
8634 "Neighbor to display information about\n"
8635 "Neighbor to display information about\n")
8636{
8637 return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 1]);
8638}
8639
8640ALIAS (show_ip_bgp_neighbors_peer,
8641 show_ip_bgp_ipv4_neighbors_peer_cmd,
8642 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X)",
8643 SHOW_STR
8644 IP_STR
8645 BGP_STR
8646 "Address family\n"
8647 "Address Family modifier\n"
8648 "Address Family modifier\n"
8649 "Detailed information on TCP and BGP neighbor connections\n"
8650 "Neighbor to display information about\n"
8651 "Neighbor to display information about\n")
8652
8653ALIAS (show_ip_bgp_neighbors_peer,
8654 show_ip_bgp_vpnv4_all_neighbors_peer_cmd,
8655 "show ip bgp vpnv4 all neighbors A.B.C.D",
8656 SHOW_STR
8657 IP_STR
8658 BGP_STR
8659 "Display VPNv4 NLRI specific information\n"
8660 "Display information about all VPNv4 NLRIs\n"
8661 "Detailed information on TCP and BGP neighbor connections\n"
8662 "Neighbor to display information about\n")
8663
8664ALIAS (show_ip_bgp_neighbors_peer,
8665 show_ip_bgp_vpnv4_rd_neighbors_peer_cmd,
8666 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D",
8667 SHOW_STR
8668 IP_STR
8669 BGP_STR
8670 "Display VPNv4 NLRI specific information\n"
8671 "Display information about all VPNv4 NLRIs\n"
8672 "Detailed information on TCP and BGP neighbor connections\n"
8673 "Neighbor to display information about\n")
8674
8675ALIAS (show_ip_bgp_neighbors_peer,
8676 show_bgp_ipv6_neighbors_peer_cmd,
8677 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X)",
8678 SHOW_STR
8679 BGP_STR
8680 "Address family\n"
8681 "Detailed information on TCP and BGP neighbor connections\n"
8682 "Neighbor to display information about\n"
8683 "Neighbor to display information about\n")
8684
8685DEFUN (show_ip_bgp_instance_neighbors,
8686 show_ip_bgp_instance_neighbors_cmd,
8687 "show ip bgp view WORD neighbors",
8688 SHOW_STR
8689 IP_STR
8690 BGP_STR
8691 "BGP view\n"
8692 "View name\n"
8693 "Detailed information on TCP and BGP neighbor connections\n")
8694{
8695 return bgp_show_neighbor_vty (vty, argv[0], show_all, NULL);
8696}
8697
8698ALIAS (show_ip_bgp_instance_neighbors,
8699 show_bgp_instance_ipv6_neighbors_cmd,
8700 "show bgp view WORD ipv6 neighbors",
8701 SHOW_STR
8702 BGP_STR
8703 "BGP view\n"
8704 "View name\n"
8705 "Address family\n"
8706 "Detailed information on TCP and BGP neighbor connections\n")
8707
8708DEFUN (show_ip_bgp_instance_neighbors_peer,
8709 show_ip_bgp_instance_neighbors_peer_cmd,
8710 "show ip bgp view WORD neighbors (A.B.C.D|X:X::X:X)",
8711 SHOW_STR
8712 IP_STR
8713 BGP_STR
8714 "BGP view\n"
8715 "View name\n"
8716 "Detailed information on TCP and BGP neighbor connections\n"
8717 "Neighbor to display information about\n"
8718 "Neighbor to display information about\n")
8719{
8720 return bgp_show_neighbor_vty (vty, argv[0], show_peer, argv[1]);
8721}
8722
8723/* Show BGP's AS paths internal data. There are both `show ip bgp
8724 paths' and `show ip mbgp paths'. Those functions results are the
8725 same.*/
8726DEFUN (show_ip_bgp_paths,
8727 show_ip_bgp_paths_cmd,
8728 "show ip bgp paths",
8729 SHOW_STR
8730 IP_STR
8731 BGP_STR
8732 "Path information\n")
8733{
8734 vty_out (vty, "Address Refcnt Path%s", VTY_NEWLINE);
8735 aspath_print_all_vty (vty);
8736 return CMD_SUCCESS;
8737}
8738
8739DEFUN (show_ip_bgp_ipv4_paths,
8740 show_ip_bgp_ipv4_paths_cmd,
8741 "show ip bgp ipv4 (unicast|multicast) paths",
8742 SHOW_STR
8743 IP_STR
8744 BGP_STR
8745 "Address family\n"
8746 "Address Family modifier\n"
8747 "Address Family modifier\n"
8748 "Path information\n")
8749{
8750 vty_out (vty, "Address Refcnt Path\r\n");
8751 aspath_print_all_vty (vty);
8752
8753 return CMD_SUCCESS;
8754}
8755
Lou Berger651b4022016-01-12 13:42:07 -05008756DEFUN (show_bgp_neighbors,
8757 show_bgp_neighbors_cmd,
8758 "show bgp neighbors",
paul718e3742002-12-13 20:15:29 +00008759 SHOW_STR
paul718e3742002-12-13 20:15:29 +00008760 BGP_STR
8761 "Detailed information on TCP and BGP neighbor connections\n")
8762{
8763 return bgp_show_neighbor_vty (vty, NULL, show_all, NULL);
8764}
8765
Lou Berger651b4022016-01-12 13:42:07 -05008766DEFUN (show_bgp_neighbors_peer,
8767 show_bgp_neighbors_peer_cmd,
Lou Berger651b4022016-01-12 13:42:07 -05008768 "show bgp neighbors (A.B.C.D|X:X::X:X)",
paul718e3742002-12-13 20:15:29 +00008769 SHOW_STR
paul718e3742002-12-13 20:15:29 +00008770 BGP_STR
8771 "Detailed information on TCP and BGP neighbor connections\n"
8772 "Neighbor to display information about\n"
8773 "Neighbor to display information about\n")
8774{
8775 return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 1]);
8776}
8777
Lou Berger651b4022016-01-12 13:42:07 -05008778DEFUN (show_bgp_instance_neighbors,
8779 show_bgp_instance_neighbors_cmd,
8780 "show bgp view WORD neighbors",
paul718e3742002-12-13 20:15:29 +00008781 SHOW_STR
paul718e3742002-12-13 20:15:29 +00008782 BGP_STR
8783 "BGP view\n"
8784 "View name\n"
8785 "Detailed information on TCP and BGP neighbor connections\n")
8786{
8787 return bgp_show_neighbor_vty (vty, argv[0], show_all, NULL);
8788}
8789
Lou Berger651b4022016-01-12 13:42:07 -05008790DEFUN (show_bgp_instance_neighbors_peer,
8791 show_bgp_instance_neighbors_peer_cmd,
Lou Berger651b4022016-01-12 13:42:07 -05008792 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X)",
paul718e3742002-12-13 20:15:29 +00008793 SHOW_STR
paul718e3742002-12-13 20:15:29 +00008794 BGP_STR
8795 "BGP view\n"
8796 "View name\n"
8797 "Detailed information on TCP and BGP neighbor connections\n"
8798 "Neighbor to display information about\n"
8799 "Neighbor to display information about\n")
8800{
8801 return bgp_show_neighbor_vty (vty, argv[0], show_peer, argv[1]);
8802}
paulbb46e942003-10-24 19:02:03 +00008803
Lou Berger651b4022016-01-12 13:42:07 -05008804ALIAS (show_bgp_instance_neighbors_peer,
paulbb46e942003-10-24 19:02:03 +00008805 show_bgp_instance_ipv6_neighbors_peer_cmd,
8806 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X)",
8807 SHOW_STR
8808 BGP_STR
8809 "BGP view\n"
8810 "View name\n"
8811 "Address family\n"
8812 "Detailed information on TCP and BGP neighbor connections\n"
8813 "Neighbor to display information about\n"
8814 "Neighbor to display information about\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02008815
paul718e3742002-12-13 20:15:29 +00008816/* Show BGP's AS paths internal data. There are both `show ip bgp
8817 paths' and `show ip mbgp paths'. Those functions results are the
8818 same.*/
Lou Berger651b4022016-01-12 13:42:07 -05008819DEFUN (show_bgp_ipv4_paths,
8820 show_bgp_ipv4_paths_cmd,
8821 "show bgp paths",
paul718e3742002-12-13 20:15:29 +00008822 SHOW_STR
paul718e3742002-12-13 20:15:29 +00008823 BGP_STR
8824 "Path information\n")
8825{
8826 vty_out (vty, "Address Refcnt Path%s", VTY_NEWLINE);
8827 aspath_print_all_vty (vty);
8828 return CMD_SUCCESS;
8829}
8830
paul718e3742002-12-13 20:15:29 +00008831#include "hash.h"
8832
paul94f2b392005-06-28 12:44:16 +00008833static void
paul718e3742002-12-13 20:15:29 +00008834community_show_all_iterator (struct hash_backet *backet, struct vty *vty)
8835{
8836 struct community *com;
8837
8838 com = (struct community *) backet->data;
David Lampartereed3c482015-03-03 08:51:53 +01008839 vty_out (vty, "[%p] (%ld) %s%s", (void *)backet, com->refcnt,
paul718e3742002-12-13 20:15:29 +00008840 community_str (com), VTY_NEWLINE);
8841}
8842
8843/* Show BGP's community internal data. */
8844DEFUN (show_ip_bgp_community_info,
8845 show_ip_bgp_community_info_cmd,
8846 "show ip bgp community-info",
8847 SHOW_STR
8848 IP_STR
8849 BGP_STR
8850 "List all bgp community information\n")
8851{
8852 vty_out (vty, "Address Refcnt Community%s", VTY_NEWLINE);
8853
8854 hash_iterate (community_hash (),
8855 (void (*) (struct hash_backet *, void *))
8856 community_show_all_iterator,
8857 vty);
8858
8859 return CMD_SUCCESS;
8860}
8861
8862DEFUN (show_ip_bgp_attr_info,
8863 show_ip_bgp_attr_info_cmd,
8864 "show ip bgp attribute-info",
8865 SHOW_STR
8866 IP_STR
8867 BGP_STR
8868 "List all bgp attribute information\n")
8869{
8870 attr_show_all (vty);
8871 return CMD_SUCCESS;
8872}
David Lamparter6b0655a2014-06-04 06:53:35 +02008873
paul94f2b392005-06-28 12:44:16 +00008874static int
paulfee0f4c2004-09-13 05:12:46 +00008875bgp_write_rsclient_summary (struct vty *vty, struct peer *rsclient,
8876 afi_t afi, safi_t safi)
8877{
8878 char timebuf[BGP_UPTIME_LEN];
8879 char rmbuf[14];
paulfd79ac92004-10-13 05:06:08 +00008880 const char *rmname;
paulfee0f4c2004-09-13 05:12:46 +00008881 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00008882 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00008883 int len;
8884 int count = 0;
8885
8886 if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_GROUP))
8887 {
paul1eb8ef22005-04-07 07:30:20 +00008888 for (ALL_LIST_ELEMENTS (rsclient->group->peer, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00008889 {
8890 count++;
8891 bgp_write_rsclient_summary (vty, peer, afi, safi);
8892 }
8893 return count;
8894 }
8895
8896 len = vty_out (vty, "%s", rsclient->host);
8897 len = 16 - len;
8898
8899 if (len < 1)
8900 vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " ");
8901 else
8902 vty_out (vty, "%*s", len, " ");
8903
hasso3d515fd2005-02-01 21:30:04 +00008904 vty_out (vty, "4 ");
paulfee0f4c2004-09-13 05:12:46 +00008905
Milan Kociancb4fc592014-12-01 12:48:25 +00008906 vty_out (vty, "%10u ", rsclient->as);
paulfee0f4c2004-09-13 05:12:46 +00008907
8908 rmname = ROUTE_MAP_EXPORT_NAME(&rsclient->filter[afi][safi]);
8909 if ( rmname && strlen (rmname) > 13 )
8910 {
8911 sprintf (rmbuf, "%13s", "...");
8912 rmname = strncpy (rmbuf, rmname, 10);
8913 }
8914 else if (! rmname)
8915 rmname = "<none>";
8916 vty_out (vty, " %13s ", rmname);
8917
8918 rmname = ROUTE_MAP_IMPORT_NAME(&rsclient->filter[afi][safi]);
8919 if ( rmname && strlen (rmname) > 13 )
8920 {
8921 sprintf (rmbuf, "%13s", "...");
8922 rmname = strncpy (rmbuf, rmname, 10);
8923 }
8924 else if (! rmname)
8925 rmname = "<none>";
8926 vty_out (vty, " %13s ", rmname);
8927
8928 vty_out (vty, "%8s", peer_uptime (rsclient->uptime, timebuf, BGP_UPTIME_LEN));
8929
8930 if (CHECK_FLAG (rsclient->flags, PEER_FLAG_SHUTDOWN))
8931 vty_out (vty, " Idle (Admin)");
8932 else if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_PREFIX_OVERFLOW))
8933 vty_out (vty, " Idle (PfxCt)");
8934 else
8935 vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, rsclient->status));
8936
8937 vty_out (vty, "%s", VTY_NEWLINE);
8938
8939 return 1;
8940}
8941
paul94f2b392005-06-28 12:44:16 +00008942static int
paulfd79ac92004-10-13 05:06:08 +00008943bgp_show_rsclient_summary (struct vty *vty, struct bgp *bgp,
8944 afi_t afi, safi_t safi)
paulfee0f4c2004-09-13 05:12:46 +00008945{
8946 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00008947 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00008948 int count = 0;
8949
8950 /* Header string for each address family. */
Milan Kociancb4fc592014-12-01 12:48:25 +00008951 static char header[] = "Neighbor V AS Export-Policy Import-Policy Up/Down State";
paulfee0f4c2004-09-13 05:12:46 +00008952
paul1eb8ef22005-04-07 07:30:20 +00008953 for (ALL_LIST_ELEMENTS (bgp->rsclient, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00008954 {
8955 if (peer->afc[afi][safi] &&
8956 CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT))
8957 {
8958 if (! count)
8959 {
8960 vty_out (vty,
8961 "Route Server's BGP router identifier %s%s",
8962 inet_ntoa (bgp->router_id), VTY_NEWLINE);
8963 vty_out (vty,
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04008964 "Route Server's local AS number %u%s", bgp->as,
paulfee0f4c2004-09-13 05:12:46 +00008965 VTY_NEWLINE);
8966
8967 vty_out (vty, "%s", VTY_NEWLINE);
8968 vty_out (vty, "%s%s", header, VTY_NEWLINE);
8969 }
8970
8971 count += bgp_write_rsclient_summary (vty, peer, afi, safi);
8972 }
8973 }
8974
8975 if (count)
8976 vty_out (vty, "%sTotal number of Route Server Clients %d%s", VTY_NEWLINE,
8977 count, VTY_NEWLINE);
8978 else
8979 vty_out (vty, "No %s Route Server Client is configured%s",
8980 afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE);
8981
8982 return CMD_SUCCESS;
8983}
8984
paul94f2b392005-06-28 12:44:16 +00008985static int
paulfd79ac92004-10-13 05:06:08 +00008986bgp_show_rsclient_summary_vty (struct vty *vty, const char *name,
8987 afi_t afi, safi_t safi)
paulfee0f4c2004-09-13 05:12:46 +00008988{
8989 struct bgp *bgp;
8990
8991 if (name)
8992 {
8993 bgp = bgp_lookup_by_name (name);
8994
8995 if (! bgp)
8996 {
8997 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
8998 return CMD_WARNING;
8999 }
9000
9001 bgp_show_rsclient_summary (vty, bgp, afi, safi);
9002 return CMD_SUCCESS;
9003 }
9004
9005 bgp = bgp_get_default ();
9006
9007 if (bgp)
9008 bgp_show_rsclient_summary (vty, bgp, afi, safi);
9009
9010 return CMD_SUCCESS;
9011}
9012
9013/* 'show bgp rsclient' commands. */
Lou Bergerf9b6c392016-01-12 13:42:09 -05009014DEFUN (show_ip_bgp_rsclient_summary,
9015 show_ip_bgp_rsclient_summary_cmd,
9016 "show ip bgp rsclient summary",
9017 SHOW_STR
9018 IP_STR
9019 BGP_STR
9020 "Information about Route Server Clients\n"
9021 "Summary of all Route Server Clients\n")
9022{
9023 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
9024}
9025
9026DEFUN (show_ip_bgp_instance_rsclient_summary,
9027 show_ip_bgp_instance_rsclient_summary_cmd,
9028 "show ip bgp view WORD rsclient summary",
9029 SHOW_STR
9030 IP_STR
9031 BGP_STR
9032 "BGP view\n"
9033 "View name\n"
9034 "Information about Route Server Clients\n"
9035 "Summary of all Route Server Clients\n")
9036{
9037 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
9038}
9039
9040DEFUN (show_ip_bgp_ipv4_rsclient_summary,
9041 show_ip_bgp_ipv4_rsclient_summary_cmd,
9042 "show ip bgp ipv4 (unicast|multicast) rsclient summary",
9043 SHOW_STR
9044 IP_STR
9045 BGP_STR
9046 "Address family\n"
9047 "Address Family modifier\n"
9048 "Address Family modifier\n"
9049 "Information about Route Server Clients\n"
9050 "Summary of all Route Server Clients\n")
9051{
9052 if (strncmp (argv[0], "m", 1) == 0)
9053 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
9054
9055 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
9056}
9057
9058DEFUN (show_ip_bgp_instance_ipv4_rsclient_summary,
9059 show_ip_bgp_instance_ipv4_rsclient_summary_cmd,
9060 "show ip bgp view WORD ipv4 (unicast|multicast) rsclient summary",
9061 SHOW_STR
9062 IP_STR
9063 BGP_STR
9064 "BGP view\n"
9065 "View name\n"
9066 "Address family\n"
9067 "Address Family modifier\n"
9068 "Address Family modifier\n"
9069 "Information about Route Server Clients\n"
9070 "Summary of all Route Server Clients\n")
9071{
9072 if (strncmp (argv[1], "m", 1) == 0)
9073 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
9074
9075 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
9076}
paulfee0f4c2004-09-13 05:12:46 +00009077
Michael Lambert95cbbd22010-07-23 14:43:04 -04009078DEFUN (show_bgp_instance_ipv4_safi_rsclient_summary,
9079 show_bgp_instance_ipv4_safi_rsclient_summary_cmd,
9080 "show bgp view WORD ipv4 (unicast|multicast) rsclient summary",
9081 SHOW_STR
9082 BGP_STR
9083 "BGP view\n"
9084 "View name\n"
9085 "Address family\n"
9086 "Address Family modifier\n"
9087 "Address Family modifier\n"
9088 "Information about Route Server Clients\n"
9089 "Summary of all Route Server Clients\n")
9090{
9091 safi_t safi;
9092
9093 if (argc == 2) {
9094 safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
9095 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, safi);
9096 } else {
9097 safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
9098 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, safi);
9099 }
9100}
9101
9102ALIAS (show_bgp_instance_ipv4_safi_rsclient_summary,
9103 show_bgp_ipv4_safi_rsclient_summary_cmd,
9104 "show bgp ipv4 (unicast|multicast) rsclient summary",
9105 SHOW_STR
9106 BGP_STR
9107 "Address family\n"
9108 "Address Family modifier\n"
9109 "Address Family modifier\n"
9110 "Information about Route Server Clients\n"
9111 "Summary of all Route Server Clients\n")
9112
paulfee0f4c2004-09-13 05:12:46 +00009113DEFUN (show_bgp_rsclient_summary,
9114 show_bgp_rsclient_summary_cmd,
9115 "show bgp rsclient summary",
9116 SHOW_STR
9117 BGP_STR
9118 "Information about Route Server Clients\n"
9119 "Summary of all Route Server Clients\n")
9120{
Lou Berger651b4022016-01-12 13:42:07 -05009121 vty_out(vty, "%sIPv4 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9122 vty_out(vty, "---------------------%s", VTY_NEWLINE);
9123 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
9124 vty_out(vty, "%sIPv4 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9125 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
9126 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
9127 vty_out(vty, "%sIPv4 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9128 vty_out(vty, "-----------------%s", VTY_NEWLINE);
9129 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
9130 vty_out(vty, "%sIPv4 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9131 vty_out(vty, "-------------------%s", VTY_NEWLINE);
9132 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_ENCAP);
9133
Lou Berger651b4022016-01-12 13:42:07 -05009134 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9135 vty_out(vty, "---------------------%s", VTY_NEWLINE);
9136 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
9137 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9138 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
9139 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
9140 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9141 vty_out(vty, "-----------------%s", VTY_NEWLINE);
9142 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_MPLS_VPN);
9143 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9144 vty_out(vty, "-------------------%s", VTY_NEWLINE);
9145 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_ENCAP);
Lou Berger205e6742016-01-12 13:42:11 -05009146
Lou Berger651b4022016-01-12 13:42:07 -05009147 return CMD_SUCCESS;
paulfee0f4c2004-09-13 05:12:46 +00009148}
9149
9150DEFUN (show_bgp_instance_rsclient_summary,
9151 show_bgp_instance_rsclient_summary_cmd,
9152 "show bgp view WORD rsclient summary",
9153 SHOW_STR
9154 BGP_STR
9155 "BGP view\n"
9156 "View name\n"
9157 "Information about Route Server Clients\n"
9158 "Summary of all Route Server Clients\n")
9159{
Lou Berger651b4022016-01-12 13:42:07 -05009160 vty_out(vty, "%sIPv4 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9161 vty_out(vty, "---------------------%s", VTY_NEWLINE);
9162 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
9163 vty_out(vty, "%sIPv4 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9164 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
9165 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
9166 vty_out(vty, "%sIPv4 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9167 vty_out(vty, "-----------------%s", VTY_NEWLINE);
9168 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_MPLS_VPN);
9169 vty_out(vty, "%sIPv4 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9170 vty_out(vty, "-------------------%s", VTY_NEWLINE);
9171 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_ENCAP);
9172
Lou Berger651b4022016-01-12 13:42:07 -05009173 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9174 vty_out(vty, "---------------------%s", VTY_NEWLINE);
9175 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
9176 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9177 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
9178 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST);
9179 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9180 vty_out(vty, "-----------------%s", VTY_NEWLINE);
9181 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_MPLS_VPN);
9182 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9183 vty_out(vty, "-------------------%s", VTY_NEWLINE);
9184 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_ENCAP);
Lou Berger205e6742016-01-12 13:42:11 -05009185
Lou Berger651b4022016-01-12 13:42:07 -05009186 return CMD_SUCCESS;
paulfee0f4c2004-09-13 05:12:46 +00009187}
9188
Lou Berger651b4022016-01-12 13:42:07 -05009189DEFUN (show_bgp_ipv6_rsclient_summary,
paulfee0f4c2004-09-13 05:12:46 +00009190 show_bgp_ipv6_rsclient_summary_cmd,
9191 "show bgp ipv6 rsclient summary",
9192 SHOW_STR
9193 BGP_STR
9194 "Address family\n"
9195 "Information about Route Server Clients\n"
9196 "Summary of all Route Server Clients\n")
Lou Berger651b4022016-01-12 13:42:07 -05009197{
9198 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9199 vty_out(vty, "---------------------%s", VTY_NEWLINE);
9200 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
9201 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9202 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
9203 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
9204 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9205 vty_out(vty, "-----------------%s", VTY_NEWLINE);
9206 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_MPLS_VPN);
9207 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9208 vty_out(vty, "-------------------%s", VTY_NEWLINE);
9209 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_ENCAP);
paulfee0f4c2004-09-13 05:12:46 +00009210
Lou Berger651b4022016-01-12 13:42:07 -05009211 return CMD_SUCCESS;
9212}
9213
9214DEFUN (show_bgp_instance_ipv6_rsclient_summary,
paulfee0f4c2004-09-13 05:12:46 +00009215 show_bgp_instance_ipv6_rsclient_summary_cmd,
9216 "show bgp view WORD ipv6 rsclient summary",
9217 SHOW_STR
9218 BGP_STR
9219 "BGP view\n"
9220 "View name\n"
9221 "Address family\n"
9222 "Information about Route Server Clients\n"
9223 "Summary of all Route Server Clients\n")
Lou Berger651b4022016-01-12 13:42:07 -05009224{
9225 vty_out(vty, "%sIPv6 Unicast 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_UNICAST);
9228 vty_out(vty, "%sIPv6 Multicast 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_MULTICAST);
9231 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9232 vty_out(vty, "-----------------%s", VTY_NEWLINE);
9233 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_MPLS_VPN);
9234 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9235 vty_out(vty, "-------------------%s", VTY_NEWLINE);
9236 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_ENCAP);
9237
9238 return CMD_SUCCESS;
9239}
Michael Lambert95cbbd22010-07-23 14:43:04 -04009240
9241DEFUN (show_bgp_instance_ipv6_safi_rsclient_summary,
9242 show_bgp_instance_ipv6_safi_rsclient_summary_cmd,
9243 "show bgp view WORD ipv6 (unicast|multicast) rsclient summary",
9244 SHOW_STR
9245 BGP_STR
9246 "BGP view\n"
9247 "View name\n"
9248 "Address family\n"
9249 "Address Family modifier\n"
9250 "Address Family modifier\n"
9251 "Information about Route Server Clients\n"
9252 "Summary of all Route Server Clients\n")
9253{
9254 safi_t safi;
9255
9256 if (argc == 2) {
9257 safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
9258 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, safi);
9259 } else {
9260 safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
9261 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, safi);
9262 }
9263}
9264
9265ALIAS (show_bgp_instance_ipv6_safi_rsclient_summary,
9266 show_bgp_ipv6_safi_rsclient_summary_cmd,
9267 "show bgp ipv6 (unicast|multicast) rsclient summary",
9268 SHOW_STR
9269 BGP_STR
Lou Berger651b4022016-01-12 13:42:07 -05009270 IPV6_STR
Michael Lambert95cbbd22010-07-23 14:43:04 -04009271 "Address Family modifier\n"
9272 "Address Family modifier\n"
9273 "Information about Route Server Clients\n"
9274 "Summary of all Route Server Clients\n")
9275
paul718e3742002-12-13 20:15:29 +00009276/* Redistribute VTY commands. */
9277
paul718e3742002-12-13 20:15:29 +00009278DEFUN (bgp_redistribute_ipv4,
9279 bgp_redistribute_ipv4_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009280 "redistribute " QUAGGA_IP_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00009281 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009282 QUAGGA_IP_REDIST_HELP_STR_BGPD)
paul718e3742002-12-13 20:15:29 +00009283{
9284 int type;
9285
David Lampartere0ca5fd2009-09-16 01:52:42 +02009286 type = proto_redistnum (AFI_IP, argv[0]);
9287 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009288 {
9289 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9290 return CMD_WARNING;
9291 }
9292 return bgp_redistribute_set (vty->index, AFI_IP, type);
9293}
9294
9295DEFUN (bgp_redistribute_ipv4_rmap,
9296 bgp_redistribute_ipv4_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009297 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00009298 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009299 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009300 "Route map reference\n"
9301 "Pointer to route-map entries\n")
9302{
9303 int type;
9304
David Lampartere0ca5fd2009-09-16 01:52:42 +02009305 type = proto_redistnum (AFI_IP, argv[0]);
9306 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009307 {
9308 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9309 return CMD_WARNING;
9310 }
9311
9312 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]);
9313 return bgp_redistribute_set (vty->index, AFI_IP, type);
9314}
9315
9316DEFUN (bgp_redistribute_ipv4_metric,
9317 bgp_redistribute_ipv4_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009318 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009319 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009320 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009321 "Metric for redistributed routes\n"
9322 "Default metric\n")
9323{
9324 int type;
9325 u_int32_t metric;
9326
David Lampartere0ca5fd2009-09-16 01:52:42 +02009327 type = proto_redistnum (AFI_IP, argv[0]);
9328 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009329 {
9330 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9331 return CMD_WARNING;
9332 }
9333 VTY_GET_INTEGER ("metric", metric, argv[1]);
9334
9335 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
9336 return bgp_redistribute_set (vty->index, AFI_IP, type);
9337}
9338
9339DEFUN (bgp_redistribute_ipv4_rmap_metric,
9340 bgp_redistribute_ipv4_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009341 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009342 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009343 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009344 "Route map reference\n"
9345 "Pointer to route-map entries\n"
9346 "Metric for redistributed routes\n"
9347 "Default metric\n")
9348{
9349 int type;
9350 u_int32_t metric;
9351
David Lampartere0ca5fd2009-09-16 01:52:42 +02009352 type = proto_redistnum (AFI_IP, argv[0]);
9353 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009354 {
9355 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9356 return CMD_WARNING;
9357 }
9358 VTY_GET_INTEGER ("metric", metric, argv[2]);
9359
9360 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]);
9361 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
9362 return bgp_redistribute_set (vty->index, AFI_IP, type);
9363}
9364
9365DEFUN (bgp_redistribute_ipv4_metric_rmap,
9366 bgp_redistribute_ipv4_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009367 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00009368 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009369 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009370 "Metric for redistributed routes\n"
9371 "Default metric\n"
9372 "Route map reference\n"
9373 "Pointer to route-map entries\n")
9374{
9375 int type;
9376 u_int32_t metric;
9377
David Lampartere0ca5fd2009-09-16 01:52:42 +02009378 type = proto_redistnum (AFI_IP, argv[0]);
9379 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009380 {
9381 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9382 return CMD_WARNING;
9383 }
9384 VTY_GET_INTEGER ("metric", metric, argv[1]);
9385
9386 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
9387 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[2]);
9388 return bgp_redistribute_set (vty->index, AFI_IP, type);
9389}
9390
9391DEFUN (no_bgp_redistribute_ipv4,
9392 no_bgp_redistribute_ipv4_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009393 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00009394 NO_STR
9395 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009396 QUAGGA_IP_REDIST_HELP_STR_BGPD)
paul718e3742002-12-13 20:15:29 +00009397{
9398 int type;
9399
David Lampartere0ca5fd2009-09-16 01:52:42 +02009400 type = proto_redistnum (AFI_IP, argv[0]);
9401 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009402 {
9403 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9404 return CMD_WARNING;
9405 }
9406
9407 return bgp_redistribute_unset (vty->index, AFI_IP, type);
9408}
9409
9410DEFUN (no_bgp_redistribute_ipv4_rmap,
9411 no_bgp_redistribute_ipv4_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009412 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00009413 NO_STR
9414 "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 "Route map reference\n"
9417 "Pointer to route-map entries\n")
9418{
9419 int type;
9420
David Lampartere0ca5fd2009-09-16 01:52:42 +02009421 type = proto_redistnum (AFI_IP, argv[0]);
9422 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009423 {
9424 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9425 return CMD_WARNING;
9426 }
9427
9428 bgp_redistribute_routemap_unset (vty->index, AFI_IP, type);
9429 return CMD_SUCCESS;
9430}
9431
9432DEFUN (no_bgp_redistribute_ipv4_metric,
9433 no_bgp_redistribute_ipv4_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009434 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009435 NO_STR
9436 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009437 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009438 "Metric for redistributed routes\n"
9439 "Default metric\n")
9440{
9441 int type;
9442
David Lampartere0ca5fd2009-09-16 01:52:42 +02009443 type = proto_redistnum (AFI_IP, argv[0]);
9444 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009445 {
9446 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9447 return CMD_WARNING;
9448 }
9449
9450 bgp_redistribute_metric_unset (vty->index, AFI_IP, type);
9451 return CMD_SUCCESS;
9452}
9453
9454DEFUN (no_bgp_redistribute_ipv4_rmap_metric,
9455 no_bgp_redistribute_ipv4_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009456 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009457 NO_STR
9458 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009459 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009460 "Route map reference\n"
9461 "Pointer to route-map entries\n"
9462 "Metric for redistributed routes\n"
9463 "Default metric\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_metric_unset (vty->index, AFI_IP, type);
9475 bgp_redistribute_routemap_unset (vty->index, AFI_IP, type);
9476 return CMD_SUCCESS;
9477}
9478
9479ALIAS (no_bgp_redistribute_ipv4_rmap_metric,
9480 no_bgp_redistribute_ipv4_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009481 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00009482 NO_STR
9483 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009484 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009485 "Metric for redistributed routes\n"
9486 "Default metric\n"
9487 "Route map reference\n"
9488 "Pointer to route-map entries\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02009489
paul718e3742002-12-13 20:15:29 +00009490DEFUN (bgp_redistribute_ipv6,
9491 bgp_redistribute_ipv6_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009492 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00009493 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009494 QUAGGA_IP6_REDIST_HELP_STR_BGPD)
paul718e3742002-12-13 20:15:29 +00009495{
9496 int type;
9497
David Lampartere0ca5fd2009-09-16 01:52:42 +02009498 type = proto_redistnum (AFI_IP6, argv[0]);
9499 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009500 {
9501 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9502 return CMD_WARNING;
9503 }
9504
9505 return bgp_redistribute_set (vty->index, AFI_IP6, type);
9506}
9507
9508DEFUN (bgp_redistribute_ipv6_rmap,
9509 bgp_redistribute_ipv6_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009510 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00009511 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009512 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009513 "Route map reference\n"
9514 "Pointer to route-map entries\n")
9515{
9516 int type;
9517
David Lampartere0ca5fd2009-09-16 01:52:42 +02009518 type = proto_redistnum (AFI_IP6, argv[0]);
9519 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009520 {
9521 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9522 return CMD_WARNING;
9523 }
9524
9525 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]);
9526 return bgp_redistribute_set (vty->index, AFI_IP6, type);
9527}
9528
9529DEFUN (bgp_redistribute_ipv6_metric,
9530 bgp_redistribute_ipv6_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009531 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009532 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009533 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009534 "Metric for redistributed routes\n"
9535 "Default metric\n")
9536{
9537 int type;
9538 u_int32_t metric;
9539
David Lampartere0ca5fd2009-09-16 01:52:42 +02009540 type = proto_redistnum (AFI_IP6, argv[0]);
9541 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009542 {
9543 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9544 return CMD_WARNING;
9545 }
9546 VTY_GET_INTEGER ("metric", metric, argv[1]);
9547
9548 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
9549 return bgp_redistribute_set (vty->index, AFI_IP6, type);
9550}
9551
9552DEFUN (bgp_redistribute_ipv6_rmap_metric,
9553 bgp_redistribute_ipv6_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009554 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009555 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009556 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009557 "Route map reference\n"
9558 "Pointer to route-map entries\n"
9559 "Metric for redistributed routes\n"
9560 "Default metric\n")
9561{
9562 int type;
9563 u_int32_t metric;
9564
David Lampartere0ca5fd2009-09-16 01:52:42 +02009565 type = proto_redistnum (AFI_IP6, argv[0]);
9566 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009567 {
9568 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9569 return CMD_WARNING;
9570 }
9571 VTY_GET_INTEGER ("metric", metric, argv[2]);
9572
9573 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]);
9574 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
9575 return bgp_redistribute_set (vty->index, AFI_IP6, type);
9576}
9577
9578DEFUN (bgp_redistribute_ipv6_metric_rmap,
9579 bgp_redistribute_ipv6_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009580 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00009581 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009582 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009583 "Metric for redistributed routes\n"
9584 "Default metric\n"
9585 "Route map reference\n"
9586 "Pointer to route-map entries\n")
9587{
9588 int type;
9589 u_int32_t metric;
9590
David Lampartere0ca5fd2009-09-16 01:52:42 +02009591 type = proto_redistnum (AFI_IP6, argv[0]);
9592 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009593 {
9594 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9595 return CMD_WARNING;
9596 }
9597 VTY_GET_INTEGER ("metric", metric, argv[1]);
9598
9599 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
9600 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[2]);
9601 return bgp_redistribute_set (vty->index, AFI_IP6, type);
9602}
9603
9604DEFUN (no_bgp_redistribute_ipv6,
9605 no_bgp_redistribute_ipv6_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009606 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00009607 NO_STR
9608 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009609 QUAGGA_IP6_REDIST_HELP_STR_BGPD)
paul718e3742002-12-13 20:15:29 +00009610{
9611 int type;
9612
David Lampartere0ca5fd2009-09-16 01:52:42 +02009613 type = proto_redistnum (AFI_IP6, argv[0]);
9614 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009615 {
9616 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9617 return CMD_WARNING;
9618 }
9619
9620 return bgp_redistribute_unset (vty->index, AFI_IP6, type);
9621}
9622
9623DEFUN (no_bgp_redistribute_ipv6_rmap,
9624 no_bgp_redistribute_ipv6_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009625 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00009626 NO_STR
9627 "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 "Route map reference\n"
9630 "Pointer to route-map entries\n")
9631{
9632 int type;
9633
David Lampartere0ca5fd2009-09-16 01:52:42 +02009634 type = proto_redistnum (AFI_IP6, argv[0]);
9635 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009636 {
9637 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9638 return CMD_WARNING;
9639 }
9640
9641 bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type);
9642 return CMD_SUCCESS;
9643}
9644
9645DEFUN (no_bgp_redistribute_ipv6_metric,
9646 no_bgp_redistribute_ipv6_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009647 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009648 NO_STR
9649 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009650 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009651 "Metric for redistributed routes\n"
9652 "Default metric\n")
9653{
9654 int type;
9655
David Lampartere0ca5fd2009-09-16 01:52:42 +02009656 type = proto_redistnum (AFI_IP6, argv[0]);
9657 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009658 {
9659 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9660 return CMD_WARNING;
9661 }
9662
9663 bgp_redistribute_metric_unset (vty->index, AFI_IP6, type);
9664 return CMD_SUCCESS;
9665}
9666
9667DEFUN (no_bgp_redistribute_ipv6_rmap_metric,
9668 no_bgp_redistribute_ipv6_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009669 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009670 NO_STR
9671 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009672 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009673 "Route map reference\n"
9674 "Pointer to route-map entries\n"
9675 "Metric for redistributed routes\n"
9676 "Default metric\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_metric_unset (vty->index, AFI_IP6, type);
9688 bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type);
9689 return CMD_SUCCESS;
9690}
9691
9692ALIAS (no_bgp_redistribute_ipv6_rmap_metric,
9693 no_bgp_redistribute_ipv6_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009694 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00009695 NO_STR
9696 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009697 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009698 "Metric for redistributed routes\n"
9699 "Default metric\n"
9700 "Route map reference\n"
9701 "Pointer to route-map entries\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02009702
paul718e3742002-12-13 20:15:29 +00009703int
9704bgp_config_write_redistribute (struct vty *vty, struct bgp *bgp, afi_t afi,
9705 safi_t safi, int *write)
9706{
9707 int i;
paul718e3742002-12-13 20:15:29 +00009708
9709 /* Unicast redistribution only. */
9710 if (safi != SAFI_UNICAST)
9711 return 0;
9712
9713 for (i = 0; i < ZEBRA_ROUTE_MAX; i++)
9714 {
9715 /* Redistribute BGP does not make sense. */
9716 if (bgp->redist[afi][i] && i != ZEBRA_ROUTE_BGP)
9717 {
9718 /* Display "address-family" when it is not yet diplayed. */
9719 bgp_config_write_family_header (vty, afi, safi, write);
9720
9721 /* "redistribute" configuration. */
ajsf52d13c2005-10-01 17:38:06 +00009722 vty_out (vty, " redistribute %s", zebra_route_string(i));
paul718e3742002-12-13 20:15:29 +00009723
9724 if (bgp->redist_metric_flag[afi][i])
Jorge Boncompte [DTI2]ddc943d2012-04-13 13:46:07 +02009725 vty_out (vty, " metric %u", bgp->redist_metric[afi][i]);
paul718e3742002-12-13 20:15:29 +00009726
9727 if (bgp->rmap[afi][i].name)
9728 vty_out (vty, " route-map %s", bgp->rmap[afi][i].name);
9729
9730 vty_out (vty, "%s", VTY_NEWLINE);
9731 }
9732 }
9733 return *write;
9734}
David Lamparter6b0655a2014-06-04 06:53:35 +02009735
paul718e3742002-12-13 20:15:29 +00009736/* BGP node structure. */
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009737static struct cmd_node bgp_node =
paul718e3742002-12-13 20:15:29 +00009738{
9739 BGP_NODE,
9740 "%s(config-router)# ",
9741 1,
9742};
9743
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009744static struct cmd_node bgp_ipv4_unicast_node =
paul718e3742002-12-13 20:15:29 +00009745{
9746 BGP_IPV4_NODE,
9747 "%s(config-router-af)# ",
9748 1,
9749};
9750
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009751static struct cmd_node bgp_ipv4_multicast_node =
paul718e3742002-12-13 20:15:29 +00009752{
9753 BGP_IPV4M_NODE,
9754 "%s(config-router-af)# ",
9755 1,
9756};
9757
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009758static struct cmd_node bgp_ipv6_unicast_node =
paul718e3742002-12-13 20:15:29 +00009759{
9760 BGP_IPV6_NODE,
9761 "%s(config-router-af)# ",
9762 1,
9763};
9764
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009765static struct cmd_node bgp_ipv6_multicast_node =
paul25ffbdc2005-08-22 22:42:08 +00009766{
9767 BGP_IPV6M_NODE,
9768 "%s(config-router-af)# ",
9769 1,
9770};
9771
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009772static struct cmd_node bgp_vpnv4_node =
paul718e3742002-12-13 20:15:29 +00009773{
9774 BGP_VPNV4_NODE,
9775 "%s(config-router-af)# ",
9776 1
9777};
David Lamparter6b0655a2014-06-04 06:53:35 +02009778
Lou Berger13c378d2016-01-12 13:41:56 -05009779static struct cmd_node bgp_vpnv6_node =
9780{
9781 BGP_VPNV6_NODE,
9782 "%s(config-router-af-vpnv6)# ",
9783 1
9784};
9785
Lou Bergera3fda882016-01-12 13:42:04 -05009786static struct cmd_node bgp_encap_node =
9787{
9788 BGP_ENCAP_NODE,
9789 "%s(config-router-af-encap)# ",
9790 1
9791};
9792
9793static struct cmd_node bgp_encapv6_node =
9794{
9795 BGP_ENCAPV6_NODE,
9796 "%s(config-router-af-encapv6)# ",
9797 1
9798};
9799
paul1f8ae702005-09-09 23:49:49 +00009800static void community_list_vty (void);
9801
paul718e3742002-12-13 20:15:29 +00009802void
paul94f2b392005-06-28 12:44:16 +00009803bgp_vty_init (void)
paul718e3742002-12-13 20:15:29 +00009804{
paul718e3742002-12-13 20:15:29 +00009805 /* Install bgp top node. */
9806 install_node (&bgp_node, bgp_config_write);
9807 install_node (&bgp_ipv4_unicast_node, NULL);
9808 install_node (&bgp_ipv4_multicast_node, NULL);
9809 install_node (&bgp_ipv6_unicast_node, NULL);
paul25ffbdc2005-08-22 22:42:08 +00009810 install_node (&bgp_ipv6_multicast_node, NULL);
paul718e3742002-12-13 20:15:29 +00009811 install_node (&bgp_vpnv4_node, NULL);
Lou Berger13c378d2016-01-12 13:41:56 -05009812 install_node (&bgp_vpnv6_node, NULL);
Lou Bergera3fda882016-01-12 13:42:04 -05009813 install_node (&bgp_encap_node, NULL);
9814 install_node (&bgp_encapv6_node, NULL);
paul718e3742002-12-13 20:15:29 +00009815
9816 /* Install default VTY commands to new nodes. */
9817 install_default (BGP_NODE);
9818 install_default (BGP_IPV4_NODE);
9819 install_default (BGP_IPV4M_NODE);
9820 install_default (BGP_IPV6_NODE);
paul25ffbdc2005-08-22 22:42:08 +00009821 install_default (BGP_IPV6M_NODE);
paul718e3742002-12-13 20:15:29 +00009822 install_default (BGP_VPNV4_NODE);
Lou Berger13c378d2016-01-12 13:41:56 -05009823 install_default (BGP_VPNV6_NODE);
Lou Bergera3fda882016-01-12 13:42:04 -05009824 install_default (BGP_ENCAP_NODE);
9825 install_default (BGP_ENCAPV6_NODE);
paul718e3742002-12-13 20:15:29 +00009826
9827 /* "bgp multiple-instance" commands. */
9828 install_element (CONFIG_NODE, &bgp_multiple_instance_cmd);
9829 install_element (CONFIG_NODE, &no_bgp_multiple_instance_cmd);
9830
9831 /* "bgp config-type" commands. */
9832 install_element (CONFIG_NODE, &bgp_config_type_cmd);
9833 install_element (CONFIG_NODE, &no_bgp_config_type_cmd);
9834
9835 /* Dummy commands (Currently not supported) */
9836 install_element (BGP_NODE, &no_synchronization_cmd);
9837 install_element (BGP_NODE, &no_auto_summary_cmd);
9838
9839 /* "router bgp" commands. */
9840 install_element (CONFIG_NODE, &router_bgp_cmd);
9841 install_element (CONFIG_NODE, &router_bgp_view_cmd);
9842
9843 /* "no router bgp" commands. */
9844 install_element (CONFIG_NODE, &no_router_bgp_cmd);
9845 install_element (CONFIG_NODE, &no_router_bgp_view_cmd);
9846
9847 /* "bgp router-id" commands. */
9848 install_element (BGP_NODE, &bgp_router_id_cmd);
9849 install_element (BGP_NODE, &no_bgp_router_id_cmd);
9850 install_element (BGP_NODE, &no_bgp_router_id_val_cmd);
9851
9852 /* "bgp cluster-id" commands. */
9853 install_element (BGP_NODE, &bgp_cluster_id_cmd);
9854 install_element (BGP_NODE, &bgp_cluster_id32_cmd);
9855 install_element (BGP_NODE, &no_bgp_cluster_id_cmd);
9856 install_element (BGP_NODE, &no_bgp_cluster_id_arg_cmd);
9857
9858 /* "bgp confederation" commands. */
9859 install_element (BGP_NODE, &bgp_confederation_identifier_cmd);
9860 install_element (BGP_NODE, &no_bgp_confederation_identifier_cmd);
9861 install_element (BGP_NODE, &no_bgp_confederation_identifier_arg_cmd);
9862
9863 /* "bgp confederation peers" commands. */
9864 install_element (BGP_NODE, &bgp_confederation_peers_cmd);
9865 install_element (BGP_NODE, &no_bgp_confederation_peers_cmd);
9866
Josh Bailey165b5ff2011-07-20 20:43:22 -07009867 /* "maximum-paths" commands. */
9868 install_element (BGP_NODE, &bgp_maxpaths_cmd);
9869 install_element (BGP_NODE, &no_bgp_maxpaths_cmd);
9870 install_element (BGP_NODE, &no_bgp_maxpaths_arg_cmd);
9871 install_element (BGP_IPV4_NODE, &bgp_maxpaths_cmd);
9872 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_cmd);
9873 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_arg_cmd);
9874 install_element (BGP_NODE, &bgp_maxpaths_ibgp_cmd);
9875 install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_cmd);
9876 install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_arg_cmd);
9877 install_element (BGP_IPV4_NODE, &bgp_maxpaths_ibgp_cmd);
9878 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_cmd);
9879 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_arg_cmd);
9880
paul718e3742002-12-13 20:15:29 +00009881 /* "timers bgp" commands. */
9882 install_element (BGP_NODE, &bgp_timers_cmd);
9883 install_element (BGP_NODE, &no_bgp_timers_cmd);
9884 install_element (BGP_NODE, &no_bgp_timers_arg_cmd);
9885
9886 /* "bgp client-to-client reflection" commands */
9887 install_element (BGP_NODE, &no_bgp_client_to_client_reflection_cmd);
9888 install_element (BGP_NODE, &bgp_client_to_client_reflection_cmd);
9889
9890 /* "bgp always-compare-med" commands */
9891 install_element (BGP_NODE, &bgp_always_compare_med_cmd);
9892 install_element (BGP_NODE, &no_bgp_always_compare_med_cmd);
9893
9894 /* "bgp deterministic-med" commands */
9895 install_element (BGP_NODE, &bgp_deterministic_med_cmd);
9896 install_element (BGP_NODE, &no_bgp_deterministic_med_cmd);
hasso538621f2004-05-21 09:31:30 +00009897
hasso538621f2004-05-21 09:31:30 +00009898 /* "bgp graceful-restart" commands */
9899 install_element (BGP_NODE, &bgp_graceful_restart_cmd);
9900 install_element (BGP_NODE, &no_bgp_graceful_restart_cmd);
hasso93406d82005-02-02 14:40:33 +00009901 install_element (BGP_NODE, &bgp_graceful_restart_stalepath_time_cmd);
9902 install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_cmd);
9903 install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_val_cmd);
paul718e3742002-12-13 20:15:29 +00009904
9905 /* "bgp fast-external-failover" commands */
9906 install_element (BGP_NODE, &bgp_fast_external_failover_cmd);
9907 install_element (BGP_NODE, &no_bgp_fast_external_failover_cmd);
9908
9909 /* "bgp enforce-first-as" commands */
9910 install_element (BGP_NODE, &bgp_enforce_first_as_cmd);
9911 install_element (BGP_NODE, &no_bgp_enforce_first_as_cmd);
9912
9913 /* "bgp bestpath compare-routerid" commands */
9914 install_element (BGP_NODE, &bgp_bestpath_compare_router_id_cmd);
9915 install_element (BGP_NODE, &no_bgp_bestpath_compare_router_id_cmd);
9916
9917 /* "bgp bestpath as-path ignore" commands */
9918 install_element (BGP_NODE, &bgp_bestpath_aspath_ignore_cmd);
9919 install_element (BGP_NODE, &no_bgp_bestpath_aspath_ignore_cmd);
9920
hasso68118452005-04-08 15:40:36 +00009921 /* "bgp bestpath as-path confed" commands */
9922 install_element (BGP_NODE, &bgp_bestpath_aspath_confed_cmd);
9923 install_element (BGP_NODE, &no_bgp_bestpath_aspath_confed_cmd);
9924
Pradosh Mohapatra2fdd4552013-09-07 07:02:36 +00009925 /* "bgp bestpath as-path multipath-relax" commands */
9926 install_element (BGP_NODE, &bgp_bestpath_aspath_multipath_relax_cmd);
9927 install_element (BGP_NODE, &no_bgp_bestpath_aspath_multipath_relax_cmd);
9928
paul848973c2003-08-13 00:32:49 +00009929 /* "bgp log-neighbor-changes" commands */
9930 install_element (BGP_NODE, &bgp_log_neighbor_changes_cmd);
9931 install_element (BGP_NODE, &no_bgp_log_neighbor_changes_cmd);
9932
paul718e3742002-12-13 20:15:29 +00009933 /* "bgp bestpath med" commands */
9934 install_element (BGP_NODE, &bgp_bestpath_med_cmd);
9935 install_element (BGP_NODE, &bgp_bestpath_med2_cmd);
9936 install_element (BGP_NODE, &bgp_bestpath_med3_cmd);
9937 install_element (BGP_NODE, &no_bgp_bestpath_med_cmd);
9938 install_element (BGP_NODE, &no_bgp_bestpath_med2_cmd);
9939 install_element (BGP_NODE, &no_bgp_bestpath_med3_cmd);
9940
9941 /* "no bgp default ipv4-unicast" commands. */
9942 install_element (BGP_NODE, &no_bgp_default_ipv4_unicast_cmd);
9943 install_element (BGP_NODE, &bgp_default_ipv4_unicast_cmd);
9944
9945 /* "bgp network import-check" commands. */
9946 install_element (BGP_NODE, &bgp_network_import_check_cmd);
9947 install_element (BGP_NODE, &no_bgp_network_import_check_cmd);
9948
9949 /* "bgp default local-preference" commands. */
9950 install_element (BGP_NODE, &bgp_default_local_preference_cmd);
9951 install_element (BGP_NODE, &no_bgp_default_local_preference_cmd);
9952 install_element (BGP_NODE, &no_bgp_default_local_preference_val_cmd);
9953
9954 /* "neighbor remote-as" commands. */
9955 install_element (BGP_NODE, &neighbor_remote_as_cmd);
9956 install_element (BGP_NODE, &no_neighbor_cmd);
9957 install_element (BGP_NODE, &no_neighbor_remote_as_cmd);
9958
9959 /* "neighbor peer-group" commands. */
9960 install_element (BGP_NODE, &neighbor_peer_group_cmd);
9961 install_element (BGP_NODE, &no_neighbor_peer_group_cmd);
9962 install_element (BGP_NODE, &no_neighbor_peer_group_remote_as_cmd);
9963
9964 /* "neighbor local-as" commands. */
9965 install_element (BGP_NODE, &neighbor_local_as_cmd);
9966 install_element (BGP_NODE, &neighbor_local_as_no_prepend_cmd);
Andrew Certain9d3f9702012-11-07 23:50:07 +00009967 install_element (BGP_NODE, &neighbor_local_as_no_prepend_replace_as_cmd);
paul718e3742002-12-13 20:15:29 +00009968 install_element (BGP_NODE, &no_neighbor_local_as_cmd);
9969 install_element (BGP_NODE, &no_neighbor_local_as_val_cmd);
9970 install_element (BGP_NODE, &no_neighbor_local_as_val2_cmd);
Andrew Certain9d3f9702012-11-07 23:50:07 +00009971 install_element (BGP_NODE, &no_neighbor_local_as_val3_cmd);
paul718e3742002-12-13 20:15:29 +00009972
Paul Jakma0df7c912008-07-21 21:02:49 +00009973 /* "neighbor password" commands. */
9974 install_element (BGP_NODE, &neighbor_password_cmd);
9975 install_element (BGP_NODE, &no_neighbor_password_cmd);
9976
paul718e3742002-12-13 20:15:29 +00009977 /* "neighbor activate" commands. */
9978 install_element (BGP_NODE, &neighbor_activate_cmd);
9979 install_element (BGP_IPV4_NODE, &neighbor_activate_cmd);
9980 install_element (BGP_IPV4M_NODE, &neighbor_activate_cmd);
9981 install_element (BGP_IPV6_NODE, &neighbor_activate_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009982 install_element (BGP_IPV6M_NODE, &neighbor_activate_cmd);
paul718e3742002-12-13 20:15:29 +00009983 install_element (BGP_VPNV4_NODE, &neighbor_activate_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -05009984 install_element (BGP_VPNV6_NODE, &neighbor_activate_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -05009985 install_element (BGP_ENCAP_NODE, &neighbor_activate_cmd);
9986 install_element (BGP_ENCAPV6_NODE, &neighbor_activate_cmd);
paul718e3742002-12-13 20:15:29 +00009987
9988 /* "no neighbor activate" commands. */
9989 install_element (BGP_NODE, &no_neighbor_activate_cmd);
9990 install_element (BGP_IPV4_NODE, &no_neighbor_activate_cmd);
9991 install_element (BGP_IPV4M_NODE, &no_neighbor_activate_cmd);
9992 install_element (BGP_IPV6_NODE, &no_neighbor_activate_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009993 install_element (BGP_IPV6M_NODE, &no_neighbor_activate_cmd);
paul718e3742002-12-13 20:15:29 +00009994 install_element (BGP_VPNV4_NODE, &no_neighbor_activate_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -05009995 install_element (BGP_VPNV6_NODE, &no_neighbor_activate_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -05009996 install_element (BGP_ENCAP_NODE, &no_neighbor_activate_cmd);
9997 install_element (BGP_ENCAPV6_NODE, &no_neighbor_activate_cmd);
paul718e3742002-12-13 20:15:29 +00009998
9999 /* "neighbor peer-group set" commands. */
10000 install_element (BGP_NODE, &neighbor_set_peer_group_cmd);
10001 install_element (BGP_IPV4_NODE, &neighbor_set_peer_group_cmd);
10002 install_element (BGP_IPV4M_NODE, &neighbor_set_peer_group_cmd);
10003 install_element (BGP_IPV6_NODE, &neighbor_set_peer_group_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010004 install_element (BGP_IPV6M_NODE, &neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +000010005 install_element (BGP_VPNV4_NODE, &neighbor_set_peer_group_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010006 install_element (BGP_VPNV6_NODE, &neighbor_set_peer_group_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010007 install_element (BGP_ENCAP_NODE, &neighbor_set_peer_group_cmd);
10008 install_element (BGP_ENCAPV6_NODE, &neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +000010009
paul718e3742002-12-13 20:15:29 +000010010 /* "no neighbor peer-group unset" commands. */
10011 install_element (BGP_NODE, &no_neighbor_set_peer_group_cmd);
10012 install_element (BGP_IPV4_NODE, &no_neighbor_set_peer_group_cmd);
10013 install_element (BGP_IPV4M_NODE, &no_neighbor_set_peer_group_cmd);
10014 install_element (BGP_IPV6_NODE, &no_neighbor_set_peer_group_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010015 install_element (BGP_IPV6M_NODE, &no_neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +000010016 install_element (BGP_VPNV4_NODE, &no_neighbor_set_peer_group_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010017 install_element (BGP_VPNV6_NODE, &no_neighbor_set_peer_group_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010018 install_element (BGP_ENCAP_NODE, &no_neighbor_set_peer_group_cmd);
10019 install_element (BGP_ENCAPV6_NODE, &no_neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +000010020
paul718e3742002-12-13 20:15:29 +000010021 /* "neighbor softreconfiguration inbound" commands.*/
10022 install_element (BGP_NODE, &neighbor_soft_reconfiguration_cmd);
10023 install_element (BGP_NODE, &no_neighbor_soft_reconfiguration_cmd);
10024 install_element (BGP_IPV4_NODE, &neighbor_soft_reconfiguration_cmd);
10025 install_element (BGP_IPV4_NODE, &no_neighbor_soft_reconfiguration_cmd);
10026 install_element (BGP_IPV4M_NODE, &neighbor_soft_reconfiguration_cmd);
10027 install_element (BGP_IPV4M_NODE, &no_neighbor_soft_reconfiguration_cmd);
10028 install_element (BGP_IPV6_NODE, &neighbor_soft_reconfiguration_cmd);
10029 install_element (BGP_IPV6_NODE, &no_neighbor_soft_reconfiguration_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010030 install_element (BGP_IPV6M_NODE, &neighbor_soft_reconfiguration_cmd);
10031 install_element (BGP_IPV6M_NODE, &no_neighbor_soft_reconfiguration_cmd);
paula58545b2003-07-12 21:43:01 +000010032 install_element (BGP_VPNV4_NODE, &neighbor_soft_reconfiguration_cmd);
10033 install_element (BGP_VPNV4_NODE, &no_neighbor_soft_reconfiguration_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010034 install_element (BGP_VPNV6_NODE, &neighbor_soft_reconfiguration_cmd);
10035 install_element (BGP_VPNV6_NODE, &no_neighbor_soft_reconfiguration_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010036 install_element (BGP_ENCAP_NODE, &neighbor_soft_reconfiguration_cmd);
10037 install_element (BGP_ENCAP_NODE, &no_neighbor_soft_reconfiguration_cmd);
10038 install_element (BGP_ENCAPV6_NODE, &neighbor_soft_reconfiguration_cmd);
10039 install_element (BGP_ENCAPV6_NODE, &no_neighbor_soft_reconfiguration_cmd);
paul718e3742002-12-13 20:15:29 +000010040
10041 /* "neighbor attribute-unchanged" commands. */
10042 install_element (BGP_NODE, &neighbor_attr_unchanged_cmd);
10043 install_element (BGP_NODE, &neighbor_attr_unchanged1_cmd);
10044 install_element (BGP_NODE, &neighbor_attr_unchanged2_cmd);
10045 install_element (BGP_NODE, &neighbor_attr_unchanged3_cmd);
10046 install_element (BGP_NODE, &neighbor_attr_unchanged4_cmd);
10047 install_element (BGP_NODE, &neighbor_attr_unchanged5_cmd);
10048 install_element (BGP_NODE, &neighbor_attr_unchanged6_cmd);
10049 install_element (BGP_NODE, &neighbor_attr_unchanged7_cmd);
10050 install_element (BGP_NODE, &neighbor_attr_unchanged8_cmd);
10051 install_element (BGP_NODE, &neighbor_attr_unchanged9_cmd);
10052 install_element (BGP_NODE, &neighbor_attr_unchanged10_cmd);
10053 install_element (BGP_NODE, &no_neighbor_attr_unchanged_cmd);
10054 install_element (BGP_NODE, &no_neighbor_attr_unchanged1_cmd);
10055 install_element (BGP_NODE, &no_neighbor_attr_unchanged2_cmd);
10056 install_element (BGP_NODE, &no_neighbor_attr_unchanged3_cmd);
10057 install_element (BGP_NODE, &no_neighbor_attr_unchanged4_cmd);
10058 install_element (BGP_NODE, &no_neighbor_attr_unchanged5_cmd);
10059 install_element (BGP_NODE, &no_neighbor_attr_unchanged6_cmd);
10060 install_element (BGP_NODE, &no_neighbor_attr_unchanged7_cmd);
10061 install_element (BGP_NODE, &no_neighbor_attr_unchanged8_cmd);
10062 install_element (BGP_NODE, &no_neighbor_attr_unchanged9_cmd);
10063 install_element (BGP_NODE, &no_neighbor_attr_unchanged10_cmd);
10064 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged_cmd);
10065 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged1_cmd);
10066 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged2_cmd);
10067 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged3_cmd);
10068 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged4_cmd);
10069 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged5_cmd);
10070 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged6_cmd);
10071 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged7_cmd);
10072 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged8_cmd);
10073 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged9_cmd);
10074 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged10_cmd);
10075 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged_cmd);
10076 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged1_cmd);
10077 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged2_cmd);
10078 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged3_cmd);
10079 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged4_cmd);
10080 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged5_cmd);
10081 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged6_cmd);
10082 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged7_cmd);
10083 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged8_cmd);
10084 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged9_cmd);
10085 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged10_cmd);
10086 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged_cmd);
10087 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged1_cmd);
10088 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged2_cmd);
10089 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged3_cmd);
10090 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged4_cmd);
10091 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged5_cmd);
10092 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged6_cmd);
10093 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged7_cmd);
10094 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged8_cmd);
10095 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged9_cmd);
10096 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged10_cmd);
10097 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged_cmd);
10098 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged1_cmd);
10099 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged2_cmd);
10100 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged3_cmd);
10101 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged4_cmd);
10102 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged5_cmd);
10103 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged6_cmd);
10104 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged7_cmd);
10105 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged8_cmd);
10106 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged9_cmd);
10107 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged10_cmd);
10108 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged_cmd);
10109 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged1_cmd);
10110 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged2_cmd);
10111 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged3_cmd);
10112 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged4_cmd);
10113 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged5_cmd);
10114 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged6_cmd);
10115 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged7_cmd);
10116 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged8_cmd);
10117 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged9_cmd);
10118 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged10_cmd);
10119 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged_cmd);
10120 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged1_cmd);
10121 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged2_cmd);
10122 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged3_cmd);
10123 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged4_cmd);
10124 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged5_cmd);
10125 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged6_cmd);
10126 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged7_cmd);
10127 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged8_cmd);
10128 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged9_cmd);
10129 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged10_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010130 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged_cmd);
10131 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged1_cmd);
10132 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged2_cmd);
10133 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged3_cmd);
10134 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged4_cmd);
10135 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged5_cmd);
10136 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged6_cmd);
10137 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged7_cmd);
10138 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged8_cmd);
10139 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged9_cmd);
10140 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged10_cmd);
10141 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged_cmd);
10142 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged1_cmd);
10143 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged2_cmd);
10144 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged3_cmd);
10145 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged4_cmd);
10146 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged5_cmd);
10147 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged6_cmd);
10148 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged7_cmd);
10149 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged8_cmd);
10150 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged9_cmd);
10151 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged10_cmd);
paul718e3742002-12-13 20:15:29 +000010152 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged_cmd);
10153 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged1_cmd);
10154 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged2_cmd);
10155 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged3_cmd);
10156 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged4_cmd);
10157 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged5_cmd);
10158 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged6_cmd);
10159 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged7_cmd);
10160 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged8_cmd);
10161 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged9_cmd);
10162 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged10_cmd);
10163 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged_cmd);
10164 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged1_cmd);
10165 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged2_cmd);
10166 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged3_cmd);
10167 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged4_cmd);
10168 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged5_cmd);
10169 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged6_cmd);
10170 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged7_cmd);
10171 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged8_cmd);
10172 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged9_cmd);
10173 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged10_cmd);
10174
Lou Berger13c378d2016-01-12 13:41:56 -050010175 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged_cmd);
10176 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged1_cmd);
10177 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged2_cmd);
10178 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged3_cmd);
10179 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged4_cmd);
10180 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged5_cmd);
10181 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged6_cmd);
10182 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged7_cmd);
10183 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged8_cmd);
10184 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged9_cmd);
10185 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged10_cmd);
10186 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged_cmd);
10187 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged1_cmd);
10188 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged2_cmd);
10189 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged3_cmd);
10190 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged4_cmd);
10191 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged5_cmd);
10192 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged6_cmd);
10193 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged7_cmd);
10194 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged8_cmd);
10195 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged9_cmd);
10196 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged10_cmd);
10197
Lou Bergera3fda882016-01-12 13:42:04 -050010198 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged_cmd);
10199 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged1_cmd);
10200 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged2_cmd);
10201 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged3_cmd);
10202 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged4_cmd);
10203 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged5_cmd);
10204 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged6_cmd);
10205 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged7_cmd);
10206 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged8_cmd);
10207 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged9_cmd);
10208 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged10_cmd);
10209 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged_cmd);
10210 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged1_cmd);
10211 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged2_cmd);
10212 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged3_cmd);
10213 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged4_cmd);
10214 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged5_cmd);
10215 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged6_cmd);
10216 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged7_cmd);
10217 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged8_cmd);
10218 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged9_cmd);
10219 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged10_cmd);
10220
10221 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged_cmd);
10222 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged1_cmd);
10223 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged2_cmd);
10224 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged3_cmd);
10225 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged4_cmd);
10226 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged5_cmd);
10227 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged6_cmd);
10228 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged7_cmd);
10229 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged8_cmd);
10230 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged9_cmd);
10231 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged10_cmd);
10232 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged_cmd);
10233 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged1_cmd);
10234 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged2_cmd);
10235 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged3_cmd);
10236 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged4_cmd);
10237 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged5_cmd);
10238 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged6_cmd);
10239 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged7_cmd);
10240 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged8_cmd);
10241 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged9_cmd);
10242 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged10_cmd);
10243
paulfee0f4c2004-09-13 05:12:46 +000010244 /* "nexthop-local unchanged" commands */
10245 install_element (BGP_IPV6_NODE, &neighbor_nexthop_local_unchanged_cmd);
10246 install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_local_unchanged_cmd);
10247
paul718e3742002-12-13 20:15:29 +000010248 /* "transparent-as" and "transparent-nexthop" for old version
10249 compatibility. */
10250 install_element (BGP_NODE, &neighbor_transparent_as_cmd);
10251 install_element (BGP_NODE, &neighbor_transparent_nexthop_cmd);
10252
10253 /* "neighbor next-hop-self" commands. */
10254 install_element (BGP_NODE, &neighbor_nexthop_self_cmd);
10255 install_element (BGP_NODE, &no_neighbor_nexthop_self_cmd);
10256 install_element (BGP_IPV4_NODE, &neighbor_nexthop_self_cmd);
10257 install_element (BGP_IPV4_NODE, &no_neighbor_nexthop_self_cmd);
10258 install_element (BGP_IPV4M_NODE, &neighbor_nexthop_self_cmd);
10259 install_element (BGP_IPV4M_NODE, &no_neighbor_nexthop_self_cmd);
10260 install_element (BGP_IPV6_NODE, &neighbor_nexthop_self_cmd);
10261 install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_self_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010262 install_element (BGP_IPV6M_NODE, &neighbor_nexthop_self_cmd);
10263 install_element (BGP_IPV6M_NODE, &no_neighbor_nexthop_self_cmd);
paul718e3742002-12-13 20:15:29 +000010264 install_element (BGP_VPNV4_NODE, &neighbor_nexthop_self_cmd);
10265 install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010266 install_element (BGP_VPNV6_NODE, &neighbor_nexthop_self_cmd);
10267 install_element (BGP_VPNV6_NODE, &no_neighbor_nexthop_self_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010268 install_element (BGP_ENCAP_NODE, &neighbor_nexthop_self_cmd);
10269 install_element (BGP_ENCAP_NODE, &no_neighbor_nexthop_self_cmd);
10270 install_element (BGP_ENCAPV6_NODE, &neighbor_nexthop_self_cmd);
10271 install_element (BGP_ENCAPV6_NODE, &no_neighbor_nexthop_self_cmd);
paul718e3742002-12-13 20:15:29 +000010272
10273 /* "neighbor remove-private-AS" commands. */
10274 install_element (BGP_NODE, &neighbor_remove_private_as_cmd);
10275 install_element (BGP_NODE, &no_neighbor_remove_private_as_cmd);
10276 install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_cmd);
10277 install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_cmd);
10278 install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_cmd);
10279 install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_cmd);
10280 install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_cmd);
10281 install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010282 install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_cmd);
10283 install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_cmd);
paul718e3742002-12-13 20:15:29 +000010284 install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_cmd);
10285 install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010286 install_element (BGP_VPNV6_NODE, &neighbor_remove_private_as_cmd);
10287 install_element (BGP_VPNV6_NODE, &no_neighbor_remove_private_as_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010288 install_element (BGP_ENCAP_NODE, &neighbor_remove_private_as_cmd);
10289 install_element (BGP_ENCAP_NODE, &no_neighbor_remove_private_as_cmd);
10290 install_element (BGP_ENCAPV6_NODE, &neighbor_remove_private_as_cmd);
10291 install_element (BGP_ENCAPV6_NODE, &no_neighbor_remove_private_as_cmd);
paul718e3742002-12-13 20:15:29 +000010292
10293 /* "neighbor send-community" commands.*/
10294 install_element (BGP_NODE, &neighbor_send_community_cmd);
10295 install_element (BGP_NODE, &neighbor_send_community_type_cmd);
10296 install_element (BGP_NODE, &no_neighbor_send_community_cmd);
10297 install_element (BGP_NODE, &no_neighbor_send_community_type_cmd);
10298 install_element (BGP_IPV4_NODE, &neighbor_send_community_cmd);
10299 install_element (BGP_IPV4_NODE, &neighbor_send_community_type_cmd);
10300 install_element (BGP_IPV4_NODE, &no_neighbor_send_community_cmd);
10301 install_element (BGP_IPV4_NODE, &no_neighbor_send_community_type_cmd);
10302 install_element (BGP_IPV4M_NODE, &neighbor_send_community_cmd);
10303 install_element (BGP_IPV4M_NODE, &neighbor_send_community_type_cmd);
10304 install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_cmd);
10305 install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_type_cmd);
10306 install_element (BGP_IPV6_NODE, &neighbor_send_community_cmd);
10307 install_element (BGP_IPV6_NODE, &neighbor_send_community_type_cmd);
10308 install_element (BGP_IPV6_NODE, &no_neighbor_send_community_cmd);
10309 install_element (BGP_IPV6_NODE, &no_neighbor_send_community_type_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010310 install_element (BGP_IPV6M_NODE, &neighbor_send_community_cmd);
10311 install_element (BGP_IPV6M_NODE, &neighbor_send_community_type_cmd);
10312 install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_cmd);
10313 install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_type_cmd);
paul718e3742002-12-13 20:15:29 +000010314 install_element (BGP_VPNV4_NODE, &neighbor_send_community_cmd);
10315 install_element (BGP_VPNV4_NODE, &neighbor_send_community_type_cmd);
10316 install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_cmd);
10317 install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_type_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010318 install_element (BGP_VPNV6_NODE, &neighbor_send_community_cmd);
10319 install_element (BGP_VPNV6_NODE, &neighbor_send_community_type_cmd);
10320 install_element (BGP_VPNV6_NODE, &no_neighbor_send_community_cmd);
10321 install_element (BGP_VPNV6_NODE, &no_neighbor_send_community_type_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010322 install_element (BGP_ENCAP_NODE, &neighbor_send_community_cmd);
10323 install_element (BGP_ENCAP_NODE, &neighbor_send_community_type_cmd);
10324 install_element (BGP_ENCAP_NODE, &no_neighbor_send_community_cmd);
10325 install_element (BGP_ENCAP_NODE, &no_neighbor_send_community_type_cmd);
10326 install_element (BGP_ENCAPV6_NODE, &neighbor_send_community_cmd);
10327 install_element (BGP_ENCAPV6_NODE, &neighbor_send_community_type_cmd);
10328 install_element (BGP_ENCAPV6_NODE, &no_neighbor_send_community_cmd);
10329 install_element (BGP_ENCAPV6_NODE, &no_neighbor_send_community_type_cmd);
paul718e3742002-12-13 20:15:29 +000010330
10331 /* "neighbor route-reflector" commands.*/
10332 install_element (BGP_NODE, &neighbor_route_reflector_client_cmd);
10333 install_element (BGP_NODE, &no_neighbor_route_reflector_client_cmd);
10334 install_element (BGP_IPV4_NODE, &neighbor_route_reflector_client_cmd);
10335 install_element (BGP_IPV4_NODE, &no_neighbor_route_reflector_client_cmd);
10336 install_element (BGP_IPV4M_NODE, &neighbor_route_reflector_client_cmd);
10337 install_element (BGP_IPV4M_NODE, &no_neighbor_route_reflector_client_cmd);
10338 install_element (BGP_IPV6_NODE, &neighbor_route_reflector_client_cmd);
10339 install_element (BGP_IPV6_NODE, &no_neighbor_route_reflector_client_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010340 install_element (BGP_IPV6M_NODE, &neighbor_route_reflector_client_cmd);
10341 install_element (BGP_IPV6M_NODE, &no_neighbor_route_reflector_client_cmd);
paul718e3742002-12-13 20:15:29 +000010342 install_element (BGP_VPNV4_NODE, &neighbor_route_reflector_client_cmd);
10343 install_element (BGP_VPNV4_NODE, &no_neighbor_route_reflector_client_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010344 install_element (BGP_VPNV6_NODE, &neighbor_route_reflector_client_cmd);
10345 install_element (BGP_VPNV6_NODE, &no_neighbor_route_reflector_client_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010346 install_element (BGP_ENCAP_NODE, &neighbor_route_reflector_client_cmd);
10347 install_element (BGP_ENCAP_NODE, &no_neighbor_route_reflector_client_cmd);
10348 install_element (BGP_ENCAPV6_NODE, &neighbor_route_reflector_client_cmd);
10349 install_element (BGP_ENCAPV6_NODE, &no_neighbor_route_reflector_client_cmd);
paul718e3742002-12-13 20:15:29 +000010350
10351 /* "neighbor route-server" commands.*/
10352 install_element (BGP_NODE, &neighbor_route_server_client_cmd);
10353 install_element (BGP_NODE, &no_neighbor_route_server_client_cmd);
10354 install_element (BGP_IPV4_NODE, &neighbor_route_server_client_cmd);
10355 install_element (BGP_IPV4_NODE, &no_neighbor_route_server_client_cmd);
10356 install_element (BGP_IPV4M_NODE, &neighbor_route_server_client_cmd);
10357 install_element (BGP_IPV4M_NODE, &no_neighbor_route_server_client_cmd);
10358 install_element (BGP_IPV6_NODE, &neighbor_route_server_client_cmd);
10359 install_element (BGP_IPV6_NODE, &no_neighbor_route_server_client_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010360 install_element (BGP_IPV6M_NODE, &neighbor_route_server_client_cmd);
10361 install_element (BGP_IPV6M_NODE, &no_neighbor_route_server_client_cmd);
paul718e3742002-12-13 20:15:29 +000010362 install_element (BGP_VPNV4_NODE, &neighbor_route_server_client_cmd);
10363 install_element (BGP_VPNV4_NODE, &no_neighbor_route_server_client_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010364 install_element (BGP_VPNV6_NODE, &neighbor_route_server_client_cmd);
10365 install_element (BGP_VPNV6_NODE, &no_neighbor_route_server_client_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010366 install_element (BGP_ENCAP_NODE, &neighbor_route_server_client_cmd);
10367 install_element (BGP_ENCAP_NODE, &no_neighbor_route_server_client_cmd);
10368 install_element (BGP_ENCAPV6_NODE, &neighbor_route_server_client_cmd);
10369 install_element (BGP_ENCAPV6_NODE, &no_neighbor_route_server_client_cmd);
paul718e3742002-12-13 20:15:29 +000010370
10371 /* "neighbor passive" commands. */
10372 install_element (BGP_NODE, &neighbor_passive_cmd);
10373 install_element (BGP_NODE, &no_neighbor_passive_cmd);
10374
10375 /* "neighbor shutdown" commands. */
10376 install_element (BGP_NODE, &neighbor_shutdown_cmd);
10377 install_element (BGP_NODE, &no_neighbor_shutdown_cmd);
10378
hassoc9502432005-02-01 22:01:48 +000010379 /* Deprecated "neighbor capability route-refresh" commands.*/
paul718e3742002-12-13 20:15:29 +000010380 install_element (BGP_NODE, &neighbor_capability_route_refresh_cmd);
10381 install_element (BGP_NODE, &no_neighbor_capability_route_refresh_cmd);
10382
10383 /* "neighbor capability orf prefix-list" commands.*/
10384 install_element (BGP_NODE, &neighbor_capability_orf_prefix_cmd);
10385 install_element (BGP_NODE, &no_neighbor_capability_orf_prefix_cmd);
10386 install_element (BGP_IPV4_NODE, &neighbor_capability_orf_prefix_cmd);
10387 install_element (BGP_IPV4_NODE, &no_neighbor_capability_orf_prefix_cmd);
10388 install_element (BGP_IPV4M_NODE, &neighbor_capability_orf_prefix_cmd);
10389 install_element (BGP_IPV4M_NODE, &no_neighbor_capability_orf_prefix_cmd);
10390 install_element (BGP_IPV6_NODE, &neighbor_capability_orf_prefix_cmd);
10391 install_element (BGP_IPV6_NODE, &no_neighbor_capability_orf_prefix_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010392 install_element (BGP_IPV6M_NODE, &neighbor_capability_orf_prefix_cmd);
10393 install_element (BGP_IPV6M_NODE, &no_neighbor_capability_orf_prefix_cmd);
paul718e3742002-12-13 20:15:29 +000010394
10395 /* "neighbor capability dynamic" commands.*/
10396 install_element (BGP_NODE, &neighbor_capability_dynamic_cmd);
10397 install_element (BGP_NODE, &no_neighbor_capability_dynamic_cmd);
10398
10399 /* "neighbor dont-capability-negotiate" commands. */
10400 install_element (BGP_NODE, &neighbor_dont_capability_negotiate_cmd);
10401 install_element (BGP_NODE, &no_neighbor_dont_capability_negotiate_cmd);
10402
10403 /* "neighbor ebgp-multihop" commands. */
10404 install_element (BGP_NODE, &neighbor_ebgp_multihop_cmd);
10405 install_element (BGP_NODE, &neighbor_ebgp_multihop_ttl_cmd);
10406 install_element (BGP_NODE, &no_neighbor_ebgp_multihop_cmd);
10407 install_element (BGP_NODE, &no_neighbor_ebgp_multihop_ttl_cmd);
10408
hasso6ffd2072005-02-02 14:50:11 +000010409 /* "neighbor disable-connected-check" commands. */
10410 install_element (BGP_NODE, &neighbor_disable_connected_check_cmd);
10411 install_element (BGP_NODE, &no_neighbor_disable_connected_check_cmd);
paul718e3742002-12-13 20:15:29 +000010412 install_element (BGP_NODE, &neighbor_enforce_multihop_cmd);
10413 install_element (BGP_NODE, &no_neighbor_enforce_multihop_cmd);
10414
10415 /* "neighbor description" commands. */
10416 install_element (BGP_NODE, &neighbor_description_cmd);
10417 install_element (BGP_NODE, &no_neighbor_description_cmd);
10418 install_element (BGP_NODE, &no_neighbor_description_val_cmd);
10419
10420 /* "neighbor update-source" commands. "*/
10421 install_element (BGP_NODE, &neighbor_update_source_cmd);
10422 install_element (BGP_NODE, &no_neighbor_update_source_cmd);
10423
10424 /* "neighbor default-originate" commands. */
10425 install_element (BGP_NODE, &neighbor_default_originate_cmd);
10426 install_element (BGP_NODE, &neighbor_default_originate_rmap_cmd);
10427 install_element (BGP_NODE, &no_neighbor_default_originate_cmd);
10428 install_element (BGP_NODE, &no_neighbor_default_originate_rmap_cmd);
10429 install_element (BGP_IPV4_NODE, &neighbor_default_originate_cmd);
10430 install_element (BGP_IPV4_NODE, &neighbor_default_originate_rmap_cmd);
10431 install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_cmd);
10432 install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_rmap_cmd);
10433 install_element (BGP_IPV4M_NODE, &neighbor_default_originate_cmd);
10434 install_element (BGP_IPV4M_NODE, &neighbor_default_originate_rmap_cmd);
10435 install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_cmd);
10436 install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_rmap_cmd);
10437 install_element (BGP_IPV6_NODE, &neighbor_default_originate_cmd);
10438 install_element (BGP_IPV6_NODE, &neighbor_default_originate_rmap_cmd);
10439 install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_cmd);
10440 install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_rmap_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010441 install_element (BGP_IPV6M_NODE, &neighbor_default_originate_cmd);
10442 install_element (BGP_IPV6M_NODE, &neighbor_default_originate_rmap_cmd);
10443 install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_cmd);
10444 install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_rmap_cmd);
paul718e3742002-12-13 20:15:29 +000010445
10446 /* "neighbor port" commands. */
10447 install_element (BGP_NODE, &neighbor_port_cmd);
10448 install_element (BGP_NODE, &no_neighbor_port_cmd);
10449 install_element (BGP_NODE, &no_neighbor_port_val_cmd);
10450
10451 /* "neighbor weight" commands. */
10452 install_element (BGP_NODE, &neighbor_weight_cmd);
10453 install_element (BGP_NODE, &no_neighbor_weight_cmd);
10454 install_element (BGP_NODE, &no_neighbor_weight_val_cmd);
10455
10456 /* "neighbor override-capability" commands. */
10457 install_element (BGP_NODE, &neighbor_override_capability_cmd);
10458 install_element (BGP_NODE, &no_neighbor_override_capability_cmd);
10459
10460 /* "neighbor strict-capability-match" commands. */
10461 install_element (BGP_NODE, &neighbor_strict_capability_cmd);
10462 install_element (BGP_NODE, &no_neighbor_strict_capability_cmd);
10463
10464 /* "neighbor timers" commands. */
10465 install_element (BGP_NODE, &neighbor_timers_cmd);
10466 install_element (BGP_NODE, &no_neighbor_timers_cmd);
10467
10468 /* "neighbor timers connect" commands. */
10469 install_element (BGP_NODE, &neighbor_timers_connect_cmd);
10470 install_element (BGP_NODE, &no_neighbor_timers_connect_cmd);
10471 install_element (BGP_NODE, &no_neighbor_timers_connect_val_cmd);
10472
10473 /* "neighbor advertisement-interval" commands. */
10474 install_element (BGP_NODE, &neighbor_advertise_interval_cmd);
10475 install_element (BGP_NODE, &no_neighbor_advertise_interval_cmd);
10476 install_element (BGP_NODE, &no_neighbor_advertise_interval_val_cmd);
10477
10478 /* "neighbor version" commands. */
10479 install_element (BGP_NODE, &neighbor_version_cmd);
paul718e3742002-12-13 20:15:29 +000010480
10481 /* "neighbor interface" commands. */
10482 install_element (BGP_NODE, &neighbor_interface_cmd);
10483 install_element (BGP_NODE, &no_neighbor_interface_cmd);
10484
10485 /* "neighbor distribute" commands. */
10486 install_element (BGP_NODE, &neighbor_distribute_list_cmd);
10487 install_element (BGP_NODE, &no_neighbor_distribute_list_cmd);
10488 install_element (BGP_IPV4_NODE, &neighbor_distribute_list_cmd);
10489 install_element (BGP_IPV4_NODE, &no_neighbor_distribute_list_cmd);
10490 install_element (BGP_IPV4M_NODE, &neighbor_distribute_list_cmd);
10491 install_element (BGP_IPV4M_NODE, &no_neighbor_distribute_list_cmd);
10492 install_element (BGP_IPV6_NODE, &neighbor_distribute_list_cmd);
10493 install_element (BGP_IPV6_NODE, &no_neighbor_distribute_list_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010494 install_element (BGP_IPV6M_NODE, &neighbor_distribute_list_cmd);
10495 install_element (BGP_IPV6M_NODE, &no_neighbor_distribute_list_cmd);
paul718e3742002-12-13 20:15:29 +000010496 install_element (BGP_VPNV4_NODE, &neighbor_distribute_list_cmd);
10497 install_element (BGP_VPNV4_NODE, &no_neighbor_distribute_list_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010498 install_element (BGP_VPNV6_NODE, &neighbor_distribute_list_cmd);
10499 install_element (BGP_VPNV6_NODE, &no_neighbor_distribute_list_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010500 install_element (BGP_ENCAP_NODE, &neighbor_distribute_list_cmd);
10501 install_element (BGP_ENCAP_NODE, &no_neighbor_distribute_list_cmd);
10502 install_element (BGP_ENCAPV6_NODE, &neighbor_distribute_list_cmd);
10503 install_element (BGP_ENCAPV6_NODE, &no_neighbor_distribute_list_cmd);
paul718e3742002-12-13 20:15:29 +000010504
10505 /* "neighbor prefix-list" commands. */
10506 install_element (BGP_NODE, &neighbor_prefix_list_cmd);
10507 install_element (BGP_NODE, &no_neighbor_prefix_list_cmd);
10508 install_element (BGP_IPV4_NODE, &neighbor_prefix_list_cmd);
10509 install_element (BGP_IPV4_NODE, &no_neighbor_prefix_list_cmd);
10510 install_element (BGP_IPV4M_NODE, &neighbor_prefix_list_cmd);
10511 install_element (BGP_IPV4M_NODE, &no_neighbor_prefix_list_cmd);
10512 install_element (BGP_IPV6_NODE, &neighbor_prefix_list_cmd);
10513 install_element (BGP_IPV6_NODE, &no_neighbor_prefix_list_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010514 install_element (BGP_IPV6M_NODE, &neighbor_prefix_list_cmd);
10515 install_element (BGP_IPV6M_NODE, &no_neighbor_prefix_list_cmd);
paul718e3742002-12-13 20:15:29 +000010516 install_element (BGP_VPNV4_NODE, &neighbor_prefix_list_cmd);
10517 install_element (BGP_VPNV4_NODE, &no_neighbor_prefix_list_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010518 install_element (BGP_VPNV6_NODE, &neighbor_prefix_list_cmd);
10519 install_element (BGP_VPNV6_NODE, &no_neighbor_prefix_list_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010520 install_element (BGP_ENCAP_NODE, &neighbor_prefix_list_cmd);
10521 install_element (BGP_ENCAP_NODE, &no_neighbor_prefix_list_cmd);
10522 install_element (BGP_ENCAPV6_NODE, &neighbor_prefix_list_cmd);
10523 install_element (BGP_ENCAPV6_NODE, &no_neighbor_prefix_list_cmd);
paul718e3742002-12-13 20:15:29 +000010524
10525 /* "neighbor filter-list" commands. */
10526 install_element (BGP_NODE, &neighbor_filter_list_cmd);
10527 install_element (BGP_NODE, &no_neighbor_filter_list_cmd);
10528 install_element (BGP_IPV4_NODE, &neighbor_filter_list_cmd);
10529 install_element (BGP_IPV4_NODE, &no_neighbor_filter_list_cmd);
10530 install_element (BGP_IPV4M_NODE, &neighbor_filter_list_cmd);
10531 install_element (BGP_IPV4M_NODE, &no_neighbor_filter_list_cmd);
10532 install_element (BGP_IPV6_NODE, &neighbor_filter_list_cmd);
10533 install_element (BGP_IPV6_NODE, &no_neighbor_filter_list_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010534 install_element (BGP_IPV6M_NODE, &neighbor_filter_list_cmd);
10535 install_element (BGP_IPV6M_NODE, &no_neighbor_filter_list_cmd);
paul718e3742002-12-13 20:15:29 +000010536 install_element (BGP_VPNV4_NODE, &neighbor_filter_list_cmd);
10537 install_element (BGP_VPNV4_NODE, &no_neighbor_filter_list_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010538 install_element (BGP_VPNV6_NODE, &neighbor_filter_list_cmd);
10539 install_element (BGP_VPNV6_NODE, &no_neighbor_filter_list_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010540 install_element (BGP_ENCAP_NODE, &neighbor_filter_list_cmd);
10541 install_element (BGP_ENCAP_NODE, &no_neighbor_filter_list_cmd);
10542 install_element (BGP_ENCAPV6_NODE, &neighbor_filter_list_cmd);
10543 install_element (BGP_ENCAPV6_NODE, &no_neighbor_filter_list_cmd);
paul718e3742002-12-13 20:15:29 +000010544
10545 /* "neighbor route-map" commands. */
10546 install_element (BGP_NODE, &neighbor_route_map_cmd);
10547 install_element (BGP_NODE, &no_neighbor_route_map_cmd);
10548 install_element (BGP_IPV4_NODE, &neighbor_route_map_cmd);
10549 install_element (BGP_IPV4_NODE, &no_neighbor_route_map_cmd);
10550 install_element (BGP_IPV4M_NODE, &neighbor_route_map_cmd);
10551 install_element (BGP_IPV4M_NODE, &no_neighbor_route_map_cmd);
10552 install_element (BGP_IPV6_NODE, &neighbor_route_map_cmd);
10553 install_element (BGP_IPV6_NODE, &no_neighbor_route_map_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010554 install_element (BGP_IPV6M_NODE, &neighbor_route_map_cmd);
10555 install_element (BGP_IPV6M_NODE, &no_neighbor_route_map_cmd);
paul718e3742002-12-13 20:15:29 +000010556 install_element (BGP_VPNV4_NODE, &neighbor_route_map_cmd);
10557 install_element (BGP_VPNV4_NODE, &no_neighbor_route_map_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010558 install_element (BGP_VPNV6_NODE, &neighbor_route_map_cmd);
10559 install_element (BGP_VPNV6_NODE, &no_neighbor_route_map_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010560 install_element (BGP_ENCAP_NODE, &neighbor_route_map_cmd);
10561 install_element (BGP_ENCAP_NODE, &no_neighbor_route_map_cmd);
10562 install_element (BGP_ENCAPV6_NODE, &neighbor_route_map_cmd);
10563 install_element (BGP_ENCAPV6_NODE, &no_neighbor_route_map_cmd);
paul718e3742002-12-13 20:15:29 +000010564
10565 /* "neighbor unsuppress-map" commands. */
10566 install_element (BGP_NODE, &neighbor_unsuppress_map_cmd);
10567 install_element (BGP_NODE, &no_neighbor_unsuppress_map_cmd);
10568 install_element (BGP_IPV4_NODE, &neighbor_unsuppress_map_cmd);
10569 install_element (BGP_IPV4_NODE, &no_neighbor_unsuppress_map_cmd);
10570 install_element (BGP_IPV4M_NODE, &neighbor_unsuppress_map_cmd);
10571 install_element (BGP_IPV4M_NODE, &no_neighbor_unsuppress_map_cmd);
10572 install_element (BGP_IPV6_NODE, &neighbor_unsuppress_map_cmd);
10573 install_element (BGP_IPV6_NODE, &no_neighbor_unsuppress_map_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010574 install_element (BGP_IPV6M_NODE, &neighbor_unsuppress_map_cmd);
10575 install_element (BGP_IPV6M_NODE, &no_neighbor_unsuppress_map_cmd);
paula58545b2003-07-12 21:43:01 +000010576 install_element (BGP_VPNV4_NODE, &neighbor_unsuppress_map_cmd);
Lou Berger82dd7072016-01-12 13:41:57 -050010577 install_element (BGP_VPNV4_NODE, &no_neighbor_unsuppress_map_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010578 install_element (BGP_VPNV6_NODE, &neighbor_unsuppress_map_cmd);
Lou Berger82dd7072016-01-12 13:41:57 -050010579 install_element (BGP_VPNV6_NODE, &no_neighbor_unsuppress_map_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010580 install_element (BGP_ENCAP_NODE, &neighbor_unsuppress_map_cmd);
10581 install_element (BGP_ENCAP_NODE, &no_neighbor_unsuppress_map_cmd);
10582 install_element (BGP_ENCAPV6_NODE, &neighbor_unsuppress_map_cmd);
10583 install_element (BGP_ENCAPV6_NODE, &no_neighbor_unsuppress_map_cmd);
paul718e3742002-12-13 20:15:29 +000010584
10585 /* "neighbor maximum-prefix" commands. */
10586 install_element (BGP_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +000010587 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +000010588 install_element (BGP_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +000010589 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +000010590 install_element (BGP_NODE, &neighbor_maximum_prefix_restart_cmd);
10591 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010592 install_element (BGP_NODE, &no_neighbor_maximum_prefix_cmd);
10593 install_element (BGP_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +000010594 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10595 install_element (BGP_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10596 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10597 install_element (BGP_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10598 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010599 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +000010600 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +000010601 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +000010602 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +000010603 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_restart_cmd);
10604 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010605 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_cmd);
10606 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +000010607 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10608 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10609 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10610 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10611 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010612 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +000010613 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +000010614 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +000010615 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +000010616 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_restart_cmd);
10617 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010618 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_cmd);
10619 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +000010620 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10621 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10622 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10623 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10624 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010625 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +000010626 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +000010627 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +000010628 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +000010629 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_restart_cmd);
10630 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010631 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_cmd);
10632 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +000010633 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10634 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10635 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10636 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10637 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010638 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_cmd);
10639 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_cmd);
10640 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_warning_cmd);
10641 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
10642 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_restart_cmd);
10643 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
10644 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_cmd);
10645 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_val_cmd);
10646 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10647 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10648 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10649 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10650 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010651 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +000010652 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +000010653 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +000010654 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +000010655 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_restart_cmd);
10656 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010657 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_cmd);
10658 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +000010659 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10660 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10661 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10662 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10663 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010664
Lou Berger13c378d2016-01-12 13:41:56 -050010665 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_cmd);
10666 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_threshold_cmd);
10667 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_warning_cmd);
10668 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
10669 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_restart_cmd);
10670 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
10671 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_cmd);
10672 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_val_cmd);
10673 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10674 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10675 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10676 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10677 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
10678
Lou Bergera3fda882016-01-12 13:42:04 -050010679 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_cmd);
10680 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_threshold_cmd);
10681 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_warning_cmd);
10682 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
10683 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_restart_cmd);
10684 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
10685 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_cmd);
10686 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_val_cmd);
10687 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10688 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10689 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10690 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10691 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
10692
10693 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_cmd);
10694 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_threshold_cmd);
10695 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_warning_cmd);
10696 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
10697 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_restart_cmd);
10698 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
10699 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_cmd);
10700 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_val_cmd);
10701 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10702 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10703 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10704 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10705 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
10706
paul718e3742002-12-13 20:15:29 +000010707 /* "neighbor allowas-in" */
10708 install_element (BGP_NODE, &neighbor_allowas_in_cmd);
10709 install_element (BGP_NODE, &neighbor_allowas_in_arg_cmd);
10710 install_element (BGP_NODE, &no_neighbor_allowas_in_cmd);
10711 install_element (BGP_IPV4_NODE, &neighbor_allowas_in_cmd);
10712 install_element (BGP_IPV4_NODE, &neighbor_allowas_in_arg_cmd);
10713 install_element (BGP_IPV4_NODE, &no_neighbor_allowas_in_cmd);
10714 install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_cmd);
10715 install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_arg_cmd);
10716 install_element (BGP_IPV4M_NODE, &no_neighbor_allowas_in_cmd);
10717 install_element (BGP_IPV6_NODE, &neighbor_allowas_in_cmd);
10718 install_element (BGP_IPV6_NODE, &neighbor_allowas_in_arg_cmd);
10719 install_element (BGP_IPV6_NODE, &no_neighbor_allowas_in_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010720 install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_cmd);
10721 install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_arg_cmd);
10722 install_element (BGP_IPV6M_NODE, &no_neighbor_allowas_in_cmd);
paul718e3742002-12-13 20:15:29 +000010723 install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_cmd);
10724 install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_arg_cmd);
10725 install_element (BGP_VPNV4_NODE, &no_neighbor_allowas_in_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010726 install_element (BGP_VPNV6_NODE, &neighbor_allowas_in_cmd);
10727 install_element (BGP_VPNV6_NODE, &neighbor_allowas_in_arg_cmd);
10728 install_element (BGP_VPNV6_NODE, &no_neighbor_allowas_in_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010729 install_element (BGP_ENCAP_NODE, &neighbor_allowas_in_cmd);
10730 install_element (BGP_ENCAP_NODE, &neighbor_allowas_in_arg_cmd);
10731 install_element (BGP_ENCAP_NODE, &no_neighbor_allowas_in_cmd);
10732 install_element (BGP_ENCAPV6_NODE, &neighbor_allowas_in_cmd);
10733 install_element (BGP_ENCAPV6_NODE, &neighbor_allowas_in_arg_cmd);
10734 install_element (BGP_ENCAPV6_NODE, &no_neighbor_allowas_in_cmd);
paul718e3742002-12-13 20:15:29 +000010735
10736 /* address-family commands. */
10737 install_element (BGP_NODE, &address_family_ipv4_cmd);
10738 install_element (BGP_NODE, &address_family_ipv4_safi_cmd);
paul718e3742002-12-13 20:15:29 +000010739 install_element (BGP_NODE, &address_family_ipv6_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010740 install_element (BGP_NODE, &address_family_ipv6_safi_cmd);
paul718e3742002-12-13 20:15:29 +000010741 install_element (BGP_NODE, &address_family_vpnv4_cmd);
10742 install_element (BGP_NODE, &address_family_vpnv4_unicast_cmd);
10743
Lou Berger13c378d2016-01-12 13:41:56 -050010744 install_element (BGP_NODE, &address_family_vpnv6_cmd);
10745 install_element (BGP_NODE, &address_family_vpnv6_unicast_cmd);
10746
Lou Bergera3fda882016-01-12 13:42:04 -050010747 install_element (BGP_NODE, &address_family_encap_cmd);
10748 install_element (BGP_NODE, &address_family_encapv4_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010749 install_element (BGP_NODE, &address_family_encapv6_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010750
paul718e3742002-12-13 20:15:29 +000010751 /* "exit-address-family" command. */
10752 install_element (BGP_IPV4_NODE, &exit_address_family_cmd);
10753 install_element (BGP_IPV4M_NODE, &exit_address_family_cmd);
10754 install_element (BGP_IPV6_NODE, &exit_address_family_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010755 install_element (BGP_IPV6M_NODE, &exit_address_family_cmd);
paul718e3742002-12-13 20:15:29 +000010756 install_element (BGP_VPNV4_NODE, &exit_address_family_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010757 install_element (BGP_VPNV6_NODE, &exit_address_family_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010758 install_element (BGP_ENCAP_NODE, &exit_address_family_cmd);
10759 install_element (BGP_ENCAPV6_NODE, &exit_address_family_cmd);
paul718e3742002-12-13 20:15:29 +000010760
10761 /* "clear ip bgp commands" */
10762 install_element (ENABLE_NODE, &clear_ip_bgp_all_cmd);
10763 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_cmd);
10764 install_element (ENABLE_NODE, &clear_ip_bgp_as_cmd);
10765 install_element (ENABLE_NODE, &clear_ip_bgp_peer_cmd);
10766 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_cmd);
10767 install_element (ENABLE_NODE, &clear_ip_bgp_external_cmd);
paul718e3742002-12-13 20:15:29 +000010768 install_element (ENABLE_NODE, &clear_bgp_all_cmd);
10769 install_element (ENABLE_NODE, &clear_bgp_instance_all_cmd);
10770 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_cmd);
10771 install_element (ENABLE_NODE, &clear_bgp_peer_cmd);
10772 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_cmd);
10773 install_element (ENABLE_NODE, &clear_bgp_peer_group_cmd);
10774 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_cmd);
10775 install_element (ENABLE_NODE, &clear_bgp_external_cmd);
10776 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_cmd);
10777 install_element (ENABLE_NODE, &clear_bgp_as_cmd);
10778 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_cmd);
paul718e3742002-12-13 20:15:29 +000010779
10780 /* "clear ip bgp neighbor soft in" */
10781 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_in_cmd);
10782 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_in_cmd);
10783 install_element (ENABLE_NODE, &clear_ip_bgp_all_in_cmd);
10784 install_element (ENABLE_NODE, &clear_ip_bgp_all_in_prefix_filter_cmd);
10785 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_in_prefix_filter_cmd);
10786 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_in_cmd);
10787 install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_cmd);
10788 install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_prefix_filter_cmd);
10789 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_in_cmd);
10790 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_cmd);
10791 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_prefix_filter_cmd);
10792 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_in_cmd);
10793 install_element (ENABLE_NODE, &clear_ip_bgp_external_in_cmd);
10794 install_element (ENABLE_NODE, &clear_ip_bgp_external_in_prefix_filter_cmd);
10795 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_in_cmd);
10796 install_element (ENABLE_NODE, &clear_ip_bgp_as_in_cmd);
10797 install_element (ENABLE_NODE, &clear_ip_bgp_as_in_prefix_filter_cmd);
10798 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_in_cmd);
10799 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_in_cmd);
10800 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_cmd);
10801 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_prefix_filter_cmd);
10802 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd);
10803 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_in_cmd);
10804 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_cmd);
10805 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd);
10806 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_in_cmd);
10807 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_cmd);
10808 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd);
10809 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_in_cmd);
10810 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_cmd);
10811 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_prefix_filter_cmd);
10812 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_in_cmd);
10813 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_cmd);
10814 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_prefix_filter_cmd);
10815 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_in_cmd);
10816 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_in_cmd);
10817 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_in_cmd);
10818 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_in_cmd);
10819 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_in_cmd);
10820 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_in_cmd);
Lou Berger298cc2f2016-01-12 13:42:02 -050010821 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_soft_in_cmd);
10822 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_in_cmd);
10823 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_soft_in_cmd);
10824 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_in_cmd);
10825 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_soft_in_cmd);
10826 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_in_cmd);
paul718e3742002-12-13 20:15:29 +000010827 install_element (ENABLE_NODE, &clear_bgp_all_soft_in_cmd);
10828 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_in_cmd);
10829 install_element (ENABLE_NODE, &clear_bgp_all_in_cmd);
10830 install_element (ENABLE_NODE, &clear_bgp_all_in_prefix_filter_cmd);
10831 install_element (ENABLE_NODE, &clear_bgp_peer_soft_in_cmd);
10832 install_element (ENABLE_NODE, &clear_bgp_peer_in_cmd);
10833 install_element (ENABLE_NODE, &clear_bgp_peer_in_prefix_filter_cmd);
10834 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_in_cmd);
10835 install_element (ENABLE_NODE, &clear_bgp_peer_group_in_cmd);
10836 install_element (ENABLE_NODE, &clear_bgp_peer_group_in_prefix_filter_cmd);
10837 install_element (ENABLE_NODE, &clear_bgp_external_soft_in_cmd);
10838 install_element (ENABLE_NODE, &clear_bgp_external_in_cmd);
10839 install_element (ENABLE_NODE, &clear_bgp_external_in_prefix_filter_cmd);
10840 install_element (ENABLE_NODE, &clear_bgp_as_soft_in_cmd);
10841 install_element (ENABLE_NODE, &clear_bgp_as_in_cmd);
10842 install_element (ENABLE_NODE, &clear_bgp_as_in_prefix_filter_cmd);
10843 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_in_cmd);
10844 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_cmd);
10845 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_prefix_filter_cmd);
10846 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_in_cmd);
10847 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_cmd);
10848 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_prefix_filter_cmd);
10849 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_in_cmd);
10850 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_cmd);
10851 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_prefix_filter_cmd);
10852 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_in_cmd);
10853 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_cmd);
10854 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_prefix_filter_cmd);
10855 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_in_cmd);
10856 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_cmd);
10857 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_prefix_filter_cmd);
paul718e3742002-12-13 20:15:29 +000010858
10859 /* "clear ip bgp neighbor soft out" */
10860 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_out_cmd);
10861 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_out_cmd);
10862 install_element (ENABLE_NODE, &clear_ip_bgp_all_out_cmd);
10863 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_out_cmd);
10864 install_element (ENABLE_NODE, &clear_ip_bgp_peer_out_cmd);
10865 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_out_cmd);
10866 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_out_cmd);
10867 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_out_cmd);
10868 install_element (ENABLE_NODE, &clear_ip_bgp_external_out_cmd);
10869 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_out_cmd);
10870 install_element (ENABLE_NODE, &clear_ip_bgp_as_out_cmd);
10871 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_out_cmd);
10872 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_out_cmd);
10873 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_out_cmd);
10874 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_out_cmd);
10875 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_out_cmd);
10876 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_out_cmd);
10877 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_out_cmd);
10878 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_out_cmd);
10879 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_out_cmd);
10880 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_out_cmd);
10881 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_out_cmd);
10882 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_out_cmd);
10883 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_out_cmd);
10884 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_out_cmd);
10885 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_out_cmd);
10886 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_out_cmd);
10887 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_out_cmd);
Lou Berger298cc2f2016-01-12 13:42:02 -050010888 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_soft_out_cmd);
10889 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_out_cmd);
10890 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_soft_out_cmd);
10891 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_out_cmd);
10892 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_soft_out_cmd);
10893 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_out_cmd);
paul718e3742002-12-13 20:15:29 +000010894 install_element (ENABLE_NODE, &clear_bgp_all_soft_out_cmd);
10895 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_out_cmd);
10896 install_element (ENABLE_NODE, &clear_bgp_all_out_cmd);
10897 install_element (ENABLE_NODE, &clear_bgp_peer_soft_out_cmd);
10898 install_element (ENABLE_NODE, &clear_bgp_peer_out_cmd);
10899 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_out_cmd);
10900 install_element (ENABLE_NODE, &clear_bgp_peer_group_out_cmd);
10901 install_element (ENABLE_NODE, &clear_bgp_external_soft_out_cmd);
10902 install_element (ENABLE_NODE, &clear_bgp_external_out_cmd);
10903 install_element (ENABLE_NODE, &clear_bgp_as_soft_out_cmd);
10904 install_element (ENABLE_NODE, &clear_bgp_as_out_cmd);
10905 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_out_cmd);
10906 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_out_cmd);
10907 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_out_cmd);
10908 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_out_cmd);
10909 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_out_cmd);
10910 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_out_cmd);
10911 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_out_cmd);
10912 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_out_cmd);
10913 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_out_cmd);
10914 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_out_cmd);
paul718e3742002-12-13 20:15:29 +000010915
10916 /* "clear ip bgp neighbor soft" */
10917 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_cmd);
10918 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_cmd);
10919 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_cmd);
10920 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_cmd);
10921 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_cmd);
10922 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_cmd);
10923 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_cmd);
10924 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_cmd);
10925 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_cmd);
10926 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_cmd);
10927 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_cmd);
10928 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_cmd);
10929 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_cmd);
10930 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_cmd);
10931 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_cmd);
Lou Berger298cc2f2016-01-12 13:42:02 -050010932 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_soft_cmd);
10933 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_soft_cmd);
10934 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_soft_cmd);
paul718e3742002-12-13 20:15:29 +000010935 install_element (ENABLE_NODE, &clear_bgp_all_soft_cmd);
10936 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_cmd);
10937 install_element (ENABLE_NODE, &clear_bgp_peer_soft_cmd);
10938 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_cmd);
10939 install_element (ENABLE_NODE, &clear_bgp_external_soft_cmd);
10940 install_element (ENABLE_NODE, &clear_bgp_as_soft_cmd);
10941 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_cmd);
10942 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_cmd);
10943 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_cmd);
10944 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_cmd);
10945 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_cmd);
paul718e3742002-12-13 20:15:29 +000010946
paulfee0f4c2004-09-13 05:12:46 +000010947 /* "clear ip bgp neighbor rsclient" */
10948 install_element (ENABLE_NODE, &clear_ip_bgp_all_rsclient_cmd);
10949 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_rsclient_cmd);
10950 install_element (ENABLE_NODE, &clear_ip_bgp_peer_rsclient_cmd);
10951 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_rsclient_cmd);
paulfee0f4c2004-09-13 05:12:46 +000010952 install_element (ENABLE_NODE, &clear_bgp_all_rsclient_cmd);
10953 install_element (ENABLE_NODE, &clear_bgp_instance_all_rsclient_cmd);
10954 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_rsclient_cmd);
10955 install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_all_rsclient_cmd);
10956 install_element (ENABLE_NODE, &clear_bgp_peer_rsclient_cmd);
10957 install_element (ENABLE_NODE, &clear_bgp_instance_peer_rsclient_cmd);
10958 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_rsclient_cmd);
10959 install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_peer_rsclient_cmd);
paulfee0f4c2004-09-13 05:12:46 +000010960
paul718e3742002-12-13 20:15:29 +000010961 /* "show ip bgp summary" commands. */
paul718e3742002-12-13 20:15:29 +000010962 install_element (VIEW_NODE, &show_bgp_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050010963 install_element (RESTRICTED_NODE, &show_bgp_summary_cmd);
10964 install_element (ENABLE_NODE, &show_bgp_summary_cmd);
10965
10966 install_element (VIEW_NODE, &show_bgp_summary_1w_cmd);
10967 install_element (RESTRICTED_NODE, &show_bgp_summary_1w_cmd);
10968 install_element (ENABLE_NODE, &show_bgp_summary_1w_cmd);
10969
10970 install_element (VIEW_NODE, &show_bgp_ipv4_safi_summary_cmd);
10971 install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_summary_cmd);
10972 install_element (VIEW_NODE, &show_bgp_instance_ipv4_summary_cmd);
10973
10974 install_element (VIEW_NODE, &show_bgp_ipv4_vpn_summary_cmd);
10975 install_element (VIEW_NODE, &show_bgp_ipv4_encap_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050010976 install_element (VIEW_NODE, &show_bgp_ipv6_vpn_summary_cmd);
10977 install_element (VIEW_NODE, &show_bgp_ipv6_encap_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050010978
paul718e3742002-12-13 20:15:29 +000010979 install_element (VIEW_NODE, &show_bgp_instance_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010980 install_element (VIEW_NODE, &show_bgp_ipv6_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010981 install_element (VIEW_NODE, &show_bgp_instance_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010982 install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010983 install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050010984 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010985 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050010986
10987 install_element (RESTRICTED_NODE, &show_bgp_ipv4_vpn_summary_cmd);
10988 install_element (RESTRICTED_NODE, &show_bgp_ipv4_encap_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050010989 install_element (RESTRICTED_NODE, &show_bgp_ipv6_vpn_summary_cmd);
10990 install_element (RESTRICTED_NODE, &show_bgp_ipv6_encap_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050010991
Paul Jakma62687ff2008-08-23 14:27:06 +010010992 install_element (RESTRICTED_NODE, &show_bgp_instance_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010993 install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010994 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010995 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010996 install_element (ENABLE_NODE, &show_bgp_ipv4_safi_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050010997 install_element (ENABLE_NODE, &show_bgp_instance_ipv4_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010998 install_element (ENABLE_NODE, &show_bgp_instance_ipv4_safi_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050010999
11000 install_element (ENABLE_NODE, &show_bgp_ipv4_vpn_summary_cmd);
11001 install_element (ENABLE_NODE, &show_bgp_ipv4_encap_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011002 install_element (ENABLE_NODE, &show_bgp_ipv6_vpn_summary_cmd);
11003 install_element (ENABLE_NODE, &show_bgp_ipv6_encap_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011004
paul718e3742002-12-13 20:15:29 +000011005 install_element (ENABLE_NODE, &show_bgp_instance_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040011006 install_element (ENABLE_NODE, &show_bgp_ipv6_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000011007 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040011008 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000011009
11010 /* "show ip bgp neighbors" commands. */
paulbb46e942003-10-24 19:02:03 +000011011 install_element (VIEW_NODE, &show_bgp_instance_neighbors_cmd);
paulbb46e942003-10-24 19:02:03 +000011012 install_element (ENABLE_NODE, &show_bgp_instance_neighbors_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011013
11014 install_element (VIEW_NODE, &show_bgp_neighbors_cmd);
11015 install_element (VIEW_NODE, &show_bgp_neighbors_peer_cmd);
11016 install_element (VIEW_NODE, &show_bgp_instance_neighbors_peer_cmd);
11017 install_element (RESTRICTED_NODE, &show_bgp_neighbors_peer_cmd);
11018 install_element (RESTRICTED_NODE, &show_bgp_instance_neighbors_peer_cmd);
11019 install_element (ENABLE_NODE, &show_bgp_neighbors_cmd);
11020 install_element (ENABLE_NODE, &show_bgp_neighbors_peer_cmd);
paulbb46e942003-10-24 19:02:03 +000011021 install_element (ENABLE_NODE, &show_bgp_instance_neighbors_peer_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011022 install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_cmd);
11023 install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
11024 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
11025 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_cmd);
paulbb46e942003-10-24 19:02:03 +000011026 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
paul718e3742002-12-13 20:15:29 +000011027
paulfee0f4c2004-09-13 05:12:46 +000011028 /* "show ip bgp rsclient" commands. */
Michael Lambert95cbbd22010-07-23 14:43:04 -040011029 install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd);
11030 install_element (VIEW_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040011031 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd);
11032 install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040011033 install_element (ENABLE_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd);
11034 install_element (ENABLE_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000011035
paulfee0f4c2004-09-13 05:12:46 +000011036 install_element (VIEW_NODE, &show_bgp_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000011037 install_element (VIEW_NODE, &show_bgp_instance_rsclient_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011038 install_element (RESTRICTED_NODE, &show_bgp_rsclient_summary_cmd);
11039 install_element (RESTRICTED_NODE, &show_bgp_instance_rsclient_summary_cmd);
11040 install_element (ENABLE_NODE, &show_bgp_rsclient_summary_cmd);
11041 install_element (ENABLE_NODE, &show_bgp_instance_rsclient_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011042 install_element (VIEW_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000011043 install_element (VIEW_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040011044 install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd);
11045 install_element (VIEW_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010011046 install_element (RESTRICTED_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010011047 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040011048 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd);
11049 install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000011050 install_element (ENABLE_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000011051 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040011052 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd);
11053 install_element (ENABLE_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000011054
paul718e3742002-12-13 20:15:29 +000011055 /* "show ip bgp paths" commands. */
Lou Berger651b4022016-01-12 13:42:07 -050011056 install_element (VIEW_NODE, &show_bgp_ipv4_paths_cmd);
11057 install_element (ENABLE_NODE, &show_bgp_ipv4_paths_cmd);
paul718e3742002-12-13 20:15:29 +000011058
11059 /* "show ip bgp community" commands. */
11060 install_element (VIEW_NODE, &show_ip_bgp_community_info_cmd);
11061 install_element (ENABLE_NODE, &show_ip_bgp_community_info_cmd);
11062
11063 /* "show ip bgp attribute-info" commands. */
11064 install_element (VIEW_NODE, &show_ip_bgp_attr_info_cmd);
11065 install_element (ENABLE_NODE, &show_ip_bgp_attr_info_cmd);
11066
11067 /* "redistribute" commands. */
11068 install_element (BGP_NODE, &bgp_redistribute_ipv4_cmd);
11069 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_cmd);
11070 install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_cmd);
11071 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_cmd);
11072 install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_cmd);
11073 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_cmd);
11074 install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_metric_cmd);
11075 install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_rmap_cmd);
11076 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_metric_cmd);
11077 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_rmap_cmd);
paul718e3742002-12-13 20:15:29 +000011078 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_cmd);
11079 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_cmd);
11080 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_cmd);
11081 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_cmd);
11082 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_cmd);
11083 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_cmd);
11084 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_metric_cmd);
11085 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_rmap_cmd);
11086 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_metric_cmd);
11087 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_rmap_cmd);
paul718e3742002-12-13 20:15:29 +000011088
Nick Hilliardfa411a22011-03-23 15:33:17 +000011089 /* ttl_security commands */
11090 install_element (BGP_NODE, &neighbor_ttl_security_cmd);
11091 install_element (BGP_NODE, &no_neighbor_ttl_security_cmd);
11092
Paul Jakma4bf6a362006-03-30 14:05:23 +000011093 /* "show bgp memory" commands. */
11094 install_element (VIEW_NODE, &show_bgp_memory_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010011095 install_element (RESTRICTED_NODE, &show_bgp_memory_cmd);
Paul Jakma4bf6a362006-03-30 14:05:23 +000011096 install_element (ENABLE_NODE, &show_bgp_memory_cmd);
11097
Michael Lamberte0081f72008-11-16 20:12:04 +000011098 /* "show bgp views" commands. */
11099 install_element (VIEW_NODE, &show_bgp_views_cmd);
11100 install_element (RESTRICTED_NODE, &show_bgp_views_cmd);
11101 install_element (ENABLE_NODE, &show_bgp_views_cmd);
Lou Bergerf9b6c392016-01-12 13:42:09 -050011102
11103 /* non afi/safi forms of commands */
11104 install_element (VIEW_NODE, &show_ip_bgp_summary_cmd);
11105 install_element (VIEW_NODE, &show_ip_bgp_instance_summary_cmd);
11106 install_element (VIEW_NODE, &show_ip_bgp_ipv4_summary_cmd);
11107 install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
11108 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
11109 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
11110 install_element (VIEW_NODE, &show_bgp_ipv6_summary_cmd);
11111 install_element (RESTRICTED_NODE, &show_ip_bgp_summary_cmd);
11112 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_summary_cmd);
11113 install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_summary_cmd);
11114 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
11115 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
11116 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
11117 install_element (RESTRICTED_NODE, &show_bgp_ipv6_summary_cmd);
11118 install_element (ENABLE_NODE, &show_ip_bgp_summary_cmd);
11119 install_element (ENABLE_NODE, &show_ip_bgp_instance_summary_cmd);
11120 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_summary_cmd);
11121 install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
11122 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
11123 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
11124 install_element (ENABLE_NODE, &show_bgp_ipv6_summary_cmd);
11125 install_element (VIEW_NODE, &show_ip_bgp_neighbors_cmd);
11126 install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_cmd);
11127 install_element (VIEW_NODE, &show_ip_bgp_neighbors_peer_cmd);
11128 install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
11129 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd);
11130 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd);
11131 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
11132 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
11133 install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_cmd);
11134 install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
11135 install_element (RESTRICTED_NODE, &show_ip_bgp_neighbors_peer_cmd);
11136 install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
11137 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
11138 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
11139 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
11140 install_element (ENABLE_NODE, &show_ip_bgp_neighbors_cmd);
11141 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_cmd);
11142 install_element (ENABLE_NODE, &show_ip_bgp_neighbors_peer_cmd);
11143 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
11144 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd);
11145 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd);
11146 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
11147 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
11148 install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_cmd);
11149 install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
11150 install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_cmd);
11151 install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
11152 install_element (RESTRICTED_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
11153 install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_cmd);
11154 install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
11155 install_element (VIEW_NODE, &show_ipv6_bgp_summary_cmd);
11156 install_element (VIEW_NODE, &show_ipv6_mbgp_summary_cmd);
11157 install_element (ENABLE_NODE, &show_ipv6_bgp_summary_cmd);
11158 install_element (ENABLE_NODE, &show_ipv6_mbgp_summary_cmd);
11159 install_element (VIEW_NODE, &show_ip_bgp_rsclient_summary_cmd);
11160 install_element (VIEW_NODE, &show_ip_bgp_instance_rsclient_summary_cmd);
11161 install_element (VIEW_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd);
11162 install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd);
11163 install_element (RESTRICTED_NODE, &show_ip_bgp_rsclient_summary_cmd);
11164 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_rsclient_summary_cmd);
11165 install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd);
11166 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd);
11167 install_element (ENABLE_NODE, &show_ip_bgp_rsclient_summary_cmd);
11168 install_element (ENABLE_NODE, &show_ip_bgp_instance_rsclient_summary_cmd);
11169 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd);
11170 install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd);
11171 install_element (VIEW_NODE, &show_ip_bgp_paths_cmd);
11172 install_element (VIEW_NODE, &show_ip_bgp_ipv4_paths_cmd);
11173 install_element (ENABLE_NODE, &show_ip_bgp_paths_cmd);
11174 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_paths_cmd);
paul718e3742002-12-13 20:15:29 +000011175 /* Community-list. */
11176 community_list_vty ();
11177}
David Lamparter6b0655a2014-06-04 06:53:35 +020011178
paul718e3742002-12-13 20:15:29 +000011179#include "memory.h"
11180#include "bgp_regex.h"
11181#include "bgp_clist.h"
11182#include "bgp_ecommunity.h"
11183
11184/* VTY functions. */
11185
11186/* Direction value to string conversion. */
paul94f2b392005-06-28 12:44:16 +000011187static const char *
paul718e3742002-12-13 20:15:29 +000011188community_direct_str (int direct)
11189{
11190 switch (direct)
11191 {
11192 case COMMUNITY_DENY:
11193 return "deny";
paul718e3742002-12-13 20:15:29 +000011194 case COMMUNITY_PERMIT:
11195 return "permit";
paul718e3742002-12-13 20:15:29 +000011196 default:
11197 return "unknown";
paul718e3742002-12-13 20:15:29 +000011198 }
11199}
11200
11201/* Display error string. */
paul94f2b392005-06-28 12:44:16 +000011202static void
paul718e3742002-12-13 20:15:29 +000011203community_list_perror (struct vty *vty, int ret)
11204{
11205 switch (ret)
11206 {
11207 case COMMUNITY_LIST_ERR_CANT_FIND_LIST:
Denis Ovsienkob7292942010-12-08 18:51:37 +030011208 vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000011209 break;
11210 case COMMUNITY_LIST_ERR_MALFORMED_VAL:
11211 vty_out (vty, "%% Malformed community-list value%s", VTY_NEWLINE);
11212 break;
11213 case COMMUNITY_LIST_ERR_STANDARD_CONFLICT:
11214 vty_out (vty, "%% Community name conflict, previously defined as standard community%s", VTY_NEWLINE);
11215 break;
11216 case COMMUNITY_LIST_ERR_EXPANDED_CONFLICT:
11217 vty_out (vty, "%% Community name conflict, previously defined as expanded community%s", VTY_NEWLINE);
11218 break;
11219 }
11220}
11221
11222/* VTY interface for community_set() function. */
paul94f2b392005-06-28 12:44:16 +000011223static int
paulfd79ac92004-10-13 05:06:08 +000011224community_list_set_vty (struct vty *vty, int argc, const char **argv,
11225 int style, int reject_all_digit_name)
paul718e3742002-12-13 20:15:29 +000011226{
11227 int ret;
11228 int direct;
11229 char *str;
11230
11231 /* Check the list type. */
11232 if (strncmp (argv[1], "p", 1) == 0)
11233 direct = COMMUNITY_PERMIT;
11234 else if (strncmp (argv[1], "d", 1) == 0)
11235 direct = COMMUNITY_DENY;
11236 else
11237 {
11238 vty_out (vty, "%% Matching condition must be permit or deny%s",
11239 VTY_NEWLINE);
11240 return CMD_WARNING;
11241 }
11242
11243 /* All digit name check. */
11244 if (reject_all_digit_name && all_digit (argv[0]))
11245 {
11246 vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE);
11247 return CMD_WARNING;
11248 }
11249
11250 /* Concat community string argument. */
11251 if (argc > 1)
11252 str = argv_concat (argv, argc, 2);
11253 else
11254 str = NULL;
11255
11256 /* When community_list_set() return nevetive value, it means
11257 malformed community string. */
11258 ret = community_list_set (bgp_clist, argv[0], str, direct, style);
11259
11260 /* Free temporary community list string allocated by
11261 argv_concat(). */
11262 if (str)
11263 XFREE (MTYPE_TMP, str);
11264
11265 if (ret < 0)
11266 {
11267 /* Display error string. */
11268 community_list_perror (vty, ret);
11269 return CMD_WARNING;
11270 }
11271
11272 return CMD_SUCCESS;
11273}
11274
paul718e3742002-12-13 20:15:29 +000011275/* Communiyt-list entry delete. */
paul94f2b392005-06-28 12:44:16 +000011276static int
hassofee6e4e2005-02-02 16:29:31 +000011277community_list_unset_vty (struct vty *vty, int argc, const char **argv,
11278 int style)
paul718e3742002-12-13 20:15:29 +000011279{
11280 int ret;
hassofee6e4e2005-02-02 16:29:31 +000011281 int direct = 0;
11282 char *str = NULL;
paul718e3742002-12-13 20:15:29 +000011283
hassofee6e4e2005-02-02 16:29:31 +000011284 if (argc > 1)
paul718e3742002-12-13 20:15:29 +000011285 {
hassofee6e4e2005-02-02 16:29:31 +000011286 /* Check the list direct. */
11287 if (strncmp (argv[1], "p", 1) == 0)
11288 direct = COMMUNITY_PERMIT;
11289 else if (strncmp (argv[1], "d", 1) == 0)
11290 direct = COMMUNITY_DENY;
11291 else
11292 {
11293 vty_out (vty, "%% Matching condition must be permit or deny%s",
11294 VTY_NEWLINE);
11295 return CMD_WARNING;
11296 }
paul718e3742002-12-13 20:15:29 +000011297
hassofee6e4e2005-02-02 16:29:31 +000011298 /* Concat community string argument. */
11299 str = argv_concat (argv, argc, 2);
11300 }
paul718e3742002-12-13 20:15:29 +000011301
11302 /* Unset community list. */
11303 ret = community_list_unset (bgp_clist, argv[0], str, direct, style);
11304
11305 /* Free temporary community list string allocated by
11306 argv_concat(). */
hassofee6e4e2005-02-02 16:29:31 +000011307 if (str)
11308 XFREE (MTYPE_TMP, str);
paul718e3742002-12-13 20:15:29 +000011309
11310 if (ret < 0)
11311 {
11312 community_list_perror (vty, ret);
11313 return CMD_WARNING;
11314 }
11315
11316 return CMD_SUCCESS;
11317}
11318
11319/* "community-list" keyword help string. */
11320#define COMMUNITY_LIST_STR "Add a community list entry\n"
11321#define COMMUNITY_VAL_STR "Community number in aa:nn format or internet|local-AS|no-advertise|no-export\n"
11322
paul718e3742002-12-13 20:15:29 +000011323DEFUN (ip_community_list_standard,
11324 ip_community_list_standard_cmd,
11325 "ip community-list <1-99> (deny|permit) .AA:NN",
11326 IP_STR
11327 COMMUNITY_LIST_STR
11328 "Community list number (standard)\n"
11329 "Specify community to reject\n"
11330 "Specify community to accept\n"
11331 COMMUNITY_VAL_STR)
11332{
11333 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0);
11334}
11335
11336ALIAS (ip_community_list_standard,
11337 ip_community_list_standard2_cmd,
11338 "ip community-list <1-99> (deny|permit)",
11339 IP_STR
11340 COMMUNITY_LIST_STR
11341 "Community list number (standard)\n"
11342 "Specify community to reject\n"
11343 "Specify community to accept\n")
11344
11345DEFUN (ip_community_list_expanded,
11346 ip_community_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000011347 "ip community-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000011348 IP_STR
11349 COMMUNITY_LIST_STR
11350 "Community list number (expanded)\n"
11351 "Specify community to reject\n"
11352 "Specify community to accept\n"
11353 "An ordered list as a regular-expression\n")
11354{
11355 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0);
11356}
11357
11358DEFUN (ip_community_list_name_standard,
11359 ip_community_list_name_standard_cmd,
11360 "ip community-list standard WORD (deny|permit) .AA:NN",
11361 IP_STR
11362 COMMUNITY_LIST_STR
11363 "Add a standard community-list entry\n"
11364 "Community list name\n"
11365 "Specify community to reject\n"
11366 "Specify community to accept\n"
11367 COMMUNITY_VAL_STR)
11368{
11369 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1);
11370}
11371
11372ALIAS (ip_community_list_name_standard,
11373 ip_community_list_name_standard2_cmd,
11374 "ip community-list standard WORD (deny|permit)",
11375 IP_STR
11376 COMMUNITY_LIST_STR
11377 "Add a standard community-list entry\n"
11378 "Community list name\n"
11379 "Specify community to reject\n"
11380 "Specify community to accept\n")
11381
11382DEFUN (ip_community_list_name_expanded,
11383 ip_community_list_name_expanded_cmd,
11384 "ip community-list expanded WORD (deny|permit) .LINE",
11385 IP_STR
11386 COMMUNITY_LIST_STR
11387 "Add an expanded community-list entry\n"
11388 "Community list name\n"
11389 "Specify community to reject\n"
11390 "Specify community to accept\n"
11391 "An ordered list as a regular-expression\n")
11392{
11393 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1);
11394}
11395
hassofee6e4e2005-02-02 16:29:31 +000011396DEFUN (no_ip_community_list_standard_all,
11397 no_ip_community_list_standard_all_cmd,
11398 "no ip community-list <1-99>",
paul718e3742002-12-13 20:15:29 +000011399 NO_STR
11400 IP_STR
11401 COMMUNITY_LIST_STR
hassofee6e4e2005-02-02 16:29:31 +000011402 "Community list number (standard)\n")
paul718e3742002-12-13 20:15:29 +000011403{
hassofee6e4e2005-02-02 16:29:31 +000011404 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
paul718e3742002-12-13 20:15:29 +000011405}
11406
hassofee6e4e2005-02-02 16:29:31 +000011407DEFUN (no_ip_community_list_expanded_all,
11408 no_ip_community_list_expanded_all_cmd,
11409 "no ip community-list <100-500>",
11410 NO_STR
11411 IP_STR
11412 COMMUNITY_LIST_STR
11413 "Community list number (expanded)\n")
11414{
11415 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
11416}
11417
11418DEFUN (no_ip_community_list_name_standard_all,
11419 no_ip_community_list_name_standard_all_cmd,
11420 "no ip community-list standard WORD",
paul718e3742002-12-13 20:15:29 +000011421 NO_STR
11422 IP_STR
11423 COMMUNITY_LIST_STR
11424 "Add a standard community-list entry\n"
paul718e3742002-12-13 20:15:29 +000011425 "Community list name\n")
11426{
hassofee6e4e2005-02-02 16:29:31 +000011427 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
paul718e3742002-12-13 20:15:29 +000011428}
11429
hassofee6e4e2005-02-02 16:29:31 +000011430DEFUN (no_ip_community_list_name_expanded_all,
11431 no_ip_community_list_name_expanded_all_cmd,
11432 "no ip community-list expanded WORD",
paul718e3742002-12-13 20:15:29 +000011433 NO_STR
11434 IP_STR
11435 COMMUNITY_LIST_STR
hassofee6e4e2005-02-02 16:29:31 +000011436 "Add an expanded community-list entry\n"
11437 "Community list name\n")
paul718e3742002-12-13 20:15:29 +000011438{
hassofee6e4e2005-02-02 16:29:31 +000011439 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
paul718e3742002-12-13 20:15:29 +000011440}
11441
11442DEFUN (no_ip_community_list_standard,
11443 no_ip_community_list_standard_cmd,
11444 "no ip community-list <1-99> (deny|permit) .AA:NN",
11445 NO_STR
11446 IP_STR
11447 COMMUNITY_LIST_STR
11448 "Community list number (standard)\n"
11449 "Specify community to reject\n"
11450 "Specify community to accept\n"
11451 COMMUNITY_VAL_STR)
11452{
11453 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
11454}
11455
11456DEFUN (no_ip_community_list_expanded,
11457 no_ip_community_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000011458 "no ip community-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000011459 NO_STR
11460 IP_STR
11461 COMMUNITY_LIST_STR
11462 "Community list number (expanded)\n"
11463 "Specify community to reject\n"
11464 "Specify community to accept\n"
11465 "An ordered list as a regular-expression\n")
11466{
11467 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
11468}
11469
11470DEFUN (no_ip_community_list_name_standard,
11471 no_ip_community_list_name_standard_cmd,
11472 "no ip community-list standard WORD (deny|permit) .AA:NN",
11473 NO_STR
11474 IP_STR
11475 COMMUNITY_LIST_STR
11476 "Specify a standard community-list\n"
11477 "Community list name\n"
11478 "Specify community to reject\n"
11479 "Specify community to accept\n"
11480 COMMUNITY_VAL_STR)
11481{
11482 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
11483}
11484
11485DEFUN (no_ip_community_list_name_expanded,
11486 no_ip_community_list_name_expanded_cmd,
11487 "no ip community-list expanded WORD (deny|permit) .LINE",
11488 NO_STR
11489 IP_STR
11490 COMMUNITY_LIST_STR
11491 "Specify an expanded community-list\n"
11492 "Community list name\n"
11493 "Specify community to reject\n"
11494 "Specify community to accept\n"
11495 "An ordered list as a regular-expression\n")
11496{
11497 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
11498}
11499
paul94f2b392005-06-28 12:44:16 +000011500static void
paul718e3742002-12-13 20:15:29 +000011501community_list_show (struct vty *vty, struct community_list *list)
11502{
11503 struct community_entry *entry;
11504
11505 for (entry = list->head; entry; entry = entry->next)
11506 {
11507 if (entry == list->head)
11508 {
11509 if (all_digit (list->name))
11510 vty_out (vty, "Community %s list %s%s",
11511 entry->style == COMMUNITY_LIST_STANDARD ?
11512 "standard" : "(expanded) access",
11513 list->name, VTY_NEWLINE);
11514 else
11515 vty_out (vty, "Named Community %s list %s%s",
11516 entry->style == COMMUNITY_LIST_STANDARD ?
11517 "standard" : "expanded",
11518 list->name, VTY_NEWLINE);
11519 }
11520 if (entry->any)
11521 vty_out (vty, " %s%s",
11522 community_direct_str (entry->direct), VTY_NEWLINE);
11523 else
11524 vty_out (vty, " %s %s%s",
11525 community_direct_str (entry->direct),
11526 entry->style == COMMUNITY_LIST_STANDARD
11527 ? community_str (entry->u.com) : entry->config,
11528 VTY_NEWLINE);
11529 }
11530}
11531
11532DEFUN (show_ip_community_list,
11533 show_ip_community_list_cmd,
11534 "show ip community-list",
11535 SHOW_STR
11536 IP_STR
11537 "List community-list\n")
11538{
11539 struct community_list *list;
11540 struct community_list_master *cm;
11541
hassofee6e4e2005-02-02 16:29:31 +000011542 cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011543 if (! cm)
11544 return CMD_SUCCESS;
11545
11546 for (list = cm->num.head; list; list = list->next)
11547 community_list_show (vty, list);
11548
11549 for (list = cm->str.head; list; list = list->next)
11550 community_list_show (vty, list);
11551
11552 return CMD_SUCCESS;
11553}
11554
11555DEFUN (show_ip_community_list_arg,
11556 show_ip_community_list_arg_cmd,
hassofee6e4e2005-02-02 16:29:31 +000011557 "show ip community-list (<1-500>|WORD)",
paul718e3742002-12-13 20:15:29 +000011558 SHOW_STR
11559 IP_STR
11560 "List community-list\n"
11561 "Community-list number\n"
11562 "Community-list name\n")
11563{
11564 struct community_list *list;
11565
hassofee6e4e2005-02-02 16:29:31 +000011566 list = community_list_lookup (bgp_clist, argv[0], COMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011567 if (! list)
11568 {
Denis Ovsienkob7292942010-12-08 18:51:37 +030011569 vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000011570 return CMD_WARNING;
11571 }
11572
11573 community_list_show (vty, list);
11574
11575 return CMD_SUCCESS;
11576}
David Lamparter6b0655a2014-06-04 06:53:35 +020011577
paul94f2b392005-06-28 12:44:16 +000011578static int
paulfd79ac92004-10-13 05:06:08 +000011579extcommunity_list_set_vty (struct vty *vty, int argc, const char **argv,
11580 int style, int reject_all_digit_name)
paul718e3742002-12-13 20:15:29 +000011581{
11582 int ret;
11583 int direct;
11584 char *str;
11585
11586 /* Check the list type. */
11587 if (strncmp (argv[1], "p", 1) == 0)
11588 direct = COMMUNITY_PERMIT;
11589 else if (strncmp (argv[1], "d", 1) == 0)
11590 direct = COMMUNITY_DENY;
11591 else
11592 {
11593 vty_out (vty, "%% Matching condition must be permit or deny%s",
11594 VTY_NEWLINE);
11595 return CMD_WARNING;
11596 }
11597
11598 /* All digit name check. */
11599 if (reject_all_digit_name && all_digit (argv[0]))
11600 {
11601 vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE);
11602 return CMD_WARNING;
11603 }
11604
11605 /* Concat community string argument. */
11606 if (argc > 1)
11607 str = argv_concat (argv, argc, 2);
11608 else
11609 str = NULL;
11610
11611 ret = extcommunity_list_set (bgp_clist, argv[0], str, direct, style);
11612
11613 /* Free temporary community list string allocated by
11614 argv_concat(). */
11615 if (str)
11616 XFREE (MTYPE_TMP, str);
11617
11618 if (ret < 0)
11619 {
11620 community_list_perror (vty, ret);
11621 return CMD_WARNING;
11622 }
11623 return CMD_SUCCESS;
11624}
11625
paul94f2b392005-06-28 12:44:16 +000011626static int
hassofee6e4e2005-02-02 16:29:31 +000011627extcommunity_list_unset_vty (struct vty *vty, int argc, const char **argv,
11628 int style)
paul718e3742002-12-13 20:15:29 +000011629{
11630 int ret;
hassofee6e4e2005-02-02 16:29:31 +000011631 int direct = 0;
11632 char *str = NULL;
paul718e3742002-12-13 20:15:29 +000011633
hassofee6e4e2005-02-02 16:29:31 +000011634 if (argc > 1)
paul718e3742002-12-13 20:15:29 +000011635 {
hassofee6e4e2005-02-02 16:29:31 +000011636 /* Check the list direct. */
11637 if (strncmp (argv[1], "p", 1) == 0)
11638 direct = COMMUNITY_PERMIT;
11639 else if (strncmp (argv[1], "d", 1) == 0)
11640 direct = COMMUNITY_DENY;
11641 else
11642 {
11643 vty_out (vty, "%% Matching condition must be permit or deny%s",
11644 VTY_NEWLINE);
11645 return CMD_WARNING;
11646 }
11647
11648 /* Concat community string argument. */
11649 str = argv_concat (argv, argc, 2);
paul718e3742002-12-13 20:15:29 +000011650 }
paul718e3742002-12-13 20:15:29 +000011651
11652 /* Unset community list. */
11653 ret = extcommunity_list_unset (bgp_clist, argv[0], str, direct, style);
11654
11655 /* Free temporary community list string allocated by
11656 argv_concat(). */
hassofee6e4e2005-02-02 16:29:31 +000011657 if (str)
11658 XFREE (MTYPE_TMP, str);
paul718e3742002-12-13 20:15:29 +000011659
11660 if (ret < 0)
11661 {
11662 community_list_perror (vty, ret);
11663 return CMD_WARNING;
11664 }
11665
11666 return CMD_SUCCESS;
11667}
11668
11669/* "extcommunity-list" keyword help string. */
11670#define EXTCOMMUNITY_LIST_STR "Add a extended community list entry\n"
11671#define EXTCOMMUNITY_VAL_STR "Extended community attribute in 'rt aa:nn_or_IPaddr:nn' OR 'soo aa:nn_or_IPaddr:nn' format\n"
11672
11673DEFUN (ip_extcommunity_list_standard,
11674 ip_extcommunity_list_standard_cmd,
11675 "ip extcommunity-list <1-99> (deny|permit) .AA:NN",
11676 IP_STR
11677 EXTCOMMUNITY_LIST_STR
11678 "Extended Community list number (standard)\n"
11679 "Specify community to reject\n"
11680 "Specify community to accept\n"
11681 EXTCOMMUNITY_VAL_STR)
11682{
11683 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0);
11684}
11685
11686ALIAS (ip_extcommunity_list_standard,
11687 ip_extcommunity_list_standard2_cmd,
11688 "ip extcommunity-list <1-99> (deny|permit)",
11689 IP_STR
11690 EXTCOMMUNITY_LIST_STR
11691 "Extended Community list number (standard)\n"
11692 "Specify community to reject\n"
11693 "Specify community to accept\n")
11694
11695DEFUN (ip_extcommunity_list_expanded,
11696 ip_extcommunity_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000011697 "ip extcommunity-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000011698 IP_STR
11699 EXTCOMMUNITY_LIST_STR
11700 "Extended Community list number (expanded)\n"
11701 "Specify community to reject\n"
11702 "Specify community to accept\n"
11703 "An ordered list as a regular-expression\n")
11704{
11705 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0);
11706}
11707
11708DEFUN (ip_extcommunity_list_name_standard,
11709 ip_extcommunity_list_name_standard_cmd,
11710 "ip extcommunity-list standard WORD (deny|permit) .AA:NN",
11711 IP_STR
11712 EXTCOMMUNITY_LIST_STR
11713 "Specify standard extcommunity-list\n"
11714 "Extended Community list name\n"
11715 "Specify community to reject\n"
11716 "Specify community to accept\n"
11717 EXTCOMMUNITY_VAL_STR)
11718{
11719 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1);
11720}
11721
11722ALIAS (ip_extcommunity_list_name_standard,
11723 ip_extcommunity_list_name_standard2_cmd,
11724 "ip extcommunity-list standard WORD (deny|permit)",
11725 IP_STR
11726 EXTCOMMUNITY_LIST_STR
11727 "Specify standard extcommunity-list\n"
11728 "Extended Community list name\n"
11729 "Specify community to reject\n"
11730 "Specify community to accept\n")
11731
11732DEFUN (ip_extcommunity_list_name_expanded,
11733 ip_extcommunity_list_name_expanded_cmd,
11734 "ip extcommunity-list expanded WORD (deny|permit) .LINE",
11735 IP_STR
11736 EXTCOMMUNITY_LIST_STR
11737 "Specify expanded extcommunity-list\n"
11738 "Extended Community list name\n"
11739 "Specify community to reject\n"
11740 "Specify community to accept\n"
11741 "An ordered list as a regular-expression\n")
11742{
11743 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1);
11744}
11745
hassofee6e4e2005-02-02 16:29:31 +000011746DEFUN (no_ip_extcommunity_list_standard_all,
11747 no_ip_extcommunity_list_standard_all_cmd,
11748 "no ip extcommunity-list <1-99>",
paul718e3742002-12-13 20:15:29 +000011749 NO_STR
11750 IP_STR
11751 EXTCOMMUNITY_LIST_STR
hassofee6e4e2005-02-02 16:29:31 +000011752 "Extended Community list number (standard)\n")
paul718e3742002-12-13 20:15:29 +000011753{
hassofee6e4e2005-02-02 16:29:31 +000011754 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
paul718e3742002-12-13 20:15:29 +000011755}
11756
hassofee6e4e2005-02-02 16:29:31 +000011757DEFUN (no_ip_extcommunity_list_expanded_all,
11758 no_ip_extcommunity_list_expanded_all_cmd,
11759 "no ip extcommunity-list <100-500>",
11760 NO_STR
11761 IP_STR
11762 EXTCOMMUNITY_LIST_STR
11763 "Extended Community list number (expanded)\n")
11764{
11765 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
11766}
11767
11768DEFUN (no_ip_extcommunity_list_name_standard_all,
11769 no_ip_extcommunity_list_name_standard_all_cmd,
11770 "no ip extcommunity-list standard WORD",
paul718e3742002-12-13 20:15:29 +000011771 NO_STR
11772 IP_STR
11773 EXTCOMMUNITY_LIST_STR
11774 "Specify standard extcommunity-list\n"
hassofee6e4e2005-02-02 16:29:31 +000011775 "Extended Community list name\n")
11776{
11777 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
11778}
11779
11780DEFUN (no_ip_extcommunity_list_name_expanded_all,
11781 no_ip_extcommunity_list_name_expanded_all_cmd,
11782 "no ip extcommunity-list expanded WORD",
11783 NO_STR
11784 IP_STR
11785 EXTCOMMUNITY_LIST_STR
paul718e3742002-12-13 20:15:29 +000011786 "Specify expanded extcommunity-list\n"
11787 "Extended Community list name\n")
11788{
hassofee6e4e2005-02-02 16:29:31 +000011789 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
paul718e3742002-12-13 20:15:29 +000011790}
11791
11792DEFUN (no_ip_extcommunity_list_standard,
11793 no_ip_extcommunity_list_standard_cmd,
11794 "no ip extcommunity-list <1-99> (deny|permit) .AA:NN",
11795 NO_STR
11796 IP_STR
11797 EXTCOMMUNITY_LIST_STR
11798 "Extended Community list number (standard)\n"
11799 "Specify community to reject\n"
11800 "Specify community to accept\n"
11801 EXTCOMMUNITY_VAL_STR)
11802{
11803 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
11804}
11805
11806DEFUN (no_ip_extcommunity_list_expanded,
11807 no_ip_extcommunity_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000011808 "no ip extcommunity-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000011809 NO_STR
11810 IP_STR
11811 EXTCOMMUNITY_LIST_STR
11812 "Extended Community list number (expanded)\n"
11813 "Specify community to reject\n"
11814 "Specify community to accept\n"
11815 "An ordered list as a regular-expression\n")
11816{
11817 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
11818}
11819
11820DEFUN (no_ip_extcommunity_list_name_standard,
11821 no_ip_extcommunity_list_name_standard_cmd,
11822 "no ip extcommunity-list standard WORD (deny|permit) .AA:NN",
11823 NO_STR
11824 IP_STR
11825 EXTCOMMUNITY_LIST_STR
11826 "Specify standard extcommunity-list\n"
11827 "Extended Community list name\n"
11828 "Specify community to reject\n"
11829 "Specify community to accept\n"
11830 EXTCOMMUNITY_VAL_STR)
11831{
11832 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
11833}
11834
11835DEFUN (no_ip_extcommunity_list_name_expanded,
11836 no_ip_extcommunity_list_name_expanded_cmd,
11837 "no ip extcommunity-list expanded WORD (deny|permit) .LINE",
11838 NO_STR
11839 IP_STR
11840 EXTCOMMUNITY_LIST_STR
11841 "Specify expanded extcommunity-list\n"
11842 "Community list name\n"
11843 "Specify community to reject\n"
11844 "Specify community to accept\n"
11845 "An ordered list as a regular-expression\n")
11846{
11847 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
11848}
11849
paul94f2b392005-06-28 12:44:16 +000011850static void
paul718e3742002-12-13 20:15:29 +000011851extcommunity_list_show (struct vty *vty, struct community_list *list)
11852{
11853 struct community_entry *entry;
11854
11855 for (entry = list->head; entry; entry = entry->next)
11856 {
11857 if (entry == list->head)
11858 {
11859 if (all_digit (list->name))
11860 vty_out (vty, "Extended community %s list %s%s",
11861 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
11862 "standard" : "(expanded) access",
11863 list->name, VTY_NEWLINE);
11864 else
11865 vty_out (vty, "Named extended community %s list %s%s",
11866 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
11867 "standard" : "expanded",
11868 list->name, VTY_NEWLINE);
11869 }
11870 if (entry->any)
11871 vty_out (vty, " %s%s",
11872 community_direct_str (entry->direct), VTY_NEWLINE);
11873 else
11874 vty_out (vty, " %s %s%s",
11875 community_direct_str (entry->direct),
11876 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
11877 entry->u.ecom->str : entry->config,
11878 VTY_NEWLINE);
11879 }
11880}
11881
11882DEFUN (show_ip_extcommunity_list,
11883 show_ip_extcommunity_list_cmd,
11884 "show ip extcommunity-list",
11885 SHOW_STR
11886 IP_STR
11887 "List extended-community list\n")
11888{
11889 struct community_list *list;
11890 struct community_list_master *cm;
11891
hassofee6e4e2005-02-02 16:29:31 +000011892 cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011893 if (! cm)
11894 return CMD_SUCCESS;
11895
11896 for (list = cm->num.head; list; list = list->next)
11897 extcommunity_list_show (vty, list);
11898
11899 for (list = cm->str.head; list; list = list->next)
11900 extcommunity_list_show (vty, list);
11901
11902 return CMD_SUCCESS;
11903}
11904
11905DEFUN (show_ip_extcommunity_list_arg,
11906 show_ip_extcommunity_list_arg_cmd,
hassofee6e4e2005-02-02 16:29:31 +000011907 "show ip extcommunity-list (<1-500>|WORD)",
paul718e3742002-12-13 20:15:29 +000011908 SHOW_STR
11909 IP_STR
11910 "List extended-community list\n"
11911 "Extcommunity-list number\n"
11912 "Extcommunity-list name\n")
11913{
11914 struct community_list *list;
11915
hassofee6e4e2005-02-02 16:29:31 +000011916 list = community_list_lookup (bgp_clist, argv[0], EXTCOMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011917 if (! list)
11918 {
Denis Ovsienkob7292942010-12-08 18:51:37 +030011919 vty_out (vty, "%% Can't find extcommunity-list%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000011920 return CMD_WARNING;
11921 }
11922
11923 extcommunity_list_show (vty, list);
11924
11925 return CMD_SUCCESS;
11926}
David Lamparter6b0655a2014-06-04 06:53:35 +020011927
paul718e3742002-12-13 20:15:29 +000011928/* Return configuration string of community-list entry. */
paulfd79ac92004-10-13 05:06:08 +000011929static const char *
paul718e3742002-12-13 20:15:29 +000011930community_list_config_str (struct community_entry *entry)
11931{
paulfd79ac92004-10-13 05:06:08 +000011932 const char *str;
paul718e3742002-12-13 20:15:29 +000011933
11934 if (entry->any)
11935 str = "";
11936 else
11937 {
11938 if (entry->style == COMMUNITY_LIST_STANDARD)
11939 str = community_str (entry->u.com);
11940 else
11941 str = entry->config;
11942 }
11943 return str;
11944}
11945
11946/* Display community-list and extcommunity-list configuration. */
paul94f2b392005-06-28 12:44:16 +000011947static int
paul718e3742002-12-13 20:15:29 +000011948community_list_config_write (struct vty *vty)
11949{
11950 struct community_list *list;
11951 struct community_entry *entry;
11952 struct community_list_master *cm;
11953 int write = 0;
11954
11955 /* Community-list. */
hassofee6e4e2005-02-02 16:29:31 +000011956 cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011957
11958 for (list = cm->num.head; list; list = list->next)
11959 for (entry = list->head; entry; entry = entry->next)
11960 {
hassofee6e4e2005-02-02 16:29:31 +000011961 vty_out (vty, "ip community-list %s %s %s%s",
11962 list->name, community_direct_str (entry->direct),
11963 community_list_config_str (entry),
11964 VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000011965 write++;
11966 }
11967 for (list = cm->str.head; list; list = list->next)
11968 for (entry = list->head; entry; entry = entry->next)
11969 {
11970 vty_out (vty, "ip community-list %s %s %s %s%s",
11971 entry->style == COMMUNITY_LIST_STANDARD
11972 ? "standard" : "expanded",
11973 list->name, community_direct_str (entry->direct),
11974 community_list_config_str (entry),
11975 VTY_NEWLINE);
11976 write++;
11977 }
11978
11979 /* Extcommunity-list. */
hassofee6e4e2005-02-02 16:29:31 +000011980 cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011981
11982 for (list = cm->num.head; list; list = list->next)
11983 for (entry = list->head; entry; entry = entry->next)
11984 {
hassofee6e4e2005-02-02 16:29:31 +000011985 vty_out (vty, "ip extcommunity-list %s %s %s%s",
11986 list->name, community_direct_str (entry->direct),
11987 community_list_config_str (entry), VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000011988 write++;
11989 }
11990 for (list = cm->str.head; list; list = list->next)
11991 for (entry = list->head; entry; entry = entry->next)
11992 {
11993 vty_out (vty, "ip extcommunity-list %s %s %s %s%s",
11994 entry->style == EXTCOMMUNITY_LIST_STANDARD
11995 ? "standard" : "expanded",
11996 list->name, community_direct_str (entry->direct),
11997 community_list_config_str (entry), VTY_NEWLINE);
11998 write++;
11999 }
12000 return write;
12001}
12002
Stephen Hemminger7fc626d2008-12-01 11:10:34 -080012003static struct cmd_node community_list_node =
paul718e3742002-12-13 20:15:29 +000012004{
12005 COMMUNITY_LIST_NODE,
12006 "",
12007 1 /* Export to vtysh. */
12008};
12009
paul94f2b392005-06-28 12:44:16 +000012010static void
12011community_list_vty (void)
paul718e3742002-12-13 20:15:29 +000012012{
12013 install_node (&community_list_node, community_list_config_write);
12014
12015 /* Community-list. */
paul718e3742002-12-13 20:15:29 +000012016 install_element (CONFIG_NODE, &ip_community_list_standard_cmd);
12017 install_element (CONFIG_NODE, &ip_community_list_standard2_cmd);
12018 install_element (CONFIG_NODE, &ip_community_list_expanded_cmd);
12019 install_element (CONFIG_NODE, &ip_community_list_name_standard_cmd);
12020 install_element (CONFIG_NODE, &ip_community_list_name_standard2_cmd);
12021 install_element (CONFIG_NODE, &ip_community_list_name_expanded_cmd);
hassofee6e4e2005-02-02 16:29:31 +000012022 install_element (CONFIG_NODE, &no_ip_community_list_standard_all_cmd);
12023 install_element (CONFIG_NODE, &no_ip_community_list_expanded_all_cmd);
12024 install_element (CONFIG_NODE, &no_ip_community_list_name_standard_all_cmd);
12025 install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_all_cmd);
paul718e3742002-12-13 20:15:29 +000012026 install_element (CONFIG_NODE, &no_ip_community_list_standard_cmd);
12027 install_element (CONFIG_NODE, &no_ip_community_list_expanded_cmd);
12028 install_element (CONFIG_NODE, &no_ip_community_list_name_standard_cmd);
12029 install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_cmd);
12030 install_element (VIEW_NODE, &show_ip_community_list_cmd);
12031 install_element (VIEW_NODE, &show_ip_community_list_arg_cmd);
12032 install_element (ENABLE_NODE, &show_ip_community_list_cmd);
12033 install_element (ENABLE_NODE, &show_ip_community_list_arg_cmd);
12034
12035 /* Extcommunity-list. */
12036 install_element (CONFIG_NODE, &ip_extcommunity_list_standard_cmd);
12037 install_element (CONFIG_NODE, &ip_extcommunity_list_standard2_cmd);
12038 install_element (CONFIG_NODE, &ip_extcommunity_list_expanded_cmd);
12039 install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard_cmd);
12040 install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard2_cmd);
12041 install_element (CONFIG_NODE, &ip_extcommunity_list_name_expanded_cmd);
hassofee6e4e2005-02-02 16:29:31 +000012042 install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_all_cmd);
12043 install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_all_cmd);
12044 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_all_cmd);
12045 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_all_cmd);
paul718e3742002-12-13 20:15:29 +000012046 install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_cmd);
12047 install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_cmd);
12048 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_cmd);
12049 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_cmd);
12050 install_element (VIEW_NODE, &show_ip_extcommunity_list_cmd);
12051 install_element (VIEW_NODE, &show_ip_extcommunity_list_arg_cmd);
12052 install_element (ENABLE_NODE, &show_ip_extcommunity_list_cmd);
12053 install_element (ENABLE_NODE, &show_ip_extcommunity_list_arg_cmd);
12054}