blob: 987ff298cb7460e010c0d9c60bd2b28fda33784b [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,
718 "maximum-paths <1-255>",
719 "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
Donald Sharp58a83f22015-09-11 10:11:42 -0400740 if ((MULTIPATH_NUM != 0) && (maxpaths > MULTIPATH_NUM))
741 vty_out (vty,
742 "%% Warning: maximum-paths set to %d is greater than %d that zebra is compiled to support%s",
743 maxpaths, MULTIPATH_NUM, VTY_NEWLINE);
744
Josh Bailey165b5ff2011-07-20 20:43:22 -0700745 return CMD_SUCCESS;
746}
747
748DEFUN (bgp_maxpaths_ibgp,
749 bgp_maxpaths_ibgp_cmd,
750 "maximum-paths ibgp <1-255>",
751 "Forward packets over multiple paths\n"
752 "iBGP-multipath\n"
753 "Number of paths\n")
754{
755 struct bgp *bgp;
756 u_int16_t maxpaths;
757 int ret;
758
759 bgp = vty->index;
760
761 VTY_GET_INTEGER_RANGE ("maximum-paths", maxpaths, argv[0], 1, 255);
762
763 ret = bgp_maximum_paths_set (bgp, bgp_node_afi (vty), bgp_node_safi(vty),
764 BGP_PEER_IBGP, maxpaths);
765 if (ret < 0)
766 {
767 vty_out (vty,
768 "%% Failed to set maximum-paths ibgp %u for afi %u, safi %u%s",
769 maxpaths, bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE);
770 return CMD_WARNING;
771 }
772
Donald Sharp58a83f22015-09-11 10:11:42 -0400773 if ((MULTIPATH_NUM != 0) && (maxpaths > MULTIPATH_NUM))
774 vty_out (vty,
775 "%% Warning: maximum-paths set to %d is greater than %d that zebra is compiled to support%s",
776 maxpaths, MULTIPATH_NUM, VTY_NEWLINE);
777
Josh Bailey165b5ff2011-07-20 20:43:22 -0700778 return CMD_SUCCESS;
779}
780
781DEFUN (no_bgp_maxpaths,
782 no_bgp_maxpaths_cmd,
783 "no maximum-paths",
784 NO_STR
785 "Forward packets over multiple paths\n"
786 "Number of paths\n")
787{
788 struct bgp *bgp;
789 int ret;
790
791 bgp = vty->index;
792
793 ret = bgp_maximum_paths_unset (bgp, bgp_node_afi (vty), bgp_node_safi(vty),
794 BGP_PEER_EBGP);
795 if (ret < 0)
796 {
797 vty_out (vty,
798 "%% Failed to unset maximum-paths for afi %u, safi %u%s",
799 bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE);
800 return CMD_WARNING;
801 }
802
803 return CMD_SUCCESS;
804}
805
806ALIAS (no_bgp_maxpaths,
807 no_bgp_maxpaths_arg_cmd,
808 "no maximum-paths <1-255>",
809 NO_STR
810 "Forward packets over multiple paths\n"
811 "Number of paths\n")
812
813DEFUN (no_bgp_maxpaths_ibgp,
814 no_bgp_maxpaths_ibgp_cmd,
815 "no maximum-paths ibgp",
816 NO_STR
817 "Forward packets over multiple paths\n"
818 "iBGP-multipath\n"
819 "Number of paths\n")
820{
821 struct bgp *bgp;
822 int ret;
823
824 bgp = vty->index;
825
826 ret = bgp_maximum_paths_unset (bgp, bgp_node_afi (vty), bgp_node_safi(vty),
827 BGP_PEER_IBGP);
828 if (ret < 0)
829 {
830 vty_out (vty,
831 "%% Failed to unset maximum-paths ibgp for afi %u, safi %u%s",
832 bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE);
833 return CMD_WARNING;
834 }
835
836 return CMD_SUCCESS;
837}
838
839ALIAS (no_bgp_maxpaths_ibgp,
840 no_bgp_maxpaths_ibgp_arg_cmd,
841 "no maximum-paths ibgp <1-255>",
842 NO_STR
843 "Forward packets over multiple paths\n"
844 "iBGP-multipath\n"
845 "Number of paths\n")
846
847int
848bgp_config_write_maxpaths (struct vty *vty, struct bgp *bgp, afi_t afi,
849 safi_t safi, int *write)
850{
851 if (bgp->maxpaths[afi][safi].maxpaths_ebgp != BGP_DEFAULT_MAXPATHS)
852 {
853 bgp_config_write_family_header (vty, afi, safi, write);
854 vty_out (vty, " maximum-paths %d%s",
855 bgp->maxpaths[afi][safi].maxpaths_ebgp, VTY_NEWLINE);
856 }
857
858 if (bgp->maxpaths[afi][safi].maxpaths_ibgp != BGP_DEFAULT_MAXPATHS)
859 {
860 bgp_config_write_family_header (vty, afi, safi, write);
861 vty_out (vty, " maximum-paths ibgp %d%s",
862 bgp->maxpaths[afi][safi].maxpaths_ibgp, VTY_NEWLINE);
863 }
864
865 return 0;
866}
David Lamparter6b0655a2014-06-04 06:53:35 +0200867
paul718e3742002-12-13 20:15:29 +0000868/* BGP timers. */
869
870DEFUN (bgp_timers,
871 bgp_timers_cmd,
872 "timers bgp <0-65535> <0-65535>",
873 "Adjust routing timers\n"
874 "BGP timers\n"
875 "Keepalive interval\n"
876 "Holdtime\n")
877{
878 struct bgp *bgp;
879 unsigned long keepalive = 0;
880 unsigned long holdtime = 0;
881
882 bgp = vty->index;
883
884 VTY_GET_INTEGER ("keepalive", keepalive, argv[0]);
885 VTY_GET_INTEGER ("holdtime", holdtime, argv[1]);
886
887 /* Holdtime value check. */
888 if (holdtime < 3 && holdtime != 0)
889 {
890 vty_out (vty, "%% hold time value must be either 0 or greater than 3%s",
891 VTY_NEWLINE);
892 return CMD_WARNING;
893 }
894
895 bgp_timers_set (bgp, keepalive, holdtime);
896
897 return CMD_SUCCESS;
898}
899
900DEFUN (no_bgp_timers,
901 no_bgp_timers_cmd,
902 "no timers bgp",
903 NO_STR
904 "Adjust routing timers\n"
905 "BGP timers\n")
906{
907 struct bgp *bgp;
908
909 bgp = vty->index;
910 bgp_timers_unset (bgp);
911
912 return CMD_SUCCESS;
913}
914
915ALIAS (no_bgp_timers,
916 no_bgp_timers_arg_cmd,
917 "no timers bgp <0-65535> <0-65535>",
918 NO_STR
919 "Adjust routing timers\n"
920 "BGP timers\n"
921 "Keepalive interval\n"
922 "Holdtime\n")
David Lamparter6b0655a2014-06-04 06:53:35 +0200923
paul718e3742002-12-13 20:15:29 +0000924DEFUN (bgp_client_to_client_reflection,
925 bgp_client_to_client_reflection_cmd,
926 "bgp client-to-client reflection",
927 "BGP specific commands\n"
928 "Configure client to client route reflection\n"
929 "reflection of routes allowed\n")
930{
931 struct bgp *bgp;
932
933 bgp = vty->index;
934 bgp_flag_unset (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT);
935 return CMD_SUCCESS;
936}
937
938DEFUN (no_bgp_client_to_client_reflection,
939 no_bgp_client_to_client_reflection_cmd,
940 "no bgp client-to-client reflection",
941 NO_STR
942 "BGP specific commands\n"
943 "Configure client to client route reflection\n"
944 "reflection of routes allowed\n")
945{
946 struct bgp *bgp;
947
948 bgp = vty->index;
949 bgp_flag_set (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT);
950 return CMD_SUCCESS;
951}
952
953/* "bgp always-compare-med" configuration. */
954DEFUN (bgp_always_compare_med,
955 bgp_always_compare_med_cmd,
956 "bgp always-compare-med",
957 "BGP specific commands\n"
958 "Allow comparing MED from different neighbors\n")
959{
960 struct bgp *bgp;
961
962 bgp = vty->index;
963 bgp_flag_set (bgp, BGP_FLAG_ALWAYS_COMPARE_MED);
964 return CMD_SUCCESS;
965}
966
967DEFUN (no_bgp_always_compare_med,
968 no_bgp_always_compare_med_cmd,
969 "no bgp always-compare-med",
970 NO_STR
971 "BGP specific commands\n"
972 "Allow comparing MED from different neighbors\n")
973{
974 struct bgp *bgp;
975
976 bgp = vty->index;
977 bgp_flag_unset (bgp, BGP_FLAG_ALWAYS_COMPARE_MED);
978 return CMD_SUCCESS;
979}
David Lamparter6b0655a2014-06-04 06:53:35 +0200980
paul718e3742002-12-13 20:15:29 +0000981/* "bgp deterministic-med" configuration. */
982DEFUN (bgp_deterministic_med,
983 bgp_deterministic_med_cmd,
984 "bgp deterministic-med",
985 "BGP specific commands\n"
986 "Pick the best-MED path among paths advertised from the neighboring AS\n")
987{
988 struct bgp *bgp;
989
990 bgp = vty->index;
991 bgp_flag_set (bgp, BGP_FLAG_DETERMINISTIC_MED);
992 return CMD_SUCCESS;
993}
994
995DEFUN (no_bgp_deterministic_med,
996 no_bgp_deterministic_med_cmd,
997 "no bgp deterministic-med",
998 NO_STR
999 "BGP specific commands\n"
1000 "Pick the best-MED path among paths advertised from the neighboring AS\n")
1001{
1002 struct bgp *bgp;
1003
1004 bgp = vty->index;
1005 bgp_flag_unset (bgp, BGP_FLAG_DETERMINISTIC_MED);
1006 return CMD_SUCCESS;
1007}
hasso538621f2004-05-21 09:31:30 +00001008
1009/* "bgp graceful-restart" configuration. */
1010DEFUN (bgp_graceful_restart,
1011 bgp_graceful_restart_cmd,
1012 "bgp graceful-restart",
1013 "BGP specific commands\n"
1014 "Graceful restart capability parameters\n")
1015{
1016 struct bgp *bgp;
1017
1018 bgp = vty->index;
1019 bgp_flag_set (bgp, BGP_FLAG_GRACEFUL_RESTART);
1020 return CMD_SUCCESS;
1021}
1022
1023DEFUN (no_bgp_graceful_restart,
1024 no_bgp_graceful_restart_cmd,
1025 "no bgp graceful-restart",
1026 NO_STR
1027 "BGP specific commands\n"
1028 "Graceful restart capability parameters\n")
1029{
1030 struct bgp *bgp;
1031
1032 bgp = vty->index;
1033 bgp_flag_unset (bgp, BGP_FLAG_GRACEFUL_RESTART);
1034 return CMD_SUCCESS;
1035}
1036
hasso93406d82005-02-02 14:40:33 +00001037DEFUN (bgp_graceful_restart_stalepath_time,
1038 bgp_graceful_restart_stalepath_time_cmd,
1039 "bgp graceful-restart stalepath-time <1-3600>",
1040 "BGP specific commands\n"
1041 "Graceful restart capability parameters\n"
1042 "Set the max time to hold onto restarting peer's stale paths\n"
1043 "Delay value (seconds)\n")
1044{
1045 struct bgp *bgp;
1046 u_int32_t stalepath;
1047
1048 bgp = vty->index;
1049 if (! bgp)
1050 return CMD_WARNING;
1051
1052 VTY_GET_INTEGER_RANGE ("stalepath-time", stalepath, argv[0], 1, 3600);
1053 bgp->stalepath_time = stalepath;
1054 return CMD_SUCCESS;
1055}
1056
1057DEFUN (no_bgp_graceful_restart_stalepath_time,
1058 no_bgp_graceful_restart_stalepath_time_cmd,
1059 "no bgp graceful-restart stalepath-time",
1060 NO_STR
1061 "BGP specific commands\n"
1062 "Graceful restart capability parameters\n"
1063 "Set the max time to hold onto restarting peer's stale paths\n")
1064{
1065 struct bgp *bgp;
1066
1067 bgp = vty->index;
1068 if (! bgp)
1069 return CMD_WARNING;
1070
1071 bgp->stalepath_time = BGP_DEFAULT_STALEPATH_TIME;
1072 return CMD_SUCCESS;
1073}
1074
1075ALIAS (no_bgp_graceful_restart_stalepath_time,
1076 no_bgp_graceful_restart_stalepath_time_val_cmd,
1077 "no bgp graceful-restart stalepath-time <1-3600>",
1078 NO_STR
1079 "BGP specific commands\n"
1080 "Graceful restart capability parameters\n"
1081 "Set the max time to hold onto restarting peer's stale paths\n"
1082 "Delay value (seconds)\n")
1083
paul718e3742002-12-13 20:15:29 +00001084/* "bgp fast-external-failover" configuration. */
1085DEFUN (bgp_fast_external_failover,
1086 bgp_fast_external_failover_cmd,
1087 "bgp fast-external-failover",
1088 BGP_STR
1089 "Immediately reset session if a link to a directly connected external peer goes down\n")
1090{
1091 struct bgp *bgp;
1092
1093 bgp = vty->index;
1094 bgp_flag_unset (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER);
1095 return CMD_SUCCESS;
1096}
1097
1098DEFUN (no_bgp_fast_external_failover,
1099 no_bgp_fast_external_failover_cmd,
1100 "no bgp fast-external-failover",
1101 NO_STR
1102 BGP_STR
1103 "Immediately reset session if a link to a directly connected external peer goes down\n")
1104{
1105 struct bgp *bgp;
1106
1107 bgp = vty->index;
1108 bgp_flag_set (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER);
1109 return CMD_SUCCESS;
1110}
David Lamparter6b0655a2014-06-04 06:53:35 +02001111
paul718e3742002-12-13 20:15:29 +00001112/* "bgp enforce-first-as" configuration. */
1113DEFUN (bgp_enforce_first_as,
1114 bgp_enforce_first_as_cmd,
1115 "bgp enforce-first-as",
1116 BGP_STR
1117 "Enforce the first AS for EBGP routes\n")
1118{
1119 struct bgp *bgp;
1120
1121 bgp = vty->index;
1122 bgp_flag_set (bgp, BGP_FLAG_ENFORCE_FIRST_AS);
1123 return CMD_SUCCESS;
1124}
1125
1126DEFUN (no_bgp_enforce_first_as,
1127 no_bgp_enforce_first_as_cmd,
1128 "no bgp enforce-first-as",
1129 NO_STR
1130 BGP_STR
1131 "Enforce the first AS for EBGP routes\n")
1132{
1133 struct bgp *bgp;
1134
1135 bgp = vty->index;
1136 bgp_flag_unset (bgp, BGP_FLAG_ENFORCE_FIRST_AS);
1137 return CMD_SUCCESS;
1138}
David Lamparter6b0655a2014-06-04 06:53:35 +02001139
paul718e3742002-12-13 20:15:29 +00001140/* "bgp bestpath compare-routerid" configuration. */
1141DEFUN (bgp_bestpath_compare_router_id,
1142 bgp_bestpath_compare_router_id_cmd,
1143 "bgp bestpath compare-routerid",
1144 "BGP specific commands\n"
1145 "Change the default bestpath selection\n"
1146 "Compare router-id for identical EBGP paths\n")
1147{
1148 struct bgp *bgp;
1149
1150 bgp = vty->index;
1151 bgp_flag_set (bgp, BGP_FLAG_COMPARE_ROUTER_ID);
1152 return CMD_SUCCESS;
1153}
1154
1155DEFUN (no_bgp_bestpath_compare_router_id,
1156 no_bgp_bestpath_compare_router_id_cmd,
1157 "no bgp bestpath compare-routerid",
1158 NO_STR
1159 "BGP specific commands\n"
1160 "Change the default bestpath selection\n"
1161 "Compare router-id for identical EBGP paths\n")
1162{
1163 struct bgp *bgp;
1164
1165 bgp = vty->index;
1166 bgp_flag_unset (bgp, BGP_FLAG_COMPARE_ROUTER_ID);
1167 return CMD_SUCCESS;
1168}
David Lamparter6b0655a2014-06-04 06:53:35 +02001169
paul718e3742002-12-13 20:15:29 +00001170/* "bgp bestpath as-path ignore" configuration. */
1171DEFUN (bgp_bestpath_aspath_ignore,
1172 bgp_bestpath_aspath_ignore_cmd,
1173 "bgp bestpath as-path ignore",
1174 "BGP specific commands\n"
1175 "Change the default bestpath selection\n"
1176 "AS-path attribute\n"
1177 "Ignore as-path length in selecting a route\n")
1178{
1179 struct bgp *bgp;
1180
1181 bgp = vty->index;
1182 bgp_flag_set (bgp, BGP_FLAG_ASPATH_IGNORE);
1183 return CMD_SUCCESS;
1184}
1185
1186DEFUN (no_bgp_bestpath_aspath_ignore,
1187 no_bgp_bestpath_aspath_ignore_cmd,
1188 "no bgp bestpath as-path ignore",
1189 NO_STR
1190 "BGP specific commands\n"
1191 "Change the default bestpath selection\n"
1192 "AS-path attribute\n"
1193 "Ignore as-path length in selecting a route\n")
1194{
1195 struct bgp *bgp;
1196
1197 bgp = vty->index;
1198 bgp_flag_unset (bgp, BGP_FLAG_ASPATH_IGNORE);
1199 return CMD_SUCCESS;
1200}
David Lamparter6b0655a2014-06-04 06:53:35 +02001201
hasso68118452005-04-08 15:40:36 +00001202/* "bgp bestpath as-path confed" configuration. */
1203DEFUN (bgp_bestpath_aspath_confed,
1204 bgp_bestpath_aspath_confed_cmd,
1205 "bgp bestpath as-path confed",
1206 "BGP specific commands\n"
1207 "Change the default bestpath selection\n"
1208 "AS-path attribute\n"
1209 "Compare path lengths including confederation sets & sequences in selecting a route\n")
1210{
1211 struct bgp *bgp;
1212
1213 bgp = vty->index;
1214 bgp_flag_set (bgp, BGP_FLAG_ASPATH_CONFED);
1215 return CMD_SUCCESS;
1216}
1217
1218DEFUN (no_bgp_bestpath_aspath_confed,
1219 no_bgp_bestpath_aspath_confed_cmd,
1220 "no bgp bestpath as-path confed",
1221 NO_STR
1222 "BGP specific commands\n"
1223 "Change the default bestpath selection\n"
1224 "AS-path attribute\n"
1225 "Compare path lengths including confederation sets & sequences in selecting a route\n")
1226{
1227 struct bgp *bgp;
1228
1229 bgp = vty->index;
1230 bgp_flag_unset (bgp, BGP_FLAG_ASPATH_CONFED);
1231 return CMD_SUCCESS;
1232}
David Lamparter6b0655a2014-06-04 06:53:35 +02001233
Pradosh Mohapatra2fdd4552013-09-07 07:02:36 +00001234/* "bgp bestpath as-path multipath-relax" configuration. */
1235DEFUN (bgp_bestpath_aspath_multipath_relax,
1236 bgp_bestpath_aspath_multipath_relax_cmd,
1237 "bgp bestpath as-path multipath-relax",
1238 "BGP specific commands\n"
1239 "Change the default bestpath selection\n"
1240 "AS-path attribute\n"
1241 "Allow load sharing across routes that have different AS paths (but same length)\n")
1242{
1243 struct bgp *bgp;
1244
1245 bgp = vty->index;
1246 bgp_flag_set (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX);
1247 return CMD_SUCCESS;
1248}
1249
1250DEFUN (no_bgp_bestpath_aspath_multipath_relax,
1251 no_bgp_bestpath_aspath_multipath_relax_cmd,
1252 "no bgp bestpath as-path multipath-relax",
1253 NO_STR
1254 "BGP specific commands\n"
1255 "Change the default bestpath selection\n"
1256 "AS-path attribute\n"
1257 "Allow load sharing across routes that have different AS paths (but same length)\n")
1258{
1259 struct bgp *bgp;
1260
1261 bgp = vty->index;
1262 bgp_flag_unset (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX);
1263 return CMD_SUCCESS;
1264}
David Lamparter6b0655a2014-06-04 06:53:35 +02001265
paul848973c2003-08-13 00:32:49 +00001266/* "bgp log-neighbor-changes" configuration. */
1267DEFUN (bgp_log_neighbor_changes,
1268 bgp_log_neighbor_changes_cmd,
1269 "bgp log-neighbor-changes",
1270 "BGP specific commands\n"
1271 "Log neighbor up/down and reset reason\n")
1272{
1273 struct bgp *bgp;
1274
1275 bgp = vty->index;
1276 bgp_flag_set (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES);
1277 return CMD_SUCCESS;
1278}
1279
1280DEFUN (no_bgp_log_neighbor_changes,
1281 no_bgp_log_neighbor_changes_cmd,
1282 "no bgp log-neighbor-changes",
1283 NO_STR
1284 "BGP specific commands\n"
1285 "Log neighbor up/down and reset reason\n")
1286{
1287 struct bgp *bgp;
1288
1289 bgp = vty->index;
1290 bgp_flag_unset (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES);
1291 return CMD_SUCCESS;
1292}
David Lamparter6b0655a2014-06-04 06:53:35 +02001293
paul718e3742002-12-13 20:15:29 +00001294/* "bgp bestpath med" configuration. */
1295DEFUN (bgp_bestpath_med,
1296 bgp_bestpath_med_cmd,
1297 "bgp bestpath med (confed|missing-as-worst)",
1298 "BGP specific commands\n"
1299 "Change the default bestpath selection\n"
1300 "MED attribute\n"
1301 "Compare MED among confederation paths\n"
1302 "Treat missing MED as the least preferred one\n")
1303{
1304 struct bgp *bgp;
1305
1306 bgp = vty->index;
1307
1308 if (strncmp (argv[0], "confed", 1) == 0)
1309 bgp_flag_set (bgp, BGP_FLAG_MED_CONFED);
1310 else
1311 bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1312
1313 return CMD_SUCCESS;
1314}
1315
1316DEFUN (bgp_bestpath_med2,
1317 bgp_bestpath_med2_cmd,
1318 "bgp bestpath med confed missing-as-worst",
1319 "BGP specific commands\n"
1320 "Change the default bestpath selection\n"
1321 "MED attribute\n"
1322 "Compare MED among confederation paths\n"
1323 "Treat missing MED as the least preferred one\n")
1324{
1325 struct bgp *bgp;
1326
1327 bgp = vty->index;
1328 bgp_flag_set (bgp, BGP_FLAG_MED_CONFED);
1329 bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1330 return CMD_SUCCESS;
1331}
1332
1333ALIAS (bgp_bestpath_med2,
1334 bgp_bestpath_med3_cmd,
1335 "bgp bestpath med missing-as-worst confed",
1336 "BGP specific commands\n"
1337 "Change the default bestpath selection\n"
1338 "MED attribute\n"
1339 "Treat missing MED as the least preferred one\n"
1340 "Compare MED among confederation paths\n")
1341
1342DEFUN (no_bgp_bestpath_med,
1343 no_bgp_bestpath_med_cmd,
1344 "no bgp bestpath med (confed|missing-as-worst)",
1345 NO_STR
1346 "BGP specific commands\n"
1347 "Change the default bestpath selection\n"
1348 "MED attribute\n"
1349 "Compare MED among confederation paths\n"
1350 "Treat missing MED as the least preferred one\n")
1351{
1352 struct bgp *bgp;
1353
1354 bgp = vty->index;
1355
1356 if (strncmp (argv[0], "confed", 1) == 0)
1357 bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED);
1358 else
1359 bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1360
1361 return CMD_SUCCESS;
1362}
1363
1364DEFUN (no_bgp_bestpath_med2,
1365 no_bgp_bestpath_med2_cmd,
1366 "no bgp bestpath med confed missing-as-worst",
1367 NO_STR
1368 "BGP specific commands\n"
1369 "Change the default bestpath selection\n"
1370 "MED attribute\n"
1371 "Compare MED among confederation paths\n"
1372 "Treat missing MED as the least preferred one\n")
1373{
1374 struct bgp *bgp;
1375
1376 bgp = vty->index;
1377 bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED);
1378 bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1379 return CMD_SUCCESS;
1380}
1381
1382ALIAS (no_bgp_bestpath_med2,
1383 no_bgp_bestpath_med3_cmd,
1384 "no bgp bestpath med missing-as-worst confed",
1385 NO_STR
1386 "BGP specific commands\n"
1387 "Change the default bestpath selection\n"
1388 "MED attribute\n"
1389 "Treat missing MED as the least preferred one\n"
1390 "Compare MED among confederation paths\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02001391
paul718e3742002-12-13 20:15:29 +00001392/* "no bgp default ipv4-unicast". */
1393DEFUN (no_bgp_default_ipv4_unicast,
1394 no_bgp_default_ipv4_unicast_cmd,
1395 "no bgp default ipv4-unicast",
1396 NO_STR
1397 "BGP specific commands\n"
1398 "Configure BGP defaults\n"
1399 "Activate ipv4-unicast for a peer by default\n")
1400{
1401 struct bgp *bgp;
1402
1403 bgp = vty->index;
1404 bgp_flag_set (bgp, BGP_FLAG_NO_DEFAULT_IPV4);
1405 return CMD_SUCCESS;
1406}
1407
1408DEFUN (bgp_default_ipv4_unicast,
1409 bgp_default_ipv4_unicast_cmd,
1410 "bgp default ipv4-unicast",
1411 "BGP specific commands\n"
1412 "Configure BGP defaults\n"
1413 "Activate ipv4-unicast for a peer by default\n")
1414{
1415 struct bgp *bgp;
1416
1417 bgp = vty->index;
1418 bgp_flag_unset (bgp, BGP_FLAG_NO_DEFAULT_IPV4);
1419 return CMD_SUCCESS;
1420}
David Lamparter6b0655a2014-06-04 06:53:35 +02001421
paul718e3742002-12-13 20:15:29 +00001422/* "bgp import-check" configuration. */
1423DEFUN (bgp_network_import_check,
1424 bgp_network_import_check_cmd,
1425 "bgp network import-check",
1426 "BGP specific commands\n"
1427 "BGP network command\n"
1428 "Check BGP network route exists in IGP\n")
1429{
1430 struct bgp *bgp;
1431
1432 bgp = vty->index;
1433 bgp_flag_set (bgp, BGP_FLAG_IMPORT_CHECK);
1434 return CMD_SUCCESS;
1435}
1436
1437DEFUN (no_bgp_network_import_check,
1438 no_bgp_network_import_check_cmd,
1439 "no bgp network import-check",
1440 NO_STR
1441 "BGP specific commands\n"
1442 "BGP network command\n"
1443 "Check BGP network route exists in IGP\n")
1444{
1445 struct bgp *bgp;
1446
1447 bgp = vty->index;
1448 bgp_flag_unset (bgp, BGP_FLAG_IMPORT_CHECK);
1449 return CMD_SUCCESS;
1450}
David Lamparter6b0655a2014-06-04 06:53:35 +02001451
paul718e3742002-12-13 20:15:29 +00001452DEFUN (bgp_default_local_preference,
1453 bgp_default_local_preference_cmd,
1454 "bgp default local-preference <0-4294967295>",
1455 "BGP specific commands\n"
1456 "Configure BGP defaults\n"
1457 "local preference (higher=more preferred)\n"
1458 "Configure default local preference value\n")
1459{
1460 struct bgp *bgp;
1461 u_int32_t local_pref;
1462
1463 bgp = vty->index;
1464
1465 VTY_GET_INTEGER ("local preference", local_pref, argv[0]);
1466
1467 bgp_default_local_preference_set (bgp, local_pref);
1468
1469 return CMD_SUCCESS;
1470}
1471
1472DEFUN (no_bgp_default_local_preference,
1473 no_bgp_default_local_preference_cmd,
1474 "no bgp default local-preference",
1475 NO_STR
1476 "BGP specific commands\n"
1477 "Configure BGP defaults\n"
1478 "local preference (higher=more preferred)\n")
1479{
1480 struct bgp *bgp;
1481
1482 bgp = vty->index;
1483 bgp_default_local_preference_unset (bgp);
1484 return CMD_SUCCESS;
1485}
1486
1487ALIAS (no_bgp_default_local_preference,
1488 no_bgp_default_local_preference_val_cmd,
1489 "no bgp default local-preference <0-4294967295>",
1490 NO_STR
1491 "BGP specific commands\n"
1492 "Configure BGP defaults\n"
1493 "local preference (higher=more preferred)\n"
1494 "Configure default local preference value\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02001495
paul718e3742002-12-13 20:15:29 +00001496static int
paulfd79ac92004-10-13 05:06:08 +00001497peer_remote_as_vty (struct vty *vty, const char *peer_str,
1498 const char *as_str, afi_t afi, safi_t safi)
paul718e3742002-12-13 20:15:29 +00001499{
1500 int ret;
1501 struct bgp *bgp;
1502 as_t as;
1503 union sockunion su;
1504
1505 bgp = vty->index;
1506
1507 /* Get AS number. */
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00001508 VTY_GET_INTEGER_RANGE ("AS", as, as_str, 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +00001509
1510 /* If peer is peer group, call proper function. */
1511 ret = str2sockunion (peer_str, &su);
1512 if (ret < 0)
1513 {
1514 ret = peer_group_remote_as (bgp, peer_str, &as);
1515 if (ret < 0)
1516 {
1517 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1518 return CMD_WARNING;
1519 }
1520 return CMD_SUCCESS;
1521 }
1522
1523 if (peer_address_self_check (&su))
1524 {
1525 vty_out (vty, "%% Can not configure the local system as neighbor%s",
1526 VTY_NEWLINE);
1527 return CMD_WARNING;
1528 }
1529
1530 ret = peer_remote_as (bgp, &su, &as, afi, safi);
1531
1532 /* This peer belongs to peer group. */
1533 switch (ret)
1534 {
1535 case BGP_ERR_PEER_GROUP_MEMBER:
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04001536 vty_out (vty, "%% Peer-group AS %u. Cannot configure remote-as for member%s", as, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00001537 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00001538 case BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT:
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04001539 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 +00001540 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00001541 }
1542 return bgp_vty_return (vty, ret);
1543}
1544
1545DEFUN (neighbor_remote_as,
1546 neighbor_remote_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001547 NEIGHBOR_CMD2 "remote-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001548 NEIGHBOR_STR
1549 NEIGHBOR_ADDR_STR2
1550 "Specify a BGP neighbor\n"
1551 AS_STR)
1552{
1553 return peer_remote_as_vty (vty, argv[0], argv[1], AFI_IP, SAFI_UNICAST);
1554}
David Lamparter6b0655a2014-06-04 06:53:35 +02001555
paul718e3742002-12-13 20:15:29 +00001556DEFUN (neighbor_peer_group,
1557 neighbor_peer_group_cmd,
1558 "neighbor WORD peer-group",
1559 NEIGHBOR_STR
1560 "Neighbor tag\n"
1561 "Configure peer-group\n")
1562{
1563 struct bgp *bgp;
1564 struct peer_group *group;
1565
1566 bgp = vty->index;
1567
1568 group = peer_group_get (bgp, argv[0]);
1569 if (! group)
1570 return CMD_WARNING;
1571
1572 return CMD_SUCCESS;
1573}
1574
1575DEFUN (no_neighbor,
1576 no_neighbor_cmd,
1577 NO_NEIGHBOR_CMD2,
1578 NO_STR
1579 NEIGHBOR_STR
1580 NEIGHBOR_ADDR_STR2)
1581{
1582 int ret;
1583 union sockunion su;
1584 struct peer_group *group;
1585 struct peer *peer;
1586
1587 ret = str2sockunion (argv[0], &su);
1588 if (ret < 0)
1589 {
1590 group = peer_group_lookup (vty->index, argv[0]);
1591 if (group)
1592 peer_group_delete (group);
1593 else
1594 {
1595 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1596 return CMD_WARNING;
1597 }
1598 }
1599 else
1600 {
1601 peer = peer_lookup (vty->index, &su);
1602 if (peer)
paul200df112005-06-01 11:17:05 +00001603 peer_delete (peer);
paul718e3742002-12-13 20:15:29 +00001604 }
1605
1606 return CMD_SUCCESS;
1607}
1608
1609ALIAS (no_neighbor,
1610 no_neighbor_remote_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001611 NO_NEIGHBOR_CMD "remote-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001612 NO_STR
1613 NEIGHBOR_STR
1614 NEIGHBOR_ADDR_STR
1615 "Specify a BGP neighbor\n"
1616 AS_STR)
1617
1618DEFUN (no_neighbor_peer_group,
1619 no_neighbor_peer_group_cmd,
1620 "no neighbor WORD peer-group",
1621 NO_STR
1622 NEIGHBOR_STR
1623 "Neighbor tag\n"
1624 "Configure peer-group\n")
1625{
1626 struct peer_group *group;
1627
1628 group = peer_group_lookup (vty->index, argv[0]);
1629 if (group)
1630 peer_group_delete (group);
1631 else
1632 {
1633 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1634 return CMD_WARNING;
1635 }
1636 return CMD_SUCCESS;
1637}
1638
1639DEFUN (no_neighbor_peer_group_remote_as,
1640 no_neighbor_peer_group_remote_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001641 "no neighbor WORD remote-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001642 NO_STR
1643 NEIGHBOR_STR
1644 "Neighbor tag\n"
1645 "Specify a BGP neighbor\n"
1646 AS_STR)
1647{
1648 struct peer_group *group;
1649
1650 group = peer_group_lookup (vty->index, argv[0]);
1651 if (group)
1652 peer_group_remote_as_delete (group);
1653 else
1654 {
1655 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1656 return CMD_WARNING;
1657 }
1658 return CMD_SUCCESS;
1659}
David Lamparter6b0655a2014-06-04 06:53:35 +02001660
paul718e3742002-12-13 20:15:29 +00001661DEFUN (neighbor_local_as,
1662 neighbor_local_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001663 NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001664 NEIGHBOR_STR
1665 NEIGHBOR_ADDR_STR2
1666 "Specify a local-as number\n"
1667 "AS number used as local AS\n")
1668{
1669 struct peer *peer;
1670 int ret;
1671
1672 peer = peer_and_group_lookup_vty (vty, argv[0]);
1673 if (! peer)
1674 return CMD_WARNING;
1675
Andrew Certain9d3f9702012-11-07 23:50:07 +00001676 ret = peer_local_as_set (peer, atoi (argv[1]), 0, 0);
paul718e3742002-12-13 20:15:29 +00001677 return bgp_vty_return (vty, ret);
1678}
1679
1680DEFUN (neighbor_local_as_no_prepend,
1681 neighbor_local_as_no_prepend_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001682 NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend",
paul718e3742002-12-13 20:15:29 +00001683 NEIGHBOR_STR
1684 NEIGHBOR_ADDR_STR2
1685 "Specify a local-as number\n"
1686 "AS number used as local AS\n"
1687 "Do not prepend local-as to updates from ebgp peers\n")
1688{
1689 struct peer *peer;
1690 int ret;
1691
1692 peer = peer_and_group_lookup_vty (vty, argv[0]);
1693 if (! peer)
1694 return CMD_WARNING;
1695
Andrew Certain9d3f9702012-11-07 23:50:07 +00001696 ret = peer_local_as_set (peer, atoi (argv[1]), 1, 0);
paul718e3742002-12-13 20:15:29 +00001697 return bgp_vty_return (vty, ret);
1698}
1699
Andrew Certain9d3f9702012-11-07 23:50:07 +00001700DEFUN (neighbor_local_as_no_prepend_replace_as,
1701 neighbor_local_as_no_prepend_replace_as_cmd,
1702 NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as",
1703 NEIGHBOR_STR
1704 NEIGHBOR_ADDR_STR2
1705 "Specify a local-as number\n"
1706 "AS number used as local AS\n"
1707 "Do not prepend local-as to updates from ebgp peers\n"
1708 "Do not prepend local-as to updates from ibgp peers\n")
1709{
1710 struct peer *peer;
1711 int ret;
1712
1713 peer = peer_and_group_lookup_vty (vty, argv[0]);
1714 if (! peer)
1715 return CMD_WARNING;
1716
1717 ret = peer_local_as_set (peer, atoi (argv[1]), 1, 1);
1718 return bgp_vty_return (vty, ret);
1719}
1720
1721
paul718e3742002-12-13 20:15:29 +00001722DEFUN (no_neighbor_local_as,
1723 no_neighbor_local_as_cmd,
1724 NO_NEIGHBOR_CMD2 "local-as",
1725 NO_STR
1726 NEIGHBOR_STR
1727 NEIGHBOR_ADDR_STR2
1728 "Specify a local-as number\n")
1729{
1730 struct peer *peer;
1731 int ret;
1732
1733 peer = peer_and_group_lookup_vty (vty, argv[0]);
1734 if (! peer)
1735 return CMD_WARNING;
1736
1737 ret = peer_local_as_unset (peer);
1738 return bgp_vty_return (vty, ret);
1739}
1740
1741ALIAS (no_neighbor_local_as,
1742 no_neighbor_local_as_val_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001743 NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001744 NO_STR
1745 NEIGHBOR_STR
1746 NEIGHBOR_ADDR_STR2
1747 "Specify a local-as number\n"
1748 "AS number used as local AS\n")
1749
1750ALIAS (no_neighbor_local_as,
1751 no_neighbor_local_as_val2_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001752 NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend",
paul718e3742002-12-13 20:15:29 +00001753 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")
Andrew Certain9d3f9702012-11-07 23:50:07 +00001759
1760ALIAS (no_neighbor_local_as,
1761 no_neighbor_local_as_val3_cmd,
1762 NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as",
1763 NO_STR
1764 NEIGHBOR_STR
1765 NEIGHBOR_ADDR_STR2
1766 "Specify a local-as number\n"
1767 "AS number used as local AS\n"
1768 "Do not prepend local-as to updates from ebgp peers\n"
1769 "Do not prepend local-as to updates from ibgp peers\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02001770
Paul Jakma0df7c912008-07-21 21:02:49 +00001771DEFUN (neighbor_password,
1772 neighbor_password_cmd,
1773 NEIGHBOR_CMD2 "password LINE",
1774 NEIGHBOR_STR
1775 NEIGHBOR_ADDR_STR2
1776 "Set a password\n"
1777 "The password\n")
1778{
1779 struct peer *peer;
1780 int ret;
1781
1782 peer = peer_and_group_lookup_vty (vty, argv[0]);
1783 if (! peer)
1784 return CMD_WARNING;
1785
1786 ret = peer_password_set (peer, argv[1]);
1787 return bgp_vty_return (vty, ret);
1788}
1789
1790DEFUN (no_neighbor_password,
1791 no_neighbor_password_cmd,
1792 NO_NEIGHBOR_CMD2 "password",
1793 NO_STR
1794 NEIGHBOR_STR
1795 NEIGHBOR_ADDR_STR2
1796 "Set a password\n")
1797{
1798 struct peer *peer;
1799 int ret;
1800
1801 peer = peer_and_group_lookup_vty (vty, argv[0]);
1802 if (! peer)
1803 return CMD_WARNING;
1804
1805 ret = peer_password_unset (peer);
1806 return bgp_vty_return (vty, ret);
1807}
David Lamparter6b0655a2014-06-04 06:53:35 +02001808
paul718e3742002-12-13 20:15:29 +00001809DEFUN (neighbor_activate,
1810 neighbor_activate_cmd,
1811 NEIGHBOR_CMD2 "activate",
1812 NEIGHBOR_STR
1813 NEIGHBOR_ADDR_STR2
1814 "Enable the Address Family for this Neighbor\n")
1815{
1816 struct peer *peer;
1817
1818 peer = peer_and_group_lookup_vty (vty, argv[0]);
1819 if (! peer)
1820 return CMD_WARNING;
1821
1822 peer_activate (peer, bgp_node_afi (vty), bgp_node_safi (vty));
1823
1824 return CMD_SUCCESS;
1825}
1826
1827DEFUN (no_neighbor_activate,
1828 no_neighbor_activate_cmd,
1829 NO_NEIGHBOR_CMD2 "activate",
1830 NO_STR
1831 NEIGHBOR_STR
1832 NEIGHBOR_ADDR_STR2
1833 "Enable the Address Family for this Neighbor\n")
1834{
1835 int ret;
1836 struct peer *peer;
1837
1838 /* Lookup peer. */
1839 peer = peer_and_group_lookup_vty (vty, argv[0]);
1840 if (! peer)
1841 return CMD_WARNING;
1842
1843 ret = peer_deactivate (peer, bgp_node_afi (vty), bgp_node_safi (vty));
1844
1845 return bgp_vty_return (vty, ret);
1846}
David Lamparter6b0655a2014-06-04 06:53:35 +02001847
paul718e3742002-12-13 20:15:29 +00001848DEFUN (neighbor_set_peer_group,
1849 neighbor_set_peer_group_cmd,
1850 NEIGHBOR_CMD "peer-group WORD",
1851 NEIGHBOR_STR
1852 NEIGHBOR_ADDR_STR
1853 "Member of the peer-group\n"
1854 "peer-group name\n")
1855{
1856 int ret;
1857 as_t as;
1858 union sockunion su;
1859 struct bgp *bgp;
1860 struct peer_group *group;
1861
1862 bgp = vty->index;
1863
1864 ret = str2sockunion (argv[0], &su);
1865 if (ret < 0)
1866 {
1867 vty_out (vty, "%% Malformed address: %s%s", argv[0], VTY_NEWLINE);
1868 return CMD_WARNING;
1869 }
1870
1871 group = peer_group_lookup (bgp, argv[1]);
1872 if (! group)
1873 {
1874 vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE);
1875 return CMD_WARNING;
1876 }
1877
1878 if (peer_address_self_check (&su))
1879 {
1880 vty_out (vty, "%% Can not configure the local system as neighbor%s",
1881 VTY_NEWLINE);
1882 return CMD_WARNING;
1883 }
1884
1885 ret = peer_group_bind (bgp, &su, group, bgp_node_afi (vty),
1886 bgp_node_safi (vty), &as);
1887
1888 if (ret == BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT)
1889 {
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04001890 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 +00001891 return CMD_WARNING;
1892 }
1893
1894 return bgp_vty_return (vty, ret);
1895}
1896
1897DEFUN (no_neighbor_set_peer_group,
1898 no_neighbor_set_peer_group_cmd,
1899 NO_NEIGHBOR_CMD "peer-group WORD",
1900 NO_STR
1901 NEIGHBOR_STR
1902 NEIGHBOR_ADDR_STR
1903 "Member of the peer-group\n"
1904 "peer-group name\n")
1905{
1906 int ret;
1907 struct bgp *bgp;
1908 struct peer *peer;
1909 struct peer_group *group;
1910
1911 bgp = vty->index;
1912
1913 peer = peer_lookup_vty (vty, argv[0]);
1914 if (! peer)
1915 return CMD_WARNING;
1916
1917 group = peer_group_lookup (bgp, argv[1]);
1918 if (! group)
1919 {
1920 vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE);
1921 return CMD_WARNING;
1922 }
1923
1924 ret = peer_group_unbind (bgp, peer, group, bgp_node_afi (vty),
1925 bgp_node_safi (vty));
1926
1927 return bgp_vty_return (vty, ret);
1928}
David Lamparter6b0655a2014-06-04 06:53:35 +02001929
paul94f2b392005-06-28 12:44:16 +00001930static int
paulfd79ac92004-10-13 05:06:08 +00001931peer_flag_modify_vty (struct vty *vty, const char *ip_str,
1932 u_int16_t flag, int set)
paul718e3742002-12-13 20:15:29 +00001933{
1934 int ret;
1935 struct peer *peer;
1936
1937 peer = peer_and_group_lookup_vty (vty, ip_str);
1938 if (! peer)
1939 return CMD_WARNING;
1940
1941 if (set)
1942 ret = peer_flag_set (peer, flag);
1943 else
1944 ret = peer_flag_unset (peer, flag);
1945
1946 return bgp_vty_return (vty, ret);
1947}
1948
paul94f2b392005-06-28 12:44:16 +00001949static int
paulfd79ac92004-10-13 05:06:08 +00001950peer_flag_set_vty (struct vty *vty, const char *ip_str, u_int16_t flag)
paul718e3742002-12-13 20:15:29 +00001951{
1952 return peer_flag_modify_vty (vty, ip_str, flag, 1);
1953}
1954
paul94f2b392005-06-28 12:44:16 +00001955static int
paulfd79ac92004-10-13 05:06:08 +00001956peer_flag_unset_vty (struct vty *vty, const char *ip_str, u_int16_t flag)
paul718e3742002-12-13 20:15:29 +00001957{
1958 return peer_flag_modify_vty (vty, ip_str, flag, 0);
1959}
1960
1961/* neighbor passive. */
1962DEFUN (neighbor_passive,
1963 neighbor_passive_cmd,
1964 NEIGHBOR_CMD2 "passive",
1965 NEIGHBOR_STR
1966 NEIGHBOR_ADDR_STR2
1967 "Don't send open messages to this neighbor\n")
1968{
1969 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_PASSIVE);
1970}
1971
1972DEFUN (no_neighbor_passive,
1973 no_neighbor_passive_cmd,
1974 NO_NEIGHBOR_CMD2 "passive",
1975 NO_STR
1976 NEIGHBOR_STR
1977 NEIGHBOR_ADDR_STR2
1978 "Don't send open messages to this neighbor\n")
1979{
1980 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_PASSIVE);
1981}
David Lamparter6b0655a2014-06-04 06:53:35 +02001982
paul718e3742002-12-13 20:15:29 +00001983/* neighbor shutdown. */
1984DEFUN (neighbor_shutdown,
1985 neighbor_shutdown_cmd,
1986 NEIGHBOR_CMD2 "shutdown",
1987 NEIGHBOR_STR
1988 NEIGHBOR_ADDR_STR2
1989 "Administratively shut down this neighbor\n")
1990{
1991 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_SHUTDOWN);
1992}
1993
1994DEFUN (no_neighbor_shutdown,
1995 no_neighbor_shutdown_cmd,
1996 NO_NEIGHBOR_CMD2 "shutdown",
1997 NO_STR
1998 NEIGHBOR_STR
1999 NEIGHBOR_ADDR_STR2
2000 "Administratively shut down this neighbor\n")
2001{
2002 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_SHUTDOWN);
2003}
David Lamparter6b0655a2014-06-04 06:53:35 +02002004
hassoc9502432005-02-01 22:01:48 +00002005/* Deprecated neighbor capability route-refresh. */
2006DEFUN_DEPRECATED (neighbor_capability_route_refresh,
2007 neighbor_capability_route_refresh_cmd,
2008 NEIGHBOR_CMD2 "capability route-refresh",
2009 NEIGHBOR_STR
2010 NEIGHBOR_ADDR_STR2
2011 "Advertise capability to the peer\n"
2012 "Advertise route-refresh capability to this neighbor\n")
paul718e3742002-12-13 20:15:29 +00002013{
hassoc9502432005-02-01 22:01:48 +00002014 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00002015}
2016
hassoc9502432005-02-01 22:01:48 +00002017DEFUN_DEPRECATED (no_neighbor_capability_route_refresh,
2018 no_neighbor_capability_route_refresh_cmd,
2019 NO_NEIGHBOR_CMD2 "capability route-refresh",
2020 NO_STR
2021 NEIGHBOR_STR
2022 NEIGHBOR_ADDR_STR2
2023 "Advertise capability to the peer\n"
2024 "Advertise route-refresh capability to this neighbor\n")
paul718e3742002-12-13 20:15:29 +00002025{
hassoc9502432005-02-01 22:01:48 +00002026 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00002027}
David Lamparter6b0655a2014-06-04 06:53:35 +02002028
paul718e3742002-12-13 20:15:29 +00002029/* neighbor capability dynamic. */
2030DEFUN (neighbor_capability_dynamic,
2031 neighbor_capability_dynamic_cmd,
2032 NEIGHBOR_CMD2 "capability dynamic",
2033 NEIGHBOR_STR
2034 NEIGHBOR_ADDR_STR2
2035 "Advertise capability to the peer\n"
2036 "Advertise dynamic capability to this neighbor\n")
2037{
2038 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY);
2039}
2040
2041DEFUN (no_neighbor_capability_dynamic,
2042 no_neighbor_capability_dynamic_cmd,
2043 NO_NEIGHBOR_CMD2 "capability dynamic",
2044 NO_STR
2045 NEIGHBOR_STR
2046 NEIGHBOR_ADDR_STR2
2047 "Advertise capability to the peer\n"
2048 "Advertise dynamic capability to this neighbor\n")
2049{
2050 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY);
2051}
David Lamparter6b0655a2014-06-04 06:53:35 +02002052
paul718e3742002-12-13 20:15:29 +00002053/* neighbor dont-capability-negotiate */
2054DEFUN (neighbor_dont_capability_negotiate,
2055 neighbor_dont_capability_negotiate_cmd,
2056 NEIGHBOR_CMD2 "dont-capability-negotiate",
2057 NEIGHBOR_STR
2058 NEIGHBOR_ADDR_STR2
2059 "Do not perform capability negotiation\n")
2060{
2061 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY);
2062}
2063
2064DEFUN (no_neighbor_dont_capability_negotiate,
2065 no_neighbor_dont_capability_negotiate_cmd,
2066 NO_NEIGHBOR_CMD2 "dont-capability-negotiate",
2067 NO_STR
2068 NEIGHBOR_STR
2069 NEIGHBOR_ADDR_STR2
2070 "Do not perform capability negotiation\n")
2071{
2072 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY);
2073}
David Lamparter6b0655a2014-06-04 06:53:35 +02002074
paul94f2b392005-06-28 12:44:16 +00002075static int
paulfd79ac92004-10-13 05:06:08 +00002076peer_af_flag_modify_vty (struct vty *vty, const char *peer_str, afi_t afi,
paulfee0f4c2004-09-13 05:12:46 +00002077 safi_t safi, u_int32_t flag, int set)
paul718e3742002-12-13 20:15:29 +00002078{
2079 int ret;
2080 struct peer *peer;
2081
2082 peer = peer_and_group_lookup_vty (vty, peer_str);
2083 if (! peer)
2084 return CMD_WARNING;
2085
2086 if (set)
2087 ret = peer_af_flag_set (peer, afi, safi, flag);
2088 else
2089 ret = peer_af_flag_unset (peer, afi, safi, flag);
2090
2091 return bgp_vty_return (vty, ret);
2092}
2093
paul94f2b392005-06-28 12:44:16 +00002094static int
paulfd79ac92004-10-13 05:06:08 +00002095peer_af_flag_set_vty (struct vty *vty, const char *peer_str, afi_t afi,
paulfee0f4c2004-09-13 05:12:46 +00002096 safi_t safi, u_int32_t flag)
paul718e3742002-12-13 20:15:29 +00002097{
2098 return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 1);
2099}
2100
paul94f2b392005-06-28 12:44:16 +00002101static int
paulfd79ac92004-10-13 05:06:08 +00002102peer_af_flag_unset_vty (struct vty *vty, const char *peer_str, afi_t afi,
paulfee0f4c2004-09-13 05:12:46 +00002103 safi_t safi, u_int32_t flag)
paul718e3742002-12-13 20:15:29 +00002104{
2105 return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 0);
2106}
David Lamparter6b0655a2014-06-04 06:53:35 +02002107
paul718e3742002-12-13 20:15:29 +00002108/* neighbor capability orf prefix-list. */
2109DEFUN (neighbor_capability_orf_prefix,
2110 neighbor_capability_orf_prefix_cmd,
2111 NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)",
2112 NEIGHBOR_STR
2113 NEIGHBOR_ADDR_STR2
2114 "Advertise capability to the peer\n"
2115 "Advertise ORF capability to the peer\n"
2116 "Advertise prefixlist ORF capability to this neighbor\n"
2117 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
2118 "Capability to RECEIVE the ORF from this neighbor\n"
2119 "Capability to SEND the ORF to this neighbor\n")
2120{
2121 u_int16_t flag = 0;
2122
2123 if (strncmp (argv[1], "s", 1) == 0)
2124 flag = PEER_FLAG_ORF_PREFIX_SM;
2125 else if (strncmp (argv[1], "r", 1) == 0)
2126 flag = PEER_FLAG_ORF_PREFIX_RM;
2127 else if (strncmp (argv[1], "b", 1) == 0)
2128 flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM;
2129 else
2130 return CMD_WARNING;
2131
2132 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2133 bgp_node_safi (vty), flag);
2134}
2135
2136DEFUN (no_neighbor_capability_orf_prefix,
2137 no_neighbor_capability_orf_prefix_cmd,
2138 NO_NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)",
2139 NO_STR
2140 NEIGHBOR_STR
2141 NEIGHBOR_ADDR_STR2
2142 "Advertise capability to the peer\n"
2143 "Advertise ORF capability to the peer\n"
2144 "Advertise prefixlist ORF capability to this neighbor\n"
2145 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
2146 "Capability to RECEIVE the ORF from this neighbor\n"
2147 "Capability to SEND the ORF to this neighbor\n")
2148{
2149 u_int16_t flag = 0;
2150
2151 if (strncmp (argv[1], "s", 1) == 0)
2152 flag = PEER_FLAG_ORF_PREFIX_SM;
2153 else if (strncmp (argv[1], "r", 1) == 0)
2154 flag = PEER_FLAG_ORF_PREFIX_RM;
2155 else if (strncmp (argv[1], "b", 1) == 0)
2156 flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM;
2157 else
2158 return CMD_WARNING;
2159
2160 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2161 bgp_node_safi (vty), flag);
2162}
David Lamparter6b0655a2014-06-04 06:53:35 +02002163
paul718e3742002-12-13 20:15:29 +00002164/* neighbor next-hop-self. */
2165DEFUN (neighbor_nexthop_self,
2166 neighbor_nexthop_self_cmd,
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002167 NEIGHBOR_CMD2 "next-hop-self {all}",
paul718e3742002-12-13 20:15:29 +00002168 NEIGHBOR_STR
2169 NEIGHBOR_ADDR_STR2
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002170 "Disable the next hop calculation for this neighbor\n"
2171 "Apply also to ibgp-learned routes when acting as a route reflector\n")
paul718e3742002-12-13 20:15:29 +00002172{
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002173 u_int32_t flags = PEER_FLAG_NEXTHOP_SELF, unset = 0;
2174 int rc;
2175
2176 /* Check if "all" is specified */
2177 if (argv[1] != NULL)
2178 flags |= PEER_FLAG_NEXTHOP_SELF_ALL;
2179 else
2180 unset |= PEER_FLAG_NEXTHOP_SELF_ALL;
2181
2182 rc = peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2183 bgp_node_safi (vty), flags);
2184 if ( rc == CMD_SUCCESS && unset )
2185 rc = peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2186 bgp_node_safi (vty), unset);
2187 return rc;
paul718e3742002-12-13 20:15:29 +00002188}
2189
2190DEFUN (no_neighbor_nexthop_self,
2191 no_neighbor_nexthop_self_cmd,
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002192 NO_NEIGHBOR_CMD2 "next-hop-self {all}",
paul718e3742002-12-13 20:15:29 +00002193 NO_STR
2194 NEIGHBOR_STR
2195 NEIGHBOR_ADDR_STR2
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002196 "Disable the next hop calculation for this neighbor\n"
2197 "Apply also to ibgp-learned routes when acting as a route reflector\n")
paul718e3742002-12-13 20:15:29 +00002198{
2199 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002200 bgp_node_safi (vty),
2201 PEER_FLAG_NEXTHOP_SELF|PEER_FLAG_NEXTHOP_SELF_ALL);
paul718e3742002-12-13 20:15:29 +00002202}
David Lamparter6b0655a2014-06-04 06:53:35 +02002203
paul718e3742002-12-13 20:15:29 +00002204/* neighbor remove-private-AS. */
2205DEFUN (neighbor_remove_private_as,
2206 neighbor_remove_private_as_cmd,
2207 NEIGHBOR_CMD2 "remove-private-AS",
2208 NEIGHBOR_STR
2209 NEIGHBOR_ADDR_STR2
2210 "Remove private AS number from outbound updates\n")
2211{
2212 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2213 bgp_node_safi (vty),
2214 PEER_FLAG_REMOVE_PRIVATE_AS);
2215}
2216
2217DEFUN (no_neighbor_remove_private_as,
2218 no_neighbor_remove_private_as_cmd,
2219 NO_NEIGHBOR_CMD2 "remove-private-AS",
2220 NO_STR
2221 NEIGHBOR_STR
2222 NEIGHBOR_ADDR_STR2
2223 "Remove private AS number from outbound updates\n")
2224{
2225 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2226 bgp_node_safi (vty),
2227 PEER_FLAG_REMOVE_PRIVATE_AS);
2228}
David Lamparter6b0655a2014-06-04 06:53:35 +02002229
paul718e3742002-12-13 20:15:29 +00002230/* neighbor send-community. */
2231DEFUN (neighbor_send_community,
2232 neighbor_send_community_cmd,
2233 NEIGHBOR_CMD2 "send-community",
2234 NEIGHBOR_STR
2235 NEIGHBOR_ADDR_STR2
2236 "Send Community attribute to this neighbor\n")
2237{
2238 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2239 bgp_node_safi (vty),
2240 PEER_FLAG_SEND_COMMUNITY);
2241}
2242
2243DEFUN (no_neighbor_send_community,
2244 no_neighbor_send_community_cmd,
2245 NO_NEIGHBOR_CMD2 "send-community",
2246 NO_STR
2247 NEIGHBOR_STR
2248 NEIGHBOR_ADDR_STR2
2249 "Send Community attribute to this neighbor\n")
2250{
2251 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2252 bgp_node_safi (vty),
2253 PEER_FLAG_SEND_COMMUNITY);
2254}
David Lamparter6b0655a2014-06-04 06:53:35 +02002255
paul718e3742002-12-13 20:15:29 +00002256/* neighbor send-community extended. */
2257DEFUN (neighbor_send_community_type,
2258 neighbor_send_community_type_cmd,
2259 NEIGHBOR_CMD2 "send-community (both|extended|standard)",
2260 NEIGHBOR_STR
2261 NEIGHBOR_ADDR_STR2
2262 "Send Community attribute to this neighbor\n"
2263 "Send Standard and Extended Community attributes\n"
2264 "Send Extended Community attributes\n"
2265 "Send Standard Community attributes\n")
2266{
2267 if (strncmp (argv[1], "s", 1) == 0)
2268 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2269 bgp_node_safi (vty),
2270 PEER_FLAG_SEND_COMMUNITY);
2271 if (strncmp (argv[1], "e", 1) == 0)
2272 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2273 bgp_node_safi (vty),
2274 PEER_FLAG_SEND_EXT_COMMUNITY);
2275
2276 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2277 bgp_node_safi (vty),
2278 (PEER_FLAG_SEND_COMMUNITY|
2279 PEER_FLAG_SEND_EXT_COMMUNITY));
2280}
2281
2282DEFUN (no_neighbor_send_community_type,
2283 no_neighbor_send_community_type_cmd,
2284 NO_NEIGHBOR_CMD2 "send-community (both|extended|standard)",
2285 NO_STR
2286 NEIGHBOR_STR
2287 NEIGHBOR_ADDR_STR2
2288 "Send Community attribute to this neighbor\n"
2289 "Send Standard and Extended Community attributes\n"
2290 "Send Extended Community attributes\n"
2291 "Send Standard Community attributes\n")
2292{
2293 if (strncmp (argv[1], "s", 1) == 0)
2294 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2295 bgp_node_safi (vty),
2296 PEER_FLAG_SEND_COMMUNITY);
2297 if (strncmp (argv[1], "e", 1) == 0)
2298 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2299 bgp_node_safi (vty),
2300 PEER_FLAG_SEND_EXT_COMMUNITY);
2301
2302 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2303 bgp_node_safi (vty),
2304 (PEER_FLAG_SEND_COMMUNITY |
2305 PEER_FLAG_SEND_EXT_COMMUNITY));
2306}
David Lamparter6b0655a2014-06-04 06:53:35 +02002307
paul718e3742002-12-13 20:15:29 +00002308/* neighbor soft-reconfig. */
2309DEFUN (neighbor_soft_reconfiguration,
2310 neighbor_soft_reconfiguration_cmd,
2311 NEIGHBOR_CMD2 "soft-reconfiguration inbound",
2312 NEIGHBOR_STR
2313 NEIGHBOR_ADDR_STR2
2314 "Per neighbor soft reconfiguration\n"
2315 "Allow inbound soft reconfiguration for this neighbor\n")
2316{
2317 return peer_af_flag_set_vty (vty, argv[0],
2318 bgp_node_afi (vty), bgp_node_safi (vty),
2319 PEER_FLAG_SOFT_RECONFIG);
2320}
2321
2322DEFUN (no_neighbor_soft_reconfiguration,
2323 no_neighbor_soft_reconfiguration_cmd,
2324 NO_NEIGHBOR_CMD2 "soft-reconfiguration inbound",
2325 NO_STR
2326 NEIGHBOR_STR
2327 NEIGHBOR_ADDR_STR2
2328 "Per neighbor soft reconfiguration\n"
2329 "Allow inbound soft reconfiguration for this neighbor\n")
2330{
2331 return peer_af_flag_unset_vty (vty, argv[0],
2332 bgp_node_afi (vty), bgp_node_safi (vty),
2333 PEER_FLAG_SOFT_RECONFIG);
2334}
David Lamparter6b0655a2014-06-04 06:53:35 +02002335
paul718e3742002-12-13 20:15:29 +00002336DEFUN (neighbor_route_reflector_client,
2337 neighbor_route_reflector_client_cmd,
2338 NEIGHBOR_CMD2 "route-reflector-client",
2339 NEIGHBOR_STR
2340 NEIGHBOR_ADDR_STR2
2341 "Configure a neighbor as Route Reflector client\n")
2342{
2343 struct peer *peer;
2344
2345
2346 peer = peer_and_group_lookup_vty (vty, argv[0]);
2347 if (! peer)
2348 return CMD_WARNING;
2349
2350 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2351 bgp_node_safi (vty),
2352 PEER_FLAG_REFLECTOR_CLIENT);
2353}
2354
2355DEFUN (no_neighbor_route_reflector_client,
2356 no_neighbor_route_reflector_client_cmd,
2357 NO_NEIGHBOR_CMD2 "route-reflector-client",
2358 NO_STR
2359 NEIGHBOR_STR
2360 NEIGHBOR_ADDR_STR2
2361 "Configure a neighbor as Route Reflector client\n")
2362{
2363 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2364 bgp_node_safi (vty),
2365 PEER_FLAG_REFLECTOR_CLIENT);
2366}
David Lamparter6b0655a2014-06-04 06:53:35 +02002367
paul94f2b392005-06-28 12:44:16 +00002368static int
paulfd79ac92004-10-13 05:06:08 +00002369peer_rsclient_set_vty (struct vty *vty, const char *peer_str,
2370 int afi, int safi)
paulfee0f4c2004-09-13 05:12:46 +00002371{
2372 int ret;
2373 struct bgp *bgp;
2374 struct peer *peer;
2375 struct peer_group *group;
paul1eb8ef22005-04-07 07:30:20 +00002376 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00002377 struct bgp_filter *pfilter;
2378 struct bgp_filter *gfilter;
Chris Caputo228da422009-07-18 05:44:03 +00002379 int locked_and_added = 0;
paulfee0f4c2004-09-13 05:12:46 +00002380
2381 bgp = vty->index;
2382
2383 peer = peer_and_group_lookup_vty (vty, peer_str);
2384 if ( ! peer )
2385 return CMD_WARNING;
2386
2387 /* If it is already a RS-Client, don't do anything. */
2388 if ( CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) )
2389 return CMD_SUCCESS;
2390
2391 if ( ! peer_rsclient_active (peer) )
paul200df112005-06-01 11:17:05 +00002392 {
2393 peer = peer_lock (peer); /* rsclient peer list reference */
2394 listnode_add_sort (bgp->rsclient, peer);
Chris Caputo228da422009-07-18 05:44:03 +00002395 locked_and_added = 1;
paul200df112005-06-01 11:17:05 +00002396 }
paulfee0f4c2004-09-13 05:12:46 +00002397
2398 ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2399 if (ret < 0)
Chris Caputo228da422009-07-18 05:44:03 +00002400 {
2401 if (locked_and_added)
2402 {
2403 listnode_delete (bgp->rsclient, peer);
2404 peer_unlock (peer); /* rsclient peer list reference */
2405 }
2406
2407 return bgp_vty_return (vty, ret);
2408 }
paulfee0f4c2004-09-13 05:12:46 +00002409
Paul Jakma64e580a2006-02-21 01:09:01 +00002410 peer->rib[afi][safi] = bgp_table_init (afi, safi);
paulfee0f4c2004-09-13 05:12:46 +00002411 peer->rib[afi][safi]->type = BGP_TABLE_RSCLIENT;
Chris Caputo228da422009-07-18 05:44:03 +00002412 /* RIB peer reference. Released when table is free'd in bgp_table_free. */
2413 peer->rib[afi][safi]->owner = peer_lock (peer);
paulfee0f4c2004-09-13 05:12:46 +00002414
2415 /* Check for existing 'network' and 'redistribute' routes. */
2416 bgp_check_local_routes_rsclient (peer, afi, safi);
2417
2418 /* Check for routes for peers configured with 'soft-reconfiguration'. */
2419 bgp_soft_reconfig_rsclient (peer, afi, safi);
2420
2421 if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP))
2422 {
2423 group = peer->group;
2424 gfilter = &peer->filter[afi][safi];
2425
paul1eb8ef22005-04-07 07:30:20 +00002426 for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00002427 {
2428 pfilter = &peer->filter[afi][safi];
2429
2430 /* Members of a non-RS-Client group should not be RS-Clients, as that
2431 is checked when the become part of the peer-group */
2432 ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2433 if (ret < 0)
2434 return bgp_vty_return (vty, ret);
2435
2436 /* Make peer's RIB point to group's RIB. */
2437 peer->rib[afi][safi] = group->conf->rib[afi][safi];
2438
2439 /* Import policy. */
2440 if (pfilter->map[RMAP_IMPORT].name)
2441 free (pfilter->map[RMAP_IMPORT].name);
2442 if (gfilter->map[RMAP_IMPORT].name)
2443 {
2444 pfilter->map[RMAP_IMPORT].name = strdup (gfilter->map[RMAP_IMPORT].name);
2445 pfilter->map[RMAP_IMPORT].map = gfilter->map[RMAP_IMPORT].map;
2446 }
2447 else
2448 {
2449 pfilter->map[RMAP_IMPORT].name = NULL;
2450 pfilter->map[RMAP_IMPORT].map =NULL;
2451 }
2452
2453 /* Export policy. */
2454 if (gfilter->map[RMAP_EXPORT].name && ! pfilter->map[RMAP_EXPORT].name)
2455 {
2456 pfilter->map[RMAP_EXPORT].name = strdup (gfilter->map[RMAP_EXPORT].name);
2457 pfilter->map[RMAP_EXPORT].map = gfilter->map[RMAP_EXPORT].map;
2458 }
2459 }
2460 }
2461 return CMD_SUCCESS;
2462}
2463
paul94f2b392005-06-28 12:44:16 +00002464static int
paulfd79ac92004-10-13 05:06:08 +00002465peer_rsclient_unset_vty (struct vty *vty, const char *peer_str,
2466 int afi, int safi)
paulfee0f4c2004-09-13 05:12:46 +00002467{
2468 int ret;
2469 struct bgp *bgp;
2470 struct peer *peer;
2471 struct peer_group *group;
paul1eb8ef22005-04-07 07:30:20 +00002472 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00002473
2474 bgp = vty->index;
2475
2476 peer = peer_and_group_lookup_vty (vty, peer_str);
2477 if ( ! peer )
2478 return CMD_WARNING;
2479
2480 /* If it is not a RS-Client, don't do anything. */
2481 if ( ! CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) )
2482 return CMD_SUCCESS;
2483
2484 if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP))
2485 {
2486 group = peer->group;
2487
paul1eb8ef22005-04-07 07:30:20 +00002488 for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00002489 {
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 peer->rib[afi][safi] = NULL;
2495 }
2496
2497 peer = group->conf;
2498 }
2499
2500 ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2501 if (ret < 0)
2502 return bgp_vty_return (vty, ret);
2503
2504 if ( ! peer_rsclient_active (peer) )
paul200df112005-06-01 11:17:05 +00002505 {
Chris Caputo228da422009-07-18 05:44:03 +00002506 bgp_clear_route (peer, afi, safi, BGP_CLEAR_ROUTE_MY_RSCLIENT);
paul200df112005-06-01 11:17:05 +00002507 listnode_delete (bgp->rsclient, peer);
Chris Caputo228da422009-07-18 05:44:03 +00002508 peer_unlock (peer); /* peer bgp rsclient reference */
paul200df112005-06-01 11:17:05 +00002509 }
paulfee0f4c2004-09-13 05:12:46 +00002510
Paul Jakmab608d5b2008-07-02 02:12:07 +00002511 bgp_table_finish (&peer->rib[bgp_node_afi(vty)][bgp_node_safi(vty)]);
paulfee0f4c2004-09-13 05:12:46 +00002512
2513 return CMD_SUCCESS;
2514}
David Lamparter6b0655a2014-06-04 06:53:35 +02002515
paul718e3742002-12-13 20:15:29 +00002516/* neighbor route-server-client. */
2517DEFUN (neighbor_route_server_client,
2518 neighbor_route_server_client_cmd,
2519 NEIGHBOR_CMD2 "route-server-client",
2520 NEIGHBOR_STR
2521 NEIGHBOR_ADDR_STR2
2522 "Configure a neighbor as Route Server client\n")
2523{
paulfee0f4c2004-09-13 05:12:46 +00002524 return peer_rsclient_set_vty (vty, argv[0], bgp_node_afi(vty),
2525 bgp_node_safi(vty));
paul718e3742002-12-13 20:15:29 +00002526}
2527
2528DEFUN (no_neighbor_route_server_client,
2529 no_neighbor_route_server_client_cmd,
2530 NO_NEIGHBOR_CMD2 "route-server-client",
2531 NO_STR
2532 NEIGHBOR_STR
2533 NEIGHBOR_ADDR_STR2
2534 "Configure a neighbor as Route Server client\n")
2535{
paulfee0f4c2004-09-13 05:12:46 +00002536 return peer_rsclient_unset_vty (vty, argv[0], bgp_node_afi(vty),
2537 bgp_node_safi(vty));
2538}
David Lamparter6b0655a2014-06-04 06:53:35 +02002539
paulfee0f4c2004-09-13 05:12:46 +00002540DEFUN (neighbor_nexthop_local_unchanged,
2541 neighbor_nexthop_local_unchanged_cmd,
2542 NEIGHBOR_CMD2 "nexthop-local unchanged",
2543 NEIGHBOR_STR
2544 NEIGHBOR_ADDR_STR2
2545 "Configure treatment of outgoing link-local nexthop attribute\n"
2546 "Leave link-local nexthop unchanged for this peer\n")
2547{
2548 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2549 bgp_node_safi (vty),
2550 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED );
2551}
David Lamparter6b0655a2014-06-04 06:53:35 +02002552
paulfee0f4c2004-09-13 05:12:46 +00002553DEFUN (no_neighbor_nexthop_local_unchanged,
2554 no_neighbor_nexthop_local_unchanged_cmd,
2555 NO_NEIGHBOR_CMD2 "nexthop-local unchanged",
2556 NO_STR
2557 NEIGHBOR_STR
2558 NEIGHBOR_ADDR_STR2
2559 "Configure treatment of outgoing link-local-nexthop attribute\n"
2560 "Leave link-local nexthop unchanged for this peer\n")
2561{
paul718e3742002-12-13 20:15:29 +00002562 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2563 bgp_node_safi (vty),
paulfee0f4c2004-09-13 05:12:46 +00002564 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED );
paul718e3742002-12-13 20:15:29 +00002565}
David Lamparter6b0655a2014-06-04 06:53:35 +02002566
paul718e3742002-12-13 20:15:29 +00002567DEFUN (neighbor_attr_unchanged,
2568 neighbor_attr_unchanged_cmd,
2569 NEIGHBOR_CMD2 "attribute-unchanged",
2570 NEIGHBOR_STR
2571 NEIGHBOR_ADDR_STR2
2572 "BGP attribute is propagated unchanged to this neighbor\n")
2573{
2574 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2575 bgp_node_safi (vty),
2576 (PEER_FLAG_AS_PATH_UNCHANGED |
2577 PEER_FLAG_NEXTHOP_UNCHANGED |
2578 PEER_FLAG_MED_UNCHANGED));
2579}
2580
2581DEFUN (neighbor_attr_unchanged1,
2582 neighbor_attr_unchanged1_cmd,
2583 NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)",
2584 NEIGHBOR_STR
2585 NEIGHBOR_ADDR_STR2
2586 "BGP attribute is propagated unchanged to this neighbor\n"
2587 "As-path attribute\n"
2588 "Nexthop attribute\n"
2589 "Med attribute\n")
2590{
2591 u_int16_t flags = 0;
2592
2593 if (strncmp (argv[1], "as-path", 1) == 0)
2594 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2595 else if (strncmp (argv[1], "next-hop", 1) == 0)
2596 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2597 else if (strncmp (argv[1], "med", 1) == 0)
2598 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2599
2600 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2601 bgp_node_safi (vty), flags);
2602}
2603
2604DEFUN (neighbor_attr_unchanged2,
2605 neighbor_attr_unchanged2_cmd,
2606 NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)",
2607 NEIGHBOR_STR
2608 NEIGHBOR_ADDR_STR2
2609 "BGP attribute is propagated unchanged to this neighbor\n"
2610 "As-path attribute\n"
2611 "Nexthop attribute\n"
2612 "Med attribute\n")
2613{
2614 u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED;
2615
2616 if (strncmp (argv[1], "next-hop", 1) == 0)
2617 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2618 else if (strncmp (argv[1], "med", 1) == 0)
2619 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2620
2621 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2622 bgp_node_safi (vty), flags);
2623
2624}
2625
2626DEFUN (neighbor_attr_unchanged3,
2627 neighbor_attr_unchanged3_cmd,
2628 NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)",
2629 NEIGHBOR_STR
2630 NEIGHBOR_ADDR_STR2
2631 "BGP attribute is propagated unchanged to this neighbor\n"
2632 "Nexthop attribute\n"
2633 "As-path attribute\n"
2634 "Med attribute\n")
2635{
2636 u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED;
2637
2638 if (strncmp (argv[1], "as-path", 1) == 0)
2639 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2640 else if (strncmp (argv[1], "med", 1) == 0)
2641 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2642
2643 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2644 bgp_node_safi (vty), flags);
2645}
2646
2647DEFUN (neighbor_attr_unchanged4,
2648 neighbor_attr_unchanged4_cmd,
2649 NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)",
2650 NEIGHBOR_STR
2651 NEIGHBOR_ADDR_STR2
2652 "BGP attribute is propagated unchanged to this neighbor\n"
2653 "Med attribute\n"
2654 "As-path attribute\n"
2655 "Nexthop attribute\n")
2656{
2657 u_int16_t flags = PEER_FLAG_MED_UNCHANGED;
2658
2659 if (strncmp (argv[1], "as-path", 1) == 0)
2660 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2661 else if (strncmp (argv[1], "next-hop", 1) == 0)
2662 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2663
2664 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2665 bgp_node_safi (vty), flags);
2666}
2667
2668ALIAS (neighbor_attr_unchanged,
2669 neighbor_attr_unchanged5_cmd,
2670 NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med",
2671 NEIGHBOR_STR
2672 NEIGHBOR_ADDR_STR2
2673 "BGP attribute is propagated unchanged to this neighbor\n"
2674 "As-path attribute\n"
2675 "Nexthop attribute\n"
2676 "Med attribute\n")
2677
2678ALIAS (neighbor_attr_unchanged,
2679 neighbor_attr_unchanged6_cmd,
2680 NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop",
2681 NEIGHBOR_STR
2682 NEIGHBOR_ADDR_STR2
2683 "BGP attribute is propagated unchanged to this neighbor\n"
2684 "As-path attribute\n"
2685 "Med attribute\n"
2686 "Nexthop attribute\n")
2687
2688ALIAS (neighbor_attr_unchanged,
2689 neighbor_attr_unchanged7_cmd,
2690 NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path",
2691 NEIGHBOR_STR
2692 NEIGHBOR_ADDR_STR2
2693 "BGP attribute is propagated unchanged to this neighbor\n"
2694 "Nexthop attribute\n"
2695 "Med attribute\n"
2696 "As-path attribute\n")
2697
2698ALIAS (neighbor_attr_unchanged,
2699 neighbor_attr_unchanged8_cmd,
2700 NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med",
2701 NEIGHBOR_STR
2702 NEIGHBOR_ADDR_STR2
2703 "BGP attribute is propagated unchanged to this neighbor\n"
2704 "Nexthop attribute\n"
2705 "As-path attribute\n"
2706 "Med attribute\n")
2707
2708ALIAS (neighbor_attr_unchanged,
2709 neighbor_attr_unchanged9_cmd,
2710 NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path",
2711 NEIGHBOR_STR
2712 NEIGHBOR_ADDR_STR2
2713 "BGP attribute is propagated unchanged to this neighbor\n"
2714 "Med attribute\n"
2715 "Nexthop attribute\n"
2716 "As-path attribute\n")
2717
2718ALIAS (neighbor_attr_unchanged,
2719 neighbor_attr_unchanged10_cmd,
2720 NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop",
2721 NEIGHBOR_STR
2722 NEIGHBOR_ADDR_STR2
2723 "BGP attribute is propagated unchanged to this neighbor\n"
2724 "Med attribute\n"
2725 "As-path attribute\n"
2726 "Nexthop attribute\n")
2727
2728DEFUN (no_neighbor_attr_unchanged,
2729 no_neighbor_attr_unchanged_cmd,
2730 NO_NEIGHBOR_CMD2 "attribute-unchanged",
2731 NO_STR
2732 NEIGHBOR_STR
2733 NEIGHBOR_ADDR_STR2
2734 "BGP attribute is propagated unchanged to this neighbor\n")
2735{
2736 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2737 bgp_node_safi (vty),
2738 (PEER_FLAG_AS_PATH_UNCHANGED |
2739 PEER_FLAG_NEXTHOP_UNCHANGED |
2740 PEER_FLAG_MED_UNCHANGED));
2741}
2742
2743DEFUN (no_neighbor_attr_unchanged1,
2744 no_neighbor_attr_unchanged1_cmd,
2745 NO_NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)",
2746 NO_STR
2747 NEIGHBOR_STR
2748 NEIGHBOR_ADDR_STR2
2749 "BGP attribute is propagated unchanged to this neighbor\n"
2750 "As-path attribute\n"
2751 "Nexthop attribute\n"
2752 "Med attribute\n")
2753{
2754 u_int16_t flags = 0;
2755
2756 if (strncmp (argv[1], "as-path", 1) == 0)
2757 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2758 else if (strncmp (argv[1], "next-hop", 1) == 0)
2759 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2760 else if (strncmp (argv[1], "med", 1) == 0)
2761 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2762
2763 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2764 bgp_node_safi (vty), flags);
2765}
2766
2767DEFUN (no_neighbor_attr_unchanged2,
2768 no_neighbor_attr_unchanged2_cmd,
2769 NO_NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)",
2770 NO_STR
2771 NEIGHBOR_STR
2772 NEIGHBOR_ADDR_STR2
2773 "BGP attribute is propagated unchanged to this neighbor\n"
2774 "As-path attribute\n"
2775 "Nexthop attribute\n"
2776 "Med attribute\n")
2777{
2778 u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED;
2779
2780 if (strncmp (argv[1], "next-hop", 1) == 0)
2781 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2782 else if (strncmp (argv[1], "med", 1) == 0)
2783 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2784
2785 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2786 bgp_node_safi (vty), flags);
2787}
2788
2789DEFUN (no_neighbor_attr_unchanged3,
2790 no_neighbor_attr_unchanged3_cmd,
2791 NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)",
2792 NO_STR
2793 NEIGHBOR_STR
2794 NEIGHBOR_ADDR_STR2
2795 "BGP attribute is propagated unchanged to this neighbor\n"
2796 "Nexthop attribute\n"
2797 "As-path attribute\n"
2798 "Med attribute\n")
2799{
2800 u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED;
2801
2802 if (strncmp (argv[1], "as-path", 1) == 0)
2803 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2804 else if (strncmp (argv[1], "med", 1) == 0)
2805 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2806
2807 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2808 bgp_node_safi (vty), flags);
2809}
2810
2811DEFUN (no_neighbor_attr_unchanged4,
2812 no_neighbor_attr_unchanged4_cmd,
2813 NO_NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)",
2814 NO_STR
2815 NEIGHBOR_STR
2816 NEIGHBOR_ADDR_STR2
2817 "BGP attribute is propagated unchanged to this neighbor\n"
2818 "Med attribute\n"
2819 "As-path attribute\n"
2820 "Nexthop attribute\n")
2821{
2822 u_int16_t flags = PEER_FLAG_MED_UNCHANGED;
2823
2824 if (strncmp (argv[1], "as-path", 1) == 0)
2825 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2826 else if (strncmp (argv[1], "next-hop", 1) == 0)
2827 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2828
2829 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2830 bgp_node_safi (vty), flags);
2831}
2832
2833ALIAS (no_neighbor_attr_unchanged,
2834 no_neighbor_attr_unchanged5_cmd,
2835 NO_NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med",
2836 NO_STR
2837 NEIGHBOR_STR
2838 NEIGHBOR_ADDR_STR2
2839 "BGP attribute is propagated unchanged to this neighbor\n"
2840 "As-path attribute\n"
2841 "Nexthop attribute\n"
2842 "Med attribute\n")
2843
2844ALIAS (no_neighbor_attr_unchanged,
2845 no_neighbor_attr_unchanged6_cmd,
2846 NO_NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop",
2847 NO_STR
2848 NEIGHBOR_STR
2849 NEIGHBOR_ADDR_STR2
2850 "BGP attribute is propagated unchanged to this neighbor\n"
2851 "As-path attribute\n"
2852 "Med attribute\n"
2853 "Nexthop attribute\n")
2854
2855ALIAS (no_neighbor_attr_unchanged,
2856 no_neighbor_attr_unchanged7_cmd,
2857 NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path",
2858 NO_STR
2859 NEIGHBOR_STR
2860 NEIGHBOR_ADDR_STR2
2861 "BGP attribute is propagated unchanged to this neighbor\n"
2862 "Nexthop attribute\n"
2863 "Med attribute\n"
2864 "As-path attribute\n")
2865
2866ALIAS (no_neighbor_attr_unchanged,
2867 no_neighbor_attr_unchanged8_cmd,
2868 NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med",
2869 NO_STR
2870 NEIGHBOR_STR
2871 NEIGHBOR_ADDR_STR2
2872 "BGP attribute is propagated unchanged to this neighbor\n"
2873 "Nexthop attribute\n"
2874 "As-path attribute\n"
2875 "Med attribute\n")
2876
2877ALIAS (no_neighbor_attr_unchanged,
2878 no_neighbor_attr_unchanged9_cmd,
2879 NO_NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path",
2880 NO_STR
2881 NEIGHBOR_STR
2882 NEIGHBOR_ADDR_STR2
2883 "BGP attribute is propagated unchanged to this neighbor\n"
2884 "Med attribute\n"
2885 "Nexthop attribute\n"
2886 "As-path attribute\n")
2887
2888ALIAS (no_neighbor_attr_unchanged,
2889 no_neighbor_attr_unchanged10_cmd,
2890 NO_NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop",
2891 NO_STR
2892 NEIGHBOR_STR
2893 NEIGHBOR_ADDR_STR2
2894 "BGP attribute is propagated unchanged to this neighbor\n"
2895 "Med attribute\n"
2896 "As-path attribute\n"
2897 "Nexthop attribute\n")
2898
2899/* For old version Zebra compatibility. */
hassodd4c5932005-02-02 17:15:34 +00002900DEFUN_DEPRECATED (neighbor_transparent_as,
2901 neighbor_transparent_as_cmd,
2902 NEIGHBOR_CMD "transparent-as",
2903 NEIGHBOR_STR
2904 NEIGHBOR_ADDR_STR
2905 "Do not append my AS number even peer is EBGP peer\n")
paul718e3742002-12-13 20:15:29 +00002906{
2907 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2908 bgp_node_safi (vty),
2909 PEER_FLAG_AS_PATH_UNCHANGED);
2910}
2911
hassodd4c5932005-02-02 17:15:34 +00002912DEFUN_DEPRECATED (neighbor_transparent_nexthop,
2913 neighbor_transparent_nexthop_cmd,
2914 NEIGHBOR_CMD "transparent-nexthop",
2915 NEIGHBOR_STR
2916 NEIGHBOR_ADDR_STR
2917 "Do not change nexthop even peer is EBGP peer\n")
paul718e3742002-12-13 20:15:29 +00002918{
2919 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2920 bgp_node_safi (vty),
2921 PEER_FLAG_NEXTHOP_UNCHANGED);
2922}
David Lamparter6b0655a2014-06-04 06:53:35 +02002923
paul718e3742002-12-13 20:15:29 +00002924/* EBGP multihop configuration. */
paul94f2b392005-06-28 12:44:16 +00002925static int
paulfd79ac92004-10-13 05:06:08 +00002926peer_ebgp_multihop_set_vty (struct vty *vty, const char *ip_str,
2927 const char *ttl_str)
paul718e3742002-12-13 20:15:29 +00002928{
2929 struct peer *peer;
paulfd79ac92004-10-13 05:06:08 +00002930 unsigned int ttl;
paul718e3742002-12-13 20:15:29 +00002931
2932 peer = peer_and_group_lookup_vty (vty, ip_str);
2933 if (! peer)
2934 return CMD_WARNING;
2935
2936 if (! ttl_str)
2937 ttl = TTL_MAX;
2938 else
2939 VTY_GET_INTEGER_RANGE ("TTL", ttl, ttl_str, 1, 255);
2940
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00002941 return bgp_vty_return (vty, peer_ebgp_multihop_set (peer, ttl));
paul718e3742002-12-13 20:15:29 +00002942}
2943
paul94f2b392005-06-28 12:44:16 +00002944static int
paulfd79ac92004-10-13 05:06:08 +00002945peer_ebgp_multihop_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00002946{
2947 struct peer *peer;
2948
2949 peer = peer_and_group_lookup_vty (vty, ip_str);
2950 if (! peer)
2951 return CMD_WARNING;
2952
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00002953 return bgp_vty_return (vty, peer_ebgp_multihop_unset (peer));
paul718e3742002-12-13 20:15:29 +00002954}
2955
2956/* neighbor ebgp-multihop. */
2957DEFUN (neighbor_ebgp_multihop,
2958 neighbor_ebgp_multihop_cmd,
2959 NEIGHBOR_CMD2 "ebgp-multihop",
2960 NEIGHBOR_STR
2961 NEIGHBOR_ADDR_STR2
2962 "Allow EBGP neighbors not on directly connected networks\n")
2963{
2964 return peer_ebgp_multihop_set_vty (vty, argv[0], NULL);
2965}
2966
2967DEFUN (neighbor_ebgp_multihop_ttl,
2968 neighbor_ebgp_multihop_ttl_cmd,
2969 NEIGHBOR_CMD2 "ebgp-multihop <1-255>",
2970 NEIGHBOR_STR
2971 NEIGHBOR_ADDR_STR2
2972 "Allow EBGP neighbors not on directly connected networks\n"
2973 "maximum hop count\n")
2974{
2975 return peer_ebgp_multihop_set_vty (vty, argv[0], argv[1]);
2976}
2977
2978DEFUN (no_neighbor_ebgp_multihop,
2979 no_neighbor_ebgp_multihop_cmd,
2980 NO_NEIGHBOR_CMD2 "ebgp-multihop",
2981 NO_STR
2982 NEIGHBOR_STR
2983 NEIGHBOR_ADDR_STR2
2984 "Allow EBGP neighbors not on directly connected networks\n")
2985{
2986 return peer_ebgp_multihop_unset_vty (vty, argv[0]);
2987}
2988
2989ALIAS (no_neighbor_ebgp_multihop,
2990 no_neighbor_ebgp_multihop_ttl_cmd,
2991 NO_NEIGHBOR_CMD2 "ebgp-multihop <1-255>",
2992 NO_STR
2993 NEIGHBOR_STR
2994 NEIGHBOR_ADDR_STR2
2995 "Allow EBGP neighbors not on directly connected networks\n"
2996 "maximum hop count\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02002997
hasso6ffd2072005-02-02 14:50:11 +00002998/* disable-connected-check */
2999DEFUN (neighbor_disable_connected_check,
3000 neighbor_disable_connected_check_cmd,
3001 NEIGHBOR_CMD2 "disable-connected-check",
3002 NEIGHBOR_STR
3003 NEIGHBOR_ADDR_STR2
3004 "one-hop away EBGP peer using loopback address\n")
3005{
3006 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK);
3007}
3008
3009DEFUN (no_neighbor_disable_connected_check,
3010 no_neighbor_disable_connected_check_cmd,
3011 NO_NEIGHBOR_CMD2 "disable-connected-check",
3012 NO_STR
3013 NEIGHBOR_STR
3014 NEIGHBOR_ADDR_STR2
3015 "one-hop away EBGP peer using loopback address\n")
3016{
3017 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK);
3018}
3019
paul718e3742002-12-13 20:15:29 +00003020/* Enforce multihop. */
hasso6ffd2072005-02-02 14:50:11 +00003021ALIAS (neighbor_disable_connected_check,
paul718e3742002-12-13 20:15:29 +00003022 neighbor_enforce_multihop_cmd,
3023 NEIGHBOR_CMD2 "enforce-multihop",
3024 NEIGHBOR_STR
3025 NEIGHBOR_ADDR_STR2
paule8e19462006-01-19 20:16:55 +00003026 "Enforce EBGP neighbors perform multihop\n")
paul718e3742002-12-13 20:15:29 +00003027
hasso6ffd2072005-02-02 14:50:11 +00003028/* Enforce multihop. */
3029ALIAS (no_neighbor_disable_connected_check,
paul718e3742002-12-13 20:15:29 +00003030 no_neighbor_enforce_multihop_cmd,
3031 NO_NEIGHBOR_CMD2 "enforce-multihop",
3032 NO_STR
3033 NEIGHBOR_STR
3034 NEIGHBOR_ADDR_STR2
paule8e19462006-01-19 20:16:55 +00003035 "Enforce EBGP neighbors perform multihop\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003036
paul718e3742002-12-13 20:15:29 +00003037DEFUN (neighbor_description,
3038 neighbor_description_cmd,
3039 NEIGHBOR_CMD2 "description .LINE",
3040 NEIGHBOR_STR
3041 NEIGHBOR_ADDR_STR2
3042 "Neighbor specific description\n"
3043 "Up to 80 characters describing this neighbor\n")
3044{
3045 struct peer *peer;
paul718e3742002-12-13 20:15:29 +00003046 char *str;
paul718e3742002-12-13 20:15:29 +00003047
3048 peer = peer_and_group_lookup_vty (vty, argv[0]);
3049 if (! peer)
3050 return CMD_WARNING;
3051
3052 if (argc == 1)
3053 return CMD_SUCCESS;
3054
ajs3b8b1852005-01-29 18:19:13 +00003055 str = argv_concat(argv, argc, 1);
paul718e3742002-12-13 20:15:29 +00003056
3057 peer_description_set (peer, str);
3058
ajs3b8b1852005-01-29 18:19:13 +00003059 XFREE (MTYPE_TMP, str);
paul718e3742002-12-13 20:15:29 +00003060
3061 return CMD_SUCCESS;
3062}
3063
3064DEFUN (no_neighbor_description,
3065 no_neighbor_description_cmd,
3066 NO_NEIGHBOR_CMD2 "description",
3067 NO_STR
3068 NEIGHBOR_STR
3069 NEIGHBOR_ADDR_STR2
3070 "Neighbor specific description\n")
3071{
3072 struct peer *peer;
3073
3074 peer = peer_and_group_lookup_vty (vty, argv[0]);
3075 if (! peer)
3076 return CMD_WARNING;
3077
3078 peer_description_unset (peer);
3079
3080 return CMD_SUCCESS;
3081}
3082
3083ALIAS (no_neighbor_description,
3084 no_neighbor_description_val_cmd,
3085 NO_NEIGHBOR_CMD2 "description .LINE",
3086 NO_STR
3087 NEIGHBOR_STR
3088 NEIGHBOR_ADDR_STR2
3089 "Neighbor specific description\n"
3090 "Up to 80 characters describing this neighbor\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003091
paul718e3742002-12-13 20:15:29 +00003092/* Neighbor update-source. */
paul94f2b392005-06-28 12:44:16 +00003093static int
paulfd79ac92004-10-13 05:06:08 +00003094peer_update_source_vty (struct vty *vty, const char *peer_str,
3095 const char *source_str)
paul718e3742002-12-13 20:15:29 +00003096{
3097 struct peer *peer;
paul718e3742002-12-13 20:15:29 +00003098
3099 peer = peer_and_group_lookup_vty (vty, peer_str);
3100 if (! peer)
3101 return CMD_WARNING;
3102
3103 if (source_str)
3104 {
Jorge Boncompte [DTI2]c63b83f2012-04-10 16:57:24 +02003105 union sockunion su;
3106 int ret = str2sockunion (source_str, &su);
3107
3108 if (ret == 0)
3109 peer_update_source_addr_set (peer, &su);
paul718e3742002-12-13 20:15:29 +00003110 else
3111 peer_update_source_if_set (peer, source_str);
3112 }
3113 else
3114 peer_update_source_unset (peer);
3115
3116 return CMD_SUCCESS;
3117}
3118
Paul Jakma9a1a3312009-07-27 12:27:55 +01003119#define BGP_UPDATE_SOURCE_STR "(A.B.C.D|X:X::X:X|WORD)"
Paul Jakma369688c2006-05-23 22:27:55 +00003120#define BGP_UPDATE_SOURCE_HELP_STR \
3121 "IPv4 address\n" \
Paul Jakma9a1a3312009-07-27 12:27:55 +01003122 "IPv6 address\n" \
3123 "Interface name (requires zebra to be running)\n"
Paul Jakma369688c2006-05-23 22:27:55 +00003124
paul718e3742002-12-13 20:15:29 +00003125DEFUN (neighbor_update_source,
3126 neighbor_update_source_cmd,
Paul Jakma369688c2006-05-23 22:27:55 +00003127 NEIGHBOR_CMD2 "update-source " BGP_UPDATE_SOURCE_STR,
paul718e3742002-12-13 20:15:29 +00003128 NEIGHBOR_STR
3129 NEIGHBOR_ADDR_STR2
3130 "Source of routing updates\n"
Paul Jakma369688c2006-05-23 22:27:55 +00003131 BGP_UPDATE_SOURCE_HELP_STR)
paul718e3742002-12-13 20:15:29 +00003132{
3133 return peer_update_source_vty (vty, argv[0], argv[1]);
3134}
3135
3136DEFUN (no_neighbor_update_source,
3137 no_neighbor_update_source_cmd,
3138 NO_NEIGHBOR_CMD2 "update-source",
3139 NO_STR
3140 NEIGHBOR_STR
3141 NEIGHBOR_ADDR_STR2
Paul Jakma369688c2006-05-23 22:27:55 +00003142 "Source of routing updates\n")
paul718e3742002-12-13 20:15:29 +00003143{
3144 return peer_update_source_vty (vty, argv[0], NULL);
3145}
David Lamparter6b0655a2014-06-04 06:53:35 +02003146
paul94f2b392005-06-28 12:44:16 +00003147static int
paulfd79ac92004-10-13 05:06:08 +00003148peer_default_originate_set_vty (struct vty *vty, const char *peer_str,
3149 afi_t afi, safi_t safi,
3150 const char *rmap, int set)
paul718e3742002-12-13 20:15:29 +00003151{
3152 int ret;
3153 struct peer *peer;
3154
3155 peer = peer_and_group_lookup_vty (vty, peer_str);
3156 if (! peer)
3157 return CMD_WARNING;
3158
3159 if (set)
3160 ret = peer_default_originate_set (peer, afi, safi, rmap);
3161 else
3162 ret = peer_default_originate_unset (peer, afi, safi);
3163
3164 return bgp_vty_return (vty, ret);
3165}
3166
3167/* neighbor default-originate. */
3168DEFUN (neighbor_default_originate,
3169 neighbor_default_originate_cmd,
3170 NEIGHBOR_CMD2 "default-originate",
3171 NEIGHBOR_STR
3172 NEIGHBOR_ADDR_STR2
3173 "Originate default route to this neighbor\n")
3174{
3175 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
3176 bgp_node_safi (vty), NULL, 1);
3177}
3178
3179DEFUN (neighbor_default_originate_rmap,
3180 neighbor_default_originate_rmap_cmd,
3181 NEIGHBOR_CMD2 "default-originate route-map WORD",
3182 NEIGHBOR_STR
3183 NEIGHBOR_ADDR_STR2
3184 "Originate default route to this neighbor\n"
3185 "Route-map to specify criteria to originate default\n"
3186 "route-map name\n")
3187{
3188 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
3189 bgp_node_safi (vty), argv[1], 1);
3190}
3191
3192DEFUN (no_neighbor_default_originate,
3193 no_neighbor_default_originate_cmd,
3194 NO_NEIGHBOR_CMD2 "default-originate",
3195 NO_STR
3196 NEIGHBOR_STR
3197 NEIGHBOR_ADDR_STR2
3198 "Originate default route to this neighbor\n")
3199{
3200 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
3201 bgp_node_safi (vty), NULL, 0);
3202}
3203
3204ALIAS (no_neighbor_default_originate,
3205 no_neighbor_default_originate_rmap_cmd,
3206 NO_NEIGHBOR_CMD2 "default-originate route-map WORD",
3207 NO_STR
3208 NEIGHBOR_STR
3209 NEIGHBOR_ADDR_STR2
3210 "Originate default route to this neighbor\n"
3211 "Route-map to specify criteria to originate default\n"
3212 "route-map name\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003213
paul718e3742002-12-13 20:15:29 +00003214/* Set neighbor's BGP port. */
paul94f2b392005-06-28 12:44:16 +00003215static int
paulfd79ac92004-10-13 05:06:08 +00003216peer_port_vty (struct vty *vty, const char *ip_str, int afi,
3217 const char *port_str)
paul718e3742002-12-13 20:15:29 +00003218{
3219 struct peer *peer;
3220 u_int16_t port;
3221 struct servent *sp;
3222
3223 peer = peer_lookup_vty (vty, ip_str);
3224 if (! peer)
3225 return CMD_WARNING;
3226
3227 if (! port_str)
3228 {
3229 sp = getservbyname ("bgp", "tcp");
3230 port = (sp == NULL) ? BGP_PORT_DEFAULT : ntohs (sp->s_port);
3231 }
3232 else
3233 {
3234 VTY_GET_INTEGER("port", port, port_str);
3235 }
3236
3237 peer_port_set (peer, port);
3238
3239 return CMD_SUCCESS;
3240}
3241
hassof4184462005-02-01 20:13:16 +00003242/* Set specified peer's BGP port. */
paul718e3742002-12-13 20:15:29 +00003243DEFUN (neighbor_port,
3244 neighbor_port_cmd,
3245 NEIGHBOR_CMD "port <0-65535>",
3246 NEIGHBOR_STR
3247 NEIGHBOR_ADDR_STR
3248 "Neighbor's BGP port\n"
3249 "TCP port number\n")
3250{
3251 return peer_port_vty (vty, argv[0], AFI_IP, argv[1]);
3252}
3253
3254DEFUN (no_neighbor_port,
3255 no_neighbor_port_cmd,
3256 NO_NEIGHBOR_CMD "port",
3257 NO_STR
3258 NEIGHBOR_STR
3259 NEIGHBOR_ADDR_STR
3260 "Neighbor's BGP port\n")
3261{
3262 return peer_port_vty (vty, argv[0], AFI_IP, NULL);
3263}
3264
3265ALIAS (no_neighbor_port,
3266 no_neighbor_port_val_cmd,
3267 NO_NEIGHBOR_CMD "port <0-65535>",
3268 NO_STR
3269 NEIGHBOR_STR
3270 NEIGHBOR_ADDR_STR
3271 "Neighbor's BGP port\n"
3272 "TCP port number\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003273
paul718e3742002-12-13 20:15:29 +00003274/* neighbor weight. */
paul94f2b392005-06-28 12:44:16 +00003275static int
paulfd79ac92004-10-13 05:06:08 +00003276peer_weight_set_vty (struct vty *vty, const char *ip_str,
3277 const char *weight_str)
paul718e3742002-12-13 20:15:29 +00003278{
paul718e3742002-12-13 20:15:29 +00003279 struct peer *peer;
3280 unsigned long weight;
3281
3282 peer = peer_and_group_lookup_vty (vty, ip_str);
3283 if (! peer)
3284 return CMD_WARNING;
3285
3286 VTY_GET_INTEGER_RANGE("weight", weight, weight_str, 0, 65535);
3287
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003288 return bgp_vty_return (vty, peer_weight_set (peer, weight));
paul718e3742002-12-13 20:15:29 +00003289}
3290
paul94f2b392005-06-28 12:44:16 +00003291static int
paulfd79ac92004-10-13 05:06:08 +00003292peer_weight_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00003293{
3294 struct peer *peer;
3295
3296 peer = peer_and_group_lookup_vty (vty, ip_str);
3297 if (! peer)
3298 return CMD_WARNING;
3299
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003300 return bgp_vty_return (vty, peer_weight_unset (peer));
paul718e3742002-12-13 20:15:29 +00003301}
3302
3303DEFUN (neighbor_weight,
3304 neighbor_weight_cmd,
3305 NEIGHBOR_CMD2 "weight <0-65535>",
3306 NEIGHBOR_STR
3307 NEIGHBOR_ADDR_STR2
3308 "Set default weight for routes from this neighbor\n"
3309 "default weight\n")
3310{
3311 return peer_weight_set_vty (vty, argv[0], argv[1]);
3312}
3313
3314DEFUN (no_neighbor_weight,
3315 no_neighbor_weight_cmd,
3316 NO_NEIGHBOR_CMD2 "weight",
3317 NO_STR
3318 NEIGHBOR_STR
3319 NEIGHBOR_ADDR_STR2
3320 "Set default weight for routes from this neighbor\n")
3321{
3322 return peer_weight_unset_vty (vty, argv[0]);
3323}
3324
3325ALIAS (no_neighbor_weight,
3326 no_neighbor_weight_val_cmd,
3327 NO_NEIGHBOR_CMD2 "weight <0-65535>",
3328 NO_STR
3329 NEIGHBOR_STR
3330 NEIGHBOR_ADDR_STR2
3331 "Set default weight for routes from this neighbor\n"
3332 "default weight\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003333
paul718e3742002-12-13 20:15:29 +00003334/* Override capability negotiation. */
3335DEFUN (neighbor_override_capability,
3336 neighbor_override_capability_cmd,
3337 NEIGHBOR_CMD2 "override-capability",
3338 NEIGHBOR_STR
3339 NEIGHBOR_ADDR_STR2
3340 "Override capability negotiation result\n")
3341{
3342 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY);
3343}
3344
3345DEFUN (no_neighbor_override_capability,
3346 no_neighbor_override_capability_cmd,
3347 NO_NEIGHBOR_CMD2 "override-capability",
3348 NO_STR
3349 NEIGHBOR_STR
3350 NEIGHBOR_ADDR_STR2
3351 "Override capability negotiation result\n")
3352{
3353 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY);
3354}
David Lamparter6b0655a2014-06-04 06:53:35 +02003355
paul718e3742002-12-13 20:15:29 +00003356DEFUN (neighbor_strict_capability,
3357 neighbor_strict_capability_cmd,
3358 NEIGHBOR_CMD "strict-capability-match",
3359 NEIGHBOR_STR
3360 NEIGHBOR_ADDR_STR
3361 "Strict capability negotiation match\n")
3362{
3363 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH);
3364}
3365
3366DEFUN (no_neighbor_strict_capability,
3367 no_neighbor_strict_capability_cmd,
3368 NO_NEIGHBOR_CMD "strict-capability-match",
3369 NO_STR
3370 NEIGHBOR_STR
3371 NEIGHBOR_ADDR_STR
3372 "Strict capability negotiation match\n")
3373{
3374 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH);
3375}
David Lamparter6b0655a2014-06-04 06:53:35 +02003376
paul94f2b392005-06-28 12:44:16 +00003377static int
paulfd79ac92004-10-13 05:06:08 +00003378peer_timers_set_vty (struct vty *vty, const char *ip_str,
3379 const char *keep_str, const char *hold_str)
paul718e3742002-12-13 20:15:29 +00003380{
3381 int ret;
3382 struct peer *peer;
3383 u_int32_t keepalive;
3384 u_int32_t holdtime;
3385
3386 peer = peer_and_group_lookup_vty (vty, ip_str);
3387 if (! peer)
3388 return CMD_WARNING;
3389
3390 VTY_GET_INTEGER_RANGE ("Keepalive", keepalive, keep_str, 0, 65535);
3391 VTY_GET_INTEGER_RANGE ("Holdtime", holdtime, hold_str, 0, 65535);
3392
3393 ret = peer_timers_set (peer, keepalive, holdtime);
3394
3395 return bgp_vty_return (vty, ret);
3396}
David Lamparter6b0655a2014-06-04 06:53:35 +02003397
paul94f2b392005-06-28 12:44:16 +00003398static int
paulfd79ac92004-10-13 05:06:08 +00003399peer_timers_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00003400{
3401 int ret;
3402 struct peer *peer;
3403
3404 peer = peer_lookup_vty (vty, ip_str);
3405 if (! peer)
3406 return CMD_WARNING;
3407
3408 ret = peer_timers_unset (peer);
3409
3410 return bgp_vty_return (vty, ret);
3411}
3412
3413DEFUN (neighbor_timers,
3414 neighbor_timers_cmd,
3415 NEIGHBOR_CMD2 "timers <0-65535> <0-65535>",
3416 NEIGHBOR_STR
3417 NEIGHBOR_ADDR_STR2
3418 "BGP per neighbor timers\n"
3419 "Keepalive interval\n"
3420 "Holdtime\n")
3421{
3422 return peer_timers_set_vty (vty, argv[0], argv[1], argv[2]);
3423}
3424
3425DEFUN (no_neighbor_timers,
3426 no_neighbor_timers_cmd,
3427 NO_NEIGHBOR_CMD2 "timers",
3428 NO_STR
3429 NEIGHBOR_STR
3430 NEIGHBOR_ADDR_STR2
3431 "BGP per neighbor timers\n")
3432{
3433 return peer_timers_unset_vty (vty, argv[0]);
3434}
David Lamparter6b0655a2014-06-04 06:53:35 +02003435
paul94f2b392005-06-28 12:44:16 +00003436static int
paulfd79ac92004-10-13 05:06:08 +00003437peer_timers_connect_set_vty (struct vty *vty, const char *ip_str,
3438 const char *time_str)
paul718e3742002-12-13 20:15:29 +00003439{
paul718e3742002-12-13 20:15:29 +00003440 struct peer *peer;
3441 u_int32_t connect;
3442
Daniel Walton0d7435f2015-10-22 11:35:20 +03003443 peer = peer_and_group_lookup_vty (vty, ip_str);
paul718e3742002-12-13 20:15:29 +00003444 if (! peer)
3445 return CMD_WARNING;
3446
3447 VTY_GET_INTEGER_RANGE ("Connect time", connect, time_str, 0, 65535);
3448
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003449 return bgp_vty_return (vty, peer_timers_connect_set (peer, connect));
paul718e3742002-12-13 20:15:29 +00003450}
3451
paul94f2b392005-06-28 12:44:16 +00003452static int
paulfd79ac92004-10-13 05:06:08 +00003453peer_timers_connect_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00003454{
paul718e3742002-12-13 20:15:29 +00003455 struct peer *peer;
3456
3457 peer = peer_and_group_lookup_vty (vty, ip_str);
3458 if (! peer)
3459 return CMD_WARNING;
3460
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003461 return bgp_vty_return (vty, peer_timers_connect_unset (peer));
paul718e3742002-12-13 20:15:29 +00003462}
3463
3464DEFUN (neighbor_timers_connect,
3465 neighbor_timers_connect_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003466 NEIGHBOR_CMD2 "timers connect <1-65535>",
paul718e3742002-12-13 20:15:29 +00003467 NEIGHBOR_STR
Daniel Walton0d7435f2015-10-22 11:35:20 +03003468 NEIGHBOR_ADDR_STR2
paul718e3742002-12-13 20:15:29 +00003469 "BGP per neighbor timers\n"
3470 "BGP connect timer\n"
3471 "Connect timer\n")
3472{
3473 return peer_timers_connect_set_vty (vty, argv[0], argv[1]);
3474}
3475
3476DEFUN (no_neighbor_timers_connect,
3477 no_neighbor_timers_connect_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003478 NO_NEIGHBOR_CMD2 "timers connect",
paul718e3742002-12-13 20:15:29 +00003479 NO_STR
3480 NEIGHBOR_STR
Daniel Walton0d7435f2015-10-22 11:35:20 +03003481 NEIGHBOR_ADDR_STR2
paul718e3742002-12-13 20:15:29 +00003482 "BGP per neighbor timers\n"
3483 "BGP connect timer\n")
3484{
3485 return peer_timers_connect_unset_vty (vty, argv[0]);
3486}
3487
3488ALIAS (no_neighbor_timers_connect,
3489 no_neighbor_timers_connect_val_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003490 NO_NEIGHBOR_CMD2 "timers connect <1-65535>",
paul718e3742002-12-13 20:15:29 +00003491 NO_STR
3492 NEIGHBOR_STR
Daniel Walton0d7435f2015-10-22 11:35:20 +03003493 NEIGHBOR_ADDR_STR2
paul718e3742002-12-13 20:15:29 +00003494 "BGP per neighbor timers\n"
3495 "BGP connect timer\n"
3496 "Connect timer\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003497
paul94f2b392005-06-28 12:44:16 +00003498static int
paulfd79ac92004-10-13 05:06:08 +00003499peer_advertise_interval_vty (struct vty *vty, const char *ip_str,
3500 const char *time_str, int set)
paul718e3742002-12-13 20:15:29 +00003501{
3502 int ret;
3503 struct peer *peer;
3504 u_int32_t routeadv = 0;
3505
Daniel Walton0d7435f2015-10-22 11:35:20 +03003506 peer = peer_and_group_lookup_vty (vty, ip_str);
paul718e3742002-12-13 20:15:29 +00003507 if (! peer)
3508 return CMD_WARNING;
3509
3510 if (time_str)
3511 VTY_GET_INTEGER_RANGE ("advertise interval", routeadv, time_str, 0, 600);
3512
3513 if (set)
3514 ret = peer_advertise_interval_set (peer, routeadv);
3515 else
3516 ret = peer_advertise_interval_unset (peer);
3517
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003518 return bgp_vty_return (vty, ret);
paul718e3742002-12-13 20:15:29 +00003519}
3520
3521DEFUN (neighbor_advertise_interval,
3522 neighbor_advertise_interval_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003523 NEIGHBOR_CMD2 "advertisement-interval <0-600>",
paul718e3742002-12-13 20:15:29 +00003524 NEIGHBOR_STR
Daniel Walton0d7435f2015-10-22 11:35:20 +03003525 NEIGHBOR_ADDR_STR2
paul718e3742002-12-13 20:15:29 +00003526 "Minimum interval between sending BGP routing updates\n"
3527 "time in seconds\n")
3528{
3529 return peer_advertise_interval_vty (vty, argv[0], argv[1], 1);
3530}
3531
3532DEFUN (no_neighbor_advertise_interval,
3533 no_neighbor_advertise_interval_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003534 NO_NEIGHBOR_CMD2 "advertisement-interval",
paul718e3742002-12-13 20:15:29 +00003535 NO_STR
3536 NEIGHBOR_STR
Daniel Walton0d7435f2015-10-22 11:35:20 +03003537 NEIGHBOR_ADDR_STR2
paul718e3742002-12-13 20:15:29 +00003538 "Minimum interval between sending BGP routing updates\n")
3539{
3540 return peer_advertise_interval_vty (vty, argv[0], NULL, 0);
3541}
3542
3543ALIAS (no_neighbor_advertise_interval,
3544 no_neighbor_advertise_interval_val_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003545 NO_NEIGHBOR_CMD2 "advertisement-interval <0-600>",
paul718e3742002-12-13 20:15:29 +00003546 NO_STR
3547 NEIGHBOR_STR
Daniel Walton0d7435f2015-10-22 11:35:20 +03003548 NEIGHBOR_ADDR_STR2
paul718e3742002-12-13 20:15:29 +00003549 "Minimum interval between sending BGP routing updates\n"
3550 "time in seconds\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003551
paul718e3742002-12-13 20:15:29 +00003552/* neighbor interface */
paul94f2b392005-06-28 12:44:16 +00003553static int
paulfd79ac92004-10-13 05:06:08 +00003554peer_interface_vty (struct vty *vty, const char *ip_str, const char *str)
paul718e3742002-12-13 20:15:29 +00003555{
3556 int ret;
3557 struct peer *peer;
3558
3559 peer = peer_lookup_vty (vty, ip_str);
3560 if (! peer)
3561 return CMD_WARNING;
3562
3563 if (str)
3564 ret = peer_interface_set (peer, str);
3565 else
3566 ret = peer_interface_unset (peer);
3567
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003568 return bgp_vty_return (vty, ret);
paul718e3742002-12-13 20:15:29 +00003569}
3570
3571DEFUN (neighbor_interface,
3572 neighbor_interface_cmd,
3573 NEIGHBOR_CMD "interface WORD",
3574 NEIGHBOR_STR
3575 NEIGHBOR_ADDR_STR
3576 "Interface\n"
3577 "Interface name\n")
3578{
3579 return peer_interface_vty (vty, argv[0], argv[1]);
3580}
3581
3582DEFUN (no_neighbor_interface,
3583 no_neighbor_interface_cmd,
3584 NO_NEIGHBOR_CMD "interface WORD",
3585 NO_STR
3586 NEIGHBOR_STR
3587 NEIGHBOR_ADDR_STR
3588 "Interface\n"
3589 "Interface name\n")
3590{
3591 return peer_interface_vty (vty, argv[0], NULL);
3592}
David Lamparter6b0655a2014-06-04 06:53:35 +02003593
paul718e3742002-12-13 20:15:29 +00003594/* Set distribute list to the peer. */
paul94f2b392005-06-28 12:44:16 +00003595static int
paulfd79ac92004-10-13 05:06:08 +00003596peer_distribute_set_vty (struct vty *vty, const char *ip_str,
3597 afi_t afi, safi_t safi,
3598 const char *name_str, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003599{
3600 int ret;
3601 struct peer *peer;
3602 int direct = FILTER_IN;
3603
3604 peer = peer_and_group_lookup_vty (vty, ip_str);
3605 if (! peer)
3606 return CMD_WARNING;
3607
3608 /* Check filter direction. */
3609 if (strncmp (direct_str, "i", 1) == 0)
3610 direct = FILTER_IN;
3611 else if (strncmp (direct_str, "o", 1) == 0)
3612 direct = FILTER_OUT;
3613
3614 ret = peer_distribute_set (peer, afi, safi, direct, name_str);
3615
3616 return bgp_vty_return (vty, ret);
3617}
3618
paul94f2b392005-06-28 12:44:16 +00003619static int
paulfd79ac92004-10-13 05:06:08 +00003620peer_distribute_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
3621 safi_t safi, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003622{
3623 int ret;
3624 struct peer *peer;
3625 int direct = FILTER_IN;
3626
3627 peer = peer_and_group_lookup_vty (vty, ip_str);
3628 if (! peer)
3629 return CMD_WARNING;
3630
3631 /* Check filter direction. */
3632 if (strncmp (direct_str, "i", 1) == 0)
3633 direct = FILTER_IN;
3634 else if (strncmp (direct_str, "o", 1) == 0)
3635 direct = FILTER_OUT;
3636
3637 ret = peer_distribute_unset (peer, afi, safi, direct);
3638
3639 return bgp_vty_return (vty, ret);
3640}
3641
3642DEFUN (neighbor_distribute_list,
3643 neighbor_distribute_list_cmd,
3644 NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)",
3645 NEIGHBOR_STR
3646 NEIGHBOR_ADDR_STR2
3647 "Filter updates to/from this neighbor\n"
3648 "IP access-list number\n"
3649 "IP access-list number (expanded range)\n"
3650 "IP Access-list name\n"
3651 "Filter incoming updates\n"
3652 "Filter outgoing updates\n")
3653{
3654 return peer_distribute_set_vty (vty, argv[0], bgp_node_afi (vty),
3655 bgp_node_safi (vty), argv[1], argv[2]);
3656}
3657
3658DEFUN (no_neighbor_distribute_list,
3659 no_neighbor_distribute_list_cmd,
3660 NO_NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)",
3661 NO_STR
3662 NEIGHBOR_STR
3663 NEIGHBOR_ADDR_STR2
3664 "Filter updates to/from this neighbor\n"
3665 "IP access-list number\n"
3666 "IP access-list number (expanded range)\n"
3667 "IP Access-list name\n"
3668 "Filter incoming updates\n"
3669 "Filter outgoing updates\n")
3670{
3671 return peer_distribute_unset_vty (vty, argv[0], bgp_node_afi (vty),
3672 bgp_node_safi (vty), argv[2]);
3673}
David Lamparter6b0655a2014-06-04 06:53:35 +02003674
paul718e3742002-12-13 20:15:29 +00003675/* Set prefix list to the peer. */
paul94f2b392005-06-28 12:44:16 +00003676static int
paulfd79ac92004-10-13 05:06:08 +00003677peer_prefix_list_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
3678 safi_t safi, const char *name_str,
3679 const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003680{
3681 int ret;
3682 struct peer *peer;
3683 int direct = FILTER_IN;
3684
3685 peer = peer_and_group_lookup_vty (vty, ip_str);
3686 if (! peer)
3687 return CMD_WARNING;
3688
3689 /* Check filter direction. */
3690 if (strncmp (direct_str, "i", 1) == 0)
3691 direct = FILTER_IN;
3692 else if (strncmp (direct_str, "o", 1) == 0)
3693 direct = FILTER_OUT;
3694
3695 ret = peer_prefix_list_set (peer, afi, safi, direct, name_str);
3696
3697 return bgp_vty_return (vty, ret);
3698}
3699
paul94f2b392005-06-28 12:44:16 +00003700static int
paulfd79ac92004-10-13 05:06:08 +00003701peer_prefix_list_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
3702 safi_t safi, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003703{
3704 int ret;
3705 struct peer *peer;
3706 int direct = FILTER_IN;
3707
3708 peer = peer_and_group_lookup_vty (vty, ip_str);
3709 if (! peer)
3710 return CMD_WARNING;
3711
3712 /* Check filter direction. */
3713 if (strncmp (direct_str, "i", 1) == 0)
3714 direct = FILTER_IN;
3715 else if (strncmp (direct_str, "o", 1) == 0)
3716 direct = FILTER_OUT;
3717
3718 ret = peer_prefix_list_unset (peer, afi, safi, direct);
3719
3720 return bgp_vty_return (vty, ret);
3721}
3722
3723DEFUN (neighbor_prefix_list,
3724 neighbor_prefix_list_cmd,
3725 NEIGHBOR_CMD2 "prefix-list WORD (in|out)",
3726 NEIGHBOR_STR
3727 NEIGHBOR_ADDR_STR2
3728 "Filter updates to/from this neighbor\n"
3729 "Name of a prefix list\n"
3730 "Filter incoming updates\n"
3731 "Filter outgoing updates\n")
3732{
3733 return peer_prefix_list_set_vty (vty, argv[0], bgp_node_afi (vty),
3734 bgp_node_safi (vty), argv[1], argv[2]);
3735}
3736
3737DEFUN (no_neighbor_prefix_list,
3738 no_neighbor_prefix_list_cmd,
3739 NO_NEIGHBOR_CMD2 "prefix-list WORD (in|out)",
3740 NO_STR
3741 NEIGHBOR_STR
3742 NEIGHBOR_ADDR_STR2
3743 "Filter updates to/from this neighbor\n"
3744 "Name of a prefix list\n"
3745 "Filter incoming updates\n"
3746 "Filter outgoing updates\n")
3747{
3748 return peer_prefix_list_unset_vty (vty, argv[0], bgp_node_afi (vty),
3749 bgp_node_safi (vty), argv[2]);
3750}
David Lamparter6b0655a2014-06-04 06:53:35 +02003751
paul94f2b392005-06-28 12:44:16 +00003752static int
paulfd79ac92004-10-13 05:06:08 +00003753peer_aslist_set_vty (struct vty *vty, const char *ip_str,
3754 afi_t afi, safi_t safi,
3755 const char *name_str, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003756{
3757 int ret;
3758 struct peer *peer;
3759 int direct = FILTER_IN;
3760
3761 peer = peer_and_group_lookup_vty (vty, ip_str);
3762 if (! peer)
3763 return CMD_WARNING;
3764
3765 /* Check filter direction. */
3766 if (strncmp (direct_str, "i", 1) == 0)
3767 direct = FILTER_IN;
3768 else if (strncmp (direct_str, "o", 1) == 0)
3769 direct = FILTER_OUT;
3770
3771 ret = peer_aslist_set (peer, afi, safi, direct, name_str);
3772
3773 return bgp_vty_return (vty, ret);
3774}
3775
paul94f2b392005-06-28 12:44:16 +00003776static int
paulfd79ac92004-10-13 05:06:08 +00003777peer_aslist_unset_vty (struct vty *vty, const char *ip_str,
3778 afi_t afi, safi_t safi,
3779 const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003780{
3781 int ret;
3782 struct peer *peer;
3783 int direct = FILTER_IN;
3784
3785 peer = peer_and_group_lookup_vty (vty, ip_str);
3786 if (! peer)
3787 return CMD_WARNING;
3788
3789 /* Check filter direction. */
3790 if (strncmp (direct_str, "i", 1) == 0)
3791 direct = FILTER_IN;
3792 else if (strncmp (direct_str, "o", 1) == 0)
3793 direct = FILTER_OUT;
3794
3795 ret = peer_aslist_unset (peer, afi, safi, direct);
3796
3797 return bgp_vty_return (vty, ret);
3798}
3799
3800DEFUN (neighbor_filter_list,
3801 neighbor_filter_list_cmd,
3802 NEIGHBOR_CMD2 "filter-list WORD (in|out)",
3803 NEIGHBOR_STR
3804 NEIGHBOR_ADDR_STR2
3805 "Establish BGP filters\n"
3806 "AS path access-list name\n"
3807 "Filter incoming routes\n"
3808 "Filter outgoing routes\n")
3809{
3810 return peer_aslist_set_vty (vty, argv[0], bgp_node_afi (vty),
3811 bgp_node_safi (vty), argv[1], argv[2]);
3812}
3813
3814DEFUN (no_neighbor_filter_list,
3815 no_neighbor_filter_list_cmd,
3816 NO_NEIGHBOR_CMD2 "filter-list WORD (in|out)",
3817 NO_STR
3818 NEIGHBOR_STR
3819 NEIGHBOR_ADDR_STR2
3820 "Establish BGP filters\n"
3821 "AS path access-list name\n"
3822 "Filter incoming routes\n"
3823 "Filter outgoing routes\n")
3824{
3825 return peer_aslist_unset_vty (vty, argv[0], bgp_node_afi (vty),
3826 bgp_node_safi (vty), argv[2]);
3827}
David Lamparter6b0655a2014-06-04 06:53:35 +02003828
paul718e3742002-12-13 20:15:29 +00003829/* Set route-map to the peer. */
paul94f2b392005-06-28 12:44:16 +00003830static int
paulfd79ac92004-10-13 05:06:08 +00003831peer_route_map_set_vty (struct vty *vty, const char *ip_str,
3832 afi_t afi, safi_t safi,
3833 const char *name_str, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003834{
3835 int ret;
3836 struct peer *peer;
paulfee0f4c2004-09-13 05:12:46 +00003837 int direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003838
3839 peer = peer_and_group_lookup_vty (vty, ip_str);
3840 if (! peer)
3841 return CMD_WARNING;
3842
3843 /* Check filter direction. */
paulfee0f4c2004-09-13 05:12:46 +00003844 if (strncmp (direct_str, "in", 2) == 0)
3845 direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003846 else if (strncmp (direct_str, "o", 1) == 0)
paulfee0f4c2004-09-13 05:12:46 +00003847 direct = RMAP_OUT;
3848 else if (strncmp (direct_str, "im", 2) == 0)
3849 direct = RMAP_IMPORT;
3850 else if (strncmp (direct_str, "e", 1) == 0)
3851 direct = RMAP_EXPORT;
paul718e3742002-12-13 20:15:29 +00003852
3853 ret = peer_route_map_set (peer, afi, safi, direct, name_str);
3854
3855 return bgp_vty_return (vty, ret);
3856}
3857
paul94f2b392005-06-28 12:44:16 +00003858static int
paulfd79ac92004-10-13 05:06:08 +00003859peer_route_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
3860 safi_t safi, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003861{
3862 int ret;
3863 struct peer *peer;
paulfee0f4c2004-09-13 05:12:46 +00003864 int direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003865
3866 peer = peer_and_group_lookup_vty (vty, ip_str);
3867 if (! peer)
3868 return CMD_WARNING;
3869
3870 /* Check filter direction. */
paulfee0f4c2004-09-13 05:12:46 +00003871 if (strncmp (direct_str, "in", 2) == 0)
3872 direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003873 else if (strncmp (direct_str, "o", 1) == 0)
paulfee0f4c2004-09-13 05:12:46 +00003874 direct = RMAP_OUT;
3875 else if (strncmp (direct_str, "im", 2) == 0)
3876 direct = RMAP_IMPORT;
3877 else if (strncmp (direct_str, "e", 1) == 0)
3878 direct = RMAP_EXPORT;
paul718e3742002-12-13 20:15:29 +00003879
3880 ret = peer_route_map_unset (peer, afi, safi, direct);
3881
3882 return bgp_vty_return (vty, ret);
3883}
3884
3885DEFUN (neighbor_route_map,
3886 neighbor_route_map_cmd,
paulfee0f4c2004-09-13 05:12:46 +00003887 NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)",
paul718e3742002-12-13 20:15:29 +00003888 NEIGHBOR_STR
3889 NEIGHBOR_ADDR_STR2
3890 "Apply route map to neighbor\n"
3891 "Name of route map\n"
3892 "Apply map to incoming routes\n"
paulfee0f4c2004-09-13 05:12:46 +00003893 "Apply map to outbound routes\n"
3894 "Apply map to routes going into a Route-Server client's table\n"
3895 "Apply map to routes coming from a Route-Server client")
paul718e3742002-12-13 20:15:29 +00003896{
3897 return peer_route_map_set_vty (vty, argv[0], bgp_node_afi (vty),
3898 bgp_node_safi (vty), argv[1], argv[2]);
3899}
3900
3901DEFUN (no_neighbor_route_map,
3902 no_neighbor_route_map_cmd,
paulfee0f4c2004-09-13 05:12:46 +00003903 NO_NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)",
paul718e3742002-12-13 20:15:29 +00003904 NO_STR
3905 NEIGHBOR_STR
3906 NEIGHBOR_ADDR_STR2
3907 "Apply route map to neighbor\n"
3908 "Name of route map\n"
3909 "Apply map to incoming routes\n"
paulfee0f4c2004-09-13 05:12:46 +00003910 "Apply map to outbound routes\n"
3911 "Apply map to routes going into a Route-Server client's table\n"
3912 "Apply map to routes coming from a Route-Server client")
paul718e3742002-12-13 20:15:29 +00003913{
3914 return peer_route_map_unset_vty (vty, argv[0], bgp_node_afi (vty),
3915 bgp_node_safi (vty), argv[2]);
3916}
David Lamparter6b0655a2014-06-04 06:53:35 +02003917
paul718e3742002-12-13 20:15:29 +00003918/* Set unsuppress-map to the peer. */
paul94f2b392005-06-28 12:44:16 +00003919static int
paulfd79ac92004-10-13 05:06:08 +00003920peer_unsuppress_map_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
3921 safi_t safi, const char *name_str)
paul718e3742002-12-13 20:15:29 +00003922{
3923 int ret;
3924 struct peer *peer;
3925
3926 peer = peer_and_group_lookup_vty (vty, ip_str);
3927 if (! peer)
3928 return CMD_WARNING;
3929
3930 ret = peer_unsuppress_map_set (peer, afi, safi, name_str);
3931
3932 return bgp_vty_return (vty, ret);
3933}
3934
3935/* Unset route-map from the peer. */
paul94f2b392005-06-28 12:44:16 +00003936static int
paulfd79ac92004-10-13 05:06:08 +00003937peer_unsuppress_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
paul718e3742002-12-13 20:15:29 +00003938 safi_t safi)
3939{
3940 int ret;
3941 struct peer *peer;
3942
3943 peer = peer_and_group_lookup_vty (vty, ip_str);
3944 if (! peer)
3945 return CMD_WARNING;
3946
3947 ret = peer_unsuppress_map_unset (peer, afi, safi);
3948
3949 return bgp_vty_return (vty, ret);
3950}
3951
3952DEFUN (neighbor_unsuppress_map,
3953 neighbor_unsuppress_map_cmd,
3954 NEIGHBOR_CMD2 "unsuppress-map WORD",
3955 NEIGHBOR_STR
3956 NEIGHBOR_ADDR_STR2
3957 "Route-map to selectively unsuppress suppressed routes\n"
3958 "Name of route map\n")
3959{
3960 return peer_unsuppress_map_set_vty (vty, argv[0], bgp_node_afi (vty),
3961 bgp_node_safi (vty), argv[1]);
3962}
3963
3964DEFUN (no_neighbor_unsuppress_map,
3965 no_neighbor_unsuppress_map_cmd,
3966 NO_NEIGHBOR_CMD2 "unsuppress-map WORD",
3967 NO_STR
3968 NEIGHBOR_STR
3969 NEIGHBOR_ADDR_STR2
3970 "Route-map to selectively unsuppress suppressed routes\n"
3971 "Name of route map\n")
3972{
3973 return peer_unsuppress_map_unset_vty (vty, argv[0], bgp_node_afi (vty),
3974 bgp_node_safi (vty));
3975}
David Lamparter6b0655a2014-06-04 06:53:35 +02003976
paul94f2b392005-06-28 12:44:16 +00003977static int
paulfd79ac92004-10-13 05:06:08 +00003978peer_maximum_prefix_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
3979 safi_t safi, const char *num_str,
hasso0a486e52005-02-01 20:57:17 +00003980 const char *threshold_str, int warning,
3981 const char *restart_str)
paul718e3742002-12-13 20:15:29 +00003982{
3983 int ret;
3984 struct peer *peer;
3985 u_int32_t max;
hassoe0701b72004-05-20 09:19:34 +00003986 u_char threshold;
hasso0a486e52005-02-01 20:57:17 +00003987 u_int16_t restart;
paul718e3742002-12-13 20:15:29 +00003988
3989 peer = peer_and_group_lookup_vty (vty, ip_str);
3990 if (! peer)
3991 return CMD_WARNING;
3992
Denis Ovsienkoe6ec1c32011-09-10 21:50:53 +04003993 VTY_GET_INTEGER ("maximum number", max, num_str);
hassoe0701b72004-05-20 09:19:34 +00003994 if (threshold_str)
3995 threshold = atoi (threshold_str);
3996 else
3997 threshold = MAXIMUM_PREFIX_THRESHOLD_DEFAULT;
paul718e3742002-12-13 20:15:29 +00003998
hasso0a486e52005-02-01 20:57:17 +00003999 if (restart_str)
4000 restart = atoi (restart_str);
4001 else
4002 restart = 0;
4003
4004 ret = peer_maximum_prefix_set (peer, afi, safi, max, threshold, warning, restart);
paul718e3742002-12-13 20:15:29 +00004005
4006 return bgp_vty_return (vty, ret);
4007}
4008
paul94f2b392005-06-28 12:44:16 +00004009static int
paulfd79ac92004-10-13 05:06:08 +00004010peer_maximum_prefix_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
paul718e3742002-12-13 20:15:29 +00004011 safi_t safi)
4012{
4013 int ret;
4014 struct peer *peer;
4015
4016 peer = peer_and_group_lookup_vty (vty, ip_str);
4017 if (! peer)
4018 return CMD_WARNING;
4019
4020 ret = peer_maximum_prefix_unset (peer, afi, safi);
4021
4022 return bgp_vty_return (vty, ret);
4023}
4024
4025/* Maximum number of prefix configuration. prefix count is different
4026 for each peer configuration. So this configuration can be set for
4027 each peer configuration. */
4028DEFUN (neighbor_maximum_prefix,
4029 neighbor_maximum_prefix_cmd,
4030 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>",
4031 NEIGHBOR_STR
4032 NEIGHBOR_ADDR_STR2
4033 "Maximum number of prefix accept from this peer\n"
4034 "maximum no. of prefix limit\n")
4035{
4036 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00004037 bgp_node_safi (vty), argv[1], NULL, 0,
4038 NULL);
paul718e3742002-12-13 20:15:29 +00004039}
4040
hassoe0701b72004-05-20 09:19:34 +00004041DEFUN (neighbor_maximum_prefix_threshold,
4042 neighbor_maximum_prefix_threshold_cmd,
4043 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100>",
4044 NEIGHBOR_STR
4045 NEIGHBOR_ADDR_STR2
4046 "Maximum number of prefix accept from this peer\n"
4047 "maximum no. of prefix limit\n"
4048 "Threshold value (%) at which to generate a warning msg\n")
4049{
4050 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00004051 bgp_node_safi (vty), argv[1], argv[2], 0,
4052 NULL);
4053}
hassoe0701b72004-05-20 09:19:34 +00004054
paul718e3742002-12-13 20:15:29 +00004055DEFUN (neighbor_maximum_prefix_warning,
4056 neighbor_maximum_prefix_warning_cmd,
4057 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
4058 NEIGHBOR_STR
4059 NEIGHBOR_ADDR_STR2
4060 "Maximum number of prefix accept from this peer\n"
4061 "maximum no. of prefix limit\n"
4062 "Only give warning message when limit is exceeded\n")
4063{
4064 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00004065 bgp_node_safi (vty), argv[1], NULL, 1,
4066 NULL);
paul718e3742002-12-13 20:15:29 +00004067}
4068
hassoe0701b72004-05-20 09:19:34 +00004069DEFUN (neighbor_maximum_prefix_threshold_warning,
4070 neighbor_maximum_prefix_threshold_warning_cmd,
4071 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only",
4072 NEIGHBOR_STR
4073 NEIGHBOR_ADDR_STR2
4074 "Maximum number of prefix accept from this peer\n"
4075 "maximum no. of prefix limit\n"
4076 "Threshold value (%) at which to generate a warning msg\n"
4077 "Only give warning message when limit is exceeded\n")
4078{
4079 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00004080 bgp_node_safi (vty), argv[1], argv[2], 1, NULL);
4081}
4082
4083DEFUN (neighbor_maximum_prefix_restart,
4084 neighbor_maximum_prefix_restart_cmd,
4085 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>",
4086 NEIGHBOR_STR
4087 NEIGHBOR_ADDR_STR2
4088 "Maximum number of prefix accept from this peer\n"
4089 "maximum no. of prefix limit\n"
4090 "Restart bgp connection after limit is exceeded\n"
4091 "Restart interval in minutes")
4092{
4093 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
4094 bgp_node_safi (vty), argv[1], NULL, 0, argv[2]);
4095}
4096
4097DEFUN (neighbor_maximum_prefix_threshold_restart,
4098 neighbor_maximum_prefix_threshold_restart_cmd,
4099 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>",
4100 NEIGHBOR_STR
4101 NEIGHBOR_ADDR_STR2
4102 "Maximum number of prefix accept from this peer\n"
4103 "maximum no. of prefix limit\n"
4104 "Threshold value (%) at which to generate a warning msg\n"
4105 "Restart bgp connection after limit is exceeded\n"
4106 "Restart interval in minutes")
4107{
4108 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
4109 bgp_node_safi (vty), argv[1], argv[2], 0, argv[3]);
4110}
hassoe0701b72004-05-20 09:19:34 +00004111
paul718e3742002-12-13 20:15:29 +00004112DEFUN (no_neighbor_maximum_prefix,
4113 no_neighbor_maximum_prefix_cmd,
4114 NO_NEIGHBOR_CMD2 "maximum-prefix",
4115 NO_STR
4116 NEIGHBOR_STR
4117 NEIGHBOR_ADDR_STR2
4118 "Maximum number of prefix accept from this peer\n")
4119{
4120 return peer_maximum_prefix_unset_vty (vty, argv[0], bgp_node_afi (vty),
4121 bgp_node_safi (vty));
4122}
4123
4124ALIAS (no_neighbor_maximum_prefix,
4125 no_neighbor_maximum_prefix_val_cmd,
4126 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>",
4127 NO_STR
4128 NEIGHBOR_STR
4129 NEIGHBOR_ADDR_STR2
4130 "Maximum number of prefix accept from this peer\n"
4131 "maximum no. of prefix limit\n")
4132
4133ALIAS (no_neighbor_maximum_prefix,
hasso0a486e52005-02-01 20:57:17 +00004134 no_neighbor_maximum_prefix_threshold_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"
4141 "Threshold value (%) at which to generate a warning msg\n")
4142
4143ALIAS (no_neighbor_maximum_prefix,
4144 no_neighbor_maximum_prefix_warning_cmd,
4145 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> 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"
paule8e19462006-01-19 20:16:55 +00004151 "Only give warning message when limit is exceeded\n")
hasso0a486e52005-02-01 20:57:17 +00004152
4153ALIAS (no_neighbor_maximum_prefix,
4154 no_neighbor_maximum_prefix_threshold_warning_cmd,
hassoe0701b72004-05-20 09:19:34 +00004155 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only",
4156 NO_STR
4157 NEIGHBOR_STR
4158 NEIGHBOR_ADDR_STR2
4159 "Maximum number of prefix accept from this peer\n"
4160 "maximum no. of prefix limit\n"
4161 "Threshold value (%) at which to generate a warning msg\n"
paule8e19462006-01-19 20:16:55 +00004162 "Only give warning message when limit is exceeded\n")
hassoe0701b72004-05-20 09:19:34 +00004163
4164ALIAS (no_neighbor_maximum_prefix,
hasso0a486e52005-02-01 20:57:17 +00004165 no_neighbor_maximum_prefix_restart_cmd,
4166 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>",
paul718e3742002-12-13 20:15:29 +00004167 NO_STR
4168 NEIGHBOR_STR
4169 NEIGHBOR_ADDR_STR2
4170 "Maximum number of prefix accept from this peer\n"
4171 "maximum no. of prefix limit\n"
hasso0a486e52005-02-01 20:57:17 +00004172 "Restart bgp connection after limit is exceeded\n"
4173 "Restart interval in minutes")
4174
4175ALIAS (no_neighbor_maximum_prefix,
4176 no_neighbor_maximum_prefix_threshold_restart_cmd,
4177 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>",
4178 NO_STR
4179 NEIGHBOR_STR
4180 NEIGHBOR_ADDR_STR2
4181 "Maximum number of prefix accept from this peer\n"
4182 "maximum no. of prefix limit\n"
4183 "Threshold value (%) at which to generate a warning msg\n"
4184 "Restart bgp connection after limit is exceeded\n"
4185 "Restart interval in minutes")
David Lamparter6b0655a2014-06-04 06:53:35 +02004186
paul718e3742002-12-13 20:15:29 +00004187/* "neighbor allowas-in" */
4188DEFUN (neighbor_allowas_in,
4189 neighbor_allowas_in_cmd,
4190 NEIGHBOR_CMD2 "allowas-in",
4191 NEIGHBOR_STR
4192 NEIGHBOR_ADDR_STR2
4193 "Accept as-path with my AS present in it\n")
4194{
4195 int ret;
4196 struct peer *peer;
paulfd79ac92004-10-13 05:06:08 +00004197 unsigned int allow_num;
paul718e3742002-12-13 20:15:29 +00004198
4199 peer = peer_and_group_lookup_vty (vty, argv[0]);
4200 if (! peer)
4201 return CMD_WARNING;
4202
4203 if (argc == 1)
4204 allow_num = 3;
4205 else
4206 VTY_GET_INTEGER_RANGE ("AS number", allow_num, argv[1], 1, 10);
4207
4208 ret = peer_allowas_in_set (peer, bgp_node_afi (vty), bgp_node_safi (vty),
4209 allow_num);
4210
4211 return bgp_vty_return (vty, ret);
4212}
4213
4214ALIAS (neighbor_allowas_in,
4215 neighbor_allowas_in_arg_cmd,
4216 NEIGHBOR_CMD2 "allowas-in <1-10>",
4217 NEIGHBOR_STR
4218 NEIGHBOR_ADDR_STR2
4219 "Accept as-path with my AS present in it\n"
4220 "Number of occurances of AS number\n")
4221
4222DEFUN (no_neighbor_allowas_in,
4223 no_neighbor_allowas_in_cmd,
4224 NO_NEIGHBOR_CMD2 "allowas-in",
4225 NO_STR
4226 NEIGHBOR_STR
4227 NEIGHBOR_ADDR_STR2
4228 "allow local ASN appears in aspath attribute\n")
4229{
4230 int ret;
4231 struct peer *peer;
4232
4233 peer = peer_and_group_lookup_vty (vty, argv[0]);
4234 if (! peer)
4235 return CMD_WARNING;
4236
4237 ret = peer_allowas_in_unset (peer, bgp_node_afi (vty), bgp_node_safi (vty));
4238
4239 return bgp_vty_return (vty, ret);
4240}
David Lamparter6b0655a2014-06-04 06:53:35 +02004241
Nick Hilliardfa411a22011-03-23 15:33:17 +00004242DEFUN (neighbor_ttl_security,
4243 neighbor_ttl_security_cmd,
4244 NEIGHBOR_CMD2 "ttl-security hops <1-254>",
4245 NEIGHBOR_STR
4246 NEIGHBOR_ADDR_STR2
4247 "Specify the maximum number of hops to the BGP peer\n")
4248{
4249 struct peer *peer;
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00004250 int gtsm_hops;
Nick Hilliardfa411a22011-03-23 15:33:17 +00004251
4252 peer = peer_and_group_lookup_vty (vty, argv[0]);
4253 if (! peer)
4254 return CMD_WARNING;
4255
4256 VTY_GET_INTEGER_RANGE ("", gtsm_hops, argv[1], 1, 254);
4257
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00004258 return bgp_vty_return (vty, peer_ttl_security_hops_set (peer, gtsm_hops));
Nick Hilliardfa411a22011-03-23 15:33:17 +00004259}
4260
4261DEFUN (no_neighbor_ttl_security,
4262 no_neighbor_ttl_security_cmd,
4263 NO_NEIGHBOR_CMD2 "ttl-security hops <1-254>",
4264 NO_STR
4265 NEIGHBOR_STR
4266 NEIGHBOR_ADDR_STR2
4267 "Specify the maximum number of hops to the BGP peer\n")
4268{
4269 struct peer *peer;
Nick Hilliardfa411a22011-03-23 15:33:17 +00004270
4271 peer = peer_and_group_lookup_vty (vty, argv[0]);
4272 if (! peer)
4273 return CMD_WARNING;
4274
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00004275 return bgp_vty_return (vty, peer_ttl_security_hops_unset (peer));
Nick Hilliardfa411a22011-03-23 15:33:17 +00004276}
David Lamparter6b0655a2014-06-04 06:53:35 +02004277
paul718e3742002-12-13 20:15:29 +00004278/* Address family configuration. */
4279DEFUN (address_family_ipv4,
4280 address_family_ipv4_cmd,
4281 "address-family ipv4",
4282 "Enter Address Family command mode\n"
4283 "Address family\n")
4284{
4285 vty->node = BGP_IPV4_NODE;
4286 return CMD_SUCCESS;
4287}
4288
4289DEFUN (address_family_ipv4_safi,
4290 address_family_ipv4_safi_cmd,
4291 "address-family ipv4 (unicast|multicast)",
4292 "Enter Address Family command mode\n"
4293 "Address family\n"
4294 "Address Family modifier\n"
4295 "Address Family modifier\n")
4296{
4297 if (strncmp (argv[0], "m", 1) == 0)
4298 vty->node = BGP_IPV4M_NODE;
4299 else
4300 vty->node = BGP_IPV4_NODE;
4301
4302 return CMD_SUCCESS;
4303}
4304
paul25ffbdc2005-08-22 22:42:08 +00004305DEFUN (address_family_ipv6,
4306 address_family_ipv6_cmd,
4307 "address-family ipv6",
paul718e3742002-12-13 20:15:29 +00004308 "Enter Address Family command mode\n"
paul25ffbdc2005-08-22 22:42:08 +00004309 "Address family\n")
paul718e3742002-12-13 20:15:29 +00004310{
4311 vty->node = BGP_IPV6_NODE;
4312 return CMD_SUCCESS;
4313}
4314
paul25ffbdc2005-08-22 22:42:08 +00004315DEFUN (address_family_ipv6_safi,
4316 address_family_ipv6_safi_cmd,
4317 "address-family ipv6 (unicast|multicast)",
paul718e3742002-12-13 20:15:29 +00004318 "Enter Address Family command mode\n"
paul25ffbdc2005-08-22 22:42:08 +00004319 "Address family\n"
4320 "Address Family modifier\n"
4321 "Address Family modifier\n")
4322{
4323 if (strncmp (argv[0], "m", 1) == 0)
4324 vty->node = BGP_IPV6M_NODE;
4325 else
4326 vty->node = BGP_IPV6_NODE;
4327
4328 return CMD_SUCCESS;
4329}
paul718e3742002-12-13 20:15:29 +00004330
4331DEFUN (address_family_vpnv4,
4332 address_family_vpnv4_cmd,
4333 "address-family vpnv4",
4334 "Enter Address Family command mode\n"
4335 "Address family\n")
4336{
4337 vty->node = BGP_VPNV4_NODE;
4338 return CMD_SUCCESS;
4339}
4340
4341ALIAS (address_family_vpnv4,
4342 address_family_vpnv4_unicast_cmd,
4343 "address-family vpnv4 unicast",
4344 "Enter Address Family command mode\n"
4345 "Address family\n"
4346 "Address Family Modifier\n")
4347
Lou Berger13c378d2016-01-12 13:41:56 -05004348DEFUN (address_family_vpnv6,
4349 address_family_vpnv6_cmd,
4350 "address-family vpnv6",
4351 "Enter Address Family command mode\n"
4352 "Address family\n")
4353{
4354 vty->node = BGP_VPNV6_NODE;
4355 return CMD_SUCCESS;
4356}
4357
4358ALIAS (address_family_vpnv6,
4359 address_family_vpnv6_unicast_cmd,
4360 "address-family vpnv6 unicast",
4361 "Enter Address Family command mode\n"
4362 "Address family\n"
4363 "Address Family Modifier\n")
4364
Lou Bergera3fda882016-01-12 13:42:04 -05004365DEFUN (address_family_encap,
4366 address_family_encap_cmd,
4367 "address-family encap",
4368 "Enter Address Family command mode\n"
4369 "Address family\n")
4370{
4371 vty->node = BGP_ENCAP_NODE;
4372 return CMD_SUCCESS;
4373}
4374
4375ALIAS (address_family_encap,
4376 address_family_encapv4_cmd,
4377 "address-family encapv4",
4378 "Enter Address Family command mode\n"
4379 "Address family\n")
4380
4381DEFUN (address_family_encapv6,
4382 address_family_encapv6_cmd,
4383 "address-family encapv6",
4384 "Enter Address Family command mode\n"
4385 "Address family\n")
4386{
4387 vty->node = BGP_ENCAPV6_NODE;
4388 return CMD_SUCCESS;
4389}
4390
paul718e3742002-12-13 20:15:29 +00004391DEFUN (exit_address_family,
4392 exit_address_family_cmd,
4393 "exit-address-family",
4394 "Exit from Address Family configuration mode\n")
4395{
Lou Bergera3fda882016-01-12 13:42:04 -05004396 /* should match list in command.c:config_exit */
hassoa8a80d52005-04-09 13:07:47 +00004397 if (vty->node == BGP_IPV4_NODE
Lou Bergera3fda882016-01-12 13:42:04 -05004398 || vty->node == BGP_ENCAP_NODE
4399 || vty->node == BGP_ENCAPV6_NODE
hassoa8a80d52005-04-09 13:07:47 +00004400 || vty->node == BGP_IPV4M_NODE
paul718e3742002-12-13 20:15:29 +00004401 || vty->node == BGP_VPNV4_NODE
Lou Berger13c378d2016-01-12 13:41:56 -05004402 || vty->node == BGP_VPNV6_NODE
paul25ffbdc2005-08-22 22:42:08 +00004403 || vty->node == BGP_IPV6_NODE
4404 || vty->node == BGP_IPV6M_NODE)
paul718e3742002-12-13 20:15:29 +00004405 vty->node = BGP_NODE;
4406 return CMD_SUCCESS;
4407}
David Lamparter6b0655a2014-06-04 06:53:35 +02004408
paul718e3742002-12-13 20:15:29 +00004409/* BGP clear sort. */
4410enum clear_sort
4411{
4412 clear_all,
4413 clear_peer,
4414 clear_group,
4415 clear_external,
4416 clear_as
4417};
4418
paul94f2b392005-06-28 12:44:16 +00004419static void
paul718e3742002-12-13 20:15:29 +00004420bgp_clear_vty_error (struct vty *vty, struct peer *peer, afi_t afi,
4421 safi_t safi, int error)
4422{
4423 switch (error)
4424 {
4425 case BGP_ERR_AF_UNCONFIGURED:
4426 vty_out (vty,
4427 "%%BGP: Enable %s %s address family for the neighbor %s%s",
4428 afi == AFI_IP6 ? "IPv6" : safi == SAFI_MPLS_VPN ? "VPNv4" : "IPv4",
4429 safi == SAFI_MULTICAST ? "Multicast" : "Unicast",
4430 peer->host, VTY_NEWLINE);
4431 break;
4432 case BGP_ERR_SOFT_RECONFIG_UNCONFIGURED:
4433 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);
4434 break;
4435 default:
4436 break;
4437 }
4438}
4439
4440/* `clear ip bgp' functions. */
paul94f2b392005-06-28 12:44:16 +00004441static int
paul718e3742002-12-13 20:15:29 +00004442bgp_clear (struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi,
paulfd79ac92004-10-13 05:06:08 +00004443 enum clear_sort sort,enum bgp_clear_type stype, const char *arg)
paul718e3742002-12-13 20:15:29 +00004444{
4445 int ret;
4446 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00004447 struct listnode *node, *nnode;
paul718e3742002-12-13 20:15:29 +00004448
4449 /* Clear all neighbors. */
4450 if (sort == clear_all)
4451 {
paul1eb8ef22005-04-07 07:30:20 +00004452 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004453 {
4454 if (stype == BGP_CLEAR_SOFT_NONE)
4455 ret = peer_clear (peer);
4456 else
4457 ret = peer_clear_soft (peer, afi, safi, stype);
4458
4459 if (ret < 0)
4460 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4461 }
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004462 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004463 }
4464
4465 /* Clear specified neighbors. */
4466 if (sort == clear_peer)
4467 {
4468 union sockunion su;
4469 int ret;
4470
4471 /* Make sockunion for lookup. */
4472 ret = str2sockunion (arg, &su);
4473 if (ret < 0)
4474 {
4475 vty_out (vty, "Malformed address: %s%s", arg, VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004476 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00004477 }
4478 peer = peer_lookup (bgp, &su);
4479 if (! peer)
4480 {
4481 vty_out (vty, "%%BGP: Unknown neighbor - \"%s\"%s", arg, VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004482 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00004483 }
4484
4485 if (stype == BGP_CLEAR_SOFT_NONE)
4486 ret = peer_clear (peer);
4487 else
4488 ret = peer_clear_soft (peer, afi, safi, stype);
4489
4490 if (ret < 0)
4491 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4492
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004493 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004494 }
4495
4496 /* Clear all peer-group members. */
4497 if (sort == clear_group)
4498 {
4499 struct peer_group *group;
4500
4501 group = peer_group_lookup (bgp, arg);
4502 if (! group)
4503 {
4504 vty_out (vty, "%%BGP: No such peer-group %s%s", arg, VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004505 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00004506 }
4507
paul1eb8ef22005-04-07 07:30:20 +00004508 for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004509 {
4510 if (stype == BGP_CLEAR_SOFT_NONE)
4511 {
4512 ret = peer_clear (peer);
4513 continue;
4514 }
4515
4516 if (! peer->af_group[afi][safi])
4517 continue;
4518
4519 ret = peer_clear_soft (peer, afi, safi, stype);
4520
4521 if (ret < 0)
4522 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4523 }
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004524 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004525 }
4526
4527 if (sort == clear_external)
4528 {
paul1eb8ef22005-04-07 07:30:20 +00004529 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004530 {
Jorge Boncompte [DTI2]6d85b152012-05-07 16:52:54 +00004531 if (peer->sort == BGP_PEER_IBGP)
paul718e3742002-12-13 20:15:29 +00004532 continue;
4533
4534 if (stype == BGP_CLEAR_SOFT_NONE)
4535 ret = peer_clear (peer);
4536 else
4537 ret = peer_clear_soft (peer, afi, safi, stype);
4538
4539 if (ret < 0)
4540 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4541 }
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004542 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004543 }
4544
4545 if (sort == clear_as)
4546 {
4547 as_t as;
paul718e3742002-12-13 20:15:29 +00004548 int find = 0;
4549
Ulrich Weberbde12e32011-11-16 19:32:12 +04004550 VTY_GET_INTEGER_RANGE ("AS", as, arg, 1, BGP_AS4_MAX);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004551
paul1eb8ef22005-04-07 07:30:20 +00004552 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004553 {
4554 if (peer->as != as)
4555 continue;
4556
4557 find = 1;
4558 if (stype == BGP_CLEAR_SOFT_NONE)
4559 ret = peer_clear (peer);
4560 else
4561 ret = peer_clear_soft (peer, afi, safi, stype);
4562
4563 if (ret < 0)
4564 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4565 }
4566 if (! find)
4567 vty_out (vty, "%%BGP: No peer is configured with AS %s%s", arg,
4568 VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004569 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004570 }
4571
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004572 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004573}
4574
paul94f2b392005-06-28 12:44:16 +00004575static int
paulfd79ac92004-10-13 05:06:08 +00004576bgp_clear_vty (struct vty *vty, const char *name, afi_t afi, safi_t safi,
4577 enum clear_sort sort, enum bgp_clear_type stype,
4578 const char *arg)
paul718e3742002-12-13 20:15:29 +00004579{
paul718e3742002-12-13 20:15:29 +00004580 struct bgp *bgp;
4581
4582 /* BGP structure lookup. */
4583 if (name)
4584 {
4585 bgp = bgp_lookup_by_name (name);
4586 if (bgp == NULL)
4587 {
4588 vty_out (vty, "Can't find BGP view %s%s", name, VTY_NEWLINE);
4589 return CMD_WARNING;
4590 }
4591 }
4592 else
4593 {
4594 bgp = bgp_get_default ();
4595 if (bgp == NULL)
4596 {
4597 vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE);
4598 return CMD_WARNING;
4599 }
4600 }
4601
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004602 return bgp_clear (vty, bgp, afi, safi, sort, stype, arg);
paul718e3742002-12-13 20:15:29 +00004603}
4604
4605DEFUN (clear_ip_bgp_all,
4606 clear_ip_bgp_all_cmd,
4607 "clear ip bgp *",
4608 CLEAR_STR
4609 IP_STR
4610 BGP_STR
4611 "Clear all peers\n")
4612{
4613 if (argc == 1)
4614 return bgp_clear_vty (vty, argv[0], 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL);
4615
4616 return bgp_clear_vty (vty, NULL, 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL);
4617}
4618
4619ALIAS (clear_ip_bgp_all,
4620 clear_bgp_all_cmd,
4621 "clear bgp *",
4622 CLEAR_STR
4623 BGP_STR
4624 "Clear all peers\n")
4625
4626ALIAS (clear_ip_bgp_all,
4627 clear_bgp_ipv6_all_cmd,
4628 "clear bgp ipv6 *",
4629 CLEAR_STR
4630 BGP_STR
4631 "Address family\n"
4632 "Clear all peers\n")
4633
4634ALIAS (clear_ip_bgp_all,
4635 clear_ip_bgp_instance_all_cmd,
4636 "clear ip bgp view WORD *",
4637 CLEAR_STR
4638 IP_STR
4639 BGP_STR
4640 "BGP view\n"
4641 "view name\n"
4642 "Clear all peers\n")
4643
4644ALIAS (clear_ip_bgp_all,
4645 clear_bgp_instance_all_cmd,
4646 "clear bgp view WORD *",
4647 CLEAR_STR
4648 BGP_STR
4649 "BGP view\n"
4650 "view name\n"
4651 "Clear all peers\n")
4652
4653DEFUN (clear_ip_bgp_peer,
4654 clear_ip_bgp_peer_cmd,
4655 "clear ip bgp (A.B.C.D|X:X::X:X)",
4656 CLEAR_STR
4657 IP_STR
4658 BGP_STR
4659 "BGP neighbor IP address to clear\n"
4660 "BGP IPv6 neighbor to clear\n")
4661{
4662 return bgp_clear_vty (vty, NULL, 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[0]);
4663}
4664
4665ALIAS (clear_ip_bgp_peer,
4666 clear_bgp_peer_cmd,
4667 "clear bgp (A.B.C.D|X:X::X:X)",
4668 CLEAR_STR
4669 BGP_STR
4670 "BGP neighbor address to clear\n"
4671 "BGP IPv6 neighbor to clear\n")
4672
4673ALIAS (clear_ip_bgp_peer,
4674 clear_bgp_ipv6_peer_cmd,
4675 "clear bgp ipv6 (A.B.C.D|X:X::X:X)",
4676 CLEAR_STR
4677 BGP_STR
4678 "Address family\n"
4679 "BGP neighbor address to clear\n"
4680 "BGP IPv6 neighbor to clear\n")
4681
4682DEFUN (clear_ip_bgp_peer_group,
4683 clear_ip_bgp_peer_group_cmd,
4684 "clear ip bgp peer-group WORD",
4685 CLEAR_STR
4686 IP_STR
4687 BGP_STR
4688 "Clear all members of peer-group\n"
4689 "BGP peer-group name\n")
4690{
4691 return bgp_clear_vty (vty, NULL, 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[0]);
4692}
4693
4694ALIAS (clear_ip_bgp_peer_group,
4695 clear_bgp_peer_group_cmd,
4696 "clear bgp peer-group WORD",
4697 CLEAR_STR
4698 BGP_STR
4699 "Clear all members of peer-group\n"
4700 "BGP peer-group name\n")
4701
4702ALIAS (clear_ip_bgp_peer_group,
4703 clear_bgp_ipv6_peer_group_cmd,
4704 "clear bgp ipv6 peer-group WORD",
4705 CLEAR_STR
4706 BGP_STR
4707 "Address family\n"
4708 "Clear all members of peer-group\n"
4709 "BGP peer-group name\n")
4710
4711DEFUN (clear_ip_bgp_external,
4712 clear_ip_bgp_external_cmd,
4713 "clear ip bgp external",
4714 CLEAR_STR
4715 IP_STR
4716 BGP_STR
4717 "Clear all external peers\n")
4718{
4719 return bgp_clear_vty (vty, NULL, 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL);
4720}
4721
4722ALIAS (clear_ip_bgp_external,
4723 clear_bgp_external_cmd,
4724 "clear bgp external",
4725 CLEAR_STR
4726 BGP_STR
4727 "Clear all external peers\n")
4728
4729ALIAS (clear_ip_bgp_external,
4730 clear_bgp_ipv6_external_cmd,
4731 "clear bgp ipv6 external",
4732 CLEAR_STR
4733 BGP_STR
4734 "Address family\n"
4735 "Clear all external peers\n")
4736
4737DEFUN (clear_ip_bgp_as,
4738 clear_ip_bgp_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00004739 "clear ip bgp " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00004740 CLEAR_STR
4741 IP_STR
4742 BGP_STR
4743 "Clear peers with the AS number\n")
4744{
4745 return bgp_clear_vty (vty, NULL, 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[0]);
4746}
4747
4748ALIAS (clear_ip_bgp_as,
4749 clear_bgp_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00004750 "clear bgp " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00004751 CLEAR_STR
4752 BGP_STR
4753 "Clear peers with the AS number\n")
4754
4755ALIAS (clear_ip_bgp_as,
4756 clear_bgp_ipv6_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00004757 "clear bgp ipv6 " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00004758 CLEAR_STR
4759 BGP_STR
4760 "Address family\n"
4761 "Clear peers with the AS number\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02004762
paul718e3742002-12-13 20:15:29 +00004763/* Outbound soft-reconfiguration */
4764DEFUN (clear_ip_bgp_all_soft_out,
4765 clear_ip_bgp_all_soft_out_cmd,
4766 "clear ip bgp * soft out",
4767 CLEAR_STR
4768 IP_STR
4769 BGP_STR
4770 "Clear all peers\n"
4771 "Soft reconfig\n"
4772 "Soft reconfig outbound update\n")
4773{
4774 if (argc == 1)
4775 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
4776 BGP_CLEAR_SOFT_OUT, NULL);
4777
4778 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
4779 BGP_CLEAR_SOFT_OUT, NULL);
4780}
4781
4782ALIAS (clear_ip_bgp_all_soft_out,
4783 clear_ip_bgp_all_out_cmd,
4784 "clear ip bgp * out",
4785 CLEAR_STR
4786 IP_STR
4787 BGP_STR
4788 "Clear all peers\n"
4789 "Soft reconfig outbound update\n")
4790
4791ALIAS (clear_ip_bgp_all_soft_out,
4792 clear_ip_bgp_instance_all_soft_out_cmd,
4793 "clear ip bgp view WORD * soft out",
4794 CLEAR_STR
4795 IP_STR
4796 BGP_STR
4797 "BGP view\n"
4798 "view name\n"
4799 "Clear all peers\n"
4800 "Soft reconfig\n"
4801 "Soft reconfig outbound update\n")
4802
4803DEFUN (clear_ip_bgp_all_ipv4_soft_out,
4804 clear_ip_bgp_all_ipv4_soft_out_cmd,
4805 "clear ip bgp * ipv4 (unicast|multicast) soft out",
4806 CLEAR_STR
4807 IP_STR
4808 BGP_STR
4809 "Clear all peers\n"
4810 "Address family\n"
4811 "Address Family modifier\n"
4812 "Address Family modifier\n"
4813 "Soft reconfig\n"
4814 "Soft reconfig outbound update\n")
4815{
4816 if (strncmp (argv[0], "m", 1) == 0)
4817 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
4818 BGP_CLEAR_SOFT_OUT, NULL);
4819
4820 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
4821 BGP_CLEAR_SOFT_OUT, NULL);
4822}
4823
4824ALIAS (clear_ip_bgp_all_ipv4_soft_out,
4825 clear_ip_bgp_all_ipv4_out_cmd,
4826 "clear ip bgp * ipv4 (unicast|multicast) out",
4827 CLEAR_STR
4828 IP_STR
4829 BGP_STR
4830 "Clear all peers\n"
4831 "Address family\n"
4832 "Address Family modifier\n"
4833 "Address Family modifier\n"
4834 "Soft reconfig outbound update\n")
4835
4836DEFUN (clear_ip_bgp_instance_all_ipv4_soft_out,
4837 clear_ip_bgp_instance_all_ipv4_soft_out_cmd,
4838 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft out",
4839 CLEAR_STR
4840 IP_STR
4841 BGP_STR
4842 "BGP view\n"
4843 "view name\n"
4844 "Clear all peers\n"
4845 "Address family\n"
4846 "Address Family modifier\n"
4847 "Address Family modifier\n"
4848 "Soft reconfig outbound update\n")
4849{
4850 if (strncmp (argv[1], "m", 1) == 0)
4851 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
4852 BGP_CLEAR_SOFT_OUT, NULL);
4853
4854 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
4855 BGP_CLEAR_SOFT_OUT, NULL);
4856}
4857
4858DEFUN (clear_ip_bgp_all_vpnv4_soft_out,
4859 clear_ip_bgp_all_vpnv4_soft_out_cmd,
4860 "clear ip bgp * vpnv4 unicast soft out",
4861 CLEAR_STR
4862 IP_STR
4863 BGP_STR
4864 "Clear all peers\n"
4865 "Address family\n"
4866 "Address Family Modifier\n"
4867 "Soft reconfig\n"
4868 "Soft reconfig outbound update\n")
4869{
4870 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
4871 BGP_CLEAR_SOFT_OUT, NULL);
4872}
4873
4874ALIAS (clear_ip_bgp_all_vpnv4_soft_out,
4875 clear_ip_bgp_all_vpnv4_out_cmd,
4876 "clear ip bgp * vpnv4 unicast out",
4877 CLEAR_STR
4878 IP_STR
4879 BGP_STR
4880 "Clear all peers\n"
4881 "Address family\n"
4882 "Address Family Modifier\n"
4883 "Soft reconfig outbound update\n")
4884
Lou Berger298cc2f2016-01-12 13:42:02 -05004885DEFUN (clear_ip_bgp_all_encap_soft_out,
4886 clear_ip_bgp_all_encap_soft_out_cmd,
4887 "clear ip bgp * encap unicast soft out",
4888 CLEAR_STR
4889 IP_STR
4890 BGP_STR
4891 "Clear all peers\n"
4892 "Address family\n"
4893 "Address Family Modifier\n"
4894 "Soft reconfig\n"
4895 "Soft reconfig outbound update\n")
4896{
4897 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_all,
4898 BGP_CLEAR_SOFT_OUT, NULL);
4899}
4900
4901ALIAS (clear_ip_bgp_all_encap_soft_out,
4902 clear_ip_bgp_all_encap_out_cmd,
4903 "clear ip bgp * encap unicast out",
4904 CLEAR_STR
4905 IP_STR
4906 BGP_STR
4907 "Clear all peers\n"
4908 "Address family\n"
4909 "Address Family Modifier\n"
4910 "Soft reconfig outbound update\n")
4911
paul718e3742002-12-13 20:15:29 +00004912DEFUN (clear_bgp_all_soft_out,
4913 clear_bgp_all_soft_out_cmd,
4914 "clear bgp * soft out",
4915 CLEAR_STR
4916 BGP_STR
4917 "Clear all peers\n"
4918 "Soft reconfig\n"
4919 "Soft reconfig outbound update\n")
4920{
4921 if (argc == 1)
4922 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
4923 BGP_CLEAR_SOFT_OUT, NULL);
4924
4925 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
4926 BGP_CLEAR_SOFT_OUT, NULL);
4927}
4928
4929ALIAS (clear_bgp_all_soft_out,
4930 clear_bgp_instance_all_soft_out_cmd,
4931 "clear bgp view WORD * soft out",
4932 CLEAR_STR
4933 BGP_STR
4934 "BGP view\n"
4935 "view name\n"
4936 "Clear all peers\n"
4937 "Soft reconfig\n"
4938 "Soft reconfig outbound update\n")
4939
4940ALIAS (clear_bgp_all_soft_out,
4941 clear_bgp_all_out_cmd,
4942 "clear bgp * out",
4943 CLEAR_STR
4944 BGP_STR
4945 "Clear all peers\n"
4946 "Soft reconfig outbound update\n")
4947
4948ALIAS (clear_bgp_all_soft_out,
4949 clear_bgp_ipv6_all_soft_out_cmd,
4950 "clear bgp ipv6 * soft out",
4951 CLEAR_STR
4952 BGP_STR
4953 "Address family\n"
4954 "Clear all peers\n"
4955 "Soft reconfig\n"
4956 "Soft reconfig outbound update\n")
4957
4958ALIAS (clear_bgp_all_soft_out,
4959 clear_bgp_ipv6_all_out_cmd,
4960 "clear bgp ipv6 * out",
4961 CLEAR_STR
4962 BGP_STR
4963 "Address family\n"
4964 "Clear all peers\n"
4965 "Soft reconfig outbound update\n")
4966
4967DEFUN (clear_ip_bgp_peer_soft_out,
4968 clear_ip_bgp_peer_soft_out_cmd,
4969 "clear ip bgp A.B.C.D soft out",
4970 CLEAR_STR
4971 IP_STR
4972 BGP_STR
4973 "BGP neighbor address to clear\n"
4974 "Soft reconfig\n"
4975 "Soft reconfig outbound update\n")
4976{
4977 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
4978 BGP_CLEAR_SOFT_OUT, argv[0]);
4979}
4980
4981ALIAS (clear_ip_bgp_peer_soft_out,
4982 clear_ip_bgp_peer_out_cmd,
4983 "clear ip bgp A.B.C.D out",
4984 CLEAR_STR
4985 IP_STR
4986 BGP_STR
4987 "BGP neighbor address to clear\n"
4988 "Soft reconfig outbound update\n")
4989
4990DEFUN (clear_ip_bgp_peer_ipv4_soft_out,
4991 clear_ip_bgp_peer_ipv4_soft_out_cmd,
4992 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft out",
4993 CLEAR_STR
4994 IP_STR
4995 BGP_STR
4996 "BGP neighbor address to clear\n"
4997 "Address family\n"
4998 "Address Family modifier\n"
4999 "Address Family modifier\n"
5000 "Soft reconfig\n"
5001 "Soft reconfig outbound update\n")
5002{
5003 if (strncmp (argv[1], "m", 1) == 0)
5004 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
5005 BGP_CLEAR_SOFT_OUT, argv[0]);
5006
5007 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5008 BGP_CLEAR_SOFT_OUT, argv[0]);
5009}
5010
5011ALIAS (clear_ip_bgp_peer_ipv4_soft_out,
5012 clear_ip_bgp_peer_ipv4_out_cmd,
5013 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) out",
5014 CLEAR_STR
5015 IP_STR
5016 BGP_STR
5017 "BGP neighbor address to clear\n"
5018 "Address family\n"
5019 "Address Family modifier\n"
5020 "Address Family modifier\n"
5021 "Soft reconfig outbound update\n")
5022
5023DEFUN (clear_ip_bgp_peer_vpnv4_soft_out,
5024 clear_ip_bgp_peer_vpnv4_soft_out_cmd,
5025 "clear ip bgp A.B.C.D vpnv4 unicast soft out",
5026 CLEAR_STR
5027 IP_STR
5028 BGP_STR
5029 "BGP neighbor address to clear\n"
5030 "Address family\n"
5031 "Address Family Modifier\n"
5032 "Soft reconfig\n"
5033 "Soft reconfig outbound update\n")
5034{
5035 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
5036 BGP_CLEAR_SOFT_OUT, argv[0]);
5037}
5038
5039ALIAS (clear_ip_bgp_peer_vpnv4_soft_out,
5040 clear_ip_bgp_peer_vpnv4_out_cmd,
5041 "clear ip bgp A.B.C.D vpnv4 unicast out",
5042 CLEAR_STR
5043 IP_STR
5044 BGP_STR
5045 "BGP neighbor address to clear\n"
5046 "Address family\n"
5047 "Address Family Modifier\n"
5048 "Soft reconfig outbound update\n")
5049
Lou Berger298cc2f2016-01-12 13:42:02 -05005050DEFUN (clear_ip_bgp_peer_encap_soft_out,
5051 clear_ip_bgp_peer_encap_soft_out_cmd,
5052 "clear ip bgp A.B.C.D encap unicast soft out",
5053 CLEAR_STR
5054 IP_STR
5055 BGP_STR
5056 "BGP neighbor address to clear\n"
5057 "Address family\n"
5058 "Address Family Modifier\n"
5059 "Soft reconfig\n"
5060 "Soft reconfig outbound update\n")
5061{
5062 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_peer,
5063 BGP_CLEAR_SOFT_OUT, argv[0]);
5064}
5065
5066ALIAS (clear_ip_bgp_peer_encap_soft_out,
5067 clear_ip_bgp_peer_encap_out_cmd,
5068 "clear ip bgp A.B.C.D encap unicast out",
5069 CLEAR_STR
5070 IP_STR
5071 BGP_STR
5072 "BGP neighbor address to clear\n"
5073 "Address family\n"
5074 "Address Family Modifier\n"
5075 "Soft reconfig outbound update\n")
5076
paul718e3742002-12-13 20:15:29 +00005077DEFUN (clear_bgp_peer_soft_out,
5078 clear_bgp_peer_soft_out_cmd,
5079 "clear bgp (A.B.C.D|X:X::X:X) soft out",
5080 CLEAR_STR
5081 BGP_STR
5082 "BGP neighbor address to clear\n"
5083 "BGP IPv6 neighbor to clear\n"
5084 "Soft reconfig\n"
5085 "Soft reconfig outbound update\n")
5086{
5087 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
5088 BGP_CLEAR_SOFT_OUT, argv[0]);
5089}
5090
5091ALIAS (clear_bgp_peer_soft_out,
5092 clear_bgp_ipv6_peer_soft_out_cmd,
5093 "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft out",
5094 CLEAR_STR
5095 BGP_STR
5096 "Address family\n"
5097 "BGP neighbor address to clear\n"
5098 "BGP IPv6 neighbor to clear\n"
5099 "Soft reconfig\n"
5100 "Soft reconfig outbound update\n")
5101
5102ALIAS (clear_bgp_peer_soft_out,
5103 clear_bgp_peer_out_cmd,
5104 "clear bgp (A.B.C.D|X:X::X:X) out",
5105 CLEAR_STR
5106 BGP_STR
5107 "BGP neighbor address to clear\n"
5108 "BGP IPv6 neighbor to clear\n"
5109 "Soft reconfig outbound update\n")
5110
5111ALIAS (clear_bgp_peer_soft_out,
5112 clear_bgp_ipv6_peer_out_cmd,
5113 "clear bgp ipv6 (A.B.C.D|X:X::X:X) out",
5114 CLEAR_STR
5115 BGP_STR
5116 "Address family\n"
5117 "BGP neighbor address to clear\n"
5118 "BGP IPv6 neighbor to clear\n"
5119 "Soft reconfig outbound update\n")
5120
5121DEFUN (clear_ip_bgp_peer_group_soft_out,
5122 clear_ip_bgp_peer_group_soft_out_cmd,
5123 "clear ip bgp peer-group WORD soft out",
5124 CLEAR_STR
5125 IP_STR
5126 BGP_STR
5127 "Clear all members of peer-group\n"
5128 "BGP peer-group name\n"
5129 "Soft reconfig\n"
5130 "Soft reconfig outbound update\n")
5131{
5132 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5133 BGP_CLEAR_SOFT_OUT, argv[0]);
5134}
5135
5136ALIAS (clear_ip_bgp_peer_group_soft_out,
5137 clear_ip_bgp_peer_group_out_cmd,
5138 "clear ip bgp peer-group WORD 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 "Soft reconfig outbound update\n")
5145
5146DEFUN (clear_ip_bgp_peer_group_ipv4_soft_out,
5147 clear_ip_bgp_peer_group_ipv4_soft_out_cmd,
5148 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft out",
5149 CLEAR_STR
5150 IP_STR
5151 BGP_STR
5152 "Clear all members of peer-group\n"
5153 "BGP peer-group name\n"
5154 "Address family\n"
5155 "Address Family modifier\n"
5156 "Address Family modifier\n"
5157 "Soft reconfig\n"
5158 "Soft reconfig outbound update\n")
5159{
5160 if (strncmp (argv[1], "m", 1) == 0)
5161 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
5162 BGP_CLEAR_SOFT_OUT, argv[0]);
5163
5164 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5165 BGP_CLEAR_SOFT_OUT, argv[0]);
5166}
5167
5168ALIAS (clear_ip_bgp_peer_group_ipv4_soft_out,
5169 clear_ip_bgp_peer_group_ipv4_out_cmd,
5170 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) out",
5171 CLEAR_STR
5172 IP_STR
5173 BGP_STR
5174 "Clear all members of peer-group\n"
5175 "BGP peer-group name\n"
5176 "Address family\n"
5177 "Address Family modifier\n"
5178 "Address Family modifier\n"
5179 "Soft reconfig outbound update\n")
5180
5181DEFUN (clear_bgp_peer_group_soft_out,
5182 clear_bgp_peer_group_soft_out_cmd,
5183 "clear bgp peer-group WORD soft out",
5184 CLEAR_STR
5185 BGP_STR
5186 "Clear all members of peer-group\n"
5187 "BGP peer-group name\n"
5188 "Soft reconfig\n"
5189 "Soft reconfig outbound update\n")
5190{
5191 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
5192 BGP_CLEAR_SOFT_OUT, argv[0]);
5193}
5194
5195ALIAS (clear_bgp_peer_group_soft_out,
5196 clear_bgp_ipv6_peer_group_soft_out_cmd,
5197 "clear bgp ipv6 peer-group WORD soft out",
5198 CLEAR_STR
5199 BGP_STR
5200 "Address family\n"
5201 "Clear all members of peer-group\n"
5202 "BGP peer-group name\n"
5203 "Soft reconfig\n"
5204 "Soft reconfig outbound update\n")
5205
5206ALIAS (clear_bgp_peer_group_soft_out,
5207 clear_bgp_peer_group_out_cmd,
5208 "clear bgp peer-group WORD out",
5209 CLEAR_STR
5210 BGP_STR
5211 "Clear all members of peer-group\n"
5212 "BGP peer-group name\n"
5213 "Soft reconfig outbound update\n")
5214
5215ALIAS (clear_bgp_peer_group_soft_out,
5216 clear_bgp_ipv6_peer_group_out_cmd,
5217 "clear bgp ipv6 peer-group WORD out",
5218 CLEAR_STR
5219 BGP_STR
5220 "Address family\n"
5221 "Clear all members of peer-group\n"
5222 "BGP peer-group name\n"
5223 "Soft reconfig outbound update\n")
5224
5225DEFUN (clear_ip_bgp_external_soft_out,
5226 clear_ip_bgp_external_soft_out_cmd,
5227 "clear ip bgp external soft out",
5228 CLEAR_STR
5229 IP_STR
5230 BGP_STR
5231 "Clear all external peers\n"
5232 "Soft reconfig\n"
5233 "Soft reconfig outbound update\n")
5234{
5235 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5236 BGP_CLEAR_SOFT_OUT, NULL);
5237}
5238
5239ALIAS (clear_ip_bgp_external_soft_out,
5240 clear_ip_bgp_external_out_cmd,
5241 "clear ip bgp external out",
5242 CLEAR_STR
5243 IP_STR
5244 BGP_STR
5245 "Clear all external peers\n"
5246 "Soft reconfig outbound update\n")
5247
5248DEFUN (clear_ip_bgp_external_ipv4_soft_out,
5249 clear_ip_bgp_external_ipv4_soft_out_cmd,
5250 "clear ip bgp external ipv4 (unicast|multicast) soft out",
5251 CLEAR_STR
5252 IP_STR
5253 BGP_STR
5254 "Clear all external peers\n"
5255 "Address family\n"
5256 "Address Family modifier\n"
5257 "Address Family modifier\n"
5258 "Soft reconfig\n"
5259 "Soft reconfig outbound update\n")
5260{
5261 if (strncmp (argv[0], "m", 1) == 0)
5262 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
5263 BGP_CLEAR_SOFT_OUT, NULL);
5264
5265 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5266 BGP_CLEAR_SOFT_OUT, NULL);
5267}
5268
5269ALIAS (clear_ip_bgp_external_ipv4_soft_out,
5270 clear_ip_bgp_external_ipv4_out_cmd,
5271 "clear ip bgp external ipv4 (unicast|multicast) out",
5272 CLEAR_STR
5273 IP_STR
5274 BGP_STR
5275 "Clear all external peers\n"
5276 "Address family\n"
5277 "Address Family modifier\n"
5278 "Address Family modifier\n"
5279 "Soft reconfig outbound update\n")
5280
5281DEFUN (clear_bgp_external_soft_out,
5282 clear_bgp_external_soft_out_cmd,
5283 "clear bgp external soft out",
5284 CLEAR_STR
5285 BGP_STR
5286 "Clear all external peers\n"
5287 "Soft reconfig\n"
5288 "Soft reconfig outbound update\n")
5289{
5290 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
5291 BGP_CLEAR_SOFT_OUT, NULL);
5292}
5293
5294ALIAS (clear_bgp_external_soft_out,
5295 clear_bgp_ipv6_external_soft_out_cmd,
5296 "clear bgp ipv6 external soft out",
5297 CLEAR_STR
5298 BGP_STR
5299 "Address family\n"
5300 "Clear all external peers\n"
5301 "Soft reconfig\n"
5302 "Soft reconfig outbound update\n")
5303
5304ALIAS (clear_bgp_external_soft_out,
5305 clear_bgp_external_out_cmd,
5306 "clear bgp external out",
5307 CLEAR_STR
5308 BGP_STR
5309 "Clear all external peers\n"
5310 "Soft reconfig outbound update\n")
5311
5312ALIAS (clear_bgp_external_soft_out,
5313 clear_bgp_ipv6_external_out_cmd,
5314 "clear bgp ipv6 external WORD out",
5315 CLEAR_STR
5316 BGP_STR
5317 "Address family\n"
5318 "Clear all external peers\n"
5319 "Soft reconfig outbound update\n")
5320
5321DEFUN (clear_ip_bgp_as_soft_out,
5322 clear_ip_bgp_as_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005323 "clear ip bgp " CMD_AS_RANGE " soft out",
paul718e3742002-12-13 20:15:29 +00005324 CLEAR_STR
5325 IP_STR
5326 BGP_STR
5327 "Clear peers with the AS number\n"
5328 "Soft reconfig\n"
5329 "Soft reconfig outbound update\n")
5330{
5331 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
5332 BGP_CLEAR_SOFT_OUT, argv[0]);
5333}
5334
5335ALIAS (clear_ip_bgp_as_soft_out,
5336 clear_ip_bgp_as_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005337 "clear ip bgp " CMD_AS_RANGE " out",
paul718e3742002-12-13 20:15:29 +00005338 CLEAR_STR
5339 IP_STR
5340 BGP_STR
5341 "Clear peers with the AS number\n"
5342 "Soft reconfig outbound update\n")
5343
5344DEFUN (clear_ip_bgp_as_ipv4_soft_out,
5345 clear_ip_bgp_as_ipv4_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005346 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft out",
paul718e3742002-12-13 20:15:29 +00005347 CLEAR_STR
5348 IP_STR
5349 BGP_STR
5350 "Clear peers with the AS number\n"
5351 "Address family\n"
5352 "Address Family modifier\n"
5353 "Address Family modifier\n"
5354 "Soft reconfig\n"
5355 "Soft reconfig outbound update\n")
5356{
5357 if (strncmp (argv[1], "m", 1) == 0)
5358 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
5359 BGP_CLEAR_SOFT_OUT, argv[0]);
5360
5361 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
5362 BGP_CLEAR_SOFT_OUT, argv[0]);
5363}
5364
5365ALIAS (clear_ip_bgp_as_ipv4_soft_out,
5366 clear_ip_bgp_as_ipv4_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005367 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) out",
paul718e3742002-12-13 20:15:29 +00005368 CLEAR_STR
5369 IP_STR
5370 BGP_STR
5371 "Clear peers with the AS number\n"
5372 "Address family\n"
5373 "Address Family modifier\n"
5374 "Address Family modifier\n"
5375 "Soft reconfig outbound update\n")
5376
5377DEFUN (clear_ip_bgp_as_vpnv4_soft_out,
5378 clear_ip_bgp_as_vpnv4_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005379 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft out",
paul718e3742002-12-13 20:15:29 +00005380 CLEAR_STR
5381 IP_STR
5382 BGP_STR
5383 "Clear peers with the AS number\n"
5384 "Address family\n"
5385 "Address Family modifier\n"
5386 "Soft reconfig\n"
5387 "Soft reconfig outbound update\n")
5388{
5389 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
5390 BGP_CLEAR_SOFT_OUT, argv[0]);
5391}
5392
5393ALIAS (clear_ip_bgp_as_vpnv4_soft_out,
5394 clear_ip_bgp_as_vpnv4_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005395 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast out",
paul718e3742002-12-13 20:15:29 +00005396 CLEAR_STR
5397 IP_STR
5398 BGP_STR
5399 "Clear peers with the AS number\n"
5400 "Address family\n"
5401 "Address Family modifier\n"
5402 "Soft reconfig outbound update\n")
5403
Lou Berger298cc2f2016-01-12 13:42:02 -05005404DEFUN (clear_ip_bgp_as_encap_soft_out,
5405 clear_ip_bgp_as_encap_soft_out_cmd,
5406 "clear ip bgp " CMD_AS_RANGE " encap unicast soft out",
5407 CLEAR_STR
5408 IP_STR
5409 BGP_STR
5410 "Clear peers with the AS number\n"
5411 "Address family\n"
5412 "Address Family modifier\n"
5413 "Soft reconfig\n"
5414 "Soft reconfig outbound update\n")
5415{
5416 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_as,
5417 BGP_CLEAR_SOFT_OUT, argv[0]);
5418}
5419
5420ALIAS (clear_ip_bgp_as_encap_soft_out,
5421 clear_ip_bgp_as_encap_out_cmd,
5422 "clear ip bgp " CMD_AS_RANGE " encap unicast out",
5423 CLEAR_STR
5424 IP_STR
5425 BGP_STR
5426 "Clear peers with the AS number\n"
5427 "Address family\n"
5428 "Address Family modifier\n"
5429 "Soft reconfig outbound update\n")
5430
paul718e3742002-12-13 20:15:29 +00005431DEFUN (clear_bgp_as_soft_out,
5432 clear_bgp_as_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005433 "clear bgp " CMD_AS_RANGE " soft out",
paul718e3742002-12-13 20:15:29 +00005434 CLEAR_STR
5435 BGP_STR
5436 "Clear peers with the AS number\n"
5437 "Soft reconfig\n"
5438 "Soft reconfig outbound update\n")
5439{
5440 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
5441 BGP_CLEAR_SOFT_OUT, argv[0]);
5442}
5443
5444ALIAS (clear_bgp_as_soft_out,
5445 clear_bgp_ipv6_as_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005446 "clear bgp ipv6 " CMD_AS_RANGE " soft out",
paul718e3742002-12-13 20:15:29 +00005447 CLEAR_STR
5448 BGP_STR
5449 "Address family\n"
5450 "Clear peers with the AS number\n"
5451 "Soft reconfig\n"
5452 "Soft reconfig outbound update\n")
5453
5454ALIAS (clear_bgp_as_soft_out,
5455 clear_bgp_as_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005456 "clear bgp " CMD_AS_RANGE " out",
paul718e3742002-12-13 20:15:29 +00005457 CLEAR_STR
5458 BGP_STR
5459 "Clear peers with the AS number\n"
5460 "Soft reconfig outbound update\n")
5461
5462ALIAS (clear_bgp_as_soft_out,
5463 clear_bgp_ipv6_as_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005464 "clear bgp ipv6 " CMD_AS_RANGE " out",
paul718e3742002-12-13 20:15:29 +00005465 CLEAR_STR
5466 BGP_STR
5467 "Address family\n"
5468 "Clear peers with the AS number\n"
5469 "Soft reconfig outbound update\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02005470
paul718e3742002-12-13 20:15:29 +00005471/* Inbound soft-reconfiguration */
5472DEFUN (clear_ip_bgp_all_soft_in,
5473 clear_ip_bgp_all_soft_in_cmd,
5474 "clear ip bgp * soft in",
5475 CLEAR_STR
5476 IP_STR
5477 BGP_STR
5478 "Clear all peers\n"
5479 "Soft reconfig\n"
5480 "Soft reconfig inbound update\n")
5481{
5482 if (argc == 1)
5483 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5484 BGP_CLEAR_SOFT_IN, NULL);
5485
5486 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5487 BGP_CLEAR_SOFT_IN, NULL);
5488}
5489
5490ALIAS (clear_ip_bgp_all_soft_in,
5491 clear_ip_bgp_instance_all_soft_in_cmd,
5492 "clear ip bgp view WORD * soft in",
5493 CLEAR_STR
5494 IP_STR
5495 BGP_STR
5496 "BGP view\n"
5497 "view name\n"
5498 "Clear all peers\n"
5499 "Soft reconfig\n"
5500 "Soft reconfig inbound update\n")
5501
5502ALIAS (clear_ip_bgp_all_soft_in,
5503 clear_ip_bgp_all_in_cmd,
5504 "clear ip bgp * in",
5505 CLEAR_STR
5506 IP_STR
5507 BGP_STR
5508 "Clear all peers\n"
5509 "Soft reconfig inbound update\n")
5510
5511DEFUN (clear_ip_bgp_all_in_prefix_filter,
5512 clear_ip_bgp_all_in_prefix_filter_cmd,
5513 "clear ip bgp * in prefix-filter",
5514 CLEAR_STR
5515 IP_STR
5516 BGP_STR
5517 "Clear all peers\n"
5518 "Soft reconfig inbound update\n"
5519 "Push out prefix-list ORF and do inbound soft reconfig\n")
5520{
5521 if (argc== 1)
5522 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5523 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5524
5525 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5526 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5527}
5528
5529ALIAS (clear_ip_bgp_all_in_prefix_filter,
5530 clear_ip_bgp_instance_all_in_prefix_filter_cmd,
5531 "clear ip bgp view WORD * in prefix-filter",
5532 CLEAR_STR
5533 IP_STR
5534 BGP_STR
5535 "BGP view\n"
5536 "view name\n"
5537 "Clear all peers\n"
5538 "Soft reconfig inbound update\n"
5539 "Push out prefix-list ORF and do inbound soft reconfig\n")
5540
5541
5542DEFUN (clear_ip_bgp_all_ipv4_soft_in,
5543 clear_ip_bgp_all_ipv4_soft_in_cmd,
5544 "clear ip bgp * ipv4 (unicast|multicast) soft in",
5545 CLEAR_STR
5546 IP_STR
5547 BGP_STR
5548 "Clear all peers\n"
5549 "Address family\n"
5550 "Address Family modifier\n"
5551 "Address Family modifier\n"
5552 "Soft reconfig\n"
5553 "Soft reconfig inbound update\n")
5554{
5555 if (strncmp (argv[0], "m", 1) == 0)
5556 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
5557 BGP_CLEAR_SOFT_IN, NULL);
5558
5559 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5560 BGP_CLEAR_SOFT_IN, NULL);
5561}
5562
5563ALIAS (clear_ip_bgp_all_ipv4_soft_in,
5564 clear_ip_bgp_all_ipv4_in_cmd,
5565 "clear ip bgp * ipv4 (unicast|multicast) in",
5566 CLEAR_STR
5567 IP_STR
5568 BGP_STR
5569 "Clear all peers\n"
5570 "Address family\n"
5571 "Address Family modifier\n"
5572 "Address Family modifier\n"
5573 "Soft reconfig inbound update\n")
5574
5575DEFUN (clear_ip_bgp_instance_all_ipv4_soft_in,
5576 clear_ip_bgp_instance_all_ipv4_soft_in_cmd,
5577 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft in",
5578 CLEAR_STR
5579 IP_STR
5580 BGP_STR
5581 "BGP view\n"
5582 "view name\n"
5583 "Clear all peers\n"
5584 "Address family\n"
5585 "Address Family modifier\n"
5586 "Address Family modifier\n"
5587 "Soft reconfig\n"
5588 "Soft reconfig inbound update\n")
5589{
5590 if (strncmp (argv[1], "m", 1) == 0)
5591 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
5592 BGP_CLEAR_SOFT_IN, NULL);
5593
5594 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5595 BGP_CLEAR_SOFT_IN, NULL);
5596}
5597
5598DEFUN (clear_ip_bgp_all_ipv4_in_prefix_filter,
5599 clear_ip_bgp_all_ipv4_in_prefix_filter_cmd,
5600 "clear ip bgp * ipv4 (unicast|multicast) in prefix-filter",
5601 CLEAR_STR
5602 IP_STR
5603 BGP_STR
5604 "Clear all peers\n"
5605 "Address family\n"
5606 "Address Family modifier\n"
5607 "Address Family modifier\n"
5608 "Soft reconfig inbound update\n"
5609 "Push out prefix-list ORF and do inbound soft reconfig\n")
5610{
5611 if (strncmp (argv[0], "m", 1) == 0)
5612 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
5613 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5614
5615 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5616 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5617}
5618
5619DEFUN (clear_ip_bgp_instance_all_ipv4_in_prefix_filter,
5620 clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd,
5621 "clear ip bgp view WORD * ipv4 (unicast|multicast) in prefix-filter",
5622 CLEAR_STR
5623 IP_STR
5624 BGP_STR
5625 "Clear all peers\n"
5626 "Address family\n"
5627 "Address Family modifier\n"
5628 "Address Family modifier\n"
5629 "Soft reconfig inbound update\n"
5630 "Push out prefix-list ORF and do inbound soft reconfig\n")
5631{
5632 if (strncmp (argv[1], "m", 1) == 0)
5633 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
5634 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5635
5636 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5637 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5638}
5639
5640DEFUN (clear_ip_bgp_all_vpnv4_soft_in,
5641 clear_ip_bgp_all_vpnv4_soft_in_cmd,
5642 "clear ip bgp * vpnv4 unicast soft in",
5643 CLEAR_STR
5644 IP_STR
5645 BGP_STR
5646 "Clear all peers\n"
5647 "Address family\n"
5648 "Address Family Modifier\n"
5649 "Soft reconfig\n"
5650 "Soft reconfig inbound update\n")
5651{
5652 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
5653 BGP_CLEAR_SOFT_IN, NULL);
5654}
5655
5656ALIAS (clear_ip_bgp_all_vpnv4_soft_in,
5657 clear_ip_bgp_all_vpnv4_in_cmd,
5658 "clear ip bgp * vpnv4 unicast in",
5659 CLEAR_STR
5660 IP_STR
5661 BGP_STR
5662 "Clear all peers\n"
5663 "Address family\n"
5664 "Address Family Modifier\n"
5665 "Soft reconfig inbound update\n")
5666
Lou Berger298cc2f2016-01-12 13:42:02 -05005667DEFUN (clear_ip_bgp_all_encap_soft_in,
5668 clear_ip_bgp_all_encap_soft_in_cmd,
5669 "clear ip bgp * encap unicast soft in",
5670 CLEAR_STR
5671 IP_STR
5672 BGP_STR
5673 "Clear all peers\n"
5674 "Address family\n"
5675 "Address Family Modifier\n"
5676 "Soft reconfig\n"
5677 "Soft reconfig inbound update\n")
5678{
5679 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_all,
5680 BGP_CLEAR_SOFT_IN, NULL);
5681}
5682
5683ALIAS (clear_ip_bgp_all_encap_soft_in,
5684 clear_ip_bgp_all_encap_in_cmd,
5685 "clear ip bgp * encap unicast in",
5686 CLEAR_STR
5687 IP_STR
5688 BGP_STR
5689 "Clear all peers\n"
5690 "Address family\n"
5691 "Address Family Modifier\n"
5692 "Soft reconfig inbound update\n")
5693
paul718e3742002-12-13 20:15:29 +00005694DEFUN (clear_bgp_all_soft_in,
5695 clear_bgp_all_soft_in_cmd,
5696 "clear bgp * soft in",
5697 CLEAR_STR
5698 BGP_STR
5699 "Clear all peers\n"
5700 "Soft reconfig\n"
5701 "Soft reconfig inbound update\n")
5702{
5703 if (argc == 1)
5704 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
5705 BGP_CLEAR_SOFT_IN, NULL);
5706
5707 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
5708 BGP_CLEAR_SOFT_IN, NULL);
5709}
5710
5711ALIAS (clear_bgp_all_soft_in,
5712 clear_bgp_instance_all_soft_in_cmd,
5713 "clear bgp view WORD * soft in",
5714 CLEAR_STR
5715 BGP_STR
5716 "BGP view\n"
5717 "view name\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_ipv6_all_soft_in_cmd,
5724 "clear bgp ipv6 * soft in",
5725 CLEAR_STR
5726 BGP_STR
5727 "Address family\n"
5728 "Clear all peers\n"
5729 "Soft reconfig\n"
5730 "Soft reconfig inbound update\n")
5731
5732ALIAS (clear_bgp_all_soft_in,
5733 clear_bgp_all_in_cmd,
5734 "clear bgp * in",
5735 CLEAR_STR
5736 BGP_STR
5737 "Clear all peers\n"
5738 "Soft reconfig inbound update\n")
5739
5740ALIAS (clear_bgp_all_soft_in,
5741 clear_bgp_ipv6_all_in_cmd,
5742 "clear bgp ipv6 * in",
5743 CLEAR_STR
5744 BGP_STR
5745 "Address family\n"
5746 "Clear all peers\n"
5747 "Soft reconfig inbound update\n")
5748
5749DEFUN (clear_bgp_all_in_prefix_filter,
5750 clear_bgp_all_in_prefix_filter_cmd,
5751 "clear bgp * in prefix-filter",
5752 CLEAR_STR
5753 BGP_STR
5754 "Clear all peers\n"
5755 "Soft reconfig inbound update\n"
5756 "Push out prefix-list ORF and do inbound soft reconfig\n")
5757{
5758 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
5759 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5760}
5761
5762ALIAS (clear_bgp_all_in_prefix_filter,
5763 clear_bgp_ipv6_all_in_prefix_filter_cmd,
5764 "clear bgp ipv6 * in prefix-filter",
5765 CLEAR_STR
5766 BGP_STR
5767 "Address family\n"
5768 "Clear all peers\n"
5769 "Soft reconfig inbound update\n"
5770 "Push out prefix-list ORF and do inbound soft reconfig\n")
5771
5772DEFUN (clear_ip_bgp_peer_soft_in,
5773 clear_ip_bgp_peer_soft_in_cmd,
5774 "clear ip bgp A.B.C.D soft in",
5775 CLEAR_STR
5776 IP_STR
5777 BGP_STR
5778 "BGP neighbor address to clear\n"
5779 "Soft reconfig\n"
5780 "Soft reconfig inbound update\n")
5781{
5782 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5783 BGP_CLEAR_SOFT_IN, argv[0]);
5784}
5785
5786ALIAS (clear_ip_bgp_peer_soft_in,
5787 clear_ip_bgp_peer_in_cmd,
5788 "clear ip bgp A.B.C.D in",
5789 CLEAR_STR
5790 IP_STR
5791 BGP_STR
5792 "BGP neighbor address to clear\n"
5793 "Soft reconfig inbound update\n")
5794
5795DEFUN (clear_ip_bgp_peer_in_prefix_filter,
5796 clear_ip_bgp_peer_in_prefix_filter_cmd,
5797 "clear ip bgp A.B.C.D in prefix-filter",
5798 CLEAR_STR
5799 IP_STR
5800 BGP_STR
5801 "BGP neighbor address to clear\n"
5802 "Soft reconfig inbound update\n"
5803 "Push out the existing ORF prefix-list\n")
5804{
5805 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5806 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5807}
5808
5809DEFUN (clear_ip_bgp_peer_ipv4_soft_in,
5810 clear_ip_bgp_peer_ipv4_soft_in_cmd,
5811 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft in",
5812 CLEAR_STR
5813 IP_STR
5814 BGP_STR
5815 "BGP neighbor address to clear\n"
5816 "Address family\n"
5817 "Address Family modifier\n"
5818 "Address Family modifier\n"
5819 "Soft reconfig\n"
5820 "Soft reconfig inbound update\n")
5821{
5822 if (strncmp (argv[1], "m", 1) == 0)
5823 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
5824 BGP_CLEAR_SOFT_IN, argv[0]);
5825
5826 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5827 BGP_CLEAR_SOFT_IN, argv[0]);
5828}
5829
5830ALIAS (clear_ip_bgp_peer_ipv4_soft_in,
5831 clear_ip_bgp_peer_ipv4_in_cmd,
5832 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in",
5833 CLEAR_STR
5834 IP_STR
5835 BGP_STR
5836 "BGP neighbor address to clear\n"
5837 "Address family\n"
5838 "Address Family modifier\n"
5839 "Address Family modifier\n"
5840 "Soft reconfig inbound update\n")
5841
5842DEFUN (clear_ip_bgp_peer_ipv4_in_prefix_filter,
5843 clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd,
5844 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in prefix-filter",
5845 CLEAR_STR
5846 IP_STR
5847 BGP_STR
5848 "BGP neighbor address to clear\n"
5849 "Address family\n"
5850 "Address Family modifier\n"
5851 "Address Family modifier\n"
5852 "Soft reconfig inbound update\n"
5853 "Push out the existing ORF prefix-list\n")
5854{
5855 if (strncmp (argv[1], "m", 1) == 0)
5856 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
5857 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5858
5859 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5860 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5861}
5862
5863DEFUN (clear_ip_bgp_peer_vpnv4_soft_in,
5864 clear_ip_bgp_peer_vpnv4_soft_in_cmd,
5865 "clear ip bgp A.B.C.D vpnv4 unicast soft in",
5866 CLEAR_STR
5867 IP_STR
5868 BGP_STR
5869 "BGP neighbor address to clear\n"
5870 "Address family\n"
5871 "Address Family Modifier\n"
5872 "Soft reconfig\n"
5873 "Soft reconfig inbound update\n")
5874{
5875 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
5876 BGP_CLEAR_SOFT_IN, argv[0]);
5877}
5878
5879ALIAS (clear_ip_bgp_peer_vpnv4_soft_in,
5880 clear_ip_bgp_peer_vpnv4_in_cmd,
5881 "clear ip bgp A.B.C.D vpnv4 unicast in",
5882 CLEAR_STR
5883 IP_STR
5884 BGP_STR
5885 "BGP neighbor address to clear\n"
5886 "Address family\n"
5887 "Address Family Modifier\n"
5888 "Soft reconfig inbound update\n")
5889
Lou Berger298cc2f2016-01-12 13:42:02 -05005890DEFUN (clear_ip_bgp_peer_encap_soft_in,
5891 clear_ip_bgp_peer_encap_soft_in_cmd,
5892 "clear ip bgp A.B.C.D encap unicast soft in",
5893 CLEAR_STR
5894 IP_STR
5895 BGP_STR
5896 "BGP neighbor address to clear\n"
5897 "Address family\n"
5898 "Address Family Modifier\n"
5899 "Soft reconfig\n"
5900 "Soft reconfig inbound update\n")
5901{
5902 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_peer,
5903 BGP_CLEAR_SOFT_IN, argv[0]);
5904}
5905
5906ALIAS (clear_ip_bgp_peer_encap_soft_in,
5907 clear_ip_bgp_peer_encap_in_cmd,
5908 "clear ip bgp A.B.C.D encap unicast in",
5909 CLEAR_STR
5910 IP_STR
5911 BGP_STR
5912 "BGP neighbor address to clear\n"
5913 "Address family\n"
5914 "Address Family Modifier\n"
5915 "Soft reconfig inbound update\n")
5916
paul718e3742002-12-13 20:15:29 +00005917DEFUN (clear_bgp_peer_soft_in,
5918 clear_bgp_peer_soft_in_cmd,
5919 "clear bgp (A.B.C.D|X:X::X:X) soft in",
5920 CLEAR_STR
5921 BGP_STR
5922 "BGP neighbor address to clear\n"
5923 "BGP IPv6 neighbor to clear\n"
5924 "Soft reconfig\n"
5925 "Soft reconfig inbound update\n")
5926{
5927 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
5928 BGP_CLEAR_SOFT_IN, argv[0]);
5929}
5930
5931ALIAS (clear_bgp_peer_soft_in,
5932 clear_bgp_ipv6_peer_soft_in_cmd,
5933 "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft in",
5934 CLEAR_STR
5935 BGP_STR
5936 "Address family\n"
5937 "BGP neighbor address to clear\n"
5938 "BGP IPv6 neighbor to clear\n"
5939 "Soft reconfig\n"
5940 "Soft reconfig inbound update\n")
5941
5942ALIAS (clear_bgp_peer_soft_in,
5943 clear_bgp_peer_in_cmd,
5944 "clear bgp (A.B.C.D|X:X::X:X) in",
5945 CLEAR_STR
5946 BGP_STR
5947 "BGP neighbor address to clear\n"
5948 "BGP IPv6 neighbor to clear\n"
5949 "Soft reconfig inbound update\n")
5950
5951ALIAS (clear_bgp_peer_soft_in,
5952 clear_bgp_ipv6_peer_in_cmd,
5953 "clear bgp ipv6 (A.B.C.D|X:X::X:X) in",
5954 CLEAR_STR
5955 BGP_STR
5956 "Address family\n"
5957 "BGP neighbor address to clear\n"
5958 "BGP IPv6 neighbor to clear\n"
5959 "Soft reconfig inbound update\n")
5960
5961DEFUN (clear_bgp_peer_in_prefix_filter,
5962 clear_bgp_peer_in_prefix_filter_cmd,
5963 "clear bgp (A.B.C.D|X:X::X:X) in prefix-filter",
5964 CLEAR_STR
5965 BGP_STR
5966 "BGP neighbor address to clear\n"
5967 "BGP IPv6 neighbor to clear\n"
5968 "Soft reconfig inbound update\n"
5969 "Push out the existing ORF prefix-list\n")
5970{
5971 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
5972 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5973}
5974
5975ALIAS (clear_bgp_peer_in_prefix_filter,
5976 clear_bgp_ipv6_peer_in_prefix_filter_cmd,
5977 "clear bgp ipv6 (A.B.C.D|X:X::X:X) in prefix-filter",
5978 CLEAR_STR
5979 BGP_STR
5980 "Address family\n"
5981 "BGP neighbor address to clear\n"
5982 "BGP IPv6 neighbor to clear\n"
5983 "Soft reconfig inbound update\n"
5984 "Push out the existing ORF prefix-list\n")
5985
5986DEFUN (clear_ip_bgp_peer_group_soft_in,
5987 clear_ip_bgp_peer_group_soft_in_cmd,
5988 "clear ip bgp peer-group WORD soft in",
5989 CLEAR_STR
5990 IP_STR
5991 BGP_STR
5992 "Clear all members of peer-group\n"
5993 "BGP peer-group name\n"
5994 "Soft reconfig\n"
5995 "Soft reconfig inbound update\n")
5996{
5997 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5998 BGP_CLEAR_SOFT_IN, argv[0]);
5999}
6000
6001ALIAS (clear_ip_bgp_peer_group_soft_in,
6002 clear_ip_bgp_peer_group_in_cmd,
6003 "clear ip bgp peer-group WORD in",
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
6011DEFUN (clear_ip_bgp_peer_group_in_prefix_filter,
6012 clear_ip_bgp_peer_group_in_prefix_filter_cmd,
6013 "clear ip bgp peer-group WORD in prefix-filter",
6014 CLEAR_STR
6015 IP_STR
6016 BGP_STR
6017 "Clear all members of peer-group\n"
6018 "BGP peer-group name\n"
6019 "Soft reconfig inbound update\n"
6020 "Push out prefix-list ORF and do inbound soft reconfig\n")
6021{
6022 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6023 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6024}
6025
6026DEFUN (clear_ip_bgp_peer_group_ipv4_soft_in,
6027 clear_ip_bgp_peer_group_ipv4_soft_in_cmd,
6028 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft in",
6029 CLEAR_STR
6030 IP_STR
6031 BGP_STR
6032 "Clear all members of peer-group\n"
6033 "BGP peer-group name\n"
6034 "Address family\n"
6035 "Address Family modifier\n"
6036 "Address Family modifier\n"
6037 "Soft reconfig\n"
6038 "Soft reconfig inbound update\n")
6039{
6040 if (strncmp (argv[1], "m", 1) == 0)
6041 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
6042 BGP_CLEAR_SOFT_IN, argv[0]);
6043
6044 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6045 BGP_CLEAR_SOFT_IN, argv[0]);
6046}
6047
6048ALIAS (clear_ip_bgp_peer_group_ipv4_soft_in,
6049 clear_ip_bgp_peer_group_ipv4_in_cmd,
6050 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in",
6051 CLEAR_STR
6052 IP_STR
6053 BGP_STR
6054 "Clear all members of peer-group\n"
6055 "BGP peer-group name\n"
6056 "Address family\n"
6057 "Address Family modifier\n"
6058 "Address Family modifier\n"
6059 "Soft reconfig inbound update\n")
6060
6061DEFUN (clear_ip_bgp_peer_group_ipv4_in_prefix_filter,
6062 clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd,
6063 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in prefix-filter",
6064 CLEAR_STR
6065 IP_STR
6066 BGP_STR
6067 "Clear all members of peer-group\n"
6068 "BGP peer-group name\n"
6069 "Address family\n"
6070 "Address Family modifier\n"
6071 "Address Family modifier\n"
6072 "Soft reconfig inbound update\n"
6073 "Push out prefix-list ORF and do inbound soft reconfig\n")
6074{
6075 if (strncmp (argv[1], "m", 1) == 0)
6076 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
6077 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6078
6079 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6080 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6081}
6082
6083DEFUN (clear_bgp_peer_group_soft_in,
6084 clear_bgp_peer_group_soft_in_cmd,
6085 "clear bgp peer-group WORD soft in",
6086 CLEAR_STR
6087 BGP_STR
6088 "Clear all members of peer-group\n"
6089 "BGP peer-group name\n"
6090 "Soft reconfig\n"
6091 "Soft reconfig inbound update\n")
6092{
6093 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
6094 BGP_CLEAR_SOFT_IN, argv[0]);
6095}
6096
6097ALIAS (clear_bgp_peer_group_soft_in,
6098 clear_bgp_ipv6_peer_group_soft_in_cmd,
6099 "clear bgp ipv6 peer-group WORD soft in",
6100 CLEAR_STR
6101 BGP_STR
6102 "Address family\n"
6103 "Clear all members of peer-group\n"
6104 "BGP peer-group name\n"
6105 "Soft reconfig\n"
6106 "Soft reconfig inbound update\n")
6107
6108ALIAS (clear_bgp_peer_group_soft_in,
6109 clear_bgp_peer_group_in_cmd,
6110 "clear bgp peer-group WORD in",
6111 CLEAR_STR
6112 BGP_STR
6113 "Clear all members of peer-group\n"
6114 "BGP peer-group name\n"
6115 "Soft reconfig inbound update\n")
6116
6117ALIAS (clear_bgp_peer_group_soft_in,
6118 clear_bgp_ipv6_peer_group_in_cmd,
6119 "clear bgp ipv6 peer-group WORD in",
6120 CLEAR_STR
6121 BGP_STR
6122 "Address family\n"
6123 "Clear all members of peer-group\n"
6124 "BGP peer-group name\n"
6125 "Soft reconfig inbound update\n")
6126
6127DEFUN (clear_bgp_peer_group_in_prefix_filter,
6128 clear_bgp_peer_group_in_prefix_filter_cmd,
6129 "clear bgp peer-group WORD in prefix-filter",
6130 CLEAR_STR
6131 BGP_STR
6132 "Clear all members of peer-group\n"
6133 "BGP peer-group name\n"
6134 "Soft reconfig inbound update\n"
6135 "Push out prefix-list ORF and do inbound soft reconfig\n")
6136{
6137 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
6138 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6139}
6140
6141ALIAS (clear_bgp_peer_group_in_prefix_filter,
6142 clear_bgp_ipv6_peer_group_in_prefix_filter_cmd,
6143 "clear bgp ipv6 peer-group WORD in prefix-filter",
6144 CLEAR_STR
6145 BGP_STR
6146 "Address family\n"
6147 "Clear all members of peer-group\n"
6148 "BGP peer-group name\n"
6149 "Soft reconfig inbound update\n"
6150 "Push out prefix-list ORF and do inbound soft reconfig\n")
6151
6152DEFUN (clear_ip_bgp_external_soft_in,
6153 clear_ip_bgp_external_soft_in_cmd,
6154 "clear ip bgp external soft in",
6155 CLEAR_STR
6156 IP_STR
6157 BGP_STR
6158 "Clear all external peers\n"
6159 "Soft reconfig\n"
6160 "Soft reconfig inbound update\n")
6161{
6162 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6163 BGP_CLEAR_SOFT_IN, NULL);
6164}
6165
6166ALIAS (clear_ip_bgp_external_soft_in,
6167 clear_ip_bgp_external_in_cmd,
6168 "clear ip bgp external in",
6169 CLEAR_STR
6170 IP_STR
6171 BGP_STR
6172 "Clear all external peers\n"
6173 "Soft reconfig inbound update\n")
6174
6175DEFUN (clear_ip_bgp_external_in_prefix_filter,
6176 clear_ip_bgp_external_in_prefix_filter_cmd,
6177 "clear ip bgp external in prefix-filter",
6178 CLEAR_STR
6179 IP_STR
6180 BGP_STR
6181 "Clear all external peers\n"
6182 "Soft reconfig inbound update\n"
6183 "Push out prefix-list ORF and do inbound soft reconfig\n")
6184{
6185 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6186 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
6187}
6188
6189DEFUN (clear_ip_bgp_external_ipv4_soft_in,
6190 clear_ip_bgp_external_ipv4_soft_in_cmd,
6191 "clear ip bgp external ipv4 (unicast|multicast) soft in",
6192 CLEAR_STR
6193 IP_STR
6194 BGP_STR
6195 "Clear all external peers\n"
6196 "Address family\n"
6197 "Address Family modifier\n"
6198 "Address Family modifier\n"
6199 "Soft reconfig\n"
6200 "Soft reconfig inbound update\n")
6201{
6202 if (strncmp (argv[0], "m", 1) == 0)
6203 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
6204 BGP_CLEAR_SOFT_IN, NULL);
6205
6206 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6207 BGP_CLEAR_SOFT_IN, NULL);
6208}
6209
6210ALIAS (clear_ip_bgp_external_ipv4_soft_in,
6211 clear_ip_bgp_external_ipv4_in_cmd,
6212 "clear ip bgp external ipv4 (unicast|multicast) in",
6213 CLEAR_STR
6214 IP_STR
6215 BGP_STR
6216 "Clear all external peers\n"
6217 "Address family\n"
6218 "Address Family modifier\n"
6219 "Address Family modifier\n"
6220 "Soft reconfig inbound update\n")
6221
6222DEFUN (clear_ip_bgp_external_ipv4_in_prefix_filter,
6223 clear_ip_bgp_external_ipv4_in_prefix_filter_cmd,
6224 "clear ip bgp external ipv4 (unicast|multicast) in prefix-filter",
6225 CLEAR_STR
6226 IP_STR
6227 BGP_STR
6228 "Clear all external peers\n"
6229 "Address family\n"
6230 "Address Family modifier\n"
6231 "Address Family modifier\n"
6232 "Soft reconfig inbound update\n"
6233 "Push out prefix-list ORF and do inbound soft reconfig\n")
6234{
6235 if (strncmp (argv[0], "m", 1) == 0)
6236 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
6237 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
6238
6239 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6240 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
6241}
6242
6243DEFUN (clear_bgp_external_soft_in,
6244 clear_bgp_external_soft_in_cmd,
6245 "clear bgp external soft in",
6246 CLEAR_STR
6247 BGP_STR
6248 "Clear all external peers\n"
6249 "Soft reconfig\n"
6250 "Soft reconfig inbound update\n")
6251{
6252 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
6253 BGP_CLEAR_SOFT_IN, NULL);
6254}
6255
6256ALIAS (clear_bgp_external_soft_in,
6257 clear_bgp_ipv6_external_soft_in_cmd,
6258 "clear bgp ipv6 external soft in",
6259 CLEAR_STR
6260 BGP_STR
6261 "Address family\n"
6262 "Clear all external peers\n"
6263 "Soft reconfig\n"
6264 "Soft reconfig inbound update\n")
6265
6266ALIAS (clear_bgp_external_soft_in,
6267 clear_bgp_external_in_cmd,
6268 "clear bgp external in",
6269 CLEAR_STR
6270 BGP_STR
6271 "Clear all external peers\n"
6272 "Soft reconfig inbound update\n")
6273
6274ALIAS (clear_bgp_external_soft_in,
6275 clear_bgp_ipv6_external_in_cmd,
6276 "clear bgp ipv6 external WORD in",
6277 CLEAR_STR
6278 BGP_STR
6279 "Address family\n"
6280 "Clear all external peers\n"
6281 "Soft reconfig inbound update\n")
6282
6283DEFUN (clear_bgp_external_in_prefix_filter,
6284 clear_bgp_external_in_prefix_filter_cmd,
6285 "clear bgp external in prefix-filter",
6286 CLEAR_STR
6287 BGP_STR
6288 "Clear all external peers\n"
6289 "Soft reconfig inbound update\n"
6290 "Push out prefix-list ORF and do inbound soft reconfig\n")
6291{
6292 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
6293 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
6294}
6295
6296ALIAS (clear_bgp_external_in_prefix_filter,
6297 clear_bgp_ipv6_external_in_prefix_filter_cmd,
6298 "clear bgp ipv6 external in prefix-filter",
6299 CLEAR_STR
6300 BGP_STR
6301 "Address family\n"
6302 "Clear all external peers\n"
6303 "Soft reconfig inbound update\n"
6304 "Push out prefix-list ORF and do inbound soft reconfig\n")
6305
6306DEFUN (clear_ip_bgp_as_soft_in,
6307 clear_ip_bgp_as_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006308 "clear ip bgp " CMD_AS_RANGE " soft in",
paul718e3742002-12-13 20:15:29 +00006309 CLEAR_STR
6310 IP_STR
6311 BGP_STR
6312 "Clear peers with the AS number\n"
6313 "Soft reconfig\n"
6314 "Soft reconfig inbound update\n")
6315{
6316 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6317 BGP_CLEAR_SOFT_IN, argv[0]);
6318}
6319
6320ALIAS (clear_ip_bgp_as_soft_in,
6321 clear_ip_bgp_as_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006322 "clear ip bgp " CMD_AS_RANGE " in",
paul718e3742002-12-13 20:15:29 +00006323 CLEAR_STR
6324 IP_STR
6325 BGP_STR
6326 "Clear peers with the AS number\n"
6327 "Soft reconfig inbound update\n")
6328
6329DEFUN (clear_ip_bgp_as_in_prefix_filter,
6330 clear_ip_bgp_as_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006331 "clear ip bgp " CMD_AS_RANGE " in prefix-filter",
paul718e3742002-12-13 20:15:29 +00006332 CLEAR_STR
6333 IP_STR
6334 BGP_STR
6335 "Clear peers with the AS number\n"
6336 "Soft reconfig inbound update\n"
6337 "Push out prefix-list ORF and do inbound soft reconfig\n")
6338{
6339 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6340 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6341}
6342
6343DEFUN (clear_ip_bgp_as_ipv4_soft_in,
6344 clear_ip_bgp_as_ipv4_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006345 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft in",
paul718e3742002-12-13 20:15:29 +00006346 CLEAR_STR
6347 IP_STR
6348 BGP_STR
6349 "Clear peers with the AS number\n"
6350 "Address family\n"
6351 "Address Family modifier\n"
6352 "Address Family modifier\n"
6353 "Soft reconfig\n"
6354 "Soft reconfig inbound update\n")
6355{
6356 if (strncmp (argv[1], "m", 1) == 0)
6357 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
6358 BGP_CLEAR_SOFT_IN, argv[0]);
6359
6360 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6361 BGP_CLEAR_SOFT_IN, argv[0]);
6362}
6363
6364ALIAS (clear_ip_bgp_as_ipv4_soft_in,
6365 clear_ip_bgp_as_ipv4_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006366 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in",
paul718e3742002-12-13 20:15:29 +00006367 CLEAR_STR
6368 IP_STR
6369 BGP_STR
6370 "Clear peers with the AS number\n"
6371 "Address family\n"
6372 "Address Family modifier\n"
6373 "Address Family modifier\n"
6374 "Soft reconfig inbound update\n")
6375
6376DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter,
6377 clear_ip_bgp_as_ipv4_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006378 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in prefix-filter",
paul718e3742002-12-13 20:15:29 +00006379 CLEAR_STR
6380 IP_STR
6381 BGP_STR
6382 "Clear peers with the AS number\n"
6383 "Address family\n"
6384 "Address Family modifier\n"
6385 "Address Family modifier\n"
6386 "Soft reconfig inbound update\n"
6387 "Push out prefix-list ORF and do inbound soft reconfig\n")
6388{
6389 if (strncmp (argv[1], "m", 1) == 0)
6390 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
6391 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6392
6393 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6394 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6395}
6396
6397DEFUN (clear_ip_bgp_as_vpnv4_soft_in,
6398 clear_ip_bgp_as_vpnv4_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006399 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft in",
paul718e3742002-12-13 20:15:29 +00006400 CLEAR_STR
6401 IP_STR
6402 BGP_STR
6403 "Clear peers with the AS number\n"
6404 "Address family\n"
6405 "Address Family modifier\n"
6406 "Soft reconfig\n"
6407 "Soft reconfig inbound update\n")
6408{
6409 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
6410 BGP_CLEAR_SOFT_IN, argv[0]);
6411}
6412
6413ALIAS (clear_ip_bgp_as_vpnv4_soft_in,
6414 clear_ip_bgp_as_vpnv4_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006415 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast in",
paul718e3742002-12-13 20:15:29 +00006416 CLEAR_STR
6417 IP_STR
6418 BGP_STR
6419 "Clear peers with the AS number\n"
6420 "Address family\n"
6421 "Address Family modifier\n"
6422 "Soft reconfig inbound update\n")
6423
Lou Berger298cc2f2016-01-12 13:42:02 -05006424DEFUN (clear_ip_bgp_as_encap_soft_in,
6425 clear_ip_bgp_as_encap_soft_in_cmd,
6426 "clear ip bgp " CMD_AS_RANGE " encap unicast soft in",
6427 CLEAR_STR
6428 IP_STR
6429 BGP_STR
6430 "Clear peers with the AS number\n"
6431 "Address family\n"
6432 "Address Family modifier\n"
6433 "Soft reconfig\n"
6434 "Soft reconfig inbound update\n")
6435{
6436 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_as,
6437 BGP_CLEAR_SOFT_IN, argv[0]);
6438}
6439
6440ALIAS (clear_ip_bgp_as_encap_soft_in,
6441 clear_ip_bgp_as_encap_in_cmd,
6442 "clear ip bgp " CMD_AS_RANGE " encap unicast in",
6443 CLEAR_STR
6444 IP_STR
6445 BGP_STR
6446 "Clear peers with the AS number\n"
6447 "Address family\n"
6448 "Address Family modifier\n"
6449 "Soft reconfig inbound update\n")
6450
paul718e3742002-12-13 20:15:29 +00006451DEFUN (clear_bgp_as_soft_in,
6452 clear_bgp_as_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006453 "clear bgp " CMD_AS_RANGE " soft in",
paul718e3742002-12-13 20:15:29 +00006454 CLEAR_STR
6455 BGP_STR
6456 "Clear peers with the AS number\n"
6457 "Soft reconfig\n"
6458 "Soft reconfig inbound update\n")
6459{
6460 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
6461 BGP_CLEAR_SOFT_IN, argv[0]);
6462}
6463
6464ALIAS (clear_bgp_as_soft_in,
6465 clear_bgp_ipv6_as_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006466 "clear bgp ipv6 " CMD_AS_RANGE " soft in",
paul718e3742002-12-13 20:15:29 +00006467 CLEAR_STR
6468 BGP_STR
6469 "Address family\n"
6470 "Clear peers with the AS number\n"
6471 "Soft reconfig\n"
6472 "Soft reconfig inbound update\n")
6473
6474ALIAS (clear_bgp_as_soft_in,
6475 clear_bgp_as_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006476 "clear bgp " CMD_AS_RANGE " in",
paul718e3742002-12-13 20:15:29 +00006477 CLEAR_STR
6478 BGP_STR
6479 "Clear peers with the AS number\n"
6480 "Soft reconfig inbound update\n")
6481
6482ALIAS (clear_bgp_as_soft_in,
6483 clear_bgp_ipv6_as_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006484 "clear bgp ipv6 " CMD_AS_RANGE " in",
paul718e3742002-12-13 20:15:29 +00006485 CLEAR_STR
6486 BGP_STR
6487 "Address family\n"
6488 "Clear peers with the AS number\n"
6489 "Soft reconfig inbound update\n")
6490
6491DEFUN (clear_bgp_as_in_prefix_filter,
6492 clear_bgp_as_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006493 "clear bgp " CMD_AS_RANGE " in prefix-filter",
paul718e3742002-12-13 20:15:29 +00006494 CLEAR_STR
6495 BGP_STR
6496 "Clear peers with the AS number\n"
6497 "Soft reconfig inbound update\n"
6498 "Push out prefix-list ORF and do inbound soft reconfig\n")
6499{
6500 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
6501 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6502}
6503
6504ALIAS (clear_bgp_as_in_prefix_filter,
6505 clear_bgp_ipv6_as_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006506 "clear bgp ipv6 " CMD_AS_RANGE " in prefix-filter",
paul718e3742002-12-13 20:15:29 +00006507 CLEAR_STR
6508 BGP_STR
6509 "Address family\n"
6510 "Clear peers with the AS number\n"
6511 "Soft reconfig inbound update\n"
6512 "Push out prefix-list ORF and do inbound soft reconfig\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02006513
paul718e3742002-12-13 20:15:29 +00006514/* Both soft-reconfiguration */
6515DEFUN (clear_ip_bgp_all_soft,
6516 clear_ip_bgp_all_soft_cmd,
6517 "clear ip bgp * soft",
6518 CLEAR_STR
6519 IP_STR
6520 BGP_STR
6521 "Clear all peers\n"
6522 "Soft reconfig\n")
6523{
6524 if (argc == 1)
6525 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
6526 BGP_CLEAR_SOFT_BOTH, NULL);
6527
6528 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6529 BGP_CLEAR_SOFT_BOTH, NULL);
6530}
6531
6532ALIAS (clear_ip_bgp_all_soft,
6533 clear_ip_bgp_instance_all_soft_cmd,
6534 "clear ip bgp view WORD * soft",
6535 CLEAR_STR
6536 IP_STR
6537 BGP_STR
6538 "BGP view\n"
6539 "view name\n"
6540 "Clear all peers\n"
6541 "Soft reconfig\n")
6542
6543
6544DEFUN (clear_ip_bgp_all_ipv4_soft,
6545 clear_ip_bgp_all_ipv4_soft_cmd,
6546 "clear ip bgp * ipv4 (unicast|multicast) soft",
6547 CLEAR_STR
6548 IP_STR
6549 BGP_STR
6550 "Clear all peers\n"
6551 "Address family\n"
6552 "Address Family Modifier\n"
6553 "Address Family Modifier\n"
6554 "Soft reconfig\n")
6555{
6556 if (strncmp (argv[0], "m", 1) == 0)
6557 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
6558 BGP_CLEAR_SOFT_BOTH, NULL);
6559
6560 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6561 BGP_CLEAR_SOFT_BOTH, NULL);
6562}
6563
6564DEFUN (clear_ip_bgp_instance_all_ipv4_soft,
6565 clear_ip_bgp_instance_all_ipv4_soft_cmd,
6566 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft",
6567 CLEAR_STR
6568 IP_STR
6569 BGP_STR
6570 "BGP view\n"
6571 "view name\n"
6572 "Clear all peers\n"
6573 "Address family\n"
6574 "Address Family Modifier\n"
6575 "Address Family Modifier\n"
6576 "Soft reconfig\n")
6577{
6578 if (strncmp (argv[1], "m", 1) == 0)
6579 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
6580 BGP_CLEAR_SOFT_BOTH, NULL);
6581
6582 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6583 BGP_CLEAR_SOFT_BOTH, NULL);
6584}
6585
6586DEFUN (clear_ip_bgp_all_vpnv4_soft,
6587 clear_ip_bgp_all_vpnv4_soft_cmd,
6588 "clear ip bgp * vpnv4 unicast soft",
6589 CLEAR_STR
6590 IP_STR
6591 BGP_STR
6592 "Clear all peers\n"
6593 "Address family\n"
6594 "Address Family Modifier\n"
6595 "Soft reconfig\n")
6596{
6597 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
6598 BGP_CLEAR_SOFT_BOTH, argv[0]);
6599}
6600
Lou Berger298cc2f2016-01-12 13:42:02 -05006601DEFUN (clear_ip_bgp_all_encap_soft,
6602 clear_ip_bgp_all_encap_soft_cmd,
6603 "clear ip bgp * encap unicast soft",
6604 CLEAR_STR
6605 IP_STR
6606 BGP_STR
6607 "Clear all peers\n"
6608 "Address family\n"
6609 "Address Family Modifier\n"
6610 "Soft reconfig\n")
6611{
6612 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_all,
6613 BGP_CLEAR_SOFT_BOTH, argv[0]);
6614}
6615
paul718e3742002-12-13 20:15:29 +00006616DEFUN (clear_bgp_all_soft,
6617 clear_bgp_all_soft_cmd,
6618 "clear bgp * soft",
6619 CLEAR_STR
6620 BGP_STR
6621 "Clear all peers\n"
6622 "Soft reconfig\n")
6623{
6624 if (argc == 1)
6625 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
6626 BGP_CLEAR_SOFT_BOTH, argv[0]);
6627
6628 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
6629 BGP_CLEAR_SOFT_BOTH, argv[0]);
6630}
6631
6632ALIAS (clear_bgp_all_soft,
6633 clear_bgp_instance_all_soft_cmd,
6634 "clear bgp view WORD * soft",
6635 CLEAR_STR
6636 BGP_STR
6637 "BGP view\n"
6638 "view name\n"
6639 "Clear all peers\n"
6640 "Soft reconfig\n")
6641
6642ALIAS (clear_bgp_all_soft,
6643 clear_bgp_ipv6_all_soft_cmd,
6644 "clear bgp ipv6 * soft",
6645 CLEAR_STR
6646 BGP_STR
6647 "Address family\n"
6648 "Clear all peers\n"
6649 "Soft reconfig\n")
6650
6651DEFUN (clear_ip_bgp_peer_soft,
6652 clear_ip_bgp_peer_soft_cmd,
6653 "clear ip bgp A.B.C.D soft",
6654 CLEAR_STR
6655 IP_STR
6656 BGP_STR
6657 "BGP neighbor address to clear\n"
6658 "Soft reconfig\n")
6659{
6660 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6661 BGP_CLEAR_SOFT_BOTH, argv[0]);
6662}
6663
6664DEFUN (clear_ip_bgp_peer_ipv4_soft,
6665 clear_ip_bgp_peer_ipv4_soft_cmd,
6666 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft",
6667 CLEAR_STR
6668 IP_STR
6669 BGP_STR
6670 "BGP neighbor address to clear\n"
6671 "Address family\n"
6672 "Address Family Modifier\n"
6673 "Address Family Modifier\n"
6674 "Soft reconfig\n")
6675{
6676 if (strncmp (argv[1], "m", 1) == 0)
6677 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
6678 BGP_CLEAR_SOFT_BOTH, argv[0]);
6679
6680 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6681 BGP_CLEAR_SOFT_BOTH, argv[0]);
6682}
6683
6684DEFUN (clear_ip_bgp_peer_vpnv4_soft,
6685 clear_ip_bgp_peer_vpnv4_soft_cmd,
6686 "clear ip bgp A.B.C.D vpnv4 unicast soft",
6687 CLEAR_STR
6688 IP_STR
6689 BGP_STR
6690 "BGP neighbor address to clear\n"
6691 "Address family\n"
6692 "Address Family Modifier\n"
6693 "Soft reconfig\n")
6694{
6695 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
6696 BGP_CLEAR_SOFT_BOTH, argv[0]);
6697}
6698
Lou Berger298cc2f2016-01-12 13:42:02 -05006699DEFUN (clear_ip_bgp_peer_encap_soft,
6700 clear_ip_bgp_peer_encap_soft_cmd,
6701 "clear ip bgp A.B.C.D encap unicast soft",
6702 CLEAR_STR
6703 IP_STR
6704 BGP_STR
6705 "BGP neighbor address to clear\n"
6706 "Address family\n"
6707 "Address Family Modifier\n"
6708 "Soft reconfig\n")
6709{
6710 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_peer,
6711 BGP_CLEAR_SOFT_BOTH, argv[0]);
6712}
6713
paul718e3742002-12-13 20:15:29 +00006714DEFUN (clear_bgp_peer_soft,
6715 clear_bgp_peer_soft_cmd,
6716 "clear bgp (A.B.C.D|X:X::X:X) soft",
6717 CLEAR_STR
6718 BGP_STR
6719 "BGP neighbor address to clear\n"
6720 "BGP IPv6 neighbor to clear\n"
6721 "Soft reconfig\n")
6722{
6723 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
6724 BGP_CLEAR_SOFT_BOTH, argv[0]);
6725}
6726
6727ALIAS (clear_bgp_peer_soft,
6728 clear_bgp_ipv6_peer_soft_cmd,
6729 "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft",
6730 CLEAR_STR
6731 BGP_STR
6732 "Address family\n"
6733 "BGP neighbor address to clear\n"
6734 "BGP IPv6 neighbor to clear\n"
6735 "Soft reconfig\n")
6736
6737DEFUN (clear_ip_bgp_peer_group_soft,
6738 clear_ip_bgp_peer_group_soft_cmd,
6739 "clear ip bgp peer-group WORD soft",
6740 CLEAR_STR
6741 IP_STR
6742 BGP_STR
6743 "Clear all members of peer-group\n"
6744 "BGP peer-group name\n"
6745 "Soft reconfig\n")
6746{
6747 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6748 BGP_CLEAR_SOFT_BOTH, argv[0]);
6749}
6750
6751DEFUN (clear_ip_bgp_peer_group_ipv4_soft,
6752 clear_ip_bgp_peer_group_ipv4_soft_cmd,
6753 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft",
6754 CLEAR_STR
6755 IP_STR
6756 BGP_STR
6757 "Clear all members of peer-group\n"
6758 "BGP peer-group name\n"
6759 "Address family\n"
6760 "Address Family modifier\n"
6761 "Address Family modifier\n"
6762 "Soft reconfig\n")
6763{
6764 if (strncmp (argv[1], "m", 1) == 0)
6765 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
6766 BGP_CLEAR_SOFT_BOTH, argv[0]);
6767
6768 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6769 BGP_CLEAR_SOFT_BOTH, argv[0]);
6770}
6771
6772DEFUN (clear_bgp_peer_group_soft,
6773 clear_bgp_peer_group_soft_cmd,
6774 "clear bgp peer-group WORD soft",
6775 CLEAR_STR
6776 BGP_STR
6777 "Clear all members of peer-group\n"
6778 "BGP peer-group name\n"
6779 "Soft reconfig\n")
6780{
6781 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
6782 BGP_CLEAR_SOFT_BOTH, argv[0]);
6783}
6784
6785ALIAS (clear_bgp_peer_group_soft,
6786 clear_bgp_ipv6_peer_group_soft_cmd,
6787 "clear bgp ipv6 peer-group WORD soft",
6788 CLEAR_STR
6789 BGP_STR
6790 "Address family\n"
6791 "Clear all members of peer-group\n"
6792 "BGP peer-group name\n"
6793 "Soft reconfig\n")
6794
6795DEFUN (clear_ip_bgp_external_soft,
6796 clear_ip_bgp_external_soft_cmd,
6797 "clear ip bgp external soft",
6798 CLEAR_STR
6799 IP_STR
6800 BGP_STR
6801 "Clear all external peers\n"
6802 "Soft reconfig\n")
6803{
6804 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6805 BGP_CLEAR_SOFT_BOTH, NULL);
6806}
6807
6808DEFUN (clear_ip_bgp_external_ipv4_soft,
6809 clear_ip_bgp_external_ipv4_soft_cmd,
6810 "clear ip bgp external ipv4 (unicast|multicast) soft",
6811 CLEAR_STR
6812 IP_STR
6813 BGP_STR
6814 "Clear all external peers\n"
6815 "Address family\n"
6816 "Address Family modifier\n"
6817 "Address Family modifier\n"
6818 "Soft reconfig\n")
6819{
6820 if (strncmp (argv[0], "m", 1) == 0)
6821 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
6822 BGP_CLEAR_SOFT_BOTH, NULL);
6823
6824 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6825 BGP_CLEAR_SOFT_BOTH, NULL);
6826}
6827
6828DEFUN (clear_bgp_external_soft,
6829 clear_bgp_external_soft_cmd,
6830 "clear bgp external soft",
6831 CLEAR_STR
6832 BGP_STR
6833 "Clear all external peers\n"
6834 "Soft reconfig\n")
6835{
6836 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
6837 BGP_CLEAR_SOFT_BOTH, NULL);
6838}
6839
6840ALIAS (clear_bgp_external_soft,
6841 clear_bgp_ipv6_external_soft_cmd,
6842 "clear bgp ipv6 external soft",
6843 CLEAR_STR
6844 BGP_STR
6845 "Address family\n"
6846 "Clear all external peers\n"
6847 "Soft reconfig\n")
6848
6849DEFUN (clear_ip_bgp_as_soft,
6850 clear_ip_bgp_as_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006851 "clear ip bgp " CMD_AS_RANGE " soft",
paul718e3742002-12-13 20:15:29 +00006852 CLEAR_STR
6853 IP_STR
6854 BGP_STR
6855 "Clear peers with the AS number\n"
6856 "Soft reconfig\n")
6857{
6858 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6859 BGP_CLEAR_SOFT_BOTH, argv[0]);
6860}
6861
6862DEFUN (clear_ip_bgp_as_ipv4_soft,
6863 clear_ip_bgp_as_ipv4_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006864 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft",
paul718e3742002-12-13 20:15:29 +00006865 CLEAR_STR
6866 IP_STR
6867 BGP_STR
6868 "Clear peers with the AS number\n"
6869 "Address family\n"
6870 "Address Family Modifier\n"
6871 "Address Family Modifier\n"
6872 "Soft reconfig\n")
6873{
6874 if (strncmp (argv[1], "m", 1) == 0)
6875 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
6876 BGP_CLEAR_SOFT_BOTH, argv[0]);
6877
6878 return bgp_clear_vty (vty, NULL,AFI_IP, SAFI_UNICAST, clear_as,
6879 BGP_CLEAR_SOFT_BOTH, argv[0]);
6880}
6881
6882DEFUN (clear_ip_bgp_as_vpnv4_soft,
6883 clear_ip_bgp_as_vpnv4_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006884 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft",
paul718e3742002-12-13 20:15:29 +00006885 CLEAR_STR
6886 IP_STR
6887 BGP_STR
6888 "Clear peers with the AS number\n"
6889 "Address family\n"
6890 "Address Family Modifier\n"
6891 "Soft reconfig\n")
6892{
6893 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
6894 BGP_CLEAR_SOFT_BOTH, argv[0]);
6895}
6896
Lou Berger298cc2f2016-01-12 13:42:02 -05006897DEFUN (clear_ip_bgp_as_encap_soft,
6898 clear_ip_bgp_as_encap_soft_cmd,
6899 "clear ip bgp " CMD_AS_RANGE " encap unicast soft",
6900 CLEAR_STR
6901 IP_STR
6902 BGP_STR
6903 "Clear peers with the AS number\n"
6904 "Address family\n"
6905 "Address Family Modifier\n"
6906 "Soft reconfig\n")
6907{
6908 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_as,
6909 BGP_CLEAR_SOFT_BOTH, argv[0]);
6910}
6911
paul718e3742002-12-13 20:15:29 +00006912DEFUN (clear_bgp_as_soft,
6913 clear_bgp_as_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006914 "clear bgp " CMD_AS_RANGE " soft",
paul718e3742002-12-13 20:15:29 +00006915 CLEAR_STR
6916 BGP_STR
6917 "Clear peers with the AS number\n"
6918 "Soft reconfig\n")
6919{
6920 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
6921 BGP_CLEAR_SOFT_BOTH, argv[0]);
6922}
6923
6924ALIAS (clear_bgp_as_soft,
6925 clear_bgp_ipv6_as_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006926 "clear bgp ipv6 " CMD_AS_RANGE " soft",
paul718e3742002-12-13 20:15:29 +00006927 CLEAR_STR
6928 BGP_STR
6929 "Address family\n"
6930 "Clear peers with the AS number\n"
6931 "Soft reconfig\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02006932
paulfee0f4c2004-09-13 05:12:46 +00006933/* RS-client soft reconfiguration. */
paulfee0f4c2004-09-13 05:12:46 +00006934DEFUN (clear_bgp_all_rsclient,
6935 clear_bgp_all_rsclient_cmd,
6936 "clear bgp * rsclient",
6937 CLEAR_STR
6938 BGP_STR
6939 "Clear all peers\n"
6940 "Soft reconfig for rsclient RIB\n")
6941{
6942 if (argc == 1)
6943 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
6944 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6945
6946 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
6947 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6948}
6949
6950ALIAS (clear_bgp_all_rsclient,
6951 clear_bgp_ipv6_all_rsclient_cmd,
6952 "clear bgp ipv6 * rsclient",
6953 CLEAR_STR
6954 BGP_STR
6955 "Address family\n"
6956 "Clear all peers\n"
6957 "Soft reconfig for rsclient RIB\n")
6958
6959ALIAS (clear_bgp_all_rsclient,
6960 clear_bgp_instance_all_rsclient_cmd,
6961 "clear bgp view WORD * rsclient",
6962 CLEAR_STR
6963 BGP_STR
6964 "BGP view\n"
6965 "view name\n"
6966 "Clear all peers\n"
6967 "Soft reconfig for rsclient RIB\n")
6968
6969ALIAS (clear_bgp_all_rsclient,
6970 clear_bgp_ipv6_instance_all_rsclient_cmd,
6971 "clear bgp ipv6 view WORD * rsclient",
6972 CLEAR_STR
6973 BGP_STR
6974 "Address family\n"
6975 "BGP view\n"
6976 "view name\n"
6977 "Clear all peers\n"
6978 "Soft reconfig for rsclient RIB\n")
paulfee0f4c2004-09-13 05:12:46 +00006979
6980DEFUN (clear_ip_bgp_all_rsclient,
6981 clear_ip_bgp_all_rsclient_cmd,
6982 "clear ip bgp * rsclient",
6983 CLEAR_STR
6984 IP_STR
6985 BGP_STR
6986 "Clear all peers\n"
6987 "Soft reconfig for rsclient RIB\n")
6988{
6989 if (argc == 1)
6990 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
6991 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6992
6993 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6994 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6995}
6996
6997ALIAS (clear_ip_bgp_all_rsclient,
6998 clear_ip_bgp_instance_all_rsclient_cmd,
6999 "clear ip bgp view WORD * rsclient",
7000 CLEAR_STR
7001 IP_STR
7002 BGP_STR
7003 "BGP view\n"
7004 "view name\n"
7005 "Clear all peers\n"
7006 "Soft reconfig for rsclient RIB\n")
7007
paulfee0f4c2004-09-13 05:12:46 +00007008DEFUN (clear_bgp_peer_rsclient,
7009 clear_bgp_peer_rsclient_cmd,
7010 "clear bgp (A.B.C.D|X:X::X:X) rsclient",
7011 CLEAR_STR
7012 BGP_STR
7013 "BGP neighbor IP address to clear\n"
7014 "BGP IPv6 neighbor to clear\n"
7015 "Soft reconfig for rsclient RIB\n")
7016{
7017 if (argc == 2)
7018 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_peer,
7019 BGP_CLEAR_SOFT_RSCLIENT, argv[1]);
7020
7021 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
7022 BGP_CLEAR_SOFT_RSCLIENT, argv[0]);
7023}
7024
7025ALIAS (clear_bgp_peer_rsclient,
7026 clear_bgp_ipv6_peer_rsclient_cmd,
7027 "clear bgp ipv6 (A.B.C.D|X:X::X:X) rsclient",
7028 CLEAR_STR
7029 BGP_STR
7030 "Address family\n"
7031 "BGP neighbor IP address to clear\n"
7032 "BGP IPv6 neighbor to clear\n"
7033 "Soft reconfig for rsclient RIB\n")
7034
7035ALIAS (clear_bgp_peer_rsclient,
7036 clear_bgp_instance_peer_rsclient_cmd,
7037 "clear bgp view WORD (A.B.C.D|X:X::X:X) rsclient",
7038 CLEAR_STR
7039 BGP_STR
7040 "BGP view\n"
7041 "view name\n"
7042 "BGP neighbor IP address to clear\n"
7043 "BGP IPv6 neighbor to clear\n"
7044 "Soft reconfig for rsclient RIB\n")
7045
7046ALIAS (clear_bgp_peer_rsclient,
7047 clear_bgp_ipv6_instance_peer_rsclient_cmd,
7048 "clear bgp ipv6 view WORD (A.B.C.D|X:X::X:X) rsclient",
7049 CLEAR_STR
7050 BGP_STR
7051 "Address family\n"
7052 "BGP view\n"
7053 "view name\n"
7054 "BGP neighbor IP address to clear\n"
7055 "BGP IPv6 neighbor to clear\n"
7056 "Soft reconfig for rsclient RIB\n")
paulfee0f4c2004-09-13 05:12:46 +00007057
7058DEFUN (clear_ip_bgp_peer_rsclient,
7059 clear_ip_bgp_peer_rsclient_cmd,
7060 "clear ip bgp (A.B.C.D|X:X::X:X) rsclient",
7061 CLEAR_STR
7062 IP_STR
7063 BGP_STR
7064 "BGP neighbor IP address to clear\n"
7065 "BGP IPv6 neighbor to clear\n"
7066 "Soft reconfig for rsclient RIB\n")
7067{
7068 if (argc == 2)
7069 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_peer,
7070 BGP_CLEAR_SOFT_RSCLIENT, argv[1]);
7071
7072 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
7073 BGP_CLEAR_SOFT_RSCLIENT, argv[0]);
7074}
7075
7076ALIAS (clear_ip_bgp_peer_rsclient,
7077 clear_ip_bgp_instance_peer_rsclient_cmd,
7078 "clear ip bgp view WORD (A.B.C.D|X:X::X:X) rsclient",
7079 CLEAR_STR
7080 IP_STR
7081 BGP_STR
7082 "BGP view\n"
7083 "view name\n"
7084 "BGP neighbor IP address to clear\n"
7085 "BGP IPv6 neighbor to clear\n"
7086 "Soft reconfig for rsclient RIB\n")
7087
Michael Lamberte0081f72008-11-16 20:12:04 +00007088DEFUN (show_bgp_views,
7089 show_bgp_views_cmd,
7090 "show bgp views",
7091 SHOW_STR
7092 BGP_STR
7093 "Show the defined BGP views\n")
7094{
7095 struct list *inst = bm->bgp;
7096 struct listnode *node;
7097 struct bgp *bgp;
7098
7099 if (!bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE))
7100 {
7101 vty_out (vty, "Multiple BGP views are not defined%s", VTY_NEWLINE);
7102 return CMD_WARNING;
7103 }
7104
7105 vty_out (vty, "Defined BGP views:%s", VTY_NEWLINE);
7106 for (ALL_LIST_ELEMENTS_RO(inst, node, bgp))
7107 vty_out (vty, "\t%s (AS%u)%s",
7108 bgp->name ? bgp->name : "(null)",
7109 bgp->as, VTY_NEWLINE);
7110
7111 return CMD_SUCCESS;
7112}
7113
Paul Jakma4bf6a362006-03-30 14:05:23 +00007114DEFUN (show_bgp_memory,
7115 show_bgp_memory_cmd,
7116 "show bgp memory",
7117 SHOW_STR
7118 BGP_STR
7119 "Global BGP memory statistics\n")
7120{
7121 char memstrbuf[MTYPE_MEMSTR_LEN];
7122 unsigned long count;
7123
7124 /* RIB related usage stats */
7125 count = mtype_stats_alloc (MTYPE_BGP_NODE);
7126 vty_out (vty, "%ld RIB nodes, using %s of memory%s", count,
7127 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7128 count * sizeof (struct bgp_node)),
7129 VTY_NEWLINE);
7130
7131 count = mtype_stats_alloc (MTYPE_BGP_ROUTE);
7132 vty_out (vty, "%ld BGP routes, using %s of memory%s", count,
7133 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7134 count * sizeof (struct bgp_info)),
7135 VTY_NEWLINE);
Paul Jakmafb982c22007-05-04 20:15:47 +00007136 if ((count = mtype_stats_alloc (MTYPE_BGP_ROUTE_EXTRA)))
7137 vty_out (vty, "%ld BGP route ancillaries, using %s of memory%s", count,
7138 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7139 count * sizeof (struct bgp_info_extra)),
7140 VTY_NEWLINE);
Paul Jakma4bf6a362006-03-30 14:05:23 +00007141
7142 if ((count = mtype_stats_alloc (MTYPE_BGP_STATIC)))
7143 vty_out (vty, "%ld Static routes, using %s of memory%s", count,
7144 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7145 count * sizeof (struct bgp_static)),
7146 VTY_NEWLINE);
7147
7148 /* Adj-In/Out */
7149 if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_IN)))
7150 vty_out (vty, "%ld Adj-In entries, using %s of memory%s", count,
7151 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7152 count * sizeof (struct bgp_adj_in)),
7153 VTY_NEWLINE);
7154 if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_OUT)))
7155 vty_out (vty, "%ld Adj-Out entries, using %s of memory%s", count,
7156 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7157 count * sizeof (struct bgp_adj_out)),
7158 VTY_NEWLINE);
7159
7160 if ((count = mtype_stats_alloc (MTYPE_BGP_NEXTHOP_CACHE)))
7161 vty_out (vty, "%ld Nexthop cache entries, using %s of memory%s", count,
7162 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7163 count * sizeof (struct bgp_nexthop_cache)),
7164 VTY_NEWLINE);
7165
7166 if ((count = mtype_stats_alloc (MTYPE_BGP_DAMP_INFO)))
7167 vty_out (vty, "%ld Dampening entries, using %s of memory%s", count,
7168 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7169 count * sizeof (struct bgp_damp_info)),
7170 VTY_NEWLINE);
7171
7172 /* Attributes */
7173 count = attr_count();
7174 vty_out (vty, "%ld BGP attributes, using %s of memory%s", count,
7175 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7176 count * sizeof(struct attr)),
7177 VTY_NEWLINE);
Paul Jakmafb982c22007-05-04 20:15:47 +00007178 if ((count = mtype_stats_alloc (MTYPE_ATTR_EXTRA)))
7179 vty_out (vty, "%ld BGP extra attributes, using %s of memory%s", count,
7180 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7181 count * sizeof(struct attr_extra)),
7182 VTY_NEWLINE);
Paul Jakma4bf6a362006-03-30 14:05:23 +00007183
7184 if ((count = attr_unknown_count()))
7185 vty_out (vty, "%ld unknown attributes%s", count, VTY_NEWLINE);
7186
7187 /* AS_PATH attributes */
7188 count = aspath_count ();
7189 vty_out (vty, "%ld BGP AS-PATH entries, using %s of memory%s", count,
7190 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7191 count * sizeof (struct aspath)),
7192 VTY_NEWLINE);
7193
7194 count = mtype_stats_alloc (MTYPE_AS_SEG);
7195 vty_out (vty, "%ld BGP AS-PATH segments, using %s of memory%s", count,
7196 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7197 count * sizeof (struct assegment)),
7198 VTY_NEWLINE);
7199
7200 /* Other attributes */
7201 if ((count = community_count ()))
7202 vty_out (vty, "%ld BGP community entries, using %s of memory%s", count,
7203 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7204 count * sizeof (struct community)),
7205 VTY_NEWLINE);
7206 if ((count = mtype_stats_alloc (MTYPE_ECOMMUNITY)))
7207 vty_out (vty, "%ld BGP community entries, using %s of memory%s", count,
7208 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7209 count * sizeof (struct ecommunity)),
7210 VTY_NEWLINE);
7211
7212 if ((count = mtype_stats_alloc (MTYPE_CLUSTER)))
7213 vty_out (vty, "%ld Cluster lists, using %s of memory%s", count,
7214 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7215 count * sizeof (struct cluster_list)),
7216 VTY_NEWLINE);
7217
7218 /* Peer related usage */
7219 count = mtype_stats_alloc (MTYPE_BGP_PEER);
7220 vty_out (vty, "%ld peers, using %s of memory%s", count,
7221 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7222 count * sizeof (struct peer)),
7223 VTY_NEWLINE);
7224
7225 if ((count = mtype_stats_alloc (MTYPE_PEER_GROUP)))
7226 vty_out (vty, "%ld peer groups, using %s of memory%s", count,
7227 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7228 count * sizeof (struct peer_group)),
7229 VTY_NEWLINE);
7230
7231 /* Other */
7232 if ((count = mtype_stats_alloc (MTYPE_HASH)))
7233 vty_out (vty, "%ld hash tables, using %s of memory%s", count,
7234 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7235 count * sizeof (struct hash)),
7236 VTY_NEWLINE);
7237 if ((count = mtype_stats_alloc (MTYPE_HASH_BACKET)))
7238 vty_out (vty, "%ld hash buckets, using %s of memory%s", count,
7239 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7240 count * sizeof (struct hash_backet)),
7241 VTY_NEWLINE);
7242 if ((count = mtype_stats_alloc (MTYPE_BGP_REGEXP)))
7243 vty_out (vty, "%ld compiled regexes, using %s of memory%s", count,
7244 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7245 count * sizeof (regex_t)),
7246 VTY_NEWLINE);
7247 return CMD_SUCCESS;
7248}
paulfee0f4c2004-09-13 05:12:46 +00007249
paul718e3742002-12-13 20:15:29 +00007250/* Show BGP peer's summary information. */
paul94f2b392005-06-28 12:44:16 +00007251static int
paul718e3742002-12-13 20:15:29 +00007252bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi)
7253{
7254 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00007255 struct listnode *node, *nnode;
Paul Jakma4bf6a362006-03-30 14:05:23 +00007256 unsigned int count = 0;
paul718e3742002-12-13 20:15:29 +00007257 char timebuf[BGP_UPTIME_LEN];
7258 int len;
7259
7260 /* Header string for each address family. */
Milan Kociancb4fc592014-12-01 12:48:25 +00007261 static char header[] = "Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd";
Paul Jakma4bf6a362006-03-30 14:05:23 +00007262
paul1eb8ef22005-04-07 07:30:20 +00007263 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00007264 {
7265 if (peer->afc[afi][safi])
7266 {
Paul Jakma4bf6a362006-03-30 14:05:23 +00007267 if (!count)
7268 {
7269 unsigned long ents;
7270 char memstrbuf[MTYPE_MEMSTR_LEN];
7271
7272 /* Usage summary and header */
7273 vty_out (vty,
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04007274 "BGP router identifier %s, local AS number %u%s",
Paul Jakma4bf6a362006-03-30 14:05:23 +00007275 inet_ntoa (bgp->router_id), bgp->as, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007276
Paul Jakma4bf6a362006-03-30 14:05:23 +00007277 ents = bgp_table_count (bgp->rib[afi][safi]);
7278 vty_out (vty, "RIB entries %ld, using %s of memory%s", ents,
7279 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7280 ents * sizeof (struct bgp_node)),
7281 VTY_NEWLINE);
7282
7283 /* Peer related usage */
7284 ents = listcount (bgp->peer);
7285 vty_out (vty, "Peers %ld, using %s of memory%s",
7286 ents,
7287 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7288 ents * sizeof (struct peer)),
7289 VTY_NEWLINE);
7290
7291 if ((ents = listcount (bgp->rsclient)))
7292 vty_out (vty, "RS-Client peers %ld, using %s of memory%s",
7293 ents,
7294 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7295 ents * sizeof (struct peer)),
7296 VTY_NEWLINE);
7297
7298 if ((ents = listcount (bgp->group)))
7299 vty_out (vty, "Peer groups %ld, using %s of memory%s", ents,
7300 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7301 ents * sizeof (struct peer_group)),
7302 VTY_NEWLINE);
7303
7304 if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING))
7305 vty_out (vty, "Dampening enabled.%s", VTY_NEWLINE);
7306 vty_out (vty, "%s", VTY_NEWLINE);
7307 vty_out (vty, "%s%s", header, VTY_NEWLINE);
7308 }
7309
paul718e3742002-12-13 20:15:29 +00007310 count++;
7311
7312 len = vty_out (vty, "%s", peer->host);
7313 len = 16 - len;
7314 if (len < 1)
7315 vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " ");
7316 else
7317 vty_out (vty, "%*s", len, " ");
7318
hasso3d515fd2005-02-01 21:30:04 +00007319 vty_out (vty, "4 ");
paul718e3742002-12-13 20:15:29 +00007320
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04007321 vty_out (vty, "%5u %7d %7d %8d %4d %4lu ",
paul718e3742002-12-13 20:15:29 +00007322 peer->as,
7323 peer->open_in + peer->update_in + peer->keepalive_in
7324 + peer->notify_in + peer->refresh_in + peer->dynamic_cap_in,
7325 peer->open_out + peer->update_out + peer->keepalive_out
7326 + peer->notify_out + peer->refresh_out
7327 + peer->dynamic_cap_out,
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00007328 0, 0, (unsigned long) peer->obuf->count);
paul718e3742002-12-13 20:15:29 +00007329
7330 vty_out (vty, "%8s",
7331 peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN));
7332
7333 if (peer->status == Established)
7334 {
7335 vty_out (vty, " %8ld", peer->pcount[afi][safi]);
7336 }
7337 else
7338 {
7339 if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN))
7340 vty_out (vty, " Idle (Admin)");
7341 else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW))
7342 vty_out (vty, " Idle (PfxCt)");
7343 else
7344 vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, peer->status));
7345 }
7346
7347 vty_out (vty, "%s", VTY_NEWLINE);
7348 }
7349 }
7350
7351 if (count)
7352 vty_out (vty, "%sTotal number of neighbors %d%s", VTY_NEWLINE,
7353 count, VTY_NEWLINE);
7354 else
7355 vty_out (vty, "No %s neighbor is configured%s",
7356 afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE);
7357 return CMD_SUCCESS;
7358}
7359
paul94f2b392005-06-28 12:44:16 +00007360static int
paulfd79ac92004-10-13 05:06:08 +00007361bgp_show_summary_vty (struct vty *vty, const char *name,
7362 afi_t afi, safi_t safi)
paul718e3742002-12-13 20:15:29 +00007363{
7364 struct bgp *bgp;
7365
7366 if (name)
7367 {
7368 bgp = bgp_lookup_by_name (name);
7369
7370 if (! bgp)
7371 {
7372 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
7373 return CMD_WARNING;
7374 }
7375
7376 bgp_show_summary (vty, bgp, afi, safi);
7377 return CMD_SUCCESS;
7378 }
7379
7380 bgp = bgp_get_default ();
7381
7382 if (bgp)
7383 bgp_show_summary (vty, bgp, afi, safi);
7384
7385 return CMD_SUCCESS;
7386}
7387
7388/* `show ip bgp summary' commands. */
Lou Bergerf9b6c392016-01-12 13:42:09 -05007389DEFUN (show_ip_bgp_summary,
7390 show_ip_bgp_summary_cmd,
7391 "show ip bgp summary",
7392 SHOW_STR
7393 IP_STR
7394 BGP_STR
7395 "Summary of BGP neighbor status\n")
7396{
7397 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
7398}
7399
7400DEFUN (show_ip_bgp_instance_summary,
7401 show_ip_bgp_instance_summary_cmd,
7402 "show ip bgp view WORD summary",
7403 SHOW_STR
7404 IP_STR
7405 BGP_STR
7406 "BGP view\n"
7407 "View name\n"
7408 "Summary of BGP neighbor status\n")
7409{
7410 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
7411}
7412
7413DEFUN (show_ip_bgp_ipv4_summary,
7414 show_ip_bgp_ipv4_summary_cmd,
7415 "show ip bgp ipv4 (unicast|multicast) summary",
7416 SHOW_STR
7417 IP_STR
7418 BGP_STR
7419 "Address family\n"
7420 "Address Family modifier\n"
7421 "Address Family modifier\n"
7422 "Summary of BGP neighbor status\n")
7423{
7424 if (strncmp (argv[0], "m", 1) == 0)
7425 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
7426
7427 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
7428}
7429
7430DEFUN (show_ip_bgp_instance_ipv4_summary,
7431 show_ip_bgp_instance_ipv4_summary_cmd,
7432 "show ip bgp view WORD ipv4 (unicast|multicast) summary",
7433 SHOW_STR
7434 IP_STR
7435 BGP_STR
7436 "BGP view\n"
7437 "View name\n"
7438 "Address family\n"
7439 "Address Family modifier\n"
7440 "Address Family modifier\n"
7441 "Summary of BGP neighbor status\n")
7442{
7443 if (strncmp (argv[1], "m", 1) == 0)
7444 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
7445 else
7446 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
7447}
7448
7449DEFUN (show_ip_bgp_vpnv4_all_summary,
7450 show_ip_bgp_vpnv4_all_summary_cmd,
7451 "show ip bgp vpnv4 all summary",
7452 SHOW_STR
7453 IP_STR
7454 BGP_STR
7455 "Display VPNv4 NLRI specific information\n"
7456 "Display information about all VPNv4 NLRIs\n"
7457 "Summary of BGP neighbor status\n")
7458{
7459 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
7460}
7461
7462DEFUN (show_ip_bgp_vpnv4_rd_summary,
7463 show_ip_bgp_vpnv4_rd_summary_cmd,
7464 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn summary",
7465 SHOW_STR
7466 IP_STR
7467 BGP_STR
7468 "Display VPNv4 NLRI specific information\n"
7469 "Display information for a route distinguisher\n"
7470 "VPN Route Distinguisher\n"
7471 "Summary of BGP neighbor status\n")
7472{
7473 int ret;
7474 struct prefix_rd prd;
7475
7476 ret = str2prefix_rd (argv[0], &prd);
7477 if (! ret)
7478 {
7479 vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
7480 return CMD_WARNING;
7481 }
7482
7483 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
7484}
7485
Lou Berger651b4022016-01-12 13:42:07 -05007486DEFUN (show_bgp_ipv4_safi_summary,
7487 show_bgp_ipv4_safi_summary_cmd,
7488 "show bgp ipv4 (unicast|multicast) summary",
paul718e3742002-12-13 20:15:29 +00007489 SHOW_STR
paul718e3742002-12-13 20:15:29 +00007490 BGP_STR
7491 "Address family\n"
7492 "Address Family modifier\n"
7493 "Address Family modifier\n"
7494 "Summary of BGP neighbor status\n")
7495{
7496 if (strncmp (argv[0], "m", 1) == 0)
7497 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
7498
7499 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
7500}
7501
Lou Berger651b4022016-01-12 13:42:07 -05007502DEFUN (show_bgp_instance_ipv4_safi_summary,
7503 show_bgp_instance_ipv4_safi_summary_cmd,
7504 "show bgp view WORD ipv4 (unicast|multicast) summary",
Michael Lambert95cbbd22010-07-23 14:43:04 -04007505 SHOW_STR
7506 BGP_STR
paul718e3742002-12-13 20:15:29 +00007507 "BGP view\n"
7508 "View name\n"
7509 "Address family\n"
7510 "Address Family modifier\n"
7511 "Address Family modifier\n"
7512 "Summary of BGP neighbor status\n")
7513{
7514 if (strncmp (argv[1], "m", 1) == 0)
7515 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
7516 else
7517 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
7518}
7519
Lou Berger651b4022016-01-12 13:42:07 -05007520DEFUN (show_bgp_ipv4_vpn_summary,
7521 show_bgp_ipv4_vpn_summary_cmd,
7522 "show bgp ipv4 vpn summary",
Michael Lambert95cbbd22010-07-23 14:43:04 -04007523 SHOW_STR
7524 BGP_STR
Lou Berger651b4022016-01-12 13:42:07 -05007525 "IPv4\n"
7526 "Display VPN NLRI specific information\n"
paul718e3742002-12-13 20:15:29 +00007527 "Summary of BGP neighbor status\n")
7528{
7529 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
7530}
7531
Lou Berger651b4022016-01-12 13:42:07 -05007532/* `show ip bgp summary' commands. */
7533DEFUN (show_bgp_ipv6_vpn_summary,
7534 show_bgp_ipv6_vpn_summary_cmd,
7535 "show bgp ipv6 vpn summary",
paul718e3742002-12-13 20:15:29 +00007536 SHOW_STR
7537 BGP_STR
Lou Berger651b4022016-01-12 13:42:07 -05007538 "IPv6\n"
7539 "Display VPN NLRI specific information\n"
paul718e3742002-12-13 20:15:29 +00007540 "Summary of BGP neighbor status\n")
7541{
Lou Berger651b4022016-01-12 13:42:07 -05007542 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MPLS_VPN);
paul718e3742002-12-13 20:15:29 +00007543}
Lou Berger651b4022016-01-12 13:42:07 -05007544
7545DEFUN (show_bgp_ipv4_encap_summary,
7546 show_bgp_ipv4_encap_summary_cmd,
7547 "show bgp ipv4 encap summary",
7548 SHOW_STR
7549 BGP_STR
7550 "IPv4\n"
7551 "Display ENCAP NLRI specific information\n"
7552 "Summary of BGP neighbor status\n")
7553{
7554 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_ENCAP);
7555}
7556
Lou Berger651b4022016-01-12 13:42:07 -05007557DEFUN (show_bgp_ipv6_encap_summary,
7558 show_bgp_ipv6_encap_summary_cmd,
7559 "show bgp ipv6 encap summary",
7560 SHOW_STR
7561 BGP_STR
7562 "IPv6\n"
7563 "Display ENCAP NLRI specific information\n"
7564 "Summary of BGP neighbor status\n")
7565{
7566 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_ENCAP);
7567}
7568
paul718e3742002-12-13 20:15:29 +00007569DEFUN (show_bgp_instance_summary,
7570 show_bgp_instance_summary_cmd,
7571 "show bgp view WORD summary",
7572 SHOW_STR
7573 BGP_STR
7574 "BGP view\n"
7575 "View name\n"
7576 "Summary of BGP neighbor status\n")
7577{
Lou Berger651b4022016-01-12 13:42:07 -05007578 vty_out(vty, "%sIPv4 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7579 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7580 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
7581 vty_out(vty, "%sIPv4 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7582 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7583 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
7584 vty_out(vty, "%sIPv4 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7585 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7586 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MPLS_VPN);
7587 vty_out(vty, "%sIPv4 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7588 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7589 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_ENCAP);
7590
Lou Berger651b4022016-01-12 13:42:07 -05007591 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7592 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7593 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
7594 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7595 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7596 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST);
7597 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7598 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7599 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MPLS_VPN);
7600 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7601 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7602 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_ENCAP);
Lou Berger205e6742016-01-12 13:42:11 -05007603
Lou Berger651b4022016-01-12 13:42:07 -05007604 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00007605}
7606
Lou Berger651b4022016-01-12 13:42:07 -05007607DEFUN (show_bgp_instance_ipv4_summary,
7608 show_bgp_instance_ipv4_summary_cmd,
7609 "show bgp view WORD ipv4 summary",
paul718e3742002-12-13 20:15:29 +00007610 SHOW_STR
7611 BGP_STR
Lou Berger651b4022016-01-12 13:42:07 -05007612 IP_STR
7613 "Address Family modifier\n"
7614 "Address Family modifier\n"
7615 "BGP view\n"
7616 "View name\n"
paul718e3742002-12-13 20:15:29 +00007617 "Summary of BGP neighbor status\n")
Lou Berger651b4022016-01-12 13:42:07 -05007618{
7619 vty_out(vty, "%sIPv4 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7620 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7621 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
7622 vty_out(vty, "%sIPv4 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7623 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7624 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
7625 vty_out(vty, "%sIPv4 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7626 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7627 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MPLS_VPN);
7628 vty_out(vty, "%sIPv4 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7629 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7630 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_ENCAP);
paul718e3742002-12-13 20:15:29 +00007631
Lou Berger651b4022016-01-12 13:42:07 -05007632 return CMD_SUCCESS;
7633}
7634
Lou Berger651b4022016-01-12 13:42:07 -05007635DEFUN (show_bgp_instance_ipv6_summary,
paul718e3742002-12-13 20:15:29 +00007636 show_bgp_instance_ipv6_summary_cmd,
7637 "show bgp view WORD ipv6 summary",
7638 SHOW_STR
7639 BGP_STR
Lou Berger651b4022016-01-12 13:42:07 -05007640 IPV6_STR
7641 "Address Family modifier\n"
7642 "Address Family modifier\n"
paul718e3742002-12-13 20:15:29 +00007643 "BGP view\n"
7644 "View name\n"
paul718e3742002-12-13 20:15:29 +00007645 "Summary of BGP neighbor status\n")
Lou Berger651b4022016-01-12 13:42:07 -05007646{
7647 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7648 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7649 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
7650 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7651 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7652 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST);
7653 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7654 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7655 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MPLS_VPN);
7656 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7657 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7658 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_ENCAP);
7659
7660 return CMD_SUCCESS;
7661}
paul718e3742002-12-13 20:15:29 +00007662
Michael Lambert95cbbd22010-07-23 14:43:04 -04007663DEFUN (show_bgp_ipv6_safi_summary,
7664 show_bgp_ipv6_safi_summary_cmd,
7665 "show bgp ipv6 (unicast|multicast) summary",
7666 SHOW_STR
7667 BGP_STR
7668 "Address family\n"
7669 "Address Family modifier\n"
7670 "Address Family modifier\n"
7671 "Summary of BGP neighbor status\n")
7672{
7673 if (strncmp (argv[0], "m", 1) == 0)
7674 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
7675
7676 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
7677}
7678
7679DEFUN (show_bgp_instance_ipv6_safi_summary,
7680 show_bgp_instance_ipv6_safi_summary_cmd,
7681 "show bgp view WORD ipv6 (unicast|multicast) summary",
7682 SHOW_STR
7683 BGP_STR
7684 "BGP view\n"
7685 "View name\n"
7686 "Address family\n"
7687 "Address Family modifier\n"
7688 "Address Family modifier\n"
7689 "Summary of BGP neighbor status\n")
7690{
7691 if (strncmp (argv[1], "m", 1) == 0)
7692 return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST);
7693
7694 return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
7695}
7696
Lou Bergerf9b6c392016-01-12 13:42:09 -05007697/* old command */
7698DEFUN (show_ipv6_bgp_summary,
7699 show_ipv6_bgp_summary_cmd,
7700 "show ipv6 bgp summary",
7701 SHOW_STR
7702 IPV6_STR
7703 BGP_STR
7704 "Summary of BGP neighbor status\n")
7705{
7706 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
7707}
7708
7709/* old command */
7710DEFUN (show_ipv6_mbgp_summary,
7711 show_ipv6_mbgp_summary_cmd,
7712 "show ipv6 mbgp summary",
7713 SHOW_STR
7714 IPV6_STR
7715 MBGP_STR
7716 "Summary of BGP neighbor status\n")
7717{
7718 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
7719}
Lou Berger651b4022016-01-12 13:42:07 -05007720
7721/* variations of show bgp [...] summary */
7722
7723/* This one is for the 0-keyword variant */
7724DEFUN (show_bgp_summary,
7725 show_bgp_summary_cmd,
7726 "show bgp summary",
paul718e3742002-12-13 20:15:29 +00007727 SHOW_STR
paul718e3742002-12-13 20:15:29 +00007728 BGP_STR
7729 "Summary of BGP neighbor status\n")
7730{
Lou Berger651b4022016-01-12 13:42:07 -05007731 vty_out(vty, "%sIPv4 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7732 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7733 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
7734 vty_out(vty, "%sIPv4 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7735 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7736 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
7737 vty_out(vty, "%sIPv4 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7738 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7739 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
7740 vty_out(vty, "%sIPv4 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7741 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7742 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_ENCAP);
7743
Lou Berger651b4022016-01-12 13:42:07 -05007744 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7745 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7746 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
7747 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7748 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7749 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
7750 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7751 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7752 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MPLS_VPN);
7753 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7754 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7755 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_ENCAP);
Lou Berger205e6742016-01-12 13:42:11 -05007756
Lou Berger651b4022016-01-12 13:42:07 -05007757 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00007758}
7759
Lou Bergerf9b6c392016-01-12 13:42:09 -05007760ALIAS (show_bgp_summary,
7761 show_bgp_ipv6_summary_cmd,
7762 "show bgp ipv6 summary",
7763 SHOW_STR
7764 BGP_STR
7765 "Address family\n"
7766 "Summary of BGP neighbor status\n")
7767
Lou Berger651b4022016-01-12 13:42:07 -05007768DEFUN (show_bgp_summary_1w,
7769 show_bgp_summary_1w_cmd,
Lou Berger651b4022016-01-12 13:42:07 -05007770 "show bgp (ipv4|ipv6|unicast|multicast|vpn|encap) summary",
paul718e3742002-12-13 20:15:29 +00007771 SHOW_STR
Lou Berger651b4022016-01-12 13:42:07 -05007772 BGP_STR
7773 IP_STR
Lou Berger651b4022016-01-12 13:42:07 -05007774 IP6_STR
Lou Berger651b4022016-01-12 13:42:07 -05007775 "Address Family modifier\n"
7776 "Address Family modifier\n"
7777 "Address Family modifier\n"
7778 "Address Family modifier\n"
paul718e3742002-12-13 20:15:29 +00007779 "Summary of BGP neighbor status\n")
7780{
Lou Berger651b4022016-01-12 13:42:07 -05007781 if (strcmp (argv[0], "ipv4") == 0) {
7782 vty_out(vty, "%sIPv4 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7783 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7784 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
7785 vty_out(vty, "%sIPv4 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7786 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7787 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
7788 vty_out(vty, "%sIPv4 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7789 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7790 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
7791 vty_out(vty, "%sIPv4 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7792 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7793 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_ENCAP);
7794 return CMD_SUCCESS;
7795 }
Lou Berger205e6742016-01-12 13:42:11 -05007796
Lou Berger651b4022016-01-12 13:42:07 -05007797 if (strcmp (argv[0], "ipv6") == 0) {
7798 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7799 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7800 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
7801 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7802 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7803 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
7804 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7805 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7806 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MPLS_VPN);
7807 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7808 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7809 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_ENCAP);
7810 return CMD_SUCCESS;
7811 }
Lou Berger205e6742016-01-12 13:42:11 -05007812
Lou Berger651b4022016-01-12 13:42:07 -05007813 if (strcmp (argv[0], "unicast") == 0) {
7814 vty_out(vty, "IPv4 Unicast Summary:%s", VTY_NEWLINE);
7815 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7816 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
Lou Berger651b4022016-01-12 13:42:07 -05007817 vty_out(vty, "%s", VTY_NEWLINE);
7818 vty_out(vty, "IPv6 Unicast Summary:%s", VTY_NEWLINE);
7819 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7820 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
Lou Berger651b4022016-01-12 13:42:07 -05007821 return CMD_SUCCESS;
7822 }
7823 if (strcmp (argv[0], "multicast") == 0) {
7824 vty_out(vty, "IPv4 Multicast Summary:%s", VTY_NEWLINE);
7825 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7826 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
Lou Berger651b4022016-01-12 13:42:07 -05007827 vty_out(vty, "%s", VTY_NEWLINE);
7828 vty_out(vty, "IPv6 Multicast Summary:%s", VTY_NEWLINE);
7829 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7830 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
Lou Berger651b4022016-01-12 13:42:07 -05007831 return CMD_SUCCESS;
7832 }
7833 if (strcmp (argv[0], "vpn") == 0) {
7834 vty_out(vty, "IPv4 VPN Summary:%s", VTY_NEWLINE);
7835 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7836 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
Lou Berger651b4022016-01-12 13:42:07 -05007837 vty_out(vty, "%s", VTY_NEWLINE);
7838 vty_out(vty, "IPv6 VPN Summary:%s", VTY_NEWLINE);
7839 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7840 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MPLS_VPN);
Lou Berger651b4022016-01-12 13:42:07 -05007841 return CMD_SUCCESS;
7842 }
7843 if (strcmp (argv[0], "encap") == 0) {
7844 vty_out(vty, "IPv4 Encap Summary:%s", VTY_NEWLINE);
7845 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7846 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_ENCAP);
Lou Berger651b4022016-01-12 13:42:07 -05007847 vty_out(vty, "%s", VTY_NEWLINE);
7848 vty_out(vty, "IPv6 Encap Summary:%s", VTY_NEWLINE);
7849 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7850 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_ENCAP);
Lou Berger651b4022016-01-12 13:42:07 -05007851 return CMD_SUCCESS;
7852 }
7853 vty_out(vty, "Unknown keyword: %s%s", argv[0], VTY_NEWLINE);
7854 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00007855}
Lou Berger651b4022016-01-12 13:42:07 -05007856
7857
David Lamparter6b0655a2014-06-04 06:53:35 +02007858
paulfd79ac92004-10-13 05:06:08 +00007859const char *
hasso538621f2004-05-21 09:31:30 +00007860afi_safi_print (afi_t afi, safi_t safi)
7861{
7862 if (afi == AFI_IP && safi == SAFI_UNICAST)
7863 return "IPv4 Unicast";
7864 else if (afi == AFI_IP && safi == SAFI_MULTICAST)
7865 return "IPv4 Multicast";
7866 else if (afi == AFI_IP && safi == SAFI_MPLS_VPN)
Lou Berger9da04bc2016-01-12 13:41:55 -05007867 return "VPN-IPv4 Unicast";
Lou Bergera3fda882016-01-12 13:42:04 -05007868 else if (afi == AFI_IP && safi == SAFI_ENCAP)
7869 return "ENCAP-IPv4 Unicast";
hasso538621f2004-05-21 09:31:30 +00007870 else if (afi == AFI_IP6 && safi == SAFI_UNICAST)
7871 return "IPv6 Unicast";
7872 else if (afi == AFI_IP6 && safi == SAFI_MULTICAST)
7873 return "IPv6 Multicast";
Lou Berger9da04bc2016-01-12 13:41:55 -05007874 else if (afi == AFI_IP6 && safi == SAFI_MPLS_VPN)
7875 return "VPN-IPv6 Unicast";
Lou Bergera3fda882016-01-12 13:42:04 -05007876 else if (afi == AFI_IP6 && safi == SAFI_ENCAP)
7877 return "ENCAP-IPv6 Unicast";
hasso538621f2004-05-21 09:31:30 +00007878 else
7879 return "Unknown";
7880}
7881
paul718e3742002-12-13 20:15:29 +00007882/* Show BGP peer's information. */
7883enum show_type
7884{
7885 show_all,
7886 show_peer
7887};
7888
paul94f2b392005-06-28 12:44:16 +00007889static void
paul718e3742002-12-13 20:15:29 +00007890bgp_show_peer_afi_orf_cap (struct vty *vty, struct peer *p,
7891 afi_t afi, safi_t safi,
7892 u_int16_t adv_smcap, u_int16_t adv_rmcap,
7893 u_int16_t rcv_smcap, u_int16_t rcv_rmcap)
7894{
7895 /* Send-Mode */
7896 if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap)
7897 || CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap))
7898 {
7899 vty_out (vty, " Send-mode: ");
7900 if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap))
7901 vty_out (vty, "advertised");
7902 if (CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap))
7903 vty_out (vty, "%sreceived",
7904 CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) ?
7905 ", " : "");
7906 vty_out (vty, "%s", VTY_NEWLINE);
7907 }
7908
7909 /* Receive-Mode */
7910 if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap)
7911 || CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap))
7912 {
7913 vty_out (vty, " Receive-mode: ");
7914 if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap))
7915 vty_out (vty, "advertised");
7916 if (CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap))
7917 vty_out (vty, "%sreceived",
7918 CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) ?
7919 ", " : "");
7920 vty_out (vty, "%s", VTY_NEWLINE);
7921 }
7922}
7923
paul94f2b392005-06-28 12:44:16 +00007924static void
paul718e3742002-12-13 20:15:29 +00007925bgp_show_peer_afi (struct vty *vty, struct peer *p, afi_t afi, safi_t safi)
7926{
7927 struct bgp_filter *filter;
7928 char orf_pfx_name[BUFSIZ];
7929 int orf_pfx_count;
7930
7931 filter = &p->filter[afi][safi];
7932
hasso538621f2004-05-21 09:31:30 +00007933 vty_out (vty, " For address family: %s%s", afi_safi_print (afi, safi),
paul718e3742002-12-13 20:15:29 +00007934 VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00007935
paul718e3742002-12-13 20:15:29 +00007936 if (p->af_group[afi][safi])
7937 vty_out (vty, " %s peer-group member%s", p->group->name, VTY_NEWLINE);
7938
7939 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
7940 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
7941 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)
7942 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
7943 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV)
7944 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
7945 vty_out (vty, " AF-dependant capabilities:%s", VTY_NEWLINE);
7946
7947 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
7948 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
7949 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
7950 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV))
7951 {
7952 vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
7953 ORF_TYPE_PREFIX, VTY_NEWLINE);
7954 bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
7955 PEER_CAP_ORF_PREFIX_SM_ADV,
7956 PEER_CAP_ORF_PREFIX_RM_ADV,
7957 PEER_CAP_ORF_PREFIX_SM_RCV,
7958 PEER_CAP_ORF_PREFIX_RM_RCV);
7959 }
7960 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
7961 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)
7962 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
7963 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
7964 {
7965 vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
7966 ORF_TYPE_PREFIX_OLD, VTY_NEWLINE);
7967 bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
7968 PEER_CAP_ORF_PREFIX_SM_ADV,
7969 PEER_CAP_ORF_PREFIX_RM_ADV,
7970 PEER_CAP_ORF_PREFIX_SM_OLD_RCV,
7971 PEER_CAP_ORF_PREFIX_RM_OLD_RCV);
7972 }
7973
7974 sprintf (orf_pfx_name, "%s.%d.%d", p->host, afi, safi);
7975 orf_pfx_count = prefix_bgp_show_prefix_list (NULL, afi, orf_pfx_name);
7976
7977 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND)
7978 || orf_pfx_count)
7979 {
7980 vty_out (vty, " Outbound Route Filter (ORF):");
7981 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND))
7982 vty_out (vty, " sent;");
7983 if (orf_pfx_count)
7984 vty_out (vty, " received (%d entries)", orf_pfx_count);
7985 vty_out (vty, "%s", VTY_NEWLINE);
7986 }
7987 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH))
7988 vty_out (vty, " First update is deferred until ORF or ROUTE-REFRESH is received%s", VTY_NEWLINE);
7989
7990 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT))
7991 vty_out (vty, " Route-Reflector Client%s", VTY_NEWLINE);
7992 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT))
7993 vty_out (vty, " Route-Server Client%s", VTY_NEWLINE);
7994 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG))
7995 vty_out (vty, " Inbound soft reconfiguration allowed%s", VTY_NEWLINE);
7996 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS))
7997 vty_out (vty, " Private AS number removed from updates to this neighbor%s", VTY_NEWLINE);
7998 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF))
7999 vty_out (vty, " NEXT_HOP is always this router%s", VTY_NEWLINE);
8000 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED))
8001 vty_out (vty, " AS_PATH is propagated unchanged to this neighbor%s", VTY_NEWLINE);
8002 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED))
8003 vty_out (vty, " NEXT_HOP is propagated unchanged to this neighbor%s", VTY_NEWLINE);
8004 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED))
8005 vty_out (vty, " MED is propagated unchanged to this neighbor%s", VTY_NEWLINE);
8006 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
8007 || CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
8008 {
8009 vty_out (vty, " Community attribute sent to this neighbor");
8010 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
8011 && CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
hasso538621f2004-05-21 09:31:30 +00008012 vty_out (vty, "(both)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008013 else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
hasso538621f2004-05-21 09:31:30 +00008014 vty_out (vty, "(extended)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008015 else
hasso538621f2004-05-21 09:31:30 +00008016 vty_out (vty, "(standard)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008017 }
8018 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE))
8019 {
8020 vty_out (vty, " Default information originate,");
8021
8022 if (p->default_rmap[afi][safi].name)
8023 vty_out (vty, " default route-map %s%s,",
8024 p->default_rmap[afi][safi].map ? "*" : "",
8025 p->default_rmap[afi][safi].name);
8026 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_DEFAULT_ORIGINATE))
8027 vty_out (vty, " default sent%s", VTY_NEWLINE);
8028 else
8029 vty_out (vty, " default not sent%s", VTY_NEWLINE);
8030 }
8031
8032 if (filter->plist[FILTER_IN].name
8033 || filter->dlist[FILTER_IN].name
8034 || filter->aslist[FILTER_IN].name
paulfee0f4c2004-09-13 05:12:46 +00008035 || filter->map[RMAP_IN].name)
paul718e3742002-12-13 20:15:29 +00008036 vty_out (vty, " Inbound path policy configured%s", VTY_NEWLINE);
8037 if (filter->plist[FILTER_OUT].name
8038 || filter->dlist[FILTER_OUT].name
8039 || filter->aslist[FILTER_OUT].name
paulfee0f4c2004-09-13 05:12:46 +00008040 || filter->map[RMAP_OUT].name
paul718e3742002-12-13 20:15:29 +00008041 || filter->usmap.name)
8042 vty_out (vty, " Outbound path policy configured%s", VTY_NEWLINE);
paulfee0f4c2004-09-13 05:12:46 +00008043 if (filter->map[RMAP_IMPORT].name)
8044 vty_out (vty, " Import policy for this RS-client configured%s", VTY_NEWLINE);
8045 if (filter->map[RMAP_EXPORT].name)
8046 vty_out (vty, " Export policy for this RS-client configured%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008047
8048 /* prefix-list */
8049 if (filter->plist[FILTER_IN].name)
8050 vty_out (vty, " Incoming update prefix filter list is %s%s%s",
8051 filter->plist[FILTER_IN].plist ? "*" : "",
8052 filter->plist[FILTER_IN].name,
8053 VTY_NEWLINE);
8054 if (filter->plist[FILTER_OUT].name)
8055 vty_out (vty, " Outgoing update prefix filter list is %s%s%s",
8056 filter->plist[FILTER_OUT].plist ? "*" : "",
8057 filter->plist[FILTER_OUT].name,
8058 VTY_NEWLINE);
8059
8060 /* distribute-list */
8061 if (filter->dlist[FILTER_IN].name)
8062 vty_out (vty, " Incoming update network filter list is %s%s%s",
8063 filter->dlist[FILTER_IN].alist ? "*" : "",
8064 filter->dlist[FILTER_IN].name,
8065 VTY_NEWLINE);
8066 if (filter->dlist[FILTER_OUT].name)
8067 vty_out (vty, " Outgoing update network filter list is %s%s%s",
8068 filter->dlist[FILTER_OUT].alist ? "*" : "",
8069 filter->dlist[FILTER_OUT].name,
8070 VTY_NEWLINE);
8071
8072 /* filter-list. */
8073 if (filter->aslist[FILTER_IN].name)
8074 vty_out (vty, " Incoming update AS path filter list is %s%s%s",
8075 filter->aslist[FILTER_IN].aslist ? "*" : "",
8076 filter->aslist[FILTER_IN].name,
8077 VTY_NEWLINE);
8078 if (filter->aslist[FILTER_OUT].name)
8079 vty_out (vty, " Outgoing update AS path filter list is %s%s%s",
8080 filter->aslist[FILTER_OUT].aslist ? "*" : "",
8081 filter->aslist[FILTER_OUT].name,
8082 VTY_NEWLINE);
8083
8084 /* route-map. */
paulfee0f4c2004-09-13 05:12:46 +00008085 if (filter->map[RMAP_IN].name)
paul718e3742002-12-13 20:15:29 +00008086 vty_out (vty, " Route map for incoming advertisements is %s%s%s",
paulfee0f4c2004-09-13 05:12:46 +00008087 filter->map[RMAP_IN].map ? "*" : "",
8088 filter->map[RMAP_IN].name,
paul718e3742002-12-13 20:15:29 +00008089 VTY_NEWLINE);
paulfee0f4c2004-09-13 05:12:46 +00008090 if (filter->map[RMAP_OUT].name)
paul718e3742002-12-13 20:15:29 +00008091 vty_out (vty, " Route map for outgoing advertisements is %s%s%s",
paulfee0f4c2004-09-13 05:12:46 +00008092 filter->map[RMAP_OUT].map ? "*" : "",
8093 filter->map[RMAP_OUT].name,
8094 VTY_NEWLINE);
8095 if (filter->map[RMAP_IMPORT].name)
8096 vty_out (vty, " Route map for advertisements going into this RS-client's table is %s%s%s",
8097 filter->map[RMAP_IMPORT].map ? "*" : "",
8098 filter->map[RMAP_IMPORT].name,
8099 VTY_NEWLINE);
8100 if (filter->map[RMAP_EXPORT].name)
8101 vty_out (vty, " Route map for advertisements coming from this RS-client is %s%s%s",
8102 filter->map[RMAP_EXPORT].map ? "*" : "",
8103 filter->map[RMAP_EXPORT].name,
paul718e3742002-12-13 20:15:29 +00008104 VTY_NEWLINE);
8105
8106 /* unsuppress-map */
8107 if (filter->usmap.name)
8108 vty_out (vty, " Route map for selective unsuppress is %s%s%s",
8109 filter->usmap.map ? "*" : "",
8110 filter->usmap.name, VTY_NEWLINE);
8111
8112 /* Receive prefix count */
hassoe0701b72004-05-20 09:19:34 +00008113 vty_out (vty, " %ld accepted prefixes%s", p->pcount[afi][safi], VTY_NEWLINE);
8114
paul718e3742002-12-13 20:15:29 +00008115 /* Maximum prefix */
8116 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX))
8117 {
hasso0a486e52005-02-01 20:57:17 +00008118 vty_out (vty, " Maximum prefixes allowed %ld%s%s", p->pmax[afi][safi],
paul718e3742002-12-13 20:15:29 +00008119 CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING)
hasso0a486e52005-02-01 20:57:17 +00008120 ? " (warning-only)" : "", VTY_NEWLINE);
8121 vty_out (vty, " Threshold for warning message %d%%",
8122 p->pmax_threshold[afi][safi]);
8123 if (p->pmax_restart[afi][safi])
8124 vty_out (vty, ", restart interval %d min", p->pmax_restart[afi][safi]);
8125 vty_out (vty, "%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008126 }
paul718e3742002-12-13 20:15:29 +00008127
8128 vty_out (vty, "%s", VTY_NEWLINE);
8129}
8130
paul94f2b392005-06-28 12:44:16 +00008131static void
paul718e3742002-12-13 20:15:29 +00008132bgp_show_peer (struct vty *vty, struct peer *p)
8133{
8134 struct bgp *bgp;
8135 char buf1[BUFSIZ];
8136 char timebuf[BGP_UPTIME_LEN];
hasso538621f2004-05-21 09:31:30 +00008137 afi_t afi;
8138 safi_t safi;
paul718e3742002-12-13 20:15:29 +00008139
8140 bgp = p->bgp;
8141
8142 /* Configured IP address. */
8143 vty_out (vty, "BGP neighbor is %s, ", p->host);
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04008144 vty_out (vty, "remote AS %u, ", p->as);
Andrew Certain9d3f9702012-11-07 23:50:07 +00008145 vty_out (vty, "local AS %u%s%s, ",
paul718e3742002-12-13 20:15:29 +00008146 p->change_local_as ? p->change_local_as : p->local_as,
8147 CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND) ?
Andrew Certain9d3f9702012-11-07 23:50:07 +00008148 " no-prepend" : "",
8149 CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_REPLACE_AS) ?
8150 " replace-as" : "");
paul718e3742002-12-13 20:15:29 +00008151 vty_out (vty, "%s link%s",
8152 p->as == p->local_as ? "internal" : "external",
8153 VTY_NEWLINE);
8154
8155 /* Description. */
8156 if (p->desc)
8157 vty_out (vty, " Description: %s%s", p->desc, VTY_NEWLINE);
8158
8159 /* Peer-group */
8160 if (p->group)
8161 vty_out (vty, " Member of peer-group %s for session parameters%s",
8162 p->group->name, VTY_NEWLINE);
8163
8164 /* Administrative shutdown. */
8165 if (CHECK_FLAG (p->flags, PEER_FLAG_SHUTDOWN))
8166 vty_out (vty, " Administratively shut down%s", VTY_NEWLINE);
8167
8168 /* BGP Version. */
8169 vty_out (vty, " BGP version 4");
paul718e3742002-12-13 20:15:29 +00008170 vty_out (vty, ", remote router ID %s%s",
8171 inet_ntop (AF_INET, &p->remote_id, buf1, BUFSIZ),
8172 VTY_NEWLINE);
8173
8174 /* Confederation */
hassoe0701b72004-05-20 09:19:34 +00008175 if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION)
8176 && bgp_confederation_peers_check (bgp, p->as))
paul718e3742002-12-13 20:15:29 +00008177 vty_out (vty, " Neighbor under common administration%s", VTY_NEWLINE);
8178
8179 /* Status. */
8180 vty_out (vty, " BGP state = %s",
8181 LOOKUP (bgp_status_msg, p->status));
8182 if (p->status == Established)
8183 vty_out (vty, ", up for %8s",
8184 peer_uptime (p->uptime, timebuf, BGP_UPTIME_LEN));
hasso93406d82005-02-02 14:40:33 +00008185 else if (p->status == Active)
8186 {
8187 if (CHECK_FLAG (p->flags, PEER_FLAG_PASSIVE))
8188 vty_out (vty, " (passive)");
8189 else if (CHECK_FLAG (p->sflags, PEER_STATUS_NSF_WAIT))
8190 vty_out (vty, " (NSF passive)");
8191 }
paul718e3742002-12-13 20:15:29 +00008192 vty_out (vty, "%s", VTY_NEWLINE);
8193
8194 /* read timer */
8195 vty_out (vty, " Last read %s", peer_uptime (p->readtime, timebuf, BGP_UPTIME_LEN));
8196
8197 /* Configured timer values. */
8198 vty_out (vty, ", hold time is %d, keepalive interval is %d seconds%s",
8199 p->v_holdtime, p->v_keepalive, VTY_NEWLINE);
8200 if (CHECK_FLAG (p->config, PEER_CONFIG_TIMER))
8201 {
8202 vty_out (vty, " Configured hold time is %d", p->holdtime);
8203 vty_out (vty, ", keepalive interval is %d seconds%s",
8204 p->keepalive, VTY_NEWLINE);
8205 }
hasso93406d82005-02-02 14:40:33 +00008206
paul718e3742002-12-13 20:15:29 +00008207 /* Capability. */
8208 if (p->status == Established)
8209 {
hasso538621f2004-05-21 09:31:30 +00008210 if (p->cap
paul718e3742002-12-13 20:15:29 +00008211 || p->afc_adv[AFI_IP][SAFI_UNICAST]
8212 || p->afc_recv[AFI_IP][SAFI_UNICAST]
8213 || p->afc_adv[AFI_IP][SAFI_MULTICAST]
8214 || p->afc_recv[AFI_IP][SAFI_MULTICAST]
paul718e3742002-12-13 20:15:29 +00008215 || p->afc_adv[AFI_IP6][SAFI_UNICAST]
8216 || p->afc_recv[AFI_IP6][SAFI_UNICAST]
8217 || p->afc_adv[AFI_IP6][SAFI_MULTICAST]
8218 || p->afc_recv[AFI_IP6][SAFI_MULTICAST]
Lou Berger9da04bc2016-01-12 13:41:55 -05008219 || p->afc_adv[AFI_IP6][SAFI_MPLS_VPN]
8220 || p->afc_recv[AFI_IP6][SAFI_MPLS_VPN]
Lou Bergera3fda882016-01-12 13:42:04 -05008221 || p->afc_adv[AFI_IP6][SAFI_ENCAP]
8222 || p->afc_recv[AFI_IP6][SAFI_ENCAP]
Lou Bergera3fda882016-01-12 13:42:04 -05008223 || p->afc_adv[AFI_IP][SAFI_ENCAP]
8224 || p->afc_recv[AFI_IP][SAFI_ENCAP]
paul718e3742002-12-13 20:15:29 +00008225 || p->afc_adv[AFI_IP][SAFI_MPLS_VPN]
8226 || p->afc_recv[AFI_IP][SAFI_MPLS_VPN])
8227 {
8228 vty_out (vty, " Neighbor capabilities:%s", VTY_NEWLINE);
8229
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00008230 /* AS4 */
8231 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV)
8232 || CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV))
8233 {
8234 vty_out (vty, " 4 Byte AS:");
8235 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV))
8236 vty_out (vty, " advertised");
8237 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV))
8238 vty_out (vty, " %sreceived",
8239 CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV) ? "and " : "");
8240 vty_out (vty, "%s", VTY_NEWLINE);
8241 }
paul718e3742002-12-13 20:15:29 +00008242 /* Dynamic */
8243 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)
8244 || CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV))
8245 {
8246 vty_out (vty, " Dynamic:");
8247 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV))
8248 vty_out (vty, " advertised");
8249 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV))
hasso538621f2004-05-21 09:31:30 +00008250 vty_out (vty, " %sreceived",
8251 CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV) ? "and " : "");
paul718e3742002-12-13 20:15:29 +00008252 vty_out (vty, "%s", VTY_NEWLINE);
8253 }
8254
8255 /* Route Refresh */
8256 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV)
8257 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)
8258 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
8259 {
8260 vty_out (vty, " Route refresh:");
8261 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV))
8262 vty_out (vty, " advertised");
8263 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)
8264 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
hasso538621f2004-05-21 09:31:30 +00008265 vty_out (vty, " %sreceived(%s)",
8266 CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) ? "and " : "",
8267 (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)
8268 && CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)) ?
8269 "old & new" : CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) ? "old" : "new");
8270
paul718e3742002-12-13 20:15:29 +00008271 vty_out (vty, "%s", VTY_NEWLINE);
8272 }
8273
hasso538621f2004-05-21 09:31:30 +00008274 /* Multiprotocol Extensions */
8275 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
8276 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
8277 if (p->afc_adv[afi][safi] || p->afc_recv[afi][safi])
paul718e3742002-12-13 20:15:29 +00008278 {
hasso538621f2004-05-21 09:31:30 +00008279 vty_out (vty, " Address family %s:", afi_safi_print (afi, safi));
8280 if (p->afc_adv[afi][safi])
8281 vty_out (vty, " advertised");
8282 if (p->afc_recv[afi][safi])
8283 vty_out (vty, " %sreceived", p->afc_adv[afi][safi] ? "and " : "");
8284 vty_out (vty, "%s", VTY_NEWLINE);
8285 }
8286
8287 /* Gracefull Restart */
8288 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)
8289 || CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
paul718e3742002-12-13 20:15:29 +00008290 {
hasso538621f2004-05-21 09:31:30 +00008291 vty_out (vty, " Graceful Restart Capabilty:");
8292 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
paul718e3742002-12-13 20:15:29 +00008293 vty_out (vty, " advertised");
hasso538621f2004-05-21 09:31:30 +00008294 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
8295 vty_out (vty, " %sreceived",
8296 CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV) ? "and " : "");
paul718e3742002-12-13 20:15:29 +00008297 vty_out (vty, "%s", VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00008298
8299 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
paul718e3742002-12-13 20:15:29 +00008300 {
hasso538621f2004-05-21 09:31:30 +00008301 int restart_af_count = 0;
8302
8303 vty_out (vty, " Remote Restart timer is %d seconds%s",
hasso93406d82005-02-02 14:40:33 +00008304 p->v_gr_restart, VTY_NEWLINE);
8305 vty_out (vty, " Address families by peer:%s ", VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00008306
8307 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
8308 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
8309 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_RCV))
8310 {
hasso93406d82005-02-02 14:40:33 +00008311 vty_out (vty, "%s%s(%s)", restart_af_count ? ", " : "",
8312 afi_safi_print (afi, safi),
8313 CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_PRESERVE_RCV) ?
8314 "preserved" : "not preserved");
hasso538621f2004-05-21 09:31:30 +00008315 restart_af_count++;
hasso93406d82005-02-02 14:40:33 +00008316 }
hasso538621f2004-05-21 09:31:30 +00008317 if (! restart_af_count)
8318 vty_out (vty, "none");
8319 vty_out (vty, "%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008320 }
paul718e3742002-12-13 20:15:29 +00008321 }
paul718e3742002-12-13 20:15:29 +00008322 }
8323 }
8324
hasso93406d82005-02-02 14:40:33 +00008325 /* graceful restart information */
8326 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)
8327 || p->t_gr_restart
8328 || p->t_gr_stale)
8329 {
8330 int eor_send_af_count = 0;
8331 int eor_receive_af_count = 0;
8332
8333 vty_out (vty, " Graceful restart informations:%s", VTY_NEWLINE);
8334 if (p->status == Established)
8335 {
8336 vty_out (vty, " End-of-RIB send: ");
8337 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
8338 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
8339 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_SEND))
8340 {
8341 vty_out (vty, "%s%s", eor_send_af_count ? ", " : "",
8342 afi_safi_print (afi, safi));
8343 eor_send_af_count++;
8344 }
8345 vty_out (vty, "%s", VTY_NEWLINE);
8346
8347 vty_out (vty, " End-of-RIB received: ");
8348 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
8349 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
8350 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_RECEIVED))
8351 {
8352 vty_out (vty, "%s%s", eor_receive_af_count ? ", " : "",
8353 afi_safi_print (afi, safi));
8354 eor_receive_af_count++;
8355 }
8356 vty_out (vty, "%s", VTY_NEWLINE);
8357 }
8358
8359 if (p->t_gr_restart)
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00008360 vty_out (vty, " The remaining time of restart timer is %ld%s",
8361 thread_timer_remain_second (p->t_gr_restart), VTY_NEWLINE);
8362
hasso93406d82005-02-02 14:40:33 +00008363 if (p->t_gr_stale)
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00008364 vty_out (vty, " The remaining time of stalepath timer is %ld%s",
8365 thread_timer_remain_second (p->t_gr_stale), VTY_NEWLINE);
hasso93406d82005-02-02 14:40:33 +00008366 }
8367
paul718e3742002-12-13 20:15:29 +00008368 /* Packet counts. */
hasso93406d82005-02-02 14:40:33 +00008369 vty_out (vty, " Message statistics:%s", VTY_NEWLINE);
8370 vty_out (vty, " Inq depth is 0%s", VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00008371 vty_out (vty, " Outq depth is %lu%s", (unsigned long) p->obuf->count, VTY_NEWLINE);
hasso93406d82005-02-02 14:40:33 +00008372 vty_out (vty, " Sent Rcvd%s", VTY_NEWLINE);
8373 vty_out (vty, " Opens: %10d %10d%s", p->open_out, p->open_in, VTY_NEWLINE);
8374 vty_out (vty, " Notifications: %10d %10d%s", p->notify_out, p->notify_in, VTY_NEWLINE);
8375 vty_out (vty, " Updates: %10d %10d%s", p->update_out, p->update_in, VTY_NEWLINE);
8376 vty_out (vty, " Keepalives: %10d %10d%s", p->keepalive_out, p->keepalive_in, VTY_NEWLINE);
8377 vty_out (vty, " Route Refresh: %10d %10d%s", p->refresh_out, p->refresh_in, VTY_NEWLINE);
8378 vty_out (vty, " Capability: %10d %10d%s", p->dynamic_cap_out, p->dynamic_cap_in, VTY_NEWLINE);
8379 vty_out (vty, " Total: %10d %10d%s", p->open_out + p->notify_out +
8380 p->update_out + p->keepalive_out + p->refresh_out + p->dynamic_cap_out,
8381 p->open_in + p->notify_in + p->update_in + p->keepalive_in + p->refresh_in +
8382 p->dynamic_cap_in, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008383
8384 /* advertisement-interval */
8385 vty_out (vty, " Minimum time between advertisement runs is %d seconds%s",
8386 p->v_routeadv, VTY_NEWLINE);
8387
8388 /* Update-source. */
8389 if (p->update_if || p->update_source)
8390 {
8391 vty_out (vty, " Update source is ");
8392 if (p->update_if)
8393 vty_out (vty, "%s", p->update_if);
8394 else if (p->update_source)
8395 vty_out (vty, "%s",
8396 sockunion2str (p->update_source, buf1, SU_ADDRSTRLEN));
8397 vty_out (vty, "%s", VTY_NEWLINE);
8398 }
8399
8400 /* Default weight */
8401 if (CHECK_FLAG (p->config, PEER_CONFIG_WEIGHT))
8402 vty_out (vty, " Default weight %d%s", p->weight,
8403 VTY_NEWLINE);
8404
8405 vty_out (vty, "%s", VTY_NEWLINE);
8406
8407 /* Address Family Information */
hasso538621f2004-05-21 09:31:30 +00008408 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
8409 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
8410 if (p->afc[afi][safi])
8411 bgp_show_peer_afi (vty, p, afi, safi);
paul718e3742002-12-13 20:15:29 +00008412
8413 vty_out (vty, " Connections established %d; dropped %d%s",
8414 p->established, p->dropped,
8415 VTY_NEWLINE);
8416
hassoe0701b72004-05-20 09:19:34 +00008417 if (! p->dropped)
8418 vty_out (vty, " Last reset never%s", VTY_NEWLINE);
8419 else
8420 vty_out (vty, " Last reset %s, due to %s%s",
8421 peer_uptime (p->resettime, timebuf, BGP_UPTIME_LEN),
8422 peer_down_str[(int) p->last_reset], VTY_NEWLINE);
paul848973c2003-08-13 00:32:49 +00008423
paul718e3742002-12-13 20:15:29 +00008424 if (CHECK_FLAG (p->sflags, PEER_STATUS_PREFIX_OVERFLOW))
8425 {
8426 vty_out (vty, " Peer had exceeded the max. no. of prefixes configured.%s", VTY_NEWLINE);
hasso0a486e52005-02-01 20:57:17 +00008427
8428 if (p->t_pmax_restart)
8429 vty_out (vty, " Reduce the no. of prefix from %s, will restart in %ld seconds%s",
8430 p->host, thread_timer_remain_second (p->t_pmax_restart),
8431 VTY_NEWLINE);
8432 else
8433 vty_out (vty, " Reduce the no. of prefix and clear ip bgp %s to restore peering%s",
8434 p->host, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008435 }
8436
Stephen Hemmingerf5a48272011-03-24 17:30:21 +00008437 /* EBGP Multihop and GTSM */
Jorge Boncompte [DTI2]6d85b152012-05-07 16:52:54 +00008438 if (p->sort != BGP_PEER_IBGP)
Stephen Hemmingerf5a48272011-03-24 17:30:21 +00008439 {
8440 if (p->gtsm_hops > 0)
8441 vty_out (vty, " External BGP neighbor may be up to %d hops away.%s",
8442 p->gtsm_hops, VTY_NEWLINE);
8443 else if (p->ttl > 1)
8444 vty_out (vty, " External BGP neighbor may be up to %d hops away.%s",
8445 p->ttl, VTY_NEWLINE);
8446 }
Pradosh Mohapatra5d804b42013-09-12 03:37:07 +00008447 else
8448 {
8449 if (p->gtsm_hops > 0)
8450 vty_out (vty, " Internal BGP neighbor may be up to %d hops away.%s",
8451 p->gtsm_hops, VTY_NEWLINE);
8452 }
paul718e3742002-12-13 20:15:29 +00008453
8454 /* Local address. */
8455 if (p->su_local)
8456 {
hasso93406d82005-02-02 14:40:33 +00008457 vty_out (vty, "Local host: %s, Local port: %d%s",
paul718e3742002-12-13 20:15:29 +00008458 sockunion2str (p->su_local, buf1, SU_ADDRSTRLEN),
8459 ntohs (p->su_local->sin.sin_port),
paul718e3742002-12-13 20:15:29 +00008460 VTY_NEWLINE);
8461 }
8462
8463 /* Remote address. */
8464 if (p->su_remote)
8465 {
8466 vty_out (vty, "Foreign host: %s, Foreign port: %d%s",
8467 sockunion2str (p->su_remote, buf1, SU_ADDRSTRLEN),
8468 ntohs (p->su_remote->sin.sin_port),
8469 VTY_NEWLINE);
8470 }
8471
8472 /* Nexthop display. */
8473 if (p->su_local)
8474 {
8475 vty_out (vty, "Nexthop: %s%s",
8476 inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ),
8477 VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008478 vty_out (vty, "Nexthop global: %s%s",
8479 inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ),
8480 VTY_NEWLINE);
8481 vty_out (vty, "Nexthop local: %s%s",
8482 inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ),
8483 VTY_NEWLINE);
8484 vty_out (vty, "BGP connection: %s%s",
8485 p->shared_network ? "shared network" : "non shared network",
8486 VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008487 }
8488
Timo Teräsef757702015-04-29 09:43:04 +03008489 /* TCP metrics. */
8490 if (p->status == Established && p->rtt)
8491 vty_out (vty, "Estimated round trip time: %d ms%s",
8492 p->rtt, VTY_NEWLINE);
8493
paul718e3742002-12-13 20:15:29 +00008494 /* Timer information. */
8495 if (p->t_start)
8496 vty_out (vty, "Next start timer due in %ld seconds%s",
8497 thread_timer_remain_second (p->t_start), VTY_NEWLINE);
8498 if (p->t_connect)
8499 vty_out (vty, "Next connect timer due in %ld seconds%s",
8500 thread_timer_remain_second (p->t_connect), VTY_NEWLINE);
8501
8502 vty_out (vty, "Read thread: %s Write thread: %s%s",
8503 p->t_read ? "on" : "off",
8504 p->t_write ? "on" : "off",
8505 VTY_NEWLINE);
8506
8507 if (p->notify.code == BGP_NOTIFY_OPEN_ERR
8508 && p->notify.subcode == BGP_NOTIFY_OPEN_UNSUP_CAPBL)
8509 bgp_capability_vty_out (vty, p);
8510
8511 vty_out (vty, "%s", VTY_NEWLINE);
8512}
8513
paul94f2b392005-06-28 12:44:16 +00008514static int
paul718e3742002-12-13 20:15:29 +00008515bgp_show_neighbor (struct vty *vty, struct bgp *bgp,
8516 enum show_type type, union sockunion *su)
8517{
paul1eb8ef22005-04-07 07:30:20 +00008518 struct listnode *node, *nnode;
paul718e3742002-12-13 20:15:29 +00008519 struct peer *peer;
8520 int find = 0;
8521
paul1eb8ef22005-04-07 07:30:20 +00008522 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00008523 {
8524 switch (type)
8525 {
8526 case show_all:
8527 bgp_show_peer (vty, peer);
8528 break;
8529 case show_peer:
8530 if (sockunion_same (&peer->su, su))
8531 {
8532 find = 1;
8533 bgp_show_peer (vty, peer);
8534 }
8535 break;
8536 }
8537 }
8538
8539 if (type == show_peer && ! find)
8540 vty_out (vty, "%% No such neighbor%s", VTY_NEWLINE);
8541
8542 return CMD_SUCCESS;
8543}
8544
paul94f2b392005-06-28 12:44:16 +00008545static int
paulfd79ac92004-10-13 05:06:08 +00008546bgp_show_neighbor_vty (struct vty *vty, const char *name,
8547 enum show_type type, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00008548{
8549 int ret;
8550 struct bgp *bgp;
8551 union sockunion su;
8552
8553 if (ip_str)
8554 {
8555 ret = str2sockunion (ip_str, &su);
8556 if (ret < 0)
8557 {
8558 vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE);
8559 return CMD_WARNING;
8560 }
8561 }
8562
8563 if (name)
8564 {
8565 bgp = bgp_lookup_by_name (name);
8566
8567 if (! bgp)
8568 {
8569 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
8570 return CMD_WARNING;
8571 }
8572
8573 bgp_show_neighbor (vty, bgp, type, &su);
8574
8575 return CMD_SUCCESS;
8576 }
8577
8578 bgp = bgp_get_default ();
8579
8580 if (bgp)
8581 bgp_show_neighbor (vty, bgp, type, &su);
8582
8583 return CMD_SUCCESS;
8584}
8585
Lou Bergerf9b6c392016-01-12 13:42:09 -05008586/* "show ip bgp neighbors" commands. */DEFUN (show_ip_bgp_neighbors,
8587 show_ip_bgp_neighbors_cmd,
8588 "show ip bgp neighbors",
8589 SHOW_STR
8590 IP_STR
8591 BGP_STR
8592 "Detailed information on TCP and BGP neighbor connections\n")
8593{
8594 return bgp_show_neighbor_vty (vty, NULL, show_all, NULL);
8595}
8596
8597ALIAS (show_ip_bgp_neighbors,
8598 show_ip_bgp_ipv4_neighbors_cmd,
8599 "show ip bgp ipv4 (unicast|multicast) neighbors",
8600 SHOW_STR
8601 IP_STR
8602 BGP_STR
8603 "Address family\n"
8604 "Address Family modifier\n"
8605 "Address Family modifier\n"
8606 "Detailed information on TCP and BGP neighbor connections\n")
8607
8608ALIAS (show_ip_bgp_neighbors,
8609 show_ip_bgp_vpnv4_all_neighbors_cmd,
8610 "show ip bgp vpnv4 all neighbors",
8611 SHOW_STR
8612 IP_STR
8613 BGP_STR
8614 "Display VPNv4 NLRI specific information\n"
8615 "Display information about all VPNv4 NLRIs\n"
8616 "Detailed information on TCP and BGP neighbor connections\n")
8617
8618ALIAS (show_ip_bgp_neighbors,
8619 show_ip_bgp_vpnv4_rd_neighbors_cmd,
8620 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors",
8621 SHOW_STR
8622 IP_STR
8623 BGP_STR
8624 "Display VPNv4 NLRI specific information\n"
8625 "Display information for a route distinguisher\n"
8626 "VPN Route Distinguisher\n"
8627 "Detailed information on TCP and BGP neighbor connections\n")
8628
8629ALIAS (show_ip_bgp_neighbors,
8630 show_bgp_ipv6_neighbors_cmd,
8631 "show bgp ipv6 neighbors",
8632 SHOW_STR
8633 BGP_STR
8634 "Address family\n"
8635 "Detailed information on TCP and BGP neighbor connections\n")
8636
8637DEFUN (show_ip_bgp_neighbors_peer,
8638 show_ip_bgp_neighbors_peer_cmd,
8639 "show ip bgp neighbors (A.B.C.D|X:X::X:X)",
8640 SHOW_STR
8641 IP_STR
8642 BGP_STR
8643 "Detailed information on TCP and BGP neighbor connections\n"
8644 "Neighbor to display information about\n"
8645 "Neighbor to display information about\n")
8646{
8647 return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 1]);
8648}
8649
8650ALIAS (show_ip_bgp_neighbors_peer,
8651 show_ip_bgp_ipv4_neighbors_peer_cmd,
8652 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X)",
8653 SHOW_STR
8654 IP_STR
8655 BGP_STR
8656 "Address family\n"
8657 "Address Family modifier\n"
8658 "Address Family modifier\n"
8659 "Detailed information on TCP and BGP neighbor connections\n"
8660 "Neighbor to display information about\n"
8661 "Neighbor to display information about\n")
8662
8663ALIAS (show_ip_bgp_neighbors_peer,
8664 show_ip_bgp_vpnv4_all_neighbors_peer_cmd,
8665 "show ip bgp vpnv4 all neighbors A.B.C.D",
8666 SHOW_STR
8667 IP_STR
8668 BGP_STR
8669 "Display VPNv4 NLRI specific information\n"
8670 "Display information about all VPNv4 NLRIs\n"
8671 "Detailed information on TCP and BGP neighbor connections\n"
8672 "Neighbor to display information about\n")
8673
8674ALIAS (show_ip_bgp_neighbors_peer,
8675 show_ip_bgp_vpnv4_rd_neighbors_peer_cmd,
8676 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D",
8677 SHOW_STR
8678 IP_STR
8679 BGP_STR
8680 "Display VPNv4 NLRI specific information\n"
8681 "Display information about all VPNv4 NLRIs\n"
8682 "Detailed information on TCP and BGP neighbor connections\n"
8683 "Neighbor to display information about\n")
8684
8685ALIAS (show_ip_bgp_neighbors_peer,
8686 show_bgp_ipv6_neighbors_peer_cmd,
8687 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X)",
8688 SHOW_STR
8689 BGP_STR
8690 "Address family\n"
8691 "Detailed information on TCP and BGP neighbor connections\n"
8692 "Neighbor to display information about\n"
8693 "Neighbor to display information about\n")
8694
8695DEFUN (show_ip_bgp_instance_neighbors,
8696 show_ip_bgp_instance_neighbors_cmd,
8697 "show ip bgp view WORD neighbors",
8698 SHOW_STR
8699 IP_STR
8700 BGP_STR
8701 "BGP view\n"
8702 "View name\n"
8703 "Detailed information on TCP and BGP neighbor connections\n")
8704{
8705 return bgp_show_neighbor_vty (vty, argv[0], show_all, NULL);
8706}
8707
8708ALIAS (show_ip_bgp_instance_neighbors,
8709 show_bgp_instance_ipv6_neighbors_cmd,
8710 "show bgp view WORD ipv6 neighbors",
8711 SHOW_STR
8712 BGP_STR
8713 "BGP view\n"
8714 "View name\n"
8715 "Address family\n"
8716 "Detailed information on TCP and BGP neighbor connections\n")
8717
8718DEFUN (show_ip_bgp_instance_neighbors_peer,
8719 show_ip_bgp_instance_neighbors_peer_cmd,
8720 "show ip bgp view WORD neighbors (A.B.C.D|X:X::X:X)",
8721 SHOW_STR
8722 IP_STR
8723 BGP_STR
8724 "BGP view\n"
8725 "View name\n"
8726 "Detailed information on TCP and BGP neighbor connections\n"
8727 "Neighbor to display information about\n"
8728 "Neighbor to display information about\n")
8729{
8730 return bgp_show_neighbor_vty (vty, argv[0], show_peer, argv[1]);
8731}
8732
8733/* Show BGP's AS paths internal data. There are both `show ip bgp
8734 paths' and `show ip mbgp paths'. Those functions results are the
8735 same.*/
8736DEFUN (show_ip_bgp_paths,
8737 show_ip_bgp_paths_cmd,
8738 "show ip bgp paths",
8739 SHOW_STR
8740 IP_STR
8741 BGP_STR
8742 "Path information\n")
8743{
8744 vty_out (vty, "Address Refcnt Path%s", VTY_NEWLINE);
8745 aspath_print_all_vty (vty);
8746 return CMD_SUCCESS;
8747}
8748
8749DEFUN (show_ip_bgp_ipv4_paths,
8750 show_ip_bgp_ipv4_paths_cmd,
8751 "show ip bgp ipv4 (unicast|multicast) paths",
8752 SHOW_STR
8753 IP_STR
8754 BGP_STR
8755 "Address family\n"
8756 "Address Family modifier\n"
8757 "Address Family modifier\n"
8758 "Path information\n")
8759{
8760 vty_out (vty, "Address Refcnt Path\r\n");
8761 aspath_print_all_vty (vty);
8762
8763 return CMD_SUCCESS;
8764}
8765
Lou Berger651b4022016-01-12 13:42:07 -05008766DEFUN (show_bgp_neighbors,
8767 show_bgp_neighbors_cmd,
8768 "show bgp neighbors",
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{
8773 return bgp_show_neighbor_vty (vty, NULL, show_all, NULL);
8774}
8775
Lou Berger651b4022016-01-12 13:42:07 -05008776DEFUN (show_bgp_neighbors_peer,
8777 show_bgp_neighbors_peer_cmd,
Lou Berger651b4022016-01-12 13:42:07 -05008778 "show bgp neighbors (A.B.C.D|X:X::X:X)",
paul718e3742002-12-13 20:15:29 +00008779 SHOW_STR
paul718e3742002-12-13 20:15:29 +00008780 BGP_STR
8781 "Detailed information on TCP and BGP neighbor connections\n"
8782 "Neighbor to display information about\n"
8783 "Neighbor to display information about\n")
8784{
8785 return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 1]);
8786}
8787
Lou Berger651b4022016-01-12 13:42:07 -05008788DEFUN (show_bgp_instance_neighbors,
8789 show_bgp_instance_neighbors_cmd,
8790 "show bgp view WORD neighbors",
paul718e3742002-12-13 20:15:29 +00008791 SHOW_STR
paul718e3742002-12-13 20:15:29 +00008792 BGP_STR
8793 "BGP view\n"
8794 "View name\n"
8795 "Detailed information on TCP and BGP neighbor connections\n")
8796{
8797 return bgp_show_neighbor_vty (vty, argv[0], show_all, NULL);
8798}
8799
Lou Berger651b4022016-01-12 13:42:07 -05008800DEFUN (show_bgp_instance_neighbors_peer,
8801 show_bgp_instance_neighbors_peer_cmd,
Lou Berger651b4022016-01-12 13:42:07 -05008802 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X)",
paul718e3742002-12-13 20:15:29 +00008803 SHOW_STR
paul718e3742002-12-13 20:15:29 +00008804 BGP_STR
8805 "BGP view\n"
8806 "View name\n"
8807 "Detailed information on TCP and BGP neighbor connections\n"
8808 "Neighbor to display information about\n"
8809 "Neighbor to display information about\n")
8810{
8811 return bgp_show_neighbor_vty (vty, argv[0], show_peer, argv[1]);
8812}
paulbb46e942003-10-24 19:02:03 +00008813
Lou Berger651b4022016-01-12 13:42:07 -05008814ALIAS (show_bgp_instance_neighbors_peer,
paulbb46e942003-10-24 19:02:03 +00008815 show_bgp_instance_ipv6_neighbors_peer_cmd,
8816 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X)",
8817 SHOW_STR
8818 BGP_STR
8819 "BGP view\n"
8820 "View name\n"
8821 "Address family\n"
8822 "Detailed information on TCP and BGP neighbor connections\n"
8823 "Neighbor to display information about\n"
8824 "Neighbor to display information about\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02008825
paul718e3742002-12-13 20:15:29 +00008826/* Show BGP's AS paths internal data. There are both `show ip bgp
8827 paths' and `show ip mbgp paths'. Those functions results are the
8828 same.*/
Lou Berger651b4022016-01-12 13:42:07 -05008829DEFUN (show_bgp_ipv4_paths,
8830 show_bgp_ipv4_paths_cmd,
8831 "show bgp paths",
paul718e3742002-12-13 20:15:29 +00008832 SHOW_STR
paul718e3742002-12-13 20:15:29 +00008833 BGP_STR
8834 "Path information\n")
8835{
8836 vty_out (vty, "Address Refcnt Path%s", VTY_NEWLINE);
8837 aspath_print_all_vty (vty);
8838 return CMD_SUCCESS;
8839}
8840
paul718e3742002-12-13 20:15:29 +00008841#include "hash.h"
8842
paul94f2b392005-06-28 12:44:16 +00008843static void
paul718e3742002-12-13 20:15:29 +00008844community_show_all_iterator (struct hash_backet *backet, struct vty *vty)
8845{
8846 struct community *com;
8847
8848 com = (struct community *) backet->data;
David Lampartereed3c482015-03-03 08:51:53 +01008849 vty_out (vty, "[%p] (%ld) %s%s", (void *)backet, com->refcnt,
paul718e3742002-12-13 20:15:29 +00008850 community_str (com), VTY_NEWLINE);
8851}
8852
8853/* Show BGP's community internal data. */
8854DEFUN (show_ip_bgp_community_info,
8855 show_ip_bgp_community_info_cmd,
8856 "show ip bgp community-info",
8857 SHOW_STR
8858 IP_STR
8859 BGP_STR
8860 "List all bgp community information\n")
8861{
8862 vty_out (vty, "Address Refcnt Community%s", VTY_NEWLINE);
8863
8864 hash_iterate (community_hash (),
8865 (void (*) (struct hash_backet *, void *))
8866 community_show_all_iterator,
8867 vty);
8868
8869 return CMD_SUCCESS;
8870}
8871
8872DEFUN (show_ip_bgp_attr_info,
8873 show_ip_bgp_attr_info_cmd,
8874 "show ip bgp attribute-info",
8875 SHOW_STR
8876 IP_STR
8877 BGP_STR
8878 "List all bgp attribute information\n")
8879{
8880 attr_show_all (vty);
8881 return CMD_SUCCESS;
8882}
David Lamparter6b0655a2014-06-04 06:53:35 +02008883
paul94f2b392005-06-28 12:44:16 +00008884static int
paulfee0f4c2004-09-13 05:12:46 +00008885bgp_write_rsclient_summary (struct vty *vty, struct peer *rsclient,
8886 afi_t afi, safi_t safi)
8887{
8888 char timebuf[BGP_UPTIME_LEN];
8889 char rmbuf[14];
paulfd79ac92004-10-13 05:06:08 +00008890 const char *rmname;
paulfee0f4c2004-09-13 05:12:46 +00008891 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00008892 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00008893 int len;
8894 int count = 0;
8895
8896 if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_GROUP))
8897 {
paul1eb8ef22005-04-07 07:30:20 +00008898 for (ALL_LIST_ELEMENTS (rsclient->group->peer, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00008899 {
8900 count++;
8901 bgp_write_rsclient_summary (vty, peer, afi, safi);
8902 }
8903 return count;
8904 }
8905
8906 len = vty_out (vty, "%s", rsclient->host);
8907 len = 16 - len;
8908
8909 if (len < 1)
8910 vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " ");
8911 else
8912 vty_out (vty, "%*s", len, " ");
8913
hasso3d515fd2005-02-01 21:30:04 +00008914 vty_out (vty, "4 ");
paulfee0f4c2004-09-13 05:12:46 +00008915
Milan Kociancb4fc592014-12-01 12:48:25 +00008916 vty_out (vty, "%10u ", rsclient->as);
paulfee0f4c2004-09-13 05:12:46 +00008917
8918 rmname = ROUTE_MAP_EXPORT_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 rmname = ROUTE_MAP_IMPORT_NAME(&rsclient->filter[afi][safi]);
8929 if ( rmname && strlen (rmname) > 13 )
8930 {
8931 sprintf (rmbuf, "%13s", "...");
8932 rmname = strncpy (rmbuf, rmname, 10);
8933 }
8934 else if (! rmname)
8935 rmname = "<none>";
8936 vty_out (vty, " %13s ", rmname);
8937
8938 vty_out (vty, "%8s", peer_uptime (rsclient->uptime, timebuf, BGP_UPTIME_LEN));
8939
8940 if (CHECK_FLAG (rsclient->flags, PEER_FLAG_SHUTDOWN))
8941 vty_out (vty, " Idle (Admin)");
8942 else if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_PREFIX_OVERFLOW))
8943 vty_out (vty, " Idle (PfxCt)");
8944 else
8945 vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, rsclient->status));
8946
8947 vty_out (vty, "%s", VTY_NEWLINE);
8948
8949 return 1;
8950}
8951
paul94f2b392005-06-28 12:44:16 +00008952static int
paulfd79ac92004-10-13 05:06:08 +00008953bgp_show_rsclient_summary (struct vty *vty, struct bgp *bgp,
8954 afi_t afi, safi_t safi)
paulfee0f4c2004-09-13 05:12:46 +00008955{
8956 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00008957 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00008958 int count = 0;
8959
8960 /* Header string for each address family. */
Milan Kociancb4fc592014-12-01 12:48:25 +00008961 static char header[] = "Neighbor V AS Export-Policy Import-Policy Up/Down State";
paulfee0f4c2004-09-13 05:12:46 +00008962
paul1eb8ef22005-04-07 07:30:20 +00008963 for (ALL_LIST_ELEMENTS (bgp->rsclient, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00008964 {
8965 if (peer->afc[afi][safi] &&
8966 CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT))
8967 {
8968 if (! count)
8969 {
8970 vty_out (vty,
8971 "Route Server's BGP router identifier %s%s",
8972 inet_ntoa (bgp->router_id), VTY_NEWLINE);
8973 vty_out (vty,
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04008974 "Route Server's local AS number %u%s", bgp->as,
paulfee0f4c2004-09-13 05:12:46 +00008975 VTY_NEWLINE);
8976
8977 vty_out (vty, "%s", VTY_NEWLINE);
8978 vty_out (vty, "%s%s", header, VTY_NEWLINE);
8979 }
8980
8981 count += bgp_write_rsclient_summary (vty, peer, afi, safi);
8982 }
8983 }
8984
8985 if (count)
8986 vty_out (vty, "%sTotal number of Route Server Clients %d%s", VTY_NEWLINE,
8987 count, VTY_NEWLINE);
8988 else
8989 vty_out (vty, "No %s Route Server Client is configured%s",
8990 afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE);
8991
8992 return CMD_SUCCESS;
8993}
8994
paul94f2b392005-06-28 12:44:16 +00008995static int
paulfd79ac92004-10-13 05:06:08 +00008996bgp_show_rsclient_summary_vty (struct vty *vty, const char *name,
8997 afi_t afi, safi_t safi)
paulfee0f4c2004-09-13 05:12:46 +00008998{
8999 struct bgp *bgp;
9000
9001 if (name)
9002 {
9003 bgp = bgp_lookup_by_name (name);
9004
9005 if (! bgp)
9006 {
9007 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
9008 return CMD_WARNING;
9009 }
9010
9011 bgp_show_rsclient_summary (vty, bgp, afi, safi);
9012 return CMD_SUCCESS;
9013 }
9014
9015 bgp = bgp_get_default ();
9016
9017 if (bgp)
9018 bgp_show_rsclient_summary (vty, bgp, afi, safi);
9019
9020 return CMD_SUCCESS;
9021}
9022
9023/* 'show bgp rsclient' commands. */
Lou Bergerf9b6c392016-01-12 13:42:09 -05009024DEFUN (show_ip_bgp_rsclient_summary,
9025 show_ip_bgp_rsclient_summary_cmd,
9026 "show ip bgp rsclient summary",
9027 SHOW_STR
9028 IP_STR
9029 BGP_STR
9030 "Information about Route Server Clients\n"
9031 "Summary of all Route Server Clients\n")
9032{
9033 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
9034}
9035
9036DEFUN (show_ip_bgp_instance_rsclient_summary,
9037 show_ip_bgp_instance_rsclient_summary_cmd,
9038 "show ip bgp view WORD rsclient summary",
9039 SHOW_STR
9040 IP_STR
9041 BGP_STR
9042 "BGP view\n"
9043 "View name\n"
9044 "Information about Route Server Clients\n"
9045 "Summary of all Route Server Clients\n")
9046{
9047 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
9048}
9049
9050DEFUN (show_ip_bgp_ipv4_rsclient_summary,
9051 show_ip_bgp_ipv4_rsclient_summary_cmd,
9052 "show ip bgp ipv4 (unicast|multicast) rsclient summary",
9053 SHOW_STR
9054 IP_STR
9055 BGP_STR
9056 "Address family\n"
9057 "Address Family modifier\n"
9058 "Address Family modifier\n"
9059 "Information about Route Server Clients\n"
9060 "Summary of all Route Server Clients\n")
9061{
9062 if (strncmp (argv[0], "m", 1) == 0)
9063 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
9064
9065 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
9066}
9067
9068DEFUN (show_ip_bgp_instance_ipv4_rsclient_summary,
9069 show_ip_bgp_instance_ipv4_rsclient_summary_cmd,
9070 "show ip bgp view WORD ipv4 (unicast|multicast) rsclient summary",
9071 SHOW_STR
9072 IP_STR
9073 BGP_STR
9074 "BGP view\n"
9075 "View name\n"
9076 "Address family\n"
9077 "Address Family modifier\n"
9078 "Address Family modifier\n"
9079 "Information about Route Server Clients\n"
9080 "Summary of all Route Server Clients\n")
9081{
9082 if (strncmp (argv[1], "m", 1) == 0)
9083 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
9084
9085 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
9086}
paulfee0f4c2004-09-13 05:12:46 +00009087
Michael Lambert95cbbd22010-07-23 14:43:04 -04009088DEFUN (show_bgp_instance_ipv4_safi_rsclient_summary,
9089 show_bgp_instance_ipv4_safi_rsclient_summary_cmd,
9090 "show bgp view WORD ipv4 (unicast|multicast) rsclient summary",
9091 SHOW_STR
9092 BGP_STR
9093 "BGP view\n"
9094 "View name\n"
9095 "Address family\n"
9096 "Address Family modifier\n"
9097 "Address Family modifier\n"
9098 "Information about Route Server Clients\n"
9099 "Summary of all Route Server Clients\n")
9100{
9101 safi_t safi;
9102
9103 if (argc == 2) {
9104 safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
9105 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, safi);
9106 } else {
9107 safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
9108 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, safi);
9109 }
9110}
9111
9112ALIAS (show_bgp_instance_ipv4_safi_rsclient_summary,
9113 show_bgp_ipv4_safi_rsclient_summary_cmd,
9114 "show bgp ipv4 (unicast|multicast) rsclient summary",
9115 SHOW_STR
9116 BGP_STR
9117 "Address family\n"
9118 "Address Family modifier\n"
9119 "Address Family modifier\n"
9120 "Information about Route Server Clients\n"
9121 "Summary of all Route Server Clients\n")
9122
paulfee0f4c2004-09-13 05:12:46 +00009123DEFUN (show_bgp_rsclient_summary,
9124 show_bgp_rsclient_summary_cmd,
9125 "show bgp rsclient summary",
9126 SHOW_STR
9127 BGP_STR
9128 "Information about Route Server Clients\n"
9129 "Summary of all Route Server Clients\n")
9130{
Lou Berger651b4022016-01-12 13:42:07 -05009131 vty_out(vty, "%sIPv4 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9132 vty_out(vty, "---------------------%s", VTY_NEWLINE);
9133 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
9134 vty_out(vty, "%sIPv4 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9135 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
9136 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
9137 vty_out(vty, "%sIPv4 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9138 vty_out(vty, "-----------------%s", VTY_NEWLINE);
9139 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
9140 vty_out(vty, "%sIPv4 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9141 vty_out(vty, "-------------------%s", VTY_NEWLINE);
9142 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_ENCAP);
9143
Lou Berger651b4022016-01-12 13:42:07 -05009144 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9145 vty_out(vty, "---------------------%s", VTY_NEWLINE);
9146 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
9147 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9148 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
9149 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
9150 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9151 vty_out(vty, "-----------------%s", VTY_NEWLINE);
9152 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_MPLS_VPN);
9153 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9154 vty_out(vty, "-------------------%s", VTY_NEWLINE);
9155 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_ENCAP);
Lou Berger205e6742016-01-12 13:42:11 -05009156
Lou Berger651b4022016-01-12 13:42:07 -05009157 return CMD_SUCCESS;
paulfee0f4c2004-09-13 05:12:46 +00009158}
9159
9160DEFUN (show_bgp_instance_rsclient_summary,
9161 show_bgp_instance_rsclient_summary_cmd,
9162 "show bgp view WORD rsclient summary",
9163 SHOW_STR
9164 BGP_STR
9165 "BGP view\n"
9166 "View name\n"
9167 "Information about Route Server Clients\n"
9168 "Summary of all Route Server Clients\n")
9169{
Lou Berger651b4022016-01-12 13:42:07 -05009170 vty_out(vty, "%sIPv4 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9171 vty_out(vty, "---------------------%s", VTY_NEWLINE);
9172 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
9173 vty_out(vty, "%sIPv4 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9174 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
9175 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
9176 vty_out(vty, "%sIPv4 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9177 vty_out(vty, "-----------------%s", VTY_NEWLINE);
9178 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_MPLS_VPN);
9179 vty_out(vty, "%sIPv4 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9180 vty_out(vty, "-------------------%s", VTY_NEWLINE);
9181 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_ENCAP);
9182
Lou Berger651b4022016-01-12 13:42:07 -05009183 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9184 vty_out(vty, "---------------------%s", VTY_NEWLINE);
9185 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
9186 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9187 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
9188 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST);
9189 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9190 vty_out(vty, "-----------------%s", VTY_NEWLINE);
9191 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_MPLS_VPN);
9192 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9193 vty_out(vty, "-------------------%s", VTY_NEWLINE);
9194 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_ENCAP);
Lou Berger205e6742016-01-12 13:42:11 -05009195
Lou Berger651b4022016-01-12 13:42:07 -05009196 return CMD_SUCCESS;
paulfee0f4c2004-09-13 05:12:46 +00009197}
9198
Lou Berger651b4022016-01-12 13:42:07 -05009199DEFUN (show_bgp_ipv6_rsclient_summary,
paulfee0f4c2004-09-13 05:12:46 +00009200 show_bgp_ipv6_rsclient_summary_cmd,
9201 "show bgp ipv6 rsclient summary",
9202 SHOW_STR
9203 BGP_STR
9204 "Address family\n"
9205 "Information about Route Server Clients\n"
9206 "Summary of all Route Server Clients\n")
Lou Berger651b4022016-01-12 13:42:07 -05009207{
9208 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9209 vty_out(vty, "---------------------%s", VTY_NEWLINE);
9210 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
9211 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9212 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
9213 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
9214 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9215 vty_out(vty, "-----------------%s", VTY_NEWLINE);
9216 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_MPLS_VPN);
9217 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9218 vty_out(vty, "-------------------%s", VTY_NEWLINE);
9219 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_ENCAP);
paulfee0f4c2004-09-13 05:12:46 +00009220
Lou Berger651b4022016-01-12 13:42:07 -05009221 return CMD_SUCCESS;
9222}
9223
9224DEFUN (show_bgp_instance_ipv6_rsclient_summary,
paulfee0f4c2004-09-13 05:12:46 +00009225 show_bgp_instance_ipv6_rsclient_summary_cmd,
9226 "show bgp view WORD ipv6 rsclient summary",
9227 SHOW_STR
9228 BGP_STR
9229 "BGP view\n"
9230 "View name\n"
9231 "Address family\n"
9232 "Information about Route Server Clients\n"
9233 "Summary of all Route Server Clients\n")
Lou Berger651b4022016-01-12 13:42:07 -05009234{
9235 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9236 vty_out(vty, "---------------------%s", VTY_NEWLINE);
9237 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
9238 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9239 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
9240 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST);
9241 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9242 vty_out(vty, "-----------------%s", VTY_NEWLINE);
9243 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_MPLS_VPN);
9244 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9245 vty_out(vty, "-------------------%s", VTY_NEWLINE);
9246 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_ENCAP);
9247
9248 return CMD_SUCCESS;
9249}
Michael Lambert95cbbd22010-07-23 14:43:04 -04009250
9251DEFUN (show_bgp_instance_ipv6_safi_rsclient_summary,
9252 show_bgp_instance_ipv6_safi_rsclient_summary_cmd,
9253 "show bgp view WORD ipv6 (unicast|multicast) rsclient summary",
9254 SHOW_STR
9255 BGP_STR
9256 "BGP view\n"
9257 "View name\n"
9258 "Address family\n"
9259 "Address Family modifier\n"
9260 "Address Family modifier\n"
9261 "Information about Route Server Clients\n"
9262 "Summary of all Route Server Clients\n")
9263{
9264 safi_t safi;
9265
9266 if (argc == 2) {
9267 safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
9268 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, safi);
9269 } else {
9270 safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
9271 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, safi);
9272 }
9273}
9274
9275ALIAS (show_bgp_instance_ipv6_safi_rsclient_summary,
9276 show_bgp_ipv6_safi_rsclient_summary_cmd,
9277 "show bgp ipv6 (unicast|multicast) rsclient summary",
9278 SHOW_STR
9279 BGP_STR
Lou Berger651b4022016-01-12 13:42:07 -05009280 IPV6_STR
Michael Lambert95cbbd22010-07-23 14:43:04 -04009281 "Address Family modifier\n"
9282 "Address Family modifier\n"
9283 "Information about Route Server Clients\n"
9284 "Summary of all Route Server Clients\n")
9285
paul718e3742002-12-13 20:15:29 +00009286/* Redistribute VTY commands. */
9287
paul718e3742002-12-13 20:15:29 +00009288DEFUN (bgp_redistribute_ipv4,
9289 bgp_redistribute_ipv4_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009290 "redistribute " QUAGGA_IP_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00009291 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009292 QUAGGA_IP_REDIST_HELP_STR_BGPD)
paul718e3742002-12-13 20:15:29 +00009293{
9294 int type;
9295
David Lampartere0ca5fd2009-09-16 01:52:42 +02009296 type = proto_redistnum (AFI_IP, argv[0]);
9297 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009298 {
9299 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9300 return CMD_WARNING;
9301 }
9302 return bgp_redistribute_set (vty->index, AFI_IP, type);
9303}
9304
9305DEFUN (bgp_redistribute_ipv4_rmap,
9306 bgp_redistribute_ipv4_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009307 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00009308 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009309 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009310 "Route map reference\n"
9311 "Pointer to route-map entries\n")
9312{
9313 int type;
9314
David Lampartere0ca5fd2009-09-16 01:52:42 +02009315 type = proto_redistnum (AFI_IP, argv[0]);
9316 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009317 {
9318 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9319 return CMD_WARNING;
9320 }
9321
9322 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]);
9323 return bgp_redistribute_set (vty->index, AFI_IP, type);
9324}
9325
9326DEFUN (bgp_redistribute_ipv4_metric,
9327 bgp_redistribute_ipv4_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009328 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009329 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009330 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009331 "Metric for redistributed routes\n"
9332 "Default metric\n")
9333{
9334 int type;
9335 u_int32_t metric;
9336
David Lampartere0ca5fd2009-09-16 01:52:42 +02009337 type = proto_redistnum (AFI_IP, argv[0]);
9338 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009339 {
9340 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9341 return CMD_WARNING;
9342 }
9343 VTY_GET_INTEGER ("metric", metric, argv[1]);
9344
9345 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
9346 return bgp_redistribute_set (vty->index, AFI_IP, type);
9347}
9348
9349DEFUN (bgp_redistribute_ipv4_rmap_metric,
9350 bgp_redistribute_ipv4_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009351 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009352 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009353 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009354 "Route map reference\n"
9355 "Pointer to route-map entries\n"
9356 "Metric for redistributed routes\n"
9357 "Default metric\n")
9358{
9359 int type;
9360 u_int32_t metric;
9361
David Lampartere0ca5fd2009-09-16 01:52:42 +02009362 type = proto_redistnum (AFI_IP, argv[0]);
9363 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009364 {
9365 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9366 return CMD_WARNING;
9367 }
9368 VTY_GET_INTEGER ("metric", metric, argv[2]);
9369
9370 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]);
9371 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
9372 return bgp_redistribute_set (vty->index, AFI_IP, type);
9373}
9374
9375DEFUN (bgp_redistribute_ipv4_metric_rmap,
9376 bgp_redistribute_ipv4_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009377 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00009378 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009379 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009380 "Metric for redistributed routes\n"
9381 "Default metric\n"
9382 "Route map reference\n"
9383 "Pointer to route-map entries\n")
9384{
9385 int type;
9386 u_int32_t metric;
9387
David Lampartere0ca5fd2009-09-16 01:52:42 +02009388 type = proto_redistnum (AFI_IP, argv[0]);
9389 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009390 {
9391 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9392 return CMD_WARNING;
9393 }
9394 VTY_GET_INTEGER ("metric", metric, argv[1]);
9395
9396 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
9397 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[2]);
9398 return bgp_redistribute_set (vty->index, AFI_IP, type);
9399}
9400
9401DEFUN (no_bgp_redistribute_ipv4,
9402 no_bgp_redistribute_ipv4_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009403 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00009404 NO_STR
9405 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009406 QUAGGA_IP_REDIST_HELP_STR_BGPD)
paul718e3742002-12-13 20:15:29 +00009407{
9408 int type;
9409
David Lampartere0ca5fd2009-09-16 01:52:42 +02009410 type = proto_redistnum (AFI_IP, argv[0]);
9411 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009412 {
9413 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9414 return CMD_WARNING;
9415 }
9416
9417 return bgp_redistribute_unset (vty->index, AFI_IP, type);
9418}
9419
9420DEFUN (no_bgp_redistribute_ipv4_rmap,
9421 no_bgp_redistribute_ipv4_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009422 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00009423 NO_STR
9424 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009425 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009426 "Route map reference\n"
9427 "Pointer to route-map entries\n")
9428{
9429 int type;
9430
David Lampartere0ca5fd2009-09-16 01:52:42 +02009431 type = proto_redistnum (AFI_IP, argv[0]);
9432 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009433 {
9434 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9435 return CMD_WARNING;
9436 }
9437
9438 bgp_redistribute_routemap_unset (vty->index, AFI_IP, type);
9439 return CMD_SUCCESS;
9440}
9441
9442DEFUN (no_bgp_redistribute_ipv4_metric,
9443 no_bgp_redistribute_ipv4_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009444 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009445 NO_STR
9446 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009447 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009448 "Metric for redistributed routes\n"
9449 "Default metric\n")
9450{
9451 int type;
9452
David Lampartere0ca5fd2009-09-16 01:52:42 +02009453 type = proto_redistnum (AFI_IP, argv[0]);
9454 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009455 {
9456 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9457 return CMD_WARNING;
9458 }
9459
9460 bgp_redistribute_metric_unset (vty->index, AFI_IP, type);
9461 return CMD_SUCCESS;
9462}
9463
9464DEFUN (no_bgp_redistribute_ipv4_rmap_metric,
9465 no_bgp_redistribute_ipv4_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009466 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009467 NO_STR
9468 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009469 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009470 "Route map reference\n"
9471 "Pointer to route-map entries\n"
9472 "Metric for redistributed routes\n"
9473 "Default metric\n")
9474{
9475 int type;
9476
David Lampartere0ca5fd2009-09-16 01:52:42 +02009477 type = proto_redistnum (AFI_IP, argv[0]);
9478 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009479 {
9480 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9481 return CMD_WARNING;
9482 }
9483
9484 bgp_redistribute_metric_unset (vty->index, AFI_IP, type);
9485 bgp_redistribute_routemap_unset (vty->index, AFI_IP, type);
9486 return CMD_SUCCESS;
9487}
9488
9489ALIAS (no_bgp_redistribute_ipv4_rmap_metric,
9490 no_bgp_redistribute_ipv4_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009491 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00009492 NO_STR
9493 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009494 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009495 "Metric for redistributed routes\n"
9496 "Default metric\n"
9497 "Route map reference\n"
9498 "Pointer to route-map entries\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02009499
paul718e3742002-12-13 20:15:29 +00009500DEFUN (bgp_redistribute_ipv6,
9501 bgp_redistribute_ipv6_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009502 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00009503 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009504 QUAGGA_IP6_REDIST_HELP_STR_BGPD)
paul718e3742002-12-13 20:15:29 +00009505{
9506 int type;
9507
David Lampartere0ca5fd2009-09-16 01:52:42 +02009508 type = proto_redistnum (AFI_IP6, argv[0]);
9509 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009510 {
9511 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9512 return CMD_WARNING;
9513 }
9514
9515 return bgp_redistribute_set (vty->index, AFI_IP6, type);
9516}
9517
9518DEFUN (bgp_redistribute_ipv6_rmap,
9519 bgp_redistribute_ipv6_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009520 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00009521 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009522 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009523 "Route map reference\n"
9524 "Pointer to route-map entries\n")
9525{
9526 int type;
9527
David Lampartere0ca5fd2009-09-16 01:52:42 +02009528 type = proto_redistnum (AFI_IP6, argv[0]);
9529 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009530 {
9531 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9532 return CMD_WARNING;
9533 }
9534
9535 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]);
9536 return bgp_redistribute_set (vty->index, AFI_IP6, type);
9537}
9538
9539DEFUN (bgp_redistribute_ipv6_metric,
9540 bgp_redistribute_ipv6_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009541 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009542 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009543 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009544 "Metric for redistributed routes\n"
9545 "Default metric\n")
9546{
9547 int type;
9548 u_int32_t metric;
9549
David Lampartere0ca5fd2009-09-16 01:52:42 +02009550 type = proto_redistnum (AFI_IP6, argv[0]);
9551 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009552 {
9553 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9554 return CMD_WARNING;
9555 }
9556 VTY_GET_INTEGER ("metric", metric, argv[1]);
9557
9558 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
9559 return bgp_redistribute_set (vty->index, AFI_IP6, type);
9560}
9561
9562DEFUN (bgp_redistribute_ipv6_rmap_metric,
9563 bgp_redistribute_ipv6_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009564 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009565 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009566 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009567 "Route map reference\n"
9568 "Pointer to route-map entries\n"
9569 "Metric for redistributed routes\n"
9570 "Default metric\n")
9571{
9572 int type;
9573 u_int32_t metric;
9574
David Lampartere0ca5fd2009-09-16 01:52:42 +02009575 type = proto_redistnum (AFI_IP6, argv[0]);
9576 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009577 {
9578 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9579 return CMD_WARNING;
9580 }
9581 VTY_GET_INTEGER ("metric", metric, argv[2]);
9582
9583 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]);
9584 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
9585 return bgp_redistribute_set (vty->index, AFI_IP6, type);
9586}
9587
9588DEFUN (bgp_redistribute_ipv6_metric_rmap,
9589 bgp_redistribute_ipv6_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009590 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00009591 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009592 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009593 "Metric for redistributed routes\n"
9594 "Default metric\n"
9595 "Route map reference\n"
9596 "Pointer to route-map entries\n")
9597{
9598 int type;
9599 u_int32_t metric;
9600
David Lampartere0ca5fd2009-09-16 01:52:42 +02009601 type = proto_redistnum (AFI_IP6, argv[0]);
9602 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009603 {
9604 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9605 return CMD_WARNING;
9606 }
9607 VTY_GET_INTEGER ("metric", metric, argv[1]);
9608
9609 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
9610 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[2]);
9611 return bgp_redistribute_set (vty->index, AFI_IP6, type);
9612}
9613
9614DEFUN (no_bgp_redistribute_ipv6,
9615 no_bgp_redistribute_ipv6_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009616 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00009617 NO_STR
9618 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009619 QUAGGA_IP6_REDIST_HELP_STR_BGPD)
paul718e3742002-12-13 20:15:29 +00009620{
9621 int type;
9622
David Lampartere0ca5fd2009-09-16 01:52:42 +02009623 type = proto_redistnum (AFI_IP6, argv[0]);
9624 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009625 {
9626 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9627 return CMD_WARNING;
9628 }
9629
9630 return bgp_redistribute_unset (vty->index, AFI_IP6, type);
9631}
9632
9633DEFUN (no_bgp_redistribute_ipv6_rmap,
9634 no_bgp_redistribute_ipv6_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009635 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00009636 NO_STR
9637 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009638 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009639 "Route map reference\n"
9640 "Pointer to route-map entries\n")
9641{
9642 int type;
9643
David Lampartere0ca5fd2009-09-16 01:52:42 +02009644 type = proto_redistnum (AFI_IP6, argv[0]);
9645 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009646 {
9647 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9648 return CMD_WARNING;
9649 }
9650
9651 bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type);
9652 return CMD_SUCCESS;
9653}
9654
9655DEFUN (no_bgp_redistribute_ipv6_metric,
9656 no_bgp_redistribute_ipv6_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009657 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009658 NO_STR
9659 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009660 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009661 "Metric for redistributed routes\n"
9662 "Default metric\n")
9663{
9664 int type;
9665
David Lampartere0ca5fd2009-09-16 01:52:42 +02009666 type = proto_redistnum (AFI_IP6, argv[0]);
9667 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009668 {
9669 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9670 return CMD_WARNING;
9671 }
9672
9673 bgp_redistribute_metric_unset (vty->index, AFI_IP6, type);
9674 return CMD_SUCCESS;
9675}
9676
9677DEFUN (no_bgp_redistribute_ipv6_rmap_metric,
9678 no_bgp_redistribute_ipv6_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009679 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009680 NO_STR
9681 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009682 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009683 "Route map reference\n"
9684 "Pointer to route-map entries\n"
9685 "Metric for redistributed routes\n"
9686 "Default metric\n")
9687{
9688 int type;
9689
David Lampartere0ca5fd2009-09-16 01:52:42 +02009690 type = proto_redistnum (AFI_IP6, argv[0]);
9691 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009692 {
9693 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9694 return CMD_WARNING;
9695 }
9696
9697 bgp_redistribute_metric_unset (vty->index, AFI_IP6, type);
9698 bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type);
9699 return CMD_SUCCESS;
9700}
9701
9702ALIAS (no_bgp_redistribute_ipv6_rmap_metric,
9703 no_bgp_redistribute_ipv6_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009704 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00009705 NO_STR
9706 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009707 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009708 "Metric for redistributed routes\n"
9709 "Default metric\n"
9710 "Route map reference\n"
9711 "Pointer to route-map entries\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02009712
paul718e3742002-12-13 20:15:29 +00009713int
9714bgp_config_write_redistribute (struct vty *vty, struct bgp *bgp, afi_t afi,
9715 safi_t safi, int *write)
9716{
9717 int i;
paul718e3742002-12-13 20:15:29 +00009718
9719 /* Unicast redistribution only. */
9720 if (safi != SAFI_UNICAST)
9721 return 0;
9722
9723 for (i = 0; i < ZEBRA_ROUTE_MAX; i++)
9724 {
9725 /* Redistribute BGP does not make sense. */
9726 if (bgp->redist[afi][i] && i != ZEBRA_ROUTE_BGP)
9727 {
9728 /* Display "address-family" when it is not yet diplayed. */
9729 bgp_config_write_family_header (vty, afi, safi, write);
9730
9731 /* "redistribute" configuration. */
ajsf52d13c2005-10-01 17:38:06 +00009732 vty_out (vty, " redistribute %s", zebra_route_string(i));
paul718e3742002-12-13 20:15:29 +00009733
9734 if (bgp->redist_metric_flag[afi][i])
Jorge Boncompte [DTI2]ddc943d2012-04-13 13:46:07 +02009735 vty_out (vty, " metric %u", bgp->redist_metric[afi][i]);
paul718e3742002-12-13 20:15:29 +00009736
9737 if (bgp->rmap[afi][i].name)
9738 vty_out (vty, " route-map %s", bgp->rmap[afi][i].name);
9739
9740 vty_out (vty, "%s", VTY_NEWLINE);
9741 }
9742 }
9743 return *write;
9744}
David Lamparter6b0655a2014-06-04 06:53:35 +02009745
paul718e3742002-12-13 20:15:29 +00009746/* BGP node structure. */
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009747static struct cmd_node bgp_node =
paul718e3742002-12-13 20:15:29 +00009748{
9749 BGP_NODE,
9750 "%s(config-router)# ",
9751 1,
9752};
9753
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009754static struct cmd_node bgp_ipv4_unicast_node =
paul718e3742002-12-13 20:15:29 +00009755{
9756 BGP_IPV4_NODE,
9757 "%s(config-router-af)# ",
9758 1,
9759};
9760
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009761static struct cmd_node bgp_ipv4_multicast_node =
paul718e3742002-12-13 20:15:29 +00009762{
9763 BGP_IPV4M_NODE,
9764 "%s(config-router-af)# ",
9765 1,
9766};
9767
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009768static struct cmd_node bgp_ipv6_unicast_node =
paul718e3742002-12-13 20:15:29 +00009769{
9770 BGP_IPV6_NODE,
9771 "%s(config-router-af)# ",
9772 1,
9773};
9774
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009775static struct cmd_node bgp_ipv6_multicast_node =
paul25ffbdc2005-08-22 22:42:08 +00009776{
9777 BGP_IPV6M_NODE,
9778 "%s(config-router-af)# ",
9779 1,
9780};
9781
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009782static struct cmd_node bgp_vpnv4_node =
paul718e3742002-12-13 20:15:29 +00009783{
9784 BGP_VPNV4_NODE,
9785 "%s(config-router-af)# ",
9786 1
9787};
David Lamparter6b0655a2014-06-04 06:53:35 +02009788
Lou Berger13c378d2016-01-12 13:41:56 -05009789static struct cmd_node bgp_vpnv6_node =
9790{
9791 BGP_VPNV6_NODE,
9792 "%s(config-router-af-vpnv6)# ",
9793 1
9794};
9795
Lou Bergera3fda882016-01-12 13:42:04 -05009796static struct cmd_node bgp_encap_node =
9797{
9798 BGP_ENCAP_NODE,
9799 "%s(config-router-af-encap)# ",
9800 1
9801};
9802
9803static struct cmd_node bgp_encapv6_node =
9804{
9805 BGP_ENCAPV6_NODE,
9806 "%s(config-router-af-encapv6)# ",
9807 1
9808};
9809
paul1f8ae702005-09-09 23:49:49 +00009810static void community_list_vty (void);
9811
paul718e3742002-12-13 20:15:29 +00009812void
paul94f2b392005-06-28 12:44:16 +00009813bgp_vty_init (void)
paul718e3742002-12-13 20:15:29 +00009814{
paul718e3742002-12-13 20:15:29 +00009815 /* Install bgp top node. */
9816 install_node (&bgp_node, bgp_config_write);
9817 install_node (&bgp_ipv4_unicast_node, NULL);
9818 install_node (&bgp_ipv4_multicast_node, NULL);
9819 install_node (&bgp_ipv6_unicast_node, NULL);
paul25ffbdc2005-08-22 22:42:08 +00009820 install_node (&bgp_ipv6_multicast_node, NULL);
paul718e3742002-12-13 20:15:29 +00009821 install_node (&bgp_vpnv4_node, NULL);
Lou Berger13c378d2016-01-12 13:41:56 -05009822 install_node (&bgp_vpnv6_node, NULL);
Lou Bergera3fda882016-01-12 13:42:04 -05009823 install_node (&bgp_encap_node, NULL);
9824 install_node (&bgp_encapv6_node, NULL);
paul718e3742002-12-13 20:15:29 +00009825
9826 /* Install default VTY commands to new nodes. */
9827 install_default (BGP_NODE);
9828 install_default (BGP_IPV4_NODE);
9829 install_default (BGP_IPV4M_NODE);
9830 install_default (BGP_IPV6_NODE);
paul25ffbdc2005-08-22 22:42:08 +00009831 install_default (BGP_IPV6M_NODE);
paul718e3742002-12-13 20:15:29 +00009832 install_default (BGP_VPNV4_NODE);
Lou Berger13c378d2016-01-12 13:41:56 -05009833 install_default (BGP_VPNV6_NODE);
Lou Bergera3fda882016-01-12 13:42:04 -05009834 install_default (BGP_ENCAP_NODE);
9835 install_default (BGP_ENCAPV6_NODE);
paul718e3742002-12-13 20:15:29 +00009836
9837 /* "bgp multiple-instance" commands. */
9838 install_element (CONFIG_NODE, &bgp_multiple_instance_cmd);
9839 install_element (CONFIG_NODE, &no_bgp_multiple_instance_cmd);
9840
9841 /* "bgp config-type" commands. */
9842 install_element (CONFIG_NODE, &bgp_config_type_cmd);
9843 install_element (CONFIG_NODE, &no_bgp_config_type_cmd);
9844
9845 /* Dummy commands (Currently not supported) */
9846 install_element (BGP_NODE, &no_synchronization_cmd);
9847 install_element (BGP_NODE, &no_auto_summary_cmd);
9848
9849 /* "router bgp" commands. */
9850 install_element (CONFIG_NODE, &router_bgp_cmd);
9851 install_element (CONFIG_NODE, &router_bgp_view_cmd);
9852
9853 /* "no router bgp" commands. */
9854 install_element (CONFIG_NODE, &no_router_bgp_cmd);
9855 install_element (CONFIG_NODE, &no_router_bgp_view_cmd);
9856
9857 /* "bgp router-id" commands. */
9858 install_element (BGP_NODE, &bgp_router_id_cmd);
9859 install_element (BGP_NODE, &no_bgp_router_id_cmd);
9860 install_element (BGP_NODE, &no_bgp_router_id_val_cmd);
9861
9862 /* "bgp cluster-id" commands. */
9863 install_element (BGP_NODE, &bgp_cluster_id_cmd);
9864 install_element (BGP_NODE, &bgp_cluster_id32_cmd);
9865 install_element (BGP_NODE, &no_bgp_cluster_id_cmd);
9866 install_element (BGP_NODE, &no_bgp_cluster_id_arg_cmd);
9867
9868 /* "bgp confederation" commands. */
9869 install_element (BGP_NODE, &bgp_confederation_identifier_cmd);
9870 install_element (BGP_NODE, &no_bgp_confederation_identifier_cmd);
9871 install_element (BGP_NODE, &no_bgp_confederation_identifier_arg_cmd);
9872
9873 /* "bgp confederation peers" commands. */
9874 install_element (BGP_NODE, &bgp_confederation_peers_cmd);
9875 install_element (BGP_NODE, &no_bgp_confederation_peers_cmd);
9876
Josh Bailey165b5ff2011-07-20 20:43:22 -07009877 /* "maximum-paths" commands. */
9878 install_element (BGP_NODE, &bgp_maxpaths_cmd);
9879 install_element (BGP_NODE, &no_bgp_maxpaths_cmd);
9880 install_element (BGP_NODE, &no_bgp_maxpaths_arg_cmd);
9881 install_element (BGP_IPV4_NODE, &bgp_maxpaths_cmd);
9882 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_cmd);
9883 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_arg_cmd);
9884 install_element (BGP_NODE, &bgp_maxpaths_ibgp_cmd);
9885 install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_cmd);
9886 install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_arg_cmd);
9887 install_element (BGP_IPV4_NODE, &bgp_maxpaths_ibgp_cmd);
9888 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_cmd);
9889 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_arg_cmd);
9890
paul718e3742002-12-13 20:15:29 +00009891 /* "timers bgp" commands. */
9892 install_element (BGP_NODE, &bgp_timers_cmd);
9893 install_element (BGP_NODE, &no_bgp_timers_cmd);
9894 install_element (BGP_NODE, &no_bgp_timers_arg_cmd);
9895
9896 /* "bgp client-to-client reflection" commands */
9897 install_element (BGP_NODE, &no_bgp_client_to_client_reflection_cmd);
9898 install_element (BGP_NODE, &bgp_client_to_client_reflection_cmd);
9899
9900 /* "bgp always-compare-med" commands */
9901 install_element (BGP_NODE, &bgp_always_compare_med_cmd);
9902 install_element (BGP_NODE, &no_bgp_always_compare_med_cmd);
9903
9904 /* "bgp deterministic-med" commands */
9905 install_element (BGP_NODE, &bgp_deterministic_med_cmd);
9906 install_element (BGP_NODE, &no_bgp_deterministic_med_cmd);
hasso538621f2004-05-21 09:31:30 +00009907
hasso538621f2004-05-21 09:31:30 +00009908 /* "bgp graceful-restart" commands */
9909 install_element (BGP_NODE, &bgp_graceful_restart_cmd);
9910 install_element (BGP_NODE, &no_bgp_graceful_restart_cmd);
hasso93406d82005-02-02 14:40:33 +00009911 install_element (BGP_NODE, &bgp_graceful_restart_stalepath_time_cmd);
9912 install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_cmd);
9913 install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_val_cmd);
paul718e3742002-12-13 20:15:29 +00009914
9915 /* "bgp fast-external-failover" commands */
9916 install_element (BGP_NODE, &bgp_fast_external_failover_cmd);
9917 install_element (BGP_NODE, &no_bgp_fast_external_failover_cmd);
9918
9919 /* "bgp enforce-first-as" commands */
9920 install_element (BGP_NODE, &bgp_enforce_first_as_cmd);
9921 install_element (BGP_NODE, &no_bgp_enforce_first_as_cmd);
9922
9923 /* "bgp bestpath compare-routerid" commands */
9924 install_element (BGP_NODE, &bgp_bestpath_compare_router_id_cmd);
9925 install_element (BGP_NODE, &no_bgp_bestpath_compare_router_id_cmd);
9926
9927 /* "bgp bestpath as-path ignore" commands */
9928 install_element (BGP_NODE, &bgp_bestpath_aspath_ignore_cmd);
9929 install_element (BGP_NODE, &no_bgp_bestpath_aspath_ignore_cmd);
9930
hasso68118452005-04-08 15:40:36 +00009931 /* "bgp bestpath as-path confed" commands */
9932 install_element (BGP_NODE, &bgp_bestpath_aspath_confed_cmd);
9933 install_element (BGP_NODE, &no_bgp_bestpath_aspath_confed_cmd);
9934
Pradosh Mohapatra2fdd4552013-09-07 07:02:36 +00009935 /* "bgp bestpath as-path multipath-relax" commands */
9936 install_element (BGP_NODE, &bgp_bestpath_aspath_multipath_relax_cmd);
9937 install_element (BGP_NODE, &no_bgp_bestpath_aspath_multipath_relax_cmd);
9938
paul848973c2003-08-13 00:32:49 +00009939 /* "bgp log-neighbor-changes" commands */
9940 install_element (BGP_NODE, &bgp_log_neighbor_changes_cmd);
9941 install_element (BGP_NODE, &no_bgp_log_neighbor_changes_cmd);
9942
paul718e3742002-12-13 20:15:29 +00009943 /* "bgp bestpath med" commands */
9944 install_element (BGP_NODE, &bgp_bestpath_med_cmd);
9945 install_element (BGP_NODE, &bgp_bestpath_med2_cmd);
9946 install_element (BGP_NODE, &bgp_bestpath_med3_cmd);
9947 install_element (BGP_NODE, &no_bgp_bestpath_med_cmd);
9948 install_element (BGP_NODE, &no_bgp_bestpath_med2_cmd);
9949 install_element (BGP_NODE, &no_bgp_bestpath_med3_cmd);
9950
9951 /* "no bgp default ipv4-unicast" commands. */
9952 install_element (BGP_NODE, &no_bgp_default_ipv4_unicast_cmd);
9953 install_element (BGP_NODE, &bgp_default_ipv4_unicast_cmd);
9954
9955 /* "bgp network import-check" commands. */
9956 install_element (BGP_NODE, &bgp_network_import_check_cmd);
9957 install_element (BGP_NODE, &no_bgp_network_import_check_cmd);
9958
9959 /* "bgp default local-preference" commands. */
9960 install_element (BGP_NODE, &bgp_default_local_preference_cmd);
9961 install_element (BGP_NODE, &no_bgp_default_local_preference_cmd);
9962 install_element (BGP_NODE, &no_bgp_default_local_preference_val_cmd);
9963
9964 /* "neighbor remote-as" commands. */
9965 install_element (BGP_NODE, &neighbor_remote_as_cmd);
9966 install_element (BGP_NODE, &no_neighbor_cmd);
9967 install_element (BGP_NODE, &no_neighbor_remote_as_cmd);
9968
9969 /* "neighbor peer-group" commands. */
9970 install_element (BGP_NODE, &neighbor_peer_group_cmd);
9971 install_element (BGP_NODE, &no_neighbor_peer_group_cmd);
9972 install_element (BGP_NODE, &no_neighbor_peer_group_remote_as_cmd);
9973
9974 /* "neighbor local-as" commands. */
9975 install_element (BGP_NODE, &neighbor_local_as_cmd);
9976 install_element (BGP_NODE, &neighbor_local_as_no_prepend_cmd);
Andrew Certain9d3f9702012-11-07 23:50:07 +00009977 install_element (BGP_NODE, &neighbor_local_as_no_prepend_replace_as_cmd);
paul718e3742002-12-13 20:15:29 +00009978 install_element (BGP_NODE, &no_neighbor_local_as_cmd);
9979 install_element (BGP_NODE, &no_neighbor_local_as_val_cmd);
9980 install_element (BGP_NODE, &no_neighbor_local_as_val2_cmd);
Andrew Certain9d3f9702012-11-07 23:50:07 +00009981 install_element (BGP_NODE, &no_neighbor_local_as_val3_cmd);
paul718e3742002-12-13 20:15:29 +00009982
Paul Jakma0df7c912008-07-21 21:02:49 +00009983 /* "neighbor password" commands. */
9984 install_element (BGP_NODE, &neighbor_password_cmd);
9985 install_element (BGP_NODE, &no_neighbor_password_cmd);
9986
paul718e3742002-12-13 20:15:29 +00009987 /* "neighbor activate" commands. */
9988 install_element (BGP_NODE, &neighbor_activate_cmd);
9989 install_element (BGP_IPV4_NODE, &neighbor_activate_cmd);
9990 install_element (BGP_IPV4M_NODE, &neighbor_activate_cmd);
9991 install_element (BGP_IPV6_NODE, &neighbor_activate_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009992 install_element (BGP_IPV6M_NODE, &neighbor_activate_cmd);
paul718e3742002-12-13 20:15:29 +00009993 install_element (BGP_VPNV4_NODE, &neighbor_activate_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -05009994 install_element (BGP_VPNV6_NODE, &neighbor_activate_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -05009995 install_element (BGP_ENCAP_NODE, &neighbor_activate_cmd);
9996 install_element (BGP_ENCAPV6_NODE, &neighbor_activate_cmd);
paul718e3742002-12-13 20:15:29 +00009997
9998 /* "no neighbor activate" commands. */
9999 install_element (BGP_NODE, &no_neighbor_activate_cmd);
10000 install_element (BGP_IPV4_NODE, &no_neighbor_activate_cmd);
10001 install_element (BGP_IPV4M_NODE, &no_neighbor_activate_cmd);
10002 install_element (BGP_IPV6_NODE, &no_neighbor_activate_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010003 install_element (BGP_IPV6M_NODE, &no_neighbor_activate_cmd);
paul718e3742002-12-13 20:15:29 +000010004 install_element (BGP_VPNV4_NODE, &no_neighbor_activate_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010005 install_element (BGP_VPNV6_NODE, &no_neighbor_activate_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010006 install_element (BGP_ENCAP_NODE, &no_neighbor_activate_cmd);
10007 install_element (BGP_ENCAPV6_NODE, &no_neighbor_activate_cmd);
paul718e3742002-12-13 20:15:29 +000010008
10009 /* "neighbor peer-group set" commands. */
10010 install_element (BGP_NODE, &neighbor_set_peer_group_cmd);
10011 install_element (BGP_IPV4_NODE, &neighbor_set_peer_group_cmd);
10012 install_element (BGP_IPV4M_NODE, &neighbor_set_peer_group_cmd);
10013 install_element (BGP_IPV6_NODE, &neighbor_set_peer_group_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010014 install_element (BGP_IPV6M_NODE, &neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +000010015 install_element (BGP_VPNV4_NODE, &neighbor_set_peer_group_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010016 install_element (BGP_VPNV6_NODE, &neighbor_set_peer_group_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010017 install_element (BGP_ENCAP_NODE, &neighbor_set_peer_group_cmd);
10018 install_element (BGP_ENCAPV6_NODE, &neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +000010019
paul718e3742002-12-13 20:15:29 +000010020 /* "no neighbor peer-group unset" commands. */
10021 install_element (BGP_NODE, &no_neighbor_set_peer_group_cmd);
10022 install_element (BGP_IPV4_NODE, &no_neighbor_set_peer_group_cmd);
10023 install_element (BGP_IPV4M_NODE, &no_neighbor_set_peer_group_cmd);
10024 install_element (BGP_IPV6_NODE, &no_neighbor_set_peer_group_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010025 install_element (BGP_IPV6M_NODE, &no_neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +000010026 install_element (BGP_VPNV4_NODE, &no_neighbor_set_peer_group_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010027 install_element (BGP_VPNV6_NODE, &no_neighbor_set_peer_group_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010028 install_element (BGP_ENCAP_NODE, &no_neighbor_set_peer_group_cmd);
10029 install_element (BGP_ENCAPV6_NODE, &no_neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +000010030
paul718e3742002-12-13 20:15:29 +000010031 /* "neighbor softreconfiguration inbound" commands.*/
10032 install_element (BGP_NODE, &neighbor_soft_reconfiguration_cmd);
10033 install_element (BGP_NODE, &no_neighbor_soft_reconfiguration_cmd);
10034 install_element (BGP_IPV4_NODE, &neighbor_soft_reconfiguration_cmd);
10035 install_element (BGP_IPV4_NODE, &no_neighbor_soft_reconfiguration_cmd);
10036 install_element (BGP_IPV4M_NODE, &neighbor_soft_reconfiguration_cmd);
10037 install_element (BGP_IPV4M_NODE, &no_neighbor_soft_reconfiguration_cmd);
10038 install_element (BGP_IPV6_NODE, &neighbor_soft_reconfiguration_cmd);
10039 install_element (BGP_IPV6_NODE, &no_neighbor_soft_reconfiguration_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010040 install_element (BGP_IPV6M_NODE, &neighbor_soft_reconfiguration_cmd);
10041 install_element (BGP_IPV6M_NODE, &no_neighbor_soft_reconfiguration_cmd);
paula58545b2003-07-12 21:43:01 +000010042 install_element (BGP_VPNV4_NODE, &neighbor_soft_reconfiguration_cmd);
10043 install_element (BGP_VPNV4_NODE, &no_neighbor_soft_reconfiguration_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010044 install_element (BGP_VPNV6_NODE, &neighbor_soft_reconfiguration_cmd);
10045 install_element (BGP_VPNV6_NODE, &no_neighbor_soft_reconfiguration_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010046 install_element (BGP_ENCAP_NODE, &neighbor_soft_reconfiguration_cmd);
10047 install_element (BGP_ENCAP_NODE, &no_neighbor_soft_reconfiguration_cmd);
10048 install_element (BGP_ENCAPV6_NODE, &neighbor_soft_reconfiguration_cmd);
10049 install_element (BGP_ENCAPV6_NODE, &no_neighbor_soft_reconfiguration_cmd);
paul718e3742002-12-13 20:15:29 +000010050
10051 /* "neighbor attribute-unchanged" commands. */
10052 install_element (BGP_NODE, &neighbor_attr_unchanged_cmd);
10053 install_element (BGP_NODE, &neighbor_attr_unchanged1_cmd);
10054 install_element (BGP_NODE, &neighbor_attr_unchanged2_cmd);
10055 install_element (BGP_NODE, &neighbor_attr_unchanged3_cmd);
10056 install_element (BGP_NODE, &neighbor_attr_unchanged4_cmd);
10057 install_element (BGP_NODE, &neighbor_attr_unchanged5_cmd);
10058 install_element (BGP_NODE, &neighbor_attr_unchanged6_cmd);
10059 install_element (BGP_NODE, &neighbor_attr_unchanged7_cmd);
10060 install_element (BGP_NODE, &neighbor_attr_unchanged8_cmd);
10061 install_element (BGP_NODE, &neighbor_attr_unchanged9_cmd);
10062 install_element (BGP_NODE, &neighbor_attr_unchanged10_cmd);
10063 install_element (BGP_NODE, &no_neighbor_attr_unchanged_cmd);
10064 install_element (BGP_NODE, &no_neighbor_attr_unchanged1_cmd);
10065 install_element (BGP_NODE, &no_neighbor_attr_unchanged2_cmd);
10066 install_element (BGP_NODE, &no_neighbor_attr_unchanged3_cmd);
10067 install_element (BGP_NODE, &no_neighbor_attr_unchanged4_cmd);
10068 install_element (BGP_NODE, &no_neighbor_attr_unchanged5_cmd);
10069 install_element (BGP_NODE, &no_neighbor_attr_unchanged6_cmd);
10070 install_element (BGP_NODE, &no_neighbor_attr_unchanged7_cmd);
10071 install_element (BGP_NODE, &no_neighbor_attr_unchanged8_cmd);
10072 install_element (BGP_NODE, &no_neighbor_attr_unchanged9_cmd);
10073 install_element (BGP_NODE, &no_neighbor_attr_unchanged10_cmd);
10074 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged_cmd);
10075 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged1_cmd);
10076 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged2_cmd);
10077 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged3_cmd);
10078 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged4_cmd);
10079 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged5_cmd);
10080 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged6_cmd);
10081 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged7_cmd);
10082 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged8_cmd);
10083 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged9_cmd);
10084 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged10_cmd);
10085 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged_cmd);
10086 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged1_cmd);
10087 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged2_cmd);
10088 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged3_cmd);
10089 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged4_cmd);
10090 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged5_cmd);
10091 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged6_cmd);
10092 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged7_cmd);
10093 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged8_cmd);
10094 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged9_cmd);
10095 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged10_cmd);
10096 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged_cmd);
10097 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged1_cmd);
10098 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged2_cmd);
10099 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged3_cmd);
10100 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged4_cmd);
10101 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged5_cmd);
10102 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged6_cmd);
10103 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged7_cmd);
10104 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged8_cmd);
10105 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged9_cmd);
10106 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged10_cmd);
10107 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged_cmd);
10108 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged1_cmd);
10109 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged2_cmd);
10110 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged3_cmd);
10111 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged4_cmd);
10112 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged5_cmd);
10113 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged6_cmd);
10114 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged7_cmd);
10115 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged8_cmd);
10116 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged9_cmd);
10117 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged10_cmd);
10118 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged_cmd);
10119 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged1_cmd);
10120 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged2_cmd);
10121 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged3_cmd);
10122 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged4_cmd);
10123 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged5_cmd);
10124 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged6_cmd);
10125 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged7_cmd);
10126 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged8_cmd);
10127 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged9_cmd);
10128 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged10_cmd);
10129 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged_cmd);
10130 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged1_cmd);
10131 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged2_cmd);
10132 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged3_cmd);
10133 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged4_cmd);
10134 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged5_cmd);
10135 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged6_cmd);
10136 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged7_cmd);
10137 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged8_cmd);
10138 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged9_cmd);
10139 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged10_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010140 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged_cmd);
10141 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged1_cmd);
10142 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged2_cmd);
10143 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged3_cmd);
10144 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged4_cmd);
10145 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged5_cmd);
10146 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged6_cmd);
10147 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged7_cmd);
10148 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged8_cmd);
10149 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged9_cmd);
10150 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged10_cmd);
10151 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged_cmd);
10152 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged1_cmd);
10153 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged2_cmd);
10154 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged3_cmd);
10155 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged4_cmd);
10156 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged5_cmd);
10157 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged6_cmd);
10158 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged7_cmd);
10159 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged8_cmd);
10160 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged9_cmd);
10161 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged10_cmd);
paul718e3742002-12-13 20:15:29 +000010162 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged_cmd);
10163 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged1_cmd);
10164 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged2_cmd);
10165 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged3_cmd);
10166 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged4_cmd);
10167 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged5_cmd);
10168 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged6_cmd);
10169 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged7_cmd);
10170 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged8_cmd);
10171 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged9_cmd);
10172 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged10_cmd);
10173 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged_cmd);
10174 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged1_cmd);
10175 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged2_cmd);
10176 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged3_cmd);
10177 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged4_cmd);
10178 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged5_cmd);
10179 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged6_cmd);
10180 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged7_cmd);
10181 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged8_cmd);
10182 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged9_cmd);
10183 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged10_cmd);
10184
Lou Berger13c378d2016-01-12 13:41:56 -050010185 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged_cmd);
10186 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged1_cmd);
10187 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged2_cmd);
10188 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged3_cmd);
10189 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged4_cmd);
10190 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged5_cmd);
10191 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged6_cmd);
10192 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged7_cmd);
10193 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged8_cmd);
10194 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged9_cmd);
10195 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged10_cmd);
10196 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged_cmd);
10197 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged1_cmd);
10198 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged2_cmd);
10199 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged3_cmd);
10200 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged4_cmd);
10201 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged5_cmd);
10202 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged6_cmd);
10203 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged7_cmd);
10204 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged8_cmd);
10205 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged9_cmd);
10206 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged10_cmd);
10207
Lou Bergera3fda882016-01-12 13:42:04 -050010208 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged_cmd);
10209 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged1_cmd);
10210 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged2_cmd);
10211 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged3_cmd);
10212 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged4_cmd);
10213 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged5_cmd);
10214 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged6_cmd);
10215 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged7_cmd);
10216 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged8_cmd);
10217 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged9_cmd);
10218 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged10_cmd);
10219 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged_cmd);
10220 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged1_cmd);
10221 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged2_cmd);
10222 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged3_cmd);
10223 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged4_cmd);
10224 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged5_cmd);
10225 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged6_cmd);
10226 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged7_cmd);
10227 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged8_cmd);
10228 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged9_cmd);
10229 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged10_cmd);
10230
10231 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged_cmd);
10232 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged1_cmd);
10233 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged2_cmd);
10234 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged3_cmd);
10235 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged4_cmd);
10236 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged5_cmd);
10237 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged6_cmd);
10238 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged7_cmd);
10239 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged8_cmd);
10240 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged9_cmd);
10241 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged10_cmd);
10242 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged_cmd);
10243 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged1_cmd);
10244 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged2_cmd);
10245 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged3_cmd);
10246 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged4_cmd);
10247 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged5_cmd);
10248 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged6_cmd);
10249 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged7_cmd);
10250 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged8_cmd);
10251 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged9_cmd);
10252 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged10_cmd);
10253
paulfee0f4c2004-09-13 05:12:46 +000010254 /* "nexthop-local unchanged" commands */
10255 install_element (BGP_IPV6_NODE, &neighbor_nexthop_local_unchanged_cmd);
10256 install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_local_unchanged_cmd);
10257
paul718e3742002-12-13 20:15:29 +000010258 /* "transparent-as" and "transparent-nexthop" for old version
10259 compatibility. */
10260 install_element (BGP_NODE, &neighbor_transparent_as_cmd);
10261 install_element (BGP_NODE, &neighbor_transparent_nexthop_cmd);
10262
10263 /* "neighbor next-hop-self" commands. */
10264 install_element (BGP_NODE, &neighbor_nexthop_self_cmd);
10265 install_element (BGP_NODE, &no_neighbor_nexthop_self_cmd);
10266 install_element (BGP_IPV4_NODE, &neighbor_nexthop_self_cmd);
10267 install_element (BGP_IPV4_NODE, &no_neighbor_nexthop_self_cmd);
10268 install_element (BGP_IPV4M_NODE, &neighbor_nexthop_self_cmd);
10269 install_element (BGP_IPV4M_NODE, &no_neighbor_nexthop_self_cmd);
10270 install_element (BGP_IPV6_NODE, &neighbor_nexthop_self_cmd);
10271 install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_self_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010272 install_element (BGP_IPV6M_NODE, &neighbor_nexthop_self_cmd);
10273 install_element (BGP_IPV6M_NODE, &no_neighbor_nexthop_self_cmd);
paul718e3742002-12-13 20:15:29 +000010274 install_element (BGP_VPNV4_NODE, &neighbor_nexthop_self_cmd);
10275 install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010276 install_element (BGP_VPNV6_NODE, &neighbor_nexthop_self_cmd);
10277 install_element (BGP_VPNV6_NODE, &no_neighbor_nexthop_self_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010278 install_element (BGP_ENCAP_NODE, &neighbor_nexthop_self_cmd);
10279 install_element (BGP_ENCAP_NODE, &no_neighbor_nexthop_self_cmd);
10280 install_element (BGP_ENCAPV6_NODE, &neighbor_nexthop_self_cmd);
10281 install_element (BGP_ENCAPV6_NODE, &no_neighbor_nexthop_self_cmd);
paul718e3742002-12-13 20:15:29 +000010282
10283 /* "neighbor remove-private-AS" commands. */
10284 install_element (BGP_NODE, &neighbor_remove_private_as_cmd);
10285 install_element (BGP_NODE, &no_neighbor_remove_private_as_cmd);
10286 install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_cmd);
10287 install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_cmd);
10288 install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_cmd);
10289 install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_cmd);
10290 install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_cmd);
10291 install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010292 install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_cmd);
10293 install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_cmd);
paul718e3742002-12-13 20:15:29 +000010294 install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_cmd);
10295 install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010296 install_element (BGP_VPNV6_NODE, &neighbor_remove_private_as_cmd);
10297 install_element (BGP_VPNV6_NODE, &no_neighbor_remove_private_as_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010298 install_element (BGP_ENCAP_NODE, &neighbor_remove_private_as_cmd);
10299 install_element (BGP_ENCAP_NODE, &no_neighbor_remove_private_as_cmd);
10300 install_element (BGP_ENCAPV6_NODE, &neighbor_remove_private_as_cmd);
10301 install_element (BGP_ENCAPV6_NODE, &no_neighbor_remove_private_as_cmd);
paul718e3742002-12-13 20:15:29 +000010302
10303 /* "neighbor send-community" commands.*/
10304 install_element (BGP_NODE, &neighbor_send_community_cmd);
10305 install_element (BGP_NODE, &neighbor_send_community_type_cmd);
10306 install_element (BGP_NODE, &no_neighbor_send_community_cmd);
10307 install_element (BGP_NODE, &no_neighbor_send_community_type_cmd);
10308 install_element (BGP_IPV4_NODE, &neighbor_send_community_cmd);
10309 install_element (BGP_IPV4_NODE, &neighbor_send_community_type_cmd);
10310 install_element (BGP_IPV4_NODE, &no_neighbor_send_community_cmd);
10311 install_element (BGP_IPV4_NODE, &no_neighbor_send_community_type_cmd);
10312 install_element (BGP_IPV4M_NODE, &neighbor_send_community_cmd);
10313 install_element (BGP_IPV4M_NODE, &neighbor_send_community_type_cmd);
10314 install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_cmd);
10315 install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_type_cmd);
10316 install_element (BGP_IPV6_NODE, &neighbor_send_community_cmd);
10317 install_element (BGP_IPV6_NODE, &neighbor_send_community_type_cmd);
10318 install_element (BGP_IPV6_NODE, &no_neighbor_send_community_cmd);
10319 install_element (BGP_IPV6_NODE, &no_neighbor_send_community_type_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010320 install_element (BGP_IPV6M_NODE, &neighbor_send_community_cmd);
10321 install_element (BGP_IPV6M_NODE, &neighbor_send_community_type_cmd);
10322 install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_cmd);
10323 install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_type_cmd);
paul718e3742002-12-13 20:15:29 +000010324 install_element (BGP_VPNV4_NODE, &neighbor_send_community_cmd);
10325 install_element (BGP_VPNV4_NODE, &neighbor_send_community_type_cmd);
10326 install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_cmd);
10327 install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_type_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010328 install_element (BGP_VPNV6_NODE, &neighbor_send_community_cmd);
10329 install_element (BGP_VPNV6_NODE, &neighbor_send_community_type_cmd);
10330 install_element (BGP_VPNV6_NODE, &no_neighbor_send_community_cmd);
10331 install_element (BGP_VPNV6_NODE, &no_neighbor_send_community_type_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010332 install_element (BGP_ENCAP_NODE, &neighbor_send_community_cmd);
10333 install_element (BGP_ENCAP_NODE, &neighbor_send_community_type_cmd);
10334 install_element (BGP_ENCAP_NODE, &no_neighbor_send_community_cmd);
10335 install_element (BGP_ENCAP_NODE, &no_neighbor_send_community_type_cmd);
10336 install_element (BGP_ENCAPV6_NODE, &neighbor_send_community_cmd);
10337 install_element (BGP_ENCAPV6_NODE, &neighbor_send_community_type_cmd);
10338 install_element (BGP_ENCAPV6_NODE, &no_neighbor_send_community_cmd);
10339 install_element (BGP_ENCAPV6_NODE, &no_neighbor_send_community_type_cmd);
paul718e3742002-12-13 20:15:29 +000010340
10341 /* "neighbor route-reflector" commands.*/
10342 install_element (BGP_NODE, &neighbor_route_reflector_client_cmd);
10343 install_element (BGP_NODE, &no_neighbor_route_reflector_client_cmd);
10344 install_element (BGP_IPV4_NODE, &neighbor_route_reflector_client_cmd);
10345 install_element (BGP_IPV4_NODE, &no_neighbor_route_reflector_client_cmd);
10346 install_element (BGP_IPV4M_NODE, &neighbor_route_reflector_client_cmd);
10347 install_element (BGP_IPV4M_NODE, &no_neighbor_route_reflector_client_cmd);
10348 install_element (BGP_IPV6_NODE, &neighbor_route_reflector_client_cmd);
10349 install_element (BGP_IPV6_NODE, &no_neighbor_route_reflector_client_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010350 install_element (BGP_IPV6M_NODE, &neighbor_route_reflector_client_cmd);
10351 install_element (BGP_IPV6M_NODE, &no_neighbor_route_reflector_client_cmd);
paul718e3742002-12-13 20:15:29 +000010352 install_element (BGP_VPNV4_NODE, &neighbor_route_reflector_client_cmd);
10353 install_element (BGP_VPNV4_NODE, &no_neighbor_route_reflector_client_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010354 install_element (BGP_VPNV6_NODE, &neighbor_route_reflector_client_cmd);
10355 install_element (BGP_VPNV6_NODE, &no_neighbor_route_reflector_client_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010356 install_element (BGP_ENCAP_NODE, &neighbor_route_reflector_client_cmd);
10357 install_element (BGP_ENCAP_NODE, &no_neighbor_route_reflector_client_cmd);
10358 install_element (BGP_ENCAPV6_NODE, &neighbor_route_reflector_client_cmd);
10359 install_element (BGP_ENCAPV6_NODE, &no_neighbor_route_reflector_client_cmd);
paul718e3742002-12-13 20:15:29 +000010360
10361 /* "neighbor route-server" commands.*/
10362 install_element (BGP_NODE, &neighbor_route_server_client_cmd);
10363 install_element (BGP_NODE, &no_neighbor_route_server_client_cmd);
10364 install_element (BGP_IPV4_NODE, &neighbor_route_server_client_cmd);
10365 install_element (BGP_IPV4_NODE, &no_neighbor_route_server_client_cmd);
10366 install_element (BGP_IPV4M_NODE, &neighbor_route_server_client_cmd);
10367 install_element (BGP_IPV4M_NODE, &no_neighbor_route_server_client_cmd);
10368 install_element (BGP_IPV6_NODE, &neighbor_route_server_client_cmd);
10369 install_element (BGP_IPV6_NODE, &no_neighbor_route_server_client_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010370 install_element (BGP_IPV6M_NODE, &neighbor_route_server_client_cmd);
10371 install_element (BGP_IPV6M_NODE, &no_neighbor_route_server_client_cmd);
paul718e3742002-12-13 20:15:29 +000010372 install_element (BGP_VPNV4_NODE, &neighbor_route_server_client_cmd);
10373 install_element (BGP_VPNV4_NODE, &no_neighbor_route_server_client_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010374 install_element (BGP_VPNV6_NODE, &neighbor_route_server_client_cmd);
10375 install_element (BGP_VPNV6_NODE, &no_neighbor_route_server_client_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010376 install_element (BGP_ENCAP_NODE, &neighbor_route_server_client_cmd);
10377 install_element (BGP_ENCAP_NODE, &no_neighbor_route_server_client_cmd);
10378 install_element (BGP_ENCAPV6_NODE, &neighbor_route_server_client_cmd);
10379 install_element (BGP_ENCAPV6_NODE, &no_neighbor_route_server_client_cmd);
paul718e3742002-12-13 20:15:29 +000010380
10381 /* "neighbor passive" commands. */
10382 install_element (BGP_NODE, &neighbor_passive_cmd);
10383 install_element (BGP_NODE, &no_neighbor_passive_cmd);
10384
10385 /* "neighbor shutdown" commands. */
10386 install_element (BGP_NODE, &neighbor_shutdown_cmd);
10387 install_element (BGP_NODE, &no_neighbor_shutdown_cmd);
10388
hassoc9502432005-02-01 22:01:48 +000010389 /* Deprecated "neighbor capability route-refresh" commands.*/
paul718e3742002-12-13 20:15:29 +000010390 install_element (BGP_NODE, &neighbor_capability_route_refresh_cmd);
10391 install_element (BGP_NODE, &no_neighbor_capability_route_refresh_cmd);
10392
10393 /* "neighbor capability orf prefix-list" commands.*/
10394 install_element (BGP_NODE, &neighbor_capability_orf_prefix_cmd);
10395 install_element (BGP_NODE, &no_neighbor_capability_orf_prefix_cmd);
10396 install_element (BGP_IPV4_NODE, &neighbor_capability_orf_prefix_cmd);
10397 install_element (BGP_IPV4_NODE, &no_neighbor_capability_orf_prefix_cmd);
10398 install_element (BGP_IPV4M_NODE, &neighbor_capability_orf_prefix_cmd);
10399 install_element (BGP_IPV4M_NODE, &no_neighbor_capability_orf_prefix_cmd);
10400 install_element (BGP_IPV6_NODE, &neighbor_capability_orf_prefix_cmd);
10401 install_element (BGP_IPV6_NODE, &no_neighbor_capability_orf_prefix_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010402 install_element (BGP_IPV6M_NODE, &neighbor_capability_orf_prefix_cmd);
10403 install_element (BGP_IPV6M_NODE, &no_neighbor_capability_orf_prefix_cmd);
paul718e3742002-12-13 20:15:29 +000010404
10405 /* "neighbor capability dynamic" commands.*/
10406 install_element (BGP_NODE, &neighbor_capability_dynamic_cmd);
10407 install_element (BGP_NODE, &no_neighbor_capability_dynamic_cmd);
10408
10409 /* "neighbor dont-capability-negotiate" commands. */
10410 install_element (BGP_NODE, &neighbor_dont_capability_negotiate_cmd);
10411 install_element (BGP_NODE, &no_neighbor_dont_capability_negotiate_cmd);
10412
10413 /* "neighbor ebgp-multihop" commands. */
10414 install_element (BGP_NODE, &neighbor_ebgp_multihop_cmd);
10415 install_element (BGP_NODE, &neighbor_ebgp_multihop_ttl_cmd);
10416 install_element (BGP_NODE, &no_neighbor_ebgp_multihop_cmd);
10417 install_element (BGP_NODE, &no_neighbor_ebgp_multihop_ttl_cmd);
10418
hasso6ffd2072005-02-02 14:50:11 +000010419 /* "neighbor disable-connected-check" commands. */
10420 install_element (BGP_NODE, &neighbor_disable_connected_check_cmd);
10421 install_element (BGP_NODE, &no_neighbor_disable_connected_check_cmd);
paul718e3742002-12-13 20:15:29 +000010422 install_element (BGP_NODE, &neighbor_enforce_multihop_cmd);
10423 install_element (BGP_NODE, &no_neighbor_enforce_multihop_cmd);
10424
10425 /* "neighbor description" commands. */
10426 install_element (BGP_NODE, &neighbor_description_cmd);
10427 install_element (BGP_NODE, &no_neighbor_description_cmd);
10428 install_element (BGP_NODE, &no_neighbor_description_val_cmd);
10429
10430 /* "neighbor update-source" commands. "*/
10431 install_element (BGP_NODE, &neighbor_update_source_cmd);
10432 install_element (BGP_NODE, &no_neighbor_update_source_cmd);
10433
10434 /* "neighbor default-originate" commands. */
10435 install_element (BGP_NODE, &neighbor_default_originate_cmd);
10436 install_element (BGP_NODE, &neighbor_default_originate_rmap_cmd);
10437 install_element (BGP_NODE, &no_neighbor_default_originate_cmd);
10438 install_element (BGP_NODE, &no_neighbor_default_originate_rmap_cmd);
10439 install_element (BGP_IPV4_NODE, &neighbor_default_originate_cmd);
10440 install_element (BGP_IPV4_NODE, &neighbor_default_originate_rmap_cmd);
10441 install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_cmd);
10442 install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_rmap_cmd);
10443 install_element (BGP_IPV4M_NODE, &neighbor_default_originate_cmd);
10444 install_element (BGP_IPV4M_NODE, &neighbor_default_originate_rmap_cmd);
10445 install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_cmd);
10446 install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_rmap_cmd);
10447 install_element (BGP_IPV6_NODE, &neighbor_default_originate_cmd);
10448 install_element (BGP_IPV6_NODE, &neighbor_default_originate_rmap_cmd);
10449 install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_cmd);
10450 install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_rmap_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010451 install_element (BGP_IPV6M_NODE, &neighbor_default_originate_cmd);
10452 install_element (BGP_IPV6M_NODE, &neighbor_default_originate_rmap_cmd);
10453 install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_cmd);
10454 install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_rmap_cmd);
paul718e3742002-12-13 20:15:29 +000010455
10456 /* "neighbor port" commands. */
10457 install_element (BGP_NODE, &neighbor_port_cmd);
10458 install_element (BGP_NODE, &no_neighbor_port_cmd);
10459 install_element (BGP_NODE, &no_neighbor_port_val_cmd);
10460
10461 /* "neighbor weight" commands. */
10462 install_element (BGP_NODE, &neighbor_weight_cmd);
10463 install_element (BGP_NODE, &no_neighbor_weight_cmd);
10464 install_element (BGP_NODE, &no_neighbor_weight_val_cmd);
10465
10466 /* "neighbor override-capability" commands. */
10467 install_element (BGP_NODE, &neighbor_override_capability_cmd);
10468 install_element (BGP_NODE, &no_neighbor_override_capability_cmd);
10469
10470 /* "neighbor strict-capability-match" commands. */
10471 install_element (BGP_NODE, &neighbor_strict_capability_cmd);
10472 install_element (BGP_NODE, &no_neighbor_strict_capability_cmd);
10473
10474 /* "neighbor timers" commands. */
10475 install_element (BGP_NODE, &neighbor_timers_cmd);
10476 install_element (BGP_NODE, &no_neighbor_timers_cmd);
10477
10478 /* "neighbor timers connect" commands. */
10479 install_element (BGP_NODE, &neighbor_timers_connect_cmd);
10480 install_element (BGP_NODE, &no_neighbor_timers_connect_cmd);
10481 install_element (BGP_NODE, &no_neighbor_timers_connect_val_cmd);
10482
10483 /* "neighbor advertisement-interval" commands. */
10484 install_element (BGP_NODE, &neighbor_advertise_interval_cmd);
10485 install_element (BGP_NODE, &no_neighbor_advertise_interval_cmd);
10486 install_element (BGP_NODE, &no_neighbor_advertise_interval_val_cmd);
10487
10488 /* "neighbor version" commands. */
10489 install_element (BGP_NODE, &neighbor_version_cmd);
paul718e3742002-12-13 20:15:29 +000010490
10491 /* "neighbor interface" commands. */
10492 install_element (BGP_NODE, &neighbor_interface_cmd);
10493 install_element (BGP_NODE, &no_neighbor_interface_cmd);
10494
10495 /* "neighbor distribute" commands. */
10496 install_element (BGP_NODE, &neighbor_distribute_list_cmd);
10497 install_element (BGP_NODE, &no_neighbor_distribute_list_cmd);
10498 install_element (BGP_IPV4_NODE, &neighbor_distribute_list_cmd);
10499 install_element (BGP_IPV4_NODE, &no_neighbor_distribute_list_cmd);
10500 install_element (BGP_IPV4M_NODE, &neighbor_distribute_list_cmd);
10501 install_element (BGP_IPV4M_NODE, &no_neighbor_distribute_list_cmd);
10502 install_element (BGP_IPV6_NODE, &neighbor_distribute_list_cmd);
10503 install_element (BGP_IPV6_NODE, &no_neighbor_distribute_list_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010504 install_element (BGP_IPV6M_NODE, &neighbor_distribute_list_cmd);
10505 install_element (BGP_IPV6M_NODE, &no_neighbor_distribute_list_cmd);
paul718e3742002-12-13 20:15:29 +000010506 install_element (BGP_VPNV4_NODE, &neighbor_distribute_list_cmd);
10507 install_element (BGP_VPNV4_NODE, &no_neighbor_distribute_list_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010508 install_element (BGP_VPNV6_NODE, &neighbor_distribute_list_cmd);
10509 install_element (BGP_VPNV6_NODE, &no_neighbor_distribute_list_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010510 install_element (BGP_ENCAP_NODE, &neighbor_distribute_list_cmd);
10511 install_element (BGP_ENCAP_NODE, &no_neighbor_distribute_list_cmd);
10512 install_element (BGP_ENCAPV6_NODE, &neighbor_distribute_list_cmd);
10513 install_element (BGP_ENCAPV6_NODE, &no_neighbor_distribute_list_cmd);
paul718e3742002-12-13 20:15:29 +000010514
10515 /* "neighbor prefix-list" commands. */
10516 install_element (BGP_NODE, &neighbor_prefix_list_cmd);
10517 install_element (BGP_NODE, &no_neighbor_prefix_list_cmd);
10518 install_element (BGP_IPV4_NODE, &neighbor_prefix_list_cmd);
10519 install_element (BGP_IPV4_NODE, &no_neighbor_prefix_list_cmd);
10520 install_element (BGP_IPV4M_NODE, &neighbor_prefix_list_cmd);
10521 install_element (BGP_IPV4M_NODE, &no_neighbor_prefix_list_cmd);
10522 install_element (BGP_IPV6_NODE, &neighbor_prefix_list_cmd);
10523 install_element (BGP_IPV6_NODE, &no_neighbor_prefix_list_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010524 install_element (BGP_IPV6M_NODE, &neighbor_prefix_list_cmd);
10525 install_element (BGP_IPV6M_NODE, &no_neighbor_prefix_list_cmd);
paul718e3742002-12-13 20:15:29 +000010526 install_element (BGP_VPNV4_NODE, &neighbor_prefix_list_cmd);
10527 install_element (BGP_VPNV4_NODE, &no_neighbor_prefix_list_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010528 install_element (BGP_VPNV6_NODE, &neighbor_prefix_list_cmd);
10529 install_element (BGP_VPNV6_NODE, &no_neighbor_prefix_list_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010530 install_element (BGP_ENCAP_NODE, &neighbor_prefix_list_cmd);
10531 install_element (BGP_ENCAP_NODE, &no_neighbor_prefix_list_cmd);
10532 install_element (BGP_ENCAPV6_NODE, &neighbor_prefix_list_cmd);
10533 install_element (BGP_ENCAPV6_NODE, &no_neighbor_prefix_list_cmd);
paul718e3742002-12-13 20:15:29 +000010534
10535 /* "neighbor filter-list" commands. */
10536 install_element (BGP_NODE, &neighbor_filter_list_cmd);
10537 install_element (BGP_NODE, &no_neighbor_filter_list_cmd);
10538 install_element (BGP_IPV4_NODE, &neighbor_filter_list_cmd);
10539 install_element (BGP_IPV4_NODE, &no_neighbor_filter_list_cmd);
10540 install_element (BGP_IPV4M_NODE, &neighbor_filter_list_cmd);
10541 install_element (BGP_IPV4M_NODE, &no_neighbor_filter_list_cmd);
10542 install_element (BGP_IPV6_NODE, &neighbor_filter_list_cmd);
10543 install_element (BGP_IPV6_NODE, &no_neighbor_filter_list_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010544 install_element (BGP_IPV6M_NODE, &neighbor_filter_list_cmd);
10545 install_element (BGP_IPV6M_NODE, &no_neighbor_filter_list_cmd);
paul718e3742002-12-13 20:15:29 +000010546 install_element (BGP_VPNV4_NODE, &neighbor_filter_list_cmd);
10547 install_element (BGP_VPNV4_NODE, &no_neighbor_filter_list_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010548 install_element (BGP_VPNV6_NODE, &neighbor_filter_list_cmd);
10549 install_element (BGP_VPNV6_NODE, &no_neighbor_filter_list_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010550 install_element (BGP_ENCAP_NODE, &neighbor_filter_list_cmd);
10551 install_element (BGP_ENCAP_NODE, &no_neighbor_filter_list_cmd);
10552 install_element (BGP_ENCAPV6_NODE, &neighbor_filter_list_cmd);
10553 install_element (BGP_ENCAPV6_NODE, &no_neighbor_filter_list_cmd);
paul718e3742002-12-13 20:15:29 +000010554
10555 /* "neighbor route-map" commands. */
10556 install_element (BGP_NODE, &neighbor_route_map_cmd);
10557 install_element (BGP_NODE, &no_neighbor_route_map_cmd);
10558 install_element (BGP_IPV4_NODE, &neighbor_route_map_cmd);
10559 install_element (BGP_IPV4_NODE, &no_neighbor_route_map_cmd);
10560 install_element (BGP_IPV4M_NODE, &neighbor_route_map_cmd);
10561 install_element (BGP_IPV4M_NODE, &no_neighbor_route_map_cmd);
10562 install_element (BGP_IPV6_NODE, &neighbor_route_map_cmd);
10563 install_element (BGP_IPV6_NODE, &no_neighbor_route_map_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010564 install_element (BGP_IPV6M_NODE, &neighbor_route_map_cmd);
10565 install_element (BGP_IPV6M_NODE, &no_neighbor_route_map_cmd);
paul718e3742002-12-13 20:15:29 +000010566 install_element (BGP_VPNV4_NODE, &neighbor_route_map_cmd);
10567 install_element (BGP_VPNV4_NODE, &no_neighbor_route_map_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010568 install_element (BGP_VPNV6_NODE, &neighbor_route_map_cmd);
10569 install_element (BGP_VPNV6_NODE, &no_neighbor_route_map_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010570 install_element (BGP_ENCAP_NODE, &neighbor_route_map_cmd);
10571 install_element (BGP_ENCAP_NODE, &no_neighbor_route_map_cmd);
10572 install_element (BGP_ENCAPV6_NODE, &neighbor_route_map_cmd);
10573 install_element (BGP_ENCAPV6_NODE, &no_neighbor_route_map_cmd);
paul718e3742002-12-13 20:15:29 +000010574
10575 /* "neighbor unsuppress-map" commands. */
10576 install_element (BGP_NODE, &neighbor_unsuppress_map_cmd);
10577 install_element (BGP_NODE, &no_neighbor_unsuppress_map_cmd);
10578 install_element (BGP_IPV4_NODE, &neighbor_unsuppress_map_cmd);
10579 install_element (BGP_IPV4_NODE, &no_neighbor_unsuppress_map_cmd);
10580 install_element (BGP_IPV4M_NODE, &neighbor_unsuppress_map_cmd);
10581 install_element (BGP_IPV4M_NODE, &no_neighbor_unsuppress_map_cmd);
10582 install_element (BGP_IPV6_NODE, &neighbor_unsuppress_map_cmd);
10583 install_element (BGP_IPV6_NODE, &no_neighbor_unsuppress_map_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010584 install_element (BGP_IPV6M_NODE, &neighbor_unsuppress_map_cmd);
10585 install_element (BGP_IPV6M_NODE, &no_neighbor_unsuppress_map_cmd);
paula58545b2003-07-12 21:43:01 +000010586 install_element (BGP_VPNV4_NODE, &neighbor_unsuppress_map_cmd);
Lou Berger82dd7072016-01-12 13:41:57 -050010587 install_element (BGP_VPNV4_NODE, &no_neighbor_unsuppress_map_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010588 install_element (BGP_VPNV6_NODE, &neighbor_unsuppress_map_cmd);
Lou Berger82dd7072016-01-12 13:41:57 -050010589 install_element (BGP_VPNV6_NODE, &no_neighbor_unsuppress_map_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010590 install_element (BGP_ENCAP_NODE, &neighbor_unsuppress_map_cmd);
10591 install_element (BGP_ENCAP_NODE, &no_neighbor_unsuppress_map_cmd);
10592 install_element (BGP_ENCAPV6_NODE, &neighbor_unsuppress_map_cmd);
10593 install_element (BGP_ENCAPV6_NODE, &no_neighbor_unsuppress_map_cmd);
paul718e3742002-12-13 20:15:29 +000010594
10595 /* "neighbor maximum-prefix" commands. */
10596 install_element (BGP_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +000010597 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +000010598 install_element (BGP_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +000010599 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +000010600 install_element (BGP_NODE, &neighbor_maximum_prefix_restart_cmd);
10601 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010602 install_element (BGP_NODE, &no_neighbor_maximum_prefix_cmd);
10603 install_element (BGP_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +000010604 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10605 install_element (BGP_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10606 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10607 install_element (BGP_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10608 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010609 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +000010610 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +000010611 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +000010612 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +000010613 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_restart_cmd);
10614 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010615 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_cmd);
10616 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +000010617 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10618 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10619 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10620 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10621 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010622 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +000010623 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +000010624 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +000010625 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +000010626 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_restart_cmd);
10627 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010628 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_cmd);
10629 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +000010630 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10631 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10632 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10633 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10634 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010635 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +000010636 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +000010637 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +000010638 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +000010639 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_restart_cmd);
10640 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010641 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_cmd);
10642 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +000010643 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10644 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10645 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10646 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10647 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010648 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_cmd);
10649 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_cmd);
10650 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_warning_cmd);
10651 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
10652 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_restart_cmd);
10653 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
10654 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_cmd);
10655 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_val_cmd);
10656 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10657 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10658 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10659 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10660 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010661 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +000010662 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +000010663 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +000010664 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +000010665 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_restart_cmd);
10666 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010667 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_cmd);
10668 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +000010669 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10670 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10671 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10672 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10673 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010674
Lou Berger13c378d2016-01-12 13:41:56 -050010675 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_cmd);
10676 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_threshold_cmd);
10677 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_warning_cmd);
10678 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
10679 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_restart_cmd);
10680 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
10681 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_cmd);
10682 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_val_cmd);
10683 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10684 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10685 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10686 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10687 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
10688
Lou Bergera3fda882016-01-12 13:42:04 -050010689 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_cmd);
10690 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_threshold_cmd);
10691 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_warning_cmd);
10692 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
10693 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_restart_cmd);
10694 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
10695 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_cmd);
10696 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_val_cmd);
10697 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10698 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10699 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10700 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10701 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
10702
10703 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_cmd);
10704 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_threshold_cmd);
10705 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_warning_cmd);
10706 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
10707 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_restart_cmd);
10708 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
10709 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_cmd);
10710 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_val_cmd);
10711 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10712 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10713 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10714 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10715 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
10716
paul718e3742002-12-13 20:15:29 +000010717 /* "neighbor allowas-in" */
10718 install_element (BGP_NODE, &neighbor_allowas_in_cmd);
10719 install_element (BGP_NODE, &neighbor_allowas_in_arg_cmd);
10720 install_element (BGP_NODE, &no_neighbor_allowas_in_cmd);
10721 install_element (BGP_IPV4_NODE, &neighbor_allowas_in_cmd);
10722 install_element (BGP_IPV4_NODE, &neighbor_allowas_in_arg_cmd);
10723 install_element (BGP_IPV4_NODE, &no_neighbor_allowas_in_cmd);
10724 install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_cmd);
10725 install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_arg_cmd);
10726 install_element (BGP_IPV4M_NODE, &no_neighbor_allowas_in_cmd);
10727 install_element (BGP_IPV6_NODE, &neighbor_allowas_in_cmd);
10728 install_element (BGP_IPV6_NODE, &neighbor_allowas_in_arg_cmd);
10729 install_element (BGP_IPV6_NODE, &no_neighbor_allowas_in_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010730 install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_cmd);
10731 install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_arg_cmd);
10732 install_element (BGP_IPV6M_NODE, &no_neighbor_allowas_in_cmd);
paul718e3742002-12-13 20:15:29 +000010733 install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_cmd);
10734 install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_arg_cmd);
10735 install_element (BGP_VPNV4_NODE, &no_neighbor_allowas_in_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010736 install_element (BGP_VPNV6_NODE, &neighbor_allowas_in_cmd);
10737 install_element (BGP_VPNV6_NODE, &neighbor_allowas_in_arg_cmd);
10738 install_element (BGP_VPNV6_NODE, &no_neighbor_allowas_in_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010739 install_element (BGP_ENCAP_NODE, &neighbor_allowas_in_cmd);
10740 install_element (BGP_ENCAP_NODE, &neighbor_allowas_in_arg_cmd);
10741 install_element (BGP_ENCAP_NODE, &no_neighbor_allowas_in_cmd);
10742 install_element (BGP_ENCAPV6_NODE, &neighbor_allowas_in_cmd);
10743 install_element (BGP_ENCAPV6_NODE, &neighbor_allowas_in_arg_cmd);
10744 install_element (BGP_ENCAPV6_NODE, &no_neighbor_allowas_in_cmd);
paul718e3742002-12-13 20:15:29 +000010745
10746 /* address-family commands. */
10747 install_element (BGP_NODE, &address_family_ipv4_cmd);
10748 install_element (BGP_NODE, &address_family_ipv4_safi_cmd);
paul718e3742002-12-13 20:15:29 +000010749 install_element (BGP_NODE, &address_family_ipv6_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010750 install_element (BGP_NODE, &address_family_ipv6_safi_cmd);
paul718e3742002-12-13 20:15:29 +000010751 install_element (BGP_NODE, &address_family_vpnv4_cmd);
10752 install_element (BGP_NODE, &address_family_vpnv4_unicast_cmd);
10753
Lou Berger13c378d2016-01-12 13:41:56 -050010754 install_element (BGP_NODE, &address_family_vpnv6_cmd);
10755 install_element (BGP_NODE, &address_family_vpnv6_unicast_cmd);
10756
Lou Bergera3fda882016-01-12 13:42:04 -050010757 install_element (BGP_NODE, &address_family_encap_cmd);
10758 install_element (BGP_NODE, &address_family_encapv4_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010759 install_element (BGP_NODE, &address_family_encapv6_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010760
paul718e3742002-12-13 20:15:29 +000010761 /* "exit-address-family" command. */
10762 install_element (BGP_IPV4_NODE, &exit_address_family_cmd);
10763 install_element (BGP_IPV4M_NODE, &exit_address_family_cmd);
10764 install_element (BGP_IPV6_NODE, &exit_address_family_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010765 install_element (BGP_IPV6M_NODE, &exit_address_family_cmd);
paul718e3742002-12-13 20:15:29 +000010766 install_element (BGP_VPNV4_NODE, &exit_address_family_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010767 install_element (BGP_VPNV6_NODE, &exit_address_family_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010768 install_element (BGP_ENCAP_NODE, &exit_address_family_cmd);
10769 install_element (BGP_ENCAPV6_NODE, &exit_address_family_cmd);
paul718e3742002-12-13 20:15:29 +000010770
10771 /* "clear ip bgp commands" */
10772 install_element (ENABLE_NODE, &clear_ip_bgp_all_cmd);
10773 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_cmd);
10774 install_element (ENABLE_NODE, &clear_ip_bgp_as_cmd);
10775 install_element (ENABLE_NODE, &clear_ip_bgp_peer_cmd);
10776 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_cmd);
10777 install_element (ENABLE_NODE, &clear_ip_bgp_external_cmd);
paul718e3742002-12-13 20:15:29 +000010778 install_element (ENABLE_NODE, &clear_bgp_all_cmd);
10779 install_element (ENABLE_NODE, &clear_bgp_instance_all_cmd);
10780 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_cmd);
10781 install_element (ENABLE_NODE, &clear_bgp_peer_cmd);
10782 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_cmd);
10783 install_element (ENABLE_NODE, &clear_bgp_peer_group_cmd);
10784 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_cmd);
10785 install_element (ENABLE_NODE, &clear_bgp_external_cmd);
10786 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_cmd);
10787 install_element (ENABLE_NODE, &clear_bgp_as_cmd);
10788 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_cmd);
paul718e3742002-12-13 20:15:29 +000010789
10790 /* "clear ip bgp neighbor soft in" */
10791 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_in_cmd);
10792 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_in_cmd);
10793 install_element (ENABLE_NODE, &clear_ip_bgp_all_in_cmd);
10794 install_element (ENABLE_NODE, &clear_ip_bgp_all_in_prefix_filter_cmd);
10795 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_in_prefix_filter_cmd);
10796 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_in_cmd);
10797 install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_cmd);
10798 install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_prefix_filter_cmd);
10799 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_in_cmd);
10800 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_cmd);
10801 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_prefix_filter_cmd);
10802 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_in_cmd);
10803 install_element (ENABLE_NODE, &clear_ip_bgp_external_in_cmd);
10804 install_element (ENABLE_NODE, &clear_ip_bgp_external_in_prefix_filter_cmd);
10805 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_in_cmd);
10806 install_element (ENABLE_NODE, &clear_ip_bgp_as_in_cmd);
10807 install_element (ENABLE_NODE, &clear_ip_bgp_as_in_prefix_filter_cmd);
10808 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_in_cmd);
10809 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_in_cmd);
10810 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_cmd);
10811 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_prefix_filter_cmd);
10812 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd);
10813 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_in_cmd);
10814 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_cmd);
10815 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd);
10816 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_in_cmd);
10817 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_cmd);
10818 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd);
10819 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_in_cmd);
10820 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_cmd);
10821 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_prefix_filter_cmd);
10822 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_in_cmd);
10823 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_cmd);
10824 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_prefix_filter_cmd);
10825 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_in_cmd);
10826 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_in_cmd);
10827 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_in_cmd);
10828 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_in_cmd);
10829 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_in_cmd);
10830 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_in_cmd);
Lou Berger298cc2f2016-01-12 13:42:02 -050010831 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_soft_in_cmd);
10832 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_in_cmd);
10833 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_soft_in_cmd);
10834 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_in_cmd);
10835 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_soft_in_cmd);
10836 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_in_cmd);
paul718e3742002-12-13 20:15:29 +000010837 install_element (ENABLE_NODE, &clear_bgp_all_soft_in_cmd);
10838 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_in_cmd);
10839 install_element (ENABLE_NODE, &clear_bgp_all_in_cmd);
10840 install_element (ENABLE_NODE, &clear_bgp_all_in_prefix_filter_cmd);
10841 install_element (ENABLE_NODE, &clear_bgp_peer_soft_in_cmd);
10842 install_element (ENABLE_NODE, &clear_bgp_peer_in_cmd);
10843 install_element (ENABLE_NODE, &clear_bgp_peer_in_prefix_filter_cmd);
10844 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_in_cmd);
10845 install_element (ENABLE_NODE, &clear_bgp_peer_group_in_cmd);
10846 install_element (ENABLE_NODE, &clear_bgp_peer_group_in_prefix_filter_cmd);
10847 install_element (ENABLE_NODE, &clear_bgp_external_soft_in_cmd);
10848 install_element (ENABLE_NODE, &clear_bgp_external_in_cmd);
10849 install_element (ENABLE_NODE, &clear_bgp_external_in_prefix_filter_cmd);
10850 install_element (ENABLE_NODE, &clear_bgp_as_soft_in_cmd);
10851 install_element (ENABLE_NODE, &clear_bgp_as_in_cmd);
10852 install_element (ENABLE_NODE, &clear_bgp_as_in_prefix_filter_cmd);
10853 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_in_cmd);
10854 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_cmd);
10855 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_prefix_filter_cmd);
10856 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_in_cmd);
10857 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_cmd);
10858 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_prefix_filter_cmd);
10859 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_in_cmd);
10860 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_cmd);
10861 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_prefix_filter_cmd);
10862 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_in_cmd);
10863 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_cmd);
10864 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_prefix_filter_cmd);
10865 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_in_cmd);
10866 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_cmd);
10867 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_prefix_filter_cmd);
paul718e3742002-12-13 20:15:29 +000010868
10869 /* "clear ip bgp neighbor soft out" */
10870 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_out_cmd);
10871 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_out_cmd);
10872 install_element (ENABLE_NODE, &clear_ip_bgp_all_out_cmd);
10873 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_out_cmd);
10874 install_element (ENABLE_NODE, &clear_ip_bgp_peer_out_cmd);
10875 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_out_cmd);
10876 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_out_cmd);
10877 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_out_cmd);
10878 install_element (ENABLE_NODE, &clear_ip_bgp_external_out_cmd);
10879 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_out_cmd);
10880 install_element (ENABLE_NODE, &clear_ip_bgp_as_out_cmd);
10881 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_out_cmd);
10882 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_out_cmd);
10883 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_out_cmd);
10884 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_out_cmd);
10885 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_out_cmd);
10886 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_out_cmd);
10887 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_out_cmd);
10888 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_out_cmd);
10889 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_out_cmd);
10890 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_out_cmd);
10891 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_out_cmd);
10892 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_out_cmd);
10893 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_out_cmd);
10894 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_out_cmd);
10895 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_out_cmd);
10896 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_out_cmd);
10897 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_out_cmd);
Lou Berger298cc2f2016-01-12 13:42:02 -050010898 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_soft_out_cmd);
10899 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_out_cmd);
10900 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_soft_out_cmd);
10901 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_out_cmd);
10902 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_soft_out_cmd);
10903 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_out_cmd);
paul718e3742002-12-13 20:15:29 +000010904 install_element (ENABLE_NODE, &clear_bgp_all_soft_out_cmd);
10905 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_out_cmd);
10906 install_element (ENABLE_NODE, &clear_bgp_all_out_cmd);
10907 install_element (ENABLE_NODE, &clear_bgp_peer_soft_out_cmd);
10908 install_element (ENABLE_NODE, &clear_bgp_peer_out_cmd);
10909 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_out_cmd);
10910 install_element (ENABLE_NODE, &clear_bgp_peer_group_out_cmd);
10911 install_element (ENABLE_NODE, &clear_bgp_external_soft_out_cmd);
10912 install_element (ENABLE_NODE, &clear_bgp_external_out_cmd);
10913 install_element (ENABLE_NODE, &clear_bgp_as_soft_out_cmd);
10914 install_element (ENABLE_NODE, &clear_bgp_as_out_cmd);
10915 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_out_cmd);
10916 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_out_cmd);
10917 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_out_cmd);
10918 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_out_cmd);
10919 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_out_cmd);
10920 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_out_cmd);
10921 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_out_cmd);
10922 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_out_cmd);
10923 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_out_cmd);
10924 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_out_cmd);
paul718e3742002-12-13 20:15:29 +000010925
10926 /* "clear ip bgp neighbor soft" */
10927 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_cmd);
10928 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_cmd);
10929 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_cmd);
10930 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_cmd);
10931 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_cmd);
10932 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_cmd);
10933 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_cmd);
10934 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_cmd);
10935 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_cmd);
10936 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_cmd);
10937 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_cmd);
10938 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_cmd);
10939 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_cmd);
10940 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_cmd);
10941 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_cmd);
Lou Berger298cc2f2016-01-12 13:42:02 -050010942 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_soft_cmd);
10943 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_soft_cmd);
10944 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_soft_cmd);
paul718e3742002-12-13 20:15:29 +000010945 install_element (ENABLE_NODE, &clear_bgp_all_soft_cmd);
10946 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_cmd);
10947 install_element (ENABLE_NODE, &clear_bgp_peer_soft_cmd);
10948 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_cmd);
10949 install_element (ENABLE_NODE, &clear_bgp_external_soft_cmd);
10950 install_element (ENABLE_NODE, &clear_bgp_as_soft_cmd);
10951 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_cmd);
10952 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_cmd);
10953 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_cmd);
10954 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_cmd);
10955 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_cmd);
paul718e3742002-12-13 20:15:29 +000010956
paulfee0f4c2004-09-13 05:12:46 +000010957 /* "clear ip bgp neighbor rsclient" */
10958 install_element (ENABLE_NODE, &clear_ip_bgp_all_rsclient_cmd);
10959 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_rsclient_cmd);
10960 install_element (ENABLE_NODE, &clear_ip_bgp_peer_rsclient_cmd);
10961 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_rsclient_cmd);
paulfee0f4c2004-09-13 05:12:46 +000010962 install_element (ENABLE_NODE, &clear_bgp_all_rsclient_cmd);
10963 install_element (ENABLE_NODE, &clear_bgp_instance_all_rsclient_cmd);
10964 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_rsclient_cmd);
10965 install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_all_rsclient_cmd);
10966 install_element (ENABLE_NODE, &clear_bgp_peer_rsclient_cmd);
10967 install_element (ENABLE_NODE, &clear_bgp_instance_peer_rsclient_cmd);
10968 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_rsclient_cmd);
10969 install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_peer_rsclient_cmd);
paulfee0f4c2004-09-13 05:12:46 +000010970
paul718e3742002-12-13 20:15:29 +000010971 /* "show ip bgp summary" commands. */
paul718e3742002-12-13 20:15:29 +000010972 install_element (VIEW_NODE, &show_bgp_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050010973 install_element (RESTRICTED_NODE, &show_bgp_summary_cmd);
10974 install_element (ENABLE_NODE, &show_bgp_summary_cmd);
10975
10976 install_element (VIEW_NODE, &show_bgp_summary_1w_cmd);
10977 install_element (RESTRICTED_NODE, &show_bgp_summary_1w_cmd);
10978 install_element (ENABLE_NODE, &show_bgp_summary_1w_cmd);
10979
10980 install_element (VIEW_NODE, &show_bgp_ipv4_safi_summary_cmd);
10981 install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_summary_cmd);
10982 install_element (VIEW_NODE, &show_bgp_instance_ipv4_summary_cmd);
10983
10984 install_element (VIEW_NODE, &show_bgp_ipv4_vpn_summary_cmd);
10985 install_element (VIEW_NODE, &show_bgp_ipv4_encap_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050010986 install_element (VIEW_NODE, &show_bgp_ipv6_vpn_summary_cmd);
10987 install_element (VIEW_NODE, &show_bgp_ipv6_encap_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050010988
paul718e3742002-12-13 20:15:29 +000010989 install_element (VIEW_NODE, &show_bgp_instance_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010990 install_element (VIEW_NODE, &show_bgp_ipv6_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010991 install_element (VIEW_NODE, &show_bgp_instance_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010992 install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010993 install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050010994 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010995 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050010996
10997 install_element (RESTRICTED_NODE, &show_bgp_ipv4_vpn_summary_cmd);
10998 install_element (RESTRICTED_NODE, &show_bgp_ipv4_encap_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050010999 install_element (RESTRICTED_NODE, &show_bgp_ipv6_vpn_summary_cmd);
11000 install_element (RESTRICTED_NODE, &show_bgp_ipv6_encap_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011001
Paul Jakma62687ff2008-08-23 14:27:06 +010011002 install_element (RESTRICTED_NODE, &show_bgp_instance_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040011003 install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010011004 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040011005 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040011006 install_element (ENABLE_NODE, &show_bgp_ipv4_safi_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011007 install_element (ENABLE_NODE, &show_bgp_instance_ipv4_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040011008 install_element (ENABLE_NODE, &show_bgp_instance_ipv4_safi_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011009
11010 install_element (ENABLE_NODE, &show_bgp_ipv4_vpn_summary_cmd);
11011 install_element (ENABLE_NODE, &show_bgp_ipv4_encap_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011012 install_element (ENABLE_NODE, &show_bgp_ipv6_vpn_summary_cmd);
11013 install_element (ENABLE_NODE, &show_bgp_ipv6_encap_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011014
paul718e3742002-12-13 20:15:29 +000011015 install_element (ENABLE_NODE, &show_bgp_instance_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040011016 install_element (ENABLE_NODE, &show_bgp_ipv6_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000011017 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040011018 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000011019
11020 /* "show ip bgp neighbors" commands. */
paulbb46e942003-10-24 19:02:03 +000011021 install_element (VIEW_NODE, &show_bgp_instance_neighbors_cmd);
paulbb46e942003-10-24 19:02:03 +000011022 install_element (ENABLE_NODE, &show_bgp_instance_neighbors_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011023
11024 install_element (VIEW_NODE, &show_bgp_neighbors_cmd);
11025 install_element (VIEW_NODE, &show_bgp_neighbors_peer_cmd);
11026 install_element (VIEW_NODE, &show_bgp_instance_neighbors_peer_cmd);
11027 install_element (RESTRICTED_NODE, &show_bgp_neighbors_peer_cmd);
11028 install_element (RESTRICTED_NODE, &show_bgp_instance_neighbors_peer_cmd);
11029 install_element (ENABLE_NODE, &show_bgp_neighbors_cmd);
11030 install_element (ENABLE_NODE, &show_bgp_neighbors_peer_cmd);
paulbb46e942003-10-24 19:02:03 +000011031 install_element (ENABLE_NODE, &show_bgp_instance_neighbors_peer_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011032 install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_cmd);
11033 install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
11034 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
11035 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_cmd);
paulbb46e942003-10-24 19:02:03 +000011036 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
paul718e3742002-12-13 20:15:29 +000011037
paulfee0f4c2004-09-13 05:12:46 +000011038 /* "show ip bgp rsclient" commands. */
Michael Lambert95cbbd22010-07-23 14:43:04 -040011039 install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd);
11040 install_element (VIEW_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040011041 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd);
11042 install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040011043 install_element (ENABLE_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd);
11044 install_element (ENABLE_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000011045
paulfee0f4c2004-09-13 05:12:46 +000011046 install_element (VIEW_NODE, &show_bgp_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000011047 install_element (VIEW_NODE, &show_bgp_instance_rsclient_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011048 install_element (RESTRICTED_NODE, &show_bgp_rsclient_summary_cmd);
11049 install_element (RESTRICTED_NODE, &show_bgp_instance_rsclient_summary_cmd);
11050 install_element (ENABLE_NODE, &show_bgp_rsclient_summary_cmd);
11051 install_element (ENABLE_NODE, &show_bgp_instance_rsclient_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011052 install_element (VIEW_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000011053 install_element (VIEW_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040011054 install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd);
11055 install_element (VIEW_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010011056 install_element (RESTRICTED_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010011057 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040011058 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd);
11059 install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000011060 install_element (ENABLE_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000011061 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040011062 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd);
11063 install_element (ENABLE_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000011064
paul718e3742002-12-13 20:15:29 +000011065 /* "show ip bgp paths" commands. */
Lou Berger651b4022016-01-12 13:42:07 -050011066 install_element (VIEW_NODE, &show_bgp_ipv4_paths_cmd);
11067 install_element (ENABLE_NODE, &show_bgp_ipv4_paths_cmd);
paul718e3742002-12-13 20:15:29 +000011068
11069 /* "show ip bgp community" commands. */
11070 install_element (VIEW_NODE, &show_ip_bgp_community_info_cmd);
11071 install_element (ENABLE_NODE, &show_ip_bgp_community_info_cmd);
11072
11073 /* "show ip bgp attribute-info" commands. */
11074 install_element (VIEW_NODE, &show_ip_bgp_attr_info_cmd);
11075 install_element (ENABLE_NODE, &show_ip_bgp_attr_info_cmd);
11076
11077 /* "redistribute" commands. */
11078 install_element (BGP_NODE, &bgp_redistribute_ipv4_cmd);
11079 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_cmd);
11080 install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_cmd);
11081 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_cmd);
11082 install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_cmd);
11083 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_cmd);
11084 install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_metric_cmd);
11085 install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_rmap_cmd);
11086 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_metric_cmd);
11087 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_rmap_cmd);
paul718e3742002-12-13 20:15:29 +000011088 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_cmd);
11089 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_cmd);
11090 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_cmd);
11091 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_cmd);
11092 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_cmd);
11093 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_cmd);
11094 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_metric_cmd);
11095 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_rmap_cmd);
11096 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_metric_cmd);
11097 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_rmap_cmd);
paul718e3742002-12-13 20:15:29 +000011098
Nick Hilliardfa411a22011-03-23 15:33:17 +000011099 /* ttl_security commands */
11100 install_element (BGP_NODE, &neighbor_ttl_security_cmd);
11101 install_element (BGP_NODE, &no_neighbor_ttl_security_cmd);
11102
Paul Jakma4bf6a362006-03-30 14:05:23 +000011103 /* "show bgp memory" commands. */
11104 install_element (VIEW_NODE, &show_bgp_memory_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010011105 install_element (RESTRICTED_NODE, &show_bgp_memory_cmd);
Paul Jakma4bf6a362006-03-30 14:05:23 +000011106 install_element (ENABLE_NODE, &show_bgp_memory_cmd);
11107
Michael Lamberte0081f72008-11-16 20:12:04 +000011108 /* "show bgp views" commands. */
11109 install_element (VIEW_NODE, &show_bgp_views_cmd);
11110 install_element (RESTRICTED_NODE, &show_bgp_views_cmd);
11111 install_element (ENABLE_NODE, &show_bgp_views_cmd);
Lou Bergerf9b6c392016-01-12 13:42:09 -050011112
11113 /* non afi/safi forms of commands */
11114 install_element (VIEW_NODE, &show_ip_bgp_summary_cmd);
11115 install_element (VIEW_NODE, &show_ip_bgp_instance_summary_cmd);
11116 install_element (VIEW_NODE, &show_ip_bgp_ipv4_summary_cmd);
11117 install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
11118 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
11119 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
11120 install_element (VIEW_NODE, &show_bgp_ipv6_summary_cmd);
11121 install_element (RESTRICTED_NODE, &show_ip_bgp_summary_cmd);
11122 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_summary_cmd);
11123 install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_summary_cmd);
11124 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
11125 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
11126 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
11127 install_element (RESTRICTED_NODE, &show_bgp_ipv6_summary_cmd);
11128 install_element (ENABLE_NODE, &show_ip_bgp_summary_cmd);
11129 install_element (ENABLE_NODE, &show_ip_bgp_instance_summary_cmd);
11130 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_summary_cmd);
11131 install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
11132 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
11133 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
11134 install_element (ENABLE_NODE, &show_bgp_ipv6_summary_cmd);
11135 install_element (VIEW_NODE, &show_ip_bgp_neighbors_cmd);
11136 install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_cmd);
11137 install_element (VIEW_NODE, &show_ip_bgp_neighbors_peer_cmd);
11138 install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
11139 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd);
11140 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd);
11141 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
11142 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
11143 install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_cmd);
11144 install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
11145 install_element (RESTRICTED_NODE, &show_ip_bgp_neighbors_peer_cmd);
11146 install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
11147 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
11148 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
11149 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
11150 install_element (ENABLE_NODE, &show_ip_bgp_neighbors_cmd);
11151 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_cmd);
11152 install_element (ENABLE_NODE, &show_ip_bgp_neighbors_peer_cmd);
11153 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
11154 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd);
11155 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd);
11156 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
11157 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
11158 install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_cmd);
11159 install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
11160 install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_cmd);
11161 install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
11162 install_element (RESTRICTED_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
11163 install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_cmd);
11164 install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
11165 install_element (VIEW_NODE, &show_ipv6_bgp_summary_cmd);
11166 install_element (VIEW_NODE, &show_ipv6_mbgp_summary_cmd);
11167 install_element (ENABLE_NODE, &show_ipv6_bgp_summary_cmd);
11168 install_element (ENABLE_NODE, &show_ipv6_mbgp_summary_cmd);
11169 install_element (VIEW_NODE, &show_ip_bgp_rsclient_summary_cmd);
11170 install_element (VIEW_NODE, &show_ip_bgp_instance_rsclient_summary_cmd);
11171 install_element (VIEW_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd);
11172 install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd);
11173 install_element (RESTRICTED_NODE, &show_ip_bgp_rsclient_summary_cmd);
11174 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_rsclient_summary_cmd);
11175 install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd);
11176 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd);
11177 install_element (ENABLE_NODE, &show_ip_bgp_rsclient_summary_cmd);
11178 install_element (ENABLE_NODE, &show_ip_bgp_instance_rsclient_summary_cmd);
11179 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd);
11180 install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd);
11181 install_element (VIEW_NODE, &show_ip_bgp_paths_cmd);
11182 install_element (VIEW_NODE, &show_ip_bgp_ipv4_paths_cmd);
11183 install_element (ENABLE_NODE, &show_ip_bgp_paths_cmd);
11184 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_paths_cmd);
paul718e3742002-12-13 20:15:29 +000011185 /* Community-list. */
11186 community_list_vty ();
11187}
David Lamparter6b0655a2014-06-04 06:53:35 +020011188
paul718e3742002-12-13 20:15:29 +000011189#include "memory.h"
11190#include "bgp_regex.h"
11191#include "bgp_clist.h"
11192#include "bgp_ecommunity.h"
11193
11194/* VTY functions. */
11195
11196/* Direction value to string conversion. */
paul94f2b392005-06-28 12:44:16 +000011197static const char *
paul718e3742002-12-13 20:15:29 +000011198community_direct_str (int direct)
11199{
11200 switch (direct)
11201 {
11202 case COMMUNITY_DENY:
11203 return "deny";
paul718e3742002-12-13 20:15:29 +000011204 case COMMUNITY_PERMIT:
11205 return "permit";
paul718e3742002-12-13 20:15:29 +000011206 default:
11207 return "unknown";
paul718e3742002-12-13 20:15:29 +000011208 }
11209}
11210
11211/* Display error string. */
paul94f2b392005-06-28 12:44:16 +000011212static void
paul718e3742002-12-13 20:15:29 +000011213community_list_perror (struct vty *vty, int ret)
11214{
11215 switch (ret)
11216 {
11217 case COMMUNITY_LIST_ERR_CANT_FIND_LIST:
Denis Ovsienkob7292942010-12-08 18:51:37 +030011218 vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000011219 break;
11220 case COMMUNITY_LIST_ERR_MALFORMED_VAL:
11221 vty_out (vty, "%% Malformed community-list value%s", VTY_NEWLINE);
11222 break;
11223 case COMMUNITY_LIST_ERR_STANDARD_CONFLICT:
11224 vty_out (vty, "%% Community name conflict, previously defined as standard community%s", VTY_NEWLINE);
11225 break;
11226 case COMMUNITY_LIST_ERR_EXPANDED_CONFLICT:
11227 vty_out (vty, "%% Community name conflict, previously defined as expanded community%s", VTY_NEWLINE);
11228 break;
11229 }
11230}
11231
11232/* VTY interface for community_set() function. */
paul94f2b392005-06-28 12:44:16 +000011233static int
paulfd79ac92004-10-13 05:06:08 +000011234community_list_set_vty (struct vty *vty, int argc, const char **argv,
11235 int style, int reject_all_digit_name)
paul718e3742002-12-13 20:15:29 +000011236{
11237 int ret;
11238 int direct;
11239 char *str;
11240
11241 /* Check the list type. */
11242 if (strncmp (argv[1], "p", 1) == 0)
11243 direct = COMMUNITY_PERMIT;
11244 else if (strncmp (argv[1], "d", 1) == 0)
11245 direct = COMMUNITY_DENY;
11246 else
11247 {
11248 vty_out (vty, "%% Matching condition must be permit or deny%s",
11249 VTY_NEWLINE);
11250 return CMD_WARNING;
11251 }
11252
11253 /* All digit name check. */
11254 if (reject_all_digit_name && all_digit (argv[0]))
11255 {
11256 vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE);
11257 return CMD_WARNING;
11258 }
11259
11260 /* Concat community string argument. */
11261 if (argc > 1)
11262 str = argv_concat (argv, argc, 2);
11263 else
11264 str = NULL;
11265
11266 /* When community_list_set() return nevetive value, it means
11267 malformed community string. */
11268 ret = community_list_set (bgp_clist, argv[0], str, direct, style);
11269
11270 /* Free temporary community list string allocated by
11271 argv_concat(). */
11272 if (str)
11273 XFREE (MTYPE_TMP, str);
11274
11275 if (ret < 0)
11276 {
11277 /* Display error string. */
11278 community_list_perror (vty, ret);
11279 return CMD_WARNING;
11280 }
11281
11282 return CMD_SUCCESS;
11283}
11284
paul718e3742002-12-13 20:15:29 +000011285/* Communiyt-list entry delete. */
paul94f2b392005-06-28 12:44:16 +000011286static int
hassofee6e4e2005-02-02 16:29:31 +000011287community_list_unset_vty (struct vty *vty, int argc, const char **argv,
11288 int style)
paul718e3742002-12-13 20:15:29 +000011289{
11290 int ret;
hassofee6e4e2005-02-02 16:29:31 +000011291 int direct = 0;
11292 char *str = NULL;
paul718e3742002-12-13 20:15:29 +000011293
hassofee6e4e2005-02-02 16:29:31 +000011294 if (argc > 1)
paul718e3742002-12-13 20:15:29 +000011295 {
hassofee6e4e2005-02-02 16:29:31 +000011296 /* Check the list direct. */
11297 if (strncmp (argv[1], "p", 1) == 0)
11298 direct = COMMUNITY_PERMIT;
11299 else if (strncmp (argv[1], "d", 1) == 0)
11300 direct = COMMUNITY_DENY;
11301 else
11302 {
11303 vty_out (vty, "%% Matching condition must be permit or deny%s",
11304 VTY_NEWLINE);
11305 return CMD_WARNING;
11306 }
paul718e3742002-12-13 20:15:29 +000011307
hassofee6e4e2005-02-02 16:29:31 +000011308 /* Concat community string argument. */
11309 str = argv_concat (argv, argc, 2);
11310 }
paul718e3742002-12-13 20:15:29 +000011311
11312 /* Unset community list. */
11313 ret = community_list_unset (bgp_clist, argv[0], str, direct, style);
11314
11315 /* Free temporary community list string allocated by
11316 argv_concat(). */
hassofee6e4e2005-02-02 16:29:31 +000011317 if (str)
11318 XFREE (MTYPE_TMP, str);
paul718e3742002-12-13 20:15:29 +000011319
11320 if (ret < 0)
11321 {
11322 community_list_perror (vty, ret);
11323 return CMD_WARNING;
11324 }
11325
11326 return CMD_SUCCESS;
11327}
11328
11329/* "community-list" keyword help string. */
11330#define COMMUNITY_LIST_STR "Add a community list entry\n"
11331#define COMMUNITY_VAL_STR "Community number in aa:nn format or internet|local-AS|no-advertise|no-export\n"
11332
paul718e3742002-12-13 20:15:29 +000011333DEFUN (ip_community_list_standard,
11334 ip_community_list_standard_cmd,
11335 "ip community-list <1-99> (deny|permit) .AA:NN",
11336 IP_STR
11337 COMMUNITY_LIST_STR
11338 "Community list number (standard)\n"
11339 "Specify community to reject\n"
11340 "Specify community to accept\n"
11341 COMMUNITY_VAL_STR)
11342{
11343 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0);
11344}
11345
11346ALIAS (ip_community_list_standard,
11347 ip_community_list_standard2_cmd,
11348 "ip community-list <1-99> (deny|permit)",
11349 IP_STR
11350 COMMUNITY_LIST_STR
11351 "Community list number (standard)\n"
11352 "Specify community to reject\n"
11353 "Specify community to accept\n")
11354
11355DEFUN (ip_community_list_expanded,
11356 ip_community_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000011357 "ip community-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000011358 IP_STR
11359 COMMUNITY_LIST_STR
11360 "Community list number (expanded)\n"
11361 "Specify community to reject\n"
11362 "Specify community to accept\n"
11363 "An ordered list as a regular-expression\n")
11364{
11365 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0);
11366}
11367
11368DEFUN (ip_community_list_name_standard,
11369 ip_community_list_name_standard_cmd,
11370 "ip community-list standard WORD (deny|permit) .AA:NN",
11371 IP_STR
11372 COMMUNITY_LIST_STR
11373 "Add a standard community-list entry\n"
11374 "Community list name\n"
11375 "Specify community to reject\n"
11376 "Specify community to accept\n"
11377 COMMUNITY_VAL_STR)
11378{
11379 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1);
11380}
11381
11382ALIAS (ip_community_list_name_standard,
11383 ip_community_list_name_standard2_cmd,
11384 "ip community-list standard WORD (deny|permit)",
11385 IP_STR
11386 COMMUNITY_LIST_STR
11387 "Add a standard community-list entry\n"
11388 "Community list name\n"
11389 "Specify community to reject\n"
11390 "Specify community to accept\n")
11391
11392DEFUN (ip_community_list_name_expanded,
11393 ip_community_list_name_expanded_cmd,
11394 "ip community-list expanded WORD (deny|permit) .LINE",
11395 IP_STR
11396 COMMUNITY_LIST_STR
11397 "Add an expanded community-list entry\n"
11398 "Community list name\n"
11399 "Specify community to reject\n"
11400 "Specify community to accept\n"
11401 "An ordered list as a regular-expression\n")
11402{
11403 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1);
11404}
11405
hassofee6e4e2005-02-02 16:29:31 +000011406DEFUN (no_ip_community_list_standard_all,
11407 no_ip_community_list_standard_all_cmd,
11408 "no ip community-list <1-99>",
paul718e3742002-12-13 20:15:29 +000011409 NO_STR
11410 IP_STR
11411 COMMUNITY_LIST_STR
hassofee6e4e2005-02-02 16:29:31 +000011412 "Community list number (standard)\n")
paul718e3742002-12-13 20:15:29 +000011413{
hassofee6e4e2005-02-02 16:29:31 +000011414 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
paul718e3742002-12-13 20:15:29 +000011415}
11416
hassofee6e4e2005-02-02 16:29:31 +000011417DEFUN (no_ip_community_list_expanded_all,
11418 no_ip_community_list_expanded_all_cmd,
11419 "no ip community-list <100-500>",
11420 NO_STR
11421 IP_STR
11422 COMMUNITY_LIST_STR
11423 "Community list number (expanded)\n")
11424{
11425 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
11426}
11427
11428DEFUN (no_ip_community_list_name_standard_all,
11429 no_ip_community_list_name_standard_all_cmd,
11430 "no ip community-list standard WORD",
paul718e3742002-12-13 20:15:29 +000011431 NO_STR
11432 IP_STR
11433 COMMUNITY_LIST_STR
11434 "Add a standard community-list entry\n"
paul718e3742002-12-13 20:15:29 +000011435 "Community list name\n")
11436{
hassofee6e4e2005-02-02 16:29:31 +000011437 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
paul718e3742002-12-13 20:15:29 +000011438}
11439
hassofee6e4e2005-02-02 16:29:31 +000011440DEFUN (no_ip_community_list_name_expanded_all,
11441 no_ip_community_list_name_expanded_all_cmd,
11442 "no ip community-list expanded WORD",
paul718e3742002-12-13 20:15:29 +000011443 NO_STR
11444 IP_STR
11445 COMMUNITY_LIST_STR
hassofee6e4e2005-02-02 16:29:31 +000011446 "Add an expanded community-list entry\n"
11447 "Community list name\n")
paul718e3742002-12-13 20:15:29 +000011448{
hassofee6e4e2005-02-02 16:29:31 +000011449 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
paul718e3742002-12-13 20:15:29 +000011450}
11451
11452DEFUN (no_ip_community_list_standard,
11453 no_ip_community_list_standard_cmd,
11454 "no ip community-list <1-99> (deny|permit) .AA:NN",
11455 NO_STR
11456 IP_STR
11457 COMMUNITY_LIST_STR
11458 "Community list number (standard)\n"
11459 "Specify community to reject\n"
11460 "Specify community to accept\n"
11461 COMMUNITY_VAL_STR)
11462{
11463 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
11464}
11465
11466DEFUN (no_ip_community_list_expanded,
11467 no_ip_community_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000011468 "no ip community-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000011469 NO_STR
11470 IP_STR
11471 COMMUNITY_LIST_STR
11472 "Community list number (expanded)\n"
11473 "Specify community to reject\n"
11474 "Specify community to accept\n"
11475 "An ordered list as a regular-expression\n")
11476{
11477 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
11478}
11479
11480DEFUN (no_ip_community_list_name_standard,
11481 no_ip_community_list_name_standard_cmd,
11482 "no ip community-list standard WORD (deny|permit) .AA:NN",
11483 NO_STR
11484 IP_STR
11485 COMMUNITY_LIST_STR
11486 "Specify a standard community-list\n"
11487 "Community list name\n"
11488 "Specify community to reject\n"
11489 "Specify community to accept\n"
11490 COMMUNITY_VAL_STR)
11491{
11492 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
11493}
11494
11495DEFUN (no_ip_community_list_name_expanded,
11496 no_ip_community_list_name_expanded_cmd,
11497 "no ip community-list expanded WORD (deny|permit) .LINE",
11498 NO_STR
11499 IP_STR
11500 COMMUNITY_LIST_STR
11501 "Specify an expanded community-list\n"
11502 "Community list name\n"
11503 "Specify community to reject\n"
11504 "Specify community to accept\n"
11505 "An ordered list as a regular-expression\n")
11506{
11507 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
11508}
11509
paul94f2b392005-06-28 12:44:16 +000011510static void
paul718e3742002-12-13 20:15:29 +000011511community_list_show (struct vty *vty, struct community_list *list)
11512{
11513 struct community_entry *entry;
11514
11515 for (entry = list->head; entry; entry = entry->next)
11516 {
11517 if (entry == list->head)
11518 {
11519 if (all_digit (list->name))
11520 vty_out (vty, "Community %s list %s%s",
11521 entry->style == COMMUNITY_LIST_STANDARD ?
11522 "standard" : "(expanded) access",
11523 list->name, VTY_NEWLINE);
11524 else
11525 vty_out (vty, "Named Community %s list %s%s",
11526 entry->style == COMMUNITY_LIST_STANDARD ?
11527 "standard" : "expanded",
11528 list->name, VTY_NEWLINE);
11529 }
11530 if (entry->any)
11531 vty_out (vty, " %s%s",
11532 community_direct_str (entry->direct), VTY_NEWLINE);
11533 else
11534 vty_out (vty, " %s %s%s",
11535 community_direct_str (entry->direct),
11536 entry->style == COMMUNITY_LIST_STANDARD
11537 ? community_str (entry->u.com) : entry->config,
11538 VTY_NEWLINE);
11539 }
11540}
11541
11542DEFUN (show_ip_community_list,
11543 show_ip_community_list_cmd,
11544 "show ip community-list",
11545 SHOW_STR
11546 IP_STR
11547 "List community-list\n")
11548{
11549 struct community_list *list;
11550 struct community_list_master *cm;
11551
hassofee6e4e2005-02-02 16:29:31 +000011552 cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011553 if (! cm)
11554 return CMD_SUCCESS;
11555
11556 for (list = cm->num.head; list; list = list->next)
11557 community_list_show (vty, list);
11558
11559 for (list = cm->str.head; list; list = list->next)
11560 community_list_show (vty, list);
11561
11562 return CMD_SUCCESS;
11563}
11564
11565DEFUN (show_ip_community_list_arg,
11566 show_ip_community_list_arg_cmd,
hassofee6e4e2005-02-02 16:29:31 +000011567 "show ip community-list (<1-500>|WORD)",
paul718e3742002-12-13 20:15:29 +000011568 SHOW_STR
11569 IP_STR
11570 "List community-list\n"
11571 "Community-list number\n"
11572 "Community-list name\n")
11573{
11574 struct community_list *list;
11575
hassofee6e4e2005-02-02 16:29:31 +000011576 list = community_list_lookup (bgp_clist, argv[0], COMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011577 if (! list)
11578 {
Denis Ovsienkob7292942010-12-08 18:51:37 +030011579 vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000011580 return CMD_WARNING;
11581 }
11582
11583 community_list_show (vty, list);
11584
11585 return CMD_SUCCESS;
11586}
David Lamparter6b0655a2014-06-04 06:53:35 +020011587
paul94f2b392005-06-28 12:44:16 +000011588static int
paulfd79ac92004-10-13 05:06:08 +000011589extcommunity_list_set_vty (struct vty *vty, int argc, const char **argv,
11590 int style, int reject_all_digit_name)
paul718e3742002-12-13 20:15:29 +000011591{
11592 int ret;
11593 int direct;
11594 char *str;
11595
11596 /* Check the list type. */
11597 if (strncmp (argv[1], "p", 1) == 0)
11598 direct = COMMUNITY_PERMIT;
11599 else if (strncmp (argv[1], "d", 1) == 0)
11600 direct = COMMUNITY_DENY;
11601 else
11602 {
11603 vty_out (vty, "%% Matching condition must be permit or deny%s",
11604 VTY_NEWLINE);
11605 return CMD_WARNING;
11606 }
11607
11608 /* All digit name check. */
11609 if (reject_all_digit_name && all_digit (argv[0]))
11610 {
11611 vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE);
11612 return CMD_WARNING;
11613 }
11614
11615 /* Concat community string argument. */
11616 if (argc > 1)
11617 str = argv_concat (argv, argc, 2);
11618 else
11619 str = NULL;
11620
11621 ret = extcommunity_list_set (bgp_clist, argv[0], str, direct, style);
11622
11623 /* Free temporary community list string allocated by
11624 argv_concat(). */
11625 if (str)
11626 XFREE (MTYPE_TMP, str);
11627
11628 if (ret < 0)
11629 {
11630 community_list_perror (vty, ret);
11631 return CMD_WARNING;
11632 }
11633 return CMD_SUCCESS;
11634}
11635
paul94f2b392005-06-28 12:44:16 +000011636static int
hassofee6e4e2005-02-02 16:29:31 +000011637extcommunity_list_unset_vty (struct vty *vty, int argc, const char **argv,
11638 int style)
paul718e3742002-12-13 20:15:29 +000011639{
11640 int ret;
hassofee6e4e2005-02-02 16:29:31 +000011641 int direct = 0;
11642 char *str = NULL;
paul718e3742002-12-13 20:15:29 +000011643
hassofee6e4e2005-02-02 16:29:31 +000011644 if (argc > 1)
paul718e3742002-12-13 20:15:29 +000011645 {
hassofee6e4e2005-02-02 16:29:31 +000011646 /* Check the list direct. */
11647 if (strncmp (argv[1], "p", 1) == 0)
11648 direct = COMMUNITY_PERMIT;
11649 else if (strncmp (argv[1], "d", 1) == 0)
11650 direct = COMMUNITY_DENY;
11651 else
11652 {
11653 vty_out (vty, "%% Matching condition must be permit or deny%s",
11654 VTY_NEWLINE);
11655 return CMD_WARNING;
11656 }
11657
11658 /* Concat community string argument. */
11659 str = argv_concat (argv, argc, 2);
paul718e3742002-12-13 20:15:29 +000011660 }
paul718e3742002-12-13 20:15:29 +000011661
11662 /* Unset community list. */
11663 ret = extcommunity_list_unset (bgp_clist, argv[0], str, direct, style);
11664
11665 /* Free temporary community list string allocated by
11666 argv_concat(). */
hassofee6e4e2005-02-02 16:29:31 +000011667 if (str)
11668 XFREE (MTYPE_TMP, str);
paul718e3742002-12-13 20:15:29 +000011669
11670 if (ret < 0)
11671 {
11672 community_list_perror (vty, ret);
11673 return CMD_WARNING;
11674 }
11675
11676 return CMD_SUCCESS;
11677}
11678
11679/* "extcommunity-list" keyword help string. */
11680#define EXTCOMMUNITY_LIST_STR "Add a extended community list entry\n"
11681#define EXTCOMMUNITY_VAL_STR "Extended community attribute in 'rt aa:nn_or_IPaddr:nn' OR 'soo aa:nn_or_IPaddr:nn' format\n"
11682
11683DEFUN (ip_extcommunity_list_standard,
11684 ip_extcommunity_list_standard_cmd,
11685 "ip extcommunity-list <1-99> (deny|permit) .AA:NN",
11686 IP_STR
11687 EXTCOMMUNITY_LIST_STR
11688 "Extended Community list number (standard)\n"
11689 "Specify community to reject\n"
11690 "Specify community to accept\n"
11691 EXTCOMMUNITY_VAL_STR)
11692{
11693 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0);
11694}
11695
11696ALIAS (ip_extcommunity_list_standard,
11697 ip_extcommunity_list_standard2_cmd,
11698 "ip extcommunity-list <1-99> (deny|permit)",
11699 IP_STR
11700 EXTCOMMUNITY_LIST_STR
11701 "Extended Community list number (standard)\n"
11702 "Specify community to reject\n"
11703 "Specify community to accept\n")
11704
11705DEFUN (ip_extcommunity_list_expanded,
11706 ip_extcommunity_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000011707 "ip extcommunity-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000011708 IP_STR
11709 EXTCOMMUNITY_LIST_STR
11710 "Extended Community list number (expanded)\n"
11711 "Specify community to reject\n"
11712 "Specify community to accept\n"
11713 "An ordered list as a regular-expression\n")
11714{
11715 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0);
11716}
11717
11718DEFUN (ip_extcommunity_list_name_standard,
11719 ip_extcommunity_list_name_standard_cmd,
11720 "ip extcommunity-list standard WORD (deny|permit) .AA:NN",
11721 IP_STR
11722 EXTCOMMUNITY_LIST_STR
11723 "Specify standard extcommunity-list\n"
11724 "Extended Community list name\n"
11725 "Specify community to reject\n"
11726 "Specify community to accept\n"
11727 EXTCOMMUNITY_VAL_STR)
11728{
11729 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1);
11730}
11731
11732ALIAS (ip_extcommunity_list_name_standard,
11733 ip_extcommunity_list_name_standard2_cmd,
11734 "ip extcommunity-list standard WORD (deny|permit)",
11735 IP_STR
11736 EXTCOMMUNITY_LIST_STR
11737 "Specify standard extcommunity-list\n"
11738 "Extended Community list name\n"
11739 "Specify community to reject\n"
11740 "Specify community to accept\n")
11741
11742DEFUN (ip_extcommunity_list_name_expanded,
11743 ip_extcommunity_list_name_expanded_cmd,
11744 "ip extcommunity-list expanded WORD (deny|permit) .LINE",
11745 IP_STR
11746 EXTCOMMUNITY_LIST_STR
11747 "Specify expanded extcommunity-list\n"
11748 "Extended Community list name\n"
11749 "Specify community to reject\n"
11750 "Specify community to accept\n"
11751 "An ordered list as a regular-expression\n")
11752{
11753 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1);
11754}
11755
hassofee6e4e2005-02-02 16:29:31 +000011756DEFUN (no_ip_extcommunity_list_standard_all,
11757 no_ip_extcommunity_list_standard_all_cmd,
11758 "no ip extcommunity-list <1-99>",
paul718e3742002-12-13 20:15:29 +000011759 NO_STR
11760 IP_STR
11761 EXTCOMMUNITY_LIST_STR
hassofee6e4e2005-02-02 16:29:31 +000011762 "Extended Community list number (standard)\n")
paul718e3742002-12-13 20:15:29 +000011763{
hassofee6e4e2005-02-02 16:29:31 +000011764 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
paul718e3742002-12-13 20:15:29 +000011765}
11766
hassofee6e4e2005-02-02 16:29:31 +000011767DEFUN (no_ip_extcommunity_list_expanded_all,
11768 no_ip_extcommunity_list_expanded_all_cmd,
11769 "no ip extcommunity-list <100-500>",
11770 NO_STR
11771 IP_STR
11772 EXTCOMMUNITY_LIST_STR
11773 "Extended Community list number (expanded)\n")
11774{
11775 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
11776}
11777
11778DEFUN (no_ip_extcommunity_list_name_standard_all,
11779 no_ip_extcommunity_list_name_standard_all_cmd,
11780 "no ip extcommunity-list standard WORD",
paul718e3742002-12-13 20:15:29 +000011781 NO_STR
11782 IP_STR
11783 EXTCOMMUNITY_LIST_STR
11784 "Specify standard extcommunity-list\n"
hassofee6e4e2005-02-02 16:29:31 +000011785 "Extended Community list name\n")
11786{
11787 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
11788}
11789
11790DEFUN (no_ip_extcommunity_list_name_expanded_all,
11791 no_ip_extcommunity_list_name_expanded_all_cmd,
11792 "no ip extcommunity-list expanded WORD",
11793 NO_STR
11794 IP_STR
11795 EXTCOMMUNITY_LIST_STR
paul718e3742002-12-13 20:15:29 +000011796 "Specify expanded extcommunity-list\n"
11797 "Extended Community list name\n")
11798{
hassofee6e4e2005-02-02 16:29:31 +000011799 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
paul718e3742002-12-13 20:15:29 +000011800}
11801
11802DEFUN (no_ip_extcommunity_list_standard,
11803 no_ip_extcommunity_list_standard_cmd,
11804 "no ip extcommunity-list <1-99> (deny|permit) .AA:NN",
11805 NO_STR
11806 IP_STR
11807 EXTCOMMUNITY_LIST_STR
11808 "Extended Community list number (standard)\n"
11809 "Specify community to reject\n"
11810 "Specify community to accept\n"
11811 EXTCOMMUNITY_VAL_STR)
11812{
11813 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
11814}
11815
11816DEFUN (no_ip_extcommunity_list_expanded,
11817 no_ip_extcommunity_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000011818 "no ip extcommunity-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000011819 NO_STR
11820 IP_STR
11821 EXTCOMMUNITY_LIST_STR
11822 "Extended Community list number (expanded)\n"
11823 "Specify community to reject\n"
11824 "Specify community to accept\n"
11825 "An ordered list as a regular-expression\n")
11826{
11827 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
11828}
11829
11830DEFUN (no_ip_extcommunity_list_name_standard,
11831 no_ip_extcommunity_list_name_standard_cmd,
11832 "no ip extcommunity-list standard WORD (deny|permit) .AA:NN",
11833 NO_STR
11834 IP_STR
11835 EXTCOMMUNITY_LIST_STR
11836 "Specify standard extcommunity-list\n"
11837 "Extended Community list name\n"
11838 "Specify community to reject\n"
11839 "Specify community to accept\n"
11840 EXTCOMMUNITY_VAL_STR)
11841{
11842 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
11843}
11844
11845DEFUN (no_ip_extcommunity_list_name_expanded,
11846 no_ip_extcommunity_list_name_expanded_cmd,
11847 "no ip extcommunity-list expanded WORD (deny|permit) .LINE",
11848 NO_STR
11849 IP_STR
11850 EXTCOMMUNITY_LIST_STR
11851 "Specify expanded extcommunity-list\n"
11852 "Community list name\n"
11853 "Specify community to reject\n"
11854 "Specify community to accept\n"
11855 "An ordered list as a regular-expression\n")
11856{
11857 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
11858}
11859
paul94f2b392005-06-28 12:44:16 +000011860static void
paul718e3742002-12-13 20:15:29 +000011861extcommunity_list_show (struct vty *vty, struct community_list *list)
11862{
11863 struct community_entry *entry;
11864
11865 for (entry = list->head; entry; entry = entry->next)
11866 {
11867 if (entry == list->head)
11868 {
11869 if (all_digit (list->name))
11870 vty_out (vty, "Extended community %s list %s%s",
11871 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
11872 "standard" : "(expanded) access",
11873 list->name, VTY_NEWLINE);
11874 else
11875 vty_out (vty, "Named extended community %s list %s%s",
11876 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
11877 "standard" : "expanded",
11878 list->name, VTY_NEWLINE);
11879 }
11880 if (entry->any)
11881 vty_out (vty, " %s%s",
11882 community_direct_str (entry->direct), VTY_NEWLINE);
11883 else
11884 vty_out (vty, " %s %s%s",
11885 community_direct_str (entry->direct),
11886 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
11887 entry->u.ecom->str : entry->config,
11888 VTY_NEWLINE);
11889 }
11890}
11891
11892DEFUN (show_ip_extcommunity_list,
11893 show_ip_extcommunity_list_cmd,
11894 "show ip extcommunity-list",
11895 SHOW_STR
11896 IP_STR
11897 "List extended-community list\n")
11898{
11899 struct community_list *list;
11900 struct community_list_master *cm;
11901
hassofee6e4e2005-02-02 16:29:31 +000011902 cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011903 if (! cm)
11904 return CMD_SUCCESS;
11905
11906 for (list = cm->num.head; list; list = list->next)
11907 extcommunity_list_show (vty, list);
11908
11909 for (list = cm->str.head; list; list = list->next)
11910 extcommunity_list_show (vty, list);
11911
11912 return CMD_SUCCESS;
11913}
11914
11915DEFUN (show_ip_extcommunity_list_arg,
11916 show_ip_extcommunity_list_arg_cmd,
hassofee6e4e2005-02-02 16:29:31 +000011917 "show ip extcommunity-list (<1-500>|WORD)",
paul718e3742002-12-13 20:15:29 +000011918 SHOW_STR
11919 IP_STR
11920 "List extended-community list\n"
11921 "Extcommunity-list number\n"
11922 "Extcommunity-list name\n")
11923{
11924 struct community_list *list;
11925
hassofee6e4e2005-02-02 16:29:31 +000011926 list = community_list_lookup (bgp_clist, argv[0], EXTCOMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011927 if (! list)
11928 {
Denis Ovsienkob7292942010-12-08 18:51:37 +030011929 vty_out (vty, "%% Can't find extcommunity-list%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000011930 return CMD_WARNING;
11931 }
11932
11933 extcommunity_list_show (vty, list);
11934
11935 return CMD_SUCCESS;
11936}
David Lamparter6b0655a2014-06-04 06:53:35 +020011937
paul718e3742002-12-13 20:15:29 +000011938/* Return configuration string of community-list entry. */
paulfd79ac92004-10-13 05:06:08 +000011939static const char *
paul718e3742002-12-13 20:15:29 +000011940community_list_config_str (struct community_entry *entry)
11941{
paulfd79ac92004-10-13 05:06:08 +000011942 const char *str;
paul718e3742002-12-13 20:15:29 +000011943
11944 if (entry->any)
11945 str = "";
11946 else
11947 {
11948 if (entry->style == COMMUNITY_LIST_STANDARD)
11949 str = community_str (entry->u.com);
11950 else
11951 str = entry->config;
11952 }
11953 return str;
11954}
11955
11956/* Display community-list and extcommunity-list configuration. */
paul94f2b392005-06-28 12:44:16 +000011957static int
paul718e3742002-12-13 20:15:29 +000011958community_list_config_write (struct vty *vty)
11959{
11960 struct community_list *list;
11961 struct community_entry *entry;
11962 struct community_list_master *cm;
11963 int write = 0;
11964
11965 /* Community-list. */
hassofee6e4e2005-02-02 16:29:31 +000011966 cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011967
11968 for (list = cm->num.head; list; list = list->next)
11969 for (entry = list->head; entry; entry = entry->next)
11970 {
hassofee6e4e2005-02-02 16:29:31 +000011971 vty_out (vty, "ip community-list %s %s %s%s",
11972 list->name, community_direct_str (entry->direct),
11973 community_list_config_str (entry),
11974 VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000011975 write++;
11976 }
11977 for (list = cm->str.head; list; list = list->next)
11978 for (entry = list->head; entry; entry = entry->next)
11979 {
11980 vty_out (vty, "ip community-list %s %s %s %s%s",
11981 entry->style == COMMUNITY_LIST_STANDARD
11982 ? "standard" : "expanded",
11983 list->name, community_direct_str (entry->direct),
11984 community_list_config_str (entry),
11985 VTY_NEWLINE);
11986 write++;
11987 }
11988
11989 /* Extcommunity-list. */
hassofee6e4e2005-02-02 16:29:31 +000011990 cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011991
11992 for (list = cm->num.head; list; list = list->next)
11993 for (entry = list->head; entry; entry = entry->next)
11994 {
hassofee6e4e2005-02-02 16:29:31 +000011995 vty_out (vty, "ip extcommunity-list %s %s %s%s",
11996 list->name, community_direct_str (entry->direct),
11997 community_list_config_str (entry), VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000011998 write++;
11999 }
12000 for (list = cm->str.head; list; list = list->next)
12001 for (entry = list->head; entry; entry = entry->next)
12002 {
12003 vty_out (vty, "ip extcommunity-list %s %s %s %s%s",
12004 entry->style == EXTCOMMUNITY_LIST_STANDARD
12005 ? "standard" : "expanded",
12006 list->name, community_direct_str (entry->direct),
12007 community_list_config_str (entry), VTY_NEWLINE);
12008 write++;
12009 }
12010 return write;
12011}
12012
Stephen Hemminger7fc626d2008-12-01 11:10:34 -080012013static struct cmd_node community_list_node =
paul718e3742002-12-13 20:15:29 +000012014{
12015 COMMUNITY_LIST_NODE,
12016 "",
12017 1 /* Export to vtysh. */
12018};
12019
paul94f2b392005-06-28 12:44:16 +000012020static void
12021community_list_vty (void)
paul718e3742002-12-13 20:15:29 +000012022{
12023 install_node (&community_list_node, community_list_config_write);
12024
12025 /* Community-list. */
paul718e3742002-12-13 20:15:29 +000012026 install_element (CONFIG_NODE, &ip_community_list_standard_cmd);
12027 install_element (CONFIG_NODE, &ip_community_list_standard2_cmd);
12028 install_element (CONFIG_NODE, &ip_community_list_expanded_cmd);
12029 install_element (CONFIG_NODE, &ip_community_list_name_standard_cmd);
12030 install_element (CONFIG_NODE, &ip_community_list_name_standard2_cmd);
12031 install_element (CONFIG_NODE, &ip_community_list_name_expanded_cmd);
hassofee6e4e2005-02-02 16:29:31 +000012032 install_element (CONFIG_NODE, &no_ip_community_list_standard_all_cmd);
12033 install_element (CONFIG_NODE, &no_ip_community_list_expanded_all_cmd);
12034 install_element (CONFIG_NODE, &no_ip_community_list_name_standard_all_cmd);
12035 install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_all_cmd);
paul718e3742002-12-13 20:15:29 +000012036 install_element (CONFIG_NODE, &no_ip_community_list_standard_cmd);
12037 install_element (CONFIG_NODE, &no_ip_community_list_expanded_cmd);
12038 install_element (CONFIG_NODE, &no_ip_community_list_name_standard_cmd);
12039 install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_cmd);
12040 install_element (VIEW_NODE, &show_ip_community_list_cmd);
12041 install_element (VIEW_NODE, &show_ip_community_list_arg_cmd);
12042 install_element (ENABLE_NODE, &show_ip_community_list_cmd);
12043 install_element (ENABLE_NODE, &show_ip_community_list_arg_cmd);
12044
12045 /* Extcommunity-list. */
12046 install_element (CONFIG_NODE, &ip_extcommunity_list_standard_cmd);
12047 install_element (CONFIG_NODE, &ip_extcommunity_list_standard2_cmd);
12048 install_element (CONFIG_NODE, &ip_extcommunity_list_expanded_cmd);
12049 install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard_cmd);
12050 install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard2_cmd);
12051 install_element (CONFIG_NODE, &ip_extcommunity_list_name_expanded_cmd);
hassofee6e4e2005-02-02 16:29:31 +000012052 install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_all_cmd);
12053 install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_all_cmd);
12054 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_all_cmd);
12055 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_all_cmd);
paul718e3742002-12-13 20:15:29 +000012056 install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_cmd);
12057 install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_cmd);
12058 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_cmd);
12059 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_cmd);
12060 install_element (VIEW_NODE, &show_ip_extcommunity_list_cmd);
12061 install_element (VIEW_NODE, &show_ip_extcommunity_list_arg_cmd);
12062 install_element (ENABLE_NODE, &show_ip_extcommunity_list_cmd);
12063 install_element (ENABLE_NODE, &show_ip_extcommunity_list_arg_cmd);
12064}