blob: 3b69a1bcaebe87bc2eb7bcbe7feff421514b1bae [file] [log] [blame]
paul718e3742002-12-13 20:15:29 +00001/* BGP VTY interface.
2 Copyright (C) 1996, 97, 98, 99, 2000 Kunihiro Ishiguro
3
4This file is part of GNU Zebra.
5
6GNU Zebra is free software; you can redistribute it and/or modify it
7under the terms of the GNU General Public License as published by the
8Free Software Foundation; either version 2, or (at your option) any
9later version.
10
11GNU Zebra is distributed in the hope that it will be useful, but
12WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with GNU Zebra; see the file COPYING. If not, write to the Free
18Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
1902111-1307, USA. */
20
21#include <zebra.h>
22
23#include "command.h"
24#include "prefix.h"
25#include "plist.h"
26#include "buffer.h"
27#include "linklist.h"
28#include "stream.h"
29#include "thread.h"
30#include "log.h"
ajs3b8b1852005-01-29 18:19:13 +000031#include "memory.h"
Paul Jakma4bf6a362006-03-30 14:05:23 +000032#include "hash.h"
Donald Sharp04907292016-01-07 10:03:01 -050033#include "filter.h"
paul718e3742002-12-13 20:15:29 +000034
35#include "bgpd/bgpd.h"
Paul Jakma4bf6a362006-03-30 14:05:23 +000036#include "bgpd/bgp_advertise.h"
paul718e3742002-12-13 20:15:29 +000037#include "bgpd/bgp_attr.h"
38#include "bgpd/bgp_aspath.h"
39#include "bgpd/bgp_community.h"
Paul Jakma4bf6a362006-03-30 14:05:23 +000040#include "bgpd/bgp_ecommunity.h"
41#include "bgpd/bgp_damp.h"
paul718e3742002-12-13 20:15:29 +000042#include "bgpd/bgp_debug.h"
hassoe0701b72004-05-20 09:19:34 +000043#include "bgpd/bgp_fsm.h"
paul718e3742002-12-13 20:15:29 +000044#include "bgpd/bgp_mplsvpn.h"
Paul Jakma4bf6a362006-03-30 14:05:23 +000045#include "bgpd/bgp_nexthop.h"
paul718e3742002-12-13 20:15:29 +000046#include "bgpd/bgp_open.h"
Paul Jakma4bf6a362006-03-30 14:05:23 +000047#include "bgpd/bgp_regex.h"
paul718e3742002-12-13 20:15:29 +000048#include "bgpd/bgp_route.h"
49#include "bgpd/bgp_zebra.h"
paulfee0f4c2004-09-13 05:12:46 +000050#include "bgpd/bgp_table.h"
paul94f2b392005-06-28 12:44:16 +000051#include "bgpd/bgp_vty.h"
Josh Bailey165b5ff2011-07-20 20:43:22 -070052#include "bgpd/bgp_mpath.h"
paul718e3742002-12-13 20:15:29 +000053
hasso18a6dce2004-10-03 18:18:34 +000054extern struct in_addr router_id_zebra;
55
paul718e3742002-12-13 20:15:29 +000056/* Utility function to get address family from current node. */
57afi_t
58bgp_node_afi (struct vty *vty)
59{
Lou Berger135ca152016-01-12 13:42:05 -050060 afi_t afi;
Lou Berger13c378d2016-01-12 13:41:56 -050061 switch (vty->node)
62 {
63 case BGP_IPV6_NODE:
64 case BGP_IPV6M_NODE:
65 case BGP_VPNV6_NODE:
Lou Bergera3fda882016-01-12 13:42:04 -050066 case BGP_ENCAPV6_NODE:
Lou Berger135ca152016-01-12 13:42:05 -050067 afi = AFI_IP6;
68 break;
69 default:
70 afi = AFI_IP;
Lou Berger13c378d2016-01-12 13:41:56 -050071 break;
72 }
Lou Berger135ca152016-01-12 13:42:05 -050073 return afi;
paul718e3742002-12-13 20:15:29 +000074}
75
76/* Utility function to get subsequent address family from current
77 node. */
78safi_t
79bgp_node_safi (struct vty *vty)
80{
Lou Berger135ca152016-01-12 13:42:05 -050081 safi_t safi;
82 switch (vty->node)
83 {
84 case BGP_ENCAP_NODE:
85 case BGP_ENCAPV6_NODE:
86 safi = SAFI_ENCAP;
87 break;
88 case BGP_VPNV4_NODE:
89 case BGP_VPNV6_NODE:
90 safi = SAFI_MPLS_VPN;
91 break;
92 case BGP_IPV4M_NODE:
93 case BGP_IPV6M_NODE:
94 safi = SAFI_MULTICAST;
95 break;
96 default:
97 safi = SAFI_UNICAST;
98 break;
99 }
100 return safi;
paul718e3742002-12-13 20:15:29 +0000101}
102
Lou Bergera3fda882016-01-12 13:42:04 -0500103int
104bgp_parse_afi(const char *str, afi_t *afi)
105{
106 if (!strcmp(str, "ipv4")) {
107 *afi = AFI_IP;
108 return 0;
109 }
Lou Bergera3fda882016-01-12 13:42:04 -0500110 if (!strcmp(str, "ipv6")) {
111 *afi = AFI_IP6;
112 return 0;
113 }
Lou Bergera3fda882016-01-12 13:42:04 -0500114 return -1;
115}
116
117int
118bgp_parse_safi(const char *str, safi_t *safi)
119{
120 if (!strcmp(str, "encap")) {
121 *safi = SAFI_ENCAP;
122 return 0;
123 }
124 if (!strcmp(str, "multicast")) {
125 *safi = SAFI_MULTICAST;
126 return 0;
127 }
128 if (!strcmp(str, "unicast")) {
129 *safi = SAFI_UNICAST;
130 return 0;
131 }
132 if (!strcmp(str, "vpn")) {
133 *safi = SAFI_MPLS_VPN;
134 return 0;
135 }
136 return -1;
137}
138
paul94f2b392005-06-28 12:44:16 +0000139static int
paul718e3742002-12-13 20:15:29 +0000140peer_address_self_check (union sockunion *su)
141{
142 struct interface *ifp = NULL;
143
144 if (su->sa.sa_family == AF_INET)
145 ifp = if_lookup_by_ipv4_exact (&su->sin.sin_addr);
paul718e3742002-12-13 20:15:29 +0000146 else if (su->sa.sa_family == AF_INET6)
147 ifp = if_lookup_by_ipv6_exact (&su->sin6.sin6_addr);
paul718e3742002-12-13 20:15:29 +0000148
149 if (ifp)
150 return 1;
151
152 return 0;
153}
154
155/* Utility function for looking up peer from VTY. */
paul94f2b392005-06-28 12:44:16 +0000156static struct peer *
paulfd79ac92004-10-13 05:06:08 +0000157peer_lookup_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +0000158{
159 int ret;
160 struct bgp *bgp;
161 union sockunion su;
162 struct peer *peer;
163
164 bgp = vty->index;
165
166 ret = str2sockunion (ip_str, &su);
167 if (ret < 0)
168 {
169 vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE);
170 return NULL;
171 }
172
173 peer = peer_lookup (bgp, &su);
174 if (! peer)
175 {
176 vty_out (vty, "%% Specify remote-as or peer-group commands first%s", VTY_NEWLINE);
177 return NULL;
178 }
179 return peer;
180}
181
182/* Utility function for looking up peer or peer group. */
paul94f2b392005-06-28 12:44:16 +0000183static struct peer *
paulfd79ac92004-10-13 05:06:08 +0000184peer_and_group_lookup_vty (struct vty *vty, const char *peer_str)
paul718e3742002-12-13 20:15:29 +0000185{
186 int ret;
187 struct bgp *bgp;
188 union sockunion su;
189 struct peer *peer;
190 struct peer_group *group;
191
192 bgp = vty->index;
193
194 ret = str2sockunion (peer_str, &su);
195 if (ret == 0)
196 {
197 peer = peer_lookup (bgp, &su);
198 if (peer)
199 return peer;
200 }
201 else
202 {
203 group = peer_group_lookup (bgp, peer_str);
204 if (group)
205 return group->conf;
206 }
207
208 vty_out (vty, "%% Specify remote-as or peer-group commands first%s",
209 VTY_NEWLINE);
210
211 return NULL;
212}
213
paul94f2b392005-06-28 12:44:16 +0000214static int
paul718e3742002-12-13 20:15:29 +0000215bgp_vty_return (struct vty *vty, int ret)
216{
paulfd79ac92004-10-13 05:06:08 +0000217 const char *str = NULL;
paul718e3742002-12-13 20:15:29 +0000218
219 switch (ret)
220 {
221 case BGP_ERR_INVALID_VALUE:
222 str = "Invalid value";
223 break;
224 case BGP_ERR_INVALID_FLAG:
225 str = "Invalid flag";
226 break;
227 case BGP_ERR_PEER_INACTIVE:
228 str = "Activate the neighbor for the address family first";
229 break;
230 case BGP_ERR_INVALID_FOR_PEER_GROUP_MEMBER:
231 str = "Invalid command for a peer-group member";
232 break;
233 case BGP_ERR_PEER_GROUP_SHUTDOWN:
234 str = "Peer-group has been shutdown. Activate the peer-group first";
235 break;
236 case BGP_ERR_PEER_GROUP_HAS_THE_FLAG:
237 str = "This peer is a peer-group member. Please change peer-group configuration";
238 break;
239 case BGP_ERR_PEER_FLAG_CONFLICT:
240 str = "Can't set override-capability and strict-capability-match at the same time";
241 break;
242 case BGP_ERR_PEER_GROUP_MEMBER_EXISTS:
243 str = "No activate for peergroup can be given only if peer-group has no members";
244 break;
245 case BGP_ERR_PEER_BELONGS_TO_GROUP:
246 str = "No activate for an individual peer-group member is invalid";
247 break;
248 case BGP_ERR_PEER_GROUP_AF_UNCONFIGURED:
249 str = "Activate the peer-group for the address family first";
250 break;
251 case BGP_ERR_PEER_GROUP_NO_REMOTE_AS:
252 str = "Specify remote-as or peer-group remote AS first";
253 break;
254 case BGP_ERR_PEER_GROUP_CANT_CHANGE:
255 str = "Cannot change the peer-group. Deconfigure first";
256 break;
257 case BGP_ERR_PEER_GROUP_MISMATCH:
258 str = "Cannot have different peer-group for the neighbor";
259 break;
260 case BGP_ERR_PEER_FILTER_CONFLICT:
261 str = "Prefix/distribute list can not co-exist";
262 break;
263 case BGP_ERR_NOT_INTERNAL_PEER:
264 str = "Invalid command. Not an internal neighbor";
265 break;
266 case BGP_ERR_REMOVE_PRIVATE_AS:
267 str = "Private AS cannot be removed for IBGP peers";
268 break;
269 case BGP_ERR_LOCAL_AS_ALLOWED_ONLY_FOR_EBGP:
270 str = "Local-AS allowed only for EBGP peers";
271 break;
272 case BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS:
273 str = "Cannot have local-as same as BGP AS number";
274 break;
Paul Jakma0df7c912008-07-21 21:02:49 +0000275 case BGP_ERR_TCPSIG_FAILED:
276 str = "Error while applying TCP-Sig to session(s)";
277 break;
Nick Hilliardfa411a22011-03-23 15:33:17 +0000278 case BGP_ERR_NO_EBGP_MULTIHOP_WITH_TTLHACK:
279 str = "ebgp-multihop and ttl-security cannot be configured together";
280 break;
Stephen Hemmingerf5a48272011-03-24 17:30:21 +0000281 case BGP_ERR_NO_IBGP_WITH_TTLHACK:
282 str = "ttl-security only allowed for EBGP peers";
283 break;
paul718e3742002-12-13 20:15:29 +0000284 }
285 if (str)
286 {
287 vty_out (vty, "%% %s%s", str, VTY_NEWLINE);
288 return CMD_WARNING;
289 }
290 return CMD_SUCCESS;
291}
292
293/* BGP global configuration. */
294
295DEFUN (bgp_multiple_instance_func,
296 bgp_multiple_instance_cmd,
297 "bgp multiple-instance",
298 BGP_STR
299 "Enable bgp multiple instance\n")
300{
301 bgp_option_set (BGP_OPT_MULTIPLE_INSTANCE);
302 return CMD_SUCCESS;
303}
304
305DEFUN (no_bgp_multiple_instance,
306 no_bgp_multiple_instance_cmd,
307 "no bgp multiple-instance",
308 NO_STR
309 BGP_STR
310 "BGP multiple instance\n")
311{
312 int ret;
313
314 ret = bgp_option_unset (BGP_OPT_MULTIPLE_INSTANCE);
315 if (ret < 0)
316 {
317 vty_out (vty, "%% There are more than two BGP instances%s", VTY_NEWLINE);
318 return CMD_WARNING;
319 }
320 return CMD_SUCCESS;
321}
322
323DEFUN (bgp_config_type,
324 bgp_config_type_cmd,
325 "bgp config-type (cisco|zebra)",
326 BGP_STR
327 "Configuration type\n"
328 "cisco\n"
329 "zebra\n")
330{
331 if (strncmp (argv[0], "c", 1) == 0)
332 bgp_option_set (BGP_OPT_CONFIG_CISCO);
333 else
334 bgp_option_unset (BGP_OPT_CONFIG_CISCO);
335
336 return CMD_SUCCESS;
337}
338
339DEFUN (no_bgp_config_type,
340 no_bgp_config_type_cmd,
341 "no bgp config-type",
342 NO_STR
343 BGP_STR
344 "Display configuration type\n")
345{
346 bgp_option_unset (BGP_OPT_CONFIG_CISCO);
347 return CMD_SUCCESS;
348}
349
350DEFUN (no_synchronization,
351 no_synchronization_cmd,
352 "no synchronization",
353 NO_STR
354 "Perform IGP synchronization\n")
355{
356 return CMD_SUCCESS;
357}
358
359DEFUN (no_auto_summary,
360 no_auto_summary_cmd,
361 "no auto-summary",
362 NO_STR
363 "Enable automatic network number summarization\n")
364{
365 return CMD_SUCCESS;
366}
hasso3d515fd2005-02-01 21:30:04 +0000367
368DEFUN_DEPRECATED (neighbor_version,
369 neighbor_version_cmd,
370 NEIGHBOR_CMD "version (4|4-)",
371 NEIGHBOR_STR
372 NEIGHBOR_ADDR_STR
373 "Set the BGP version to match a neighbor\n"
374 "Neighbor's BGP version\n")
375{
376 return CMD_SUCCESS;
377}
David Lamparter6b0655a2014-06-04 06:53:35 +0200378
paul718e3742002-12-13 20:15:29 +0000379/* "router bgp" commands. */
380DEFUN (router_bgp,
381 router_bgp_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000382 "router bgp " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000383 ROUTER_STR
384 BGP_STR
385 AS_STR)
386{
387 int ret;
388 as_t as;
389 struct bgp *bgp;
paulfd79ac92004-10-13 05:06:08 +0000390 const char *name = NULL;
paul718e3742002-12-13 20:15:29 +0000391
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000392 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +0000393
394 if (argc == 2)
395 name = argv[1];
396
397 ret = bgp_get (&bgp, &as, name);
398 switch (ret)
399 {
400 case BGP_ERR_MULTIPLE_INSTANCE_NOT_SET:
401 vty_out (vty, "Please specify 'bgp multiple-instance' first%s",
402 VTY_NEWLINE);
403 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +0000404 case BGP_ERR_AS_MISMATCH:
Denis Ovsienkoaea339f2009-04-30 17:16:22 +0400405 vty_out (vty, "BGP is already running; AS is %u%s", as, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +0000406 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +0000407 case BGP_ERR_INSTANCE_MISMATCH:
408 vty_out (vty, "BGP view name and AS number mismatch%s", VTY_NEWLINE);
Denis Ovsienkoaea339f2009-04-30 17:16:22 +0400409 vty_out (vty, "BGP instance is already running; AS is %u%s",
paul718e3742002-12-13 20:15:29 +0000410 as, VTY_NEWLINE);
411 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +0000412 }
413
414 vty->node = BGP_NODE;
415 vty->index = bgp;
416
417 return CMD_SUCCESS;
418}
419
420ALIAS (router_bgp,
421 router_bgp_view_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000422 "router bgp " CMD_AS_RANGE " view WORD",
paul718e3742002-12-13 20:15:29 +0000423 ROUTER_STR
424 BGP_STR
425 AS_STR
426 "BGP view\n"
427 "view name\n")
David Lamparter6b0655a2014-06-04 06:53:35 +0200428
paul718e3742002-12-13 20:15:29 +0000429/* "no router bgp" commands. */
430DEFUN (no_router_bgp,
431 no_router_bgp_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000432 "no router bgp " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000433 NO_STR
434 ROUTER_STR
435 BGP_STR
436 AS_STR)
437{
438 as_t as;
439 struct bgp *bgp;
paulfd79ac92004-10-13 05:06:08 +0000440 const char *name = NULL;
paul718e3742002-12-13 20:15:29 +0000441
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000442 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +0000443
444 if (argc == 2)
445 name = argv[1];
446
447 /* Lookup bgp structure. */
448 bgp = bgp_lookup (as, name);
449 if (! bgp)
450 {
451 vty_out (vty, "%% Can't find BGP instance%s", VTY_NEWLINE);
452 return CMD_WARNING;
453 }
454
455 bgp_delete (bgp);
456
457 return CMD_SUCCESS;
458}
459
460ALIAS (no_router_bgp,
461 no_router_bgp_view_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000462 "no router bgp " CMD_AS_RANGE " view WORD",
paul718e3742002-12-13 20:15:29 +0000463 NO_STR
464 ROUTER_STR
465 BGP_STR
466 AS_STR
467 "BGP view\n"
468 "view name\n")
David Lamparter6b0655a2014-06-04 06:53:35 +0200469
paul718e3742002-12-13 20:15:29 +0000470/* BGP router-id. */
471
472DEFUN (bgp_router_id,
473 bgp_router_id_cmd,
474 "bgp router-id A.B.C.D",
475 BGP_STR
476 "Override configured router identifier\n"
477 "Manually configured router identifier\n")
478{
479 int ret;
480 struct in_addr id;
481 struct bgp *bgp;
482
483 bgp = vty->index;
484
485 ret = inet_aton (argv[0], &id);
486 if (! ret)
487 {
488 vty_out (vty, "%% Malformed bgp router identifier%s", VTY_NEWLINE);
489 return CMD_WARNING;
490 }
491
hasso18a6dce2004-10-03 18:18:34 +0000492 bgp->router_id_static = id;
paul718e3742002-12-13 20:15:29 +0000493 bgp_router_id_set (bgp, &id);
494
495 return CMD_SUCCESS;
496}
497
498DEFUN (no_bgp_router_id,
499 no_bgp_router_id_cmd,
500 "no bgp router-id",
501 NO_STR
502 BGP_STR
503 "Override configured router identifier\n")
504{
505 int ret;
506 struct in_addr id;
507 struct bgp *bgp;
508
509 bgp = vty->index;
510
511 if (argc == 1)
512 {
513 ret = inet_aton (argv[0], &id);
514 if (! ret)
515 {
516 vty_out (vty, "%% Malformed BGP router identifier%s", VTY_NEWLINE);
517 return CMD_WARNING;
518 }
519
hasso18a6dce2004-10-03 18:18:34 +0000520 if (! IPV4_ADDR_SAME (&bgp->router_id_static, &id))
paul718e3742002-12-13 20:15:29 +0000521 {
522 vty_out (vty, "%% BGP router-id doesn't match%s", VTY_NEWLINE);
523 return CMD_WARNING;
524 }
525 }
526
hasso18a6dce2004-10-03 18:18:34 +0000527 bgp->router_id_static.s_addr = 0;
528 bgp_router_id_set (bgp, &router_id_zebra);
paul718e3742002-12-13 20:15:29 +0000529
530 return CMD_SUCCESS;
531}
532
533ALIAS (no_bgp_router_id,
534 no_bgp_router_id_val_cmd,
535 "no bgp router-id A.B.C.D",
536 NO_STR
537 BGP_STR
538 "Override configured router identifier\n"
539 "Manually configured router identifier\n")
David Lamparter6b0655a2014-06-04 06:53:35 +0200540
paul718e3742002-12-13 20:15:29 +0000541/* BGP Cluster ID. */
542
543DEFUN (bgp_cluster_id,
544 bgp_cluster_id_cmd,
545 "bgp cluster-id A.B.C.D",
546 BGP_STR
547 "Configure Route-Reflector Cluster-id\n"
548 "Route-Reflector Cluster-id in IP address format\n")
549{
550 int ret;
551 struct bgp *bgp;
552 struct in_addr cluster;
553
554 bgp = vty->index;
555
556 ret = inet_aton (argv[0], &cluster);
557 if (! ret)
558 {
559 vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE);
560 return CMD_WARNING;
561 }
562
563 bgp_cluster_id_set (bgp, &cluster);
564
565 return CMD_SUCCESS;
566}
567
568ALIAS (bgp_cluster_id,
569 bgp_cluster_id32_cmd,
570 "bgp cluster-id <1-4294967295>",
571 BGP_STR
572 "Configure Route-Reflector Cluster-id\n"
573 "Route-Reflector Cluster-id as 32 bit quantity\n")
574
575DEFUN (no_bgp_cluster_id,
576 no_bgp_cluster_id_cmd,
577 "no bgp cluster-id",
578 NO_STR
579 BGP_STR
580 "Configure Route-Reflector Cluster-id\n")
581{
582 int ret;
583 struct bgp *bgp;
584 struct in_addr cluster;
585
586 bgp = vty->index;
587
588 if (argc == 1)
589 {
590 ret = inet_aton (argv[0], &cluster);
591 if (! ret)
592 {
593 vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE);
594 return CMD_WARNING;
595 }
596 }
597
598 bgp_cluster_id_unset (bgp);
599
600 return CMD_SUCCESS;
601}
602
603ALIAS (no_bgp_cluster_id,
604 no_bgp_cluster_id_arg_cmd,
605 "no bgp cluster-id A.B.C.D",
606 NO_STR
607 BGP_STR
608 "Configure Route-Reflector Cluster-id\n"
609 "Route-Reflector Cluster-id in IP address format\n")
David Lamparter6b0655a2014-06-04 06:53:35 +0200610
paul718e3742002-12-13 20:15:29 +0000611DEFUN (bgp_confederation_identifier,
612 bgp_confederation_identifier_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000613 "bgp confederation identifier " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000614 "BGP specific commands\n"
615 "AS confederation parameters\n"
616 "AS number\n"
617 "Set routing domain confederation AS\n")
618{
619 struct bgp *bgp;
620 as_t as;
621
622 bgp = vty->index;
623
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000624 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +0000625
626 bgp_confederation_id_set (bgp, as);
627
628 return CMD_SUCCESS;
629}
630
631DEFUN (no_bgp_confederation_identifier,
632 no_bgp_confederation_identifier_cmd,
633 "no bgp confederation identifier",
634 NO_STR
635 "BGP specific commands\n"
636 "AS confederation parameters\n"
637 "AS number\n")
638{
639 struct bgp *bgp;
Paul Jakma7aa9dce2014-09-19 14:42:23 +0100640 as_t as __attribute__((unused)); /* Dummy for VTY_GET_INTEGER_RANGE */
paul718e3742002-12-13 20:15:29 +0000641
642 bgp = vty->index;
643
644 if (argc == 1)
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000645 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +0000646
647 bgp_confederation_id_unset (bgp);
648
649 return CMD_SUCCESS;
650}
651
652ALIAS (no_bgp_confederation_identifier,
653 no_bgp_confederation_identifier_arg_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000654 "no bgp confederation identifier " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000655 NO_STR
656 "BGP specific commands\n"
657 "AS confederation parameters\n"
658 "AS number\n"
659 "Set routing domain confederation AS\n")
David Lamparter6b0655a2014-06-04 06:53:35 +0200660
paul718e3742002-12-13 20:15:29 +0000661DEFUN (bgp_confederation_peers,
662 bgp_confederation_peers_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000663 "bgp confederation peers ." CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000664 "BGP specific commands\n"
665 "AS confederation parameters\n"
666 "Peer ASs in BGP confederation\n"
667 AS_STR)
668{
669 struct bgp *bgp;
670 as_t as;
671 int i;
672
673 bgp = vty->index;
674
675 for (i = 0; i < argc; i++)
676 {
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000677 VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +0000678
679 if (bgp->as == as)
680 {
681 vty_out (vty, "%% Local member-AS not allowed in confed peer list%s",
682 VTY_NEWLINE);
683 continue;
684 }
685
686 bgp_confederation_peers_add (bgp, as);
687 }
688 return CMD_SUCCESS;
689}
690
691DEFUN (no_bgp_confederation_peers,
692 no_bgp_confederation_peers_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000693 "no bgp confederation peers ." CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000694 NO_STR
695 "BGP specific commands\n"
696 "AS confederation parameters\n"
697 "Peer ASs in BGP confederation\n"
698 AS_STR)
699{
700 struct bgp *bgp;
701 as_t as;
702 int i;
703
704 bgp = vty->index;
705
706 for (i = 0; i < argc; i++)
707 {
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000708 VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX);
709
paul718e3742002-12-13 20:15:29 +0000710 bgp_confederation_peers_remove (bgp, as);
711 }
712 return CMD_SUCCESS;
713}
David Lamparter6b0655a2014-06-04 06:53:35 +0200714
Josh Bailey165b5ff2011-07-20 20:43:22 -0700715/* Maximum-paths configuration */
716DEFUN (bgp_maxpaths,
717 bgp_maxpaths_cmd,
Donald Sharpecc1a132015-12-09 08:24:47 -0500718 "maximum-paths " CMD_RANGE_STR(1, MULTIPATH_NUM),
Josh Bailey165b5ff2011-07-20 20:43:22 -0700719 "Forward packets over multiple paths\n"
720 "Number of paths\n")
721{
722 struct bgp *bgp;
723 u_int16_t maxpaths;
724 int ret;
725
726 bgp = vty->index;
727
728 VTY_GET_INTEGER_RANGE ("maximum-paths", maxpaths, argv[0], 1, 255);
729
730 ret = bgp_maximum_paths_set (bgp, bgp_node_afi (vty), bgp_node_safi(vty),
731 BGP_PEER_EBGP, maxpaths);
732 if (ret < 0)
733 {
734 vty_out (vty,
735 "%% Failed to set maximum-paths %u for afi %u, safi %u%s",
736 maxpaths, bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE);
737 return CMD_WARNING;
738 }
739
740 return CMD_SUCCESS;
741}
742
743DEFUN (bgp_maxpaths_ibgp,
744 bgp_maxpaths_ibgp_cmd,
Donald Sharpecc1a132015-12-09 08:24:47 -0500745 "maximum-paths ibgp " CMD_RANGE_STR(1, MULTIPATH_NUM),
Josh Bailey165b5ff2011-07-20 20:43:22 -0700746 "Forward packets over multiple paths\n"
747 "iBGP-multipath\n"
748 "Number of paths\n")
749{
750 struct bgp *bgp;
751 u_int16_t maxpaths;
752 int ret;
753
754 bgp = vty->index;
755
756 VTY_GET_INTEGER_RANGE ("maximum-paths", maxpaths, argv[0], 1, 255);
757
758 ret = bgp_maximum_paths_set (bgp, bgp_node_afi (vty), bgp_node_safi(vty),
759 BGP_PEER_IBGP, maxpaths);
760 if (ret < 0)
761 {
762 vty_out (vty,
763 "%% Failed to set maximum-paths ibgp %u for afi %u, safi %u%s",
764 maxpaths, bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE);
765 return CMD_WARNING;
766 }
767
768 return CMD_SUCCESS;
769}
770
771DEFUN (no_bgp_maxpaths,
772 no_bgp_maxpaths_cmd,
773 "no maximum-paths",
774 NO_STR
775 "Forward packets over multiple paths\n"
776 "Number of paths\n")
777{
778 struct bgp *bgp;
779 int ret;
780
781 bgp = vty->index;
782
783 ret = bgp_maximum_paths_unset (bgp, bgp_node_afi (vty), bgp_node_safi(vty),
784 BGP_PEER_EBGP);
785 if (ret < 0)
786 {
787 vty_out (vty,
788 "%% Failed to unset maximum-paths for afi %u, safi %u%s",
789 bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE);
790 return CMD_WARNING;
791 }
792
793 return CMD_SUCCESS;
794}
795
796ALIAS (no_bgp_maxpaths,
797 no_bgp_maxpaths_arg_cmd,
Donald Sharpecc1a132015-12-09 08:24:47 -0500798 "no maximum-paths " CMD_RANGE_STR(1, MULTIPATH_NUM),
Josh Bailey165b5ff2011-07-20 20:43:22 -0700799 NO_STR
800 "Forward packets over multiple paths\n"
801 "Number of paths\n")
802
803DEFUN (no_bgp_maxpaths_ibgp,
804 no_bgp_maxpaths_ibgp_cmd,
805 "no maximum-paths ibgp",
806 NO_STR
807 "Forward packets over multiple paths\n"
808 "iBGP-multipath\n"
809 "Number of paths\n")
810{
811 struct bgp *bgp;
812 int ret;
813
814 bgp = vty->index;
815
816 ret = bgp_maximum_paths_unset (bgp, bgp_node_afi (vty), bgp_node_safi(vty),
817 BGP_PEER_IBGP);
818 if (ret < 0)
819 {
820 vty_out (vty,
821 "%% Failed to unset maximum-paths ibgp for afi %u, safi %u%s",
822 bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE);
823 return CMD_WARNING;
824 }
825
826 return CMD_SUCCESS;
827}
828
829ALIAS (no_bgp_maxpaths_ibgp,
830 no_bgp_maxpaths_ibgp_arg_cmd,
Donald Sharpecc1a132015-12-09 08:24:47 -0500831 "no maximum-paths ibgp " CMD_RANGE_STR(1, MULTIPATH_NUM),
Josh Bailey165b5ff2011-07-20 20:43:22 -0700832 NO_STR
833 "Forward packets over multiple paths\n"
834 "iBGP-multipath\n"
835 "Number of paths\n")
836
837int
838bgp_config_write_maxpaths (struct vty *vty, struct bgp *bgp, afi_t afi,
839 safi_t safi, int *write)
840{
841 if (bgp->maxpaths[afi][safi].maxpaths_ebgp != BGP_DEFAULT_MAXPATHS)
842 {
843 bgp_config_write_family_header (vty, afi, safi, write);
844 vty_out (vty, " maximum-paths %d%s",
845 bgp->maxpaths[afi][safi].maxpaths_ebgp, VTY_NEWLINE);
846 }
847
848 if (bgp->maxpaths[afi][safi].maxpaths_ibgp != BGP_DEFAULT_MAXPATHS)
849 {
850 bgp_config_write_family_header (vty, afi, safi, write);
851 vty_out (vty, " maximum-paths ibgp %d%s",
852 bgp->maxpaths[afi][safi].maxpaths_ibgp, VTY_NEWLINE);
853 }
854
855 return 0;
856}
David Lamparter6b0655a2014-06-04 06:53:35 +0200857
paul718e3742002-12-13 20:15:29 +0000858/* BGP timers. */
859
860DEFUN (bgp_timers,
861 bgp_timers_cmd,
862 "timers bgp <0-65535> <0-65535>",
863 "Adjust routing timers\n"
864 "BGP timers\n"
865 "Keepalive interval\n"
866 "Holdtime\n")
867{
868 struct bgp *bgp;
869 unsigned long keepalive = 0;
870 unsigned long holdtime = 0;
871
872 bgp = vty->index;
873
874 VTY_GET_INTEGER ("keepalive", keepalive, argv[0]);
875 VTY_GET_INTEGER ("holdtime", holdtime, argv[1]);
876
877 /* Holdtime value check. */
878 if (holdtime < 3 && holdtime != 0)
879 {
880 vty_out (vty, "%% hold time value must be either 0 or greater than 3%s",
881 VTY_NEWLINE);
882 return CMD_WARNING;
883 }
884
885 bgp_timers_set (bgp, keepalive, holdtime);
886
887 return CMD_SUCCESS;
888}
889
890DEFUN (no_bgp_timers,
891 no_bgp_timers_cmd,
892 "no timers bgp",
893 NO_STR
894 "Adjust routing timers\n"
895 "BGP timers\n")
896{
897 struct bgp *bgp;
898
899 bgp = vty->index;
900 bgp_timers_unset (bgp);
901
902 return CMD_SUCCESS;
903}
904
905ALIAS (no_bgp_timers,
906 no_bgp_timers_arg_cmd,
907 "no timers bgp <0-65535> <0-65535>",
908 NO_STR
909 "Adjust routing timers\n"
910 "BGP timers\n"
911 "Keepalive interval\n"
912 "Holdtime\n")
David Lamparter6b0655a2014-06-04 06:53:35 +0200913
paul718e3742002-12-13 20:15:29 +0000914DEFUN (bgp_client_to_client_reflection,
915 bgp_client_to_client_reflection_cmd,
916 "bgp client-to-client reflection",
917 "BGP specific commands\n"
918 "Configure client to client route reflection\n"
919 "reflection of routes allowed\n")
920{
921 struct bgp *bgp;
922
923 bgp = vty->index;
924 bgp_flag_unset (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT);
925 return CMD_SUCCESS;
926}
927
928DEFUN (no_bgp_client_to_client_reflection,
929 no_bgp_client_to_client_reflection_cmd,
930 "no bgp client-to-client reflection",
931 NO_STR
932 "BGP specific commands\n"
933 "Configure client to client route reflection\n"
934 "reflection of routes allowed\n")
935{
936 struct bgp *bgp;
937
938 bgp = vty->index;
939 bgp_flag_set (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT);
940 return CMD_SUCCESS;
941}
942
943/* "bgp always-compare-med" configuration. */
944DEFUN (bgp_always_compare_med,
945 bgp_always_compare_med_cmd,
946 "bgp always-compare-med",
947 "BGP specific commands\n"
948 "Allow comparing MED from different neighbors\n")
949{
950 struct bgp *bgp;
951
952 bgp = vty->index;
953 bgp_flag_set (bgp, BGP_FLAG_ALWAYS_COMPARE_MED);
954 return CMD_SUCCESS;
955}
956
957DEFUN (no_bgp_always_compare_med,
958 no_bgp_always_compare_med_cmd,
959 "no bgp always-compare-med",
960 NO_STR
961 "BGP specific commands\n"
962 "Allow comparing MED from different neighbors\n")
963{
964 struct bgp *bgp;
965
966 bgp = vty->index;
967 bgp_flag_unset (bgp, BGP_FLAG_ALWAYS_COMPARE_MED);
968 return CMD_SUCCESS;
969}
David Lamparter6b0655a2014-06-04 06:53:35 +0200970
paul718e3742002-12-13 20:15:29 +0000971/* "bgp deterministic-med" configuration. */
972DEFUN (bgp_deterministic_med,
973 bgp_deterministic_med_cmd,
974 "bgp deterministic-med",
975 "BGP specific commands\n"
976 "Pick the best-MED path among paths advertised from the neighboring AS\n")
977{
978 struct bgp *bgp;
979
980 bgp = vty->index;
981 bgp_flag_set (bgp, BGP_FLAG_DETERMINISTIC_MED);
982 return CMD_SUCCESS;
983}
984
985DEFUN (no_bgp_deterministic_med,
986 no_bgp_deterministic_med_cmd,
987 "no bgp deterministic-med",
988 NO_STR
989 "BGP specific commands\n"
990 "Pick the best-MED path among paths advertised from the neighboring AS\n")
991{
992 struct bgp *bgp;
993
994 bgp = vty->index;
995 bgp_flag_unset (bgp, BGP_FLAG_DETERMINISTIC_MED);
996 return CMD_SUCCESS;
997}
hasso538621f2004-05-21 09:31:30 +0000998
999/* "bgp graceful-restart" configuration. */
1000DEFUN (bgp_graceful_restart,
1001 bgp_graceful_restart_cmd,
1002 "bgp graceful-restart",
1003 "BGP specific commands\n"
1004 "Graceful restart capability parameters\n")
1005{
1006 struct bgp *bgp;
1007
1008 bgp = vty->index;
1009 bgp_flag_set (bgp, BGP_FLAG_GRACEFUL_RESTART);
1010 return CMD_SUCCESS;
1011}
1012
1013DEFUN (no_bgp_graceful_restart,
1014 no_bgp_graceful_restart_cmd,
1015 "no bgp graceful-restart",
1016 NO_STR
1017 "BGP specific commands\n"
1018 "Graceful restart capability parameters\n")
1019{
1020 struct bgp *bgp;
1021
1022 bgp = vty->index;
1023 bgp_flag_unset (bgp, BGP_FLAG_GRACEFUL_RESTART);
1024 return CMD_SUCCESS;
1025}
1026
hasso93406d82005-02-02 14:40:33 +00001027DEFUN (bgp_graceful_restart_stalepath_time,
1028 bgp_graceful_restart_stalepath_time_cmd,
1029 "bgp graceful-restart stalepath-time <1-3600>",
1030 "BGP specific commands\n"
1031 "Graceful restart capability parameters\n"
1032 "Set the max time to hold onto restarting peer's stale paths\n"
1033 "Delay value (seconds)\n")
1034{
1035 struct bgp *bgp;
1036 u_int32_t stalepath;
1037
1038 bgp = vty->index;
1039 if (! bgp)
1040 return CMD_WARNING;
1041
1042 VTY_GET_INTEGER_RANGE ("stalepath-time", stalepath, argv[0], 1, 3600);
1043 bgp->stalepath_time = stalepath;
1044 return CMD_SUCCESS;
1045}
1046
Philippe Guibert4afa3dd2016-05-24 16:52:02 +02001047DEFUN (bgp_graceful_restart_restart_time,
1048 bgp_graceful_restart_restart_time_cmd,
1049 "bgp graceful-restart restart-time <1-3600>",
1050 "BGP specific commands\n"
1051 "Graceful restart capability parameters\n"
1052 "Set the time to wait to delete stale routes before a BGP open message is received\n"
1053 "Delay value (seconds)\n")
1054{
1055 struct bgp *bgp;
1056 u_int32_t restart;
1057
1058 bgp = vty->index;
1059 if (! bgp)
1060 return CMD_WARNING;
1061
1062 VTY_GET_INTEGER_RANGE ("restart-time", restart, argv[0], 1, 3600);
1063 bgp->restart_time = restart;
1064 return CMD_SUCCESS;
1065}
1066
hasso93406d82005-02-02 14:40:33 +00001067DEFUN (no_bgp_graceful_restart_stalepath_time,
1068 no_bgp_graceful_restart_stalepath_time_cmd,
1069 "no bgp graceful-restart stalepath-time",
1070 NO_STR
1071 "BGP specific commands\n"
1072 "Graceful restart capability parameters\n"
1073 "Set the max time to hold onto restarting peer's stale paths\n")
1074{
1075 struct bgp *bgp;
1076
1077 bgp = vty->index;
1078 if (! bgp)
1079 return CMD_WARNING;
1080
1081 bgp->stalepath_time = BGP_DEFAULT_STALEPATH_TIME;
1082 return CMD_SUCCESS;
1083}
1084
Philippe Guibert4afa3dd2016-05-24 16:52:02 +02001085DEFUN (no_bgp_graceful_restart_restart_time,
1086 no_bgp_graceful_restart_restart_time_cmd,
1087 "no bgp graceful-restart restart-time",
1088 NO_STR
1089 "BGP specific commands\n"
1090 "Graceful restart capability parameters\n"
1091 "Set the time to wait to delete stale routes before a BGP open message is received\n")
1092{
1093 struct bgp *bgp;
1094
1095 bgp = vty->index;
1096 if (! bgp)
1097 return CMD_WARNING;
1098
1099 bgp->restart_time = BGP_DEFAULT_RESTART_TIME;
1100 return CMD_SUCCESS;
1101}
1102
hasso93406d82005-02-02 14:40:33 +00001103ALIAS (no_bgp_graceful_restart_stalepath_time,
1104 no_bgp_graceful_restart_stalepath_time_val_cmd,
1105 "no bgp graceful-restart stalepath-time <1-3600>",
1106 NO_STR
1107 "BGP specific commands\n"
1108 "Graceful restart capability parameters\n"
1109 "Set the max time to hold onto restarting peer's stale paths\n"
1110 "Delay value (seconds)\n")
1111
Philippe Guibert4afa3dd2016-05-24 16:52:02 +02001112ALIAS (no_bgp_graceful_restart_restart_time,
1113 no_bgp_graceful_restart_restart_time_val_cmd,
1114 "no bgp graceful-restart restart-time <1-3600>",
1115 NO_STR
1116 "BGP specific commands\n"
1117 "Graceful restart capability parameters\n"
1118 "Set the time to wait to delete stale routes before a BGP open message is received\n"
1119 "Delay value (seconds)\n")
1120
paul718e3742002-12-13 20:15:29 +00001121/* "bgp fast-external-failover" configuration. */
1122DEFUN (bgp_fast_external_failover,
1123 bgp_fast_external_failover_cmd,
1124 "bgp fast-external-failover",
1125 BGP_STR
1126 "Immediately reset session if a link to a directly connected external peer goes down\n")
1127{
1128 struct bgp *bgp;
1129
1130 bgp = vty->index;
1131 bgp_flag_unset (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER);
1132 return CMD_SUCCESS;
1133}
1134
1135DEFUN (no_bgp_fast_external_failover,
1136 no_bgp_fast_external_failover_cmd,
1137 "no bgp fast-external-failover",
1138 NO_STR
1139 BGP_STR
1140 "Immediately reset session if a link to a directly connected external peer goes down\n")
1141{
1142 struct bgp *bgp;
1143
1144 bgp = vty->index;
1145 bgp_flag_set (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER);
1146 return CMD_SUCCESS;
1147}
David Lamparter6b0655a2014-06-04 06:53:35 +02001148
paul718e3742002-12-13 20:15:29 +00001149/* "bgp enforce-first-as" configuration. */
1150DEFUN (bgp_enforce_first_as,
1151 bgp_enforce_first_as_cmd,
1152 "bgp enforce-first-as",
1153 BGP_STR
1154 "Enforce the first AS for EBGP routes\n")
1155{
1156 struct bgp *bgp;
1157
1158 bgp = vty->index;
1159 bgp_flag_set (bgp, BGP_FLAG_ENFORCE_FIRST_AS);
1160 return CMD_SUCCESS;
1161}
1162
1163DEFUN (no_bgp_enforce_first_as,
1164 no_bgp_enforce_first_as_cmd,
1165 "no bgp enforce-first-as",
1166 NO_STR
1167 BGP_STR
1168 "Enforce the first AS for EBGP routes\n")
1169{
1170 struct bgp *bgp;
1171
1172 bgp = vty->index;
1173 bgp_flag_unset (bgp, BGP_FLAG_ENFORCE_FIRST_AS);
1174 return CMD_SUCCESS;
1175}
David Lamparter6b0655a2014-06-04 06:53:35 +02001176
paul718e3742002-12-13 20:15:29 +00001177/* "bgp bestpath compare-routerid" configuration. */
1178DEFUN (bgp_bestpath_compare_router_id,
1179 bgp_bestpath_compare_router_id_cmd,
1180 "bgp bestpath compare-routerid",
1181 "BGP specific commands\n"
1182 "Change the default bestpath selection\n"
1183 "Compare router-id for identical EBGP paths\n")
1184{
1185 struct bgp *bgp;
1186
1187 bgp = vty->index;
1188 bgp_flag_set (bgp, BGP_FLAG_COMPARE_ROUTER_ID);
1189 return CMD_SUCCESS;
1190}
1191
1192DEFUN (no_bgp_bestpath_compare_router_id,
1193 no_bgp_bestpath_compare_router_id_cmd,
1194 "no bgp bestpath compare-routerid",
1195 NO_STR
1196 "BGP specific commands\n"
1197 "Change the default bestpath selection\n"
1198 "Compare router-id for identical EBGP paths\n")
1199{
1200 struct bgp *bgp;
1201
1202 bgp = vty->index;
1203 bgp_flag_unset (bgp, BGP_FLAG_COMPARE_ROUTER_ID);
1204 return CMD_SUCCESS;
1205}
David Lamparter6b0655a2014-06-04 06:53:35 +02001206
paul718e3742002-12-13 20:15:29 +00001207/* "bgp bestpath as-path ignore" configuration. */
1208DEFUN (bgp_bestpath_aspath_ignore,
1209 bgp_bestpath_aspath_ignore_cmd,
1210 "bgp bestpath as-path ignore",
1211 "BGP specific commands\n"
1212 "Change the default bestpath selection\n"
1213 "AS-path attribute\n"
1214 "Ignore as-path length in selecting a route\n")
1215{
1216 struct bgp *bgp;
1217
1218 bgp = vty->index;
1219 bgp_flag_set (bgp, BGP_FLAG_ASPATH_IGNORE);
1220 return CMD_SUCCESS;
1221}
1222
1223DEFUN (no_bgp_bestpath_aspath_ignore,
1224 no_bgp_bestpath_aspath_ignore_cmd,
1225 "no bgp bestpath as-path ignore",
1226 NO_STR
1227 "BGP specific commands\n"
1228 "Change the default bestpath selection\n"
1229 "AS-path attribute\n"
1230 "Ignore as-path length in selecting a route\n")
1231{
1232 struct bgp *bgp;
1233
1234 bgp = vty->index;
1235 bgp_flag_unset (bgp, BGP_FLAG_ASPATH_IGNORE);
1236 return CMD_SUCCESS;
1237}
David Lamparter6b0655a2014-06-04 06:53:35 +02001238
hasso68118452005-04-08 15:40:36 +00001239/* "bgp bestpath as-path confed" configuration. */
1240DEFUN (bgp_bestpath_aspath_confed,
1241 bgp_bestpath_aspath_confed_cmd,
1242 "bgp bestpath as-path confed",
1243 "BGP specific commands\n"
1244 "Change the default bestpath selection\n"
1245 "AS-path attribute\n"
1246 "Compare path lengths including confederation sets & sequences in selecting a route\n")
1247{
1248 struct bgp *bgp;
1249
1250 bgp = vty->index;
1251 bgp_flag_set (bgp, BGP_FLAG_ASPATH_CONFED);
1252 return CMD_SUCCESS;
1253}
1254
1255DEFUN (no_bgp_bestpath_aspath_confed,
1256 no_bgp_bestpath_aspath_confed_cmd,
1257 "no bgp bestpath as-path confed",
1258 NO_STR
1259 "BGP specific commands\n"
1260 "Change the default bestpath selection\n"
1261 "AS-path attribute\n"
1262 "Compare path lengths including confederation sets & sequences in selecting a route\n")
1263{
1264 struct bgp *bgp;
1265
1266 bgp = vty->index;
1267 bgp_flag_unset (bgp, BGP_FLAG_ASPATH_CONFED);
1268 return CMD_SUCCESS;
1269}
David Lamparter6b0655a2014-06-04 06:53:35 +02001270
Pradosh Mohapatra2fdd4552013-09-07 07:02:36 +00001271/* "bgp bestpath as-path multipath-relax" configuration. */
1272DEFUN (bgp_bestpath_aspath_multipath_relax,
1273 bgp_bestpath_aspath_multipath_relax_cmd,
1274 "bgp bestpath as-path multipath-relax",
1275 "BGP specific commands\n"
1276 "Change the default bestpath selection\n"
1277 "AS-path attribute\n"
1278 "Allow load sharing across routes that have different AS paths (but same length)\n")
1279{
1280 struct bgp *bgp;
1281
1282 bgp = vty->index;
1283 bgp_flag_set (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX);
1284 return CMD_SUCCESS;
1285}
1286
1287DEFUN (no_bgp_bestpath_aspath_multipath_relax,
1288 no_bgp_bestpath_aspath_multipath_relax_cmd,
1289 "no bgp bestpath as-path multipath-relax",
1290 NO_STR
1291 "BGP specific commands\n"
1292 "Change the default bestpath selection\n"
1293 "AS-path attribute\n"
1294 "Allow load sharing across routes that have different AS paths (but same length)\n")
1295{
1296 struct bgp *bgp;
1297
1298 bgp = vty->index;
1299 bgp_flag_unset (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX);
1300 return CMD_SUCCESS;
1301}
David Lamparter6b0655a2014-06-04 06:53:35 +02001302
paul848973c2003-08-13 00:32:49 +00001303/* "bgp log-neighbor-changes" configuration. */
1304DEFUN (bgp_log_neighbor_changes,
1305 bgp_log_neighbor_changes_cmd,
1306 "bgp log-neighbor-changes",
1307 "BGP specific commands\n"
1308 "Log neighbor up/down and reset reason\n")
1309{
1310 struct bgp *bgp;
1311
1312 bgp = vty->index;
1313 bgp_flag_set (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES);
1314 return CMD_SUCCESS;
1315}
1316
1317DEFUN (no_bgp_log_neighbor_changes,
1318 no_bgp_log_neighbor_changes_cmd,
1319 "no bgp log-neighbor-changes",
1320 NO_STR
1321 "BGP specific commands\n"
1322 "Log neighbor up/down and reset reason\n")
1323{
1324 struct bgp *bgp;
1325
1326 bgp = vty->index;
1327 bgp_flag_unset (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES);
1328 return CMD_SUCCESS;
1329}
David Lamparter6b0655a2014-06-04 06:53:35 +02001330
paul718e3742002-12-13 20:15:29 +00001331/* "bgp bestpath med" configuration. */
1332DEFUN (bgp_bestpath_med,
1333 bgp_bestpath_med_cmd,
1334 "bgp bestpath med (confed|missing-as-worst)",
1335 "BGP specific commands\n"
1336 "Change the default bestpath selection\n"
1337 "MED attribute\n"
1338 "Compare MED among confederation paths\n"
1339 "Treat missing MED as the least preferred one\n")
1340{
1341 struct bgp *bgp;
1342
1343 bgp = vty->index;
1344
1345 if (strncmp (argv[0], "confed", 1) == 0)
1346 bgp_flag_set (bgp, BGP_FLAG_MED_CONFED);
1347 else
1348 bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1349
1350 return CMD_SUCCESS;
1351}
1352
1353DEFUN (bgp_bestpath_med2,
1354 bgp_bestpath_med2_cmd,
1355 "bgp bestpath med confed missing-as-worst",
1356 "BGP specific commands\n"
1357 "Change the default bestpath selection\n"
1358 "MED attribute\n"
1359 "Compare MED among confederation paths\n"
1360 "Treat missing MED as the least preferred one\n")
1361{
1362 struct bgp *bgp;
1363
1364 bgp = vty->index;
1365 bgp_flag_set (bgp, BGP_FLAG_MED_CONFED);
1366 bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1367 return CMD_SUCCESS;
1368}
1369
1370ALIAS (bgp_bestpath_med2,
1371 bgp_bestpath_med3_cmd,
1372 "bgp bestpath med missing-as-worst confed",
1373 "BGP specific commands\n"
1374 "Change the default bestpath selection\n"
1375 "MED attribute\n"
1376 "Treat missing MED as the least preferred one\n"
1377 "Compare MED among confederation paths\n")
1378
1379DEFUN (no_bgp_bestpath_med,
1380 no_bgp_bestpath_med_cmd,
1381 "no bgp bestpath med (confed|missing-as-worst)",
1382 NO_STR
1383 "BGP specific commands\n"
1384 "Change the default bestpath selection\n"
1385 "MED attribute\n"
1386 "Compare MED among confederation paths\n"
1387 "Treat missing MED as the least preferred one\n")
1388{
1389 struct bgp *bgp;
1390
1391 bgp = vty->index;
1392
1393 if (strncmp (argv[0], "confed", 1) == 0)
1394 bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED);
1395 else
1396 bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1397
1398 return CMD_SUCCESS;
1399}
1400
1401DEFUN (no_bgp_bestpath_med2,
1402 no_bgp_bestpath_med2_cmd,
1403 "no bgp bestpath med confed missing-as-worst",
1404 NO_STR
1405 "BGP specific commands\n"
1406 "Change the default bestpath selection\n"
1407 "MED attribute\n"
1408 "Compare MED among confederation paths\n"
1409 "Treat missing MED as the least preferred one\n")
1410{
1411 struct bgp *bgp;
1412
1413 bgp = vty->index;
1414 bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED);
1415 bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1416 return CMD_SUCCESS;
1417}
1418
1419ALIAS (no_bgp_bestpath_med2,
1420 no_bgp_bestpath_med3_cmd,
1421 "no bgp bestpath med missing-as-worst confed",
1422 NO_STR
1423 "BGP specific commands\n"
1424 "Change the default bestpath selection\n"
1425 "MED attribute\n"
1426 "Treat missing MED as the least preferred one\n"
1427 "Compare MED among confederation paths\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02001428
paul718e3742002-12-13 20:15:29 +00001429/* "no bgp default ipv4-unicast". */
1430DEFUN (no_bgp_default_ipv4_unicast,
1431 no_bgp_default_ipv4_unicast_cmd,
1432 "no bgp default ipv4-unicast",
1433 NO_STR
1434 "BGP specific commands\n"
1435 "Configure BGP defaults\n"
1436 "Activate ipv4-unicast for a peer by default\n")
1437{
1438 struct bgp *bgp;
1439
1440 bgp = vty->index;
1441 bgp_flag_set (bgp, BGP_FLAG_NO_DEFAULT_IPV4);
1442 return CMD_SUCCESS;
1443}
1444
1445DEFUN (bgp_default_ipv4_unicast,
1446 bgp_default_ipv4_unicast_cmd,
1447 "bgp default ipv4-unicast",
1448 "BGP specific commands\n"
1449 "Configure BGP defaults\n"
1450 "Activate ipv4-unicast for a peer by default\n")
1451{
1452 struct bgp *bgp;
1453
1454 bgp = vty->index;
1455 bgp_flag_unset (bgp, BGP_FLAG_NO_DEFAULT_IPV4);
1456 return CMD_SUCCESS;
1457}
David Lamparter6b0655a2014-06-04 06:53:35 +02001458
paul718e3742002-12-13 20:15:29 +00001459/* "bgp import-check" configuration. */
1460DEFUN (bgp_network_import_check,
1461 bgp_network_import_check_cmd,
1462 "bgp network import-check",
1463 "BGP specific commands\n"
1464 "BGP network command\n"
1465 "Check BGP network route exists in IGP\n")
1466{
1467 struct bgp *bgp;
1468
1469 bgp = vty->index;
1470 bgp_flag_set (bgp, BGP_FLAG_IMPORT_CHECK);
1471 return CMD_SUCCESS;
1472}
1473
1474DEFUN (no_bgp_network_import_check,
1475 no_bgp_network_import_check_cmd,
1476 "no bgp network import-check",
1477 NO_STR
1478 "BGP specific commands\n"
1479 "BGP network command\n"
1480 "Check BGP network route exists in IGP\n")
1481{
1482 struct bgp *bgp;
1483
1484 bgp = vty->index;
1485 bgp_flag_unset (bgp, BGP_FLAG_IMPORT_CHECK);
1486 return CMD_SUCCESS;
1487}
David Lamparter6b0655a2014-06-04 06:53:35 +02001488
paul718e3742002-12-13 20:15:29 +00001489DEFUN (bgp_default_local_preference,
1490 bgp_default_local_preference_cmd,
1491 "bgp default local-preference <0-4294967295>",
1492 "BGP specific commands\n"
1493 "Configure BGP defaults\n"
1494 "local preference (higher=more preferred)\n"
1495 "Configure default local preference value\n")
1496{
1497 struct bgp *bgp;
1498 u_int32_t local_pref;
1499
1500 bgp = vty->index;
1501
1502 VTY_GET_INTEGER ("local preference", local_pref, argv[0]);
1503
1504 bgp_default_local_preference_set (bgp, local_pref);
1505
1506 return CMD_SUCCESS;
1507}
1508
1509DEFUN (no_bgp_default_local_preference,
1510 no_bgp_default_local_preference_cmd,
1511 "no bgp default local-preference",
1512 NO_STR
1513 "BGP specific commands\n"
1514 "Configure BGP defaults\n"
1515 "local preference (higher=more preferred)\n")
1516{
1517 struct bgp *bgp;
1518
1519 bgp = vty->index;
1520 bgp_default_local_preference_unset (bgp);
1521 return CMD_SUCCESS;
1522}
1523
1524ALIAS (no_bgp_default_local_preference,
1525 no_bgp_default_local_preference_val_cmd,
1526 "no bgp default local-preference <0-4294967295>",
1527 NO_STR
1528 "BGP specific commands\n"
1529 "Configure BGP defaults\n"
1530 "local preference (higher=more preferred)\n"
1531 "Configure default local preference value\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02001532
paul718e3742002-12-13 20:15:29 +00001533static int
paulfd79ac92004-10-13 05:06:08 +00001534peer_remote_as_vty (struct vty *vty, const char *peer_str,
1535 const char *as_str, afi_t afi, safi_t safi)
paul718e3742002-12-13 20:15:29 +00001536{
1537 int ret;
1538 struct bgp *bgp;
1539 as_t as;
1540 union sockunion su;
1541
1542 bgp = vty->index;
1543
1544 /* Get AS number. */
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00001545 VTY_GET_INTEGER_RANGE ("AS", as, as_str, 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +00001546
1547 /* If peer is peer group, call proper function. */
1548 ret = str2sockunion (peer_str, &su);
1549 if (ret < 0)
1550 {
1551 ret = peer_group_remote_as (bgp, peer_str, &as);
1552 if (ret < 0)
1553 {
1554 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1555 return CMD_WARNING;
1556 }
1557 return CMD_SUCCESS;
1558 }
1559
1560 if (peer_address_self_check (&su))
1561 {
1562 vty_out (vty, "%% Can not configure the local system as neighbor%s",
1563 VTY_NEWLINE);
1564 return CMD_WARNING;
1565 }
1566
1567 ret = peer_remote_as (bgp, &su, &as, afi, safi);
1568
1569 /* This peer belongs to peer group. */
1570 switch (ret)
1571 {
1572 case BGP_ERR_PEER_GROUP_MEMBER:
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04001573 vty_out (vty, "%% Peer-group AS %u. Cannot configure remote-as for member%s", as, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00001574 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00001575 case BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT:
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04001576 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 +00001577 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00001578 }
1579 return bgp_vty_return (vty, ret);
1580}
1581
1582DEFUN (neighbor_remote_as,
1583 neighbor_remote_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001584 NEIGHBOR_CMD2 "remote-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001585 NEIGHBOR_STR
1586 NEIGHBOR_ADDR_STR2
1587 "Specify a BGP neighbor\n"
1588 AS_STR)
1589{
1590 return peer_remote_as_vty (vty, argv[0], argv[1], AFI_IP, SAFI_UNICAST);
1591}
David Lamparter6b0655a2014-06-04 06:53:35 +02001592
paul718e3742002-12-13 20:15:29 +00001593DEFUN (neighbor_peer_group,
1594 neighbor_peer_group_cmd,
1595 "neighbor WORD peer-group",
1596 NEIGHBOR_STR
1597 "Neighbor tag\n"
1598 "Configure peer-group\n")
1599{
1600 struct bgp *bgp;
1601 struct peer_group *group;
1602
1603 bgp = vty->index;
1604
1605 group = peer_group_get (bgp, argv[0]);
1606 if (! group)
1607 return CMD_WARNING;
1608
1609 return CMD_SUCCESS;
1610}
1611
1612DEFUN (no_neighbor,
1613 no_neighbor_cmd,
1614 NO_NEIGHBOR_CMD2,
1615 NO_STR
1616 NEIGHBOR_STR
1617 NEIGHBOR_ADDR_STR2)
1618{
1619 int ret;
1620 union sockunion su;
1621 struct peer_group *group;
1622 struct peer *peer;
1623
1624 ret = str2sockunion (argv[0], &su);
1625 if (ret < 0)
1626 {
1627 group = peer_group_lookup (vty->index, argv[0]);
1628 if (group)
1629 peer_group_delete (group);
1630 else
1631 {
1632 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1633 return CMD_WARNING;
1634 }
1635 }
1636 else
1637 {
1638 peer = peer_lookup (vty->index, &su);
1639 if (peer)
paul200df112005-06-01 11:17:05 +00001640 peer_delete (peer);
paul718e3742002-12-13 20:15:29 +00001641 }
1642
1643 return CMD_SUCCESS;
1644}
1645
1646ALIAS (no_neighbor,
1647 no_neighbor_remote_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001648 NO_NEIGHBOR_CMD "remote-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001649 NO_STR
1650 NEIGHBOR_STR
1651 NEIGHBOR_ADDR_STR
1652 "Specify a BGP neighbor\n"
1653 AS_STR)
1654
1655DEFUN (no_neighbor_peer_group,
1656 no_neighbor_peer_group_cmd,
1657 "no neighbor WORD peer-group",
1658 NO_STR
1659 NEIGHBOR_STR
1660 "Neighbor tag\n"
1661 "Configure peer-group\n")
1662{
1663 struct peer_group *group;
1664
1665 group = peer_group_lookup (vty->index, argv[0]);
1666 if (group)
1667 peer_group_delete (group);
1668 else
1669 {
1670 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1671 return CMD_WARNING;
1672 }
1673 return CMD_SUCCESS;
1674}
1675
1676DEFUN (no_neighbor_peer_group_remote_as,
1677 no_neighbor_peer_group_remote_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001678 "no neighbor WORD remote-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001679 NO_STR
1680 NEIGHBOR_STR
1681 "Neighbor tag\n"
1682 "Specify a BGP neighbor\n"
1683 AS_STR)
1684{
1685 struct peer_group *group;
1686
1687 group = peer_group_lookup (vty->index, argv[0]);
1688 if (group)
1689 peer_group_remote_as_delete (group);
1690 else
1691 {
1692 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1693 return CMD_WARNING;
1694 }
1695 return CMD_SUCCESS;
1696}
David Lamparter6b0655a2014-06-04 06:53:35 +02001697
paul718e3742002-12-13 20:15:29 +00001698DEFUN (neighbor_local_as,
1699 neighbor_local_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001700 NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001701 NEIGHBOR_STR
1702 NEIGHBOR_ADDR_STR2
1703 "Specify a local-as number\n"
1704 "AS number used as local AS\n")
1705{
1706 struct peer *peer;
1707 int ret;
1708
1709 peer = peer_and_group_lookup_vty (vty, argv[0]);
1710 if (! peer)
1711 return CMD_WARNING;
1712
Andrew Certain9d3f9702012-11-07 23:50:07 +00001713 ret = peer_local_as_set (peer, atoi (argv[1]), 0, 0);
paul718e3742002-12-13 20:15:29 +00001714 return bgp_vty_return (vty, ret);
1715}
1716
1717DEFUN (neighbor_local_as_no_prepend,
1718 neighbor_local_as_no_prepend_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001719 NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend",
paul718e3742002-12-13 20:15:29 +00001720 NEIGHBOR_STR
1721 NEIGHBOR_ADDR_STR2
1722 "Specify a local-as number\n"
1723 "AS number used as local AS\n"
1724 "Do not prepend local-as to updates from ebgp peers\n")
1725{
1726 struct peer *peer;
1727 int ret;
1728
1729 peer = peer_and_group_lookup_vty (vty, argv[0]);
1730 if (! peer)
1731 return CMD_WARNING;
1732
Andrew Certain9d3f9702012-11-07 23:50:07 +00001733 ret = peer_local_as_set (peer, atoi (argv[1]), 1, 0);
paul718e3742002-12-13 20:15:29 +00001734 return bgp_vty_return (vty, ret);
1735}
1736
Andrew Certain9d3f9702012-11-07 23:50:07 +00001737DEFUN (neighbor_local_as_no_prepend_replace_as,
1738 neighbor_local_as_no_prepend_replace_as_cmd,
1739 NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as",
1740 NEIGHBOR_STR
1741 NEIGHBOR_ADDR_STR2
1742 "Specify a local-as number\n"
1743 "AS number used as local AS\n"
1744 "Do not prepend local-as to updates from ebgp peers\n"
1745 "Do not prepend local-as to updates from ibgp peers\n")
1746{
1747 struct peer *peer;
1748 int ret;
1749
1750 peer = peer_and_group_lookup_vty (vty, argv[0]);
1751 if (! peer)
1752 return CMD_WARNING;
1753
1754 ret = peer_local_as_set (peer, atoi (argv[1]), 1, 1);
1755 return bgp_vty_return (vty, ret);
1756}
1757
1758
paul718e3742002-12-13 20:15:29 +00001759DEFUN (no_neighbor_local_as,
1760 no_neighbor_local_as_cmd,
1761 NO_NEIGHBOR_CMD2 "local-as",
1762 NO_STR
1763 NEIGHBOR_STR
1764 NEIGHBOR_ADDR_STR2
1765 "Specify a local-as number\n")
1766{
1767 struct peer *peer;
1768 int ret;
1769
1770 peer = peer_and_group_lookup_vty (vty, argv[0]);
1771 if (! peer)
1772 return CMD_WARNING;
1773
1774 ret = peer_local_as_unset (peer);
1775 return bgp_vty_return (vty, ret);
1776}
1777
1778ALIAS (no_neighbor_local_as,
1779 no_neighbor_local_as_val_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001780 NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001781 NO_STR
1782 NEIGHBOR_STR
1783 NEIGHBOR_ADDR_STR2
1784 "Specify a local-as number\n"
1785 "AS number used as local AS\n")
1786
1787ALIAS (no_neighbor_local_as,
1788 no_neighbor_local_as_val2_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001789 NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend",
paul718e3742002-12-13 20:15:29 +00001790 NO_STR
1791 NEIGHBOR_STR
1792 NEIGHBOR_ADDR_STR2
1793 "Specify a local-as number\n"
1794 "AS number used as local AS\n"
1795 "Do not prepend local-as to updates from ebgp peers\n")
Andrew Certain9d3f9702012-11-07 23:50:07 +00001796
1797ALIAS (no_neighbor_local_as,
1798 no_neighbor_local_as_val3_cmd,
1799 NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as",
1800 NO_STR
1801 NEIGHBOR_STR
1802 NEIGHBOR_ADDR_STR2
1803 "Specify a local-as number\n"
1804 "AS number used as local AS\n"
1805 "Do not prepend local-as to updates from ebgp peers\n"
1806 "Do not prepend local-as to updates from ibgp peers\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02001807
Paul Jakma0df7c912008-07-21 21:02:49 +00001808DEFUN (neighbor_password,
1809 neighbor_password_cmd,
1810 NEIGHBOR_CMD2 "password LINE",
1811 NEIGHBOR_STR
1812 NEIGHBOR_ADDR_STR2
1813 "Set a password\n"
1814 "The password\n")
1815{
1816 struct peer *peer;
1817 int ret;
1818
1819 peer = peer_and_group_lookup_vty (vty, argv[0]);
1820 if (! peer)
1821 return CMD_WARNING;
1822
1823 ret = peer_password_set (peer, argv[1]);
1824 return bgp_vty_return (vty, ret);
1825}
1826
1827DEFUN (no_neighbor_password,
1828 no_neighbor_password_cmd,
1829 NO_NEIGHBOR_CMD2 "password",
1830 NO_STR
1831 NEIGHBOR_STR
1832 NEIGHBOR_ADDR_STR2
1833 "Set a password\n")
1834{
1835 struct peer *peer;
1836 int ret;
1837
1838 peer = peer_and_group_lookup_vty (vty, argv[0]);
1839 if (! peer)
1840 return CMD_WARNING;
1841
1842 ret = peer_password_unset (peer);
1843 return bgp_vty_return (vty, ret);
1844}
David Lamparter6b0655a2014-06-04 06:53:35 +02001845
paul718e3742002-12-13 20:15:29 +00001846DEFUN (neighbor_activate,
1847 neighbor_activate_cmd,
1848 NEIGHBOR_CMD2 "activate",
1849 NEIGHBOR_STR
1850 NEIGHBOR_ADDR_STR2
1851 "Enable the Address Family for this Neighbor\n")
1852{
1853 struct peer *peer;
1854
1855 peer = peer_and_group_lookup_vty (vty, argv[0]);
1856 if (! peer)
1857 return CMD_WARNING;
1858
1859 peer_activate (peer, bgp_node_afi (vty), bgp_node_safi (vty));
1860
1861 return CMD_SUCCESS;
1862}
1863
1864DEFUN (no_neighbor_activate,
1865 no_neighbor_activate_cmd,
1866 NO_NEIGHBOR_CMD2 "activate",
1867 NO_STR
1868 NEIGHBOR_STR
1869 NEIGHBOR_ADDR_STR2
1870 "Enable the Address Family for this Neighbor\n")
1871{
1872 int ret;
1873 struct peer *peer;
1874
1875 /* Lookup peer. */
1876 peer = peer_and_group_lookup_vty (vty, argv[0]);
1877 if (! peer)
1878 return CMD_WARNING;
1879
1880 ret = peer_deactivate (peer, bgp_node_afi (vty), bgp_node_safi (vty));
1881
1882 return bgp_vty_return (vty, ret);
1883}
David Lamparter6b0655a2014-06-04 06:53:35 +02001884
paul718e3742002-12-13 20:15:29 +00001885DEFUN (neighbor_set_peer_group,
1886 neighbor_set_peer_group_cmd,
1887 NEIGHBOR_CMD "peer-group WORD",
1888 NEIGHBOR_STR
1889 NEIGHBOR_ADDR_STR
1890 "Member of the peer-group\n"
1891 "peer-group name\n")
1892{
1893 int ret;
1894 as_t as;
1895 union sockunion su;
1896 struct bgp *bgp;
1897 struct peer_group *group;
1898
1899 bgp = vty->index;
1900
1901 ret = str2sockunion (argv[0], &su);
1902 if (ret < 0)
1903 {
1904 vty_out (vty, "%% Malformed address: %s%s", argv[0], VTY_NEWLINE);
1905 return CMD_WARNING;
1906 }
1907
1908 group = peer_group_lookup (bgp, argv[1]);
1909 if (! group)
1910 {
1911 vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE);
1912 return CMD_WARNING;
1913 }
1914
1915 if (peer_address_self_check (&su))
1916 {
1917 vty_out (vty, "%% Can not configure the local system as neighbor%s",
1918 VTY_NEWLINE);
1919 return CMD_WARNING;
1920 }
1921
1922 ret = peer_group_bind (bgp, &su, group, bgp_node_afi (vty),
1923 bgp_node_safi (vty), &as);
1924
1925 if (ret == BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT)
1926 {
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04001927 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 +00001928 return CMD_WARNING;
1929 }
1930
1931 return bgp_vty_return (vty, ret);
1932}
1933
1934DEFUN (no_neighbor_set_peer_group,
1935 no_neighbor_set_peer_group_cmd,
1936 NO_NEIGHBOR_CMD "peer-group WORD",
1937 NO_STR
1938 NEIGHBOR_STR
1939 NEIGHBOR_ADDR_STR
1940 "Member of the peer-group\n"
1941 "peer-group name\n")
1942{
1943 int ret;
1944 struct bgp *bgp;
1945 struct peer *peer;
1946 struct peer_group *group;
1947
1948 bgp = vty->index;
1949
1950 peer = peer_lookup_vty (vty, argv[0]);
1951 if (! peer)
1952 return CMD_WARNING;
1953
1954 group = peer_group_lookup (bgp, argv[1]);
1955 if (! group)
1956 {
1957 vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE);
1958 return CMD_WARNING;
1959 }
1960
1961 ret = peer_group_unbind (bgp, peer, group, bgp_node_afi (vty),
1962 bgp_node_safi (vty));
1963
1964 return bgp_vty_return (vty, ret);
1965}
David Lamparter6b0655a2014-06-04 06:53:35 +02001966
paul94f2b392005-06-28 12:44:16 +00001967static int
paulfd79ac92004-10-13 05:06:08 +00001968peer_flag_modify_vty (struct vty *vty, const char *ip_str,
1969 u_int16_t flag, int set)
paul718e3742002-12-13 20:15:29 +00001970{
1971 int ret;
1972 struct peer *peer;
1973
1974 peer = peer_and_group_lookup_vty (vty, ip_str);
1975 if (! peer)
1976 return CMD_WARNING;
1977
1978 if (set)
1979 ret = peer_flag_set (peer, flag);
1980 else
1981 ret = peer_flag_unset (peer, flag);
1982
1983 return bgp_vty_return (vty, ret);
1984}
1985
paul94f2b392005-06-28 12:44:16 +00001986static int
paulfd79ac92004-10-13 05:06:08 +00001987peer_flag_set_vty (struct vty *vty, const char *ip_str, u_int16_t flag)
paul718e3742002-12-13 20:15:29 +00001988{
1989 return peer_flag_modify_vty (vty, ip_str, flag, 1);
1990}
1991
paul94f2b392005-06-28 12:44:16 +00001992static int
paulfd79ac92004-10-13 05:06:08 +00001993peer_flag_unset_vty (struct vty *vty, const char *ip_str, u_int16_t flag)
paul718e3742002-12-13 20:15:29 +00001994{
1995 return peer_flag_modify_vty (vty, ip_str, flag, 0);
1996}
1997
1998/* neighbor passive. */
1999DEFUN (neighbor_passive,
2000 neighbor_passive_cmd,
2001 NEIGHBOR_CMD2 "passive",
2002 NEIGHBOR_STR
2003 NEIGHBOR_ADDR_STR2
2004 "Don't send open messages to this neighbor\n")
2005{
2006 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_PASSIVE);
2007}
2008
2009DEFUN (no_neighbor_passive,
2010 no_neighbor_passive_cmd,
2011 NO_NEIGHBOR_CMD2 "passive",
2012 NO_STR
2013 NEIGHBOR_STR
2014 NEIGHBOR_ADDR_STR2
2015 "Don't send open messages to this neighbor\n")
2016{
2017 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_PASSIVE);
2018}
David Lamparter6b0655a2014-06-04 06:53:35 +02002019
paul718e3742002-12-13 20:15:29 +00002020/* neighbor shutdown. */
2021DEFUN (neighbor_shutdown,
2022 neighbor_shutdown_cmd,
2023 NEIGHBOR_CMD2 "shutdown",
2024 NEIGHBOR_STR
2025 NEIGHBOR_ADDR_STR2
2026 "Administratively shut down this neighbor\n")
2027{
2028 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_SHUTDOWN);
2029}
2030
2031DEFUN (no_neighbor_shutdown,
2032 no_neighbor_shutdown_cmd,
2033 NO_NEIGHBOR_CMD2 "shutdown",
2034 NO_STR
2035 NEIGHBOR_STR
2036 NEIGHBOR_ADDR_STR2
2037 "Administratively shut down this neighbor\n")
2038{
2039 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_SHUTDOWN);
2040}
David Lamparter6b0655a2014-06-04 06:53:35 +02002041
hassoc9502432005-02-01 22:01:48 +00002042/* Deprecated neighbor capability route-refresh. */
2043DEFUN_DEPRECATED (neighbor_capability_route_refresh,
2044 neighbor_capability_route_refresh_cmd,
2045 NEIGHBOR_CMD2 "capability route-refresh",
2046 NEIGHBOR_STR
2047 NEIGHBOR_ADDR_STR2
2048 "Advertise capability to the peer\n"
2049 "Advertise route-refresh capability to this neighbor\n")
paul718e3742002-12-13 20:15:29 +00002050{
hassoc9502432005-02-01 22:01:48 +00002051 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00002052}
2053
hassoc9502432005-02-01 22:01:48 +00002054DEFUN_DEPRECATED (no_neighbor_capability_route_refresh,
2055 no_neighbor_capability_route_refresh_cmd,
2056 NO_NEIGHBOR_CMD2 "capability route-refresh",
2057 NO_STR
2058 NEIGHBOR_STR
2059 NEIGHBOR_ADDR_STR2
2060 "Advertise capability to the peer\n"
2061 "Advertise route-refresh capability to this neighbor\n")
paul718e3742002-12-13 20:15:29 +00002062{
hassoc9502432005-02-01 22:01:48 +00002063 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00002064}
David Lamparter6b0655a2014-06-04 06:53:35 +02002065
paul718e3742002-12-13 20:15:29 +00002066/* neighbor capability dynamic. */
2067DEFUN (neighbor_capability_dynamic,
2068 neighbor_capability_dynamic_cmd,
2069 NEIGHBOR_CMD2 "capability dynamic",
2070 NEIGHBOR_STR
2071 NEIGHBOR_ADDR_STR2
2072 "Advertise capability to the peer\n"
2073 "Advertise dynamic capability to this neighbor\n")
2074{
2075 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY);
2076}
2077
2078DEFUN (no_neighbor_capability_dynamic,
2079 no_neighbor_capability_dynamic_cmd,
2080 NO_NEIGHBOR_CMD2 "capability dynamic",
2081 NO_STR
2082 NEIGHBOR_STR
2083 NEIGHBOR_ADDR_STR2
2084 "Advertise capability to the peer\n"
2085 "Advertise dynamic capability to this neighbor\n")
2086{
2087 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY);
2088}
David Lamparter6b0655a2014-06-04 06:53:35 +02002089
paul718e3742002-12-13 20:15:29 +00002090/* neighbor dont-capability-negotiate */
2091DEFUN (neighbor_dont_capability_negotiate,
2092 neighbor_dont_capability_negotiate_cmd,
2093 NEIGHBOR_CMD2 "dont-capability-negotiate",
2094 NEIGHBOR_STR
2095 NEIGHBOR_ADDR_STR2
2096 "Do not perform capability negotiation\n")
2097{
2098 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY);
2099}
2100
2101DEFUN (no_neighbor_dont_capability_negotiate,
2102 no_neighbor_dont_capability_negotiate_cmd,
2103 NO_NEIGHBOR_CMD2 "dont-capability-negotiate",
2104 NO_STR
2105 NEIGHBOR_STR
2106 NEIGHBOR_ADDR_STR2
2107 "Do not perform capability negotiation\n")
2108{
2109 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY);
2110}
David Lamparter6b0655a2014-06-04 06:53:35 +02002111
paul94f2b392005-06-28 12:44:16 +00002112static int
paulfd79ac92004-10-13 05:06:08 +00002113peer_af_flag_modify_vty (struct vty *vty, const char *peer_str, afi_t afi,
paulfee0f4c2004-09-13 05:12:46 +00002114 safi_t safi, u_int32_t flag, int set)
paul718e3742002-12-13 20:15:29 +00002115{
2116 int ret;
2117 struct peer *peer;
2118
2119 peer = peer_and_group_lookup_vty (vty, peer_str);
2120 if (! peer)
2121 return CMD_WARNING;
2122
2123 if (set)
2124 ret = peer_af_flag_set (peer, afi, safi, flag);
2125 else
2126 ret = peer_af_flag_unset (peer, afi, safi, flag);
2127
2128 return bgp_vty_return (vty, ret);
2129}
2130
paul94f2b392005-06-28 12:44:16 +00002131static int
paulfd79ac92004-10-13 05:06:08 +00002132peer_af_flag_set_vty (struct vty *vty, const char *peer_str, afi_t afi,
paulfee0f4c2004-09-13 05:12:46 +00002133 safi_t safi, u_int32_t flag)
paul718e3742002-12-13 20:15:29 +00002134{
2135 return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 1);
2136}
2137
paul94f2b392005-06-28 12:44:16 +00002138static int
paulfd79ac92004-10-13 05:06:08 +00002139peer_af_flag_unset_vty (struct vty *vty, const char *peer_str, afi_t afi,
paulfee0f4c2004-09-13 05:12:46 +00002140 safi_t safi, u_int32_t flag)
paul718e3742002-12-13 20:15:29 +00002141{
2142 return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 0);
2143}
David Lamparter6b0655a2014-06-04 06:53:35 +02002144
paul718e3742002-12-13 20:15:29 +00002145/* neighbor capability orf prefix-list. */
2146DEFUN (neighbor_capability_orf_prefix,
2147 neighbor_capability_orf_prefix_cmd,
2148 NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)",
2149 NEIGHBOR_STR
2150 NEIGHBOR_ADDR_STR2
2151 "Advertise capability to the peer\n"
2152 "Advertise ORF capability to the peer\n"
2153 "Advertise prefixlist ORF capability to this neighbor\n"
2154 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
2155 "Capability to RECEIVE the ORF from this neighbor\n"
2156 "Capability to SEND the ORF to this neighbor\n")
2157{
2158 u_int16_t flag = 0;
2159
2160 if (strncmp (argv[1], "s", 1) == 0)
2161 flag = PEER_FLAG_ORF_PREFIX_SM;
2162 else if (strncmp (argv[1], "r", 1) == 0)
2163 flag = PEER_FLAG_ORF_PREFIX_RM;
2164 else if (strncmp (argv[1], "b", 1) == 0)
2165 flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM;
2166 else
2167 return CMD_WARNING;
2168
2169 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2170 bgp_node_safi (vty), flag);
2171}
2172
2173DEFUN (no_neighbor_capability_orf_prefix,
2174 no_neighbor_capability_orf_prefix_cmd,
2175 NO_NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)",
2176 NO_STR
2177 NEIGHBOR_STR
2178 NEIGHBOR_ADDR_STR2
2179 "Advertise capability to the peer\n"
2180 "Advertise ORF capability to the peer\n"
2181 "Advertise prefixlist ORF capability to this neighbor\n"
2182 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
2183 "Capability to RECEIVE the ORF from this neighbor\n"
2184 "Capability to SEND the ORF to this neighbor\n")
2185{
2186 u_int16_t flag = 0;
2187
2188 if (strncmp (argv[1], "s", 1) == 0)
2189 flag = PEER_FLAG_ORF_PREFIX_SM;
2190 else if (strncmp (argv[1], "r", 1) == 0)
2191 flag = PEER_FLAG_ORF_PREFIX_RM;
2192 else if (strncmp (argv[1], "b", 1) == 0)
2193 flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM;
2194 else
2195 return CMD_WARNING;
2196
2197 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2198 bgp_node_safi (vty), flag);
2199}
David Lamparter6b0655a2014-06-04 06:53:35 +02002200
paul718e3742002-12-13 20:15:29 +00002201/* neighbor next-hop-self. */
2202DEFUN (neighbor_nexthop_self,
2203 neighbor_nexthop_self_cmd,
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002204 NEIGHBOR_CMD2 "next-hop-self {all}",
paul718e3742002-12-13 20:15:29 +00002205 NEIGHBOR_STR
2206 NEIGHBOR_ADDR_STR2
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002207 "Disable the next hop calculation for this neighbor\n"
2208 "Apply also to ibgp-learned routes when acting as a route reflector\n")
paul718e3742002-12-13 20:15:29 +00002209{
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002210 u_int32_t flags = PEER_FLAG_NEXTHOP_SELF, unset = 0;
2211 int rc;
2212
2213 /* Check if "all" is specified */
2214 if (argv[1] != NULL)
2215 flags |= PEER_FLAG_NEXTHOP_SELF_ALL;
2216 else
2217 unset |= PEER_FLAG_NEXTHOP_SELF_ALL;
2218
2219 rc = peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2220 bgp_node_safi (vty), flags);
2221 if ( rc == CMD_SUCCESS && unset )
2222 rc = peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2223 bgp_node_safi (vty), unset);
2224 return rc;
paul718e3742002-12-13 20:15:29 +00002225}
2226
2227DEFUN (no_neighbor_nexthop_self,
2228 no_neighbor_nexthop_self_cmd,
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002229 NO_NEIGHBOR_CMD2 "next-hop-self {all}",
paul718e3742002-12-13 20:15:29 +00002230 NO_STR
2231 NEIGHBOR_STR
2232 NEIGHBOR_ADDR_STR2
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002233 "Disable the next hop calculation for this neighbor\n"
2234 "Apply also to ibgp-learned routes when acting as a route reflector\n")
paul718e3742002-12-13 20:15:29 +00002235{
2236 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002237 bgp_node_safi (vty),
2238 PEER_FLAG_NEXTHOP_SELF|PEER_FLAG_NEXTHOP_SELF_ALL);
paul718e3742002-12-13 20:15:29 +00002239}
David Lamparter6b0655a2014-06-04 06:53:35 +02002240
paul718e3742002-12-13 20:15:29 +00002241/* neighbor remove-private-AS. */
2242DEFUN (neighbor_remove_private_as,
2243 neighbor_remove_private_as_cmd,
2244 NEIGHBOR_CMD2 "remove-private-AS",
2245 NEIGHBOR_STR
2246 NEIGHBOR_ADDR_STR2
2247 "Remove private AS number from outbound updates\n")
2248{
2249 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2250 bgp_node_safi (vty),
2251 PEER_FLAG_REMOVE_PRIVATE_AS);
2252}
2253
2254DEFUN (no_neighbor_remove_private_as,
2255 no_neighbor_remove_private_as_cmd,
2256 NO_NEIGHBOR_CMD2 "remove-private-AS",
2257 NO_STR
2258 NEIGHBOR_STR
2259 NEIGHBOR_ADDR_STR2
2260 "Remove private AS number from outbound updates\n")
2261{
2262 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2263 bgp_node_safi (vty),
2264 PEER_FLAG_REMOVE_PRIVATE_AS);
2265}
David Lamparter6b0655a2014-06-04 06:53:35 +02002266
paul718e3742002-12-13 20:15:29 +00002267/* neighbor send-community. */
2268DEFUN (neighbor_send_community,
2269 neighbor_send_community_cmd,
2270 NEIGHBOR_CMD2 "send-community",
2271 NEIGHBOR_STR
2272 NEIGHBOR_ADDR_STR2
2273 "Send Community attribute to this neighbor\n")
2274{
2275 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2276 bgp_node_safi (vty),
2277 PEER_FLAG_SEND_COMMUNITY);
2278}
2279
2280DEFUN (no_neighbor_send_community,
2281 no_neighbor_send_community_cmd,
2282 NO_NEIGHBOR_CMD2 "send-community",
2283 NO_STR
2284 NEIGHBOR_STR
2285 NEIGHBOR_ADDR_STR2
2286 "Send Community attribute to this neighbor\n")
2287{
2288 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2289 bgp_node_safi (vty),
2290 PEER_FLAG_SEND_COMMUNITY);
2291}
David Lamparter6b0655a2014-06-04 06:53:35 +02002292
paul718e3742002-12-13 20:15:29 +00002293/* neighbor send-community extended. */
2294DEFUN (neighbor_send_community_type,
2295 neighbor_send_community_type_cmd,
2296 NEIGHBOR_CMD2 "send-community (both|extended|standard)",
2297 NEIGHBOR_STR
2298 NEIGHBOR_ADDR_STR2
2299 "Send Community attribute to this neighbor\n"
2300 "Send Standard and Extended Community attributes\n"
2301 "Send Extended Community attributes\n"
2302 "Send Standard Community attributes\n")
2303{
2304 if (strncmp (argv[1], "s", 1) == 0)
2305 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2306 bgp_node_safi (vty),
2307 PEER_FLAG_SEND_COMMUNITY);
2308 if (strncmp (argv[1], "e", 1) == 0)
2309 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2310 bgp_node_safi (vty),
2311 PEER_FLAG_SEND_EXT_COMMUNITY);
2312
2313 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2314 bgp_node_safi (vty),
2315 (PEER_FLAG_SEND_COMMUNITY|
2316 PEER_FLAG_SEND_EXT_COMMUNITY));
2317}
2318
2319DEFUN (no_neighbor_send_community_type,
2320 no_neighbor_send_community_type_cmd,
2321 NO_NEIGHBOR_CMD2 "send-community (both|extended|standard)",
2322 NO_STR
2323 NEIGHBOR_STR
2324 NEIGHBOR_ADDR_STR2
2325 "Send Community attribute to this neighbor\n"
2326 "Send Standard and Extended Community attributes\n"
2327 "Send Extended Community attributes\n"
2328 "Send Standard Community attributes\n")
2329{
2330 if (strncmp (argv[1], "s", 1) == 0)
2331 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2332 bgp_node_safi (vty),
2333 PEER_FLAG_SEND_COMMUNITY);
2334 if (strncmp (argv[1], "e", 1) == 0)
2335 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2336 bgp_node_safi (vty),
2337 PEER_FLAG_SEND_EXT_COMMUNITY);
2338
2339 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2340 bgp_node_safi (vty),
2341 (PEER_FLAG_SEND_COMMUNITY |
2342 PEER_FLAG_SEND_EXT_COMMUNITY));
2343}
David Lamparter6b0655a2014-06-04 06:53:35 +02002344
paul718e3742002-12-13 20:15:29 +00002345/* neighbor soft-reconfig. */
2346DEFUN (neighbor_soft_reconfiguration,
2347 neighbor_soft_reconfiguration_cmd,
2348 NEIGHBOR_CMD2 "soft-reconfiguration inbound",
2349 NEIGHBOR_STR
2350 NEIGHBOR_ADDR_STR2
2351 "Per neighbor soft reconfiguration\n"
2352 "Allow inbound soft reconfiguration for this neighbor\n")
2353{
2354 return peer_af_flag_set_vty (vty, argv[0],
2355 bgp_node_afi (vty), bgp_node_safi (vty),
2356 PEER_FLAG_SOFT_RECONFIG);
2357}
2358
2359DEFUN (no_neighbor_soft_reconfiguration,
2360 no_neighbor_soft_reconfiguration_cmd,
2361 NO_NEIGHBOR_CMD2 "soft-reconfiguration inbound",
2362 NO_STR
2363 NEIGHBOR_STR
2364 NEIGHBOR_ADDR_STR2
2365 "Per neighbor soft reconfiguration\n"
2366 "Allow inbound soft reconfiguration for this neighbor\n")
2367{
2368 return peer_af_flag_unset_vty (vty, argv[0],
2369 bgp_node_afi (vty), bgp_node_safi (vty),
2370 PEER_FLAG_SOFT_RECONFIG);
2371}
David Lamparter6b0655a2014-06-04 06:53:35 +02002372
paul718e3742002-12-13 20:15:29 +00002373DEFUN (neighbor_route_reflector_client,
2374 neighbor_route_reflector_client_cmd,
2375 NEIGHBOR_CMD2 "route-reflector-client",
2376 NEIGHBOR_STR
2377 NEIGHBOR_ADDR_STR2
2378 "Configure a neighbor as Route Reflector client\n")
2379{
2380 struct peer *peer;
2381
2382
2383 peer = peer_and_group_lookup_vty (vty, argv[0]);
2384 if (! peer)
2385 return CMD_WARNING;
2386
2387 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2388 bgp_node_safi (vty),
2389 PEER_FLAG_REFLECTOR_CLIENT);
2390}
2391
2392DEFUN (no_neighbor_route_reflector_client,
2393 no_neighbor_route_reflector_client_cmd,
2394 NO_NEIGHBOR_CMD2 "route-reflector-client",
2395 NO_STR
2396 NEIGHBOR_STR
2397 NEIGHBOR_ADDR_STR2
2398 "Configure a neighbor as Route Reflector client\n")
2399{
2400 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2401 bgp_node_safi (vty),
2402 PEER_FLAG_REFLECTOR_CLIENT);
2403}
David Lamparter6b0655a2014-06-04 06:53:35 +02002404
paul94f2b392005-06-28 12:44:16 +00002405static int
paulfd79ac92004-10-13 05:06:08 +00002406peer_rsclient_set_vty (struct vty *vty, const char *peer_str,
2407 int afi, int safi)
paulfee0f4c2004-09-13 05:12:46 +00002408{
2409 int ret;
2410 struct bgp *bgp;
2411 struct peer *peer;
2412 struct peer_group *group;
paul1eb8ef22005-04-07 07:30:20 +00002413 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00002414 struct bgp_filter *pfilter;
2415 struct bgp_filter *gfilter;
Chris Caputo228da422009-07-18 05:44:03 +00002416 int locked_and_added = 0;
paulfee0f4c2004-09-13 05:12:46 +00002417
2418 bgp = vty->index;
2419
2420 peer = peer_and_group_lookup_vty (vty, peer_str);
2421 if ( ! peer )
2422 return CMD_WARNING;
2423
2424 /* If it is already a RS-Client, don't do anything. */
2425 if ( CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) )
2426 return CMD_SUCCESS;
2427
2428 if ( ! peer_rsclient_active (peer) )
paul200df112005-06-01 11:17:05 +00002429 {
2430 peer = peer_lock (peer); /* rsclient peer list reference */
2431 listnode_add_sort (bgp->rsclient, peer);
Chris Caputo228da422009-07-18 05:44:03 +00002432 locked_and_added = 1;
paul200df112005-06-01 11:17:05 +00002433 }
paulfee0f4c2004-09-13 05:12:46 +00002434
2435 ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2436 if (ret < 0)
Chris Caputo228da422009-07-18 05:44:03 +00002437 {
2438 if (locked_and_added)
2439 {
2440 listnode_delete (bgp->rsclient, peer);
2441 peer_unlock (peer); /* rsclient peer list reference */
2442 }
2443
2444 return bgp_vty_return (vty, ret);
2445 }
paulfee0f4c2004-09-13 05:12:46 +00002446
Paul Jakma64e580a2006-02-21 01:09:01 +00002447 peer->rib[afi][safi] = bgp_table_init (afi, safi);
paulfee0f4c2004-09-13 05:12:46 +00002448 peer->rib[afi][safi]->type = BGP_TABLE_RSCLIENT;
Chris Caputo228da422009-07-18 05:44:03 +00002449 /* RIB peer reference. Released when table is free'd in bgp_table_free. */
2450 peer->rib[afi][safi]->owner = peer_lock (peer);
paulfee0f4c2004-09-13 05:12:46 +00002451
2452 /* Check for existing 'network' and 'redistribute' routes. */
2453 bgp_check_local_routes_rsclient (peer, afi, safi);
2454
2455 /* Check for routes for peers configured with 'soft-reconfiguration'. */
2456 bgp_soft_reconfig_rsclient (peer, afi, safi);
2457
2458 if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP))
2459 {
2460 group = peer->group;
2461 gfilter = &peer->filter[afi][safi];
2462
paul1eb8ef22005-04-07 07:30:20 +00002463 for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00002464 {
2465 pfilter = &peer->filter[afi][safi];
2466
2467 /* Members of a non-RS-Client group should not be RS-Clients, as that
2468 is checked when the become part of the peer-group */
2469 ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2470 if (ret < 0)
2471 return bgp_vty_return (vty, ret);
2472
2473 /* Make peer's RIB point to group's RIB. */
2474 peer->rib[afi][safi] = group->conf->rib[afi][safi];
2475
2476 /* Import policy. */
2477 if (pfilter->map[RMAP_IMPORT].name)
2478 free (pfilter->map[RMAP_IMPORT].name);
2479 if (gfilter->map[RMAP_IMPORT].name)
2480 {
2481 pfilter->map[RMAP_IMPORT].name = strdup (gfilter->map[RMAP_IMPORT].name);
2482 pfilter->map[RMAP_IMPORT].map = gfilter->map[RMAP_IMPORT].map;
2483 }
2484 else
2485 {
2486 pfilter->map[RMAP_IMPORT].name = NULL;
2487 pfilter->map[RMAP_IMPORT].map =NULL;
2488 }
2489
2490 /* Export policy. */
2491 if (gfilter->map[RMAP_EXPORT].name && ! pfilter->map[RMAP_EXPORT].name)
2492 {
2493 pfilter->map[RMAP_EXPORT].name = strdup (gfilter->map[RMAP_EXPORT].name);
2494 pfilter->map[RMAP_EXPORT].map = gfilter->map[RMAP_EXPORT].map;
2495 }
2496 }
2497 }
2498 return CMD_SUCCESS;
2499}
2500
paul94f2b392005-06-28 12:44:16 +00002501static int
paulfd79ac92004-10-13 05:06:08 +00002502peer_rsclient_unset_vty (struct vty *vty, const char *peer_str,
2503 int afi, int safi)
paulfee0f4c2004-09-13 05:12:46 +00002504{
2505 int ret;
2506 struct bgp *bgp;
2507 struct peer *peer;
2508 struct peer_group *group;
paul1eb8ef22005-04-07 07:30:20 +00002509 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00002510
2511 bgp = vty->index;
2512
2513 peer = peer_and_group_lookup_vty (vty, peer_str);
2514 if ( ! peer )
2515 return CMD_WARNING;
2516
2517 /* If it is not a RS-Client, don't do anything. */
2518 if ( ! CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) )
2519 return CMD_SUCCESS;
2520
2521 if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP))
2522 {
2523 group = peer->group;
2524
paul1eb8ef22005-04-07 07:30:20 +00002525 for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00002526 {
2527 ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2528 if (ret < 0)
2529 return bgp_vty_return (vty, ret);
2530
2531 peer->rib[afi][safi] = NULL;
2532 }
2533
2534 peer = group->conf;
2535 }
2536
2537 ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2538 if (ret < 0)
2539 return bgp_vty_return (vty, ret);
2540
2541 if ( ! peer_rsclient_active (peer) )
paul200df112005-06-01 11:17:05 +00002542 {
Chris Caputo228da422009-07-18 05:44:03 +00002543 bgp_clear_route (peer, afi, safi, BGP_CLEAR_ROUTE_MY_RSCLIENT);
paul200df112005-06-01 11:17:05 +00002544 listnode_delete (bgp->rsclient, peer);
Chris Caputo228da422009-07-18 05:44:03 +00002545 peer_unlock (peer); /* peer bgp rsclient reference */
paul200df112005-06-01 11:17:05 +00002546 }
paulfee0f4c2004-09-13 05:12:46 +00002547
Paul Jakmab608d5b2008-07-02 02:12:07 +00002548 bgp_table_finish (&peer->rib[bgp_node_afi(vty)][bgp_node_safi(vty)]);
paulfee0f4c2004-09-13 05:12:46 +00002549
2550 return CMD_SUCCESS;
2551}
David Lamparter6b0655a2014-06-04 06:53:35 +02002552
paul718e3742002-12-13 20:15:29 +00002553/* neighbor route-server-client. */
2554DEFUN (neighbor_route_server_client,
2555 neighbor_route_server_client_cmd,
2556 NEIGHBOR_CMD2 "route-server-client",
2557 NEIGHBOR_STR
2558 NEIGHBOR_ADDR_STR2
2559 "Configure a neighbor as Route Server client\n")
2560{
paulfee0f4c2004-09-13 05:12:46 +00002561 return peer_rsclient_set_vty (vty, argv[0], bgp_node_afi(vty),
2562 bgp_node_safi(vty));
paul718e3742002-12-13 20:15:29 +00002563}
2564
2565DEFUN (no_neighbor_route_server_client,
2566 no_neighbor_route_server_client_cmd,
2567 NO_NEIGHBOR_CMD2 "route-server-client",
2568 NO_STR
2569 NEIGHBOR_STR
2570 NEIGHBOR_ADDR_STR2
2571 "Configure a neighbor as Route Server client\n")
2572{
paulfee0f4c2004-09-13 05:12:46 +00002573 return peer_rsclient_unset_vty (vty, argv[0], bgp_node_afi(vty),
2574 bgp_node_safi(vty));
2575}
David Lamparter6b0655a2014-06-04 06:53:35 +02002576
paulfee0f4c2004-09-13 05:12:46 +00002577DEFUN (neighbor_nexthop_local_unchanged,
2578 neighbor_nexthop_local_unchanged_cmd,
2579 NEIGHBOR_CMD2 "nexthop-local unchanged",
2580 NEIGHBOR_STR
2581 NEIGHBOR_ADDR_STR2
2582 "Configure treatment of outgoing link-local nexthop attribute\n"
2583 "Leave link-local nexthop unchanged for this peer\n")
2584{
2585 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2586 bgp_node_safi (vty),
2587 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED );
2588}
David Lamparter6b0655a2014-06-04 06:53:35 +02002589
paulfee0f4c2004-09-13 05:12:46 +00002590DEFUN (no_neighbor_nexthop_local_unchanged,
2591 no_neighbor_nexthop_local_unchanged_cmd,
2592 NO_NEIGHBOR_CMD2 "nexthop-local unchanged",
2593 NO_STR
2594 NEIGHBOR_STR
2595 NEIGHBOR_ADDR_STR2
2596 "Configure treatment of outgoing link-local-nexthop attribute\n"
2597 "Leave link-local nexthop unchanged for this peer\n")
2598{
paul718e3742002-12-13 20:15:29 +00002599 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2600 bgp_node_safi (vty),
paulfee0f4c2004-09-13 05:12:46 +00002601 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED );
paul718e3742002-12-13 20:15:29 +00002602}
David Lamparter6b0655a2014-06-04 06:53:35 +02002603
paul718e3742002-12-13 20:15:29 +00002604DEFUN (neighbor_attr_unchanged,
2605 neighbor_attr_unchanged_cmd,
2606 NEIGHBOR_CMD2 "attribute-unchanged",
2607 NEIGHBOR_STR
2608 NEIGHBOR_ADDR_STR2
2609 "BGP attribute is propagated unchanged to this neighbor\n")
2610{
2611 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2612 bgp_node_safi (vty),
2613 (PEER_FLAG_AS_PATH_UNCHANGED |
2614 PEER_FLAG_NEXTHOP_UNCHANGED |
2615 PEER_FLAG_MED_UNCHANGED));
2616}
2617
2618DEFUN (neighbor_attr_unchanged1,
2619 neighbor_attr_unchanged1_cmd,
2620 NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)",
2621 NEIGHBOR_STR
2622 NEIGHBOR_ADDR_STR2
2623 "BGP attribute is propagated unchanged to this neighbor\n"
2624 "As-path attribute\n"
2625 "Nexthop attribute\n"
2626 "Med attribute\n")
2627{
2628 u_int16_t flags = 0;
2629
2630 if (strncmp (argv[1], "as-path", 1) == 0)
2631 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2632 else if (strncmp (argv[1], "next-hop", 1) == 0)
2633 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2634 else if (strncmp (argv[1], "med", 1) == 0)
2635 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2636
2637 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2638 bgp_node_safi (vty), flags);
2639}
2640
2641DEFUN (neighbor_attr_unchanged2,
2642 neighbor_attr_unchanged2_cmd,
2643 NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)",
2644 NEIGHBOR_STR
2645 NEIGHBOR_ADDR_STR2
2646 "BGP attribute is propagated unchanged to this neighbor\n"
2647 "As-path attribute\n"
2648 "Nexthop attribute\n"
2649 "Med attribute\n")
2650{
2651 u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED;
2652
2653 if (strncmp (argv[1], "next-hop", 1) == 0)
2654 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2655 else if (strncmp (argv[1], "med", 1) == 0)
2656 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2657
2658 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2659 bgp_node_safi (vty), flags);
2660
2661}
2662
2663DEFUN (neighbor_attr_unchanged3,
2664 neighbor_attr_unchanged3_cmd,
2665 NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)",
2666 NEIGHBOR_STR
2667 NEIGHBOR_ADDR_STR2
2668 "BGP attribute is propagated unchanged to this neighbor\n"
2669 "Nexthop attribute\n"
2670 "As-path attribute\n"
2671 "Med attribute\n")
2672{
2673 u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED;
2674
2675 if (strncmp (argv[1], "as-path", 1) == 0)
2676 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2677 else if (strncmp (argv[1], "med", 1) == 0)
2678 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2679
2680 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2681 bgp_node_safi (vty), flags);
2682}
2683
2684DEFUN (neighbor_attr_unchanged4,
2685 neighbor_attr_unchanged4_cmd,
2686 NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)",
2687 NEIGHBOR_STR
2688 NEIGHBOR_ADDR_STR2
2689 "BGP attribute is propagated unchanged to this neighbor\n"
2690 "Med attribute\n"
2691 "As-path attribute\n"
2692 "Nexthop attribute\n")
2693{
2694 u_int16_t flags = PEER_FLAG_MED_UNCHANGED;
2695
2696 if (strncmp (argv[1], "as-path", 1) == 0)
2697 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2698 else if (strncmp (argv[1], "next-hop", 1) == 0)
2699 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2700
2701 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2702 bgp_node_safi (vty), flags);
2703}
2704
2705ALIAS (neighbor_attr_unchanged,
2706 neighbor_attr_unchanged5_cmd,
2707 NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med",
2708 NEIGHBOR_STR
2709 NEIGHBOR_ADDR_STR2
2710 "BGP attribute is propagated unchanged to this neighbor\n"
2711 "As-path attribute\n"
2712 "Nexthop attribute\n"
2713 "Med attribute\n")
2714
2715ALIAS (neighbor_attr_unchanged,
2716 neighbor_attr_unchanged6_cmd,
2717 NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop",
2718 NEIGHBOR_STR
2719 NEIGHBOR_ADDR_STR2
2720 "BGP attribute is propagated unchanged to this neighbor\n"
2721 "As-path attribute\n"
2722 "Med attribute\n"
2723 "Nexthop attribute\n")
2724
2725ALIAS (neighbor_attr_unchanged,
2726 neighbor_attr_unchanged7_cmd,
2727 NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path",
2728 NEIGHBOR_STR
2729 NEIGHBOR_ADDR_STR2
2730 "BGP attribute is propagated unchanged to this neighbor\n"
2731 "Nexthop attribute\n"
2732 "Med attribute\n"
2733 "As-path attribute\n")
2734
2735ALIAS (neighbor_attr_unchanged,
2736 neighbor_attr_unchanged8_cmd,
2737 NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med",
2738 NEIGHBOR_STR
2739 NEIGHBOR_ADDR_STR2
2740 "BGP attribute is propagated unchanged to this neighbor\n"
2741 "Nexthop attribute\n"
2742 "As-path attribute\n"
2743 "Med attribute\n")
2744
2745ALIAS (neighbor_attr_unchanged,
2746 neighbor_attr_unchanged9_cmd,
2747 NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path",
2748 NEIGHBOR_STR
2749 NEIGHBOR_ADDR_STR2
2750 "BGP attribute is propagated unchanged to this neighbor\n"
2751 "Med attribute\n"
2752 "Nexthop attribute\n"
2753 "As-path attribute\n")
2754
2755ALIAS (neighbor_attr_unchanged,
2756 neighbor_attr_unchanged10_cmd,
2757 NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop",
2758 NEIGHBOR_STR
2759 NEIGHBOR_ADDR_STR2
2760 "BGP attribute is propagated unchanged to this neighbor\n"
2761 "Med attribute\n"
2762 "As-path attribute\n"
2763 "Nexthop attribute\n")
2764
2765DEFUN (no_neighbor_attr_unchanged,
2766 no_neighbor_attr_unchanged_cmd,
2767 NO_NEIGHBOR_CMD2 "attribute-unchanged",
2768 NO_STR
2769 NEIGHBOR_STR
2770 NEIGHBOR_ADDR_STR2
2771 "BGP attribute is propagated unchanged to this neighbor\n")
2772{
2773 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2774 bgp_node_safi (vty),
2775 (PEER_FLAG_AS_PATH_UNCHANGED |
2776 PEER_FLAG_NEXTHOP_UNCHANGED |
2777 PEER_FLAG_MED_UNCHANGED));
2778}
2779
2780DEFUN (no_neighbor_attr_unchanged1,
2781 no_neighbor_attr_unchanged1_cmd,
2782 NO_NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)",
2783 NO_STR
2784 NEIGHBOR_STR
2785 NEIGHBOR_ADDR_STR2
2786 "BGP attribute is propagated unchanged to this neighbor\n"
2787 "As-path attribute\n"
2788 "Nexthop attribute\n"
2789 "Med attribute\n")
2790{
2791 u_int16_t flags = 0;
2792
2793 if (strncmp (argv[1], "as-path", 1) == 0)
2794 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2795 else if (strncmp (argv[1], "next-hop", 1) == 0)
2796 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2797 else if (strncmp (argv[1], "med", 1) == 0)
2798 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2799
2800 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2801 bgp_node_safi (vty), flags);
2802}
2803
2804DEFUN (no_neighbor_attr_unchanged2,
2805 no_neighbor_attr_unchanged2_cmd,
2806 NO_NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)",
2807 NO_STR
2808 NEIGHBOR_STR
2809 NEIGHBOR_ADDR_STR2
2810 "BGP attribute is propagated unchanged to this neighbor\n"
2811 "As-path attribute\n"
2812 "Nexthop attribute\n"
2813 "Med attribute\n")
2814{
2815 u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED;
2816
2817 if (strncmp (argv[1], "next-hop", 1) == 0)
2818 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2819 else if (strncmp (argv[1], "med", 1) == 0)
2820 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2821
2822 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2823 bgp_node_safi (vty), flags);
2824}
2825
2826DEFUN (no_neighbor_attr_unchanged3,
2827 no_neighbor_attr_unchanged3_cmd,
2828 NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)",
2829 NO_STR
2830 NEIGHBOR_STR
2831 NEIGHBOR_ADDR_STR2
2832 "BGP attribute is propagated unchanged to this neighbor\n"
2833 "Nexthop attribute\n"
2834 "As-path attribute\n"
2835 "Med attribute\n")
2836{
2837 u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED;
2838
2839 if (strncmp (argv[1], "as-path", 1) == 0)
2840 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2841 else if (strncmp (argv[1], "med", 1) == 0)
2842 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2843
2844 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2845 bgp_node_safi (vty), flags);
2846}
2847
2848DEFUN (no_neighbor_attr_unchanged4,
2849 no_neighbor_attr_unchanged4_cmd,
2850 NO_NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)",
2851 NO_STR
2852 NEIGHBOR_STR
2853 NEIGHBOR_ADDR_STR2
2854 "BGP attribute is propagated unchanged to this neighbor\n"
2855 "Med attribute\n"
2856 "As-path attribute\n"
2857 "Nexthop attribute\n")
2858{
2859 u_int16_t flags = PEER_FLAG_MED_UNCHANGED;
2860
2861 if (strncmp (argv[1], "as-path", 1) == 0)
2862 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2863 else if (strncmp (argv[1], "next-hop", 1) == 0)
2864 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2865
2866 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2867 bgp_node_safi (vty), flags);
2868}
2869
2870ALIAS (no_neighbor_attr_unchanged,
2871 no_neighbor_attr_unchanged5_cmd,
2872 NO_NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med",
2873 NO_STR
2874 NEIGHBOR_STR
2875 NEIGHBOR_ADDR_STR2
2876 "BGP attribute is propagated unchanged to this neighbor\n"
2877 "As-path attribute\n"
2878 "Nexthop attribute\n"
2879 "Med attribute\n")
2880
2881ALIAS (no_neighbor_attr_unchanged,
2882 no_neighbor_attr_unchanged6_cmd,
2883 NO_NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop",
2884 NO_STR
2885 NEIGHBOR_STR
2886 NEIGHBOR_ADDR_STR2
2887 "BGP attribute is propagated unchanged to this neighbor\n"
2888 "As-path attribute\n"
2889 "Med attribute\n"
2890 "Nexthop attribute\n")
2891
2892ALIAS (no_neighbor_attr_unchanged,
2893 no_neighbor_attr_unchanged7_cmd,
2894 NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path",
2895 NO_STR
2896 NEIGHBOR_STR
2897 NEIGHBOR_ADDR_STR2
2898 "BGP attribute is propagated unchanged to this neighbor\n"
2899 "Nexthop attribute\n"
2900 "Med attribute\n"
2901 "As-path attribute\n")
2902
2903ALIAS (no_neighbor_attr_unchanged,
2904 no_neighbor_attr_unchanged8_cmd,
2905 NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med",
2906 NO_STR
2907 NEIGHBOR_STR
2908 NEIGHBOR_ADDR_STR2
2909 "BGP attribute is propagated unchanged to this neighbor\n"
2910 "Nexthop attribute\n"
2911 "As-path attribute\n"
2912 "Med attribute\n")
2913
2914ALIAS (no_neighbor_attr_unchanged,
2915 no_neighbor_attr_unchanged9_cmd,
2916 NO_NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path",
2917 NO_STR
2918 NEIGHBOR_STR
2919 NEIGHBOR_ADDR_STR2
2920 "BGP attribute is propagated unchanged to this neighbor\n"
2921 "Med attribute\n"
2922 "Nexthop attribute\n"
2923 "As-path attribute\n")
2924
2925ALIAS (no_neighbor_attr_unchanged,
2926 no_neighbor_attr_unchanged10_cmd,
2927 NO_NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop",
2928 NO_STR
2929 NEIGHBOR_STR
2930 NEIGHBOR_ADDR_STR2
2931 "BGP attribute is propagated unchanged to this neighbor\n"
2932 "Med attribute\n"
2933 "As-path attribute\n"
2934 "Nexthop attribute\n")
2935
2936/* For old version Zebra compatibility. */
hassodd4c5932005-02-02 17:15:34 +00002937DEFUN_DEPRECATED (neighbor_transparent_as,
2938 neighbor_transparent_as_cmd,
2939 NEIGHBOR_CMD "transparent-as",
2940 NEIGHBOR_STR
2941 NEIGHBOR_ADDR_STR
2942 "Do not append my AS number even peer is EBGP peer\n")
paul718e3742002-12-13 20:15:29 +00002943{
2944 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2945 bgp_node_safi (vty),
2946 PEER_FLAG_AS_PATH_UNCHANGED);
2947}
2948
hassodd4c5932005-02-02 17:15:34 +00002949DEFUN_DEPRECATED (neighbor_transparent_nexthop,
2950 neighbor_transparent_nexthop_cmd,
2951 NEIGHBOR_CMD "transparent-nexthop",
2952 NEIGHBOR_STR
2953 NEIGHBOR_ADDR_STR
2954 "Do not change nexthop even peer is EBGP peer\n")
paul718e3742002-12-13 20:15:29 +00002955{
2956 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2957 bgp_node_safi (vty),
2958 PEER_FLAG_NEXTHOP_UNCHANGED);
2959}
David Lamparter6b0655a2014-06-04 06:53:35 +02002960
paul718e3742002-12-13 20:15:29 +00002961/* EBGP multihop configuration. */
paul94f2b392005-06-28 12:44:16 +00002962static int
paulfd79ac92004-10-13 05:06:08 +00002963peer_ebgp_multihop_set_vty (struct vty *vty, const char *ip_str,
2964 const char *ttl_str)
paul718e3742002-12-13 20:15:29 +00002965{
2966 struct peer *peer;
paulfd79ac92004-10-13 05:06:08 +00002967 unsigned int ttl;
paul718e3742002-12-13 20:15:29 +00002968
2969 peer = peer_and_group_lookup_vty (vty, ip_str);
2970 if (! peer)
2971 return CMD_WARNING;
2972
2973 if (! ttl_str)
2974 ttl = TTL_MAX;
2975 else
2976 VTY_GET_INTEGER_RANGE ("TTL", ttl, ttl_str, 1, 255);
2977
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00002978 return bgp_vty_return (vty, peer_ebgp_multihop_set (peer, ttl));
paul718e3742002-12-13 20:15:29 +00002979}
2980
paul94f2b392005-06-28 12:44:16 +00002981static int
paulfd79ac92004-10-13 05:06:08 +00002982peer_ebgp_multihop_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00002983{
2984 struct peer *peer;
2985
2986 peer = peer_and_group_lookup_vty (vty, ip_str);
2987 if (! peer)
2988 return CMD_WARNING;
2989
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00002990 return bgp_vty_return (vty, peer_ebgp_multihop_unset (peer));
paul718e3742002-12-13 20:15:29 +00002991}
2992
2993/* neighbor ebgp-multihop. */
2994DEFUN (neighbor_ebgp_multihop,
2995 neighbor_ebgp_multihop_cmd,
2996 NEIGHBOR_CMD2 "ebgp-multihop",
2997 NEIGHBOR_STR
2998 NEIGHBOR_ADDR_STR2
2999 "Allow EBGP neighbors not on directly connected networks\n")
3000{
3001 return peer_ebgp_multihop_set_vty (vty, argv[0], NULL);
3002}
3003
3004DEFUN (neighbor_ebgp_multihop_ttl,
3005 neighbor_ebgp_multihop_ttl_cmd,
3006 NEIGHBOR_CMD2 "ebgp-multihop <1-255>",
3007 NEIGHBOR_STR
3008 NEIGHBOR_ADDR_STR2
3009 "Allow EBGP neighbors not on directly connected networks\n"
3010 "maximum hop count\n")
3011{
3012 return peer_ebgp_multihop_set_vty (vty, argv[0], argv[1]);
3013}
3014
3015DEFUN (no_neighbor_ebgp_multihop,
3016 no_neighbor_ebgp_multihop_cmd,
3017 NO_NEIGHBOR_CMD2 "ebgp-multihop",
3018 NO_STR
3019 NEIGHBOR_STR
3020 NEIGHBOR_ADDR_STR2
3021 "Allow EBGP neighbors not on directly connected networks\n")
3022{
3023 return peer_ebgp_multihop_unset_vty (vty, argv[0]);
3024}
3025
3026ALIAS (no_neighbor_ebgp_multihop,
3027 no_neighbor_ebgp_multihop_ttl_cmd,
3028 NO_NEIGHBOR_CMD2 "ebgp-multihop <1-255>",
3029 NO_STR
3030 NEIGHBOR_STR
3031 NEIGHBOR_ADDR_STR2
3032 "Allow EBGP neighbors not on directly connected networks\n"
3033 "maximum hop count\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003034
hasso6ffd2072005-02-02 14:50:11 +00003035/* disable-connected-check */
3036DEFUN (neighbor_disable_connected_check,
3037 neighbor_disable_connected_check_cmd,
3038 NEIGHBOR_CMD2 "disable-connected-check",
3039 NEIGHBOR_STR
3040 NEIGHBOR_ADDR_STR2
3041 "one-hop away EBGP peer using loopback address\n")
3042{
3043 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK);
3044}
3045
3046DEFUN (no_neighbor_disable_connected_check,
3047 no_neighbor_disable_connected_check_cmd,
3048 NO_NEIGHBOR_CMD2 "disable-connected-check",
3049 NO_STR
3050 NEIGHBOR_STR
3051 NEIGHBOR_ADDR_STR2
3052 "one-hop away EBGP peer using loopback address\n")
3053{
3054 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK);
3055}
3056
paul718e3742002-12-13 20:15:29 +00003057/* Enforce multihop. */
hasso6ffd2072005-02-02 14:50:11 +00003058ALIAS (neighbor_disable_connected_check,
paul718e3742002-12-13 20:15:29 +00003059 neighbor_enforce_multihop_cmd,
3060 NEIGHBOR_CMD2 "enforce-multihop",
3061 NEIGHBOR_STR
3062 NEIGHBOR_ADDR_STR2
paule8e19462006-01-19 20:16:55 +00003063 "Enforce EBGP neighbors perform multihop\n")
paul718e3742002-12-13 20:15:29 +00003064
hasso6ffd2072005-02-02 14:50:11 +00003065/* Enforce multihop. */
3066ALIAS (no_neighbor_disable_connected_check,
paul718e3742002-12-13 20:15:29 +00003067 no_neighbor_enforce_multihop_cmd,
3068 NO_NEIGHBOR_CMD2 "enforce-multihop",
3069 NO_STR
3070 NEIGHBOR_STR
3071 NEIGHBOR_ADDR_STR2
paule8e19462006-01-19 20:16:55 +00003072 "Enforce EBGP neighbors perform multihop\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003073
paul718e3742002-12-13 20:15:29 +00003074DEFUN (neighbor_description,
3075 neighbor_description_cmd,
3076 NEIGHBOR_CMD2 "description .LINE",
3077 NEIGHBOR_STR
3078 NEIGHBOR_ADDR_STR2
3079 "Neighbor specific description\n"
3080 "Up to 80 characters describing this neighbor\n")
3081{
3082 struct peer *peer;
paul718e3742002-12-13 20:15:29 +00003083 char *str;
paul718e3742002-12-13 20:15:29 +00003084
3085 peer = peer_and_group_lookup_vty (vty, argv[0]);
3086 if (! peer)
3087 return CMD_WARNING;
3088
3089 if (argc == 1)
3090 return CMD_SUCCESS;
3091
ajs3b8b1852005-01-29 18:19:13 +00003092 str = argv_concat(argv, argc, 1);
paul718e3742002-12-13 20:15:29 +00003093
3094 peer_description_set (peer, str);
3095
ajs3b8b1852005-01-29 18:19:13 +00003096 XFREE (MTYPE_TMP, str);
paul718e3742002-12-13 20:15:29 +00003097
3098 return CMD_SUCCESS;
3099}
3100
3101DEFUN (no_neighbor_description,
3102 no_neighbor_description_cmd,
3103 NO_NEIGHBOR_CMD2 "description",
3104 NO_STR
3105 NEIGHBOR_STR
3106 NEIGHBOR_ADDR_STR2
3107 "Neighbor specific description\n")
3108{
3109 struct peer *peer;
3110
3111 peer = peer_and_group_lookup_vty (vty, argv[0]);
3112 if (! peer)
3113 return CMD_WARNING;
3114
3115 peer_description_unset (peer);
3116
3117 return CMD_SUCCESS;
3118}
3119
3120ALIAS (no_neighbor_description,
3121 no_neighbor_description_val_cmd,
3122 NO_NEIGHBOR_CMD2 "description .LINE",
3123 NO_STR
3124 NEIGHBOR_STR
3125 NEIGHBOR_ADDR_STR2
3126 "Neighbor specific description\n"
3127 "Up to 80 characters describing this neighbor\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003128
paul718e3742002-12-13 20:15:29 +00003129/* Neighbor update-source. */
paul94f2b392005-06-28 12:44:16 +00003130static int
paulfd79ac92004-10-13 05:06:08 +00003131peer_update_source_vty (struct vty *vty, const char *peer_str,
3132 const char *source_str)
paul718e3742002-12-13 20:15:29 +00003133{
3134 struct peer *peer;
paul718e3742002-12-13 20:15:29 +00003135
3136 peer = peer_and_group_lookup_vty (vty, peer_str);
3137 if (! peer)
3138 return CMD_WARNING;
3139
3140 if (source_str)
3141 {
Jorge Boncompte [DTI2]c63b83f2012-04-10 16:57:24 +02003142 union sockunion su;
3143 int ret = str2sockunion (source_str, &su);
3144
3145 if (ret == 0)
3146 peer_update_source_addr_set (peer, &su);
paul718e3742002-12-13 20:15:29 +00003147 else
3148 peer_update_source_if_set (peer, source_str);
3149 }
3150 else
3151 peer_update_source_unset (peer);
3152
3153 return CMD_SUCCESS;
3154}
3155
Paul Jakma9a1a3312009-07-27 12:27:55 +01003156#define BGP_UPDATE_SOURCE_STR "(A.B.C.D|X:X::X:X|WORD)"
Paul Jakma369688c2006-05-23 22:27:55 +00003157#define BGP_UPDATE_SOURCE_HELP_STR \
3158 "IPv4 address\n" \
Paul Jakma9a1a3312009-07-27 12:27:55 +01003159 "IPv6 address\n" \
3160 "Interface name (requires zebra to be running)\n"
Paul Jakma369688c2006-05-23 22:27:55 +00003161
paul718e3742002-12-13 20:15:29 +00003162DEFUN (neighbor_update_source,
3163 neighbor_update_source_cmd,
Paul Jakma369688c2006-05-23 22:27:55 +00003164 NEIGHBOR_CMD2 "update-source " BGP_UPDATE_SOURCE_STR,
paul718e3742002-12-13 20:15:29 +00003165 NEIGHBOR_STR
3166 NEIGHBOR_ADDR_STR2
3167 "Source of routing updates\n"
Paul Jakma369688c2006-05-23 22:27:55 +00003168 BGP_UPDATE_SOURCE_HELP_STR)
paul718e3742002-12-13 20:15:29 +00003169{
3170 return peer_update_source_vty (vty, argv[0], argv[1]);
3171}
3172
3173DEFUN (no_neighbor_update_source,
3174 no_neighbor_update_source_cmd,
3175 NO_NEIGHBOR_CMD2 "update-source",
3176 NO_STR
3177 NEIGHBOR_STR
3178 NEIGHBOR_ADDR_STR2
Paul Jakma369688c2006-05-23 22:27:55 +00003179 "Source of routing updates\n")
paul718e3742002-12-13 20:15:29 +00003180{
3181 return peer_update_source_vty (vty, argv[0], NULL);
3182}
David Lamparter6b0655a2014-06-04 06:53:35 +02003183
paul94f2b392005-06-28 12:44:16 +00003184static int
paulfd79ac92004-10-13 05:06:08 +00003185peer_default_originate_set_vty (struct vty *vty, const char *peer_str,
3186 afi_t afi, safi_t safi,
3187 const char *rmap, int set)
paul718e3742002-12-13 20:15:29 +00003188{
3189 int ret;
3190 struct peer *peer;
3191
3192 peer = peer_and_group_lookup_vty (vty, peer_str);
3193 if (! peer)
3194 return CMD_WARNING;
3195
3196 if (set)
3197 ret = peer_default_originate_set (peer, afi, safi, rmap);
3198 else
3199 ret = peer_default_originate_unset (peer, afi, safi);
3200
3201 return bgp_vty_return (vty, ret);
3202}
3203
3204/* neighbor default-originate. */
3205DEFUN (neighbor_default_originate,
3206 neighbor_default_originate_cmd,
3207 NEIGHBOR_CMD2 "default-originate",
3208 NEIGHBOR_STR
3209 NEIGHBOR_ADDR_STR2
3210 "Originate default route to this neighbor\n")
3211{
3212 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
3213 bgp_node_safi (vty), NULL, 1);
3214}
3215
3216DEFUN (neighbor_default_originate_rmap,
3217 neighbor_default_originate_rmap_cmd,
3218 NEIGHBOR_CMD2 "default-originate route-map WORD",
3219 NEIGHBOR_STR
3220 NEIGHBOR_ADDR_STR2
3221 "Originate default route to this neighbor\n"
3222 "Route-map to specify criteria to originate default\n"
3223 "route-map name\n")
3224{
3225 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
3226 bgp_node_safi (vty), argv[1], 1);
3227}
3228
3229DEFUN (no_neighbor_default_originate,
3230 no_neighbor_default_originate_cmd,
3231 NO_NEIGHBOR_CMD2 "default-originate",
3232 NO_STR
3233 NEIGHBOR_STR
3234 NEIGHBOR_ADDR_STR2
3235 "Originate default route to this neighbor\n")
3236{
3237 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
3238 bgp_node_safi (vty), NULL, 0);
3239}
3240
3241ALIAS (no_neighbor_default_originate,
3242 no_neighbor_default_originate_rmap_cmd,
3243 NO_NEIGHBOR_CMD2 "default-originate route-map WORD",
3244 NO_STR
3245 NEIGHBOR_STR
3246 NEIGHBOR_ADDR_STR2
3247 "Originate default route to this neighbor\n"
3248 "Route-map to specify criteria to originate default\n"
3249 "route-map name\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003250
paul718e3742002-12-13 20:15:29 +00003251/* Set neighbor's BGP port. */
paul94f2b392005-06-28 12:44:16 +00003252static int
paulfd79ac92004-10-13 05:06:08 +00003253peer_port_vty (struct vty *vty, const char *ip_str, int afi,
3254 const char *port_str)
paul718e3742002-12-13 20:15:29 +00003255{
3256 struct peer *peer;
3257 u_int16_t port;
3258 struct servent *sp;
3259
3260 peer = peer_lookup_vty (vty, ip_str);
3261 if (! peer)
3262 return CMD_WARNING;
3263
3264 if (! port_str)
3265 {
3266 sp = getservbyname ("bgp", "tcp");
3267 port = (sp == NULL) ? BGP_PORT_DEFAULT : ntohs (sp->s_port);
3268 }
3269 else
3270 {
3271 VTY_GET_INTEGER("port", port, port_str);
3272 }
3273
3274 peer_port_set (peer, port);
3275
3276 return CMD_SUCCESS;
3277}
3278
hassof4184462005-02-01 20:13:16 +00003279/* Set specified peer's BGP port. */
paul718e3742002-12-13 20:15:29 +00003280DEFUN (neighbor_port,
3281 neighbor_port_cmd,
3282 NEIGHBOR_CMD "port <0-65535>",
3283 NEIGHBOR_STR
3284 NEIGHBOR_ADDR_STR
3285 "Neighbor's BGP port\n"
3286 "TCP port number\n")
3287{
3288 return peer_port_vty (vty, argv[0], AFI_IP, argv[1]);
3289}
3290
3291DEFUN (no_neighbor_port,
3292 no_neighbor_port_cmd,
3293 NO_NEIGHBOR_CMD "port",
3294 NO_STR
3295 NEIGHBOR_STR
3296 NEIGHBOR_ADDR_STR
3297 "Neighbor's BGP port\n")
3298{
3299 return peer_port_vty (vty, argv[0], AFI_IP, NULL);
3300}
3301
3302ALIAS (no_neighbor_port,
3303 no_neighbor_port_val_cmd,
3304 NO_NEIGHBOR_CMD "port <0-65535>",
3305 NO_STR
3306 NEIGHBOR_STR
3307 NEIGHBOR_ADDR_STR
3308 "Neighbor's BGP port\n"
3309 "TCP port number\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003310
paul718e3742002-12-13 20:15:29 +00003311/* neighbor weight. */
paul94f2b392005-06-28 12:44:16 +00003312static int
paulfd79ac92004-10-13 05:06:08 +00003313peer_weight_set_vty (struct vty *vty, const char *ip_str,
3314 const char *weight_str)
paul718e3742002-12-13 20:15:29 +00003315{
paul718e3742002-12-13 20:15:29 +00003316 struct peer *peer;
3317 unsigned long weight;
3318
3319 peer = peer_and_group_lookup_vty (vty, ip_str);
3320 if (! peer)
3321 return CMD_WARNING;
3322
3323 VTY_GET_INTEGER_RANGE("weight", weight, weight_str, 0, 65535);
3324
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003325 return bgp_vty_return (vty, peer_weight_set (peer, weight));
paul718e3742002-12-13 20:15:29 +00003326}
3327
paul94f2b392005-06-28 12:44:16 +00003328static int
paulfd79ac92004-10-13 05:06:08 +00003329peer_weight_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00003330{
3331 struct peer *peer;
3332
3333 peer = peer_and_group_lookup_vty (vty, ip_str);
3334 if (! peer)
3335 return CMD_WARNING;
3336
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003337 return bgp_vty_return (vty, peer_weight_unset (peer));
paul718e3742002-12-13 20:15:29 +00003338}
3339
3340DEFUN (neighbor_weight,
3341 neighbor_weight_cmd,
3342 NEIGHBOR_CMD2 "weight <0-65535>",
3343 NEIGHBOR_STR
3344 NEIGHBOR_ADDR_STR2
3345 "Set default weight for routes from this neighbor\n"
3346 "default weight\n")
3347{
3348 return peer_weight_set_vty (vty, argv[0], argv[1]);
3349}
3350
3351DEFUN (no_neighbor_weight,
3352 no_neighbor_weight_cmd,
3353 NO_NEIGHBOR_CMD2 "weight",
3354 NO_STR
3355 NEIGHBOR_STR
3356 NEIGHBOR_ADDR_STR2
3357 "Set default weight for routes from this neighbor\n")
3358{
3359 return peer_weight_unset_vty (vty, argv[0]);
3360}
3361
3362ALIAS (no_neighbor_weight,
3363 no_neighbor_weight_val_cmd,
3364 NO_NEIGHBOR_CMD2 "weight <0-65535>",
3365 NO_STR
3366 NEIGHBOR_STR
3367 NEIGHBOR_ADDR_STR2
3368 "Set default weight for routes from this neighbor\n"
3369 "default weight\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003370
paul718e3742002-12-13 20:15:29 +00003371/* Override capability negotiation. */
3372DEFUN (neighbor_override_capability,
3373 neighbor_override_capability_cmd,
3374 NEIGHBOR_CMD2 "override-capability",
3375 NEIGHBOR_STR
3376 NEIGHBOR_ADDR_STR2
3377 "Override capability negotiation result\n")
3378{
3379 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY);
3380}
3381
3382DEFUN (no_neighbor_override_capability,
3383 no_neighbor_override_capability_cmd,
3384 NO_NEIGHBOR_CMD2 "override-capability",
3385 NO_STR
3386 NEIGHBOR_STR
3387 NEIGHBOR_ADDR_STR2
3388 "Override capability negotiation result\n")
3389{
3390 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY);
3391}
David Lamparter6b0655a2014-06-04 06:53:35 +02003392
paul718e3742002-12-13 20:15:29 +00003393DEFUN (neighbor_strict_capability,
3394 neighbor_strict_capability_cmd,
3395 NEIGHBOR_CMD "strict-capability-match",
3396 NEIGHBOR_STR
3397 NEIGHBOR_ADDR_STR
3398 "Strict capability negotiation match\n")
3399{
3400 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH);
3401}
3402
3403DEFUN (no_neighbor_strict_capability,
3404 no_neighbor_strict_capability_cmd,
3405 NO_NEIGHBOR_CMD "strict-capability-match",
3406 NO_STR
3407 NEIGHBOR_STR
3408 NEIGHBOR_ADDR_STR
3409 "Strict capability negotiation match\n")
3410{
3411 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH);
3412}
David Lamparter6b0655a2014-06-04 06:53:35 +02003413
paul94f2b392005-06-28 12:44:16 +00003414static int
paulfd79ac92004-10-13 05:06:08 +00003415peer_timers_set_vty (struct vty *vty, const char *ip_str,
3416 const char *keep_str, const char *hold_str)
paul718e3742002-12-13 20:15:29 +00003417{
3418 int ret;
3419 struct peer *peer;
3420 u_int32_t keepalive;
3421 u_int32_t holdtime;
3422
3423 peer = peer_and_group_lookup_vty (vty, ip_str);
3424 if (! peer)
3425 return CMD_WARNING;
3426
3427 VTY_GET_INTEGER_RANGE ("Keepalive", keepalive, keep_str, 0, 65535);
3428 VTY_GET_INTEGER_RANGE ("Holdtime", holdtime, hold_str, 0, 65535);
3429
3430 ret = peer_timers_set (peer, keepalive, holdtime);
3431
3432 return bgp_vty_return (vty, ret);
3433}
David Lamparter6b0655a2014-06-04 06:53:35 +02003434
paul94f2b392005-06-28 12:44:16 +00003435static int
paulfd79ac92004-10-13 05:06:08 +00003436peer_timers_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00003437{
3438 int ret;
3439 struct peer *peer;
3440
3441 peer = peer_lookup_vty (vty, ip_str);
3442 if (! peer)
3443 return CMD_WARNING;
3444
3445 ret = peer_timers_unset (peer);
3446
3447 return bgp_vty_return (vty, ret);
3448}
3449
3450DEFUN (neighbor_timers,
3451 neighbor_timers_cmd,
3452 NEIGHBOR_CMD2 "timers <0-65535> <0-65535>",
3453 NEIGHBOR_STR
3454 NEIGHBOR_ADDR_STR2
3455 "BGP per neighbor timers\n"
3456 "Keepalive interval\n"
3457 "Holdtime\n")
3458{
3459 return peer_timers_set_vty (vty, argv[0], argv[1], argv[2]);
3460}
3461
3462DEFUN (no_neighbor_timers,
3463 no_neighbor_timers_cmd,
3464 NO_NEIGHBOR_CMD2 "timers",
3465 NO_STR
3466 NEIGHBOR_STR
3467 NEIGHBOR_ADDR_STR2
3468 "BGP per neighbor timers\n")
3469{
3470 return peer_timers_unset_vty (vty, argv[0]);
3471}
David Lamparter6b0655a2014-06-04 06:53:35 +02003472
paul94f2b392005-06-28 12:44:16 +00003473static int
paulfd79ac92004-10-13 05:06:08 +00003474peer_timers_connect_set_vty (struct vty *vty, const char *ip_str,
3475 const char *time_str)
paul718e3742002-12-13 20:15:29 +00003476{
paul718e3742002-12-13 20:15:29 +00003477 struct peer *peer;
3478 u_int32_t connect;
3479
Daniel Walton0d7435f2015-10-22 11:35:20 +03003480 peer = peer_and_group_lookup_vty (vty, ip_str);
paul718e3742002-12-13 20:15:29 +00003481 if (! peer)
3482 return CMD_WARNING;
3483
3484 VTY_GET_INTEGER_RANGE ("Connect time", connect, time_str, 0, 65535);
3485
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003486 return bgp_vty_return (vty, peer_timers_connect_set (peer, connect));
paul718e3742002-12-13 20:15:29 +00003487}
3488
paul94f2b392005-06-28 12:44:16 +00003489static int
paulfd79ac92004-10-13 05:06:08 +00003490peer_timers_connect_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00003491{
paul718e3742002-12-13 20:15:29 +00003492 struct peer *peer;
3493
3494 peer = peer_and_group_lookup_vty (vty, ip_str);
3495 if (! peer)
3496 return CMD_WARNING;
3497
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003498 return bgp_vty_return (vty, peer_timers_connect_unset (peer));
paul718e3742002-12-13 20:15:29 +00003499}
3500
3501DEFUN (neighbor_timers_connect,
3502 neighbor_timers_connect_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003503 NEIGHBOR_CMD2 "timers connect <1-65535>",
paul718e3742002-12-13 20:15:29 +00003504 NEIGHBOR_STR
Daniel Walton0d7435f2015-10-22 11:35:20 +03003505 NEIGHBOR_ADDR_STR2
paul718e3742002-12-13 20:15:29 +00003506 "BGP per neighbor timers\n"
3507 "BGP connect timer\n"
3508 "Connect timer\n")
3509{
3510 return peer_timers_connect_set_vty (vty, argv[0], argv[1]);
3511}
3512
3513DEFUN (no_neighbor_timers_connect,
3514 no_neighbor_timers_connect_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003515 NO_NEIGHBOR_CMD2 "timers connect",
paul718e3742002-12-13 20:15:29 +00003516 NO_STR
3517 NEIGHBOR_STR
Daniel Walton0d7435f2015-10-22 11:35:20 +03003518 NEIGHBOR_ADDR_STR2
paul718e3742002-12-13 20:15:29 +00003519 "BGP per neighbor timers\n"
3520 "BGP connect timer\n")
3521{
3522 return peer_timers_connect_unset_vty (vty, argv[0]);
3523}
3524
3525ALIAS (no_neighbor_timers_connect,
3526 no_neighbor_timers_connect_val_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003527 NO_NEIGHBOR_CMD2 "timers connect <1-65535>",
paul718e3742002-12-13 20:15:29 +00003528 NO_STR
3529 NEIGHBOR_STR
Daniel Walton0d7435f2015-10-22 11:35:20 +03003530 NEIGHBOR_ADDR_STR2
paul718e3742002-12-13 20:15:29 +00003531 "BGP per neighbor timers\n"
3532 "BGP connect timer\n"
3533 "Connect timer\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003534
paul94f2b392005-06-28 12:44:16 +00003535static int
paulfd79ac92004-10-13 05:06:08 +00003536peer_advertise_interval_vty (struct vty *vty, const char *ip_str,
3537 const char *time_str, int set)
paul718e3742002-12-13 20:15:29 +00003538{
3539 int ret;
3540 struct peer *peer;
3541 u_int32_t routeadv = 0;
3542
Daniel Walton0d7435f2015-10-22 11:35:20 +03003543 peer = peer_and_group_lookup_vty (vty, ip_str);
paul718e3742002-12-13 20:15:29 +00003544 if (! peer)
3545 return CMD_WARNING;
3546
3547 if (time_str)
3548 VTY_GET_INTEGER_RANGE ("advertise interval", routeadv, time_str, 0, 600);
3549
3550 if (set)
3551 ret = peer_advertise_interval_set (peer, routeadv);
3552 else
3553 ret = peer_advertise_interval_unset (peer);
3554
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003555 return bgp_vty_return (vty, ret);
paul718e3742002-12-13 20:15:29 +00003556}
3557
3558DEFUN (neighbor_advertise_interval,
3559 neighbor_advertise_interval_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003560 NEIGHBOR_CMD2 "advertisement-interval <0-600>",
paul718e3742002-12-13 20:15:29 +00003561 NEIGHBOR_STR
Daniel Walton0d7435f2015-10-22 11:35:20 +03003562 NEIGHBOR_ADDR_STR2
paul718e3742002-12-13 20:15:29 +00003563 "Minimum interval between sending BGP routing updates\n"
3564 "time in seconds\n")
3565{
3566 return peer_advertise_interval_vty (vty, argv[0], argv[1], 1);
3567}
3568
3569DEFUN (no_neighbor_advertise_interval,
3570 no_neighbor_advertise_interval_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003571 NO_NEIGHBOR_CMD2 "advertisement-interval",
paul718e3742002-12-13 20:15:29 +00003572 NO_STR
3573 NEIGHBOR_STR
Daniel Walton0d7435f2015-10-22 11:35:20 +03003574 NEIGHBOR_ADDR_STR2
paul718e3742002-12-13 20:15:29 +00003575 "Minimum interval between sending BGP routing updates\n")
3576{
3577 return peer_advertise_interval_vty (vty, argv[0], NULL, 0);
3578}
3579
3580ALIAS (no_neighbor_advertise_interval,
3581 no_neighbor_advertise_interval_val_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003582 NO_NEIGHBOR_CMD2 "advertisement-interval <0-600>",
paul718e3742002-12-13 20:15:29 +00003583 NO_STR
3584 NEIGHBOR_STR
Daniel Walton0d7435f2015-10-22 11:35:20 +03003585 NEIGHBOR_ADDR_STR2
paul718e3742002-12-13 20:15:29 +00003586 "Minimum interval between sending BGP routing updates\n"
3587 "time in seconds\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003588
paul718e3742002-12-13 20:15:29 +00003589/* neighbor interface */
paul94f2b392005-06-28 12:44:16 +00003590static int
paulfd79ac92004-10-13 05:06:08 +00003591peer_interface_vty (struct vty *vty, const char *ip_str, const char *str)
paul718e3742002-12-13 20:15:29 +00003592{
3593 int ret;
3594 struct peer *peer;
3595
3596 peer = peer_lookup_vty (vty, ip_str);
3597 if (! peer)
3598 return CMD_WARNING;
3599
3600 if (str)
3601 ret = peer_interface_set (peer, str);
3602 else
3603 ret = peer_interface_unset (peer);
3604
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003605 return bgp_vty_return (vty, ret);
paul718e3742002-12-13 20:15:29 +00003606}
3607
3608DEFUN (neighbor_interface,
3609 neighbor_interface_cmd,
3610 NEIGHBOR_CMD "interface WORD",
3611 NEIGHBOR_STR
3612 NEIGHBOR_ADDR_STR
3613 "Interface\n"
3614 "Interface name\n")
3615{
3616 return peer_interface_vty (vty, argv[0], argv[1]);
3617}
3618
3619DEFUN (no_neighbor_interface,
3620 no_neighbor_interface_cmd,
3621 NO_NEIGHBOR_CMD "interface WORD",
3622 NO_STR
3623 NEIGHBOR_STR
3624 NEIGHBOR_ADDR_STR
3625 "Interface\n"
3626 "Interface name\n")
3627{
3628 return peer_interface_vty (vty, argv[0], NULL);
3629}
David Lamparter6b0655a2014-06-04 06:53:35 +02003630
paul718e3742002-12-13 20:15:29 +00003631/* Set distribute list to the peer. */
paul94f2b392005-06-28 12:44:16 +00003632static int
paulfd79ac92004-10-13 05:06:08 +00003633peer_distribute_set_vty (struct vty *vty, const char *ip_str,
3634 afi_t afi, safi_t safi,
3635 const char *name_str, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003636{
3637 int ret;
3638 struct peer *peer;
3639 int direct = FILTER_IN;
3640
3641 peer = peer_and_group_lookup_vty (vty, ip_str);
3642 if (! peer)
3643 return CMD_WARNING;
3644
3645 /* Check filter direction. */
3646 if (strncmp (direct_str, "i", 1) == 0)
3647 direct = FILTER_IN;
3648 else if (strncmp (direct_str, "o", 1) == 0)
3649 direct = FILTER_OUT;
3650
3651 ret = peer_distribute_set (peer, afi, safi, direct, name_str);
3652
3653 return bgp_vty_return (vty, ret);
3654}
3655
paul94f2b392005-06-28 12:44:16 +00003656static int
paulfd79ac92004-10-13 05:06:08 +00003657peer_distribute_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
3658 safi_t safi, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003659{
3660 int ret;
3661 struct peer *peer;
3662 int direct = FILTER_IN;
3663
3664 peer = peer_and_group_lookup_vty (vty, ip_str);
3665 if (! peer)
3666 return CMD_WARNING;
3667
3668 /* Check filter direction. */
3669 if (strncmp (direct_str, "i", 1) == 0)
3670 direct = FILTER_IN;
3671 else if (strncmp (direct_str, "o", 1) == 0)
3672 direct = FILTER_OUT;
3673
3674 ret = peer_distribute_unset (peer, afi, safi, direct);
3675
3676 return bgp_vty_return (vty, ret);
3677}
3678
3679DEFUN (neighbor_distribute_list,
3680 neighbor_distribute_list_cmd,
3681 NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)",
3682 NEIGHBOR_STR
3683 NEIGHBOR_ADDR_STR2
3684 "Filter updates to/from this neighbor\n"
3685 "IP access-list number\n"
3686 "IP access-list number (expanded range)\n"
3687 "IP Access-list name\n"
3688 "Filter incoming updates\n"
3689 "Filter outgoing updates\n")
3690{
3691 return peer_distribute_set_vty (vty, argv[0], bgp_node_afi (vty),
3692 bgp_node_safi (vty), argv[1], argv[2]);
3693}
3694
3695DEFUN (no_neighbor_distribute_list,
3696 no_neighbor_distribute_list_cmd,
3697 NO_NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)",
3698 NO_STR
3699 NEIGHBOR_STR
3700 NEIGHBOR_ADDR_STR2
3701 "Filter updates to/from this neighbor\n"
3702 "IP access-list number\n"
3703 "IP access-list number (expanded range)\n"
3704 "IP Access-list name\n"
3705 "Filter incoming updates\n"
3706 "Filter outgoing updates\n")
3707{
3708 return peer_distribute_unset_vty (vty, argv[0], bgp_node_afi (vty),
3709 bgp_node_safi (vty), argv[2]);
3710}
David Lamparter6b0655a2014-06-04 06:53:35 +02003711
paul718e3742002-12-13 20:15:29 +00003712/* Set prefix list to the peer. */
paul94f2b392005-06-28 12:44:16 +00003713static int
paulfd79ac92004-10-13 05:06:08 +00003714peer_prefix_list_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
3715 safi_t safi, const char *name_str,
3716 const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003717{
3718 int ret;
3719 struct peer *peer;
3720 int direct = FILTER_IN;
3721
3722 peer = peer_and_group_lookup_vty (vty, ip_str);
3723 if (! peer)
3724 return CMD_WARNING;
3725
3726 /* Check filter direction. */
3727 if (strncmp (direct_str, "i", 1) == 0)
3728 direct = FILTER_IN;
3729 else if (strncmp (direct_str, "o", 1) == 0)
3730 direct = FILTER_OUT;
3731
3732 ret = peer_prefix_list_set (peer, afi, safi, direct, name_str);
3733
3734 return bgp_vty_return (vty, ret);
3735}
3736
paul94f2b392005-06-28 12:44:16 +00003737static int
paulfd79ac92004-10-13 05:06:08 +00003738peer_prefix_list_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
3739 safi_t safi, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003740{
3741 int ret;
3742 struct peer *peer;
3743 int direct = FILTER_IN;
3744
3745 peer = peer_and_group_lookup_vty (vty, ip_str);
3746 if (! peer)
3747 return CMD_WARNING;
3748
3749 /* Check filter direction. */
3750 if (strncmp (direct_str, "i", 1) == 0)
3751 direct = FILTER_IN;
3752 else if (strncmp (direct_str, "o", 1) == 0)
3753 direct = FILTER_OUT;
3754
3755 ret = peer_prefix_list_unset (peer, afi, safi, direct);
3756
3757 return bgp_vty_return (vty, ret);
3758}
3759
3760DEFUN (neighbor_prefix_list,
3761 neighbor_prefix_list_cmd,
3762 NEIGHBOR_CMD2 "prefix-list WORD (in|out)",
3763 NEIGHBOR_STR
3764 NEIGHBOR_ADDR_STR2
3765 "Filter updates to/from this neighbor\n"
3766 "Name of a prefix list\n"
3767 "Filter incoming updates\n"
3768 "Filter outgoing updates\n")
3769{
3770 return peer_prefix_list_set_vty (vty, argv[0], bgp_node_afi (vty),
3771 bgp_node_safi (vty), argv[1], argv[2]);
3772}
3773
3774DEFUN (no_neighbor_prefix_list,
3775 no_neighbor_prefix_list_cmd,
3776 NO_NEIGHBOR_CMD2 "prefix-list WORD (in|out)",
3777 NO_STR
3778 NEIGHBOR_STR
3779 NEIGHBOR_ADDR_STR2
3780 "Filter updates to/from this neighbor\n"
3781 "Name of a prefix list\n"
3782 "Filter incoming updates\n"
3783 "Filter outgoing updates\n")
3784{
3785 return peer_prefix_list_unset_vty (vty, argv[0], bgp_node_afi (vty),
3786 bgp_node_safi (vty), argv[2]);
3787}
David Lamparter6b0655a2014-06-04 06:53:35 +02003788
paul94f2b392005-06-28 12:44:16 +00003789static int
paulfd79ac92004-10-13 05:06:08 +00003790peer_aslist_set_vty (struct vty *vty, const char *ip_str,
3791 afi_t afi, safi_t safi,
3792 const char *name_str, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003793{
3794 int ret;
3795 struct peer *peer;
3796 int direct = FILTER_IN;
3797
3798 peer = peer_and_group_lookup_vty (vty, ip_str);
3799 if (! peer)
3800 return CMD_WARNING;
3801
3802 /* Check filter direction. */
3803 if (strncmp (direct_str, "i", 1) == 0)
3804 direct = FILTER_IN;
3805 else if (strncmp (direct_str, "o", 1) == 0)
3806 direct = FILTER_OUT;
3807
3808 ret = peer_aslist_set (peer, afi, safi, direct, name_str);
3809
3810 return bgp_vty_return (vty, ret);
3811}
3812
paul94f2b392005-06-28 12:44:16 +00003813static int
paulfd79ac92004-10-13 05:06:08 +00003814peer_aslist_unset_vty (struct vty *vty, const char *ip_str,
3815 afi_t afi, safi_t safi,
3816 const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003817{
3818 int ret;
3819 struct peer *peer;
3820 int direct = FILTER_IN;
3821
3822 peer = peer_and_group_lookup_vty (vty, ip_str);
3823 if (! peer)
3824 return CMD_WARNING;
3825
3826 /* Check filter direction. */
3827 if (strncmp (direct_str, "i", 1) == 0)
3828 direct = FILTER_IN;
3829 else if (strncmp (direct_str, "o", 1) == 0)
3830 direct = FILTER_OUT;
3831
3832 ret = peer_aslist_unset (peer, afi, safi, direct);
3833
3834 return bgp_vty_return (vty, ret);
3835}
3836
3837DEFUN (neighbor_filter_list,
3838 neighbor_filter_list_cmd,
3839 NEIGHBOR_CMD2 "filter-list WORD (in|out)",
3840 NEIGHBOR_STR
3841 NEIGHBOR_ADDR_STR2
3842 "Establish BGP filters\n"
3843 "AS path access-list name\n"
3844 "Filter incoming routes\n"
3845 "Filter outgoing routes\n")
3846{
3847 return peer_aslist_set_vty (vty, argv[0], bgp_node_afi (vty),
3848 bgp_node_safi (vty), argv[1], argv[2]);
3849}
3850
3851DEFUN (no_neighbor_filter_list,
3852 no_neighbor_filter_list_cmd,
3853 NO_NEIGHBOR_CMD2 "filter-list WORD (in|out)",
3854 NO_STR
3855 NEIGHBOR_STR
3856 NEIGHBOR_ADDR_STR2
3857 "Establish BGP filters\n"
3858 "AS path access-list name\n"
3859 "Filter incoming routes\n"
3860 "Filter outgoing routes\n")
3861{
3862 return peer_aslist_unset_vty (vty, argv[0], bgp_node_afi (vty),
3863 bgp_node_safi (vty), argv[2]);
3864}
David Lamparter6b0655a2014-06-04 06:53:35 +02003865
paul718e3742002-12-13 20:15:29 +00003866/* Set route-map to the peer. */
paul94f2b392005-06-28 12:44:16 +00003867static int
paulfd79ac92004-10-13 05:06:08 +00003868peer_route_map_set_vty (struct vty *vty, const char *ip_str,
3869 afi_t afi, safi_t safi,
3870 const char *name_str, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003871{
3872 int ret;
3873 struct peer *peer;
paulfee0f4c2004-09-13 05:12:46 +00003874 int direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003875
3876 peer = peer_and_group_lookup_vty (vty, ip_str);
3877 if (! peer)
3878 return CMD_WARNING;
3879
3880 /* Check filter direction. */
paulfee0f4c2004-09-13 05:12:46 +00003881 if (strncmp (direct_str, "in", 2) == 0)
3882 direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003883 else if (strncmp (direct_str, "o", 1) == 0)
paulfee0f4c2004-09-13 05:12:46 +00003884 direct = RMAP_OUT;
3885 else if (strncmp (direct_str, "im", 2) == 0)
3886 direct = RMAP_IMPORT;
3887 else if (strncmp (direct_str, "e", 1) == 0)
3888 direct = RMAP_EXPORT;
paul718e3742002-12-13 20:15:29 +00003889
3890 ret = peer_route_map_set (peer, afi, safi, direct, name_str);
3891
3892 return bgp_vty_return (vty, ret);
3893}
3894
paul94f2b392005-06-28 12:44:16 +00003895static int
paulfd79ac92004-10-13 05:06:08 +00003896peer_route_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
3897 safi_t safi, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003898{
3899 int ret;
3900 struct peer *peer;
paulfee0f4c2004-09-13 05:12:46 +00003901 int direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003902
3903 peer = peer_and_group_lookup_vty (vty, ip_str);
3904 if (! peer)
3905 return CMD_WARNING;
3906
3907 /* Check filter direction. */
paulfee0f4c2004-09-13 05:12:46 +00003908 if (strncmp (direct_str, "in", 2) == 0)
3909 direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003910 else if (strncmp (direct_str, "o", 1) == 0)
paulfee0f4c2004-09-13 05:12:46 +00003911 direct = RMAP_OUT;
3912 else if (strncmp (direct_str, "im", 2) == 0)
3913 direct = RMAP_IMPORT;
3914 else if (strncmp (direct_str, "e", 1) == 0)
3915 direct = RMAP_EXPORT;
paul718e3742002-12-13 20:15:29 +00003916
3917 ret = peer_route_map_unset (peer, afi, safi, direct);
3918
3919 return bgp_vty_return (vty, ret);
3920}
3921
3922DEFUN (neighbor_route_map,
3923 neighbor_route_map_cmd,
paulfee0f4c2004-09-13 05:12:46 +00003924 NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)",
paul718e3742002-12-13 20:15:29 +00003925 NEIGHBOR_STR
3926 NEIGHBOR_ADDR_STR2
3927 "Apply route map to neighbor\n"
3928 "Name of route map\n"
3929 "Apply map to incoming routes\n"
paulfee0f4c2004-09-13 05:12:46 +00003930 "Apply map to outbound routes\n"
3931 "Apply map to routes going into a Route-Server client's table\n"
3932 "Apply map to routes coming from a Route-Server client")
paul718e3742002-12-13 20:15:29 +00003933{
3934 return peer_route_map_set_vty (vty, argv[0], bgp_node_afi (vty),
3935 bgp_node_safi (vty), argv[1], argv[2]);
3936}
3937
3938DEFUN (no_neighbor_route_map,
3939 no_neighbor_route_map_cmd,
paulfee0f4c2004-09-13 05:12:46 +00003940 NO_NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)",
paul718e3742002-12-13 20:15:29 +00003941 NO_STR
3942 NEIGHBOR_STR
3943 NEIGHBOR_ADDR_STR2
3944 "Apply route map to neighbor\n"
3945 "Name of route map\n"
3946 "Apply map to incoming routes\n"
paulfee0f4c2004-09-13 05:12:46 +00003947 "Apply map to outbound routes\n"
3948 "Apply map to routes going into a Route-Server client's table\n"
3949 "Apply map to routes coming from a Route-Server client")
paul718e3742002-12-13 20:15:29 +00003950{
3951 return peer_route_map_unset_vty (vty, argv[0], bgp_node_afi (vty),
3952 bgp_node_safi (vty), argv[2]);
3953}
David Lamparter6b0655a2014-06-04 06:53:35 +02003954
paul718e3742002-12-13 20:15:29 +00003955/* Set unsuppress-map to the peer. */
paul94f2b392005-06-28 12:44:16 +00003956static int
paulfd79ac92004-10-13 05:06:08 +00003957peer_unsuppress_map_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
3958 safi_t safi, const char *name_str)
paul718e3742002-12-13 20:15:29 +00003959{
3960 int ret;
3961 struct peer *peer;
3962
3963 peer = peer_and_group_lookup_vty (vty, ip_str);
3964 if (! peer)
3965 return CMD_WARNING;
3966
3967 ret = peer_unsuppress_map_set (peer, afi, safi, name_str);
3968
3969 return bgp_vty_return (vty, ret);
3970}
3971
3972/* Unset route-map from the peer. */
paul94f2b392005-06-28 12:44:16 +00003973static int
paulfd79ac92004-10-13 05:06:08 +00003974peer_unsuppress_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
paul718e3742002-12-13 20:15:29 +00003975 safi_t safi)
3976{
3977 int ret;
3978 struct peer *peer;
3979
3980 peer = peer_and_group_lookup_vty (vty, ip_str);
3981 if (! peer)
3982 return CMD_WARNING;
3983
3984 ret = peer_unsuppress_map_unset (peer, afi, safi);
3985
3986 return bgp_vty_return (vty, ret);
3987}
3988
3989DEFUN (neighbor_unsuppress_map,
3990 neighbor_unsuppress_map_cmd,
3991 NEIGHBOR_CMD2 "unsuppress-map WORD",
3992 NEIGHBOR_STR
3993 NEIGHBOR_ADDR_STR2
3994 "Route-map to selectively unsuppress suppressed routes\n"
3995 "Name of route map\n")
3996{
3997 return peer_unsuppress_map_set_vty (vty, argv[0], bgp_node_afi (vty),
3998 bgp_node_safi (vty), argv[1]);
3999}
4000
4001DEFUN (no_neighbor_unsuppress_map,
4002 no_neighbor_unsuppress_map_cmd,
4003 NO_NEIGHBOR_CMD2 "unsuppress-map WORD",
4004 NO_STR
4005 NEIGHBOR_STR
4006 NEIGHBOR_ADDR_STR2
4007 "Route-map to selectively unsuppress suppressed routes\n"
4008 "Name of route map\n")
4009{
4010 return peer_unsuppress_map_unset_vty (vty, argv[0], bgp_node_afi (vty),
4011 bgp_node_safi (vty));
4012}
David Lamparter6b0655a2014-06-04 06:53:35 +02004013
paul94f2b392005-06-28 12:44:16 +00004014static int
paulfd79ac92004-10-13 05:06:08 +00004015peer_maximum_prefix_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
4016 safi_t safi, const char *num_str,
hasso0a486e52005-02-01 20:57:17 +00004017 const char *threshold_str, int warning,
4018 const char *restart_str)
paul718e3742002-12-13 20:15:29 +00004019{
4020 int ret;
4021 struct peer *peer;
4022 u_int32_t max;
hassoe0701b72004-05-20 09:19:34 +00004023 u_char threshold;
hasso0a486e52005-02-01 20:57:17 +00004024 u_int16_t restart;
paul718e3742002-12-13 20:15:29 +00004025
4026 peer = peer_and_group_lookup_vty (vty, ip_str);
4027 if (! peer)
4028 return CMD_WARNING;
4029
Denis Ovsienkoe6ec1c32011-09-10 21:50:53 +04004030 VTY_GET_INTEGER ("maximum number", max, num_str);
hassoe0701b72004-05-20 09:19:34 +00004031 if (threshold_str)
4032 threshold = atoi (threshold_str);
4033 else
4034 threshold = MAXIMUM_PREFIX_THRESHOLD_DEFAULT;
paul718e3742002-12-13 20:15:29 +00004035
hasso0a486e52005-02-01 20:57:17 +00004036 if (restart_str)
4037 restart = atoi (restart_str);
4038 else
4039 restart = 0;
4040
4041 ret = peer_maximum_prefix_set (peer, afi, safi, max, threshold, warning, restart);
paul718e3742002-12-13 20:15:29 +00004042
4043 return bgp_vty_return (vty, ret);
4044}
4045
paul94f2b392005-06-28 12:44:16 +00004046static int
paulfd79ac92004-10-13 05:06:08 +00004047peer_maximum_prefix_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
paul718e3742002-12-13 20:15:29 +00004048 safi_t safi)
4049{
4050 int ret;
4051 struct peer *peer;
4052
4053 peer = peer_and_group_lookup_vty (vty, ip_str);
4054 if (! peer)
4055 return CMD_WARNING;
4056
4057 ret = peer_maximum_prefix_unset (peer, afi, safi);
4058
4059 return bgp_vty_return (vty, ret);
4060}
4061
4062/* Maximum number of prefix configuration. prefix count is different
4063 for each peer configuration. So this configuration can be set for
4064 each peer configuration. */
4065DEFUN (neighbor_maximum_prefix,
4066 neighbor_maximum_prefix_cmd,
4067 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>",
4068 NEIGHBOR_STR
4069 NEIGHBOR_ADDR_STR2
4070 "Maximum number of prefix accept from this peer\n"
4071 "maximum no. of prefix limit\n")
4072{
4073 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00004074 bgp_node_safi (vty), argv[1], NULL, 0,
4075 NULL);
paul718e3742002-12-13 20:15:29 +00004076}
4077
hassoe0701b72004-05-20 09:19:34 +00004078DEFUN (neighbor_maximum_prefix_threshold,
4079 neighbor_maximum_prefix_threshold_cmd,
4080 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100>",
4081 NEIGHBOR_STR
4082 NEIGHBOR_ADDR_STR2
4083 "Maximum number of prefix accept from this peer\n"
4084 "maximum no. of prefix limit\n"
4085 "Threshold value (%) at which to generate a warning msg\n")
4086{
4087 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00004088 bgp_node_safi (vty), argv[1], argv[2], 0,
4089 NULL);
4090}
hassoe0701b72004-05-20 09:19:34 +00004091
paul718e3742002-12-13 20:15:29 +00004092DEFUN (neighbor_maximum_prefix_warning,
4093 neighbor_maximum_prefix_warning_cmd,
4094 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
4095 NEIGHBOR_STR
4096 NEIGHBOR_ADDR_STR2
4097 "Maximum number of prefix accept from this peer\n"
4098 "maximum no. of prefix limit\n"
4099 "Only give warning message when limit is exceeded\n")
4100{
4101 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00004102 bgp_node_safi (vty), argv[1], NULL, 1,
4103 NULL);
paul718e3742002-12-13 20:15:29 +00004104}
4105
hassoe0701b72004-05-20 09:19:34 +00004106DEFUN (neighbor_maximum_prefix_threshold_warning,
4107 neighbor_maximum_prefix_threshold_warning_cmd,
4108 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only",
4109 NEIGHBOR_STR
4110 NEIGHBOR_ADDR_STR2
4111 "Maximum number of prefix accept from this peer\n"
4112 "maximum no. of prefix limit\n"
4113 "Threshold value (%) at which to generate a warning msg\n"
4114 "Only give warning message when limit is exceeded\n")
4115{
4116 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00004117 bgp_node_safi (vty), argv[1], argv[2], 1, NULL);
4118}
4119
4120DEFUN (neighbor_maximum_prefix_restart,
4121 neighbor_maximum_prefix_restart_cmd,
4122 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>",
4123 NEIGHBOR_STR
4124 NEIGHBOR_ADDR_STR2
4125 "Maximum number of prefix accept from this peer\n"
4126 "maximum no. of prefix limit\n"
4127 "Restart bgp connection after limit is exceeded\n"
4128 "Restart interval in minutes")
4129{
4130 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
4131 bgp_node_safi (vty), argv[1], NULL, 0, argv[2]);
4132}
4133
4134DEFUN (neighbor_maximum_prefix_threshold_restart,
4135 neighbor_maximum_prefix_threshold_restart_cmd,
4136 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>",
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 "Restart bgp connection after limit is exceeded\n"
4143 "Restart interval in minutes")
4144{
4145 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
4146 bgp_node_safi (vty), argv[1], argv[2], 0, argv[3]);
4147}
hassoe0701b72004-05-20 09:19:34 +00004148
paul718e3742002-12-13 20:15:29 +00004149DEFUN (no_neighbor_maximum_prefix,
4150 no_neighbor_maximum_prefix_cmd,
4151 NO_NEIGHBOR_CMD2 "maximum-prefix",
4152 NO_STR
4153 NEIGHBOR_STR
4154 NEIGHBOR_ADDR_STR2
4155 "Maximum number of prefix accept from this peer\n")
4156{
4157 return peer_maximum_prefix_unset_vty (vty, argv[0], bgp_node_afi (vty),
4158 bgp_node_safi (vty));
4159}
4160
4161ALIAS (no_neighbor_maximum_prefix,
4162 no_neighbor_maximum_prefix_val_cmd,
4163 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>",
4164 NO_STR
4165 NEIGHBOR_STR
4166 NEIGHBOR_ADDR_STR2
4167 "Maximum number of prefix accept from this peer\n"
4168 "maximum no. of prefix limit\n")
4169
4170ALIAS (no_neighbor_maximum_prefix,
hasso0a486e52005-02-01 20:57:17 +00004171 no_neighbor_maximum_prefix_threshold_cmd,
4172 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
4173 NO_STR
4174 NEIGHBOR_STR
4175 NEIGHBOR_ADDR_STR2
4176 "Maximum number of prefix accept from this peer\n"
4177 "maximum no. of prefix limit\n"
4178 "Threshold value (%) at which to generate a warning msg\n")
4179
4180ALIAS (no_neighbor_maximum_prefix,
4181 no_neighbor_maximum_prefix_warning_cmd,
4182 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
4183 NO_STR
4184 NEIGHBOR_STR
4185 NEIGHBOR_ADDR_STR2
4186 "Maximum number of prefix accept from this peer\n"
4187 "maximum no. of prefix limit\n"
paule8e19462006-01-19 20:16:55 +00004188 "Only give warning message when limit is exceeded\n")
hasso0a486e52005-02-01 20:57:17 +00004189
4190ALIAS (no_neighbor_maximum_prefix,
4191 no_neighbor_maximum_prefix_threshold_warning_cmd,
hassoe0701b72004-05-20 09:19:34 +00004192 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only",
4193 NO_STR
4194 NEIGHBOR_STR
4195 NEIGHBOR_ADDR_STR2
4196 "Maximum number of prefix accept from this peer\n"
4197 "maximum no. of prefix limit\n"
4198 "Threshold value (%) at which to generate a warning msg\n"
paule8e19462006-01-19 20:16:55 +00004199 "Only give warning message when limit is exceeded\n")
hassoe0701b72004-05-20 09:19:34 +00004200
4201ALIAS (no_neighbor_maximum_prefix,
hasso0a486e52005-02-01 20:57:17 +00004202 no_neighbor_maximum_prefix_restart_cmd,
4203 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>",
paul718e3742002-12-13 20:15:29 +00004204 NO_STR
4205 NEIGHBOR_STR
4206 NEIGHBOR_ADDR_STR2
4207 "Maximum number of prefix accept from this peer\n"
4208 "maximum no. of prefix limit\n"
hasso0a486e52005-02-01 20:57:17 +00004209 "Restart bgp connection after limit is exceeded\n"
4210 "Restart interval in minutes")
4211
4212ALIAS (no_neighbor_maximum_prefix,
4213 no_neighbor_maximum_prefix_threshold_restart_cmd,
4214 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>",
4215 NO_STR
4216 NEIGHBOR_STR
4217 NEIGHBOR_ADDR_STR2
4218 "Maximum number of prefix accept from this peer\n"
4219 "maximum no. of prefix limit\n"
4220 "Threshold value (%) at which to generate a warning msg\n"
4221 "Restart bgp connection after limit is exceeded\n"
4222 "Restart interval in minutes")
David Lamparter6b0655a2014-06-04 06:53:35 +02004223
paul718e3742002-12-13 20:15:29 +00004224/* "neighbor allowas-in" */
4225DEFUN (neighbor_allowas_in,
4226 neighbor_allowas_in_cmd,
4227 NEIGHBOR_CMD2 "allowas-in",
4228 NEIGHBOR_STR
4229 NEIGHBOR_ADDR_STR2
4230 "Accept as-path with my AS present in it\n")
4231{
4232 int ret;
4233 struct peer *peer;
paulfd79ac92004-10-13 05:06:08 +00004234 unsigned int allow_num;
paul718e3742002-12-13 20:15:29 +00004235
4236 peer = peer_and_group_lookup_vty (vty, argv[0]);
4237 if (! peer)
4238 return CMD_WARNING;
4239
4240 if (argc == 1)
4241 allow_num = 3;
4242 else
4243 VTY_GET_INTEGER_RANGE ("AS number", allow_num, argv[1], 1, 10);
4244
4245 ret = peer_allowas_in_set (peer, bgp_node_afi (vty), bgp_node_safi (vty),
4246 allow_num);
4247
4248 return bgp_vty_return (vty, ret);
4249}
4250
4251ALIAS (neighbor_allowas_in,
4252 neighbor_allowas_in_arg_cmd,
4253 NEIGHBOR_CMD2 "allowas-in <1-10>",
4254 NEIGHBOR_STR
4255 NEIGHBOR_ADDR_STR2
4256 "Accept as-path with my AS present in it\n"
4257 "Number of occurances of AS number\n")
4258
4259DEFUN (no_neighbor_allowas_in,
4260 no_neighbor_allowas_in_cmd,
4261 NO_NEIGHBOR_CMD2 "allowas-in",
4262 NO_STR
4263 NEIGHBOR_STR
4264 NEIGHBOR_ADDR_STR2
4265 "allow local ASN appears in aspath attribute\n")
4266{
4267 int ret;
4268 struct peer *peer;
4269
4270 peer = peer_and_group_lookup_vty (vty, argv[0]);
4271 if (! peer)
4272 return CMD_WARNING;
4273
4274 ret = peer_allowas_in_unset (peer, bgp_node_afi (vty), bgp_node_safi (vty));
4275
4276 return bgp_vty_return (vty, ret);
4277}
David Lamparter6b0655a2014-06-04 06:53:35 +02004278
Nick Hilliardfa411a22011-03-23 15:33:17 +00004279DEFUN (neighbor_ttl_security,
4280 neighbor_ttl_security_cmd,
4281 NEIGHBOR_CMD2 "ttl-security hops <1-254>",
4282 NEIGHBOR_STR
4283 NEIGHBOR_ADDR_STR2
4284 "Specify the maximum number of hops to the BGP peer\n")
4285{
4286 struct peer *peer;
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00004287 int gtsm_hops;
Nick Hilliardfa411a22011-03-23 15:33:17 +00004288
4289 peer = peer_and_group_lookup_vty (vty, argv[0]);
4290 if (! peer)
4291 return CMD_WARNING;
4292
4293 VTY_GET_INTEGER_RANGE ("", gtsm_hops, argv[1], 1, 254);
4294
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00004295 return bgp_vty_return (vty, peer_ttl_security_hops_set (peer, gtsm_hops));
Nick Hilliardfa411a22011-03-23 15:33:17 +00004296}
4297
4298DEFUN (no_neighbor_ttl_security,
4299 no_neighbor_ttl_security_cmd,
4300 NO_NEIGHBOR_CMD2 "ttl-security hops <1-254>",
4301 NO_STR
4302 NEIGHBOR_STR
4303 NEIGHBOR_ADDR_STR2
4304 "Specify the maximum number of hops to the BGP peer\n")
4305{
4306 struct peer *peer;
Nick Hilliardfa411a22011-03-23 15:33:17 +00004307
4308 peer = peer_and_group_lookup_vty (vty, argv[0]);
4309 if (! peer)
4310 return CMD_WARNING;
4311
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00004312 return bgp_vty_return (vty, peer_ttl_security_hops_unset (peer));
Nick Hilliardfa411a22011-03-23 15:33:17 +00004313}
David Lamparter6b0655a2014-06-04 06:53:35 +02004314
paul718e3742002-12-13 20:15:29 +00004315/* Address family configuration. */
4316DEFUN (address_family_ipv4,
4317 address_family_ipv4_cmd,
4318 "address-family ipv4",
4319 "Enter Address Family command mode\n"
4320 "Address family\n")
4321{
4322 vty->node = BGP_IPV4_NODE;
4323 return CMD_SUCCESS;
4324}
4325
4326DEFUN (address_family_ipv4_safi,
4327 address_family_ipv4_safi_cmd,
4328 "address-family ipv4 (unicast|multicast)",
4329 "Enter Address Family command mode\n"
4330 "Address family\n"
4331 "Address Family modifier\n"
4332 "Address Family modifier\n")
4333{
4334 if (strncmp (argv[0], "m", 1) == 0)
4335 vty->node = BGP_IPV4M_NODE;
4336 else
4337 vty->node = BGP_IPV4_NODE;
4338
4339 return CMD_SUCCESS;
4340}
4341
paul25ffbdc2005-08-22 22:42:08 +00004342DEFUN (address_family_ipv6,
4343 address_family_ipv6_cmd,
4344 "address-family ipv6",
paul718e3742002-12-13 20:15:29 +00004345 "Enter Address Family command mode\n"
paul25ffbdc2005-08-22 22:42:08 +00004346 "Address family\n")
paul718e3742002-12-13 20:15:29 +00004347{
4348 vty->node = BGP_IPV6_NODE;
4349 return CMD_SUCCESS;
4350}
4351
paul25ffbdc2005-08-22 22:42:08 +00004352DEFUN (address_family_ipv6_safi,
4353 address_family_ipv6_safi_cmd,
4354 "address-family ipv6 (unicast|multicast)",
paul718e3742002-12-13 20:15:29 +00004355 "Enter Address Family command mode\n"
paul25ffbdc2005-08-22 22:42:08 +00004356 "Address family\n"
4357 "Address Family modifier\n"
4358 "Address Family modifier\n")
4359{
4360 if (strncmp (argv[0], "m", 1) == 0)
4361 vty->node = BGP_IPV6M_NODE;
4362 else
4363 vty->node = BGP_IPV6_NODE;
4364
4365 return CMD_SUCCESS;
4366}
paul718e3742002-12-13 20:15:29 +00004367
4368DEFUN (address_family_vpnv4,
4369 address_family_vpnv4_cmd,
4370 "address-family vpnv4",
4371 "Enter Address Family command mode\n"
4372 "Address family\n")
4373{
4374 vty->node = BGP_VPNV4_NODE;
4375 return CMD_SUCCESS;
4376}
4377
4378ALIAS (address_family_vpnv4,
4379 address_family_vpnv4_unicast_cmd,
4380 "address-family vpnv4 unicast",
4381 "Enter Address Family command mode\n"
4382 "Address family\n"
4383 "Address Family Modifier\n")
4384
Lou Berger13c378d2016-01-12 13:41:56 -05004385DEFUN (address_family_vpnv6,
4386 address_family_vpnv6_cmd,
4387 "address-family vpnv6",
4388 "Enter Address Family command mode\n"
4389 "Address family\n")
4390{
4391 vty->node = BGP_VPNV6_NODE;
4392 return CMD_SUCCESS;
4393}
4394
4395ALIAS (address_family_vpnv6,
4396 address_family_vpnv6_unicast_cmd,
4397 "address-family vpnv6 unicast",
4398 "Enter Address Family command mode\n"
4399 "Address family\n"
4400 "Address Family Modifier\n")
4401
Lou Bergera3fda882016-01-12 13:42:04 -05004402DEFUN (address_family_encap,
4403 address_family_encap_cmd,
4404 "address-family encap",
4405 "Enter Address Family command mode\n"
4406 "Address family\n")
4407{
4408 vty->node = BGP_ENCAP_NODE;
4409 return CMD_SUCCESS;
4410}
4411
4412ALIAS (address_family_encap,
4413 address_family_encapv4_cmd,
4414 "address-family encapv4",
4415 "Enter Address Family command mode\n"
4416 "Address family\n")
4417
4418DEFUN (address_family_encapv6,
4419 address_family_encapv6_cmd,
4420 "address-family encapv6",
4421 "Enter Address Family command mode\n"
4422 "Address family\n")
4423{
4424 vty->node = BGP_ENCAPV6_NODE;
4425 return CMD_SUCCESS;
4426}
4427
paul718e3742002-12-13 20:15:29 +00004428DEFUN (exit_address_family,
4429 exit_address_family_cmd,
4430 "exit-address-family",
4431 "Exit from Address Family configuration mode\n")
4432{
Lou Bergera3fda882016-01-12 13:42:04 -05004433 /* should match list in command.c:config_exit */
hassoa8a80d52005-04-09 13:07:47 +00004434 if (vty->node == BGP_IPV4_NODE
Lou Bergera3fda882016-01-12 13:42:04 -05004435 || vty->node == BGP_ENCAP_NODE
4436 || vty->node == BGP_ENCAPV6_NODE
hassoa8a80d52005-04-09 13:07:47 +00004437 || vty->node == BGP_IPV4M_NODE
paul718e3742002-12-13 20:15:29 +00004438 || vty->node == BGP_VPNV4_NODE
Lou Berger13c378d2016-01-12 13:41:56 -05004439 || vty->node == BGP_VPNV6_NODE
paul25ffbdc2005-08-22 22:42:08 +00004440 || vty->node == BGP_IPV6_NODE
4441 || vty->node == BGP_IPV6M_NODE)
paul718e3742002-12-13 20:15:29 +00004442 vty->node = BGP_NODE;
4443 return CMD_SUCCESS;
4444}
David Lamparter6b0655a2014-06-04 06:53:35 +02004445
paul718e3742002-12-13 20:15:29 +00004446/* BGP clear sort. */
4447enum clear_sort
4448{
4449 clear_all,
4450 clear_peer,
4451 clear_group,
4452 clear_external,
4453 clear_as
4454};
4455
paul94f2b392005-06-28 12:44:16 +00004456static void
paul718e3742002-12-13 20:15:29 +00004457bgp_clear_vty_error (struct vty *vty, struct peer *peer, afi_t afi,
4458 safi_t safi, int error)
4459{
4460 switch (error)
4461 {
4462 case BGP_ERR_AF_UNCONFIGURED:
4463 vty_out (vty,
4464 "%%BGP: Enable %s %s address family for the neighbor %s%s",
4465 afi == AFI_IP6 ? "IPv6" : safi == SAFI_MPLS_VPN ? "VPNv4" : "IPv4",
4466 safi == SAFI_MULTICAST ? "Multicast" : "Unicast",
4467 peer->host, VTY_NEWLINE);
4468 break;
4469 case BGP_ERR_SOFT_RECONFIG_UNCONFIGURED:
4470 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);
4471 break;
4472 default:
4473 break;
4474 }
4475}
4476
4477/* `clear ip bgp' functions. */
paul94f2b392005-06-28 12:44:16 +00004478static int
paul718e3742002-12-13 20:15:29 +00004479bgp_clear (struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi,
paulfd79ac92004-10-13 05:06:08 +00004480 enum clear_sort sort,enum bgp_clear_type stype, const char *arg)
paul718e3742002-12-13 20:15:29 +00004481{
4482 int ret;
4483 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00004484 struct listnode *node, *nnode;
paul718e3742002-12-13 20:15:29 +00004485
4486 /* Clear all neighbors. */
4487 if (sort == clear_all)
4488 {
paul1eb8ef22005-04-07 07:30:20 +00004489 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004490 {
4491 if (stype == BGP_CLEAR_SOFT_NONE)
4492 ret = peer_clear (peer);
4493 else
4494 ret = peer_clear_soft (peer, afi, safi, stype);
4495
4496 if (ret < 0)
4497 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4498 }
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004499 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004500 }
4501
4502 /* Clear specified neighbors. */
4503 if (sort == clear_peer)
4504 {
4505 union sockunion su;
4506 int ret;
4507
4508 /* Make sockunion for lookup. */
4509 ret = str2sockunion (arg, &su);
4510 if (ret < 0)
4511 {
4512 vty_out (vty, "Malformed address: %s%s", arg, VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004513 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00004514 }
4515 peer = peer_lookup (bgp, &su);
4516 if (! peer)
4517 {
4518 vty_out (vty, "%%BGP: Unknown neighbor - \"%s\"%s", arg, VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004519 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00004520 }
4521
4522 if (stype == BGP_CLEAR_SOFT_NONE)
4523 ret = peer_clear (peer);
4524 else
4525 ret = peer_clear_soft (peer, afi, safi, stype);
4526
4527 if (ret < 0)
4528 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4529
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004530 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004531 }
4532
4533 /* Clear all peer-group members. */
4534 if (sort == clear_group)
4535 {
4536 struct peer_group *group;
4537
4538 group = peer_group_lookup (bgp, arg);
4539 if (! group)
4540 {
4541 vty_out (vty, "%%BGP: No such peer-group %s%s", arg, VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004542 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00004543 }
4544
paul1eb8ef22005-04-07 07:30:20 +00004545 for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004546 {
4547 if (stype == BGP_CLEAR_SOFT_NONE)
4548 {
4549 ret = peer_clear (peer);
4550 continue;
4551 }
4552
4553 if (! peer->af_group[afi][safi])
4554 continue;
4555
4556 ret = peer_clear_soft (peer, afi, safi, stype);
4557
4558 if (ret < 0)
4559 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4560 }
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004561 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004562 }
4563
4564 if (sort == clear_external)
4565 {
paul1eb8ef22005-04-07 07:30:20 +00004566 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004567 {
Jorge Boncompte [DTI2]6d85b152012-05-07 16:52:54 +00004568 if (peer->sort == BGP_PEER_IBGP)
paul718e3742002-12-13 20:15:29 +00004569 continue;
4570
4571 if (stype == BGP_CLEAR_SOFT_NONE)
4572 ret = peer_clear (peer);
4573 else
4574 ret = peer_clear_soft (peer, afi, safi, stype);
4575
4576 if (ret < 0)
4577 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4578 }
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004579 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004580 }
4581
4582 if (sort == clear_as)
4583 {
4584 as_t as;
paul718e3742002-12-13 20:15:29 +00004585 int find = 0;
4586
Ulrich Weberbde12e32011-11-16 19:32:12 +04004587 VTY_GET_INTEGER_RANGE ("AS", as, arg, 1, BGP_AS4_MAX);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004588
paul1eb8ef22005-04-07 07:30:20 +00004589 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004590 {
4591 if (peer->as != as)
4592 continue;
4593
4594 find = 1;
4595 if (stype == BGP_CLEAR_SOFT_NONE)
4596 ret = peer_clear (peer);
4597 else
4598 ret = peer_clear_soft (peer, afi, safi, stype);
4599
4600 if (ret < 0)
4601 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4602 }
4603 if (! find)
4604 vty_out (vty, "%%BGP: No peer is configured with AS %s%s", arg,
4605 VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004606 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004607 }
4608
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004609 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004610}
4611
paul94f2b392005-06-28 12:44:16 +00004612static int
paulfd79ac92004-10-13 05:06:08 +00004613bgp_clear_vty (struct vty *vty, const char *name, afi_t afi, safi_t safi,
4614 enum clear_sort sort, enum bgp_clear_type stype,
4615 const char *arg)
paul718e3742002-12-13 20:15:29 +00004616{
paul718e3742002-12-13 20:15:29 +00004617 struct bgp *bgp;
4618
4619 /* BGP structure lookup. */
4620 if (name)
4621 {
4622 bgp = bgp_lookup_by_name (name);
4623 if (bgp == NULL)
4624 {
4625 vty_out (vty, "Can't find BGP view %s%s", name, VTY_NEWLINE);
4626 return CMD_WARNING;
4627 }
4628 }
4629 else
4630 {
4631 bgp = bgp_get_default ();
4632 if (bgp == NULL)
4633 {
4634 vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE);
4635 return CMD_WARNING;
4636 }
4637 }
4638
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004639 return bgp_clear (vty, bgp, afi, safi, sort, stype, arg);
paul718e3742002-12-13 20:15:29 +00004640}
4641
4642DEFUN (clear_ip_bgp_all,
4643 clear_ip_bgp_all_cmd,
4644 "clear ip bgp *",
4645 CLEAR_STR
4646 IP_STR
4647 BGP_STR
4648 "Clear all peers\n")
4649{
4650 if (argc == 1)
4651 return bgp_clear_vty (vty, argv[0], 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL);
4652
4653 return bgp_clear_vty (vty, NULL, 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL);
4654}
4655
4656ALIAS (clear_ip_bgp_all,
4657 clear_bgp_all_cmd,
4658 "clear bgp *",
4659 CLEAR_STR
4660 BGP_STR
4661 "Clear all peers\n")
4662
4663ALIAS (clear_ip_bgp_all,
4664 clear_bgp_ipv6_all_cmd,
4665 "clear bgp ipv6 *",
4666 CLEAR_STR
4667 BGP_STR
4668 "Address family\n"
4669 "Clear all peers\n")
4670
4671ALIAS (clear_ip_bgp_all,
4672 clear_ip_bgp_instance_all_cmd,
4673 "clear ip bgp view WORD *",
4674 CLEAR_STR
4675 IP_STR
4676 BGP_STR
4677 "BGP view\n"
4678 "view name\n"
4679 "Clear all peers\n")
4680
4681ALIAS (clear_ip_bgp_all,
4682 clear_bgp_instance_all_cmd,
4683 "clear bgp view WORD *",
4684 CLEAR_STR
4685 BGP_STR
4686 "BGP view\n"
4687 "view name\n"
4688 "Clear all peers\n")
4689
4690DEFUN (clear_ip_bgp_peer,
4691 clear_ip_bgp_peer_cmd,
4692 "clear ip bgp (A.B.C.D|X:X::X:X)",
4693 CLEAR_STR
4694 IP_STR
4695 BGP_STR
4696 "BGP neighbor IP address to clear\n"
4697 "BGP IPv6 neighbor to clear\n")
4698{
4699 return bgp_clear_vty (vty, NULL, 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[0]);
4700}
4701
4702ALIAS (clear_ip_bgp_peer,
4703 clear_bgp_peer_cmd,
4704 "clear bgp (A.B.C.D|X:X::X:X)",
4705 CLEAR_STR
4706 BGP_STR
4707 "BGP neighbor address to clear\n"
4708 "BGP IPv6 neighbor to clear\n")
4709
4710ALIAS (clear_ip_bgp_peer,
4711 clear_bgp_ipv6_peer_cmd,
4712 "clear bgp ipv6 (A.B.C.D|X:X::X:X)",
4713 CLEAR_STR
4714 BGP_STR
4715 "Address family\n"
4716 "BGP neighbor address to clear\n"
4717 "BGP IPv6 neighbor to clear\n")
4718
4719DEFUN (clear_ip_bgp_peer_group,
4720 clear_ip_bgp_peer_group_cmd,
4721 "clear ip bgp peer-group WORD",
4722 CLEAR_STR
4723 IP_STR
4724 BGP_STR
4725 "Clear all members of peer-group\n"
4726 "BGP peer-group name\n")
4727{
4728 return bgp_clear_vty (vty, NULL, 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[0]);
4729}
4730
4731ALIAS (clear_ip_bgp_peer_group,
4732 clear_bgp_peer_group_cmd,
4733 "clear bgp peer-group WORD",
4734 CLEAR_STR
4735 BGP_STR
4736 "Clear all members of peer-group\n"
4737 "BGP peer-group name\n")
4738
4739ALIAS (clear_ip_bgp_peer_group,
4740 clear_bgp_ipv6_peer_group_cmd,
4741 "clear bgp ipv6 peer-group WORD",
4742 CLEAR_STR
4743 BGP_STR
4744 "Address family\n"
4745 "Clear all members of peer-group\n"
4746 "BGP peer-group name\n")
4747
4748DEFUN (clear_ip_bgp_external,
4749 clear_ip_bgp_external_cmd,
4750 "clear ip bgp external",
4751 CLEAR_STR
4752 IP_STR
4753 BGP_STR
4754 "Clear all external peers\n")
4755{
4756 return bgp_clear_vty (vty, NULL, 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL);
4757}
4758
4759ALIAS (clear_ip_bgp_external,
4760 clear_bgp_external_cmd,
4761 "clear bgp external",
4762 CLEAR_STR
4763 BGP_STR
4764 "Clear all external peers\n")
4765
4766ALIAS (clear_ip_bgp_external,
4767 clear_bgp_ipv6_external_cmd,
4768 "clear bgp ipv6 external",
4769 CLEAR_STR
4770 BGP_STR
4771 "Address family\n"
4772 "Clear all external peers\n")
4773
4774DEFUN (clear_ip_bgp_as,
4775 clear_ip_bgp_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00004776 "clear ip bgp " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00004777 CLEAR_STR
4778 IP_STR
4779 BGP_STR
4780 "Clear peers with the AS number\n")
4781{
4782 return bgp_clear_vty (vty, NULL, 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[0]);
4783}
4784
4785ALIAS (clear_ip_bgp_as,
4786 clear_bgp_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00004787 "clear bgp " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00004788 CLEAR_STR
4789 BGP_STR
4790 "Clear peers with the AS number\n")
4791
4792ALIAS (clear_ip_bgp_as,
4793 clear_bgp_ipv6_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00004794 "clear bgp ipv6 " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00004795 CLEAR_STR
4796 BGP_STR
4797 "Address family\n"
4798 "Clear peers with the AS number\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02004799
paul718e3742002-12-13 20:15:29 +00004800/* Outbound soft-reconfiguration */
4801DEFUN (clear_ip_bgp_all_soft_out,
4802 clear_ip_bgp_all_soft_out_cmd,
4803 "clear ip bgp * soft out",
4804 CLEAR_STR
4805 IP_STR
4806 BGP_STR
4807 "Clear all peers\n"
4808 "Soft reconfig\n"
4809 "Soft reconfig outbound update\n")
4810{
4811 if (argc == 1)
4812 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
4813 BGP_CLEAR_SOFT_OUT, NULL);
4814
4815 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
4816 BGP_CLEAR_SOFT_OUT, NULL);
4817}
4818
4819ALIAS (clear_ip_bgp_all_soft_out,
4820 clear_ip_bgp_all_out_cmd,
4821 "clear ip bgp * out",
4822 CLEAR_STR
4823 IP_STR
4824 BGP_STR
4825 "Clear all peers\n"
4826 "Soft reconfig outbound update\n")
4827
4828ALIAS (clear_ip_bgp_all_soft_out,
4829 clear_ip_bgp_instance_all_soft_out_cmd,
4830 "clear ip bgp view WORD * soft out",
4831 CLEAR_STR
4832 IP_STR
4833 BGP_STR
4834 "BGP view\n"
4835 "view name\n"
4836 "Clear all peers\n"
4837 "Soft reconfig\n"
4838 "Soft reconfig outbound update\n")
4839
4840DEFUN (clear_ip_bgp_all_ipv4_soft_out,
4841 clear_ip_bgp_all_ipv4_soft_out_cmd,
4842 "clear ip bgp * ipv4 (unicast|multicast) soft out",
4843 CLEAR_STR
4844 IP_STR
4845 BGP_STR
4846 "Clear all peers\n"
4847 "Address family\n"
4848 "Address Family modifier\n"
4849 "Address Family modifier\n"
4850 "Soft reconfig\n"
4851 "Soft reconfig outbound update\n")
4852{
4853 if (strncmp (argv[0], "m", 1) == 0)
4854 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
4855 BGP_CLEAR_SOFT_OUT, NULL);
4856
4857 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
4858 BGP_CLEAR_SOFT_OUT, NULL);
4859}
4860
4861ALIAS (clear_ip_bgp_all_ipv4_soft_out,
4862 clear_ip_bgp_all_ipv4_out_cmd,
4863 "clear ip bgp * ipv4 (unicast|multicast) out",
4864 CLEAR_STR
4865 IP_STR
4866 BGP_STR
4867 "Clear all peers\n"
4868 "Address family\n"
4869 "Address Family modifier\n"
4870 "Address Family modifier\n"
4871 "Soft reconfig outbound update\n")
4872
4873DEFUN (clear_ip_bgp_instance_all_ipv4_soft_out,
4874 clear_ip_bgp_instance_all_ipv4_soft_out_cmd,
4875 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft out",
4876 CLEAR_STR
4877 IP_STR
4878 BGP_STR
4879 "BGP view\n"
4880 "view name\n"
4881 "Clear all peers\n"
4882 "Address family\n"
4883 "Address Family modifier\n"
4884 "Address Family modifier\n"
4885 "Soft reconfig outbound update\n")
4886{
4887 if (strncmp (argv[1], "m", 1) == 0)
4888 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
4889 BGP_CLEAR_SOFT_OUT, NULL);
4890
4891 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
4892 BGP_CLEAR_SOFT_OUT, NULL);
4893}
4894
4895DEFUN (clear_ip_bgp_all_vpnv4_soft_out,
4896 clear_ip_bgp_all_vpnv4_soft_out_cmd,
4897 "clear ip bgp * vpnv4 unicast soft out",
4898 CLEAR_STR
4899 IP_STR
4900 BGP_STR
4901 "Clear all peers\n"
4902 "Address family\n"
4903 "Address Family Modifier\n"
4904 "Soft reconfig\n"
4905 "Soft reconfig outbound update\n")
4906{
4907 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
4908 BGP_CLEAR_SOFT_OUT, NULL);
4909}
4910
4911ALIAS (clear_ip_bgp_all_vpnv4_soft_out,
4912 clear_ip_bgp_all_vpnv4_out_cmd,
4913 "clear ip bgp * vpnv4 unicast out",
4914 CLEAR_STR
4915 IP_STR
4916 BGP_STR
4917 "Clear all peers\n"
4918 "Address family\n"
4919 "Address Family Modifier\n"
4920 "Soft reconfig outbound update\n")
4921
Lou Berger298cc2f2016-01-12 13:42:02 -05004922DEFUN (clear_ip_bgp_all_encap_soft_out,
4923 clear_ip_bgp_all_encap_soft_out_cmd,
4924 "clear ip bgp * encap unicast soft out",
4925 CLEAR_STR
4926 IP_STR
4927 BGP_STR
4928 "Clear all peers\n"
4929 "Address family\n"
4930 "Address Family Modifier\n"
4931 "Soft reconfig\n"
4932 "Soft reconfig outbound update\n")
4933{
4934 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_all,
4935 BGP_CLEAR_SOFT_OUT, NULL);
4936}
4937
4938ALIAS (clear_ip_bgp_all_encap_soft_out,
4939 clear_ip_bgp_all_encap_out_cmd,
4940 "clear ip bgp * encap unicast out",
4941 CLEAR_STR
4942 IP_STR
4943 BGP_STR
4944 "Clear all peers\n"
4945 "Address family\n"
4946 "Address Family Modifier\n"
4947 "Soft reconfig outbound update\n")
4948
paul718e3742002-12-13 20:15:29 +00004949DEFUN (clear_bgp_all_soft_out,
4950 clear_bgp_all_soft_out_cmd,
4951 "clear bgp * soft out",
4952 CLEAR_STR
4953 BGP_STR
4954 "Clear all peers\n"
4955 "Soft reconfig\n"
4956 "Soft reconfig outbound update\n")
4957{
4958 if (argc == 1)
4959 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
4960 BGP_CLEAR_SOFT_OUT, NULL);
4961
4962 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
4963 BGP_CLEAR_SOFT_OUT, NULL);
4964}
4965
4966ALIAS (clear_bgp_all_soft_out,
4967 clear_bgp_instance_all_soft_out_cmd,
4968 "clear bgp view WORD * soft out",
4969 CLEAR_STR
4970 BGP_STR
4971 "BGP view\n"
4972 "view name\n"
4973 "Clear all peers\n"
4974 "Soft reconfig\n"
4975 "Soft reconfig outbound update\n")
4976
4977ALIAS (clear_bgp_all_soft_out,
4978 clear_bgp_all_out_cmd,
4979 "clear bgp * out",
4980 CLEAR_STR
4981 BGP_STR
4982 "Clear all peers\n"
4983 "Soft reconfig outbound update\n")
4984
4985ALIAS (clear_bgp_all_soft_out,
4986 clear_bgp_ipv6_all_soft_out_cmd,
4987 "clear bgp ipv6 * soft out",
4988 CLEAR_STR
4989 BGP_STR
4990 "Address family\n"
4991 "Clear all peers\n"
4992 "Soft reconfig\n"
4993 "Soft reconfig outbound update\n")
4994
4995ALIAS (clear_bgp_all_soft_out,
4996 clear_bgp_ipv6_all_out_cmd,
4997 "clear bgp ipv6 * out",
4998 CLEAR_STR
4999 BGP_STR
5000 "Address family\n"
5001 "Clear all peers\n"
5002 "Soft reconfig outbound update\n")
5003
5004DEFUN (clear_ip_bgp_peer_soft_out,
5005 clear_ip_bgp_peer_soft_out_cmd,
5006 "clear ip bgp A.B.C.D soft out",
5007 CLEAR_STR
5008 IP_STR
5009 BGP_STR
5010 "BGP neighbor address to clear\n"
5011 "Soft reconfig\n"
5012 "Soft reconfig outbound update\n")
5013{
5014 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5015 BGP_CLEAR_SOFT_OUT, argv[0]);
5016}
5017
5018ALIAS (clear_ip_bgp_peer_soft_out,
5019 clear_ip_bgp_peer_out_cmd,
5020 "clear ip bgp A.B.C.D out",
5021 CLEAR_STR
5022 IP_STR
5023 BGP_STR
5024 "BGP neighbor address to clear\n"
5025 "Soft reconfig outbound update\n")
5026
5027DEFUN (clear_ip_bgp_peer_ipv4_soft_out,
5028 clear_ip_bgp_peer_ipv4_soft_out_cmd,
5029 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft out",
5030 CLEAR_STR
5031 IP_STR
5032 BGP_STR
5033 "BGP neighbor address to clear\n"
5034 "Address family\n"
5035 "Address Family modifier\n"
5036 "Address Family modifier\n"
5037 "Soft reconfig\n"
5038 "Soft reconfig outbound update\n")
5039{
5040 if (strncmp (argv[1], "m", 1) == 0)
5041 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
5042 BGP_CLEAR_SOFT_OUT, argv[0]);
5043
5044 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5045 BGP_CLEAR_SOFT_OUT, argv[0]);
5046}
5047
5048ALIAS (clear_ip_bgp_peer_ipv4_soft_out,
5049 clear_ip_bgp_peer_ipv4_out_cmd,
5050 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) out",
5051 CLEAR_STR
5052 IP_STR
5053 BGP_STR
5054 "BGP neighbor address to clear\n"
5055 "Address family\n"
5056 "Address Family modifier\n"
5057 "Address Family modifier\n"
5058 "Soft reconfig outbound update\n")
5059
5060DEFUN (clear_ip_bgp_peer_vpnv4_soft_out,
5061 clear_ip_bgp_peer_vpnv4_soft_out_cmd,
5062 "clear ip bgp A.B.C.D vpnv4 unicast soft out",
5063 CLEAR_STR
5064 IP_STR
5065 BGP_STR
5066 "BGP neighbor address to clear\n"
5067 "Address family\n"
5068 "Address Family Modifier\n"
5069 "Soft reconfig\n"
5070 "Soft reconfig outbound update\n")
5071{
5072 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
5073 BGP_CLEAR_SOFT_OUT, argv[0]);
5074}
5075
5076ALIAS (clear_ip_bgp_peer_vpnv4_soft_out,
5077 clear_ip_bgp_peer_vpnv4_out_cmd,
5078 "clear ip bgp A.B.C.D vpnv4 unicast out",
5079 CLEAR_STR
5080 IP_STR
5081 BGP_STR
5082 "BGP neighbor address to clear\n"
5083 "Address family\n"
5084 "Address Family Modifier\n"
5085 "Soft reconfig outbound update\n")
5086
Lou Berger298cc2f2016-01-12 13:42:02 -05005087DEFUN (clear_ip_bgp_peer_encap_soft_out,
5088 clear_ip_bgp_peer_encap_soft_out_cmd,
5089 "clear ip bgp A.B.C.D encap unicast soft out",
5090 CLEAR_STR
5091 IP_STR
5092 BGP_STR
5093 "BGP neighbor address to clear\n"
5094 "Address family\n"
5095 "Address Family Modifier\n"
5096 "Soft reconfig\n"
5097 "Soft reconfig outbound update\n")
5098{
5099 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_peer,
5100 BGP_CLEAR_SOFT_OUT, argv[0]);
5101}
5102
5103ALIAS (clear_ip_bgp_peer_encap_soft_out,
5104 clear_ip_bgp_peer_encap_out_cmd,
5105 "clear ip bgp A.B.C.D encap unicast out",
5106 CLEAR_STR
5107 IP_STR
5108 BGP_STR
5109 "BGP neighbor address to clear\n"
5110 "Address family\n"
5111 "Address Family Modifier\n"
5112 "Soft reconfig outbound update\n")
5113
paul718e3742002-12-13 20:15:29 +00005114DEFUN (clear_bgp_peer_soft_out,
5115 clear_bgp_peer_soft_out_cmd,
5116 "clear bgp (A.B.C.D|X:X::X:X) soft out",
5117 CLEAR_STR
5118 BGP_STR
5119 "BGP neighbor address to clear\n"
5120 "BGP IPv6 neighbor to clear\n"
5121 "Soft reconfig\n"
5122 "Soft reconfig outbound update\n")
5123{
5124 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
5125 BGP_CLEAR_SOFT_OUT, argv[0]);
5126}
5127
5128ALIAS (clear_bgp_peer_soft_out,
5129 clear_bgp_ipv6_peer_soft_out_cmd,
5130 "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft out",
5131 CLEAR_STR
5132 BGP_STR
5133 "Address family\n"
5134 "BGP neighbor address to clear\n"
5135 "BGP IPv6 neighbor to clear\n"
5136 "Soft reconfig\n"
5137 "Soft reconfig outbound update\n")
5138
5139ALIAS (clear_bgp_peer_soft_out,
5140 clear_bgp_peer_out_cmd,
5141 "clear bgp (A.B.C.D|X:X::X:X) out",
5142 CLEAR_STR
5143 BGP_STR
5144 "BGP neighbor address to clear\n"
5145 "BGP IPv6 neighbor to clear\n"
5146 "Soft reconfig outbound update\n")
5147
5148ALIAS (clear_bgp_peer_soft_out,
5149 clear_bgp_ipv6_peer_out_cmd,
5150 "clear bgp ipv6 (A.B.C.D|X:X::X:X) out",
5151 CLEAR_STR
5152 BGP_STR
5153 "Address family\n"
5154 "BGP neighbor address to clear\n"
5155 "BGP IPv6 neighbor to clear\n"
5156 "Soft reconfig outbound update\n")
5157
5158DEFUN (clear_ip_bgp_peer_group_soft_out,
5159 clear_ip_bgp_peer_group_soft_out_cmd,
5160 "clear ip bgp peer-group WORD soft out",
5161 CLEAR_STR
5162 IP_STR
5163 BGP_STR
5164 "Clear all members of peer-group\n"
5165 "BGP peer-group name\n"
5166 "Soft reconfig\n"
5167 "Soft reconfig outbound update\n")
5168{
5169 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5170 BGP_CLEAR_SOFT_OUT, argv[0]);
5171}
5172
5173ALIAS (clear_ip_bgp_peer_group_soft_out,
5174 clear_ip_bgp_peer_group_out_cmd,
5175 "clear ip bgp peer-group WORD out",
5176 CLEAR_STR
5177 IP_STR
5178 BGP_STR
5179 "Clear all members of peer-group\n"
5180 "BGP peer-group name\n"
5181 "Soft reconfig outbound update\n")
5182
5183DEFUN (clear_ip_bgp_peer_group_ipv4_soft_out,
5184 clear_ip_bgp_peer_group_ipv4_soft_out_cmd,
5185 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft out",
5186 CLEAR_STR
5187 IP_STR
5188 BGP_STR
5189 "Clear all members of peer-group\n"
5190 "BGP peer-group name\n"
5191 "Address family\n"
5192 "Address Family modifier\n"
5193 "Address Family modifier\n"
5194 "Soft reconfig\n"
5195 "Soft reconfig outbound update\n")
5196{
5197 if (strncmp (argv[1], "m", 1) == 0)
5198 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
5199 BGP_CLEAR_SOFT_OUT, argv[0]);
5200
5201 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5202 BGP_CLEAR_SOFT_OUT, argv[0]);
5203}
5204
5205ALIAS (clear_ip_bgp_peer_group_ipv4_soft_out,
5206 clear_ip_bgp_peer_group_ipv4_out_cmd,
5207 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) out",
5208 CLEAR_STR
5209 IP_STR
5210 BGP_STR
5211 "Clear all members of peer-group\n"
5212 "BGP peer-group name\n"
5213 "Address family\n"
5214 "Address Family modifier\n"
5215 "Address Family modifier\n"
5216 "Soft reconfig outbound update\n")
5217
5218DEFUN (clear_bgp_peer_group_soft_out,
5219 clear_bgp_peer_group_soft_out_cmd,
5220 "clear bgp peer-group WORD soft out",
5221 CLEAR_STR
5222 BGP_STR
5223 "Clear all members of peer-group\n"
5224 "BGP peer-group name\n"
5225 "Soft reconfig\n"
5226 "Soft reconfig outbound update\n")
5227{
5228 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
5229 BGP_CLEAR_SOFT_OUT, argv[0]);
5230}
5231
5232ALIAS (clear_bgp_peer_group_soft_out,
5233 clear_bgp_ipv6_peer_group_soft_out_cmd,
5234 "clear bgp ipv6 peer-group WORD soft out",
5235 CLEAR_STR
5236 BGP_STR
5237 "Address family\n"
5238 "Clear all members of peer-group\n"
5239 "BGP peer-group name\n"
5240 "Soft reconfig\n"
5241 "Soft reconfig outbound update\n")
5242
5243ALIAS (clear_bgp_peer_group_soft_out,
5244 clear_bgp_peer_group_out_cmd,
5245 "clear bgp peer-group WORD out",
5246 CLEAR_STR
5247 BGP_STR
5248 "Clear all members of peer-group\n"
5249 "BGP peer-group name\n"
5250 "Soft reconfig outbound update\n")
5251
5252ALIAS (clear_bgp_peer_group_soft_out,
5253 clear_bgp_ipv6_peer_group_out_cmd,
5254 "clear bgp ipv6 peer-group WORD out",
5255 CLEAR_STR
5256 BGP_STR
5257 "Address family\n"
5258 "Clear all members of peer-group\n"
5259 "BGP peer-group name\n"
5260 "Soft reconfig outbound update\n")
5261
5262DEFUN (clear_ip_bgp_external_soft_out,
5263 clear_ip_bgp_external_soft_out_cmd,
5264 "clear ip bgp external soft out",
5265 CLEAR_STR
5266 IP_STR
5267 BGP_STR
5268 "Clear all external peers\n"
5269 "Soft reconfig\n"
5270 "Soft reconfig outbound update\n")
5271{
5272 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5273 BGP_CLEAR_SOFT_OUT, NULL);
5274}
5275
5276ALIAS (clear_ip_bgp_external_soft_out,
5277 clear_ip_bgp_external_out_cmd,
5278 "clear ip bgp external out",
5279 CLEAR_STR
5280 IP_STR
5281 BGP_STR
5282 "Clear all external peers\n"
5283 "Soft reconfig outbound update\n")
5284
5285DEFUN (clear_ip_bgp_external_ipv4_soft_out,
5286 clear_ip_bgp_external_ipv4_soft_out_cmd,
5287 "clear ip bgp external ipv4 (unicast|multicast) soft out",
5288 CLEAR_STR
5289 IP_STR
5290 BGP_STR
5291 "Clear all external peers\n"
5292 "Address family\n"
5293 "Address Family modifier\n"
5294 "Address Family modifier\n"
5295 "Soft reconfig\n"
5296 "Soft reconfig outbound update\n")
5297{
5298 if (strncmp (argv[0], "m", 1) == 0)
5299 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
5300 BGP_CLEAR_SOFT_OUT, NULL);
5301
5302 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5303 BGP_CLEAR_SOFT_OUT, NULL);
5304}
5305
5306ALIAS (clear_ip_bgp_external_ipv4_soft_out,
5307 clear_ip_bgp_external_ipv4_out_cmd,
5308 "clear ip bgp external ipv4 (unicast|multicast) out",
5309 CLEAR_STR
5310 IP_STR
5311 BGP_STR
5312 "Clear all external peers\n"
5313 "Address family\n"
5314 "Address Family modifier\n"
5315 "Address Family modifier\n"
5316 "Soft reconfig outbound update\n")
5317
5318DEFUN (clear_bgp_external_soft_out,
5319 clear_bgp_external_soft_out_cmd,
5320 "clear bgp external soft out",
5321 CLEAR_STR
5322 BGP_STR
5323 "Clear all external peers\n"
5324 "Soft reconfig\n"
5325 "Soft reconfig outbound update\n")
5326{
5327 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
5328 BGP_CLEAR_SOFT_OUT, NULL);
5329}
5330
5331ALIAS (clear_bgp_external_soft_out,
5332 clear_bgp_ipv6_external_soft_out_cmd,
5333 "clear bgp ipv6 external soft out",
5334 CLEAR_STR
5335 BGP_STR
5336 "Address family\n"
5337 "Clear all external peers\n"
5338 "Soft reconfig\n"
5339 "Soft reconfig outbound update\n")
5340
5341ALIAS (clear_bgp_external_soft_out,
5342 clear_bgp_external_out_cmd,
5343 "clear bgp external out",
5344 CLEAR_STR
5345 BGP_STR
5346 "Clear all external peers\n"
5347 "Soft reconfig outbound update\n")
5348
5349ALIAS (clear_bgp_external_soft_out,
5350 clear_bgp_ipv6_external_out_cmd,
5351 "clear bgp ipv6 external WORD out",
5352 CLEAR_STR
5353 BGP_STR
5354 "Address family\n"
5355 "Clear all external peers\n"
5356 "Soft reconfig outbound update\n")
5357
5358DEFUN (clear_ip_bgp_as_soft_out,
5359 clear_ip_bgp_as_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005360 "clear ip bgp " CMD_AS_RANGE " soft out",
paul718e3742002-12-13 20:15:29 +00005361 CLEAR_STR
5362 IP_STR
5363 BGP_STR
5364 "Clear peers with the AS number\n"
5365 "Soft reconfig\n"
5366 "Soft reconfig outbound update\n")
5367{
5368 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
5369 BGP_CLEAR_SOFT_OUT, argv[0]);
5370}
5371
5372ALIAS (clear_ip_bgp_as_soft_out,
5373 clear_ip_bgp_as_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005374 "clear ip bgp " CMD_AS_RANGE " out",
paul718e3742002-12-13 20:15:29 +00005375 CLEAR_STR
5376 IP_STR
5377 BGP_STR
5378 "Clear peers with the AS number\n"
5379 "Soft reconfig outbound update\n")
5380
5381DEFUN (clear_ip_bgp_as_ipv4_soft_out,
5382 clear_ip_bgp_as_ipv4_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005383 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft out",
paul718e3742002-12-13 20:15:29 +00005384 CLEAR_STR
5385 IP_STR
5386 BGP_STR
5387 "Clear peers with the AS number\n"
5388 "Address family\n"
5389 "Address Family modifier\n"
5390 "Address Family modifier\n"
5391 "Soft reconfig\n"
5392 "Soft reconfig outbound update\n")
5393{
5394 if (strncmp (argv[1], "m", 1) == 0)
5395 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
5396 BGP_CLEAR_SOFT_OUT, argv[0]);
5397
5398 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
5399 BGP_CLEAR_SOFT_OUT, argv[0]);
5400}
5401
5402ALIAS (clear_ip_bgp_as_ipv4_soft_out,
5403 clear_ip_bgp_as_ipv4_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005404 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) out",
paul718e3742002-12-13 20:15:29 +00005405 CLEAR_STR
5406 IP_STR
5407 BGP_STR
5408 "Clear peers with the AS number\n"
5409 "Address family\n"
5410 "Address Family modifier\n"
5411 "Address Family modifier\n"
5412 "Soft reconfig outbound update\n")
5413
5414DEFUN (clear_ip_bgp_as_vpnv4_soft_out,
5415 clear_ip_bgp_as_vpnv4_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005416 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft out",
paul718e3742002-12-13 20:15:29 +00005417 CLEAR_STR
5418 IP_STR
5419 BGP_STR
5420 "Clear peers with the AS number\n"
5421 "Address family\n"
5422 "Address Family modifier\n"
5423 "Soft reconfig\n"
5424 "Soft reconfig outbound update\n")
5425{
5426 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
5427 BGP_CLEAR_SOFT_OUT, argv[0]);
5428}
5429
5430ALIAS (clear_ip_bgp_as_vpnv4_soft_out,
5431 clear_ip_bgp_as_vpnv4_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005432 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast out",
paul718e3742002-12-13 20:15:29 +00005433 CLEAR_STR
5434 IP_STR
5435 BGP_STR
5436 "Clear peers with the AS number\n"
5437 "Address family\n"
5438 "Address Family modifier\n"
5439 "Soft reconfig outbound update\n")
5440
Lou Berger298cc2f2016-01-12 13:42:02 -05005441DEFUN (clear_ip_bgp_as_encap_soft_out,
5442 clear_ip_bgp_as_encap_soft_out_cmd,
5443 "clear ip bgp " CMD_AS_RANGE " encap unicast soft out",
5444 CLEAR_STR
5445 IP_STR
5446 BGP_STR
5447 "Clear peers with the AS number\n"
5448 "Address family\n"
5449 "Address Family modifier\n"
5450 "Soft reconfig\n"
5451 "Soft reconfig outbound update\n")
5452{
5453 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_as,
5454 BGP_CLEAR_SOFT_OUT, argv[0]);
5455}
5456
5457ALIAS (clear_ip_bgp_as_encap_soft_out,
5458 clear_ip_bgp_as_encap_out_cmd,
5459 "clear ip bgp " CMD_AS_RANGE " encap unicast out",
5460 CLEAR_STR
5461 IP_STR
5462 BGP_STR
5463 "Clear peers with the AS number\n"
5464 "Address family\n"
5465 "Address Family modifier\n"
5466 "Soft reconfig outbound update\n")
5467
paul718e3742002-12-13 20:15:29 +00005468DEFUN (clear_bgp_as_soft_out,
5469 clear_bgp_as_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005470 "clear bgp " CMD_AS_RANGE " soft out",
paul718e3742002-12-13 20:15:29 +00005471 CLEAR_STR
5472 BGP_STR
5473 "Clear peers with the AS number\n"
5474 "Soft reconfig\n"
5475 "Soft reconfig outbound update\n")
5476{
5477 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
5478 BGP_CLEAR_SOFT_OUT, argv[0]);
5479}
5480
5481ALIAS (clear_bgp_as_soft_out,
5482 clear_bgp_ipv6_as_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005483 "clear bgp ipv6 " CMD_AS_RANGE " soft out",
paul718e3742002-12-13 20:15:29 +00005484 CLEAR_STR
5485 BGP_STR
5486 "Address family\n"
5487 "Clear peers with the AS number\n"
5488 "Soft reconfig\n"
5489 "Soft reconfig outbound update\n")
5490
5491ALIAS (clear_bgp_as_soft_out,
5492 clear_bgp_as_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005493 "clear bgp " CMD_AS_RANGE " out",
paul718e3742002-12-13 20:15:29 +00005494 CLEAR_STR
5495 BGP_STR
5496 "Clear peers with the AS number\n"
5497 "Soft reconfig outbound update\n")
5498
5499ALIAS (clear_bgp_as_soft_out,
5500 clear_bgp_ipv6_as_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005501 "clear bgp ipv6 " CMD_AS_RANGE " out",
paul718e3742002-12-13 20:15:29 +00005502 CLEAR_STR
5503 BGP_STR
5504 "Address family\n"
5505 "Clear peers with the AS number\n"
5506 "Soft reconfig outbound update\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02005507
paul718e3742002-12-13 20:15:29 +00005508/* Inbound soft-reconfiguration */
5509DEFUN (clear_ip_bgp_all_soft_in,
5510 clear_ip_bgp_all_soft_in_cmd,
5511 "clear ip bgp * soft in",
5512 CLEAR_STR
5513 IP_STR
5514 BGP_STR
5515 "Clear all peers\n"
5516 "Soft reconfig\n"
5517 "Soft reconfig inbound update\n")
5518{
5519 if (argc == 1)
5520 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5521 BGP_CLEAR_SOFT_IN, NULL);
5522
5523 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5524 BGP_CLEAR_SOFT_IN, NULL);
5525}
5526
5527ALIAS (clear_ip_bgp_all_soft_in,
5528 clear_ip_bgp_instance_all_soft_in_cmd,
5529 "clear ip bgp view WORD * soft in",
5530 CLEAR_STR
5531 IP_STR
5532 BGP_STR
5533 "BGP view\n"
5534 "view name\n"
5535 "Clear all peers\n"
5536 "Soft reconfig\n"
5537 "Soft reconfig inbound update\n")
5538
5539ALIAS (clear_ip_bgp_all_soft_in,
5540 clear_ip_bgp_all_in_cmd,
5541 "clear ip bgp * in",
5542 CLEAR_STR
5543 IP_STR
5544 BGP_STR
5545 "Clear all peers\n"
5546 "Soft reconfig inbound update\n")
5547
5548DEFUN (clear_ip_bgp_all_in_prefix_filter,
5549 clear_ip_bgp_all_in_prefix_filter_cmd,
5550 "clear ip bgp * in prefix-filter",
5551 CLEAR_STR
5552 IP_STR
5553 BGP_STR
5554 "Clear all peers\n"
5555 "Soft reconfig inbound update\n"
5556 "Push out prefix-list ORF and do inbound soft reconfig\n")
5557{
5558 if (argc== 1)
5559 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5560 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5561
5562 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5563 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5564}
5565
5566ALIAS (clear_ip_bgp_all_in_prefix_filter,
5567 clear_ip_bgp_instance_all_in_prefix_filter_cmd,
5568 "clear ip bgp view WORD * in prefix-filter",
5569 CLEAR_STR
5570 IP_STR
5571 BGP_STR
5572 "BGP view\n"
5573 "view name\n"
5574 "Clear all peers\n"
5575 "Soft reconfig inbound update\n"
5576 "Push out prefix-list ORF and do inbound soft reconfig\n")
5577
5578
5579DEFUN (clear_ip_bgp_all_ipv4_soft_in,
5580 clear_ip_bgp_all_ipv4_soft_in_cmd,
5581 "clear ip bgp * ipv4 (unicast|multicast) soft in",
5582 CLEAR_STR
5583 IP_STR
5584 BGP_STR
5585 "Clear all peers\n"
5586 "Address family\n"
5587 "Address Family modifier\n"
5588 "Address Family modifier\n"
5589 "Soft reconfig\n"
5590 "Soft reconfig inbound update\n")
5591{
5592 if (strncmp (argv[0], "m", 1) == 0)
5593 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
5594 BGP_CLEAR_SOFT_IN, NULL);
5595
5596 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5597 BGP_CLEAR_SOFT_IN, NULL);
5598}
5599
5600ALIAS (clear_ip_bgp_all_ipv4_soft_in,
5601 clear_ip_bgp_all_ipv4_in_cmd,
5602 "clear ip bgp * ipv4 (unicast|multicast) in",
5603 CLEAR_STR
5604 IP_STR
5605 BGP_STR
5606 "Clear all peers\n"
5607 "Address family\n"
5608 "Address Family modifier\n"
5609 "Address Family modifier\n"
5610 "Soft reconfig inbound update\n")
5611
5612DEFUN (clear_ip_bgp_instance_all_ipv4_soft_in,
5613 clear_ip_bgp_instance_all_ipv4_soft_in_cmd,
5614 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft in",
5615 CLEAR_STR
5616 IP_STR
5617 BGP_STR
5618 "BGP view\n"
5619 "view name\n"
5620 "Clear all peers\n"
5621 "Address family\n"
5622 "Address Family modifier\n"
5623 "Address Family modifier\n"
5624 "Soft reconfig\n"
5625 "Soft reconfig inbound update\n")
5626{
5627 if (strncmp (argv[1], "m", 1) == 0)
5628 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
5629 BGP_CLEAR_SOFT_IN, NULL);
5630
5631 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5632 BGP_CLEAR_SOFT_IN, NULL);
5633}
5634
5635DEFUN (clear_ip_bgp_all_ipv4_in_prefix_filter,
5636 clear_ip_bgp_all_ipv4_in_prefix_filter_cmd,
5637 "clear ip bgp * ipv4 (unicast|multicast) in prefix-filter",
5638 CLEAR_STR
5639 IP_STR
5640 BGP_STR
5641 "Clear all peers\n"
5642 "Address family\n"
5643 "Address Family modifier\n"
5644 "Address Family modifier\n"
5645 "Soft reconfig inbound update\n"
5646 "Push out prefix-list ORF and do inbound soft reconfig\n")
5647{
5648 if (strncmp (argv[0], "m", 1) == 0)
5649 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
5650 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5651
5652 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5653 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5654}
5655
5656DEFUN (clear_ip_bgp_instance_all_ipv4_in_prefix_filter,
5657 clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd,
5658 "clear ip bgp view WORD * ipv4 (unicast|multicast) in prefix-filter",
5659 CLEAR_STR
5660 IP_STR
5661 BGP_STR
5662 "Clear all peers\n"
5663 "Address family\n"
5664 "Address Family modifier\n"
5665 "Address Family modifier\n"
5666 "Soft reconfig inbound update\n"
5667 "Push out prefix-list ORF and do inbound soft reconfig\n")
5668{
5669 if (strncmp (argv[1], "m", 1) == 0)
5670 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
5671 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5672
5673 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5674 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5675}
5676
5677DEFUN (clear_ip_bgp_all_vpnv4_soft_in,
5678 clear_ip_bgp_all_vpnv4_soft_in_cmd,
5679 "clear ip bgp * vpnv4 unicast soft in",
5680 CLEAR_STR
5681 IP_STR
5682 BGP_STR
5683 "Clear all peers\n"
5684 "Address family\n"
5685 "Address Family Modifier\n"
5686 "Soft reconfig\n"
5687 "Soft reconfig inbound update\n")
5688{
5689 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
5690 BGP_CLEAR_SOFT_IN, NULL);
5691}
5692
5693ALIAS (clear_ip_bgp_all_vpnv4_soft_in,
5694 clear_ip_bgp_all_vpnv4_in_cmd,
5695 "clear ip bgp * vpnv4 unicast in",
5696 CLEAR_STR
5697 IP_STR
5698 BGP_STR
5699 "Clear all peers\n"
5700 "Address family\n"
5701 "Address Family Modifier\n"
5702 "Soft reconfig inbound update\n")
5703
Lou Berger298cc2f2016-01-12 13:42:02 -05005704DEFUN (clear_ip_bgp_all_encap_soft_in,
5705 clear_ip_bgp_all_encap_soft_in_cmd,
5706 "clear ip bgp * encap unicast soft in",
5707 CLEAR_STR
5708 IP_STR
5709 BGP_STR
5710 "Clear all peers\n"
5711 "Address family\n"
5712 "Address Family Modifier\n"
5713 "Soft reconfig\n"
5714 "Soft reconfig inbound update\n")
5715{
5716 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_all,
5717 BGP_CLEAR_SOFT_IN, NULL);
5718}
5719
5720ALIAS (clear_ip_bgp_all_encap_soft_in,
5721 clear_ip_bgp_all_encap_in_cmd,
5722 "clear ip bgp * encap unicast in",
5723 CLEAR_STR
5724 IP_STR
5725 BGP_STR
5726 "Clear all peers\n"
5727 "Address family\n"
5728 "Address Family Modifier\n"
5729 "Soft reconfig inbound update\n")
5730
paul718e3742002-12-13 20:15:29 +00005731DEFUN (clear_bgp_all_soft_in,
5732 clear_bgp_all_soft_in_cmd,
5733 "clear bgp * soft in",
5734 CLEAR_STR
5735 BGP_STR
5736 "Clear all peers\n"
5737 "Soft reconfig\n"
5738 "Soft reconfig inbound update\n")
5739{
5740 if (argc == 1)
5741 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
5742 BGP_CLEAR_SOFT_IN, NULL);
5743
5744 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
5745 BGP_CLEAR_SOFT_IN, NULL);
5746}
5747
5748ALIAS (clear_bgp_all_soft_in,
5749 clear_bgp_instance_all_soft_in_cmd,
5750 "clear bgp view WORD * soft in",
5751 CLEAR_STR
5752 BGP_STR
5753 "BGP view\n"
5754 "view name\n"
5755 "Clear all peers\n"
5756 "Soft reconfig\n"
5757 "Soft reconfig inbound update\n")
5758
5759ALIAS (clear_bgp_all_soft_in,
5760 clear_bgp_ipv6_all_soft_in_cmd,
5761 "clear bgp ipv6 * soft in",
5762 CLEAR_STR
5763 BGP_STR
5764 "Address family\n"
5765 "Clear all peers\n"
5766 "Soft reconfig\n"
5767 "Soft reconfig inbound update\n")
5768
5769ALIAS (clear_bgp_all_soft_in,
5770 clear_bgp_all_in_cmd,
5771 "clear bgp * in",
5772 CLEAR_STR
5773 BGP_STR
5774 "Clear all peers\n"
5775 "Soft reconfig inbound update\n")
5776
5777ALIAS (clear_bgp_all_soft_in,
5778 clear_bgp_ipv6_all_in_cmd,
5779 "clear bgp ipv6 * in",
5780 CLEAR_STR
5781 BGP_STR
5782 "Address family\n"
5783 "Clear all peers\n"
5784 "Soft reconfig inbound update\n")
5785
5786DEFUN (clear_bgp_all_in_prefix_filter,
5787 clear_bgp_all_in_prefix_filter_cmd,
5788 "clear bgp * in prefix-filter",
5789 CLEAR_STR
5790 BGP_STR
5791 "Clear all peers\n"
5792 "Soft reconfig inbound update\n"
5793 "Push out prefix-list ORF and do inbound soft reconfig\n")
5794{
5795 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
5796 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5797}
5798
5799ALIAS (clear_bgp_all_in_prefix_filter,
5800 clear_bgp_ipv6_all_in_prefix_filter_cmd,
5801 "clear bgp ipv6 * in prefix-filter",
5802 CLEAR_STR
5803 BGP_STR
5804 "Address family\n"
5805 "Clear all peers\n"
5806 "Soft reconfig inbound update\n"
5807 "Push out prefix-list ORF and do inbound soft reconfig\n")
5808
5809DEFUN (clear_ip_bgp_peer_soft_in,
5810 clear_ip_bgp_peer_soft_in_cmd,
5811 "clear ip bgp A.B.C.D soft in",
5812 CLEAR_STR
5813 IP_STR
5814 BGP_STR
5815 "BGP neighbor address to clear\n"
5816 "Soft reconfig\n"
5817 "Soft reconfig inbound update\n")
5818{
5819 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5820 BGP_CLEAR_SOFT_IN, argv[0]);
5821}
5822
5823ALIAS (clear_ip_bgp_peer_soft_in,
5824 clear_ip_bgp_peer_in_cmd,
5825 "clear ip bgp A.B.C.D in",
5826 CLEAR_STR
5827 IP_STR
5828 BGP_STR
5829 "BGP neighbor address to clear\n"
5830 "Soft reconfig inbound update\n")
5831
5832DEFUN (clear_ip_bgp_peer_in_prefix_filter,
5833 clear_ip_bgp_peer_in_prefix_filter_cmd,
5834 "clear ip bgp A.B.C.D in prefix-filter",
5835 CLEAR_STR
5836 IP_STR
5837 BGP_STR
5838 "BGP neighbor address to clear\n"
5839 "Soft reconfig inbound update\n"
5840 "Push out the existing ORF prefix-list\n")
5841{
5842 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5843 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5844}
5845
5846DEFUN (clear_ip_bgp_peer_ipv4_soft_in,
5847 clear_ip_bgp_peer_ipv4_soft_in_cmd,
5848 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft in",
5849 CLEAR_STR
5850 IP_STR
5851 BGP_STR
5852 "BGP neighbor address to clear\n"
5853 "Address family\n"
5854 "Address Family modifier\n"
5855 "Address Family modifier\n"
5856 "Soft reconfig\n"
5857 "Soft reconfig inbound update\n")
5858{
5859 if (strncmp (argv[1], "m", 1) == 0)
5860 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
5861 BGP_CLEAR_SOFT_IN, argv[0]);
5862
5863 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5864 BGP_CLEAR_SOFT_IN, argv[0]);
5865}
5866
5867ALIAS (clear_ip_bgp_peer_ipv4_soft_in,
5868 clear_ip_bgp_peer_ipv4_in_cmd,
5869 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in",
5870 CLEAR_STR
5871 IP_STR
5872 BGP_STR
5873 "BGP neighbor address to clear\n"
5874 "Address family\n"
5875 "Address Family modifier\n"
5876 "Address Family modifier\n"
5877 "Soft reconfig inbound update\n")
5878
5879DEFUN (clear_ip_bgp_peer_ipv4_in_prefix_filter,
5880 clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd,
5881 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in prefix-filter",
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 "Address Family modifier\n"
5889 "Soft reconfig inbound update\n"
5890 "Push out the existing ORF prefix-list\n")
5891{
5892 if (strncmp (argv[1], "m", 1) == 0)
5893 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
5894 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5895
5896 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5897 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5898}
5899
5900DEFUN (clear_ip_bgp_peer_vpnv4_soft_in,
5901 clear_ip_bgp_peer_vpnv4_soft_in_cmd,
5902 "clear ip bgp A.B.C.D vpnv4 unicast soft in",
5903 CLEAR_STR
5904 IP_STR
5905 BGP_STR
5906 "BGP neighbor address to clear\n"
5907 "Address family\n"
5908 "Address Family Modifier\n"
5909 "Soft reconfig\n"
5910 "Soft reconfig inbound update\n")
5911{
5912 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
5913 BGP_CLEAR_SOFT_IN, argv[0]);
5914}
5915
5916ALIAS (clear_ip_bgp_peer_vpnv4_soft_in,
5917 clear_ip_bgp_peer_vpnv4_in_cmd,
5918 "clear ip bgp A.B.C.D vpnv4 unicast in",
5919 CLEAR_STR
5920 IP_STR
5921 BGP_STR
5922 "BGP neighbor address to clear\n"
5923 "Address family\n"
5924 "Address Family Modifier\n"
5925 "Soft reconfig inbound update\n")
5926
Lou Berger298cc2f2016-01-12 13:42:02 -05005927DEFUN (clear_ip_bgp_peer_encap_soft_in,
5928 clear_ip_bgp_peer_encap_soft_in_cmd,
5929 "clear ip bgp A.B.C.D encap unicast soft in",
5930 CLEAR_STR
5931 IP_STR
5932 BGP_STR
5933 "BGP neighbor address to clear\n"
5934 "Address family\n"
5935 "Address Family Modifier\n"
5936 "Soft reconfig\n"
5937 "Soft reconfig inbound update\n")
5938{
5939 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_peer,
5940 BGP_CLEAR_SOFT_IN, argv[0]);
5941}
5942
5943ALIAS (clear_ip_bgp_peer_encap_soft_in,
5944 clear_ip_bgp_peer_encap_in_cmd,
5945 "clear ip bgp A.B.C.D encap unicast in",
5946 CLEAR_STR
5947 IP_STR
5948 BGP_STR
5949 "BGP neighbor address to clear\n"
5950 "Address family\n"
5951 "Address Family Modifier\n"
5952 "Soft reconfig inbound update\n")
5953
paul718e3742002-12-13 20:15:29 +00005954DEFUN (clear_bgp_peer_soft_in,
5955 clear_bgp_peer_soft_in_cmd,
5956 "clear bgp (A.B.C.D|X:X::X:X) soft in",
5957 CLEAR_STR
5958 BGP_STR
5959 "BGP neighbor address to clear\n"
5960 "BGP IPv6 neighbor to clear\n"
5961 "Soft reconfig\n"
5962 "Soft reconfig inbound update\n")
5963{
5964 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
5965 BGP_CLEAR_SOFT_IN, argv[0]);
5966}
5967
5968ALIAS (clear_bgp_peer_soft_in,
5969 clear_bgp_ipv6_peer_soft_in_cmd,
5970 "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft in",
5971 CLEAR_STR
5972 BGP_STR
5973 "Address family\n"
5974 "BGP neighbor address to clear\n"
5975 "BGP IPv6 neighbor to clear\n"
5976 "Soft reconfig\n"
5977 "Soft reconfig inbound update\n")
5978
5979ALIAS (clear_bgp_peer_soft_in,
5980 clear_bgp_peer_in_cmd,
5981 "clear bgp (A.B.C.D|X:X::X:X) in",
5982 CLEAR_STR
5983 BGP_STR
5984 "BGP neighbor address to clear\n"
5985 "BGP IPv6 neighbor to clear\n"
5986 "Soft reconfig inbound update\n")
5987
5988ALIAS (clear_bgp_peer_soft_in,
5989 clear_bgp_ipv6_peer_in_cmd,
5990 "clear bgp ipv6 (A.B.C.D|X:X::X:X) in",
5991 CLEAR_STR
5992 BGP_STR
5993 "Address family\n"
5994 "BGP neighbor address to clear\n"
5995 "BGP IPv6 neighbor to clear\n"
5996 "Soft reconfig inbound update\n")
5997
5998DEFUN (clear_bgp_peer_in_prefix_filter,
5999 clear_bgp_peer_in_prefix_filter_cmd,
6000 "clear bgp (A.B.C.D|X:X::X:X) in prefix-filter",
6001 CLEAR_STR
6002 BGP_STR
6003 "BGP neighbor address to clear\n"
6004 "BGP IPv6 neighbor to clear\n"
6005 "Soft reconfig inbound update\n"
6006 "Push out the existing ORF prefix-list\n")
6007{
6008 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
6009 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6010}
6011
6012ALIAS (clear_bgp_peer_in_prefix_filter,
6013 clear_bgp_ipv6_peer_in_prefix_filter_cmd,
6014 "clear bgp ipv6 (A.B.C.D|X:X::X:X) in prefix-filter",
6015 CLEAR_STR
6016 BGP_STR
6017 "Address family\n"
6018 "BGP neighbor address to clear\n"
6019 "BGP IPv6 neighbor to clear\n"
6020 "Soft reconfig inbound update\n"
6021 "Push out the existing ORF prefix-list\n")
6022
6023DEFUN (clear_ip_bgp_peer_group_soft_in,
6024 clear_ip_bgp_peer_group_soft_in_cmd,
6025 "clear ip bgp peer-group WORD soft in",
6026 CLEAR_STR
6027 IP_STR
6028 BGP_STR
6029 "Clear all members of peer-group\n"
6030 "BGP peer-group name\n"
6031 "Soft reconfig\n"
6032 "Soft reconfig inbound update\n")
6033{
6034 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6035 BGP_CLEAR_SOFT_IN, argv[0]);
6036}
6037
6038ALIAS (clear_ip_bgp_peer_group_soft_in,
6039 clear_ip_bgp_peer_group_in_cmd,
6040 "clear ip bgp peer-group WORD in",
6041 CLEAR_STR
6042 IP_STR
6043 BGP_STR
6044 "Clear all members of peer-group\n"
6045 "BGP peer-group name\n"
6046 "Soft reconfig inbound update\n")
6047
6048DEFUN (clear_ip_bgp_peer_group_in_prefix_filter,
6049 clear_ip_bgp_peer_group_in_prefix_filter_cmd,
6050 "clear ip bgp peer-group WORD in prefix-filter",
6051 CLEAR_STR
6052 IP_STR
6053 BGP_STR
6054 "Clear all members of peer-group\n"
6055 "BGP peer-group name\n"
6056 "Soft reconfig inbound update\n"
6057 "Push out prefix-list ORF and do inbound soft reconfig\n")
6058{
6059 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6060 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6061}
6062
6063DEFUN (clear_ip_bgp_peer_group_ipv4_soft_in,
6064 clear_ip_bgp_peer_group_ipv4_soft_in_cmd,
6065 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft in",
6066 CLEAR_STR
6067 IP_STR
6068 BGP_STR
6069 "Clear all members of peer-group\n"
6070 "BGP peer-group name\n"
6071 "Address family\n"
6072 "Address Family modifier\n"
6073 "Address Family modifier\n"
6074 "Soft reconfig\n"
6075 "Soft reconfig inbound update\n")
6076{
6077 if (strncmp (argv[1], "m", 1) == 0)
6078 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
6079 BGP_CLEAR_SOFT_IN, argv[0]);
6080
6081 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6082 BGP_CLEAR_SOFT_IN, argv[0]);
6083}
6084
6085ALIAS (clear_ip_bgp_peer_group_ipv4_soft_in,
6086 clear_ip_bgp_peer_group_ipv4_in_cmd,
6087 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in",
6088 CLEAR_STR
6089 IP_STR
6090 BGP_STR
6091 "Clear all members of peer-group\n"
6092 "BGP peer-group name\n"
6093 "Address family\n"
6094 "Address Family modifier\n"
6095 "Address Family modifier\n"
6096 "Soft reconfig inbound update\n")
6097
6098DEFUN (clear_ip_bgp_peer_group_ipv4_in_prefix_filter,
6099 clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd,
6100 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in prefix-filter",
6101 CLEAR_STR
6102 IP_STR
6103 BGP_STR
6104 "Clear all members of peer-group\n"
6105 "BGP peer-group name\n"
6106 "Address family\n"
6107 "Address Family modifier\n"
6108 "Address Family modifier\n"
6109 "Soft reconfig inbound update\n"
6110 "Push out prefix-list ORF and do inbound soft reconfig\n")
6111{
6112 if (strncmp (argv[1], "m", 1) == 0)
6113 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
6114 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6115
6116 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6117 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6118}
6119
6120DEFUN (clear_bgp_peer_group_soft_in,
6121 clear_bgp_peer_group_soft_in_cmd,
6122 "clear bgp peer-group WORD soft in",
6123 CLEAR_STR
6124 BGP_STR
6125 "Clear all members of peer-group\n"
6126 "BGP peer-group name\n"
6127 "Soft reconfig\n"
6128 "Soft reconfig inbound update\n")
6129{
6130 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
6131 BGP_CLEAR_SOFT_IN, argv[0]);
6132}
6133
6134ALIAS (clear_bgp_peer_group_soft_in,
6135 clear_bgp_ipv6_peer_group_soft_in_cmd,
6136 "clear bgp ipv6 peer-group WORD soft in",
6137 CLEAR_STR
6138 BGP_STR
6139 "Address family\n"
6140 "Clear all members of peer-group\n"
6141 "BGP peer-group name\n"
6142 "Soft reconfig\n"
6143 "Soft reconfig inbound update\n")
6144
6145ALIAS (clear_bgp_peer_group_soft_in,
6146 clear_bgp_peer_group_in_cmd,
6147 "clear bgp peer-group WORD in",
6148 CLEAR_STR
6149 BGP_STR
6150 "Clear all members of peer-group\n"
6151 "BGP peer-group name\n"
6152 "Soft reconfig inbound update\n")
6153
6154ALIAS (clear_bgp_peer_group_soft_in,
6155 clear_bgp_ipv6_peer_group_in_cmd,
6156 "clear bgp ipv6 peer-group WORD in",
6157 CLEAR_STR
6158 BGP_STR
6159 "Address family\n"
6160 "Clear all members of peer-group\n"
6161 "BGP peer-group name\n"
6162 "Soft reconfig inbound update\n")
6163
6164DEFUN (clear_bgp_peer_group_in_prefix_filter,
6165 clear_bgp_peer_group_in_prefix_filter_cmd,
6166 "clear bgp peer-group WORD in prefix-filter",
6167 CLEAR_STR
6168 BGP_STR
6169 "Clear all members of peer-group\n"
6170 "BGP peer-group name\n"
6171 "Soft reconfig inbound update\n"
6172 "Push out prefix-list ORF and do inbound soft reconfig\n")
6173{
6174 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
6175 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6176}
6177
6178ALIAS (clear_bgp_peer_group_in_prefix_filter,
6179 clear_bgp_ipv6_peer_group_in_prefix_filter_cmd,
6180 "clear bgp ipv6 peer-group WORD in prefix-filter",
6181 CLEAR_STR
6182 BGP_STR
6183 "Address family\n"
6184 "Clear all members of peer-group\n"
6185 "BGP peer-group name\n"
6186 "Soft reconfig inbound update\n"
6187 "Push out prefix-list ORF and do inbound soft reconfig\n")
6188
6189DEFUN (clear_ip_bgp_external_soft_in,
6190 clear_ip_bgp_external_soft_in_cmd,
6191 "clear ip bgp external soft in",
6192 CLEAR_STR
6193 IP_STR
6194 BGP_STR
6195 "Clear all external peers\n"
6196 "Soft reconfig\n"
6197 "Soft reconfig inbound update\n")
6198{
6199 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6200 BGP_CLEAR_SOFT_IN, NULL);
6201}
6202
6203ALIAS (clear_ip_bgp_external_soft_in,
6204 clear_ip_bgp_external_in_cmd,
6205 "clear ip bgp external in",
6206 CLEAR_STR
6207 IP_STR
6208 BGP_STR
6209 "Clear all external peers\n"
6210 "Soft reconfig inbound update\n")
6211
6212DEFUN (clear_ip_bgp_external_in_prefix_filter,
6213 clear_ip_bgp_external_in_prefix_filter_cmd,
6214 "clear ip bgp external in prefix-filter",
6215 CLEAR_STR
6216 IP_STR
6217 BGP_STR
6218 "Clear all external peers\n"
6219 "Soft reconfig inbound update\n"
6220 "Push out prefix-list ORF and do inbound soft reconfig\n")
6221{
6222 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6223 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
6224}
6225
6226DEFUN (clear_ip_bgp_external_ipv4_soft_in,
6227 clear_ip_bgp_external_ipv4_soft_in_cmd,
6228 "clear ip bgp external ipv4 (unicast|multicast) soft in",
6229 CLEAR_STR
6230 IP_STR
6231 BGP_STR
6232 "Clear all external peers\n"
6233 "Address family\n"
6234 "Address Family modifier\n"
6235 "Address Family modifier\n"
6236 "Soft reconfig\n"
6237 "Soft reconfig inbound update\n")
6238{
6239 if (strncmp (argv[0], "m", 1) == 0)
6240 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
6241 BGP_CLEAR_SOFT_IN, NULL);
6242
6243 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6244 BGP_CLEAR_SOFT_IN, NULL);
6245}
6246
6247ALIAS (clear_ip_bgp_external_ipv4_soft_in,
6248 clear_ip_bgp_external_ipv4_in_cmd,
6249 "clear ip bgp external ipv4 (unicast|multicast) in",
6250 CLEAR_STR
6251 IP_STR
6252 BGP_STR
6253 "Clear all external peers\n"
6254 "Address family\n"
6255 "Address Family modifier\n"
6256 "Address Family modifier\n"
6257 "Soft reconfig inbound update\n")
6258
6259DEFUN (clear_ip_bgp_external_ipv4_in_prefix_filter,
6260 clear_ip_bgp_external_ipv4_in_prefix_filter_cmd,
6261 "clear ip bgp external ipv4 (unicast|multicast) in prefix-filter",
6262 CLEAR_STR
6263 IP_STR
6264 BGP_STR
6265 "Clear all external peers\n"
6266 "Address family\n"
6267 "Address Family modifier\n"
6268 "Address Family modifier\n"
6269 "Soft reconfig inbound update\n"
6270 "Push out prefix-list ORF and do inbound soft reconfig\n")
6271{
6272 if (strncmp (argv[0], "m", 1) == 0)
6273 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
6274 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
6275
6276 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6277 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
6278}
6279
6280DEFUN (clear_bgp_external_soft_in,
6281 clear_bgp_external_soft_in_cmd,
6282 "clear bgp external soft in",
6283 CLEAR_STR
6284 BGP_STR
6285 "Clear all external peers\n"
6286 "Soft reconfig\n"
6287 "Soft reconfig inbound update\n")
6288{
6289 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
6290 BGP_CLEAR_SOFT_IN, NULL);
6291}
6292
6293ALIAS (clear_bgp_external_soft_in,
6294 clear_bgp_ipv6_external_soft_in_cmd,
6295 "clear bgp ipv6 external soft in",
6296 CLEAR_STR
6297 BGP_STR
6298 "Address family\n"
6299 "Clear all external peers\n"
6300 "Soft reconfig\n"
6301 "Soft reconfig inbound update\n")
6302
6303ALIAS (clear_bgp_external_soft_in,
6304 clear_bgp_external_in_cmd,
6305 "clear bgp external in",
6306 CLEAR_STR
6307 BGP_STR
6308 "Clear all external peers\n"
6309 "Soft reconfig inbound update\n")
6310
6311ALIAS (clear_bgp_external_soft_in,
6312 clear_bgp_ipv6_external_in_cmd,
6313 "clear bgp ipv6 external WORD in",
6314 CLEAR_STR
6315 BGP_STR
6316 "Address family\n"
6317 "Clear all external peers\n"
6318 "Soft reconfig inbound update\n")
6319
6320DEFUN (clear_bgp_external_in_prefix_filter,
6321 clear_bgp_external_in_prefix_filter_cmd,
6322 "clear bgp external in prefix-filter",
6323 CLEAR_STR
6324 BGP_STR
6325 "Clear all external peers\n"
6326 "Soft reconfig inbound update\n"
6327 "Push out prefix-list ORF and do inbound soft reconfig\n")
6328{
6329 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
6330 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
6331}
6332
6333ALIAS (clear_bgp_external_in_prefix_filter,
6334 clear_bgp_ipv6_external_in_prefix_filter_cmd,
6335 "clear bgp ipv6 external in prefix-filter",
6336 CLEAR_STR
6337 BGP_STR
6338 "Address family\n"
6339 "Clear all external peers\n"
6340 "Soft reconfig inbound update\n"
6341 "Push out prefix-list ORF and do inbound soft reconfig\n")
6342
6343DEFUN (clear_ip_bgp_as_soft_in,
6344 clear_ip_bgp_as_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006345 "clear ip bgp " CMD_AS_RANGE " 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 "Soft reconfig\n"
6351 "Soft reconfig inbound update\n")
6352{
6353 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6354 BGP_CLEAR_SOFT_IN, argv[0]);
6355}
6356
6357ALIAS (clear_ip_bgp_as_soft_in,
6358 clear_ip_bgp_as_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006359 "clear ip bgp " CMD_AS_RANGE " in",
paul718e3742002-12-13 20:15:29 +00006360 CLEAR_STR
6361 IP_STR
6362 BGP_STR
6363 "Clear peers with the AS number\n"
6364 "Soft reconfig inbound update\n")
6365
6366DEFUN (clear_ip_bgp_as_in_prefix_filter,
6367 clear_ip_bgp_as_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006368 "clear ip bgp " CMD_AS_RANGE " in prefix-filter",
paul718e3742002-12-13 20:15:29 +00006369 CLEAR_STR
6370 IP_STR
6371 BGP_STR
6372 "Clear peers with the AS number\n"
6373 "Soft reconfig inbound update\n"
6374 "Push out prefix-list ORF and do inbound soft reconfig\n")
6375{
6376 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6377 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6378}
6379
6380DEFUN (clear_ip_bgp_as_ipv4_soft_in,
6381 clear_ip_bgp_as_ipv4_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006382 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft in",
paul718e3742002-12-13 20:15:29 +00006383 CLEAR_STR
6384 IP_STR
6385 BGP_STR
6386 "Clear peers with the AS number\n"
6387 "Address family\n"
6388 "Address Family modifier\n"
6389 "Address Family modifier\n"
6390 "Soft reconfig\n"
6391 "Soft reconfig inbound update\n")
6392{
6393 if (strncmp (argv[1], "m", 1) == 0)
6394 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
6395 BGP_CLEAR_SOFT_IN, argv[0]);
6396
6397 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6398 BGP_CLEAR_SOFT_IN, argv[0]);
6399}
6400
6401ALIAS (clear_ip_bgp_as_ipv4_soft_in,
6402 clear_ip_bgp_as_ipv4_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006403 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in",
paul718e3742002-12-13 20:15:29 +00006404 CLEAR_STR
6405 IP_STR
6406 BGP_STR
6407 "Clear peers with the AS number\n"
6408 "Address family\n"
6409 "Address Family modifier\n"
6410 "Address Family modifier\n"
6411 "Soft reconfig inbound update\n")
6412
6413DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter,
6414 clear_ip_bgp_as_ipv4_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006415 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in prefix-filter",
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 "Address Family modifier\n"
6423 "Soft reconfig inbound update\n"
6424 "Push out prefix-list ORF and do inbound soft reconfig\n")
6425{
6426 if (strncmp (argv[1], "m", 1) == 0)
6427 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
6428 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6429
6430 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6431 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6432}
6433
6434DEFUN (clear_ip_bgp_as_vpnv4_soft_in,
6435 clear_ip_bgp_as_vpnv4_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006436 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft in",
paul718e3742002-12-13 20:15:29 +00006437 CLEAR_STR
6438 IP_STR
6439 BGP_STR
6440 "Clear peers with the AS number\n"
6441 "Address family\n"
6442 "Address Family modifier\n"
6443 "Soft reconfig\n"
6444 "Soft reconfig inbound update\n")
6445{
6446 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
6447 BGP_CLEAR_SOFT_IN, argv[0]);
6448}
6449
6450ALIAS (clear_ip_bgp_as_vpnv4_soft_in,
6451 clear_ip_bgp_as_vpnv4_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006452 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast in",
paul718e3742002-12-13 20:15:29 +00006453 CLEAR_STR
6454 IP_STR
6455 BGP_STR
6456 "Clear peers with the AS number\n"
6457 "Address family\n"
6458 "Address Family modifier\n"
6459 "Soft reconfig inbound update\n")
6460
Lou Berger298cc2f2016-01-12 13:42:02 -05006461DEFUN (clear_ip_bgp_as_encap_soft_in,
6462 clear_ip_bgp_as_encap_soft_in_cmd,
6463 "clear ip bgp " CMD_AS_RANGE " encap unicast soft in",
6464 CLEAR_STR
6465 IP_STR
6466 BGP_STR
6467 "Clear peers with the AS number\n"
6468 "Address family\n"
6469 "Address Family modifier\n"
6470 "Soft reconfig\n"
6471 "Soft reconfig inbound update\n")
6472{
6473 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_as,
6474 BGP_CLEAR_SOFT_IN, argv[0]);
6475}
6476
6477ALIAS (clear_ip_bgp_as_encap_soft_in,
6478 clear_ip_bgp_as_encap_in_cmd,
6479 "clear ip bgp " CMD_AS_RANGE " encap unicast in",
6480 CLEAR_STR
6481 IP_STR
6482 BGP_STR
6483 "Clear peers with the AS number\n"
6484 "Address family\n"
6485 "Address Family modifier\n"
6486 "Soft reconfig inbound update\n")
6487
paul718e3742002-12-13 20:15:29 +00006488DEFUN (clear_bgp_as_soft_in,
6489 clear_bgp_as_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006490 "clear bgp " CMD_AS_RANGE " soft in",
paul718e3742002-12-13 20:15:29 +00006491 CLEAR_STR
6492 BGP_STR
6493 "Clear peers with the AS number\n"
6494 "Soft reconfig\n"
6495 "Soft reconfig inbound update\n")
6496{
6497 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
6498 BGP_CLEAR_SOFT_IN, argv[0]);
6499}
6500
6501ALIAS (clear_bgp_as_soft_in,
6502 clear_bgp_ipv6_as_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006503 "clear bgp ipv6 " CMD_AS_RANGE " soft in",
paul718e3742002-12-13 20:15:29 +00006504 CLEAR_STR
6505 BGP_STR
6506 "Address family\n"
6507 "Clear peers with the AS number\n"
6508 "Soft reconfig\n"
6509 "Soft reconfig inbound update\n")
6510
6511ALIAS (clear_bgp_as_soft_in,
6512 clear_bgp_as_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006513 "clear bgp " CMD_AS_RANGE " in",
paul718e3742002-12-13 20:15:29 +00006514 CLEAR_STR
6515 BGP_STR
6516 "Clear peers with the AS number\n"
6517 "Soft reconfig inbound update\n")
6518
6519ALIAS (clear_bgp_as_soft_in,
6520 clear_bgp_ipv6_as_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006521 "clear bgp ipv6 " CMD_AS_RANGE " in",
paul718e3742002-12-13 20:15:29 +00006522 CLEAR_STR
6523 BGP_STR
6524 "Address family\n"
6525 "Clear peers with the AS number\n"
6526 "Soft reconfig inbound update\n")
6527
6528DEFUN (clear_bgp_as_in_prefix_filter,
6529 clear_bgp_as_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006530 "clear bgp " CMD_AS_RANGE " in prefix-filter",
paul718e3742002-12-13 20:15:29 +00006531 CLEAR_STR
6532 BGP_STR
6533 "Clear peers with the AS number\n"
6534 "Soft reconfig inbound update\n"
6535 "Push out prefix-list ORF and do inbound soft reconfig\n")
6536{
6537 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
6538 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6539}
6540
6541ALIAS (clear_bgp_as_in_prefix_filter,
6542 clear_bgp_ipv6_as_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006543 "clear bgp ipv6 " CMD_AS_RANGE " in prefix-filter",
paul718e3742002-12-13 20:15:29 +00006544 CLEAR_STR
6545 BGP_STR
6546 "Address family\n"
6547 "Clear peers with the AS number\n"
6548 "Soft reconfig inbound update\n"
6549 "Push out prefix-list ORF and do inbound soft reconfig\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02006550
paul718e3742002-12-13 20:15:29 +00006551/* Both soft-reconfiguration */
6552DEFUN (clear_ip_bgp_all_soft,
6553 clear_ip_bgp_all_soft_cmd,
6554 "clear ip bgp * soft",
6555 CLEAR_STR
6556 IP_STR
6557 BGP_STR
6558 "Clear all peers\n"
6559 "Soft reconfig\n")
6560{
6561 if (argc == 1)
6562 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
6563 BGP_CLEAR_SOFT_BOTH, NULL);
6564
6565 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6566 BGP_CLEAR_SOFT_BOTH, NULL);
6567}
6568
6569ALIAS (clear_ip_bgp_all_soft,
6570 clear_ip_bgp_instance_all_soft_cmd,
6571 "clear ip bgp view WORD * soft",
6572 CLEAR_STR
6573 IP_STR
6574 BGP_STR
6575 "BGP view\n"
6576 "view name\n"
6577 "Clear all peers\n"
6578 "Soft reconfig\n")
6579
6580
6581DEFUN (clear_ip_bgp_all_ipv4_soft,
6582 clear_ip_bgp_all_ipv4_soft_cmd,
6583 "clear ip bgp * ipv4 (unicast|multicast) soft",
6584 CLEAR_STR
6585 IP_STR
6586 BGP_STR
6587 "Clear all peers\n"
6588 "Address family\n"
6589 "Address Family Modifier\n"
6590 "Address Family Modifier\n"
6591 "Soft reconfig\n")
6592{
6593 if (strncmp (argv[0], "m", 1) == 0)
6594 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
6595 BGP_CLEAR_SOFT_BOTH, NULL);
6596
6597 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6598 BGP_CLEAR_SOFT_BOTH, NULL);
6599}
6600
6601DEFUN (clear_ip_bgp_instance_all_ipv4_soft,
6602 clear_ip_bgp_instance_all_ipv4_soft_cmd,
6603 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft",
6604 CLEAR_STR
6605 IP_STR
6606 BGP_STR
6607 "BGP view\n"
6608 "view name\n"
6609 "Clear all peers\n"
6610 "Address family\n"
6611 "Address Family Modifier\n"
6612 "Address Family Modifier\n"
6613 "Soft reconfig\n")
6614{
6615 if (strncmp (argv[1], "m", 1) == 0)
6616 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
6617 BGP_CLEAR_SOFT_BOTH, NULL);
6618
6619 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6620 BGP_CLEAR_SOFT_BOTH, NULL);
6621}
6622
6623DEFUN (clear_ip_bgp_all_vpnv4_soft,
6624 clear_ip_bgp_all_vpnv4_soft_cmd,
6625 "clear ip bgp * vpnv4 unicast soft",
6626 CLEAR_STR
6627 IP_STR
6628 BGP_STR
6629 "Clear all peers\n"
6630 "Address family\n"
6631 "Address Family Modifier\n"
6632 "Soft reconfig\n")
6633{
6634 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
6635 BGP_CLEAR_SOFT_BOTH, argv[0]);
6636}
6637
Lou Berger298cc2f2016-01-12 13:42:02 -05006638DEFUN (clear_ip_bgp_all_encap_soft,
6639 clear_ip_bgp_all_encap_soft_cmd,
6640 "clear ip bgp * encap unicast soft",
6641 CLEAR_STR
6642 IP_STR
6643 BGP_STR
6644 "Clear all peers\n"
6645 "Address family\n"
6646 "Address Family Modifier\n"
6647 "Soft reconfig\n")
6648{
6649 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_all,
6650 BGP_CLEAR_SOFT_BOTH, argv[0]);
6651}
6652
paul718e3742002-12-13 20:15:29 +00006653DEFUN (clear_bgp_all_soft,
6654 clear_bgp_all_soft_cmd,
6655 "clear bgp * soft",
6656 CLEAR_STR
6657 BGP_STR
6658 "Clear all peers\n"
6659 "Soft reconfig\n")
6660{
6661 if (argc == 1)
6662 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
6663 BGP_CLEAR_SOFT_BOTH, argv[0]);
6664
6665 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
6666 BGP_CLEAR_SOFT_BOTH, argv[0]);
6667}
6668
6669ALIAS (clear_bgp_all_soft,
6670 clear_bgp_instance_all_soft_cmd,
6671 "clear bgp view WORD * soft",
6672 CLEAR_STR
6673 BGP_STR
6674 "BGP view\n"
6675 "view name\n"
6676 "Clear all peers\n"
6677 "Soft reconfig\n")
6678
6679ALIAS (clear_bgp_all_soft,
6680 clear_bgp_ipv6_all_soft_cmd,
6681 "clear bgp ipv6 * soft",
6682 CLEAR_STR
6683 BGP_STR
6684 "Address family\n"
6685 "Clear all peers\n"
6686 "Soft reconfig\n")
6687
6688DEFUN (clear_ip_bgp_peer_soft,
6689 clear_ip_bgp_peer_soft_cmd,
6690 "clear ip bgp A.B.C.D soft",
6691 CLEAR_STR
6692 IP_STR
6693 BGP_STR
6694 "BGP neighbor address to clear\n"
6695 "Soft reconfig\n")
6696{
6697 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6698 BGP_CLEAR_SOFT_BOTH, argv[0]);
6699}
6700
6701DEFUN (clear_ip_bgp_peer_ipv4_soft,
6702 clear_ip_bgp_peer_ipv4_soft_cmd,
6703 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft",
6704 CLEAR_STR
6705 IP_STR
6706 BGP_STR
6707 "BGP neighbor address to clear\n"
6708 "Address family\n"
6709 "Address Family Modifier\n"
6710 "Address Family Modifier\n"
6711 "Soft reconfig\n")
6712{
6713 if (strncmp (argv[1], "m", 1) == 0)
6714 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
6715 BGP_CLEAR_SOFT_BOTH, argv[0]);
6716
6717 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6718 BGP_CLEAR_SOFT_BOTH, argv[0]);
6719}
6720
6721DEFUN (clear_ip_bgp_peer_vpnv4_soft,
6722 clear_ip_bgp_peer_vpnv4_soft_cmd,
6723 "clear ip bgp A.B.C.D vpnv4 unicast soft",
6724 CLEAR_STR
6725 IP_STR
6726 BGP_STR
6727 "BGP neighbor address to clear\n"
6728 "Address family\n"
6729 "Address Family Modifier\n"
6730 "Soft reconfig\n")
6731{
6732 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
6733 BGP_CLEAR_SOFT_BOTH, argv[0]);
6734}
6735
Lou Berger298cc2f2016-01-12 13:42:02 -05006736DEFUN (clear_ip_bgp_peer_encap_soft,
6737 clear_ip_bgp_peer_encap_soft_cmd,
6738 "clear ip bgp A.B.C.D encap unicast soft",
6739 CLEAR_STR
6740 IP_STR
6741 BGP_STR
6742 "BGP neighbor address to clear\n"
6743 "Address family\n"
6744 "Address Family Modifier\n"
6745 "Soft reconfig\n")
6746{
6747 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_peer,
6748 BGP_CLEAR_SOFT_BOTH, argv[0]);
6749}
6750
paul718e3742002-12-13 20:15:29 +00006751DEFUN (clear_bgp_peer_soft,
6752 clear_bgp_peer_soft_cmd,
6753 "clear bgp (A.B.C.D|X:X::X:X) soft",
6754 CLEAR_STR
6755 BGP_STR
6756 "BGP neighbor address to clear\n"
6757 "BGP IPv6 neighbor to clear\n"
6758 "Soft reconfig\n")
6759{
6760 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
6761 BGP_CLEAR_SOFT_BOTH, argv[0]);
6762}
6763
6764ALIAS (clear_bgp_peer_soft,
6765 clear_bgp_ipv6_peer_soft_cmd,
6766 "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft",
6767 CLEAR_STR
6768 BGP_STR
6769 "Address family\n"
6770 "BGP neighbor address to clear\n"
6771 "BGP IPv6 neighbor to clear\n"
6772 "Soft reconfig\n")
6773
6774DEFUN (clear_ip_bgp_peer_group_soft,
6775 clear_ip_bgp_peer_group_soft_cmd,
6776 "clear ip bgp peer-group WORD soft",
6777 CLEAR_STR
6778 IP_STR
6779 BGP_STR
6780 "Clear all members of peer-group\n"
6781 "BGP peer-group name\n"
6782 "Soft reconfig\n")
6783{
6784 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6785 BGP_CLEAR_SOFT_BOTH, argv[0]);
6786}
6787
6788DEFUN (clear_ip_bgp_peer_group_ipv4_soft,
6789 clear_ip_bgp_peer_group_ipv4_soft_cmd,
6790 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft",
6791 CLEAR_STR
6792 IP_STR
6793 BGP_STR
6794 "Clear all members of peer-group\n"
6795 "BGP peer-group name\n"
6796 "Address family\n"
6797 "Address Family modifier\n"
6798 "Address Family modifier\n"
6799 "Soft reconfig\n")
6800{
6801 if (strncmp (argv[1], "m", 1) == 0)
6802 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
6803 BGP_CLEAR_SOFT_BOTH, argv[0]);
6804
6805 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6806 BGP_CLEAR_SOFT_BOTH, argv[0]);
6807}
6808
6809DEFUN (clear_bgp_peer_group_soft,
6810 clear_bgp_peer_group_soft_cmd,
6811 "clear bgp peer-group WORD soft",
6812 CLEAR_STR
6813 BGP_STR
6814 "Clear all members of peer-group\n"
6815 "BGP peer-group name\n"
6816 "Soft reconfig\n")
6817{
6818 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
6819 BGP_CLEAR_SOFT_BOTH, argv[0]);
6820}
6821
6822ALIAS (clear_bgp_peer_group_soft,
6823 clear_bgp_ipv6_peer_group_soft_cmd,
6824 "clear bgp ipv6 peer-group WORD soft",
6825 CLEAR_STR
6826 BGP_STR
6827 "Address family\n"
6828 "Clear all members of peer-group\n"
6829 "BGP peer-group name\n"
6830 "Soft reconfig\n")
6831
6832DEFUN (clear_ip_bgp_external_soft,
6833 clear_ip_bgp_external_soft_cmd,
6834 "clear ip bgp external soft",
6835 CLEAR_STR
6836 IP_STR
6837 BGP_STR
6838 "Clear all external peers\n"
6839 "Soft reconfig\n")
6840{
6841 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6842 BGP_CLEAR_SOFT_BOTH, NULL);
6843}
6844
6845DEFUN (clear_ip_bgp_external_ipv4_soft,
6846 clear_ip_bgp_external_ipv4_soft_cmd,
6847 "clear ip bgp external ipv4 (unicast|multicast) soft",
6848 CLEAR_STR
6849 IP_STR
6850 BGP_STR
6851 "Clear all external peers\n"
6852 "Address family\n"
6853 "Address Family modifier\n"
6854 "Address Family modifier\n"
6855 "Soft reconfig\n")
6856{
6857 if (strncmp (argv[0], "m", 1) == 0)
6858 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
6859 BGP_CLEAR_SOFT_BOTH, NULL);
6860
6861 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6862 BGP_CLEAR_SOFT_BOTH, NULL);
6863}
6864
6865DEFUN (clear_bgp_external_soft,
6866 clear_bgp_external_soft_cmd,
6867 "clear bgp external soft",
6868 CLEAR_STR
6869 BGP_STR
6870 "Clear all external peers\n"
6871 "Soft reconfig\n")
6872{
6873 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
6874 BGP_CLEAR_SOFT_BOTH, NULL);
6875}
6876
6877ALIAS (clear_bgp_external_soft,
6878 clear_bgp_ipv6_external_soft_cmd,
6879 "clear bgp ipv6 external soft",
6880 CLEAR_STR
6881 BGP_STR
6882 "Address family\n"
6883 "Clear all external peers\n"
6884 "Soft reconfig\n")
6885
6886DEFUN (clear_ip_bgp_as_soft,
6887 clear_ip_bgp_as_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006888 "clear ip bgp " CMD_AS_RANGE " soft",
paul718e3742002-12-13 20:15:29 +00006889 CLEAR_STR
6890 IP_STR
6891 BGP_STR
6892 "Clear peers with the AS number\n"
6893 "Soft reconfig\n")
6894{
6895 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6896 BGP_CLEAR_SOFT_BOTH, argv[0]);
6897}
6898
6899DEFUN (clear_ip_bgp_as_ipv4_soft,
6900 clear_ip_bgp_as_ipv4_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006901 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft",
paul718e3742002-12-13 20:15:29 +00006902 CLEAR_STR
6903 IP_STR
6904 BGP_STR
6905 "Clear peers with the AS number\n"
6906 "Address family\n"
6907 "Address Family Modifier\n"
6908 "Address Family Modifier\n"
6909 "Soft reconfig\n")
6910{
6911 if (strncmp (argv[1], "m", 1) == 0)
6912 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
6913 BGP_CLEAR_SOFT_BOTH, argv[0]);
6914
6915 return bgp_clear_vty (vty, NULL,AFI_IP, SAFI_UNICAST, clear_as,
6916 BGP_CLEAR_SOFT_BOTH, argv[0]);
6917}
6918
6919DEFUN (clear_ip_bgp_as_vpnv4_soft,
6920 clear_ip_bgp_as_vpnv4_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006921 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft",
paul718e3742002-12-13 20:15:29 +00006922 CLEAR_STR
6923 IP_STR
6924 BGP_STR
6925 "Clear peers with the AS number\n"
6926 "Address family\n"
6927 "Address Family Modifier\n"
6928 "Soft reconfig\n")
6929{
6930 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
6931 BGP_CLEAR_SOFT_BOTH, argv[0]);
6932}
6933
Lou Berger298cc2f2016-01-12 13:42:02 -05006934DEFUN (clear_ip_bgp_as_encap_soft,
6935 clear_ip_bgp_as_encap_soft_cmd,
6936 "clear ip bgp " CMD_AS_RANGE " encap unicast soft",
6937 CLEAR_STR
6938 IP_STR
6939 BGP_STR
6940 "Clear peers with the AS number\n"
6941 "Address family\n"
6942 "Address Family Modifier\n"
6943 "Soft reconfig\n")
6944{
6945 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_as,
6946 BGP_CLEAR_SOFT_BOTH, argv[0]);
6947}
6948
paul718e3742002-12-13 20:15:29 +00006949DEFUN (clear_bgp_as_soft,
6950 clear_bgp_as_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006951 "clear bgp " CMD_AS_RANGE " soft",
paul718e3742002-12-13 20:15:29 +00006952 CLEAR_STR
6953 BGP_STR
6954 "Clear peers with the AS number\n"
6955 "Soft reconfig\n")
6956{
6957 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
6958 BGP_CLEAR_SOFT_BOTH, argv[0]);
6959}
6960
6961ALIAS (clear_bgp_as_soft,
6962 clear_bgp_ipv6_as_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006963 "clear bgp ipv6 " CMD_AS_RANGE " soft",
paul718e3742002-12-13 20:15:29 +00006964 CLEAR_STR
6965 BGP_STR
6966 "Address family\n"
6967 "Clear peers with the AS number\n"
6968 "Soft reconfig\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02006969
paulfee0f4c2004-09-13 05:12:46 +00006970/* RS-client soft reconfiguration. */
paulfee0f4c2004-09-13 05:12:46 +00006971DEFUN (clear_bgp_all_rsclient,
6972 clear_bgp_all_rsclient_cmd,
6973 "clear bgp * rsclient",
6974 CLEAR_STR
6975 BGP_STR
6976 "Clear all peers\n"
6977 "Soft reconfig for rsclient RIB\n")
6978{
6979 if (argc == 1)
6980 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
6981 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6982
6983 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
6984 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6985}
6986
6987ALIAS (clear_bgp_all_rsclient,
6988 clear_bgp_ipv6_all_rsclient_cmd,
6989 "clear bgp ipv6 * rsclient",
6990 CLEAR_STR
6991 BGP_STR
6992 "Address family\n"
6993 "Clear all peers\n"
6994 "Soft reconfig for rsclient RIB\n")
6995
6996ALIAS (clear_bgp_all_rsclient,
6997 clear_bgp_instance_all_rsclient_cmd,
6998 "clear bgp view WORD * rsclient",
6999 CLEAR_STR
7000 BGP_STR
7001 "BGP view\n"
7002 "view name\n"
7003 "Clear all peers\n"
7004 "Soft reconfig for rsclient RIB\n")
7005
7006ALIAS (clear_bgp_all_rsclient,
7007 clear_bgp_ipv6_instance_all_rsclient_cmd,
7008 "clear bgp ipv6 view WORD * rsclient",
7009 CLEAR_STR
7010 BGP_STR
7011 "Address family\n"
7012 "BGP view\n"
7013 "view name\n"
7014 "Clear all peers\n"
7015 "Soft reconfig for rsclient RIB\n")
paulfee0f4c2004-09-13 05:12:46 +00007016
7017DEFUN (clear_ip_bgp_all_rsclient,
7018 clear_ip_bgp_all_rsclient_cmd,
7019 "clear ip bgp * rsclient",
7020 CLEAR_STR
7021 IP_STR
7022 BGP_STR
7023 "Clear all peers\n"
7024 "Soft reconfig for rsclient RIB\n")
7025{
7026 if (argc == 1)
7027 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
7028 BGP_CLEAR_SOFT_RSCLIENT, NULL);
7029
7030 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
7031 BGP_CLEAR_SOFT_RSCLIENT, NULL);
7032}
7033
7034ALIAS (clear_ip_bgp_all_rsclient,
7035 clear_ip_bgp_instance_all_rsclient_cmd,
7036 "clear ip bgp view WORD * rsclient",
7037 CLEAR_STR
7038 IP_STR
7039 BGP_STR
7040 "BGP view\n"
7041 "view name\n"
7042 "Clear all peers\n"
7043 "Soft reconfig for rsclient RIB\n")
7044
paulfee0f4c2004-09-13 05:12:46 +00007045DEFUN (clear_bgp_peer_rsclient,
7046 clear_bgp_peer_rsclient_cmd,
7047 "clear bgp (A.B.C.D|X:X::X:X) rsclient",
7048 CLEAR_STR
7049 BGP_STR
7050 "BGP neighbor IP address to clear\n"
7051 "BGP IPv6 neighbor to clear\n"
7052 "Soft reconfig for rsclient RIB\n")
7053{
7054 if (argc == 2)
7055 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_peer,
7056 BGP_CLEAR_SOFT_RSCLIENT, argv[1]);
7057
7058 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
7059 BGP_CLEAR_SOFT_RSCLIENT, argv[0]);
7060}
7061
7062ALIAS (clear_bgp_peer_rsclient,
7063 clear_bgp_ipv6_peer_rsclient_cmd,
7064 "clear bgp ipv6 (A.B.C.D|X:X::X:X) rsclient",
7065 CLEAR_STR
7066 BGP_STR
7067 "Address family\n"
7068 "BGP neighbor IP address to clear\n"
7069 "BGP IPv6 neighbor to clear\n"
7070 "Soft reconfig for rsclient RIB\n")
7071
7072ALIAS (clear_bgp_peer_rsclient,
7073 clear_bgp_instance_peer_rsclient_cmd,
7074 "clear bgp view WORD (A.B.C.D|X:X::X:X) rsclient",
7075 CLEAR_STR
7076 BGP_STR
7077 "BGP view\n"
7078 "view name\n"
7079 "BGP neighbor IP address to clear\n"
7080 "BGP IPv6 neighbor to clear\n"
7081 "Soft reconfig for rsclient RIB\n")
7082
7083ALIAS (clear_bgp_peer_rsclient,
7084 clear_bgp_ipv6_instance_peer_rsclient_cmd,
7085 "clear bgp ipv6 view WORD (A.B.C.D|X:X::X:X) rsclient",
7086 CLEAR_STR
7087 BGP_STR
7088 "Address family\n"
7089 "BGP view\n"
7090 "view name\n"
7091 "BGP neighbor IP address to clear\n"
7092 "BGP IPv6 neighbor to clear\n"
7093 "Soft reconfig for rsclient RIB\n")
paulfee0f4c2004-09-13 05:12:46 +00007094
7095DEFUN (clear_ip_bgp_peer_rsclient,
7096 clear_ip_bgp_peer_rsclient_cmd,
7097 "clear ip bgp (A.B.C.D|X:X::X:X) rsclient",
7098 CLEAR_STR
7099 IP_STR
7100 BGP_STR
7101 "BGP neighbor IP address to clear\n"
7102 "BGP IPv6 neighbor to clear\n"
7103 "Soft reconfig for rsclient RIB\n")
7104{
7105 if (argc == 2)
7106 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_peer,
7107 BGP_CLEAR_SOFT_RSCLIENT, argv[1]);
7108
7109 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
7110 BGP_CLEAR_SOFT_RSCLIENT, argv[0]);
7111}
7112
7113ALIAS (clear_ip_bgp_peer_rsclient,
7114 clear_ip_bgp_instance_peer_rsclient_cmd,
7115 "clear ip bgp view WORD (A.B.C.D|X:X::X:X) rsclient",
7116 CLEAR_STR
7117 IP_STR
7118 BGP_STR
7119 "BGP view\n"
7120 "view name\n"
7121 "BGP neighbor IP address to clear\n"
7122 "BGP IPv6 neighbor to clear\n"
7123 "Soft reconfig for rsclient RIB\n")
7124
Michael Lamberte0081f72008-11-16 20:12:04 +00007125DEFUN (show_bgp_views,
7126 show_bgp_views_cmd,
7127 "show bgp views",
7128 SHOW_STR
7129 BGP_STR
7130 "Show the defined BGP views\n")
7131{
7132 struct list *inst = bm->bgp;
7133 struct listnode *node;
7134 struct bgp *bgp;
7135
7136 if (!bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE))
7137 {
7138 vty_out (vty, "Multiple BGP views are not defined%s", VTY_NEWLINE);
7139 return CMD_WARNING;
7140 }
7141
7142 vty_out (vty, "Defined BGP views:%s", VTY_NEWLINE);
7143 for (ALL_LIST_ELEMENTS_RO(inst, node, bgp))
7144 vty_out (vty, "\t%s (AS%u)%s",
7145 bgp->name ? bgp->name : "(null)",
7146 bgp->as, VTY_NEWLINE);
7147
7148 return CMD_SUCCESS;
7149}
7150
Paul Jakma4bf6a362006-03-30 14:05:23 +00007151DEFUN (show_bgp_memory,
7152 show_bgp_memory_cmd,
7153 "show bgp memory",
7154 SHOW_STR
7155 BGP_STR
7156 "Global BGP memory statistics\n")
7157{
7158 char memstrbuf[MTYPE_MEMSTR_LEN];
7159 unsigned long count;
7160
7161 /* RIB related usage stats */
7162 count = mtype_stats_alloc (MTYPE_BGP_NODE);
7163 vty_out (vty, "%ld RIB nodes, using %s of memory%s", count,
7164 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7165 count * sizeof (struct bgp_node)),
7166 VTY_NEWLINE);
7167
7168 count = mtype_stats_alloc (MTYPE_BGP_ROUTE);
7169 vty_out (vty, "%ld BGP routes, using %s of memory%s", count,
7170 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7171 count * sizeof (struct bgp_info)),
7172 VTY_NEWLINE);
Paul Jakmafb982c22007-05-04 20:15:47 +00007173 if ((count = mtype_stats_alloc (MTYPE_BGP_ROUTE_EXTRA)))
7174 vty_out (vty, "%ld BGP route ancillaries, using %s of memory%s", count,
7175 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7176 count * sizeof (struct bgp_info_extra)),
7177 VTY_NEWLINE);
Paul Jakma4bf6a362006-03-30 14:05:23 +00007178
7179 if ((count = mtype_stats_alloc (MTYPE_BGP_STATIC)))
7180 vty_out (vty, "%ld Static routes, using %s of memory%s", count,
7181 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7182 count * sizeof (struct bgp_static)),
7183 VTY_NEWLINE);
7184
7185 /* Adj-In/Out */
7186 if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_IN)))
7187 vty_out (vty, "%ld Adj-In entries, using %s of memory%s", count,
7188 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7189 count * sizeof (struct bgp_adj_in)),
7190 VTY_NEWLINE);
7191 if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_OUT)))
7192 vty_out (vty, "%ld Adj-Out entries, using %s of memory%s", count,
7193 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7194 count * sizeof (struct bgp_adj_out)),
7195 VTY_NEWLINE);
7196
7197 if ((count = mtype_stats_alloc (MTYPE_BGP_NEXTHOP_CACHE)))
7198 vty_out (vty, "%ld Nexthop cache entries, using %s of memory%s", count,
7199 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7200 count * sizeof (struct bgp_nexthop_cache)),
7201 VTY_NEWLINE);
7202
7203 if ((count = mtype_stats_alloc (MTYPE_BGP_DAMP_INFO)))
7204 vty_out (vty, "%ld Dampening entries, using %s of memory%s", count,
7205 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7206 count * sizeof (struct bgp_damp_info)),
7207 VTY_NEWLINE);
7208
7209 /* Attributes */
7210 count = attr_count();
7211 vty_out (vty, "%ld BGP attributes, using %s of memory%s", count,
7212 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7213 count * sizeof(struct attr)),
7214 VTY_NEWLINE);
Paul Jakmafb982c22007-05-04 20:15:47 +00007215 if ((count = mtype_stats_alloc (MTYPE_ATTR_EXTRA)))
7216 vty_out (vty, "%ld BGP extra attributes, using %s of memory%s", count,
7217 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7218 count * sizeof(struct attr_extra)),
7219 VTY_NEWLINE);
Paul Jakma4bf6a362006-03-30 14:05:23 +00007220
7221 if ((count = attr_unknown_count()))
7222 vty_out (vty, "%ld unknown attributes%s", count, VTY_NEWLINE);
7223
7224 /* AS_PATH attributes */
7225 count = aspath_count ();
7226 vty_out (vty, "%ld BGP AS-PATH entries, using %s of memory%s", count,
7227 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7228 count * sizeof (struct aspath)),
7229 VTY_NEWLINE);
7230
7231 count = mtype_stats_alloc (MTYPE_AS_SEG);
7232 vty_out (vty, "%ld BGP AS-PATH segments, using %s of memory%s", count,
7233 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7234 count * sizeof (struct assegment)),
7235 VTY_NEWLINE);
7236
7237 /* Other attributes */
7238 if ((count = community_count ()))
7239 vty_out (vty, "%ld BGP community entries, using %s of memory%s", count,
7240 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7241 count * sizeof (struct community)),
7242 VTY_NEWLINE);
7243 if ((count = mtype_stats_alloc (MTYPE_ECOMMUNITY)))
7244 vty_out (vty, "%ld BGP community entries, using %s of memory%s", count,
7245 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7246 count * sizeof (struct ecommunity)),
7247 VTY_NEWLINE);
7248
7249 if ((count = mtype_stats_alloc (MTYPE_CLUSTER)))
7250 vty_out (vty, "%ld Cluster lists, using %s of memory%s", count,
7251 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7252 count * sizeof (struct cluster_list)),
7253 VTY_NEWLINE);
7254
7255 /* Peer related usage */
7256 count = mtype_stats_alloc (MTYPE_BGP_PEER);
7257 vty_out (vty, "%ld peers, using %s of memory%s", count,
7258 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7259 count * sizeof (struct peer)),
7260 VTY_NEWLINE);
7261
7262 if ((count = mtype_stats_alloc (MTYPE_PEER_GROUP)))
7263 vty_out (vty, "%ld peer groups, using %s of memory%s", count,
7264 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7265 count * sizeof (struct peer_group)),
7266 VTY_NEWLINE);
7267
7268 /* Other */
7269 if ((count = mtype_stats_alloc (MTYPE_HASH)))
7270 vty_out (vty, "%ld hash tables, using %s of memory%s", count,
7271 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7272 count * sizeof (struct hash)),
7273 VTY_NEWLINE);
7274 if ((count = mtype_stats_alloc (MTYPE_HASH_BACKET)))
7275 vty_out (vty, "%ld hash buckets, using %s of memory%s", count,
7276 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7277 count * sizeof (struct hash_backet)),
7278 VTY_NEWLINE);
7279 if ((count = mtype_stats_alloc (MTYPE_BGP_REGEXP)))
7280 vty_out (vty, "%ld compiled regexes, using %s of memory%s", count,
7281 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7282 count * sizeof (regex_t)),
7283 VTY_NEWLINE);
7284 return CMD_SUCCESS;
7285}
paulfee0f4c2004-09-13 05:12:46 +00007286
paul718e3742002-12-13 20:15:29 +00007287/* Show BGP peer's summary information. */
paul94f2b392005-06-28 12:44:16 +00007288static int
paul718e3742002-12-13 20:15:29 +00007289bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi)
7290{
7291 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00007292 struct listnode *node, *nnode;
Paul Jakma4bf6a362006-03-30 14:05:23 +00007293 unsigned int count = 0;
paul718e3742002-12-13 20:15:29 +00007294 char timebuf[BGP_UPTIME_LEN];
7295 int len;
7296
7297 /* Header string for each address family. */
Milan Kociancb4fc592014-12-01 12:48:25 +00007298 static char header[] = "Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd";
Paul Jakma4bf6a362006-03-30 14:05:23 +00007299
paul1eb8ef22005-04-07 07:30:20 +00007300 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00007301 {
7302 if (peer->afc[afi][safi])
7303 {
Paul Jakma4bf6a362006-03-30 14:05:23 +00007304 if (!count)
7305 {
7306 unsigned long ents;
7307 char memstrbuf[MTYPE_MEMSTR_LEN];
7308
7309 /* Usage summary and header */
7310 vty_out (vty,
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04007311 "BGP router identifier %s, local AS number %u%s",
Paul Jakma4bf6a362006-03-30 14:05:23 +00007312 inet_ntoa (bgp->router_id), bgp->as, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007313
Paul Jakma4bf6a362006-03-30 14:05:23 +00007314 ents = bgp_table_count (bgp->rib[afi][safi]);
7315 vty_out (vty, "RIB entries %ld, using %s of memory%s", ents,
7316 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7317 ents * sizeof (struct bgp_node)),
7318 VTY_NEWLINE);
7319
7320 /* Peer related usage */
7321 ents = listcount (bgp->peer);
7322 vty_out (vty, "Peers %ld, using %s of memory%s",
7323 ents,
7324 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7325 ents * sizeof (struct peer)),
7326 VTY_NEWLINE);
7327
7328 if ((ents = listcount (bgp->rsclient)))
7329 vty_out (vty, "RS-Client peers %ld, using %s of memory%s",
7330 ents,
7331 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7332 ents * sizeof (struct peer)),
7333 VTY_NEWLINE);
7334
7335 if ((ents = listcount (bgp->group)))
7336 vty_out (vty, "Peer groups %ld, using %s of memory%s", ents,
7337 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7338 ents * sizeof (struct peer_group)),
7339 VTY_NEWLINE);
7340
7341 if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING))
7342 vty_out (vty, "Dampening enabled.%s", VTY_NEWLINE);
7343 vty_out (vty, "%s", VTY_NEWLINE);
7344 vty_out (vty, "%s%s", header, VTY_NEWLINE);
7345 }
7346
paul718e3742002-12-13 20:15:29 +00007347 count++;
7348
7349 len = vty_out (vty, "%s", peer->host);
7350 len = 16 - len;
7351 if (len < 1)
7352 vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " ");
7353 else
7354 vty_out (vty, "%*s", len, " ");
7355
hasso3d515fd2005-02-01 21:30:04 +00007356 vty_out (vty, "4 ");
paul718e3742002-12-13 20:15:29 +00007357
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04007358 vty_out (vty, "%5u %7d %7d %8d %4d %4lu ",
paul718e3742002-12-13 20:15:29 +00007359 peer->as,
7360 peer->open_in + peer->update_in + peer->keepalive_in
7361 + peer->notify_in + peer->refresh_in + peer->dynamic_cap_in,
7362 peer->open_out + peer->update_out + peer->keepalive_out
7363 + peer->notify_out + peer->refresh_out
7364 + peer->dynamic_cap_out,
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00007365 0, 0, (unsigned long) peer->obuf->count);
paul718e3742002-12-13 20:15:29 +00007366
7367 vty_out (vty, "%8s",
7368 peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN));
7369
7370 if (peer->status == Established)
7371 {
7372 vty_out (vty, " %8ld", peer->pcount[afi][safi]);
7373 }
7374 else
7375 {
7376 if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN))
7377 vty_out (vty, " Idle (Admin)");
7378 else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW))
7379 vty_out (vty, " Idle (PfxCt)");
7380 else
7381 vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, peer->status));
7382 }
7383
7384 vty_out (vty, "%s", VTY_NEWLINE);
7385 }
7386 }
7387
7388 if (count)
7389 vty_out (vty, "%sTotal number of neighbors %d%s", VTY_NEWLINE,
7390 count, VTY_NEWLINE);
7391 else
7392 vty_out (vty, "No %s neighbor is configured%s",
7393 afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE);
7394 return CMD_SUCCESS;
7395}
7396
paul94f2b392005-06-28 12:44:16 +00007397static int
paulfd79ac92004-10-13 05:06:08 +00007398bgp_show_summary_vty (struct vty *vty, const char *name,
7399 afi_t afi, safi_t safi)
paul718e3742002-12-13 20:15:29 +00007400{
7401 struct bgp *bgp;
7402
7403 if (name)
7404 {
7405 bgp = bgp_lookup_by_name (name);
7406
7407 if (! bgp)
7408 {
7409 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
7410 return CMD_WARNING;
7411 }
7412
7413 bgp_show_summary (vty, bgp, afi, safi);
7414 return CMD_SUCCESS;
7415 }
7416
7417 bgp = bgp_get_default ();
7418
7419 if (bgp)
7420 bgp_show_summary (vty, bgp, afi, safi);
7421
7422 return CMD_SUCCESS;
7423}
7424
7425/* `show ip bgp summary' commands. */
Lou Bergerf9b6c392016-01-12 13:42:09 -05007426DEFUN (show_ip_bgp_summary,
7427 show_ip_bgp_summary_cmd,
7428 "show ip bgp summary",
7429 SHOW_STR
7430 IP_STR
7431 BGP_STR
7432 "Summary of BGP neighbor status\n")
7433{
7434 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
7435}
7436
7437DEFUN (show_ip_bgp_instance_summary,
7438 show_ip_bgp_instance_summary_cmd,
7439 "show ip bgp view WORD summary",
7440 SHOW_STR
7441 IP_STR
7442 BGP_STR
7443 "BGP view\n"
7444 "View name\n"
7445 "Summary of BGP neighbor status\n")
7446{
7447 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
7448}
7449
7450DEFUN (show_ip_bgp_ipv4_summary,
7451 show_ip_bgp_ipv4_summary_cmd,
7452 "show ip bgp ipv4 (unicast|multicast) summary",
7453 SHOW_STR
7454 IP_STR
7455 BGP_STR
7456 "Address family\n"
7457 "Address Family modifier\n"
7458 "Address Family modifier\n"
7459 "Summary of BGP neighbor status\n")
7460{
7461 if (strncmp (argv[0], "m", 1) == 0)
7462 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
7463
7464 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
7465}
7466
7467DEFUN (show_ip_bgp_instance_ipv4_summary,
7468 show_ip_bgp_instance_ipv4_summary_cmd,
7469 "show ip bgp view WORD ipv4 (unicast|multicast) summary",
7470 SHOW_STR
7471 IP_STR
7472 BGP_STR
7473 "BGP view\n"
7474 "View name\n"
7475 "Address family\n"
7476 "Address Family modifier\n"
7477 "Address Family modifier\n"
7478 "Summary of BGP neighbor status\n")
7479{
7480 if (strncmp (argv[1], "m", 1) == 0)
7481 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
7482 else
7483 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
7484}
7485
7486DEFUN (show_ip_bgp_vpnv4_all_summary,
7487 show_ip_bgp_vpnv4_all_summary_cmd,
7488 "show ip bgp vpnv4 all summary",
7489 SHOW_STR
7490 IP_STR
7491 BGP_STR
7492 "Display VPNv4 NLRI specific information\n"
7493 "Display information about all VPNv4 NLRIs\n"
7494 "Summary of BGP neighbor status\n")
7495{
7496 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
7497}
7498
7499DEFUN (show_ip_bgp_vpnv4_rd_summary,
7500 show_ip_bgp_vpnv4_rd_summary_cmd,
7501 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn summary",
7502 SHOW_STR
7503 IP_STR
7504 BGP_STR
7505 "Display VPNv4 NLRI specific information\n"
7506 "Display information for a route distinguisher\n"
7507 "VPN Route Distinguisher\n"
7508 "Summary of BGP neighbor status\n")
7509{
7510 int ret;
7511 struct prefix_rd prd;
7512
7513 ret = str2prefix_rd (argv[0], &prd);
7514 if (! ret)
7515 {
7516 vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
7517 return CMD_WARNING;
7518 }
7519
7520 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
7521}
7522
Lou Berger651b4022016-01-12 13:42:07 -05007523DEFUN (show_bgp_ipv4_safi_summary,
7524 show_bgp_ipv4_safi_summary_cmd,
7525 "show bgp ipv4 (unicast|multicast) summary",
paul718e3742002-12-13 20:15:29 +00007526 SHOW_STR
paul718e3742002-12-13 20:15:29 +00007527 BGP_STR
7528 "Address family\n"
7529 "Address Family modifier\n"
7530 "Address Family modifier\n"
7531 "Summary of BGP neighbor status\n")
7532{
7533 if (strncmp (argv[0], "m", 1) == 0)
7534 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
7535
7536 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
7537}
7538
Lou Berger651b4022016-01-12 13:42:07 -05007539DEFUN (show_bgp_instance_ipv4_safi_summary,
7540 show_bgp_instance_ipv4_safi_summary_cmd,
7541 "show bgp view WORD ipv4 (unicast|multicast) summary",
Michael Lambert95cbbd22010-07-23 14:43:04 -04007542 SHOW_STR
7543 BGP_STR
paul718e3742002-12-13 20:15:29 +00007544 "BGP view\n"
7545 "View name\n"
7546 "Address family\n"
7547 "Address Family modifier\n"
7548 "Address Family modifier\n"
7549 "Summary of BGP neighbor status\n")
7550{
7551 if (strncmp (argv[1], "m", 1) == 0)
7552 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
7553 else
7554 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
7555}
7556
Lou Berger651b4022016-01-12 13:42:07 -05007557DEFUN (show_bgp_ipv4_vpn_summary,
7558 show_bgp_ipv4_vpn_summary_cmd,
7559 "show bgp ipv4 vpn summary",
Michael Lambert95cbbd22010-07-23 14:43:04 -04007560 SHOW_STR
7561 BGP_STR
Lou Berger651b4022016-01-12 13:42:07 -05007562 "IPv4\n"
7563 "Display VPN NLRI specific information\n"
paul718e3742002-12-13 20:15:29 +00007564 "Summary of BGP neighbor status\n")
7565{
7566 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
7567}
7568
Lou Berger651b4022016-01-12 13:42:07 -05007569/* `show ip bgp summary' commands. */
7570DEFUN (show_bgp_ipv6_vpn_summary,
7571 show_bgp_ipv6_vpn_summary_cmd,
7572 "show bgp ipv6 vpn summary",
paul718e3742002-12-13 20:15:29 +00007573 SHOW_STR
7574 BGP_STR
Lou Berger651b4022016-01-12 13:42:07 -05007575 "IPv6\n"
7576 "Display VPN NLRI specific information\n"
paul718e3742002-12-13 20:15:29 +00007577 "Summary of BGP neighbor status\n")
7578{
Lou Berger651b4022016-01-12 13:42:07 -05007579 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MPLS_VPN);
paul718e3742002-12-13 20:15:29 +00007580}
Lou Berger651b4022016-01-12 13:42:07 -05007581
7582DEFUN (show_bgp_ipv4_encap_summary,
7583 show_bgp_ipv4_encap_summary_cmd,
7584 "show bgp ipv4 encap summary",
7585 SHOW_STR
7586 BGP_STR
7587 "IPv4\n"
7588 "Display ENCAP NLRI specific information\n"
7589 "Summary of BGP neighbor status\n")
7590{
7591 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_ENCAP);
7592}
7593
Lou Berger651b4022016-01-12 13:42:07 -05007594DEFUN (show_bgp_ipv6_encap_summary,
7595 show_bgp_ipv6_encap_summary_cmd,
7596 "show bgp ipv6 encap summary",
7597 SHOW_STR
7598 BGP_STR
7599 "IPv6\n"
7600 "Display ENCAP NLRI specific information\n"
7601 "Summary of BGP neighbor status\n")
7602{
7603 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_ENCAP);
7604}
7605
paul718e3742002-12-13 20:15:29 +00007606DEFUN (show_bgp_instance_summary,
7607 show_bgp_instance_summary_cmd,
7608 "show bgp view WORD summary",
7609 SHOW_STR
7610 BGP_STR
7611 "BGP view\n"
7612 "View name\n"
7613 "Summary of BGP neighbor status\n")
7614{
Lou Berger651b4022016-01-12 13:42:07 -05007615 vty_out(vty, "%sIPv4 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7616 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7617 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
7618 vty_out(vty, "%sIPv4 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7619 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7620 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
7621 vty_out(vty, "%sIPv4 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7622 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7623 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MPLS_VPN);
7624 vty_out(vty, "%sIPv4 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7625 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7626 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_ENCAP);
7627
Lou Berger651b4022016-01-12 13:42:07 -05007628 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7629 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7630 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
7631 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7632 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7633 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST);
7634 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7635 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7636 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MPLS_VPN);
7637 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7638 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7639 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_ENCAP);
Lou Berger205e6742016-01-12 13:42:11 -05007640
Lou Berger651b4022016-01-12 13:42:07 -05007641 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00007642}
7643
Lou Berger651b4022016-01-12 13:42:07 -05007644DEFUN (show_bgp_instance_ipv4_summary,
7645 show_bgp_instance_ipv4_summary_cmd,
7646 "show bgp view WORD ipv4 summary",
paul718e3742002-12-13 20:15:29 +00007647 SHOW_STR
7648 BGP_STR
Lou Berger651b4022016-01-12 13:42:07 -05007649 IP_STR
7650 "Address Family modifier\n"
7651 "Address Family modifier\n"
7652 "BGP view\n"
7653 "View name\n"
paul718e3742002-12-13 20:15:29 +00007654 "Summary of BGP neighbor status\n")
Lou Berger651b4022016-01-12 13:42:07 -05007655{
7656 vty_out(vty, "%sIPv4 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7657 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7658 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
7659 vty_out(vty, "%sIPv4 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7660 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7661 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
7662 vty_out(vty, "%sIPv4 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7663 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7664 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MPLS_VPN);
7665 vty_out(vty, "%sIPv4 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7666 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7667 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_ENCAP);
paul718e3742002-12-13 20:15:29 +00007668
Lou Berger651b4022016-01-12 13:42:07 -05007669 return CMD_SUCCESS;
7670}
7671
Lou Berger651b4022016-01-12 13:42:07 -05007672DEFUN (show_bgp_instance_ipv6_summary,
paul718e3742002-12-13 20:15:29 +00007673 show_bgp_instance_ipv6_summary_cmd,
7674 "show bgp view WORD ipv6 summary",
7675 SHOW_STR
7676 BGP_STR
Lou Berger651b4022016-01-12 13:42:07 -05007677 IPV6_STR
7678 "Address Family modifier\n"
7679 "Address Family modifier\n"
paul718e3742002-12-13 20:15:29 +00007680 "BGP view\n"
7681 "View name\n"
paul718e3742002-12-13 20:15:29 +00007682 "Summary of BGP neighbor status\n")
Lou Berger651b4022016-01-12 13:42:07 -05007683{
7684 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7685 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7686 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
7687 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7688 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7689 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST);
7690 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7691 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7692 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MPLS_VPN);
7693 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7694 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7695 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_ENCAP);
7696
7697 return CMD_SUCCESS;
7698}
paul718e3742002-12-13 20:15:29 +00007699
Michael Lambert95cbbd22010-07-23 14:43:04 -04007700DEFUN (show_bgp_ipv6_safi_summary,
7701 show_bgp_ipv6_safi_summary_cmd,
7702 "show bgp ipv6 (unicast|multicast) summary",
7703 SHOW_STR
7704 BGP_STR
7705 "Address family\n"
7706 "Address Family modifier\n"
7707 "Address Family modifier\n"
7708 "Summary of BGP neighbor status\n")
7709{
7710 if (strncmp (argv[0], "m", 1) == 0)
7711 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
7712
7713 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
7714}
7715
7716DEFUN (show_bgp_instance_ipv6_safi_summary,
7717 show_bgp_instance_ipv6_safi_summary_cmd,
7718 "show bgp view WORD ipv6 (unicast|multicast) summary",
7719 SHOW_STR
7720 BGP_STR
7721 "BGP view\n"
7722 "View name\n"
7723 "Address family\n"
7724 "Address Family modifier\n"
7725 "Address Family modifier\n"
7726 "Summary of BGP neighbor status\n")
7727{
7728 if (strncmp (argv[1], "m", 1) == 0)
7729 return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST);
7730
7731 return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
7732}
7733
Lou Bergerf9b6c392016-01-12 13:42:09 -05007734/* old command */
7735DEFUN (show_ipv6_bgp_summary,
7736 show_ipv6_bgp_summary_cmd,
7737 "show ipv6 bgp summary",
7738 SHOW_STR
7739 IPV6_STR
7740 BGP_STR
7741 "Summary of BGP neighbor status\n")
7742{
7743 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
7744}
7745
7746/* old command */
7747DEFUN (show_ipv6_mbgp_summary,
7748 show_ipv6_mbgp_summary_cmd,
7749 "show ipv6 mbgp summary",
7750 SHOW_STR
7751 IPV6_STR
7752 MBGP_STR
7753 "Summary of BGP neighbor status\n")
7754{
7755 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
7756}
Lou Berger651b4022016-01-12 13:42:07 -05007757
7758/* variations of show bgp [...] summary */
7759
7760/* This one is for the 0-keyword variant */
7761DEFUN (show_bgp_summary,
7762 show_bgp_summary_cmd,
7763 "show bgp summary",
paul718e3742002-12-13 20:15:29 +00007764 SHOW_STR
paul718e3742002-12-13 20:15:29 +00007765 BGP_STR
7766 "Summary of BGP neighbor status\n")
7767{
Lou Berger651b4022016-01-12 13:42:07 -05007768 vty_out(vty, "%sIPv4 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7769 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7770 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
7771 vty_out(vty, "%sIPv4 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7772 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7773 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
7774 vty_out(vty, "%sIPv4 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7775 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7776 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
7777 vty_out(vty, "%sIPv4 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7778 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7779 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_ENCAP);
7780
Lou Berger651b4022016-01-12 13:42:07 -05007781 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7782 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7783 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
7784 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7785 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7786 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
7787 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7788 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7789 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MPLS_VPN);
7790 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7791 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7792 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_ENCAP);
Lou Berger205e6742016-01-12 13:42:11 -05007793
Lou Berger651b4022016-01-12 13:42:07 -05007794 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00007795}
7796
Lou Bergerf9b6c392016-01-12 13:42:09 -05007797ALIAS (show_bgp_summary,
7798 show_bgp_ipv6_summary_cmd,
7799 "show bgp ipv6 summary",
7800 SHOW_STR
7801 BGP_STR
7802 "Address family\n"
7803 "Summary of BGP neighbor status\n")
7804
Lou Berger651b4022016-01-12 13:42:07 -05007805DEFUN (show_bgp_summary_1w,
7806 show_bgp_summary_1w_cmd,
Lou Berger651b4022016-01-12 13:42:07 -05007807 "show bgp (ipv4|ipv6|unicast|multicast|vpn|encap) summary",
paul718e3742002-12-13 20:15:29 +00007808 SHOW_STR
Lou Berger651b4022016-01-12 13:42:07 -05007809 BGP_STR
7810 IP_STR
Lou Berger651b4022016-01-12 13:42:07 -05007811 IP6_STR
Lou Berger651b4022016-01-12 13:42:07 -05007812 "Address Family modifier\n"
7813 "Address Family modifier\n"
7814 "Address Family modifier\n"
7815 "Address Family modifier\n"
paul718e3742002-12-13 20:15:29 +00007816 "Summary of BGP neighbor status\n")
7817{
Lou Berger651b4022016-01-12 13:42:07 -05007818 if (strcmp (argv[0], "ipv4") == 0) {
7819 vty_out(vty, "%sIPv4 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7820 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7821 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
7822 vty_out(vty, "%sIPv4 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7823 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7824 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
7825 vty_out(vty, "%sIPv4 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7826 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7827 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
7828 vty_out(vty, "%sIPv4 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7829 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7830 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_ENCAP);
7831 return CMD_SUCCESS;
7832 }
Lou Berger205e6742016-01-12 13:42:11 -05007833
Lou Berger651b4022016-01-12 13:42:07 -05007834 if (strcmp (argv[0], "ipv6") == 0) {
7835 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7836 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7837 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
7838 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7839 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7840 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
7841 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7842 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7843 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MPLS_VPN);
7844 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7845 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7846 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_ENCAP);
7847 return CMD_SUCCESS;
7848 }
Lou Berger205e6742016-01-12 13:42:11 -05007849
Lou Berger651b4022016-01-12 13:42:07 -05007850 if (strcmp (argv[0], "unicast") == 0) {
7851 vty_out(vty, "IPv4 Unicast Summary:%s", VTY_NEWLINE);
7852 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7853 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
Lou Berger651b4022016-01-12 13:42:07 -05007854 vty_out(vty, "%s", VTY_NEWLINE);
7855 vty_out(vty, "IPv6 Unicast Summary:%s", VTY_NEWLINE);
7856 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7857 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
Lou Berger651b4022016-01-12 13:42:07 -05007858 return CMD_SUCCESS;
7859 }
7860 if (strcmp (argv[0], "multicast") == 0) {
7861 vty_out(vty, "IPv4 Multicast Summary:%s", VTY_NEWLINE);
7862 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7863 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
Lou Berger651b4022016-01-12 13:42:07 -05007864 vty_out(vty, "%s", VTY_NEWLINE);
7865 vty_out(vty, "IPv6 Multicast Summary:%s", VTY_NEWLINE);
7866 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7867 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
Lou Berger651b4022016-01-12 13:42:07 -05007868 return CMD_SUCCESS;
7869 }
7870 if (strcmp (argv[0], "vpn") == 0) {
7871 vty_out(vty, "IPv4 VPN Summary:%s", VTY_NEWLINE);
7872 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7873 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
Lou Berger651b4022016-01-12 13:42:07 -05007874 vty_out(vty, "%s", VTY_NEWLINE);
7875 vty_out(vty, "IPv6 VPN Summary:%s", VTY_NEWLINE);
7876 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7877 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MPLS_VPN);
Lou Berger651b4022016-01-12 13:42:07 -05007878 return CMD_SUCCESS;
7879 }
7880 if (strcmp (argv[0], "encap") == 0) {
7881 vty_out(vty, "IPv4 Encap Summary:%s", VTY_NEWLINE);
7882 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7883 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_ENCAP);
Lou Berger651b4022016-01-12 13:42:07 -05007884 vty_out(vty, "%s", VTY_NEWLINE);
7885 vty_out(vty, "IPv6 Encap Summary:%s", VTY_NEWLINE);
7886 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7887 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_ENCAP);
Lou Berger651b4022016-01-12 13:42:07 -05007888 return CMD_SUCCESS;
7889 }
7890 vty_out(vty, "Unknown keyword: %s%s", argv[0], VTY_NEWLINE);
7891 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00007892}
Lou Berger651b4022016-01-12 13:42:07 -05007893
7894
David Lamparter6b0655a2014-06-04 06:53:35 +02007895
paulfd79ac92004-10-13 05:06:08 +00007896const char *
hasso538621f2004-05-21 09:31:30 +00007897afi_safi_print (afi_t afi, safi_t safi)
7898{
7899 if (afi == AFI_IP && safi == SAFI_UNICAST)
7900 return "IPv4 Unicast";
7901 else if (afi == AFI_IP && safi == SAFI_MULTICAST)
7902 return "IPv4 Multicast";
7903 else if (afi == AFI_IP && safi == SAFI_MPLS_VPN)
Lou Berger9da04bc2016-01-12 13:41:55 -05007904 return "VPN-IPv4 Unicast";
Lou Bergera3fda882016-01-12 13:42:04 -05007905 else if (afi == AFI_IP && safi == SAFI_ENCAP)
7906 return "ENCAP-IPv4 Unicast";
hasso538621f2004-05-21 09:31:30 +00007907 else if (afi == AFI_IP6 && safi == SAFI_UNICAST)
7908 return "IPv6 Unicast";
7909 else if (afi == AFI_IP6 && safi == SAFI_MULTICAST)
7910 return "IPv6 Multicast";
Lou Berger9da04bc2016-01-12 13:41:55 -05007911 else if (afi == AFI_IP6 && safi == SAFI_MPLS_VPN)
7912 return "VPN-IPv6 Unicast";
Lou Bergera3fda882016-01-12 13:42:04 -05007913 else if (afi == AFI_IP6 && safi == SAFI_ENCAP)
7914 return "ENCAP-IPv6 Unicast";
hasso538621f2004-05-21 09:31:30 +00007915 else
7916 return "Unknown";
7917}
7918
paul718e3742002-12-13 20:15:29 +00007919/* Show BGP peer's information. */
7920enum show_type
7921{
7922 show_all,
7923 show_peer
7924};
7925
paul94f2b392005-06-28 12:44:16 +00007926static void
paul718e3742002-12-13 20:15:29 +00007927bgp_show_peer_afi_orf_cap (struct vty *vty, struct peer *p,
7928 afi_t afi, safi_t safi,
7929 u_int16_t adv_smcap, u_int16_t adv_rmcap,
7930 u_int16_t rcv_smcap, u_int16_t rcv_rmcap)
7931{
7932 /* Send-Mode */
7933 if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap)
7934 || CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap))
7935 {
7936 vty_out (vty, " Send-mode: ");
7937 if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap))
7938 vty_out (vty, "advertised");
7939 if (CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap))
7940 vty_out (vty, "%sreceived",
7941 CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) ?
7942 ", " : "");
7943 vty_out (vty, "%s", VTY_NEWLINE);
7944 }
7945
7946 /* Receive-Mode */
7947 if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap)
7948 || CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap))
7949 {
7950 vty_out (vty, " Receive-mode: ");
7951 if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap))
7952 vty_out (vty, "advertised");
7953 if (CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap))
7954 vty_out (vty, "%sreceived",
7955 CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) ?
7956 ", " : "");
7957 vty_out (vty, "%s", VTY_NEWLINE);
7958 }
7959}
7960
paul94f2b392005-06-28 12:44:16 +00007961static void
paul718e3742002-12-13 20:15:29 +00007962bgp_show_peer_afi (struct vty *vty, struct peer *p, afi_t afi, safi_t safi)
7963{
7964 struct bgp_filter *filter;
7965 char orf_pfx_name[BUFSIZ];
7966 int orf_pfx_count;
7967
7968 filter = &p->filter[afi][safi];
7969
hasso538621f2004-05-21 09:31:30 +00007970 vty_out (vty, " For address family: %s%s", afi_safi_print (afi, safi),
paul718e3742002-12-13 20:15:29 +00007971 VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00007972
paul718e3742002-12-13 20:15:29 +00007973 if (p->af_group[afi][safi])
7974 vty_out (vty, " %s peer-group member%s", p->group->name, VTY_NEWLINE);
7975
7976 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
7977 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
7978 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)
7979 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
7980 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV)
7981 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
7982 vty_out (vty, " AF-dependant capabilities:%s", VTY_NEWLINE);
7983
7984 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
7985 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
7986 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
7987 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV))
7988 {
7989 vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
7990 ORF_TYPE_PREFIX, VTY_NEWLINE);
7991 bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
7992 PEER_CAP_ORF_PREFIX_SM_ADV,
7993 PEER_CAP_ORF_PREFIX_RM_ADV,
7994 PEER_CAP_ORF_PREFIX_SM_RCV,
7995 PEER_CAP_ORF_PREFIX_RM_RCV);
7996 }
7997 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
7998 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)
7999 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
8000 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
8001 {
8002 vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
8003 ORF_TYPE_PREFIX_OLD, VTY_NEWLINE);
8004 bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
8005 PEER_CAP_ORF_PREFIX_SM_ADV,
8006 PEER_CAP_ORF_PREFIX_RM_ADV,
8007 PEER_CAP_ORF_PREFIX_SM_OLD_RCV,
8008 PEER_CAP_ORF_PREFIX_RM_OLD_RCV);
8009 }
8010
8011 sprintf (orf_pfx_name, "%s.%d.%d", p->host, afi, safi);
8012 orf_pfx_count = prefix_bgp_show_prefix_list (NULL, afi, orf_pfx_name);
8013
8014 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND)
8015 || orf_pfx_count)
8016 {
8017 vty_out (vty, " Outbound Route Filter (ORF):");
8018 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND))
8019 vty_out (vty, " sent;");
8020 if (orf_pfx_count)
8021 vty_out (vty, " received (%d entries)", orf_pfx_count);
8022 vty_out (vty, "%s", VTY_NEWLINE);
8023 }
8024 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH))
8025 vty_out (vty, " First update is deferred until ORF or ROUTE-REFRESH is received%s", VTY_NEWLINE);
8026
8027 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT))
8028 vty_out (vty, " Route-Reflector Client%s", VTY_NEWLINE);
8029 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT))
8030 vty_out (vty, " Route-Server Client%s", VTY_NEWLINE);
8031 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG))
8032 vty_out (vty, " Inbound soft reconfiguration allowed%s", VTY_NEWLINE);
8033 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS))
8034 vty_out (vty, " Private AS number removed from updates to this neighbor%s", VTY_NEWLINE);
8035 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF))
8036 vty_out (vty, " NEXT_HOP is always this router%s", VTY_NEWLINE);
8037 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED))
8038 vty_out (vty, " AS_PATH is propagated unchanged to this neighbor%s", VTY_NEWLINE);
8039 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED))
8040 vty_out (vty, " NEXT_HOP is propagated unchanged to this neighbor%s", VTY_NEWLINE);
8041 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED))
8042 vty_out (vty, " MED is propagated unchanged to this neighbor%s", VTY_NEWLINE);
8043 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
8044 || CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
8045 {
8046 vty_out (vty, " Community attribute sent to this neighbor");
8047 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
8048 && CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
hasso538621f2004-05-21 09:31:30 +00008049 vty_out (vty, "(both)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008050 else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
hasso538621f2004-05-21 09:31:30 +00008051 vty_out (vty, "(extended)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008052 else
hasso538621f2004-05-21 09:31:30 +00008053 vty_out (vty, "(standard)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008054 }
8055 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE))
8056 {
8057 vty_out (vty, " Default information originate,");
8058
8059 if (p->default_rmap[afi][safi].name)
8060 vty_out (vty, " default route-map %s%s,",
8061 p->default_rmap[afi][safi].map ? "*" : "",
8062 p->default_rmap[afi][safi].name);
8063 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_DEFAULT_ORIGINATE))
8064 vty_out (vty, " default sent%s", VTY_NEWLINE);
8065 else
8066 vty_out (vty, " default not sent%s", VTY_NEWLINE);
8067 }
8068
8069 if (filter->plist[FILTER_IN].name
8070 || filter->dlist[FILTER_IN].name
8071 || filter->aslist[FILTER_IN].name
paulfee0f4c2004-09-13 05:12:46 +00008072 || filter->map[RMAP_IN].name)
paul718e3742002-12-13 20:15:29 +00008073 vty_out (vty, " Inbound path policy configured%s", VTY_NEWLINE);
8074 if (filter->plist[FILTER_OUT].name
8075 || filter->dlist[FILTER_OUT].name
8076 || filter->aslist[FILTER_OUT].name
paulfee0f4c2004-09-13 05:12:46 +00008077 || filter->map[RMAP_OUT].name
paul718e3742002-12-13 20:15:29 +00008078 || filter->usmap.name)
8079 vty_out (vty, " Outbound path policy configured%s", VTY_NEWLINE);
paulfee0f4c2004-09-13 05:12:46 +00008080 if (filter->map[RMAP_IMPORT].name)
8081 vty_out (vty, " Import policy for this RS-client configured%s", VTY_NEWLINE);
8082 if (filter->map[RMAP_EXPORT].name)
8083 vty_out (vty, " Export policy for this RS-client configured%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008084
8085 /* prefix-list */
8086 if (filter->plist[FILTER_IN].name)
8087 vty_out (vty, " Incoming update prefix filter list is %s%s%s",
8088 filter->plist[FILTER_IN].plist ? "*" : "",
8089 filter->plist[FILTER_IN].name,
8090 VTY_NEWLINE);
8091 if (filter->plist[FILTER_OUT].name)
8092 vty_out (vty, " Outgoing update prefix filter list is %s%s%s",
8093 filter->plist[FILTER_OUT].plist ? "*" : "",
8094 filter->plist[FILTER_OUT].name,
8095 VTY_NEWLINE);
8096
8097 /* distribute-list */
8098 if (filter->dlist[FILTER_IN].name)
8099 vty_out (vty, " Incoming update network filter list is %s%s%s",
8100 filter->dlist[FILTER_IN].alist ? "*" : "",
8101 filter->dlist[FILTER_IN].name,
8102 VTY_NEWLINE);
8103 if (filter->dlist[FILTER_OUT].name)
8104 vty_out (vty, " Outgoing update network filter list is %s%s%s",
8105 filter->dlist[FILTER_OUT].alist ? "*" : "",
8106 filter->dlist[FILTER_OUT].name,
8107 VTY_NEWLINE);
8108
8109 /* filter-list. */
8110 if (filter->aslist[FILTER_IN].name)
8111 vty_out (vty, " Incoming update AS path filter list is %s%s%s",
8112 filter->aslist[FILTER_IN].aslist ? "*" : "",
8113 filter->aslist[FILTER_IN].name,
8114 VTY_NEWLINE);
8115 if (filter->aslist[FILTER_OUT].name)
8116 vty_out (vty, " Outgoing update AS path filter list is %s%s%s",
8117 filter->aslist[FILTER_OUT].aslist ? "*" : "",
8118 filter->aslist[FILTER_OUT].name,
8119 VTY_NEWLINE);
8120
8121 /* route-map. */
paulfee0f4c2004-09-13 05:12:46 +00008122 if (filter->map[RMAP_IN].name)
paul718e3742002-12-13 20:15:29 +00008123 vty_out (vty, " Route map for incoming advertisements is %s%s%s",
paulfee0f4c2004-09-13 05:12:46 +00008124 filter->map[RMAP_IN].map ? "*" : "",
8125 filter->map[RMAP_IN].name,
paul718e3742002-12-13 20:15:29 +00008126 VTY_NEWLINE);
paulfee0f4c2004-09-13 05:12:46 +00008127 if (filter->map[RMAP_OUT].name)
paul718e3742002-12-13 20:15:29 +00008128 vty_out (vty, " Route map for outgoing advertisements is %s%s%s",
paulfee0f4c2004-09-13 05:12:46 +00008129 filter->map[RMAP_OUT].map ? "*" : "",
8130 filter->map[RMAP_OUT].name,
8131 VTY_NEWLINE);
8132 if (filter->map[RMAP_IMPORT].name)
8133 vty_out (vty, " Route map for advertisements going into this RS-client's table is %s%s%s",
8134 filter->map[RMAP_IMPORT].map ? "*" : "",
8135 filter->map[RMAP_IMPORT].name,
8136 VTY_NEWLINE);
8137 if (filter->map[RMAP_EXPORT].name)
8138 vty_out (vty, " Route map for advertisements coming from this RS-client is %s%s%s",
8139 filter->map[RMAP_EXPORT].map ? "*" : "",
8140 filter->map[RMAP_EXPORT].name,
paul718e3742002-12-13 20:15:29 +00008141 VTY_NEWLINE);
8142
8143 /* unsuppress-map */
8144 if (filter->usmap.name)
8145 vty_out (vty, " Route map for selective unsuppress is %s%s%s",
8146 filter->usmap.map ? "*" : "",
8147 filter->usmap.name, VTY_NEWLINE);
8148
8149 /* Receive prefix count */
hassoe0701b72004-05-20 09:19:34 +00008150 vty_out (vty, " %ld accepted prefixes%s", p->pcount[afi][safi], VTY_NEWLINE);
8151
paul718e3742002-12-13 20:15:29 +00008152 /* Maximum prefix */
8153 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX))
8154 {
hasso0a486e52005-02-01 20:57:17 +00008155 vty_out (vty, " Maximum prefixes allowed %ld%s%s", p->pmax[afi][safi],
paul718e3742002-12-13 20:15:29 +00008156 CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING)
hasso0a486e52005-02-01 20:57:17 +00008157 ? " (warning-only)" : "", VTY_NEWLINE);
8158 vty_out (vty, " Threshold for warning message %d%%",
8159 p->pmax_threshold[afi][safi]);
8160 if (p->pmax_restart[afi][safi])
8161 vty_out (vty, ", restart interval %d min", p->pmax_restart[afi][safi]);
8162 vty_out (vty, "%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008163 }
paul718e3742002-12-13 20:15:29 +00008164
8165 vty_out (vty, "%s", VTY_NEWLINE);
8166}
8167
paul94f2b392005-06-28 12:44:16 +00008168static void
paul718e3742002-12-13 20:15:29 +00008169bgp_show_peer (struct vty *vty, struct peer *p)
8170{
8171 struct bgp *bgp;
8172 char buf1[BUFSIZ];
8173 char timebuf[BGP_UPTIME_LEN];
hasso538621f2004-05-21 09:31:30 +00008174 afi_t afi;
8175 safi_t safi;
paul718e3742002-12-13 20:15:29 +00008176
8177 bgp = p->bgp;
8178
8179 /* Configured IP address. */
8180 vty_out (vty, "BGP neighbor is %s, ", p->host);
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04008181 vty_out (vty, "remote AS %u, ", p->as);
Andrew Certain9d3f9702012-11-07 23:50:07 +00008182 vty_out (vty, "local AS %u%s%s, ",
paul718e3742002-12-13 20:15:29 +00008183 p->change_local_as ? p->change_local_as : p->local_as,
8184 CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND) ?
Andrew Certain9d3f9702012-11-07 23:50:07 +00008185 " no-prepend" : "",
8186 CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_REPLACE_AS) ?
8187 " replace-as" : "");
paul718e3742002-12-13 20:15:29 +00008188 vty_out (vty, "%s link%s",
8189 p->as == p->local_as ? "internal" : "external",
8190 VTY_NEWLINE);
8191
8192 /* Description. */
8193 if (p->desc)
8194 vty_out (vty, " Description: %s%s", p->desc, VTY_NEWLINE);
8195
8196 /* Peer-group */
8197 if (p->group)
8198 vty_out (vty, " Member of peer-group %s for session parameters%s",
8199 p->group->name, VTY_NEWLINE);
8200
8201 /* Administrative shutdown. */
8202 if (CHECK_FLAG (p->flags, PEER_FLAG_SHUTDOWN))
8203 vty_out (vty, " Administratively shut down%s", VTY_NEWLINE);
8204
8205 /* BGP Version. */
8206 vty_out (vty, " BGP version 4");
paul718e3742002-12-13 20:15:29 +00008207 vty_out (vty, ", remote router ID %s%s",
8208 inet_ntop (AF_INET, &p->remote_id, buf1, BUFSIZ),
8209 VTY_NEWLINE);
8210
8211 /* Confederation */
hassoe0701b72004-05-20 09:19:34 +00008212 if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION)
8213 && bgp_confederation_peers_check (bgp, p->as))
paul718e3742002-12-13 20:15:29 +00008214 vty_out (vty, " Neighbor under common administration%s", VTY_NEWLINE);
8215
8216 /* Status. */
8217 vty_out (vty, " BGP state = %s",
8218 LOOKUP (bgp_status_msg, p->status));
8219 if (p->status == Established)
8220 vty_out (vty, ", up for %8s",
8221 peer_uptime (p->uptime, timebuf, BGP_UPTIME_LEN));
hasso93406d82005-02-02 14:40:33 +00008222 else if (p->status == Active)
8223 {
8224 if (CHECK_FLAG (p->flags, PEER_FLAG_PASSIVE))
8225 vty_out (vty, " (passive)");
8226 else if (CHECK_FLAG (p->sflags, PEER_STATUS_NSF_WAIT))
8227 vty_out (vty, " (NSF passive)");
8228 }
paul718e3742002-12-13 20:15:29 +00008229 vty_out (vty, "%s", VTY_NEWLINE);
8230
8231 /* read timer */
8232 vty_out (vty, " Last read %s", peer_uptime (p->readtime, timebuf, BGP_UPTIME_LEN));
8233
8234 /* Configured timer values. */
8235 vty_out (vty, ", hold time is %d, keepalive interval is %d seconds%s",
8236 p->v_holdtime, p->v_keepalive, VTY_NEWLINE);
8237 if (CHECK_FLAG (p->config, PEER_CONFIG_TIMER))
8238 {
8239 vty_out (vty, " Configured hold time is %d", p->holdtime);
8240 vty_out (vty, ", keepalive interval is %d seconds%s",
8241 p->keepalive, VTY_NEWLINE);
8242 }
hasso93406d82005-02-02 14:40:33 +00008243
paul718e3742002-12-13 20:15:29 +00008244 /* Capability. */
8245 if (p->status == Established)
8246 {
hasso538621f2004-05-21 09:31:30 +00008247 if (p->cap
paul718e3742002-12-13 20:15:29 +00008248 || p->afc_adv[AFI_IP][SAFI_UNICAST]
8249 || p->afc_recv[AFI_IP][SAFI_UNICAST]
8250 || p->afc_adv[AFI_IP][SAFI_MULTICAST]
8251 || p->afc_recv[AFI_IP][SAFI_MULTICAST]
paul718e3742002-12-13 20:15:29 +00008252 || p->afc_adv[AFI_IP6][SAFI_UNICAST]
8253 || p->afc_recv[AFI_IP6][SAFI_UNICAST]
8254 || p->afc_adv[AFI_IP6][SAFI_MULTICAST]
8255 || p->afc_recv[AFI_IP6][SAFI_MULTICAST]
Lou Berger9da04bc2016-01-12 13:41:55 -05008256 || p->afc_adv[AFI_IP6][SAFI_MPLS_VPN]
8257 || p->afc_recv[AFI_IP6][SAFI_MPLS_VPN]
Lou Bergera3fda882016-01-12 13:42:04 -05008258 || p->afc_adv[AFI_IP6][SAFI_ENCAP]
8259 || p->afc_recv[AFI_IP6][SAFI_ENCAP]
Lou Bergera3fda882016-01-12 13:42:04 -05008260 || p->afc_adv[AFI_IP][SAFI_ENCAP]
8261 || p->afc_recv[AFI_IP][SAFI_ENCAP]
paul718e3742002-12-13 20:15:29 +00008262 || p->afc_adv[AFI_IP][SAFI_MPLS_VPN]
8263 || p->afc_recv[AFI_IP][SAFI_MPLS_VPN])
8264 {
8265 vty_out (vty, " Neighbor capabilities:%s", VTY_NEWLINE);
8266
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00008267 /* AS4 */
8268 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV)
8269 || CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV))
8270 {
8271 vty_out (vty, " 4 Byte AS:");
8272 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV))
8273 vty_out (vty, " advertised");
8274 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV))
8275 vty_out (vty, " %sreceived",
8276 CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV) ? "and " : "");
8277 vty_out (vty, "%s", VTY_NEWLINE);
8278 }
paul718e3742002-12-13 20:15:29 +00008279 /* Dynamic */
8280 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)
8281 || CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV))
8282 {
8283 vty_out (vty, " Dynamic:");
8284 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV))
8285 vty_out (vty, " advertised");
8286 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV))
hasso538621f2004-05-21 09:31:30 +00008287 vty_out (vty, " %sreceived",
8288 CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV) ? "and " : "");
paul718e3742002-12-13 20:15:29 +00008289 vty_out (vty, "%s", VTY_NEWLINE);
8290 }
8291
8292 /* Route Refresh */
8293 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV)
8294 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)
8295 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
8296 {
8297 vty_out (vty, " Route refresh:");
8298 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV))
8299 vty_out (vty, " advertised");
8300 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)
8301 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
hasso538621f2004-05-21 09:31:30 +00008302 vty_out (vty, " %sreceived(%s)",
8303 CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) ? "and " : "",
8304 (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)
8305 && CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)) ?
8306 "old & new" : CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) ? "old" : "new");
8307
paul718e3742002-12-13 20:15:29 +00008308 vty_out (vty, "%s", VTY_NEWLINE);
8309 }
8310
hasso538621f2004-05-21 09:31:30 +00008311 /* Multiprotocol Extensions */
8312 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
8313 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
8314 if (p->afc_adv[afi][safi] || p->afc_recv[afi][safi])
paul718e3742002-12-13 20:15:29 +00008315 {
hasso538621f2004-05-21 09:31:30 +00008316 vty_out (vty, " Address family %s:", afi_safi_print (afi, safi));
8317 if (p->afc_adv[afi][safi])
8318 vty_out (vty, " advertised");
8319 if (p->afc_recv[afi][safi])
8320 vty_out (vty, " %sreceived", p->afc_adv[afi][safi] ? "and " : "");
8321 vty_out (vty, "%s", VTY_NEWLINE);
8322 }
8323
8324 /* Gracefull Restart */
8325 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)
8326 || CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
paul718e3742002-12-13 20:15:29 +00008327 {
hasso538621f2004-05-21 09:31:30 +00008328 vty_out (vty, " Graceful Restart Capabilty:");
8329 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
paul718e3742002-12-13 20:15:29 +00008330 vty_out (vty, " advertised");
hasso538621f2004-05-21 09:31:30 +00008331 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
8332 vty_out (vty, " %sreceived",
8333 CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV) ? "and " : "");
paul718e3742002-12-13 20:15:29 +00008334 vty_out (vty, "%s", VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00008335
8336 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
paul718e3742002-12-13 20:15:29 +00008337 {
hasso538621f2004-05-21 09:31:30 +00008338 int restart_af_count = 0;
8339
8340 vty_out (vty, " Remote Restart timer is %d seconds%s",
hasso93406d82005-02-02 14:40:33 +00008341 p->v_gr_restart, VTY_NEWLINE);
8342 vty_out (vty, " Address families by peer:%s ", VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00008343
8344 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
8345 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
8346 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_RCV))
8347 {
hasso93406d82005-02-02 14:40:33 +00008348 vty_out (vty, "%s%s(%s)", restart_af_count ? ", " : "",
8349 afi_safi_print (afi, safi),
8350 CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_PRESERVE_RCV) ?
8351 "preserved" : "not preserved");
hasso538621f2004-05-21 09:31:30 +00008352 restart_af_count++;
hasso93406d82005-02-02 14:40:33 +00008353 }
hasso538621f2004-05-21 09:31:30 +00008354 if (! restart_af_count)
8355 vty_out (vty, "none");
8356 vty_out (vty, "%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008357 }
paul718e3742002-12-13 20:15:29 +00008358 }
paul718e3742002-12-13 20:15:29 +00008359 }
8360 }
8361
hasso93406d82005-02-02 14:40:33 +00008362 /* graceful restart information */
8363 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)
8364 || p->t_gr_restart
8365 || p->t_gr_stale)
8366 {
8367 int eor_send_af_count = 0;
8368 int eor_receive_af_count = 0;
8369
8370 vty_out (vty, " Graceful restart informations:%s", VTY_NEWLINE);
8371 if (p->status == Established)
8372 {
8373 vty_out (vty, " End-of-RIB send: ");
8374 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
8375 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
8376 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_SEND))
8377 {
8378 vty_out (vty, "%s%s", eor_send_af_count ? ", " : "",
8379 afi_safi_print (afi, safi));
8380 eor_send_af_count++;
8381 }
8382 vty_out (vty, "%s", VTY_NEWLINE);
8383
8384 vty_out (vty, " End-of-RIB received: ");
8385 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
8386 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
8387 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_RECEIVED))
8388 {
8389 vty_out (vty, "%s%s", eor_receive_af_count ? ", " : "",
8390 afi_safi_print (afi, safi));
8391 eor_receive_af_count++;
8392 }
8393 vty_out (vty, "%s", VTY_NEWLINE);
8394 }
8395
8396 if (p->t_gr_restart)
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00008397 vty_out (vty, " The remaining time of restart timer is %ld%s",
8398 thread_timer_remain_second (p->t_gr_restart), VTY_NEWLINE);
8399
hasso93406d82005-02-02 14:40:33 +00008400 if (p->t_gr_stale)
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00008401 vty_out (vty, " The remaining time of stalepath timer is %ld%s",
8402 thread_timer_remain_second (p->t_gr_stale), VTY_NEWLINE);
hasso93406d82005-02-02 14:40:33 +00008403 }
8404
paul718e3742002-12-13 20:15:29 +00008405 /* Packet counts. */
hasso93406d82005-02-02 14:40:33 +00008406 vty_out (vty, " Message statistics:%s", VTY_NEWLINE);
8407 vty_out (vty, " Inq depth is 0%s", VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00008408 vty_out (vty, " Outq depth is %lu%s", (unsigned long) p->obuf->count, VTY_NEWLINE);
hasso93406d82005-02-02 14:40:33 +00008409 vty_out (vty, " Sent Rcvd%s", VTY_NEWLINE);
8410 vty_out (vty, " Opens: %10d %10d%s", p->open_out, p->open_in, VTY_NEWLINE);
8411 vty_out (vty, " Notifications: %10d %10d%s", p->notify_out, p->notify_in, VTY_NEWLINE);
8412 vty_out (vty, " Updates: %10d %10d%s", p->update_out, p->update_in, VTY_NEWLINE);
8413 vty_out (vty, " Keepalives: %10d %10d%s", p->keepalive_out, p->keepalive_in, VTY_NEWLINE);
8414 vty_out (vty, " Route Refresh: %10d %10d%s", p->refresh_out, p->refresh_in, VTY_NEWLINE);
8415 vty_out (vty, " Capability: %10d %10d%s", p->dynamic_cap_out, p->dynamic_cap_in, VTY_NEWLINE);
8416 vty_out (vty, " Total: %10d %10d%s", p->open_out + p->notify_out +
8417 p->update_out + p->keepalive_out + p->refresh_out + p->dynamic_cap_out,
8418 p->open_in + p->notify_in + p->update_in + p->keepalive_in + p->refresh_in +
8419 p->dynamic_cap_in, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008420
8421 /* advertisement-interval */
8422 vty_out (vty, " Minimum time between advertisement runs is %d seconds%s",
8423 p->v_routeadv, VTY_NEWLINE);
8424
8425 /* Update-source. */
8426 if (p->update_if || p->update_source)
8427 {
8428 vty_out (vty, " Update source is ");
8429 if (p->update_if)
8430 vty_out (vty, "%s", p->update_if);
8431 else if (p->update_source)
8432 vty_out (vty, "%s",
8433 sockunion2str (p->update_source, buf1, SU_ADDRSTRLEN));
8434 vty_out (vty, "%s", VTY_NEWLINE);
8435 }
8436
8437 /* Default weight */
8438 if (CHECK_FLAG (p->config, PEER_CONFIG_WEIGHT))
8439 vty_out (vty, " Default weight %d%s", p->weight,
8440 VTY_NEWLINE);
8441
8442 vty_out (vty, "%s", VTY_NEWLINE);
8443
8444 /* Address Family Information */
hasso538621f2004-05-21 09:31:30 +00008445 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
8446 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
8447 if (p->afc[afi][safi])
8448 bgp_show_peer_afi (vty, p, afi, safi);
paul718e3742002-12-13 20:15:29 +00008449
8450 vty_out (vty, " Connections established %d; dropped %d%s",
8451 p->established, p->dropped,
8452 VTY_NEWLINE);
8453
hassoe0701b72004-05-20 09:19:34 +00008454 if (! p->dropped)
8455 vty_out (vty, " Last reset never%s", VTY_NEWLINE);
8456 else
8457 vty_out (vty, " Last reset %s, due to %s%s",
8458 peer_uptime (p->resettime, timebuf, BGP_UPTIME_LEN),
8459 peer_down_str[(int) p->last_reset], VTY_NEWLINE);
paul848973c2003-08-13 00:32:49 +00008460
paul718e3742002-12-13 20:15:29 +00008461 if (CHECK_FLAG (p->sflags, PEER_STATUS_PREFIX_OVERFLOW))
8462 {
8463 vty_out (vty, " Peer had exceeded the max. no. of prefixes configured.%s", VTY_NEWLINE);
hasso0a486e52005-02-01 20:57:17 +00008464
8465 if (p->t_pmax_restart)
8466 vty_out (vty, " Reduce the no. of prefix from %s, will restart in %ld seconds%s",
8467 p->host, thread_timer_remain_second (p->t_pmax_restart),
8468 VTY_NEWLINE);
8469 else
8470 vty_out (vty, " Reduce the no. of prefix and clear ip bgp %s to restore peering%s",
8471 p->host, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008472 }
8473
Stephen Hemmingerf5a48272011-03-24 17:30:21 +00008474 /* EBGP Multihop and GTSM */
Jorge Boncompte [DTI2]6d85b152012-05-07 16:52:54 +00008475 if (p->sort != BGP_PEER_IBGP)
Stephen Hemmingerf5a48272011-03-24 17:30:21 +00008476 {
8477 if (p->gtsm_hops > 0)
8478 vty_out (vty, " External BGP neighbor may be up to %d hops away.%s",
8479 p->gtsm_hops, VTY_NEWLINE);
8480 else if (p->ttl > 1)
8481 vty_out (vty, " External BGP neighbor may be up to %d hops away.%s",
8482 p->ttl, VTY_NEWLINE);
8483 }
Pradosh Mohapatra5d804b42013-09-12 03:37:07 +00008484 else
8485 {
8486 if (p->gtsm_hops > 0)
8487 vty_out (vty, " Internal BGP neighbor may be up to %d hops away.%s",
8488 p->gtsm_hops, VTY_NEWLINE);
8489 }
paul718e3742002-12-13 20:15:29 +00008490
8491 /* Local address. */
8492 if (p->su_local)
8493 {
hasso93406d82005-02-02 14:40:33 +00008494 vty_out (vty, "Local host: %s, Local port: %d%s",
paul718e3742002-12-13 20:15:29 +00008495 sockunion2str (p->su_local, buf1, SU_ADDRSTRLEN),
8496 ntohs (p->su_local->sin.sin_port),
paul718e3742002-12-13 20:15:29 +00008497 VTY_NEWLINE);
8498 }
8499
8500 /* Remote address. */
8501 if (p->su_remote)
8502 {
8503 vty_out (vty, "Foreign host: %s, Foreign port: %d%s",
8504 sockunion2str (p->su_remote, buf1, SU_ADDRSTRLEN),
8505 ntohs (p->su_remote->sin.sin_port),
8506 VTY_NEWLINE);
8507 }
8508
8509 /* Nexthop display. */
8510 if (p->su_local)
8511 {
8512 vty_out (vty, "Nexthop: %s%s",
8513 inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ),
8514 VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008515 vty_out (vty, "Nexthop global: %s%s",
8516 inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ),
8517 VTY_NEWLINE);
8518 vty_out (vty, "Nexthop local: %s%s",
8519 inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ),
8520 VTY_NEWLINE);
8521 vty_out (vty, "BGP connection: %s%s",
8522 p->shared_network ? "shared network" : "non shared network",
8523 VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008524 }
8525
Timo Teräsef757702015-04-29 09:43:04 +03008526 /* TCP metrics. */
8527 if (p->status == Established && p->rtt)
8528 vty_out (vty, "Estimated round trip time: %d ms%s",
8529 p->rtt, VTY_NEWLINE);
8530
paul718e3742002-12-13 20:15:29 +00008531 /* Timer information. */
8532 if (p->t_start)
8533 vty_out (vty, "Next start timer due in %ld seconds%s",
8534 thread_timer_remain_second (p->t_start), VTY_NEWLINE);
8535 if (p->t_connect)
8536 vty_out (vty, "Next connect timer due in %ld seconds%s",
8537 thread_timer_remain_second (p->t_connect), VTY_NEWLINE);
8538
8539 vty_out (vty, "Read thread: %s Write thread: %s%s",
8540 p->t_read ? "on" : "off",
8541 p->t_write ? "on" : "off",
8542 VTY_NEWLINE);
8543
8544 if (p->notify.code == BGP_NOTIFY_OPEN_ERR
8545 && p->notify.subcode == BGP_NOTIFY_OPEN_UNSUP_CAPBL)
8546 bgp_capability_vty_out (vty, p);
8547
8548 vty_out (vty, "%s", VTY_NEWLINE);
8549}
8550
paul94f2b392005-06-28 12:44:16 +00008551static int
paul718e3742002-12-13 20:15:29 +00008552bgp_show_neighbor (struct vty *vty, struct bgp *bgp,
8553 enum show_type type, union sockunion *su)
8554{
paul1eb8ef22005-04-07 07:30:20 +00008555 struct listnode *node, *nnode;
paul718e3742002-12-13 20:15:29 +00008556 struct peer *peer;
8557 int find = 0;
8558
paul1eb8ef22005-04-07 07:30:20 +00008559 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00008560 {
8561 switch (type)
8562 {
8563 case show_all:
8564 bgp_show_peer (vty, peer);
8565 break;
8566 case show_peer:
8567 if (sockunion_same (&peer->su, su))
8568 {
8569 find = 1;
8570 bgp_show_peer (vty, peer);
8571 }
8572 break;
8573 }
8574 }
8575
8576 if (type == show_peer && ! find)
8577 vty_out (vty, "%% No such neighbor%s", VTY_NEWLINE);
8578
8579 return CMD_SUCCESS;
8580}
8581
paul94f2b392005-06-28 12:44:16 +00008582static int
paulfd79ac92004-10-13 05:06:08 +00008583bgp_show_neighbor_vty (struct vty *vty, const char *name,
8584 enum show_type type, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00008585{
8586 int ret;
8587 struct bgp *bgp;
8588 union sockunion su;
8589
8590 if (ip_str)
8591 {
8592 ret = str2sockunion (ip_str, &su);
8593 if (ret < 0)
8594 {
8595 vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE);
8596 return CMD_WARNING;
8597 }
8598 }
8599
8600 if (name)
8601 {
8602 bgp = bgp_lookup_by_name (name);
8603
8604 if (! bgp)
8605 {
8606 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
8607 return CMD_WARNING;
8608 }
8609
8610 bgp_show_neighbor (vty, bgp, type, &su);
8611
8612 return CMD_SUCCESS;
8613 }
8614
8615 bgp = bgp_get_default ();
8616
8617 if (bgp)
8618 bgp_show_neighbor (vty, bgp, type, &su);
8619
8620 return CMD_SUCCESS;
8621}
8622
Lou Bergerf9b6c392016-01-12 13:42:09 -05008623/* "show ip bgp neighbors" commands. */DEFUN (show_ip_bgp_neighbors,
8624 show_ip_bgp_neighbors_cmd,
8625 "show ip bgp neighbors",
8626 SHOW_STR
8627 IP_STR
8628 BGP_STR
8629 "Detailed information on TCP and BGP neighbor connections\n")
8630{
8631 return bgp_show_neighbor_vty (vty, NULL, show_all, NULL);
8632}
8633
8634ALIAS (show_ip_bgp_neighbors,
8635 show_ip_bgp_ipv4_neighbors_cmd,
8636 "show ip bgp ipv4 (unicast|multicast) neighbors",
8637 SHOW_STR
8638 IP_STR
8639 BGP_STR
8640 "Address family\n"
8641 "Address Family modifier\n"
8642 "Address Family modifier\n"
8643 "Detailed information on TCP and BGP neighbor connections\n")
8644
8645ALIAS (show_ip_bgp_neighbors,
8646 show_ip_bgp_vpnv4_all_neighbors_cmd,
8647 "show ip bgp vpnv4 all neighbors",
8648 SHOW_STR
8649 IP_STR
8650 BGP_STR
8651 "Display VPNv4 NLRI specific information\n"
8652 "Display information about all VPNv4 NLRIs\n"
8653 "Detailed information on TCP and BGP neighbor connections\n")
8654
8655ALIAS (show_ip_bgp_neighbors,
8656 show_ip_bgp_vpnv4_rd_neighbors_cmd,
8657 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors",
8658 SHOW_STR
8659 IP_STR
8660 BGP_STR
8661 "Display VPNv4 NLRI specific information\n"
8662 "Display information for a route distinguisher\n"
8663 "VPN Route Distinguisher\n"
8664 "Detailed information on TCP and BGP neighbor connections\n")
8665
8666ALIAS (show_ip_bgp_neighbors,
8667 show_bgp_ipv6_neighbors_cmd,
8668 "show bgp ipv6 neighbors",
8669 SHOW_STR
8670 BGP_STR
8671 "Address family\n"
8672 "Detailed information on TCP and BGP neighbor connections\n")
8673
8674DEFUN (show_ip_bgp_neighbors_peer,
8675 show_ip_bgp_neighbors_peer_cmd,
8676 "show ip bgp neighbors (A.B.C.D|X:X::X:X)",
8677 SHOW_STR
8678 IP_STR
8679 BGP_STR
8680 "Detailed information on TCP and BGP neighbor connections\n"
8681 "Neighbor to display information about\n"
8682 "Neighbor to display information about\n")
8683{
8684 return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 1]);
8685}
8686
8687ALIAS (show_ip_bgp_neighbors_peer,
8688 show_ip_bgp_ipv4_neighbors_peer_cmd,
8689 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X)",
8690 SHOW_STR
8691 IP_STR
8692 BGP_STR
8693 "Address family\n"
8694 "Address Family modifier\n"
8695 "Address Family modifier\n"
8696 "Detailed information on TCP and BGP neighbor connections\n"
8697 "Neighbor to display information about\n"
8698 "Neighbor to display information about\n")
8699
8700ALIAS (show_ip_bgp_neighbors_peer,
8701 show_ip_bgp_vpnv4_all_neighbors_peer_cmd,
8702 "show ip bgp vpnv4 all neighbors A.B.C.D",
8703 SHOW_STR
8704 IP_STR
8705 BGP_STR
8706 "Display VPNv4 NLRI specific information\n"
8707 "Display information about all VPNv4 NLRIs\n"
8708 "Detailed information on TCP and BGP neighbor connections\n"
8709 "Neighbor to display information about\n")
8710
8711ALIAS (show_ip_bgp_neighbors_peer,
8712 show_ip_bgp_vpnv4_rd_neighbors_peer_cmd,
8713 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D",
8714 SHOW_STR
8715 IP_STR
8716 BGP_STR
8717 "Display VPNv4 NLRI specific information\n"
8718 "Display information about all VPNv4 NLRIs\n"
8719 "Detailed information on TCP and BGP neighbor connections\n"
8720 "Neighbor to display information about\n")
8721
8722ALIAS (show_ip_bgp_neighbors_peer,
8723 show_bgp_ipv6_neighbors_peer_cmd,
8724 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X)",
8725 SHOW_STR
8726 BGP_STR
8727 "Address family\n"
8728 "Detailed information on TCP and BGP neighbor connections\n"
8729 "Neighbor to display information about\n"
8730 "Neighbor to display information about\n")
8731
8732DEFUN (show_ip_bgp_instance_neighbors,
8733 show_ip_bgp_instance_neighbors_cmd,
8734 "show ip bgp view WORD neighbors",
8735 SHOW_STR
8736 IP_STR
8737 BGP_STR
8738 "BGP view\n"
8739 "View name\n"
8740 "Detailed information on TCP and BGP neighbor connections\n")
8741{
8742 return bgp_show_neighbor_vty (vty, argv[0], show_all, NULL);
8743}
8744
8745ALIAS (show_ip_bgp_instance_neighbors,
8746 show_bgp_instance_ipv6_neighbors_cmd,
8747 "show bgp view WORD ipv6 neighbors",
8748 SHOW_STR
8749 BGP_STR
8750 "BGP view\n"
8751 "View name\n"
8752 "Address family\n"
8753 "Detailed information on TCP and BGP neighbor connections\n")
8754
8755DEFUN (show_ip_bgp_instance_neighbors_peer,
8756 show_ip_bgp_instance_neighbors_peer_cmd,
8757 "show ip bgp view WORD neighbors (A.B.C.D|X:X::X:X)",
8758 SHOW_STR
8759 IP_STR
8760 BGP_STR
8761 "BGP view\n"
8762 "View name\n"
8763 "Detailed information on TCP and BGP neighbor connections\n"
8764 "Neighbor to display information about\n"
8765 "Neighbor to display information about\n")
8766{
8767 return bgp_show_neighbor_vty (vty, argv[0], show_peer, argv[1]);
8768}
8769
8770/* Show BGP's AS paths internal data. There are both `show ip bgp
8771 paths' and `show ip mbgp paths'. Those functions results are the
8772 same.*/
8773DEFUN (show_ip_bgp_paths,
8774 show_ip_bgp_paths_cmd,
8775 "show ip bgp paths",
8776 SHOW_STR
8777 IP_STR
8778 BGP_STR
8779 "Path information\n")
8780{
8781 vty_out (vty, "Address Refcnt Path%s", VTY_NEWLINE);
8782 aspath_print_all_vty (vty);
8783 return CMD_SUCCESS;
8784}
8785
8786DEFUN (show_ip_bgp_ipv4_paths,
8787 show_ip_bgp_ipv4_paths_cmd,
8788 "show ip bgp ipv4 (unicast|multicast) paths",
8789 SHOW_STR
8790 IP_STR
8791 BGP_STR
8792 "Address family\n"
8793 "Address Family modifier\n"
8794 "Address Family modifier\n"
8795 "Path information\n")
8796{
8797 vty_out (vty, "Address Refcnt Path\r\n");
8798 aspath_print_all_vty (vty);
8799
8800 return CMD_SUCCESS;
8801}
8802
Lou Berger651b4022016-01-12 13:42:07 -05008803DEFUN (show_bgp_neighbors,
8804 show_bgp_neighbors_cmd,
8805 "show bgp neighbors",
paul718e3742002-12-13 20:15:29 +00008806 SHOW_STR
paul718e3742002-12-13 20:15:29 +00008807 BGP_STR
8808 "Detailed information on TCP and BGP neighbor connections\n")
8809{
8810 return bgp_show_neighbor_vty (vty, NULL, show_all, NULL);
8811}
8812
Lou Berger651b4022016-01-12 13:42:07 -05008813DEFUN (show_bgp_neighbors_peer,
8814 show_bgp_neighbors_peer_cmd,
Lou Berger651b4022016-01-12 13:42:07 -05008815 "show bgp neighbors (A.B.C.D|X:X::X:X)",
paul718e3742002-12-13 20:15:29 +00008816 SHOW_STR
paul718e3742002-12-13 20:15:29 +00008817 BGP_STR
8818 "Detailed information on TCP and BGP neighbor connections\n"
8819 "Neighbor to display information about\n"
8820 "Neighbor to display information about\n")
8821{
8822 return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 1]);
8823}
8824
Lou Berger651b4022016-01-12 13:42:07 -05008825DEFUN (show_bgp_instance_neighbors,
8826 show_bgp_instance_neighbors_cmd,
8827 "show bgp view WORD neighbors",
paul718e3742002-12-13 20:15:29 +00008828 SHOW_STR
paul718e3742002-12-13 20:15:29 +00008829 BGP_STR
8830 "BGP view\n"
8831 "View name\n"
8832 "Detailed information on TCP and BGP neighbor connections\n")
8833{
8834 return bgp_show_neighbor_vty (vty, argv[0], show_all, NULL);
8835}
8836
Lou Berger651b4022016-01-12 13:42:07 -05008837DEFUN (show_bgp_instance_neighbors_peer,
8838 show_bgp_instance_neighbors_peer_cmd,
Lou Berger651b4022016-01-12 13:42:07 -05008839 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X)",
paul718e3742002-12-13 20:15:29 +00008840 SHOW_STR
paul718e3742002-12-13 20:15:29 +00008841 BGP_STR
8842 "BGP view\n"
8843 "View name\n"
8844 "Detailed information on TCP and BGP neighbor connections\n"
8845 "Neighbor to display information about\n"
8846 "Neighbor to display information about\n")
8847{
8848 return bgp_show_neighbor_vty (vty, argv[0], show_peer, argv[1]);
8849}
paulbb46e942003-10-24 19:02:03 +00008850
Lou Berger651b4022016-01-12 13:42:07 -05008851ALIAS (show_bgp_instance_neighbors_peer,
paulbb46e942003-10-24 19:02:03 +00008852 show_bgp_instance_ipv6_neighbors_peer_cmd,
8853 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X)",
8854 SHOW_STR
8855 BGP_STR
8856 "BGP view\n"
8857 "View name\n"
8858 "Address family\n"
8859 "Detailed information on TCP and BGP neighbor connections\n"
8860 "Neighbor to display information about\n"
8861 "Neighbor to display information about\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02008862
paul718e3742002-12-13 20:15:29 +00008863/* Show BGP's AS paths internal data. There are both `show ip bgp
8864 paths' and `show ip mbgp paths'. Those functions results are the
8865 same.*/
Lou Berger651b4022016-01-12 13:42:07 -05008866DEFUN (show_bgp_ipv4_paths,
8867 show_bgp_ipv4_paths_cmd,
8868 "show bgp paths",
paul718e3742002-12-13 20:15:29 +00008869 SHOW_STR
paul718e3742002-12-13 20:15:29 +00008870 BGP_STR
8871 "Path information\n")
8872{
8873 vty_out (vty, "Address Refcnt Path%s", VTY_NEWLINE);
8874 aspath_print_all_vty (vty);
8875 return CMD_SUCCESS;
8876}
8877
paul718e3742002-12-13 20:15:29 +00008878#include "hash.h"
8879
paul94f2b392005-06-28 12:44:16 +00008880static void
paul718e3742002-12-13 20:15:29 +00008881community_show_all_iterator (struct hash_backet *backet, struct vty *vty)
8882{
8883 struct community *com;
8884
8885 com = (struct community *) backet->data;
David Lampartereed3c482015-03-03 08:51:53 +01008886 vty_out (vty, "[%p] (%ld) %s%s", (void *)backet, com->refcnt,
paul718e3742002-12-13 20:15:29 +00008887 community_str (com), VTY_NEWLINE);
8888}
8889
8890/* Show BGP's community internal data. */
8891DEFUN (show_ip_bgp_community_info,
8892 show_ip_bgp_community_info_cmd,
8893 "show ip bgp community-info",
8894 SHOW_STR
8895 IP_STR
8896 BGP_STR
8897 "List all bgp community information\n")
8898{
8899 vty_out (vty, "Address Refcnt Community%s", VTY_NEWLINE);
8900
8901 hash_iterate (community_hash (),
8902 (void (*) (struct hash_backet *, void *))
8903 community_show_all_iterator,
8904 vty);
8905
8906 return CMD_SUCCESS;
8907}
8908
8909DEFUN (show_ip_bgp_attr_info,
8910 show_ip_bgp_attr_info_cmd,
8911 "show ip bgp attribute-info",
8912 SHOW_STR
8913 IP_STR
8914 BGP_STR
8915 "List all bgp attribute information\n")
8916{
8917 attr_show_all (vty);
8918 return CMD_SUCCESS;
8919}
David Lamparter6b0655a2014-06-04 06:53:35 +02008920
paul94f2b392005-06-28 12:44:16 +00008921static int
paulfee0f4c2004-09-13 05:12:46 +00008922bgp_write_rsclient_summary (struct vty *vty, struct peer *rsclient,
8923 afi_t afi, safi_t safi)
8924{
8925 char timebuf[BGP_UPTIME_LEN];
8926 char rmbuf[14];
paulfd79ac92004-10-13 05:06:08 +00008927 const char *rmname;
paulfee0f4c2004-09-13 05:12:46 +00008928 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00008929 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00008930 int len;
8931 int count = 0;
8932
8933 if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_GROUP))
8934 {
paul1eb8ef22005-04-07 07:30:20 +00008935 for (ALL_LIST_ELEMENTS (rsclient->group->peer, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00008936 {
8937 count++;
8938 bgp_write_rsclient_summary (vty, peer, afi, safi);
8939 }
8940 return count;
8941 }
8942
8943 len = vty_out (vty, "%s", rsclient->host);
8944 len = 16 - len;
8945
8946 if (len < 1)
8947 vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " ");
8948 else
8949 vty_out (vty, "%*s", len, " ");
8950
hasso3d515fd2005-02-01 21:30:04 +00008951 vty_out (vty, "4 ");
paulfee0f4c2004-09-13 05:12:46 +00008952
Milan Kociancb4fc592014-12-01 12:48:25 +00008953 vty_out (vty, "%10u ", rsclient->as);
paulfee0f4c2004-09-13 05:12:46 +00008954
8955 rmname = ROUTE_MAP_EXPORT_NAME(&rsclient->filter[afi][safi]);
8956 if ( rmname && strlen (rmname) > 13 )
8957 {
8958 sprintf (rmbuf, "%13s", "...");
8959 rmname = strncpy (rmbuf, rmname, 10);
8960 }
8961 else if (! rmname)
8962 rmname = "<none>";
8963 vty_out (vty, " %13s ", rmname);
8964
8965 rmname = ROUTE_MAP_IMPORT_NAME(&rsclient->filter[afi][safi]);
8966 if ( rmname && strlen (rmname) > 13 )
8967 {
8968 sprintf (rmbuf, "%13s", "...");
8969 rmname = strncpy (rmbuf, rmname, 10);
8970 }
8971 else if (! rmname)
8972 rmname = "<none>";
8973 vty_out (vty, " %13s ", rmname);
8974
8975 vty_out (vty, "%8s", peer_uptime (rsclient->uptime, timebuf, BGP_UPTIME_LEN));
8976
8977 if (CHECK_FLAG (rsclient->flags, PEER_FLAG_SHUTDOWN))
8978 vty_out (vty, " Idle (Admin)");
8979 else if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_PREFIX_OVERFLOW))
8980 vty_out (vty, " Idle (PfxCt)");
8981 else
8982 vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, rsclient->status));
8983
8984 vty_out (vty, "%s", VTY_NEWLINE);
8985
8986 return 1;
8987}
8988
paul94f2b392005-06-28 12:44:16 +00008989static int
paulfd79ac92004-10-13 05:06:08 +00008990bgp_show_rsclient_summary (struct vty *vty, struct bgp *bgp,
8991 afi_t afi, safi_t safi)
paulfee0f4c2004-09-13 05:12:46 +00008992{
8993 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00008994 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00008995 int count = 0;
8996
8997 /* Header string for each address family. */
Milan Kociancb4fc592014-12-01 12:48:25 +00008998 static char header[] = "Neighbor V AS Export-Policy Import-Policy Up/Down State";
paulfee0f4c2004-09-13 05:12:46 +00008999
paul1eb8ef22005-04-07 07:30:20 +00009000 for (ALL_LIST_ELEMENTS (bgp->rsclient, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00009001 {
9002 if (peer->afc[afi][safi] &&
9003 CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT))
9004 {
9005 if (! count)
9006 {
9007 vty_out (vty,
9008 "Route Server's BGP router identifier %s%s",
9009 inet_ntoa (bgp->router_id), VTY_NEWLINE);
9010 vty_out (vty,
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04009011 "Route Server's local AS number %u%s", bgp->as,
paulfee0f4c2004-09-13 05:12:46 +00009012 VTY_NEWLINE);
9013
9014 vty_out (vty, "%s", VTY_NEWLINE);
9015 vty_out (vty, "%s%s", header, VTY_NEWLINE);
9016 }
9017
9018 count += bgp_write_rsclient_summary (vty, peer, afi, safi);
9019 }
9020 }
9021
9022 if (count)
9023 vty_out (vty, "%sTotal number of Route Server Clients %d%s", VTY_NEWLINE,
9024 count, VTY_NEWLINE);
9025 else
9026 vty_out (vty, "No %s Route Server Client is configured%s",
9027 afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE);
9028
9029 return CMD_SUCCESS;
9030}
9031
paul94f2b392005-06-28 12:44:16 +00009032static int
paulfd79ac92004-10-13 05:06:08 +00009033bgp_show_rsclient_summary_vty (struct vty *vty, const char *name,
9034 afi_t afi, safi_t safi)
paulfee0f4c2004-09-13 05:12:46 +00009035{
9036 struct bgp *bgp;
9037
9038 if (name)
9039 {
9040 bgp = bgp_lookup_by_name (name);
9041
9042 if (! bgp)
9043 {
9044 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
9045 return CMD_WARNING;
9046 }
9047
9048 bgp_show_rsclient_summary (vty, bgp, afi, safi);
9049 return CMD_SUCCESS;
9050 }
9051
9052 bgp = bgp_get_default ();
9053
9054 if (bgp)
9055 bgp_show_rsclient_summary (vty, bgp, afi, safi);
9056
9057 return CMD_SUCCESS;
9058}
9059
9060/* 'show bgp rsclient' commands. */
Lou Bergerf9b6c392016-01-12 13:42:09 -05009061DEFUN (show_ip_bgp_rsclient_summary,
9062 show_ip_bgp_rsclient_summary_cmd,
9063 "show ip bgp rsclient summary",
9064 SHOW_STR
9065 IP_STR
9066 BGP_STR
9067 "Information about Route Server Clients\n"
9068 "Summary of all Route Server Clients\n")
9069{
9070 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
9071}
9072
9073DEFUN (show_ip_bgp_instance_rsclient_summary,
9074 show_ip_bgp_instance_rsclient_summary_cmd,
9075 "show ip bgp view WORD rsclient summary",
9076 SHOW_STR
9077 IP_STR
9078 BGP_STR
9079 "BGP view\n"
9080 "View name\n"
9081 "Information about Route Server Clients\n"
9082 "Summary of all Route Server Clients\n")
9083{
9084 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
9085}
9086
9087DEFUN (show_ip_bgp_ipv4_rsclient_summary,
9088 show_ip_bgp_ipv4_rsclient_summary_cmd,
9089 "show ip bgp ipv4 (unicast|multicast) rsclient summary",
9090 SHOW_STR
9091 IP_STR
9092 BGP_STR
9093 "Address family\n"
9094 "Address Family modifier\n"
9095 "Address Family modifier\n"
9096 "Information about Route Server Clients\n"
9097 "Summary of all Route Server Clients\n")
9098{
9099 if (strncmp (argv[0], "m", 1) == 0)
9100 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
9101
9102 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
9103}
9104
9105DEFUN (show_ip_bgp_instance_ipv4_rsclient_summary,
9106 show_ip_bgp_instance_ipv4_rsclient_summary_cmd,
9107 "show ip bgp view WORD ipv4 (unicast|multicast) rsclient summary",
9108 SHOW_STR
9109 IP_STR
9110 BGP_STR
9111 "BGP view\n"
9112 "View name\n"
9113 "Address family\n"
9114 "Address Family modifier\n"
9115 "Address Family modifier\n"
9116 "Information about Route Server Clients\n"
9117 "Summary of all Route Server Clients\n")
9118{
9119 if (strncmp (argv[1], "m", 1) == 0)
9120 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
9121
9122 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
9123}
paulfee0f4c2004-09-13 05:12:46 +00009124
Michael Lambert95cbbd22010-07-23 14:43:04 -04009125DEFUN (show_bgp_instance_ipv4_safi_rsclient_summary,
9126 show_bgp_instance_ipv4_safi_rsclient_summary_cmd,
9127 "show bgp view WORD ipv4 (unicast|multicast) rsclient summary",
9128 SHOW_STR
9129 BGP_STR
9130 "BGP view\n"
9131 "View name\n"
9132 "Address family\n"
9133 "Address Family modifier\n"
9134 "Address Family modifier\n"
9135 "Information about Route Server Clients\n"
9136 "Summary of all Route Server Clients\n")
9137{
9138 safi_t safi;
9139
9140 if (argc == 2) {
9141 safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
9142 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, safi);
9143 } else {
9144 safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
9145 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, safi);
9146 }
9147}
9148
9149ALIAS (show_bgp_instance_ipv4_safi_rsclient_summary,
9150 show_bgp_ipv4_safi_rsclient_summary_cmd,
9151 "show bgp ipv4 (unicast|multicast) rsclient summary",
9152 SHOW_STR
9153 BGP_STR
9154 "Address family\n"
9155 "Address Family modifier\n"
9156 "Address Family modifier\n"
9157 "Information about Route Server Clients\n"
9158 "Summary of all Route Server Clients\n")
9159
paulfee0f4c2004-09-13 05:12:46 +00009160DEFUN (show_bgp_rsclient_summary,
9161 show_bgp_rsclient_summary_cmd,
9162 "show bgp rsclient summary",
9163 SHOW_STR
9164 BGP_STR
9165 "Information about Route Server Clients\n"
9166 "Summary of all Route Server Clients\n")
9167{
Lou Berger651b4022016-01-12 13:42:07 -05009168 vty_out(vty, "%sIPv4 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9169 vty_out(vty, "---------------------%s", VTY_NEWLINE);
9170 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
9171 vty_out(vty, "%sIPv4 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9172 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
9173 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
9174 vty_out(vty, "%sIPv4 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9175 vty_out(vty, "-----------------%s", VTY_NEWLINE);
9176 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
9177 vty_out(vty, "%sIPv4 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9178 vty_out(vty, "-------------------%s", VTY_NEWLINE);
9179 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_ENCAP);
9180
Lou Berger651b4022016-01-12 13:42:07 -05009181 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9182 vty_out(vty, "---------------------%s", VTY_NEWLINE);
9183 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
9184 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9185 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
9186 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
9187 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9188 vty_out(vty, "-----------------%s", VTY_NEWLINE);
9189 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_MPLS_VPN);
9190 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9191 vty_out(vty, "-------------------%s", VTY_NEWLINE);
9192 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_ENCAP);
Lou Berger205e6742016-01-12 13:42:11 -05009193
Lou Berger651b4022016-01-12 13:42:07 -05009194 return CMD_SUCCESS;
paulfee0f4c2004-09-13 05:12:46 +00009195}
9196
9197DEFUN (show_bgp_instance_rsclient_summary,
9198 show_bgp_instance_rsclient_summary_cmd,
9199 "show bgp view WORD rsclient summary",
9200 SHOW_STR
9201 BGP_STR
9202 "BGP view\n"
9203 "View name\n"
9204 "Information about Route Server Clients\n"
9205 "Summary of all Route Server Clients\n")
9206{
Lou Berger651b4022016-01-12 13:42:07 -05009207 vty_out(vty, "%sIPv4 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9208 vty_out(vty, "---------------------%s", VTY_NEWLINE);
9209 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
9210 vty_out(vty, "%sIPv4 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9211 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
9212 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
9213 vty_out(vty, "%sIPv4 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9214 vty_out(vty, "-----------------%s", VTY_NEWLINE);
9215 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_MPLS_VPN);
9216 vty_out(vty, "%sIPv4 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9217 vty_out(vty, "-------------------%s", VTY_NEWLINE);
9218 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_ENCAP);
9219
Lou Berger651b4022016-01-12 13:42:07 -05009220 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9221 vty_out(vty, "---------------------%s", VTY_NEWLINE);
9222 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
9223 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9224 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
9225 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST);
9226 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9227 vty_out(vty, "-----------------%s", VTY_NEWLINE);
9228 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_MPLS_VPN);
9229 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9230 vty_out(vty, "-------------------%s", VTY_NEWLINE);
9231 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_ENCAP);
Lou Berger205e6742016-01-12 13:42:11 -05009232
Lou Berger651b4022016-01-12 13:42:07 -05009233 return CMD_SUCCESS;
paulfee0f4c2004-09-13 05:12:46 +00009234}
9235
Lou Berger651b4022016-01-12 13:42:07 -05009236DEFUN (show_bgp_ipv6_rsclient_summary,
paulfee0f4c2004-09-13 05:12:46 +00009237 show_bgp_ipv6_rsclient_summary_cmd,
9238 "show bgp ipv6 rsclient summary",
9239 SHOW_STR
9240 BGP_STR
9241 "Address family\n"
9242 "Information about Route Server Clients\n"
9243 "Summary of all Route Server Clients\n")
Lou Berger651b4022016-01-12 13:42:07 -05009244{
9245 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9246 vty_out(vty, "---------------------%s", VTY_NEWLINE);
9247 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
9248 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9249 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
9250 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
9251 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9252 vty_out(vty, "-----------------%s", VTY_NEWLINE);
9253 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_MPLS_VPN);
9254 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9255 vty_out(vty, "-------------------%s", VTY_NEWLINE);
9256 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_ENCAP);
paulfee0f4c2004-09-13 05:12:46 +00009257
Lou Berger651b4022016-01-12 13:42:07 -05009258 return CMD_SUCCESS;
9259}
9260
9261DEFUN (show_bgp_instance_ipv6_rsclient_summary,
paulfee0f4c2004-09-13 05:12:46 +00009262 show_bgp_instance_ipv6_rsclient_summary_cmd,
9263 "show bgp view WORD ipv6 rsclient summary",
9264 SHOW_STR
9265 BGP_STR
9266 "BGP view\n"
9267 "View name\n"
9268 "Address family\n"
9269 "Information about Route Server Clients\n"
9270 "Summary of all Route Server Clients\n")
Lou Berger651b4022016-01-12 13:42:07 -05009271{
9272 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9273 vty_out(vty, "---------------------%s", VTY_NEWLINE);
9274 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
9275 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9276 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
9277 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST);
9278 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9279 vty_out(vty, "-----------------%s", VTY_NEWLINE);
9280 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_MPLS_VPN);
9281 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
9282 vty_out(vty, "-------------------%s", VTY_NEWLINE);
9283 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_ENCAP);
9284
9285 return CMD_SUCCESS;
9286}
Michael Lambert95cbbd22010-07-23 14:43:04 -04009287
9288DEFUN (show_bgp_instance_ipv6_safi_rsclient_summary,
9289 show_bgp_instance_ipv6_safi_rsclient_summary_cmd,
9290 "show bgp view WORD ipv6 (unicast|multicast) rsclient summary",
9291 SHOW_STR
9292 BGP_STR
9293 "BGP view\n"
9294 "View name\n"
9295 "Address family\n"
9296 "Address Family modifier\n"
9297 "Address Family modifier\n"
9298 "Information about Route Server Clients\n"
9299 "Summary of all Route Server Clients\n")
9300{
9301 safi_t safi;
9302
9303 if (argc == 2) {
9304 safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
9305 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, safi);
9306 } else {
9307 safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
9308 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, safi);
9309 }
9310}
9311
9312ALIAS (show_bgp_instance_ipv6_safi_rsclient_summary,
9313 show_bgp_ipv6_safi_rsclient_summary_cmd,
9314 "show bgp ipv6 (unicast|multicast) rsclient summary",
9315 SHOW_STR
9316 BGP_STR
Lou Berger651b4022016-01-12 13:42:07 -05009317 IPV6_STR
Michael Lambert95cbbd22010-07-23 14:43:04 -04009318 "Address Family modifier\n"
9319 "Address Family modifier\n"
9320 "Information about Route Server Clients\n"
9321 "Summary of all Route Server Clients\n")
9322
paul718e3742002-12-13 20:15:29 +00009323/* Redistribute VTY commands. */
9324
paul718e3742002-12-13 20:15:29 +00009325DEFUN (bgp_redistribute_ipv4,
9326 bgp_redistribute_ipv4_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009327 "redistribute " QUAGGA_IP_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00009328 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009329 QUAGGA_IP_REDIST_HELP_STR_BGPD)
paul718e3742002-12-13 20:15:29 +00009330{
9331 int type;
9332
David Lampartere0ca5fd2009-09-16 01:52:42 +02009333 type = proto_redistnum (AFI_IP, argv[0]);
9334 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009335 {
9336 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9337 return CMD_WARNING;
9338 }
9339 return bgp_redistribute_set (vty->index, AFI_IP, type);
9340}
9341
9342DEFUN (bgp_redistribute_ipv4_rmap,
9343 bgp_redistribute_ipv4_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009344 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00009345 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009346 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009347 "Route map reference\n"
9348 "Pointer to route-map entries\n")
9349{
9350 int type;
9351
David Lampartere0ca5fd2009-09-16 01:52:42 +02009352 type = proto_redistnum (AFI_IP, argv[0]);
9353 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009354 {
9355 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9356 return CMD_WARNING;
9357 }
9358
9359 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]);
9360 return bgp_redistribute_set (vty->index, AFI_IP, type);
9361}
9362
9363DEFUN (bgp_redistribute_ipv4_metric,
9364 bgp_redistribute_ipv4_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009365 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009366 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009367 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009368 "Metric for redistributed routes\n"
9369 "Default metric\n")
9370{
9371 int type;
9372 u_int32_t metric;
9373
David Lampartere0ca5fd2009-09-16 01:52:42 +02009374 type = proto_redistnum (AFI_IP, argv[0]);
9375 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009376 {
9377 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9378 return CMD_WARNING;
9379 }
9380 VTY_GET_INTEGER ("metric", metric, argv[1]);
9381
9382 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
9383 return bgp_redistribute_set (vty->index, AFI_IP, type);
9384}
9385
9386DEFUN (bgp_redistribute_ipv4_rmap_metric,
9387 bgp_redistribute_ipv4_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009388 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009389 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009390 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009391 "Route map reference\n"
9392 "Pointer to route-map entries\n"
9393 "Metric for redistributed routes\n"
9394 "Default metric\n")
9395{
9396 int type;
9397 u_int32_t metric;
9398
David Lampartere0ca5fd2009-09-16 01:52:42 +02009399 type = proto_redistnum (AFI_IP, argv[0]);
9400 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009401 {
9402 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9403 return CMD_WARNING;
9404 }
9405 VTY_GET_INTEGER ("metric", metric, argv[2]);
9406
9407 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]);
9408 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
9409 return bgp_redistribute_set (vty->index, AFI_IP, type);
9410}
9411
9412DEFUN (bgp_redistribute_ipv4_metric_rmap,
9413 bgp_redistribute_ipv4_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009414 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00009415 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009416 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009417 "Metric for redistributed routes\n"
9418 "Default metric\n"
9419 "Route map reference\n"
9420 "Pointer to route-map entries\n")
9421{
9422 int type;
9423 u_int32_t metric;
9424
David Lampartere0ca5fd2009-09-16 01:52:42 +02009425 type = proto_redistnum (AFI_IP, argv[0]);
9426 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009427 {
9428 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9429 return CMD_WARNING;
9430 }
9431 VTY_GET_INTEGER ("metric", metric, argv[1]);
9432
9433 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
9434 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[2]);
9435 return bgp_redistribute_set (vty->index, AFI_IP, type);
9436}
9437
9438DEFUN (no_bgp_redistribute_ipv4,
9439 no_bgp_redistribute_ipv4_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009440 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00009441 NO_STR
9442 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009443 QUAGGA_IP_REDIST_HELP_STR_BGPD)
paul718e3742002-12-13 20:15:29 +00009444{
9445 int type;
9446
David Lampartere0ca5fd2009-09-16 01:52:42 +02009447 type = proto_redistnum (AFI_IP, argv[0]);
9448 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009449 {
9450 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9451 return CMD_WARNING;
9452 }
9453
9454 return bgp_redistribute_unset (vty->index, AFI_IP, type);
9455}
9456
9457DEFUN (no_bgp_redistribute_ipv4_rmap,
9458 no_bgp_redistribute_ipv4_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009459 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00009460 NO_STR
9461 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009462 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009463 "Route map reference\n"
9464 "Pointer to route-map entries\n")
9465{
9466 int type;
9467
David Lampartere0ca5fd2009-09-16 01:52:42 +02009468 type = proto_redistnum (AFI_IP, argv[0]);
9469 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009470 {
9471 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9472 return CMD_WARNING;
9473 }
9474
9475 bgp_redistribute_routemap_unset (vty->index, AFI_IP, type);
9476 return CMD_SUCCESS;
9477}
9478
9479DEFUN (no_bgp_redistribute_ipv4_metric,
9480 no_bgp_redistribute_ipv4_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009481 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009482 NO_STR
9483 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009484 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009485 "Metric for redistributed routes\n"
9486 "Default metric\n")
9487{
9488 int type;
9489
David Lampartere0ca5fd2009-09-16 01:52:42 +02009490 type = proto_redistnum (AFI_IP, argv[0]);
9491 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009492 {
9493 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9494 return CMD_WARNING;
9495 }
9496
9497 bgp_redistribute_metric_unset (vty->index, AFI_IP, type);
9498 return CMD_SUCCESS;
9499}
9500
9501DEFUN (no_bgp_redistribute_ipv4_rmap_metric,
9502 no_bgp_redistribute_ipv4_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009503 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009504 NO_STR
9505 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009506 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009507 "Route map reference\n"
9508 "Pointer to route-map entries\n"
9509 "Metric for redistributed routes\n"
9510 "Default metric\n")
9511{
9512 int type;
9513
David Lampartere0ca5fd2009-09-16 01:52:42 +02009514 type = proto_redistnum (AFI_IP, argv[0]);
9515 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009516 {
9517 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9518 return CMD_WARNING;
9519 }
9520
9521 bgp_redistribute_metric_unset (vty->index, AFI_IP, type);
9522 bgp_redistribute_routemap_unset (vty->index, AFI_IP, type);
9523 return CMD_SUCCESS;
9524}
9525
9526ALIAS (no_bgp_redistribute_ipv4_rmap_metric,
9527 no_bgp_redistribute_ipv4_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009528 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00009529 NO_STR
9530 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009531 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009532 "Metric for redistributed routes\n"
9533 "Default metric\n"
9534 "Route map reference\n"
9535 "Pointer to route-map entries\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02009536
paul718e3742002-12-13 20:15:29 +00009537DEFUN (bgp_redistribute_ipv6,
9538 bgp_redistribute_ipv6_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009539 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00009540 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009541 QUAGGA_IP6_REDIST_HELP_STR_BGPD)
paul718e3742002-12-13 20:15:29 +00009542{
9543 int type;
9544
David Lampartere0ca5fd2009-09-16 01:52:42 +02009545 type = proto_redistnum (AFI_IP6, argv[0]);
9546 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009547 {
9548 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9549 return CMD_WARNING;
9550 }
9551
9552 return bgp_redistribute_set (vty->index, AFI_IP6, type);
9553}
9554
9555DEFUN (bgp_redistribute_ipv6_rmap,
9556 bgp_redistribute_ipv6_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009557 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00009558 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009559 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009560 "Route map reference\n"
9561 "Pointer to route-map entries\n")
9562{
9563 int type;
9564
David Lampartere0ca5fd2009-09-16 01:52:42 +02009565 type = proto_redistnum (AFI_IP6, argv[0]);
9566 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009567 {
9568 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9569 return CMD_WARNING;
9570 }
9571
9572 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]);
9573 return bgp_redistribute_set (vty->index, AFI_IP6, type);
9574}
9575
9576DEFUN (bgp_redistribute_ipv6_metric,
9577 bgp_redistribute_ipv6_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009578 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009579 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009580 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009581 "Metric for redistributed routes\n"
9582 "Default metric\n")
9583{
9584 int type;
9585 u_int32_t metric;
9586
David Lampartere0ca5fd2009-09-16 01:52:42 +02009587 type = proto_redistnum (AFI_IP6, argv[0]);
9588 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009589 {
9590 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9591 return CMD_WARNING;
9592 }
9593 VTY_GET_INTEGER ("metric", metric, argv[1]);
9594
9595 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
9596 return bgp_redistribute_set (vty->index, AFI_IP6, type);
9597}
9598
9599DEFUN (bgp_redistribute_ipv6_rmap_metric,
9600 bgp_redistribute_ipv6_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009601 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009602 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009603 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009604 "Route map reference\n"
9605 "Pointer to route-map entries\n"
9606 "Metric for redistributed routes\n"
9607 "Default metric\n")
9608{
9609 int type;
9610 u_int32_t metric;
9611
David Lampartere0ca5fd2009-09-16 01:52:42 +02009612 type = proto_redistnum (AFI_IP6, argv[0]);
9613 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009614 {
9615 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9616 return CMD_WARNING;
9617 }
9618 VTY_GET_INTEGER ("metric", metric, argv[2]);
9619
9620 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]);
9621 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
9622 return bgp_redistribute_set (vty->index, AFI_IP6, type);
9623}
9624
9625DEFUN (bgp_redistribute_ipv6_metric_rmap,
9626 bgp_redistribute_ipv6_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009627 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00009628 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009629 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009630 "Metric for redistributed routes\n"
9631 "Default metric\n"
9632 "Route map reference\n"
9633 "Pointer to route-map entries\n")
9634{
9635 int type;
9636 u_int32_t metric;
9637
David Lampartere0ca5fd2009-09-16 01:52:42 +02009638 type = proto_redistnum (AFI_IP6, argv[0]);
9639 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009640 {
9641 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9642 return CMD_WARNING;
9643 }
9644 VTY_GET_INTEGER ("metric", metric, argv[1]);
9645
9646 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
9647 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[2]);
9648 return bgp_redistribute_set (vty->index, AFI_IP6, type);
9649}
9650
9651DEFUN (no_bgp_redistribute_ipv6,
9652 no_bgp_redistribute_ipv6_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009653 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00009654 NO_STR
9655 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009656 QUAGGA_IP6_REDIST_HELP_STR_BGPD)
paul718e3742002-12-13 20:15:29 +00009657{
9658 int type;
9659
David Lampartere0ca5fd2009-09-16 01:52:42 +02009660 type = proto_redistnum (AFI_IP6, argv[0]);
9661 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009662 {
9663 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9664 return CMD_WARNING;
9665 }
9666
9667 return bgp_redistribute_unset (vty->index, AFI_IP6, type);
9668}
9669
9670DEFUN (no_bgp_redistribute_ipv6_rmap,
9671 no_bgp_redistribute_ipv6_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009672 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00009673 NO_STR
9674 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009675 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009676 "Route map reference\n"
9677 "Pointer to route-map entries\n")
9678{
9679 int type;
9680
David Lampartere0ca5fd2009-09-16 01:52:42 +02009681 type = proto_redistnum (AFI_IP6, argv[0]);
9682 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009683 {
9684 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9685 return CMD_WARNING;
9686 }
9687
9688 bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type);
9689 return CMD_SUCCESS;
9690}
9691
9692DEFUN (no_bgp_redistribute_ipv6_metric,
9693 no_bgp_redistribute_ipv6_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009694 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009695 NO_STR
9696 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009697 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009698 "Metric for redistributed routes\n"
9699 "Default metric\n")
9700{
9701 int type;
9702
David Lampartere0ca5fd2009-09-16 01:52:42 +02009703 type = proto_redistnum (AFI_IP6, argv[0]);
9704 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009705 {
9706 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9707 return CMD_WARNING;
9708 }
9709
9710 bgp_redistribute_metric_unset (vty->index, AFI_IP6, type);
9711 return CMD_SUCCESS;
9712}
9713
9714DEFUN (no_bgp_redistribute_ipv6_rmap_metric,
9715 no_bgp_redistribute_ipv6_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009716 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009717 NO_STR
9718 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009719 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009720 "Route map reference\n"
9721 "Pointer to route-map entries\n"
9722 "Metric for redistributed routes\n"
9723 "Default metric\n")
9724{
9725 int type;
9726
David Lampartere0ca5fd2009-09-16 01:52:42 +02009727 type = proto_redistnum (AFI_IP6, argv[0]);
9728 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009729 {
9730 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9731 return CMD_WARNING;
9732 }
9733
9734 bgp_redistribute_metric_unset (vty->index, AFI_IP6, type);
9735 bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type);
9736 return CMD_SUCCESS;
9737}
9738
9739ALIAS (no_bgp_redistribute_ipv6_rmap_metric,
9740 no_bgp_redistribute_ipv6_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009741 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00009742 NO_STR
9743 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009744 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009745 "Metric for redistributed routes\n"
9746 "Default metric\n"
9747 "Route map reference\n"
9748 "Pointer to route-map entries\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02009749
paul718e3742002-12-13 20:15:29 +00009750int
9751bgp_config_write_redistribute (struct vty *vty, struct bgp *bgp, afi_t afi,
9752 safi_t safi, int *write)
9753{
9754 int i;
paul718e3742002-12-13 20:15:29 +00009755
9756 /* Unicast redistribution only. */
9757 if (safi != SAFI_UNICAST)
9758 return 0;
9759
9760 for (i = 0; i < ZEBRA_ROUTE_MAX; i++)
9761 {
9762 /* Redistribute BGP does not make sense. */
9763 if (bgp->redist[afi][i] && i != ZEBRA_ROUTE_BGP)
9764 {
9765 /* Display "address-family" when it is not yet diplayed. */
9766 bgp_config_write_family_header (vty, afi, safi, write);
9767
9768 /* "redistribute" configuration. */
ajsf52d13c2005-10-01 17:38:06 +00009769 vty_out (vty, " redistribute %s", zebra_route_string(i));
paul718e3742002-12-13 20:15:29 +00009770
9771 if (bgp->redist_metric_flag[afi][i])
Jorge Boncompte [DTI2]ddc943d2012-04-13 13:46:07 +02009772 vty_out (vty, " metric %u", bgp->redist_metric[afi][i]);
paul718e3742002-12-13 20:15:29 +00009773
9774 if (bgp->rmap[afi][i].name)
9775 vty_out (vty, " route-map %s", bgp->rmap[afi][i].name);
9776
9777 vty_out (vty, "%s", VTY_NEWLINE);
9778 }
9779 }
9780 return *write;
9781}
David Lamparter6b0655a2014-06-04 06:53:35 +02009782
paul718e3742002-12-13 20:15:29 +00009783/* BGP node structure. */
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009784static struct cmd_node bgp_node =
paul718e3742002-12-13 20:15:29 +00009785{
9786 BGP_NODE,
9787 "%s(config-router)# ",
9788 1,
9789};
9790
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009791static struct cmd_node bgp_ipv4_unicast_node =
paul718e3742002-12-13 20:15:29 +00009792{
9793 BGP_IPV4_NODE,
9794 "%s(config-router-af)# ",
9795 1,
9796};
9797
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009798static struct cmd_node bgp_ipv4_multicast_node =
paul718e3742002-12-13 20:15:29 +00009799{
9800 BGP_IPV4M_NODE,
9801 "%s(config-router-af)# ",
9802 1,
9803};
9804
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009805static struct cmd_node bgp_ipv6_unicast_node =
paul718e3742002-12-13 20:15:29 +00009806{
9807 BGP_IPV6_NODE,
9808 "%s(config-router-af)# ",
9809 1,
9810};
9811
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009812static struct cmd_node bgp_ipv6_multicast_node =
paul25ffbdc2005-08-22 22:42:08 +00009813{
9814 BGP_IPV6M_NODE,
9815 "%s(config-router-af)# ",
9816 1,
9817};
9818
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009819static struct cmd_node bgp_vpnv4_node =
paul718e3742002-12-13 20:15:29 +00009820{
9821 BGP_VPNV4_NODE,
9822 "%s(config-router-af)# ",
9823 1
9824};
David Lamparter6b0655a2014-06-04 06:53:35 +02009825
Lou Berger13c378d2016-01-12 13:41:56 -05009826static struct cmd_node bgp_vpnv6_node =
9827{
9828 BGP_VPNV6_NODE,
9829 "%s(config-router-af-vpnv6)# ",
9830 1
9831};
9832
Lou Bergera3fda882016-01-12 13:42:04 -05009833static struct cmd_node bgp_encap_node =
9834{
9835 BGP_ENCAP_NODE,
9836 "%s(config-router-af-encap)# ",
9837 1
9838};
9839
9840static struct cmd_node bgp_encapv6_node =
9841{
9842 BGP_ENCAPV6_NODE,
9843 "%s(config-router-af-encapv6)# ",
9844 1
9845};
9846
paul1f8ae702005-09-09 23:49:49 +00009847static void community_list_vty (void);
9848
paul718e3742002-12-13 20:15:29 +00009849void
paul94f2b392005-06-28 12:44:16 +00009850bgp_vty_init (void)
paul718e3742002-12-13 20:15:29 +00009851{
paul718e3742002-12-13 20:15:29 +00009852 /* Install bgp top node. */
9853 install_node (&bgp_node, bgp_config_write);
9854 install_node (&bgp_ipv4_unicast_node, NULL);
9855 install_node (&bgp_ipv4_multicast_node, NULL);
9856 install_node (&bgp_ipv6_unicast_node, NULL);
paul25ffbdc2005-08-22 22:42:08 +00009857 install_node (&bgp_ipv6_multicast_node, NULL);
paul718e3742002-12-13 20:15:29 +00009858 install_node (&bgp_vpnv4_node, NULL);
Lou Berger13c378d2016-01-12 13:41:56 -05009859 install_node (&bgp_vpnv6_node, NULL);
Lou Bergera3fda882016-01-12 13:42:04 -05009860 install_node (&bgp_encap_node, NULL);
9861 install_node (&bgp_encapv6_node, NULL);
paul718e3742002-12-13 20:15:29 +00009862
9863 /* Install default VTY commands to new nodes. */
9864 install_default (BGP_NODE);
9865 install_default (BGP_IPV4_NODE);
9866 install_default (BGP_IPV4M_NODE);
9867 install_default (BGP_IPV6_NODE);
paul25ffbdc2005-08-22 22:42:08 +00009868 install_default (BGP_IPV6M_NODE);
paul718e3742002-12-13 20:15:29 +00009869 install_default (BGP_VPNV4_NODE);
Lou Berger13c378d2016-01-12 13:41:56 -05009870 install_default (BGP_VPNV6_NODE);
Lou Bergera3fda882016-01-12 13:42:04 -05009871 install_default (BGP_ENCAP_NODE);
9872 install_default (BGP_ENCAPV6_NODE);
paul718e3742002-12-13 20:15:29 +00009873
9874 /* "bgp multiple-instance" commands. */
9875 install_element (CONFIG_NODE, &bgp_multiple_instance_cmd);
9876 install_element (CONFIG_NODE, &no_bgp_multiple_instance_cmd);
9877
9878 /* "bgp config-type" commands. */
9879 install_element (CONFIG_NODE, &bgp_config_type_cmd);
9880 install_element (CONFIG_NODE, &no_bgp_config_type_cmd);
9881
9882 /* Dummy commands (Currently not supported) */
9883 install_element (BGP_NODE, &no_synchronization_cmd);
9884 install_element (BGP_NODE, &no_auto_summary_cmd);
9885
9886 /* "router bgp" commands. */
9887 install_element (CONFIG_NODE, &router_bgp_cmd);
9888 install_element (CONFIG_NODE, &router_bgp_view_cmd);
9889
9890 /* "no router bgp" commands. */
9891 install_element (CONFIG_NODE, &no_router_bgp_cmd);
9892 install_element (CONFIG_NODE, &no_router_bgp_view_cmd);
9893
9894 /* "bgp router-id" commands. */
9895 install_element (BGP_NODE, &bgp_router_id_cmd);
9896 install_element (BGP_NODE, &no_bgp_router_id_cmd);
9897 install_element (BGP_NODE, &no_bgp_router_id_val_cmd);
9898
9899 /* "bgp cluster-id" commands. */
9900 install_element (BGP_NODE, &bgp_cluster_id_cmd);
9901 install_element (BGP_NODE, &bgp_cluster_id32_cmd);
9902 install_element (BGP_NODE, &no_bgp_cluster_id_cmd);
9903 install_element (BGP_NODE, &no_bgp_cluster_id_arg_cmd);
9904
9905 /* "bgp confederation" commands. */
9906 install_element (BGP_NODE, &bgp_confederation_identifier_cmd);
9907 install_element (BGP_NODE, &no_bgp_confederation_identifier_cmd);
9908 install_element (BGP_NODE, &no_bgp_confederation_identifier_arg_cmd);
9909
9910 /* "bgp confederation peers" commands. */
9911 install_element (BGP_NODE, &bgp_confederation_peers_cmd);
9912 install_element (BGP_NODE, &no_bgp_confederation_peers_cmd);
9913
Josh Bailey165b5ff2011-07-20 20:43:22 -07009914 /* "maximum-paths" commands. */
9915 install_element (BGP_NODE, &bgp_maxpaths_cmd);
9916 install_element (BGP_NODE, &no_bgp_maxpaths_cmd);
9917 install_element (BGP_NODE, &no_bgp_maxpaths_arg_cmd);
9918 install_element (BGP_IPV4_NODE, &bgp_maxpaths_cmd);
9919 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_cmd);
9920 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_arg_cmd);
9921 install_element (BGP_NODE, &bgp_maxpaths_ibgp_cmd);
9922 install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_cmd);
9923 install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_arg_cmd);
9924 install_element (BGP_IPV4_NODE, &bgp_maxpaths_ibgp_cmd);
9925 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_cmd);
9926 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_arg_cmd);
9927
paul718e3742002-12-13 20:15:29 +00009928 /* "timers bgp" commands. */
9929 install_element (BGP_NODE, &bgp_timers_cmd);
9930 install_element (BGP_NODE, &no_bgp_timers_cmd);
9931 install_element (BGP_NODE, &no_bgp_timers_arg_cmd);
9932
9933 /* "bgp client-to-client reflection" commands */
9934 install_element (BGP_NODE, &no_bgp_client_to_client_reflection_cmd);
9935 install_element (BGP_NODE, &bgp_client_to_client_reflection_cmd);
9936
9937 /* "bgp always-compare-med" commands */
9938 install_element (BGP_NODE, &bgp_always_compare_med_cmd);
9939 install_element (BGP_NODE, &no_bgp_always_compare_med_cmd);
9940
9941 /* "bgp deterministic-med" commands */
9942 install_element (BGP_NODE, &bgp_deterministic_med_cmd);
9943 install_element (BGP_NODE, &no_bgp_deterministic_med_cmd);
hasso538621f2004-05-21 09:31:30 +00009944
hasso538621f2004-05-21 09:31:30 +00009945 /* "bgp graceful-restart" commands */
9946 install_element (BGP_NODE, &bgp_graceful_restart_cmd);
9947 install_element (BGP_NODE, &no_bgp_graceful_restart_cmd);
hasso93406d82005-02-02 14:40:33 +00009948 install_element (BGP_NODE, &bgp_graceful_restart_stalepath_time_cmd);
9949 install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_cmd);
9950 install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_val_cmd);
Philippe Guibert4afa3dd2016-05-24 16:52:02 +02009951 install_element (BGP_NODE, &bgp_graceful_restart_restart_time_cmd);
9952 install_element (BGP_NODE, &no_bgp_graceful_restart_restart_time_cmd);
9953 install_element (BGP_NODE, &no_bgp_graceful_restart_restart_time_val_cmd);
paul718e3742002-12-13 20:15:29 +00009954
9955 /* "bgp fast-external-failover" commands */
9956 install_element (BGP_NODE, &bgp_fast_external_failover_cmd);
9957 install_element (BGP_NODE, &no_bgp_fast_external_failover_cmd);
9958
9959 /* "bgp enforce-first-as" commands */
9960 install_element (BGP_NODE, &bgp_enforce_first_as_cmd);
9961 install_element (BGP_NODE, &no_bgp_enforce_first_as_cmd);
9962
9963 /* "bgp bestpath compare-routerid" commands */
9964 install_element (BGP_NODE, &bgp_bestpath_compare_router_id_cmd);
9965 install_element (BGP_NODE, &no_bgp_bestpath_compare_router_id_cmd);
9966
9967 /* "bgp bestpath as-path ignore" commands */
9968 install_element (BGP_NODE, &bgp_bestpath_aspath_ignore_cmd);
9969 install_element (BGP_NODE, &no_bgp_bestpath_aspath_ignore_cmd);
9970
hasso68118452005-04-08 15:40:36 +00009971 /* "bgp bestpath as-path confed" commands */
9972 install_element (BGP_NODE, &bgp_bestpath_aspath_confed_cmd);
9973 install_element (BGP_NODE, &no_bgp_bestpath_aspath_confed_cmd);
9974
Pradosh Mohapatra2fdd4552013-09-07 07:02:36 +00009975 /* "bgp bestpath as-path multipath-relax" commands */
9976 install_element (BGP_NODE, &bgp_bestpath_aspath_multipath_relax_cmd);
9977 install_element (BGP_NODE, &no_bgp_bestpath_aspath_multipath_relax_cmd);
9978
paul848973c2003-08-13 00:32:49 +00009979 /* "bgp log-neighbor-changes" commands */
9980 install_element (BGP_NODE, &bgp_log_neighbor_changes_cmd);
9981 install_element (BGP_NODE, &no_bgp_log_neighbor_changes_cmd);
9982
paul718e3742002-12-13 20:15:29 +00009983 /* "bgp bestpath med" commands */
9984 install_element (BGP_NODE, &bgp_bestpath_med_cmd);
9985 install_element (BGP_NODE, &bgp_bestpath_med2_cmd);
9986 install_element (BGP_NODE, &bgp_bestpath_med3_cmd);
9987 install_element (BGP_NODE, &no_bgp_bestpath_med_cmd);
9988 install_element (BGP_NODE, &no_bgp_bestpath_med2_cmd);
9989 install_element (BGP_NODE, &no_bgp_bestpath_med3_cmd);
9990
9991 /* "no bgp default ipv4-unicast" commands. */
9992 install_element (BGP_NODE, &no_bgp_default_ipv4_unicast_cmd);
9993 install_element (BGP_NODE, &bgp_default_ipv4_unicast_cmd);
9994
9995 /* "bgp network import-check" commands. */
9996 install_element (BGP_NODE, &bgp_network_import_check_cmd);
9997 install_element (BGP_NODE, &no_bgp_network_import_check_cmd);
9998
9999 /* "bgp default local-preference" commands. */
10000 install_element (BGP_NODE, &bgp_default_local_preference_cmd);
10001 install_element (BGP_NODE, &no_bgp_default_local_preference_cmd);
10002 install_element (BGP_NODE, &no_bgp_default_local_preference_val_cmd);
10003
10004 /* "neighbor remote-as" commands. */
10005 install_element (BGP_NODE, &neighbor_remote_as_cmd);
10006 install_element (BGP_NODE, &no_neighbor_cmd);
10007 install_element (BGP_NODE, &no_neighbor_remote_as_cmd);
10008
10009 /* "neighbor peer-group" commands. */
10010 install_element (BGP_NODE, &neighbor_peer_group_cmd);
10011 install_element (BGP_NODE, &no_neighbor_peer_group_cmd);
10012 install_element (BGP_NODE, &no_neighbor_peer_group_remote_as_cmd);
10013
10014 /* "neighbor local-as" commands. */
10015 install_element (BGP_NODE, &neighbor_local_as_cmd);
10016 install_element (BGP_NODE, &neighbor_local_as_no_prepend_cmd);
Andrew Certain9d3f9702012-11-07 23:50:07 +000010017 install_element (BGP_NODE, &neighbor_local_as_no_prepend_replace_as_cmd);
paul718e3742002-12-13 20:15:29 +000010018 install_element (BGP_NODE, &no_neighbor_local_as_cmd);
10019 install_element (BGP_NODE, &no_neighbor_local_as_val_cmd);
10020 install_element (BGP_NODE, &no_neighbor_local_as_val2_cmd);
Andrew Certain9d3f9702012-11-07 23:50:07 +000010021 install_element (BGP_NODE, &no_neighbor_local_as_val3_cmd);
paul718e3742002-12-13 20:15:29 +000010022
Paul Jakma0df7c912008-07-21 21:02:49 +000010023 /* "neighbor password" commands. */
10024 install_element (BGP_NODE, &neighbor_password_cmd);
10025 install_element (BGP_NODE, &no_neighbor_password_cmd);
10026
paul718e3742002-12-13 20:15:29 +000010027 /* "neighbor activate" commands. */
10028 install_element (BGP_NODE, &neighbor_activate_cmd);
10029 install_element (BGP_IPV4_NODE, &neighbor_activate_cmd);
10030 install_element (BGP_IPV4M_NODE, &neighbor_activate_cmd);
10031 install_element (BGP_IPV6_NODE, &neighbor_activate_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010032 install_element (BGP_IPV6M_NODE, &neighbor_activate_cmd);
paul718e3742002-12-13 20:15:29 +000010033 install_element (BGP_VPNV4_NODE, &neighbor_activate_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010034 install_element (BGP_VPNV6_NODE, &neighbor_activate_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010035 install_element (BGP_ENCAP_NODE, &neighbor_activate_cmd);
10036 install_element (BGP_ENCAPV6_NODE, &neighbor_activate_cmd);
paul718e3742002-12-13 20:15:29 +000010037
10038 /* "no neighbor activate" commands. */
10039 install_element (BGP_NODE, &no_neighbor_activate_cmd);
10040 install_element (BGP_IPV4_NODE, &no_neighbor_activate_cmd);
10041 install_element (BGP_IPV4M_NODE, &no_neighbor_activate_cmd);
10042 install_element (BGP_IPV6_NODE, &no_neighbor_activate_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010043 install_element (BGP_IPV6M_NODE, &no_neighbor_activate_cmd);
paul718e3742002-12-13 20:15:29 +000010044 install_element (BGP_VPNV4_NODE, &no_neighbor_activate_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010045 install_element (BGP_VPNV6_NODE, &no_neighbor_activate_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010046 install_element (BGP_ENCAP_NODE, &no_neighbor_activate_cmd);
10047 install_element (BGP_ENCAPV6_NODE, &no_neighbor_activate_cmd);
paul718e3742002-12-13 20:15:29 +000010048
10049 /* "neighbor peer-group set" commands. */
10050 install_element (BGP_NODE, &neighbor_set_peer_group_cmd);
10051 install_element (BGP_IPV4_NODE, &neighbor_set_peer_group_cmd);
10052 install_element (BGP_IPV4M_NODE, &neighbor_set_peer_group_cmd);
10053 install_element (BGP_IPV6_NODE, &neighbor_set_peer_group_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010054 install_element (BGP_IPV6M_NODE, &neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +000010055 install_element (BGP_VPNV4_NODE, &neighbor_set_peer_group_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010056 install_element (BGP_VPNV6_NODE, &neighbor_set_peer_group_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010057 install_element (BGP_ENCAP_NODE, &neighbor_set_peer_group_cmd);
10058 install_element (BGP_ENCAPV6_NODE, &neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +000010059
paul718e3742002-12-13 20:15:29 +000010060 /* "no neighbor peer-group unset" commands. */
10061 install_element (BGP_NODE, &no_neighbor_set_peer_group_cmd);
10062 install_element (BGP_IPV4_NODE, &no_neighbor_set_peer_group_cmd);
10063 install_element (BGP_IPV4M_NODE, &no_neighbor_set_peer_group_cmd);
10064 install_element (BGP_IPV6_NODE, &no_neighbor_set_peer_group_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010065 install_element (BGP_IPV6M_NODE, &no_neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +000010066 install_element (BGP_VPNV4_NODE, &no_neighbor_set_peer_group_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010067 install_element (BGP_VPNV6_NODE, &no_neighbor_set_peer_group_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010068 install_element (BGP_ENCAP_NODE, &no_neighbor_set_peer_group_cmd);
10069 install_element (BGP_ENCAPV6_NODE, &no_neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +000010070
paul718e3742002-12-13 20:15:29 +000010071 /* "neighbor softreconfiguration inbound" commands.*/
10072 install_element (BGP_NODE, &neighbor_soft_reconfiguration_cmd);
10073 install_element (BGP_NODE, &no_neighbor_soft_reconfiguration_cmd);
10074 install_element (BGP_IPV4_NODE, &neighbor_soft_reconfiguration_cmd);
10075 install_element (BGP_IPV4_NODE, &no_neighbor_soft_reconfiguration_cmd);
10076 install_element (BGP_IPV4M_NODE, &neighbor_soft_reconfiguration_cmd);
10077 install_element (BGP_IPV4M_NODE, &no_neighbor_soft_reconfiguration_cmd);
10078 install_element (BGP_IPV6_NODE, &neighbor_soft_reconfiguration_cmd);
10079 install_element (BGP_IPV6_NODE, &no_neighbor_soft_reconfiguration_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010080 install_element (BGP_IPV6M_NODE, &neighbor_soft_reconfiguration_cmd);
10081 install_element (BGP_IPV6M_NODE, &no_neighbor_soft_reconfiguration_cmd);
paula58545b2003-07-12 21:43:01 +000010082 install_element (BGP_VPNV4_NODE, &neighbor_soft_reconfiguration_cmd);
10083 install_element (BGP_VPNV4_NODE, &no_neighbor_soft_reconfiguration_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010084 install_element (BGP_VPNV6_NODE, &neighbor_soft_reconfiguration_cmd);
10085 install_element (BGP_VPNV6_NODE, &no_neighbor_soft_reconfiguration_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010086 install_element (BGP_ENCAP_NODE, &neighbor_soft_reconfiguration_cmd);
10087 install_element (BGP_ENCAP_NODE, &no_neighbor_soft_reconfiguration_cmd);
10088 install_element (BGP_ENCAPV6_NODE, &neighbor_soft_reconfiguration_cmd);
10089 install_element (BGP_ENCAPV6_NODE, &no_neighbor_soft_reconfiguration_cmd);
paul718e3742002-12-13 20:15:29 +000010090
10091 /* "neighbor attribute-unchanged" commands. */
10092 install_element (BGP_NODE, &neighbor_attr_unchanged_cmd);
10093 install_element (BGP_NODE, &neighbor_attr_unchanged1_cmd);
10094 install_element (BGP_NODE, &neighbor_attr_unchanged2_cmd);
10095 install_element (BGP_NODE, &neighbor_attr_unchanged3_cmd);
10096 install_element (BGP_NODE, &neighbor_attr_unchanged4_cmd);
10097 install_element (BGP_NODE, &neighbor_attr_unchanged5_cmd);
10098 install_element (BGP_NODE, &neighbor_attr_unchanged6_cmd);
10099 install_element (BGP_NODE, &neighbor_attr_unchanged7_cmd);
10100 install_element (BGP_NODE, &neighbor_attr_unchanged8_cmd);
10101 install_element (BGP_NODE, &neighbor_attr_unchanged9_cmd);
10102 install_element (BGP_NODE, &neighbor_attr_unchanged10_cmd);
10103 install_element (BGP_NODE, &no_neighbor_attr_unchanged_cmd);
10104 install_element (BGP_NODE, &no_neighbor_attr_unchanged1_cmd);
10105 install_element (BGP_NODE, &no_neighbor_attr_unchanged2_cmd);
10106 install_element (BGP_NODE, &no_neighbor_attr_unchanged3_cmd);
10107 install_element (BGP_NODE, &no_neighbor_attr_unchanged4_cmd);
10108 install_element (BGP_NODE, &no_neighbor_attr_unchanged5_cmd);
10109 install_element (BGP_NODE, &no_neighbor_attr_unchanged6_cmd);
10110 install_element (BGP_NODE, &no_neighbor_attr_unchanged7_cmd);
10111 install_element (BGP_NODE, &no_neighbor_attr_unchanged8_cmd);
10112 install_element (BGP_NODE, &no_neighbor_attr_unchanged9_cmd);
10113 install_element (BGP_NODE, &no_neighbor_attr_unchanged10_cmd);
10114 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged_cmd);
10115 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged1_cmd);
10116 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged2_cmd);
10117 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged3_cmd);
10118 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged4_cmd);
10119 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged5_cmd);
10120 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged6_cmd);
10121 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged7_cmd);
10122 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged8_cmd);
10123 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged9_cmd);
10124 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged10_cmd);
10125 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged_cmd);
10126 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged1_cmd);
10127 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged2_cmd);
10128 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged3_cmd);
10129 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged4_cmd);
10130 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged5_cmd);
10131 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged6_cmd);
10132 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged7_cmd);
10133 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged8_cmd);
10134 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged9_cmd);
10135 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged10_cmd);
10136 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged_cmd);
10137 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged1_cmd);
10138 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged2_cmd);
10139 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged3_cmd);
10140 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged4_cmd);
10141 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged5_cmd);
10142 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged6_cmd);
10143 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged7_cmd);
10144 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged8_cmd);
10145 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged9_cmd);
10146 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged10_cmd);
10147 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged_cmd);
10148 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged1_cmd);
10149 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged2_cmd);
10150 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged3_cmd);
10151 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged4_cmd);
10152 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged5_cmd);
10153 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged6_cmd);
10154 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged7_cmd);
10155 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged8_cmd);
10156 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged9_cmd);
10157 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged10_cmd);
10158 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged_cmd);
10159 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged1_cmd);
10160 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged2_cmd);
10161 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged3_cmd);
10162 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged4_cmd);
10163 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged5_cmd);
10164 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged6_cmd);
10165 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged7_cmd);
10166 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged8_cmd);
10167 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged9_cmd);
10168 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged10_cmd);
10169 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged_cmd);
10170 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged1_cmd);
10171 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged2_cmd);
10172 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged3_cmd);
10173 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged4_cmd);
10174 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged5_cmd);
10175 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged6_cmd);
10176 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged7_cmd);
10177 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged8_cmd);
10178 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged9_cmd);
10179 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged10_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010180 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged_cmd);
10181 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged1_cmd);
10182 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged2_cmd);
10183 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged3_cmd);
10184 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged4_cmd);
10185 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged5_cmd);
10186 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged6_cmd);
10187 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged7_cmd);
10188 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged8_cmd);
10189 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged9_cmd);
10190 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged10_cmd);
10191 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged_cmd);
10192 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged1_cmd);
10193 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged2_cmd);
10194 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged3_cmd);
10195 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged4_cmd);
10196 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged5_cmd);
10197 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged6_cmd);
10198 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged7_cmd);
10199 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged8_cmd);
10200 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged9_cmd);
10201 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged10_cmd);
paul718e3742002-12-13 20:15:29 +000010202 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged_cmd);
10203 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged1_cmd);
10204 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged2_cmd);
10205 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged3_cmd);
10206 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged4_cmd);
10207 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged5_cmd);
10208 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged6_cmd);
10209 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged7_cmd);
10210 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged8_cmd);
10211 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged9_cmd);
10212 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged10_cmd);
10213 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged_cmd);
10214 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged1_cmd);
10215 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged2_cmd);
10216 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged3_cmd);
10217 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged4_cmd);
10218 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged5_cmd);
10219 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged6_cmd);
10220 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged7_cmd);
10221 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged8_cmd);
10222 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged9_cmd);
10223 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged10_cmd);
10224
Lou Berger13c378d2016-01-12 13:41:56 -050010225 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged_cmd);
10226 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged1_cmd);
10227 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged2_cmd);
10228 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged3_cmd);
10229 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged4_cmd);
10230 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged5_cmd);
10231 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged6_cmd);
10232 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged7_cmd);
10233 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged8_cmd);
10234 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged9_cmd);
10235 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged10_cmd);
10236 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged_cmd);
10237 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged1_cmd);
10238 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged2_cmd);
10239 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged3_cmd);
10240 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged4_cmd);
10241 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged5_cmd);
10242 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged6_cmd);
10243 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged7_cmd);
10244 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged8_cmd);
10245 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged9_cmd);
10246 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged10_cmd);
10247
Lou Bergera3fda882016-01-12 13:42:04 -050010248 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged_cmd);
10249 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged1_cmd);
10250 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged2_cmd);
10251 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged3_cmd);
10252 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged4_cmd);
10253 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged5_cmd);
10254 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged6_cmd);
10255 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged7_cmd);
10256 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged8_cmd);
10257 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged9_cmd);
10258 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged10_cmd);
10259 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged_cmd);
10260 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged1_cmd);
10261 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged2_cmd);
10262 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged3_cmd);
10263 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged4_cmd);
10264 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged5_cmd);
10265 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged6_cmd);
10266 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged7_cmd);
10267 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged8_cmd);
10268 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged9_cmd);
10269 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged10_cmd);
10270
10271 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged_cmd);
10272 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged1_cmd);
10273 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged2_cmd);
10274 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged3_cmd);
10275 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged4_cmd);
10276 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged5_cmd);
10277 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged6_cmd);
10278 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged7_cmd);
10279 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged8_cmd);
10280 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged9_cmd);
10281 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged10_cmd);
10282 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged_cmd);
10283 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged1_cmd);
10284 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged2_cmd);
10285 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged3_cmd);
10286 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged4_cmd);
10287 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged5_cmd);
10288 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged6_cmd);
10289 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged7_cmd);
10290 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged8_cmd);
10291 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged9_cmd);
10292 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged10_cmd);
10293
paulfee0f4c2004-09-13 05:12:46 +000010294 /* "nexthop-local unchanged" commands */
10295 install_element (BGP_IPV6_NODE, &neighbor_nexthop_local_unchanged_cmd);
10296 install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_local_unchanged_cmd);
10297
paul718e3742002-12-13 20:15:29 +000010298 /* "transparent-as" and "transparent-nexthop" for old version
10299 compatibility. */
10300 install_element (BGP_NODE, &neighbor_transparent_as_cmd);
10301 install_element (BGP_NODE, &neighbor_transparent_nexthop_cmd);
10302
10303 /* "neighbor next-hop-self" commands. */
10304 install_element (BGP_NODE, &neighbor_nexthop_self_cmd);
10305 install_element (BGP_NODE, &no_neighbor_nexthop_self_cmd);
10306 install_element (BGP_IPV4_NODE, &neighbor_nexthop_self_cmd);
10307 install_element (BGP_IPV4_NODE, &no_neighbor_nexthop_self_cmd);
10308 install_element (BGP_IPV4M_NODE, &neighbor_nexthop_self_cmd);
10309 install_element (BGP_IPV4M_NODE, &no_neighbor_nexthop_self_cmd);
10310 install_element (BGP_IPV6_NODE, &neighbor_nexthop_self_cmd);
10311 install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_self_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010312 install_element (BGP_IPV6M_NODE, &neighbor_nexthop_self_cmd);
10313 install_element (BGP_IPV6M_NODE, &no_neighbor_nexthop_self_cmd);
paul718e3742002-12-13 20:15:29 +000010314 install_element (BGP_VPNV4_NODE, &neighbor_nexthop_self_cmd);
10315 install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010316 install_element (BGP_VPNV6_NODE, &neighbor_nexthop_self_cmd);
10317 install_element (BGP_VPNV6_NODE, &no_neighbor_nexthop_self_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010318 install_element (BGP_ENCAP_NODE, &neighbor_nexthop_self_cmd);
10319 install_element (BGP_ENCAP_NODE, &no_neighbor_nexthop_self_cmd);
10320 install_element (BGP_ENCAPV6_NODE, &neighbor_nexthop_self_cmd);
10321 install_element (BGP_ENCAPV6_NODE, &no_neighbor_nexthop_self_cmd);
paul718e3742002-12-13 20:15:29 +000010322
10323 /* "neighbor remove-private-AS" commands. */
10324 install_element (BGP_NODE, &neighbor_remove_private_as_cmd);
10325 install_element (BGP_NODE, &no_neighbor_remove_private_as_cmd);
10326 install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_cmd);
10327 install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_cmd);
10328 install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_cmd);
10329 install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_cmd);
10330 install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_cmd);
10331 install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010332 install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_cmd);
10333 install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_cmd);
paul718e3742002-12-13 20:15:29 +000010334 install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_cmd);
10335 install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010336 install_element (BGP_VPNV6_NODE, &neighbor_remove_private_as_cmd);
10337 install_element (BGP_VPNV6_NODE, &no_neighbor_remove_private_as_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010338 install_element (BGP_ENCAP_NODE, &neighbor_remove_private_as_cmd);
10339 install_element (BGP_ENCAP_NODE, &no_neighbor_remove_private_as_cmd);
10340 install_element (BGP_ENCAPV6_NODE, &neighbor_remove_private_as_cmd);
10341 install_element (BGP_ENCAPV6_NODE, &no_neighbor_remove_private_as_cmd);
paul718e3742002-12-13 20:15:29 +000010342
10343 /* "neighbor send-community" commands.*/
10344 install_element (BGP_NODE, &neighbor_send_community_cmd);
10345 install_element (BGP_NODE, &neighbor_send_community_type_cmd);
10346 install_element (BGP_NODE, &no_neighbor_send_community_cmd);
10347 install_element (BGP_NODE, &no_neighbor_send_community_type_cmd);
10348 install_element (BGP_IPV4_NODE, &neighbor_send_community_cmd);
10349 install_element (BGP_IPV4_NODE, &neighbor_send_community_type_cmd);
10350 install_element (BGP_IPV4_NODE, &no_neighbor_send_community_cmd);
10351 install_element (BGP_IPV4_NODE, &no_neighbor_send_community_type_cmd);
10352 install_element (BGP_IPV4M_NODE, &neighbor_send_community_cmd);
10353 install_element (BGP_IPV4M_NODE, &neighbor_send_community_type_cmd);
10354 install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_cmd);
10355 install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_type_cmd);
10356 install_element (BGP_IPV6_NODE, &neighbor_send_community_cmd);
10357 install_element (BGP_IPV6_NODE, &neighbor_send_community_type_cmd);
10358 install_element (BGP_IPV6_NODE, &no_neighbor_send_community_cmd);
10359 install_element (BGP_IPV6_NODE, &no_neighbor_send_community_type_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010360 install_element (BGP_IPV6M_NODE, &neighbor_send_community_cmd);
10361 install_element (BGP_IPV6M_NODE, &neighbor_send_community_type_cmd);
10362 install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_cmd);
10363 install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_type_cmd);
paul718e3742002-12-13 20:15:29 +000010364 install_element (BGP_VPNV4_NODE, &neighbor_send_community_cmd);
10365 install_element (BGP_VPNV4_NODE, &neighbor_send_community_type_cmd);
10366 install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_cmd);
10367 install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_type_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010368 install_element (BGP_VPNV6_NODE, &neighbor_send_community_cmd);
10369 install_element (BGP_VPNV6_NODE, &neighbor_send_community_type_cmd);
10370 install_element (BGP_VPNV6_NODE, &no_neighbor_send_community_cmd);
10371 install_element (BGP_VPNV6_NODE, &no_neighbor_send_community_type_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010372 install_element (BGP_ENCAP_NODE, &neighbor_send_community_cmd);
10373 install_element (BGP_ENCAP_NODE, &neighbor_send_community_type_cmd);
10374 install_element (BGP_ENCAP_NODE, &no_neighbor_send_community_cmd);
10375 install_element (BGP_ENCAP_NODE, &no_neighbor_send_community_type_cmd);
10376 install_element (BGP_ENCAPV6_NODE, &neighbor_send_community_cmd);
10377 install_element (BGP_ENCAPV6_NODE, &neighbor_send_community_type_cmd);
10378 install_element (BGP_ENCAPV6_NODE, &no_neighbor_send_community_cmd);
10379 install_element (BGP_ENCAPV6_NODE, &no_neighbor_send_community_type_cmd);
paul718e3742002-12-13 20:15:29 +000010380
10381 /* "neighbor route-reflector" commands.*/
10382 install_element (BGP_NODE, &neighbor_route_reflector_client_cmd);
10383 install_element (BGP_NODE, &no_neighbor_route_reflector_client_cmd);
10384 install_element (BGP_IPV4_NODE, &neighbor_route_reflector_client_cmd);
10385 install_element (BGP_IPV4_NODE, &no_neighbor_route_reflector_client_cmd);
10386 install_element (BGP_IPV4M_NODE, &neighbor_route_reflector_client_cmd);
10387 install_element (BGP_IPV4M_NODE, &no_neighbor_route_reflector_client_cmd);
10388 install_element (BGP_IPV6_NODE, &neighbor_route_reflector_client_cmd);
10389 install_element (BGP_IPV6_NODE, &no_neighbor_route_reflector_client_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010390 install_element (BGP_IPV6M_NODE, &neighbor_route_reflector_client_cmd);
10391 install_element (BGP_IPV6M_NODE, &no_neighbor_route_reflector_client_cmd);
paul718e3742002-12-13 20:15:29 +000010392 install_element (BGP_VPNV4_NODE, &neighbor_route_reflector_client_cmd);
10393 install_element (BGP_VPNV4_NODE, &no_neighbor_route_reflector_client_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010394 install_element (BGP_VPNV6_NODE, &neighbor_route_reflector_client_cmd);
10395 install_element (BGP_VPNV6_NODE, &no_neighbor_route_reflector_client_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010396 install_element (BGP_ENCAP_NODE, &neighbor_route_reflector_client_cmd);
10397 install_element (BGP_ENCAP_NODE, &no_neighbor_route_reflector_client_cmd);
10398 install_element (BGP_ENCAPV6_NODE, &neighbor_route_reflector_client_cmd);
10399 install_element (BGP_ENCAPV6_NODE, &no_neighbor_route_reflector_client_cmd);
paul718e3742002-12-13 20:15:29 +000010400
10401 /* "neighbor route-server" commands.*/
10402 install_element (BGP_NODE, &neighbor_route_server_client_cmd);
10403 install_element (BGP_NODE, &no_neighbor_route_server_client_cmd);
10404 install_element (BGP_IPV4_NODE, &neighbor_route_server_client_cmd);
10405 install_element (BGP_IPV4_NODE, &no_neighbor_route_server_client_cmd);
10406 install_element (BGP_IPV4M_NODE, &neighbor_route_server_client_cmd);
10407 install_element (BGP_IPV4M_NODE, &no_neighbor_route_server_client_cmd);
10408 install_element (BGP_IPV6_NODE, &neighbor_route_server_client_cmd);
10409 install_element (BGP_IPV6_NODE, &no_neighbor_route_server_client_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010410 install_element (BGP_IPV6M_NODE, &neighbor_route_server_client_cmd);
10411 install_element (BGP_IPV6M_NODE, &no_neighbor_route_server_client_cmd);
paul718e3742002-12-13 20:15:29 +000010412 install_element (BGP_VPNV4_NODE, &neighbor_route_server_client_cmd);
10413 install_element (BGP_VPNV4_NODE, &no_neighbor_route_server_client_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010414 install_element (BGP_VPNV6_NODE, &neighbor_route_server_client_cmd);
10415 install_element (BGP_VPNV6_NODE, &no_neighbor_route_server_client_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010416 install_element (BGP_ENCAP_NODE, &neighbor_route_server_client_cmd);
10417 install_element (BGP_ENCAP_NODE, &no_neighbor_route_server_client_cmd);
10418 install_element (BGP_ENCAPV6_NODE, &neighbor_route_server_client_cmd);
10419 install_element (BGP_ENCAPV6_NODE, &no_neighbor_route_server_client_cmd);
paul718e3742002-12-13 20:15:29 +000010420
10421 /* "neighbor passive" commands. */
10422 install_element (BGP_NODE, &neighbor_passive_cmd);
10423 install_element (BGP_NODE, &no_neighbor_passive_cmd);
10424
10425 /* "neighbor shutdown" commands. */
10426 install_element (BGP_NODE, &neighbor_shutdown_cmd);
10427 install_element (BGP_NODE, &no_neighbor_shutdown_cmd);
10428
hassoc9502432005-02-01 22:01:48 +000010429 /* Deprecated "neighbor capability route-refresh" commands.*/
paul718e3742002-12-13 20:15:29 +000010430 install_element (BGP_NODE, &neighbor_capability_route_refresh_cmd);
10431 install_element (BGP_NODE, &no_neighbor_capability_route_refresh_cmd);
10432
10433 /* "neighbor capability orf prefix-list" commands.*/
10434 install_element (BGP_NODE, &neighbor_capability_orf_prefix_cmd);
10435 install_element (BGP_NODE, &no_neighbor_capability_orf_prefix_cmd);
10436 install_element (BGP_IPV4_NODE, &neighbor_capability_orf_prefix_cmd);
10437 install_element (BGP_IPV4_NODE, &no_neighbor_capability_orf_prefix_cmd);
10438 install_element (BGP_IPV4M_NODE, &neighbor_capability_orf_prefix_cmd);
10439 install_element (BGP_IPV4M_NODE, &no_neighbor_capability_orf_prefix_cmd);
10440 install_element (BGP_IPV6_NODE, &neighbor_capability_orf_prefix_cmd);
10441 install_element (BGP_IPV6_NODE, &no_neighbor_capability_orf_prefix_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010442 install_element (BGP_IPV6M_NODE, &neighbor_capability_orf_prefix_cmd);
10443 install_element (BGP_IPV6M_NODE, &no_neighbor_capability_orf_prefix_cmd);
paul718e3742002-12-13 20:15:29 +000010444
10445 /* "neighbor capability dynamic" commands.*/
10446 install_element (BGP_NODE, &neighbor_capability_dynamic_cmd);
10447 install_element (BGP_NODE, &no_neighbor_capability_dynamic_cmd);
10448
10449 /* "neighbor dont-capability-negotiate" commands. */
10450 install_element (BGP_NODE, &neighbor_dont_capability_negotiate_cmd);
10451 install_element (BGP_NODE, &no_neighbor_dont_capability_negotiate_cmd);
10452
10453 /* "neighbor ebgp-multihop" commands. */
10454 install_element (BGP_NODE, &neighbor_ebgp_multihop_cmd);
10455 install_element (BGP_NODE, &neighbor_ebgp_multihop_ttl_cmd);
10456 install_element (BGP_NODE, &no_neighbor_ebgp_multihop_cmd);
10457 install_element (BGP_NODE, &no_neighbor_ebgp_multihop_ttl_cmd);
10458
hasso6ffd2072005-02-02 14:50:11 +000010459 /* "neighbor disable-connected-check" commands. */
10460 install_element (BGP_NODE, &neighbor_disable_connected_check_cmd);
10461 install_element (BGP_NODE, &no_neighbor_disable_connected_check_cmd);
paul718e3742002-12-13 20:15:29 +000010462 install_element (BGP_NODE, &neighbor_enforce_multihop_cmd);
10463 install_element (BGP_NODE, &no_neighbor_enforce_multihop_cmd);
10464
10465 /* "neighbor description" commands. */
10466 install_element (BGP_NODE, &neighbor_description_cmd);
10467 install_element (BGP_NODE, &no_neighbor_description_cmd);
10468 install_element (BGP_NODE, &no_neighbor_description_val_cmd);
10469
10470 /* "neighbor update-source" commands. "*/
10471 install_element (BGP_NODE, &neighbor_update_source_cmd);
10472 install_element (BGP_NODE, &no_neighbor_update_source_cmd);
10473
10474 /* "neighbor default-originate" commands. */
10475 install_element (BGP_NODE, &neighbor_default_originate_cmd);
10476 install_element (BGP_NODE, &neighbor_default_originate_rmap_cmd);
10477 install_element (BGP_NODE, &no_neighbor_default_originate_cmd);
10478 install_element (BGP_NODE, &no_neighbor_default_originate_rmap_cmd);
10479 install_element (BGP_IPV4_NODE, &neighbor_default_originate_cmd);
10480 install_element (BGP_IPV4_NODE, &neighbor_default_originate_rmap_cmd);
10481 install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_cmd);
10482 install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_rmap_cmd);
10483 install_element (BGP_IPV4M_NODE, &neighbor_default_originate_cmd);
10484 install_element (BGP_IPV4M_NODE, &neighbor_default_originate_rmap_cmd);
10485 install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_cmd);
10486 install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_rmap_cmd);
10487 install_element (BGP_IPV6_NODE, &neighbor_default_originate_cmd);
10488 install_element (BGP_IPV6_NODE, &neighbor_default_originate_rmap_cmd);
10489 install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_cmd);
10490 install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_rmap_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010491 install_element (BGP_IPV6M_NODE, &neighbor_default_originate_cmd);
10492 install_element (BGP_IPV6M_NODE, &neighbor_default_originate_rmap_cmd);
10493 install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_cmd);
10494 install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_rmap_cmd);
paul718e3742002-12-13 20:15:29 +000010495
10496 /* "neighbor port" commands. */
10497 install_element (BGP_NODE, &neighbor_port_cmd);
10498 install_element (BGP_NODE, &no_neighbor_port_cmd);
10499 install_element (BGP_NODE, &no_neighbor_port_val_cmd);
10500
10501 /* "neighbor weight" commands. */
10502 install_element (BGP_NODE, &neighbor_weight_cmd);
10503 install_element (BGP_NODE, &no_neighbor_weight_cmd);
10504 install_element (BGP_NODE, &no_neighbor_weight_val_cmd);
10505
10506 /* "neighbor override-capability" commands. */
10507 install_element (BGP_NODE, &neighbor_override_capability_cmd);
10508 install_element (BGP_NODE, &no_neighbor_override_capability_cmd);
10509
10510 /* "neighbor strict-capability-match" commands. */
10511 install_element (BGP_NODE, &neighbor_strict_capability_cmd);
10512 install_element (BGP_NODE, &no_neighbor_strict_capability_cmd);
10513
10514 /* "neighbor timers" commands. */
10515 install_element (BGP_NODE, &neighbor_timers_cmd);
10516 install_element (BGP_NODE, &no_neighbor_timers_cmd);
10517
10518 /* "neighbor timers connect" commands. */
10519 install_element (BGP_NODE, &neighbor_timers_connect_cmd);
10520 install_element (BGP_NODE, &no_neighbor_timers_connect_cmd);
10521 install_element (BGP_NODE, &no_neighbor_timers_connect_val_cmd);
10522
10523 /* "neighbor advertisement-interval" commands. */
10524 install_element (BGP_NODE, &neighbor_advertise_interval_cmd);
10525 install_element (BGP_NODE, &no_neighbor_advertise_interval_cmd);
10526 install_element (BGP_NODE, &no_neighbor_advertise_interval_val_cmd);
10527
10528 /* "neighbor version" commands. */
10529 install_element (BGP_NODE, &neighbor_version_cmd);
paul718e3742002-12-13 20:15:29 +000010530
10531 /* "neighbor interface" commands. */
10532 install_element (BGP_NODE, &neighbor_interface_cmd);
10533 install_element (BGP_NODE, &no_neighbor_interface_cmd);
10534
10535 /* "neighbor distribute" commands. */
10536 install_element (BGP_NODE, &neighbor_distribute_list_cmd);
10537 install_element (BGP_NODE, &no_neighbor_distribute_list_cmd);
10538 install_element (BGP_IPV4_NODE, &neighbor_distribute_list_cmd);
10539 install_element (BGP_IPV4_NODE, &no_neighbor_distribute_list_cmd);
10540 install_element (BGP_IPV4M_NODE, &neighbor_distribute_list_cmd);
10541 install_element (BGP_IPV4M_NODE, &no_neighbor_distribute_list_cmd);
10542 install_element (BGP_IPV6_NODE, &neighbor_distribute_list_cmd);
10543 install_element (BGP_IPV6_NODE, &no_neighbor_distribute_list_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010544 install_element (BGP_IPV6M_NODE, &neighbor_distribute_list_cmd);
10545 install_element (BGP_IPV6M_NODE, &no_neighbor_distribute_list_cmd);
paul718e3742002-12-13 20:15:29 +000010546 install_element (BGP_VPNV4_NODE, &neighbor_distribute_list_cmd);
10547 install_element (BGP_VPNV4_NODE, &no_neighbor_distribute_list_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010548 install_element (BGP_VPNV6_NODE, &neighbor_distribute_list_cmd);
10549 install_element (BGP_VPNV6_NODE, &no_neighbor_distribute_list_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010550 install_element (BGP_ENCAP_NODE, &neighbor_distribute_list_cmd);
10551 install_element (BGP_ENCAP_NODE, &no_neighbor_distribute_list_cmd);
10552 install_element (BGP_ENCAPV6_NODE, &neighbor_distribute_list_cmd);
10553 install_element (BGP_ENCAPV6_NODE, &no_neighbor_distribute_list_cmd);
paul718e3742002-12-13 20:15:29 +000010554
10555 /* "neighbor prefix-list" commands. */
10556 install_element (BGP_NODE, &neighbor_prefix_list_cmd);
10557 install_element (BGP_NODE, &no_neighbor_prefix_list_cmd);
10558 install_element (BGP_IPV4_NODE, &neighbor_prefix_list_cmd);
10559 install_element (BGP_IPV4_NODE, &no_neighbor_prefix_list_cmd);
10560 install_element (BGP_IPV4M_NODE, &neighbor_prefix_list_cmd);
10561 install_element (BGP_IPV4M_NODE, &no_neighbor_prefix_list_cmd);
10562 install_element (BGP_IPV6_NODE, &neighbor_prefix_list_cmd);
10563 install_element (BGP_IPV6_NODE, &no_neighbor_prefix_list_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010564 install_element (BGP_IPV6M_NODE, &neighbor_prefix_list_cmd);
10565 install_element (BGP_IPV6M_NODE, &no_neighbor_prefix_list_cmd);
paul718e3742002-12-13 20:15:29 +000010566 install_element (BGP_VPNV4_NODE, &neighbor_prefix_list_cmd);
10567 install_element (BGP_VPNV4_NODE, &no_neighbor_prefix_list_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010568 install_element (BGP_VPNV6_NODE, &neighbor_prefix_list_cmd);
10569 install_element (BGP_VPNV6_NODE, &no_neighbor_prefix_list_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010570 install_element (BGP_ENCAP_NODE, &neighbor_prefix_list_cmd);
10571 install_element (BGP_ENCAP_NODE, &no_neighbor_prefix_list_cmd);
10572 install_element (BGP_ENCAPV6_NODE, &neighbor_prefix_list_cmd);
10573 install_element (BGP_ENCAPV6_NODE, &no_neighbor_prefix_list_cmd);
paul718e3742002-12-13 20:15:29 +000010574
10575 /* "neighbor filter-list" commands. */
10576 install_element (BGP_NODE, &neighbor_filter_list_cmd);
10577 install_element (BGP_NODE, &no_neighbor_filter_list_cmd);
10578 install_element (BGP_IPV4_NODE, &neighbor_filter_list_cmd);
10579 install_element (BGP_IPV4_NODE, &no_neighbor_filter_list_cmd);
10580 install_element (BGP_IPV4M_NODE, &neighbor_filter_list_cmd);
10581 install_element (BGP_IPV4M_NODE, &no_neighbor_filter_list_cmd);
10582 install_element (BGP_IPV6_NODE, &neighbor_filter_list_cmd);
10583 install_element (BGP_IPV6_NODE, &no_neighbor_filter_list_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010584 install_element (BGP_IPV6M_NODE, &neighbor_filter_list_cmd);
10585 install_element (BGP_IPV6M_NODE, &no_neighbor_filter_list_cmd);
paul718e3742002-12-13 20:15:29 +000010586 install_element (BGP_VPNV4_NODE, &neighbor_filter_list_cmd);
10587 install_element (BGP_VPNV4_NODE, &no_neighbor_filter_list_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010588 install_element (BGP_VPNV6_NODE, &neighbor_filter_list_cmd);
10589 install_element (BGP_VPNV6_NODE, &no_neighbor_filter_list_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010590 install_element (BGP_ENCAP_NODE, &neighbor_filter_list_cmd);
10591 install_element (BGP_ENCAP_NODE, &no_neighbor_filter_list_cmd);
10592 install_element (BGP_ENCAPV6_NODE, &neighbor_filter_list_cmd);
10593 install_element (BGP_ENCAPV6_NODE, &no_neighbor_filter_list_cmd);
paul718e3742002-12-13 20:15:29 +000010594
10595 /* "neighbor route-map" commands. */
10596 install_element (BGP_NODE, &neighbor_route_map_cmd);
10597 install_element (BGP_NODE, &no_neighbor_route_map_cmd);
10598 install_element (BGP_IPV4_NODE, &neighbor_route_map_cmd);
10599 install_element (BGP_IPV4_NODE, &no_neighbor_route_map_cmd);
10600 install_element (BGP_IPV4M_NODE, &neighbor_route_map_cmd);
10601 install_element (BGP_IPV4M_NODE, &no_neighbor_route_map_cmd);
10602 install_element (BGP_IPV6_NODE, &neighbor_route_map_cmd);
10603 install_element (BGP_IPV6_NODE, &no_neighbor_route_map_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010604 install_element (BGP_IPV6M_NODE, &neighbor_route_map_cmd);
10605 install_element (BGP_IPV6M_NODE, &no_neighbor_route_map_cmd);
paul718e3742002-12-13 20:15:29 +000010606 install_element (BGP_VPNV4_NODE, &neighbor_route_map_cmd);
10607 install_element (BGP_VPNV4_NODE, &no_neighbor_route_map_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010608 install_element (BGP_VPNV6_NODE, &neighbor_route_map_cmd);
10609 install_element (BGP_VPNV6_NODE, &no_neighbor_route_map_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010610 install_element (BGP_ENCAP_NODE, &neighbor_route_map_cmd);
10611 install_element (BGP_ENCAP_NODE, &no_neighbor_route_map_cmd);
10612 install_element (BGP_ENCAPV6_NODE, &neighbor_route_map_cmd);
10613 install_element (BGP_ENCAPV6_NODE, &no_neighbor_route_map_cmd);
paul718e3742002-12-13 20:15:29 +000010614
10615 /* "neighbor unsuppress-map" commands. */
10616 install_element (BGP_NODE, &neighbor_unsuppress_map_cmd);
10617 install_element (BGP_NODE, &no_neighbor_unsuppress_map_cmd);
10618 install_element (BGP_IPV4_NODE, &neighbor_unsuppress_map_cmd);
10619 install_element (BGP_IPV4_NODE, &no_neighbor_unsuppress_map_cmd);
10620 install_element (BGP_IPV4M_NODE, &neighbor_unsuppress_map_cmd);
10621 install_element (BGP_IPV4M_NODE, &no_neighbor_unsuppress_map_cmd);
10622 install_element (BGP_IPV6_NODE, &neighbor_unsuppress_map_cmd);
10623 install_element (BGP_IPV6_NODE, &no_neighbor_unsuppress_map_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010624 install_element (BGP_IPV6M_NODE, &neighbor_unsuppress_map_cmd);
10625 install_element (BGP_IPV6M_NODE, &no_neighbor_unsuppress_map_cmd);
paula58545b2003-07-12 21:43:01 +000010626 install_element (BGP_VPNV4_NODE, &neighbor_unsuppress_map_cmd);
Lou Berger82dd7072016-01-12 13:41:57 -050010627 install_element (BGP_VPNV4_NODE, &no_neighbor_unsuppress_map_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010628 install_element (BGP_VPNV6_NODE, &neighbor_unsuppress_map_cmd);
Lou Berger82dd7072016-01-12 13:41:57 -050010629 install_element (BGP_VPNV6_NODE, &no_neighbor_unsuppress_map_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010630 install_element (BGP_ENCAP_NODE, &neighbor_unsuppress_map_cmd);
10631 install_element (BGP_ENCAP_NODE, &no_neighbor_unsuppress_map_cmd);
10632 install_element (BGP_ENCAPV6_NODE, &neighbor_unsuppress_map_cmd);
10633 install_element (BGP_ENCAPV6_NODE, &no_neighbor_unsuppress_map_cmd);
paul718e3742002-12-13 20:15:29 +000010634
10635 /* "neighbor maximum-prefix" commands. */
10636 install_element (BGP_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +000010637 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +000010638 install_element (BGP_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +000010639 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +000010640 install_element (BGP_NODE, &neighbor_maximum_prefix_restart_cmd);
10641 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010642 install_element (BGP_NODE, &no_neighbor_maximum_prefix_cmd);
10643 install_element (BGP_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +000010644 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10645 install_element (BGP_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10646 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10647 install_element (BGP_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10648 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010649 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +000010650 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +000010651 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +000010652 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +000010653 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_restart_cmd);
10654 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010655 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_cmd);
10656 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +000010657 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10658 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10659 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10660 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10661 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010662 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +000010663 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +000010664 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +000010665 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +000010666 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_restart_cmd);
10667 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010668 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_cmd);
10669 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +000010670 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10671 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10672 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10673 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10674 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010675 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +000010676 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +000010677 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +000010678 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +000010679 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_restart_cmd);
10680 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010681 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_cmd);
10682 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +000010683 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10684 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10685 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10686 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10687 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010688 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_cmd);
10689 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_cmd);
10690 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_warning_cmd);
10691 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
10692 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_restart_cmd);
10693 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
10694 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_cmd);
10695 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_val_cmd);
10696 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10697 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10698 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10699 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10700 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010701 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +000010702 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +000010703 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +000010704 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +000010705 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_restart_cmd);
10706 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010707 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_cmd);
10708 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +000010709 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10710 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10711 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10712 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10713 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010714
Lou Berger13c378d2016-01-12 13:41:56 -050010715 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_cmd);
10716 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_threshold_cmd);
10717 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_warning_cmd);
10718 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
10719 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_restart_cmd);
10720 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
10721 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_cmd);
10722 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_val_cmd);
10723 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10724 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10725 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10726 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10727 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
10728
Lou Bergera3fda882016-01-12 13:42:04 -050010729 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_cmd);
10730 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_threshold_cmd);
10731 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_warning_cmd);
10732 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
10733 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_restart_cmd);
10734 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
10735 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_cmd);
10736 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_val_cmd);
10737 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10738 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10739 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10740 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10741 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
10742
10743 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_cmd);
10744 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_threshold_cmd);
10745 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_warning_cmd);
10746 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
10747 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_restart_cmd);
10748 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
10749 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_cmd);
10750 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_val_cmd);
10751 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10752 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10753 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10754 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10755 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
10756
paul718e3742002-12-13 20:15:29 +000010757 /* "neighbor allowas-in" */
10758 install_element (BGP_NODE, &neighbor_allowas_in_cmd);
10759 install_element (BGP_NODE, &neighbor_allowas_in_arg_cmd);
10760 install_element (BGP_NODE, &no_neighbor_allowas_in_cmd);
10761 install_element (BGP_IPV4_NODE, &neighbor_allowas_in_cmd);
10762 install_element (BGP_IPV4_NODE, &neighbor_allowas_in_arg_cmd);
10763 install_element (BGP_IPV4_NODE, &no_neighbor_allowas_in_cmd);
10764 install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_cmd);
10765 install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_arg_cmd);
10766 install_element (BGP_IPV4M_NODE, &no_neighbor_allowas_in_cmd);
10767 install_element (BGP_IPV6_NODE, &neighbor_allowas_in_cmd);
10768 install_element (BGP_IPV6_NODE, &neighbor_allowas_in_arg_cmd);
10769 install_element (BGP_IPV6_NODE, &no_neighbor_allowas_in_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010770 install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_cmd);
10771 install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_arg_cmd);
10772 install_element (BGP_IPV6M_NODE, &no_neighbor_allowas_in_cmd);
paul718e3742002-12-13 20:15:29 +000010773 install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_cmd);
10774 install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_arg_cmd);
10775 install_element (BGP_VPNV4_NODE, &no_neighbor_allowas_in_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010776 install_element (BGP_VPNV6_NODE, &neighbor_allowas_in_cmd);
10777 install_element (BGP_VPNV6_NODE, &neighbor_allowas_in_arg_cmd);
10778 install_element (BGP_VPNV6_NODE, &no_neighbor_allowas_in_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010779 install_element (BGP_ENCAP_NODE, &neighbor_allowas_in_cmd);
10780 install_element (BGP_ENCAP_NODE, &neighbor_allowas_in_arg_cmd);
10781 install_element (BGP_ENCAP_NODE, &no_neighbor_allowas_in_cmd);
10782 install_element (BGP_ENCAPV6_NODE, &neighbor_allowas_in_cmd);
10783 install_element (BGP_ENCAPV6_NODE, &neighbor_allowas_in_arg_cmd);
10784 install_element (BGP_ENCAPV6_NODE, &no_neighbor_allowas_in_cmd);
paul718e3742002-12-13 20:15:29 +000010785
10786 /* address-family commands. */
10787 install_element (BGP_NODE, &address_family_ipv4_cmd);
10788 install_element (BGP_NODE, &address_family_ipv4_safi_cmd);
paul718e3742002-12-13 20:15:29 +000010789 install_element (BGP_NODE, &address_family_ipv6_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010790 install_element (BGP_NODE, &address_family_ipv6_safi_cmd);
paul718e3742002-12-13 20:15:29 +000010791 install_element (BGP_NODE, &address_family_vpnv4_cmd);
10792 install_element (BGP_NODE, &address_family_vpnv4_unicast_cmd);
10793
Lou Berger13c378d2016-01-12 13:41:56 -050010794 install_element (BGP_NODE, &address_family_vpnv6_cmd);
10795 install_element (BGP_NODE, &address_family_vpnv6_unicast_cmd);
10796
Lou Bergera3fda882016-01-12 13:42:04 -050010797 install_element (BGP_NODE, &address_family_encap_cmd);
10798 install_element (BGP_NODE, &address_family_encapv4_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010799 install_element (BGP_NODE, &address_family_encapv6_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010800
paul718e3742002-12-13 20:15:29 +000010801 /* "exit-address-family" command. */
10802 install_element (BGP_IPV4_NODE, &exit_address_family_cmd);
10803 install_element (BGP_IPV4M_NODE, &exit_address_family_cmd);
10804 install_element (BGP_IPV6_NODE, &exit_address_family_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010805 install_element (BGP_IPV6M_NODE, &exit_address_family_cmd);
paul718e3742002-12-13 20:15:29 +000010806 install_element (BGP_VPNV4_NODE, &exit_address_family_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010807 install_element (BGP_VPNV6_NODE, &exit_address_family_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010808 install_element (BGP_ENCAP_NODE, &exit_address_family_cmd);
10809 install_element (BGP_ENCAPV6_NODE, &exit_address_family_cmd);
paul718e3742002-12-13 20:15:29 +000010810
10811 /* "clear ip bgp commands" */
10812 install_element (ENABLE_NODE, &clear_ip_bgp_all_cmd);
10813 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_cmd);
10814 install_element (ENABLE_NODE, &clear_ip_bgp_as_cmd);
10815 install_element (ENABLE_NODE, &clear_ip_bgp_peer_cmd);
10816 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_cmd);
10817 install_element (ENABLE_NODE, &clear_ip_bgp_external_cmd);
paul718e3742002-12-13 20:15:29 +000010818 install_element (ENABLE_NODE, &clear_bgp_all_cmd);
10819 install_element (ENABLE_NODE, &clear_bgp_instance_all_cmd);
10820 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_cmd);
10821 install_element (ENABLE_NODE, &clear_bgp_peer_cmd);
10822 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_cmd);
10823 install_element (ENABLE_NODE, &clear_bgp_peer_group_cmd);
10824 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_cmd);
10825 install_element (ENABLE_NODE, &clear_bgp_external_cmd);
10826 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_cmd);
10827 install_element (ENABLE_NODE, &clear_bgp_as_cmd);
10828 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_cmd);
paul718e3742002-12-13 20:15:29 +000010829
10830 /* "clear ip bgp neighbor soft in" */
10831 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_in_cmd);
10832 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_in_cmd);
10833 install_element (ENABLE_NODE, &clear_ip_bgp_all_in_cmd);
10834 install_element (ENABLE_NODE, &clear_ip_bgp_all_in_prefix_filter_cmd);
10835 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_in_prefix_filter_cmd);
10836 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_in_cmd);
10837 install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_cmd);
10838 install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_prefix_filter_cmd);
10839 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_in_cmd);
10840 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_cmd);
10841 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_prefix_filter_cmd);
10842 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_in_cmd);
10843 install_element (ENABLE_NODE, &clear_ip_bgp_external_in_cmd);
10844 install_element (ENABLE_NODE, &clear_ip_bgp_external_in_prefix_filter_cmd);
10845 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_in_cmd);
10846 install_element (ENABLE_NODE, &clear_ip_bgp_as_in_cmd);
10847 install_element (ENABLE_NODE, &clear_ip_bgp_as_in_prefix_filter_cmd);
10848 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_in_cmd);
10849 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_in_cmd);
10850 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_cmd);
10851 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_prefix_filter_cmd);
10852 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd);
10853 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_in_cmd);
10854 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_cmd);
10855 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd);
10856 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_in_cmd);
10857 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_cmd);
10858 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd);
10859 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_in_cmd);
10860 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_cmd);
10861 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_prefix_filter_cmd);
10862 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_in_cmd);
10863 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_cmd);
10864 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_prefix_filter_cmd);
10865 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_in_cmd);
10866 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_in_cmd);
10867 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_in_cmd);
10868 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_in_cmd);
10869 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_in_cmd);
10870 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_in_cmd);
Lou Berger298cc2f2016-01-12 13:42:02 -050010871 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_soft_in_cmd);
10872 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_in_cmd);
10873 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_soft_in_cmd);
10874 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_in_cmd);
10875 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_soft_in_cmd);
10876 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_in_cmd);
paul718e3742002-12-13 20:15:29 +000010877 install_element (ENABLE_NODE, &clear_bgp_all_soft_in_cmd);
10878 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_in_cmd);
10879 install_element (ENABLE_NODE, &clear_bgp_all_in_cmd);
10880 install_element (ENABLE_NODE, &clear_bgp_all_in_prefix_filter_cmd);
10881 install_element (ENABLE_NODE, &clear_bgp_peer_soft_in_cmd);
10882 install_element (ENABLE_NODE, &clear_bgp_peer_in_cmd);
10883 install_element (ENABLE_NODE, &clear_bgp_peer_in_prefix_filter_cmd);
10884 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_in_cmd);
10885 install_element (ENABLE_NODE, &clear_bgp_peer_group_in_cmd);
10886 install_element (ENABLE_NODE, &clear_bgp_peer_group_in_prefix_filter_cmd);
10887 install_element (ENABLE_NODE, &clear_bgp_external_soft_in_cmd);
10888 install_element (ENABLE_NODE, &clear_bgp_external_in_cmd);
10889 install_element (ENABLE_NODE, &clear_bgp_external_in_prefix_filter_cmd);
10890 install_element (ENABLE_NODE, &clear_bgp_as_soft_in_cmd);
10891 install_element (ENABLE_NODE, &clear_bgp_as_in_cmd);
10892 install_element (ENABLE_NODE, &clear_bgp_as_in_prefix_filter_cmd);
10893 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_in_cmd);
10894 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_cmd);
10895 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_prefix_filter_cmd);
10896 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_in_cmd);
10897 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_cmd);
10898 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_prefix_filter_cmd);
10899 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_in_cmd);
10900 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_cmd);
10901 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_prefix_filter_cmd);
10902 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_in_cmd);
10903 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_cmd);
10904 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_prefix_filter_cmd);
10905 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_in_cmd);
10906 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_cmd);
10907 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_prefix_filter_cmd);
paul718e3742002-12-13 20:15:29 +000010908
10909 /* "clear ip bgp neighbor soft out" */
10910 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_out_cmd);
10911 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_out_cmd);
10912 install_element (ENABLE_NODE, &clear_ip_bgp_all_out_cmd);
10913 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_out_cmd);
10914 install_element (ENABLE_NODE, &clear_ip_bgp_peer_out_cmd);
10915 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_out_cmd);
10916 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_out_cmd);
10917 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_out_cmd);
10918 install_element (ENABLE_NODE, &clear_ip_bgp_external_out_cmd);
10919 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_out_cmd);
10920 install_element (ENABLE_NODE, &clear_ip_bgp_as_out_cmd);
10921 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_out_cmd);
10922 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_out_cmd);
10923 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_out_cmd);
10924 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_out_cmd);
10925 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_out_cmd);
10926 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_out_cmd);
10927 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_out_cmd);
10928 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_out_cmd);
10929 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_out_cmd);
10930 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_out_cmd);
10931 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_out_cmd);
10932 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_out_cmd);
10933 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_out_cmd);
10934 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_out_cmd);
10935 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_out_cmd);
10936 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_out_cmd);
10937 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_out_cmd);
Lou Berger298cc2f2016-01-12 13:42:02 -050010938 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_soft_out_cmd);
10939 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_out_cmd);
10940 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_soft_out_cmd);
10941 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_out_cmd);
10942 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_soft_out_cmd);
10943 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_out_cmd);
paul718e3742002-12-13 20:15:29 +000010944 install_element (ENABLE_NODE, &clear_bgp_all_soft_out_cmd);
10945 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_out_cmd);
10946 install_element (ENABLE_NODE, &clear_bgp_all_out_cmd);
10947 install_element (ENABLE_NODE, &clear_bgp_peer_soft_out_cmd);
10948 install_element (ENABLE_NODE, &clear_bgp_peer_out_cmd);
10949 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_out_cmd);
10950 install_element (ENABLE_NODE, &clear_bgp_peer_group_out_cmd);
10951 install_element (ENABLE_NODE, &clear_bgp_external_soft_out_cmd);
10952 install_element (ENABLE_NODE, &clear_bgp_external_out_cmd);
10953 install_element (ENABLE_NODE, &clear_bgp_as_soft_out_cmd);
10954 install_element (ENABLE_NODE, &clear_bgp_as_out_cmd);
10955 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_out_cmd);
10956 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_out_cmd);
10957 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_out_cmd);
10958 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_out_cmd);
10959 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_out_cmd);
10960 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_out_cmd);
10961 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_out_cmd);
10962 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_out_cmd);
10963 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_out_cmd);
10964 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_out_cmd);
paul718e3742002-12-13 20:15:29 +000010965
10966 /* "clear ip bgp neighbor soft" */
10967 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_cmd);
10968 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_cmd);
10969 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_cmd);
10970 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_cmd);
10971 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_cmd);
10972 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_cmd);
10973 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_cmd);
10974 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_cmd);
10975 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_cmd);
10976 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_cmd);
10977 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_cmd);
10978 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_cmd);
10979 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_cmd);
10980 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_cmd);
10981 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_cmd);
Lou Berger298cc2f2016-01-12 13:42:02 -050010982 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_soft_cmd);
10983 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_soft_cmd);
10984 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_soft_cmd);
paul718e3742002-12-13 20:15:29 +000010985 install_element (ENABLE_NODE, &clear_bgp_all_soft_cmd);
10986 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_cmd);
10987 install_element (ENABLE_NODE, &clear_bgp_peer_soft_cmd);
10988 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_cmd);
10989 install_element (ENABLE_NODE, &clear_bgp_external_soft_cmd);
10990 install_element (ENABLE_NODE, &clear_bgp_as_soft_cmd);
10991 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_cmd);
10992 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_cmd);
10993 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_cmd);
10994 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_cmd);
10995 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_cmd);
paul718e3742002-12-13 20:15:29 +000010996
paulfee0f4c2004-09-13 05:12:46 +000010997 /* "clear ip bgp neighbor rsclient" */
10998 install_element (ENABLE_NODE, &clear_ip_bgp_all_rsclient_cmd);
10999 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_rsclient_cmd);
11000 install_element (ENABLE_NODE, &clear_ip_bgp_peer_rsclient_cmd);
11001 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_rsclient_cmd);
paulfee0f4c2004-09-13 05:12:46 +000011002 install_element (ENABLE_NODE, &clear_bgp_all_rsclient_cmd);
11003 install_element (ENABLE_NODE, &clear_bgp_instance_all_rsclient_cmd);
11004 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_rsclient_cmd);
11005 install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_all_rsclient_cmd);
11006 install_element (ENABLE_NODE, &clear_bgp_peer_rsclient_cmd);
11007 install_element (ENABLE_NODE, &clear_bgp_instance_peer_rsclient_cmd);
11008 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_rsclient_cmd);
11009 install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_peer_rsclient_cmd);
paulfee0f4c2004-09-13 05:12:46 +000011010
paul718e3742002-12-13 20:15:29 +000011011 /* "show ip bgp summary" commands. */
paul718e3742002-12-13 20:15:29 +000011012 install_element (VIEW_NODE, &show_bgp_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011013 install_element (RESTRICTED_NODE, &show_bgp_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011014
11015 install_element (VIEW_NODE, &show_bgp_summary_1w_cmd);
11016 install_element (RESTRICTED_NODE, &show_bgp_summary_1w_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011017
11018 install_element (VIEW_NODE, &show_bgp_ipv4_safi_summary_cmd);
11019 install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_summary_cmd);
11020 install_element (VIEW_NODE, &show_bgp_instance_ipv4_summary_cmd);
11021
11022 install_element (VIEW_NODE, &show_bgp_ipv4_vpn_summary_cmd);
11023 install_element (VIEW_NODE, &show_bgp_ipv4_encap_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011024 install_element (VIEW_NODE, &show_bgp_ipv6_vpn_summary_cmd);
11025 install_element (VIEW_NODE, &show_bgp_ipv6_encap_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011026
paul718e3742002-12-13 20:15:29 +000011027 install_element (VIEW_NODE, &show_bgp_instance_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040011028 install_element (VIEW_NODE, &show_bgp_ipv6_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000011029 install_element (VIEW_NODE, &show_bgp_instance_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040011030 install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_summary_cmd);
Donald Sharp68b45cc2016-03-11 14:27:13 -050011031
Michael Lambert95cbbd22010-07-23 14:43:04 -040011032 install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011033 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040011034 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011035
11036 install_element (RESTRICTED_NODE, &show_bgp_ipv4_vpn_summary_cmd);
11037 install_element (RESTRICTED_NODE, &show_bgp_ipv4_encap_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011038 install_element (RESTRICTED_NODE, &show_bgp_ipv6_vpn_summary_cmd);
11039 install_element (RESTRICTED_NODE, &show_bgp_ipv6_encap_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011040
Paul Jakma62687ff2008-08-23 14:27:06 +010011041 install_element (RESTRICTED_NODE, &show_bgp_instance_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040011042 install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010011043 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040011044 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000011045
11046 /* "show ip bgp neighbors" commands. */
paulbb46e942003-10-24 19:02:03 +000011047 install_element (VIEW_NODE, &show_bgp_instance_neighbors_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011048
11049 install_element (VIEW_NODE, &show_bgp_neighbors_cmd);
11050 install_element (VIEW_NODE, &show_bgp_neighbors_peer_cmd);
11051 install_element (VIEW_NODE, &show_bgp_instance_neighbors_peer_cmd);
11052 install_element (RESTRICTED_NODE, &show_bgp_neighbors_peer_cmd);
11053 install_element (RESTRICTED_NODE, &show_bgp_instance_neighbors_peer_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011054 install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_cmd);
11055 install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
11056 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
Donald Sharp68b45cc2016-03-11 14:27:13 -050011057 install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_cmd);
11058 install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
paul718e3742002-12-13 20:15:29 +000011059
paulfee0f4c2004-09-13 05:12:46 +000011060 /* "show ip bgp rsclient" commands. */
Michael Lambert95cbbd22010-07-23 14:43:04 -040011061 install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd);
11062 install_element (VIEW_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040011063 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd);
11064 install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000011065
paulfee0f4c2004-09-13 05:12:46 +000011066 install_element (VIEW_NODE, &show_bgp_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000011067 install_element (VIEW_NODE, &show_bgp_instance_rsclient_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011068 install_element (RESTRICTED_NODE, &show_bgp_rsclient_summary_cmd);
11069 install_element (RESTRICTED_NODE, &show_bgp_instance_rsclient_summary_cmd);
Donald Sharp68b45cc2016-03-11 14:27:13 -050011070
11071 install_element (VIEW_NODE, &show_bgp_rsclient_summary_cmd);
11072 install_element (VIEW_NODE, &show_bgp_instance_rsclient_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050011073 install_element (VIEW_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000011074 install_element (VIEW_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040011075 install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd);
11076 install_element (VIEW_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010011077 install_element (RESTRICTED_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010011078 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040011079 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd);
11080 install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000011081
paul718e3742002-12-13 20:15:29 +000011082 /* "show ip bgp paths" commands. */
Lou Berger651b4022016-01-12 13:42:07 -050011083 install_element (VIEW_NODE, &show_bgp_ipv4_paths_cmd);
paul718e3742002-12-13 20:15:29 +000011084
11085 /* "show ip bgp community" commands. */
11086 install_element (VIEW_NODE, &show_ip_bgp_community_info_cmd);
paul718e3742002-12-13 20:15:29 +000011087
11088 /* "show ip bgp attribute-info" commands. */
11089 install_element (VIEW_NODE, &show_ip_bgp_attr_info_cmd);
paul718e3742002-12-13 20:15:29 +000011090
11091 /* "redistribute" commands. */
11092 install_element (BGP_NODE, &bgp_redistribute_ipv4_cmd);
11093 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_cmd);
11094 install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_cmd);
11095 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_cmd);
11096 install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_cmd);
11097 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_cmd);
11098 install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_metric_cmd);
11099 install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_rmap_cmd);
11100 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_metric_cmd);
11101 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_rmap_cmd);
paul718e3742002-12-13 20:15:29 +000011102 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_cmd);
11103 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_cmd);
11104 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_cmd);
11105 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_cmd);
11106 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_cmd);
11107 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_cmd);
11108 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_metric_cmd);
11109 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_rmap_cmd);
11110 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_metric_cmd);
11111 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_rmap_cmd);
paul718e3742002-12-13 20:15:29 +000011112
Nick Hilliardfa411a22011-03-23 15:33:17 +000011113 /* ttl_security commands */
11114 install_element (BGP_NODE, &neighbor_ttl_security_cmd);
11115 install_element (BGP_NODE, &no_neighbor_ttl_security_cmd);
11116
Paul Jakma4bf6a362006-03-30 14:05:23 +000011117 /* "show bgp memory" commands. */
11118 install_element (VIEW_NODE, &show_bgp_memory_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010011119 install_element (RESTRICTED_NODE, &show_bgp_memory_cmd);
Paul Jakma4bf6a362006-03-30 14:05:23 +000011120
Michael Lamberte0081f72008-11-16 20:12:04 +000011121 /* "show bgp views" commands. */
11122 install_element (VIEW_NODE, &show_bgp_views_cmd);
11123 install_element (RESTRICTED_NODE, &show_bgp_views_cmd);
Donald Sharp68b45cc2016-03-11 14:27:13 -050011124
11125 /* "show bgp views" commands. */
11126 install_element (VIEW_NODE, &show_bgp_views_cmd);
Lou Bergerf9b6c392016-01-12 13:42:09 -050011127
11128 /* non afi/safi forms of commands */
11129 install_element (VIEW_NODE, &show_ip_bgp_summary_cmd);
11130 install_element (VIEW_NODE, &show_ip_bgp_instance_summary_cmd);
11131 install_element (VIEW_NODE, &show_ip_bgp_ipv4_summary_cmd);
11132 install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
11133 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
11134 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
11135 install_element (VIEW_NODE, &show_bgp_ipv6_summary_cmd);
11136 install_element (RESTRICTED_NODE, &show_ip_bgp_summary_cmd);
11137 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_summary_cmd);
11138 install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_summary_cmd);
11139 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
11140 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
11141 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
11142 install_element (RESTRICTED_NODE, &show_bgp_ipv6_summary_cmd);
Lou Bergerf9b6c392016-01-12 13:42:09 -050011143 install_element (VIEW_NODE, &show_ip_bgp_neighbors_cmd);
11144 install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_cmd);
11145 install_element (VIEW_NODE, &show_ip_bgp_neighbors_peer_cmd);
11146 install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
11147 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd);
11148 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd);
11149 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
11150 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
11151 install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_cmd);
11152 install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
11153 install_element (RESTRICTED_NODE, &show_ip_bgp_neighbors_peer_cmd);
11154 install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
11155 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
11156 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
11157 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
Lou Bergerf9b6c392016-01-12 13:42:09 -050011158 install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_cmd);
11159 install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
11160 install_element (RESTRICTED_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
Donald Sharp68b45cc2016-03-11 14:27:13 -050011161 install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_cmd);
11162 install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
Lou Bergerf9b6c392016-01-12 13:42:09 -050011163 install_element (VIEW_NODE, &show_ipv6_bgp_summary_cmd);
11164 install_element (VIEW_NODE, &show_ipv6_mbgp_summary_cmd);
Lou Bergerf9b6c392016-01-12 13:42:09 -050011165 install_element (VIEW_NODE, &show_ip_bgp_rsclient_summary_cmd);
11166 install_element (VIEW_NODE, &show_ip_bgp_instance_rsclient_summary_cmd);
11167 install_element (VIEW_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd);
11168 install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd);
11169 install_element (RESTRICTED_NODE, &show_ip_bgp_rsclient_summary_cmd);
11170 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_rsclient_summary_cmd);
11171 install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd);
11172 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd);
11173 install_element (ENABLE_NODE, &show_ip_bgp_rsclient_summary_cmd);
Lou Bergerf9b6c392016-01-12 13:42:09 -050011174 install_element (VIEW_NODE, &show_ip_bgp_paths_cmd);
11175 install_element (VIEW_NODE, &show_ip_bgp_ipv4_paths_cmd);
paul718e3742002-12-13 20:15:29 +000011176 /* Community-list. */
11177 community_list_vty ();
11178}
David Lamparter6b0655a2014-06-04 06:53:35 +020011179
paul718e3742002-12-13 20:15:29 +000011180#include "memory.h"
11181#include "bgp_regex.h"
11182#include "bgp_clist.h"
11183#include "bgp_ecommunity.h"
11184
11185/* VTY functions. */
11186
11187/* Direction value to string conversion. */
paul94f2b392005-06-28 12:44:16 +000011188static const char *
paul718e3742002-12-13 20:15:29 +000011189community_direct_str (int direct)
11190{
11191 switch (direct)
11192 {
11193 case COMMUNITY_DENY:
11194 return "deny";
paul718e3742002-12-13 20:15:29 +000011195 case COMMUNITY_PERMIT:
11196 return "permit";
paul718e3742002-12-13 20:15:29 +000011197 default:
11198 return "unknown";
paul718e3742002-12-13 20:15:29 +000011199 }
11200}
11201
11202/* Display error string. */
paul94f2b392005-06-28 12:44:16 +000011203static void
paul718e3742002-12-13 20:15:29 +000011204community_list_perror (struct vty *vty, int ret)
11205{
11206 switch (ret)
11207 {
11208 case COMMUNITY_LIST_ERR_CANT_FIND_LIST:
Denis Ovsienkob7292942010-12-08 18:51:37 +030011209 vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000011210 break;
11211 case COMMUNITY_LIST_ERR_MALFORMED_VAL:
11212 vty_out (vty, "%% Malformed community-list value%s", VTY_NEWLINE);
11213 break;
11214 case COMMUNITY_LIST_ERR_STANDARD_CONFLICT:
11215 vty_out (vty, "%% Community name conflict, previously defined as standard community%s", VTY_NEWLINE);
11216 break;
11217 case COMMUNITY_LIST_ERR_EXPANDED_CONFLICT:
11218 vty_out (vty, "%% Community name conflict, previously defined as expanded community%s", VTY_NEWLINE);
11219 break;
11220 }
11221}
11222
11223/* VTY interface for community_set() function. */
paul94f2b392005-06-28 12:44:16 +000011224static int
paulfd79ac92004-10-13 05:06:08 +000011225community_list_set_vty (struct vty *vty, int argc, const char **argv,
11226 int style, int reject_all_digit_name)
paul718e3742002-12-13 20:15:29 +000011227{
11228 int ret;
11229 int direct;
11230 char *str;
11231
11232 /* Check the list type. */
11233 if (strncmp (argv[1], "p", 1) == 0)
11234 direct = COMMUNITY_PERMIT;
11235 else if (strncmp (argv[1], "d", 1) == 0)
11236 direct = COMMUNITY_DENY;
11237 else
11238 {
11239 vty_out (vty, "%% Matching condition must be permit or deny%s",
11240 VTY_NEWLINE);
11241 return CMD_WARNING;
11242 }
11243
11244 /* All digit name check. */
11245 if (reject_all_digit_name && all_digit (argv[0]))
11246 {
11247 vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE);
11248 return CMD_WARNING;
11249 }
11250
11251 /* Concat community string argument. */
11252 if (argc > 1)
11253 str = argv_concat (argv, argc, 2);
11254 else
11255 str = NULL;
11256
11257 /* When community_list_set() return nevetive value, it means
11258 malformed community string. */
11259 ret = community_list_set (bgp_clist, argv[0], str, direct, style);
11260
11261 /* Free temporary community list string allocated by
11262 argv_concat(). */
11263 if (str)
11264 XFREE (MTYPE_TMP, str);
11265
11266 if (ret < 0)
11267 {
11268 /* Display error string. */
11269 community_list_perror (vty, ret);
11270 return CMD_WARNING;
11271 }
11272
11273 return CMD_SUCCESS;
11274}
11275
paul718e3742002-12-13 20:15:29 +000011276/* Communiyt-list entry delete. */
paul94f2b392005-06-28 12:44:16 +000011277static int
hassofee6e4e2005-02-02 16:29:31 +000011278community_list_unset_vty (struct vty *vty, int argc, const char **argv,
11279 int style)
paul718e3742002-12-13 20:15:29 +000011280{
11281 int ret;
hassofee6e4e2005-02-02 16:29:31 +000011282 int direct = 0;
11283 char *str = NULL;
paul718e3742002-12-13 20:15:29 +000011284
hassofee6e4e2005-02-02 16:29:31 +000011285 if (argc > 1)
paul718e3742002-12-13 20:15:29 +000011286 {
hassofee6e4e2005-02-02 16:29:31 +000011287 /* Check the list direct. */
11288 if (strncmp (argv[1], "p", 1) == 0)
11289 direct = COMMUNITY_PERMIT;
11290 else if (strncmp (argv[1], "d", 1) == 0)
11291 direct = COMMUNITY_DENY;
11292 else
11293 {
11294 vty_out (vty, "%% Matching condition must be permit or deny%s",
11295 VTY_NEWLINE);
11296 return CMD_WARNING;
11297 }
paul718e3742002-12-13 20:15:29 +000011298
hassofee6e4e2005-02-02 16:29:31 +000011299 /* Concat community string argument. */
11300 str = argv_concat (argv, argc, 2);
11301 }
paul718e3742002-12-13 20:15:29 +000011302
11303 /* Unset community list. */
11304 ret = community_list_unset (bgp_clist, argv[0], str, direct, style);
11305
11306 /* Free temporary community list string allocated by
11307 argv_concat(). */
hassofee6e4e2005-02-02 16:29:31 +000011308 if (str)
11309 XFREE (MTYPE_TMP, str);
paul718e3742002-12-13 20:15:29 +000011310
11311 if (ret < 0)
11312 {
11313 community_list_perror (vty, ret);
11314 return CMD_WARNING;
11315 }
11316
11317 return CMD_SUCCESS;
11318}
11319
11320/* "community-list" keyword help string. */
11321#define COMMUNITY_LIST_STR "Add a community list entry\n"
11322#define COMMUNITY_VAL_STR "Community number in aa:nn format or internet|local-AS|no-advertise|no-export\n"
11323
paul718e3742002-12-13 20:15:29 +000011324DEFUN (ip_community_list_standard,
11325 ip_community_list_standard_cmd,
11326 "ip community-list <1-99> (deny|permit) .AA:NN",
11327 IP_STR
11328 COMMUNITY_LIST_STR
11329 "Community list number (standard)\n"
11330 "Specify community to reject\n"
11331 "Specify community to accept\n"
11332 COMMUNITY_VAL_STR)
11333{
11334 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0);
11335}
11336
11337ALIAS (ip_community_list_standard,
11338 ip_community_list_standard2_cmd,
11339 "ip community-list <1-99> (deny|permit)",
11340 IP_STR
11341 COMMUNITY_LIST_STR
11342 "Community list number (standard)\n"
11343 "Specify community to reject\n"
11344 "Specify community to accept\n")
11345
11346DEFUN (ip_community_list_expanded,
11347 ip_community_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000011348 "ip community-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000011349 IP_STR
11350 COMMUNITY_LIST_STR
11351 "Community list number (expanded)\n"
11352 "Specify community to reject\n"
11353 "Specify community to accept\n"
11354 "An ordered list as a regular-expression\n")
11355{
11356 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0);
11357}
11358
11359DEFUN (ip_community_list_name_standard,
11360 ip_community_list_name_standard_cmd,
11361 "ip community-list standard WORD (deny|permit) .AA:NN",
11362 IP_STR
11363 COMMUNITY_LIST_STR
11364 "Add a standard community-list entry\n"
11365 "Community list name\n"
11366 "Specify community to reject\n"
11367 "Specify community to accept\n"
11368 COMMUNITY_VAL_STR)
11369{
11370 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1);
11371}
11372
11373ALIAS (ip_community_list_name_standard,
11374 ip_community_list_name_standard2_cmd,
11375 "ip community-list standard WORD (deny|permit)",
11376 IP_STR
11377 COMMUNITY_LIST_STR
11378 "Add a standard community-list entry\n"
11379 "Community list name\n"
11380 "Specify community to reject\n"
11381 "Specify community to accept\n")
11382
11383DEFUN (ip_community_list_name_expanded,
11384 ip_community_list_name_expanded_cmd,
11385 "ip community-list expanded WORD (deny|permit) .LINE",
11386 IP_STR
11387 COMMUNITY_LIST_STR
11388 "Add an expanded community-list entry\n"
11389 "Community list name\n"
11390 "Specify community to reject\n"
11391 "Specify community to accept\n"
11392 "An ordered list as a regular-expression\n")
11393{
11394 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1);
11395}
11396
hassofee6e4e2005-02-02 16:29:31 +000011397DEFUN (no_ip_community_list_standard_all,
11398 no_ip_community_list_standard_all_cmd,
11399 "no ip community-list <1-99>",
paul718e3742002-12-13 20:15:29 +000011400 NO_STR
11401 IP_STR
11402 COMMUNITY_LIST_STR
hassofee6e4e2005-02-02 16:29:31 +000011403 "Community list number (standard)\n")
paul718e3742002-12-13 20:15:29 +000011404{
hassofee6e4e2005-02-02 16:29:31 +000011405 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
paul718e3742002-12-13 20:15:29 +000011406}
11407
hassofee6e4e2005-02-02 16:29:31 +000011408DEFUN (no_ip_community_list_expanded_all,
11409 no_ip_community_list_expanded_all_cmd,
11410 "no ip community-list <100-500>",
11411 NO_STR
11412 IP_STR
11413 COMMUNITY_LIST_STR
11414 "Community list number (expanded)\n")
11415{
11416 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
11417}
11418
11419DEFUN (no_ip_community_list_name_standard_all,
11420 no_ip_community_list_name_standard_all_cmd,
11421 "no ip community-list standard WORD",
paul718e3742002-12-13 20:15:29 +000011422 NO_STR
11423 IP_STR
11424 COMMUNITY_LIST_STR
11425 "Add a standard community-list entry\n"
paul718e3742002-12-13 20:15:29 +000011426 "Community list name\n")
11427{
hassofee6e4e2005-02-02 16:29:31 +000011428 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
paul718e3742002-12-13 20:15:29 +000011429}
11430
hassofee6e4e2005-02-02 16:29:31 +000011431DEFUN (no_ip_community_list_name_expanded_all,
11432 no_ip_community_list_name_expanded_all_cmd,
11433 "no ip community-list expanded WORD",
paul718e3742002-12-13 20:15:29 +000011434 NO_STR
11435 IP_STR
11436 COMMUNITY_LIST_STR
hassofee6e4e2005-02-02 16:29:31 +000011437 "Add an expanded community-list entry\n"
11438 "Community list name\n")
paul718e3742002-12-13 20:15:29 +000011439{
hassofee6e4e2005-02-02 16:29:31 +000011440 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
paul718e3742002-12-13 20:15:29 +000011441}
11442
11443DEFUN (no_ip_community_list_standard,
11444 no_ip_community_list_standard_cmd,
11445 "no ip community-list <1-99> (deny|permit) .AA:NN",
11446 NO_STR
11447 IP_STR
11448 COMMUNITY_LIST_STR
11449 "Community list number (standard)\n"
11450 "Specify community to reject\n"
11451 "Specify community to accept\n"
11452 COMMUNITY_VAL_STR)
11453{
11454 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
11455}
11456
11457DEFUN (no_ip_community_list_expanded,
11458 no_ip_community_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000011459 "no ip community-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000011460 NO_STR
11461 IP_STR
11462 COMMUNITY_LIST_STR
11463 "Community list number (expanded)\n"
11464 "Specify community to reject\n"
11465 "Specify community to accept\n"
11466 "An ordered list as a regular-expression\n")
11467{
11468 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
11469}
11470
11471DEFUN (no_ip_community_list_name_standard,
11472 no_ip_community_list_name_standard_cmd,
11473 "no ip community-list standard WORD (deny|permit) .AA:NN",
11474 NO_STR
11475 IP_STR
11476 COMMUNITY_LIST_STR
11477 "Specify a standard community-list\n"
11478 "Community list name\n"
11479 "Specify community to reject\n"
11480 "Specify community to accept\n"
11481 COMMUNITY_VAL_STR)
11482{
11483 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
11484}
11485
11486DEFUN (no_ip_community_list_name_expanded,
11487 no_ip_community_list_name_expanded_cmd,
11488 "no ip community-list expanded WORD (deny|permit) .LINE",
11489 NO_STR
11490 IP_STR
11491 COMMUNITY_LIST_STR
11492 "Specify an expanded community-list\n"
11493 "Community list name\n"
11494 "Specify community to reject\n"
11495 "Specify community to accept\n"
11496 "An ordered list as a regular-expression\n")
11497{
11498 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
11499}
11500
paul94f2b392005-06-28 12:44:16 +000011501static void
paul718e3742002-12-13 20:15:29 +000011502community_list_show (struct vty *vty, struct community_list *list)
11503{
11504 struct community_entry *entry;
11505
11506 for (entry = list->head; entry; entry = entry->next)
11507 {
11508 if (entry == list->head)
11509 {
11510 if (all_digit (list->name))
11511 vty_out (vty, "Community %s list %s%s",
11512 entry->style == COMMUNITY_LIST_STANDARD ?
11513 "standard" : "(expanded) access",
11514 list->name, VTY_NEWLINE);
11515 else
11516 vty_out (vty, "Named Community %s list %s%s",
11517 entry->style == COMMUNITY_LIST_STANDARD ?
11518 "standard" : "expanded",
11519 list->name, VTY_NEWLINE);
11520 }
11521 if (entry->any)
11522 vty_out (vty, " %s%s",
11523 community_direct_str (entry->direct), VTY_NEWLINE);
11524 else
11525 vty_out (vty, " %s %s%s",
11526 community_direct_str (entry->direct),
11527 entry->style == COMMUNITY_LIST_STANDARD
11528 ? community_str (entry->u.com) : entry->config,
11529 VTY_NEWLINE);
11530 }
11531}
11532
11533DEFUN (show_ip_community_list,
11534 show_ip_community_list_cmd,
11535 "show ip community-list",
11536 SHOW_STR
11537 IP_STR
11538 "List community-list\n")
11539{
11540 struct community_list *list;
11541 struct community_list_master *cm;
11542
hassofee6e4e2005-02-02 16:29:31 +000011543 cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011544 if (! cm)
11545 return CMD_SUCCESS;
11546
11547 for (list = cm->num.head; list; list = list->next)
11548 community_list_show (vty, list);
11549
11550 for (list = cm->str.head; list; list = list->next)
11551 community_list_show (vty, list);
11552
11553 return CMD_SUCCESS;
11554}
11555
11556DEFUN (show_ip_community_list_arg,
11557 show_ip_community_list_arg_cmd,
hassofee6e4e2005-02-02 16:29:31 +000011558 "show ip community-list (<1-500>|WORD)",
paul718e3742002-12-13 20:15:29 +000011559 SHOW_STR
11560 IP_STR
11561 "List community-list\n"
11562 "Community-list number\n"
11563 "Community-list name\n")
11564{
11565 struct community_list *list;
11566
hassofee6e4e2005-02-02 16:29:31 +000011567 list = community_list_lookup (bgp_clist, argv[0], COMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011568 if (! list)
11569 {
Denis Ovsienkob7292942010-12-08 18:51:37 +030011570 vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000011571 return CMD_WARNING;
11572 }
11573
11574 community_list_show (vty, list);
11575
11576 return CMD_SUCCESS;
11577}
David Lamparter6b0655a2014-06-04 06:53:35 +020011578
paul94f2b392005-06-28 12:44:16 +000011579static int
paulfd79ac92004-10-13 05:06:08 +000011580extcommunity_list_set_vty (struct vty *vty, int argc, const char **argv,
11581 int style, int reject_all_digit_name)
paul718e3742002-12-13 20:15:29 +000011582{
11583 int ret;
11584 int direct;
11585 char *str;
11586
11587 /* Check the list type. */
11588 if (strncmp (argv[1], "p", 1) == 0)
11589 direct = COMMUNITY_PERMIT;
11590 else if (strncmp (argv[1], "d", 1) == 0)
11591 direct = COMMUNITY_DENY;
11592 else
11593 {
11594 vty_out (vty, "%% Matching condition must be permit or deny%s",
11595 VTY_NEWLINE);
11596 return CMD_WARNING;
11597 }
11598
11599 /* All digit name check. */
11600 if (reject_all_digit_name && all_digit (argv[0]))
11601 {
11602 vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE);
11603 return CMD_WARNING;
11604 }
11605
11606 /* Concat community string argument. */
11607 if (argc > 1)
11608 str = argv_concat (argv, argc, 2);
11609 else
11610 str = NULL;
11611
11612 ret = extcommunity_list_set (bgp_clist, argv[0], str, direct, style);
11613
11614 /* Free temporary community list string allocated by
11615 argv_concat(). */
11616 if (str)
11617 XFREE (MTYPE_TMP, str);
11618
11619 if (ret < 0)
11620 {
11621 community_list_perror (vty, ret);
11622 return CMD_WARNING;
11623 }
11624 return CMD_SUCCESS;
11625}
11626
paul94f2b392005-06-28 12:44:16 +000011627static int
hassofee6e4e2005-02-02 16:29:31 +000011628extcommunity_list_unset_vty (struct vty *vty, int argc, const char **argv,
11629 int style)
paul718e3742002-12-13 20:15:29 +000011630{
11631 int ret;
hassofee6e4e2005-02-02 16:29:31 +000011632 int direct = 0;
11633 char *str = NULL;
paul718e3742002-12-13 20:15:29 +000011634
hassofee6e4e2005-02-02 16:29:31 +000011635 if (argc > 1)
paul718e3742002-12-13 20:15:29 +000011636 {
hassofee6e4e2005-02-02 16:29:31 +000011637 /* Check the list direct. */
11638 if (strncmp (argv[1], "p", 1) == 0)
11639 direct = COMMUNITY_PERMIT;
11640 else if (strncmp (argv[1], "d", 1) == 0)
11641 direct = COMMUNITY_DENY;
11642 else
11643 {
11644 vty_out (vty, "%% Matching condition must be permit or deny%s",
11645 VTY_NEWLINE);
11646 return CMD_WARNING;
11647 }
11648
11649 /* Concat community string argument. */
11650 str = argv_concat (argv, argc, 2);
paul718e3742002-12-13 20:15:29 +000011651 }
paul718e3742002-12-13 20:15:29 +000011652
11653 /* Unset community list. */
11654 ret = extcommunity_list_unset (bgp_clist, argv[0], str, direct, style);
11655
11656 /* Free temporary community list string allocated by
11657 argv_concat(). */
hassofee6e4e2005-02-02 16:29:31 +000011658 if (str)
11659 XFREE (MTYPE_TMP, str);
paul718e3742002-12-13 20:15:29 +000011660
11661 if (ret < 0)
11662 {
11663 community_list_perror (vty, ret);
11664 return CMD_WARNING;
11665 }
11666
11667 return CMD_SUCCESS;
11668}
11669
11670/* "extcommunity-list" keyword help string. */
11671#define EXTCOMMUNITY_LIST_STR "Add a extended community list entry\n"
11672#define EXTCOMMUNITY_VAL_STR "Extended community attribute in 'rt aa:nn_or_IPaddr:nn' OR 'soo aa:nn_or_IPaddr:nn' format\n"
11673
11674DEFUN (ip_extcommunity_list_standard,
11675 ip_extcommunity_list_standard_cmd,
11676 "ip extcommunity-list <1-99> (deny|permit) .AA:NN",
11677 IP_STR
11678 EXTCOMMUNITY_LIST_STR
11679 "Extended Community list number (standard)\n"
11680 "Specify community to reject\n"
11681 "Specify community to accept\n"
11682 EXTCOMMUNITY_VAL_STR)
11683{
11684 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0);
11685}
11686
11687ALIAS (ip_extcommunity_list_standard,
11688 ip_extcommunity_list_standard2_cmd,
11689 "ip extcommunity-list <1-99> (deny|permit)",
11690 IP_STR
11691 EXTCOMMUNITY_LIST_STR
11692 "Extended Community list number (standard)\n"
11693 "Specify community to reject\n"
11694 "Specify community to accept\n")
11695
11696DEFUN (ip_extcommunity_list_expanded,
11697 ip_extcommunity_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000011698 "ip extcommunity-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000011699 IP_STR
11700 EXTCOMMUNITY_LIST_STR
11701 "Extended Community list number (expanded)\n"
11702 "Specify community to reject\n"
11703 "Specify community to accept\n"
11704 "An ordered list as a regular-expression\n")
11705{
11706 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0);
11707}
11708
11709DEFUN (ip_extcommunity_list_name_standard,
11710 ip_extcommunity_list_name_standard_cmd,
11711 "ip extcommunity-list standard WORD (deny|permit) .AA:NN",
11712 IP_STR
11713 EXTCOMMUNITY_LIST_STR
11714 "Specify standard extcommunity-list\n"
11715 "Extended Community list name\n"
11716 "Specify community to reject\n"
11717 "Specify community to accept\n"
11718 EXTCOMMUNITY_VAL_STR)
11719{
11720 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1);
11721}
11722
11723ALIAS (ip_extcommunity_list_name_standard,
11724 ip_extcommunity_list_name_standard2_cmd,
11725 "ip extcommunity-list standard WORD (deny|permit)",
11726 IP_STR
11727 EXTCOMMUNITY_LIST_STR
11728 "Specify standard extcommunity-list\n"
11729 "Extended Community list name\n"
11730 "Specify community to reject\n"
11731 "Specify community to accept\n")
11732
11733DEFUN (ip_extcommunity_list_name_expanded,
11734 ip_extcommunity_list_name_expanded_cmd,
11735 "ip extcommunity-list expanded WORD (deny|permit) .LINE",
11736 IP_STR
11737 EXTCOMMUNITY_LIST_STR
11738 "Specify expanded extcommunity-list\n"
11739 "Extended Community list name\n"
11740 "Specify community to reject\n"
11741 "Specify community to accept\n"
11742 "An ordered list as a regular-expression\n")
11743{
11744 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1);
11745}
11746
hassofee6e4e2005-02-02 16:29:31 +000011747DEFUN (no_ip_extcommunity_list_standard_all,
11748 no_ip_extcommunity_list_standard_all_cmd,
11749 "no ip extcommunity-list <1-99>",
paul718e3742002-12-13 20:15:29 +000011750 NO_STR
11751 IP_STR
11752 EXTCOMMUNITY_LIST_STR
hassofee6e4e2005-02-02 16:29:31 +000011753 "Extended Community list number (standard)\n")
paul718e3742002-12-13 20:15:29 +000011754{
hassofee6e4e2005-02-02 16:29:31 +000011755 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
paul718e3742002-12-13 20:15:29 +000011756}
11757
hassofee6e4e2005-02-02 16:29:31 +000011758DEFUN (no_ip_extcommunity_list_expanded_all,
11759 no_ip_extcommunity_list_expanded_all_cmd,
11760 "no ip extcommunity-list <100-500>",
11761 NO_STR
11762 IP_STR
11763 EXTCOMMUNITY_LIST_STR
11764 "Extended Community list number (expanded)\n")
11765{
11766 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
11767}
11768
11769DEFUN (no_ip_extcommunity_list_name_standard_all,
11770 no_ip_extcommunity_list_name_standard_all_cmd,
11771 "no ip extcommunity-list standard WORD",
paul718e3742002-12-13 20:15:29 +000011772 NO_STR
11773 IP_STR
11774 EXTCOMMUNITY_LIST_STR
11775 "Specify standard extcommunity-list\n"
hassofee6e4e2005-02-02 16:29:31 +000011776 "Extended Community list name\n")
11777{
11778 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
11779}
11780
11781DEFUN (no_ip_extcommunity_list_name_expanded_all,
11782 no_ip_extcommunity_list_name_expanded_all_cmd,
11783 "no ip extcommunity-list expanded WORD",
11784 NO_STR
11785 IP_STR
11786 EXTCOMMUNITY_LIST_STR
paul718e3742002-12-13 20:15:29 +000011787 "Specify expanded extcommunity-list\n"
11788 "Extended Community list name\n")
11789{
hassofee6e4e2005-02-02 16:29:31 +000011790 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
paul718e3742002-12-13 20:15:29 +000011791}
11792
11793DEFUN (no_ip_extcommunity_list_standard,
11794 no_ip_extcommunity_list_standard_cmd,
11795 "no ip extcommunity-list <1-99> (deny|permit) .AA:NN",
11796 NO_STR
11797 IP_STR
11798 EXTCOMMUNITY_LIST_STR
11799 "Extended Community list number (standard)\n"
11800 "Specify community to reject\n"
11801 "Specify community to accept\n"
11802 EXTCOMMUNITY_VAL_STR)
11803{
11804 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
11805}
11806
11807DEFUN (no_ip_extcommunity_list_expanded,
11808 no_ip_extcommunity_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000011809 "no ip extcommunity-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000011810 NO_STR
11811 IP_STR
11812 EXTCOMMUNITY_LIST_STR
11813 "Extended Community list number (expanded)\n"
11814 "Specify community to reject\n"
11815 "Specify community to accept\n"
11816 "An ordered list as a regular-expression\n")
11817{
11818 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
11819}
11820
11821DEFUN (no_ip_extcommunity_list_name_standard,
11822 no_ip_extcommunity_list_name_standard_cmd,
11823 "no ip extcommunity-list standard WORD (deny|permit) .AA:NN",
11824 NO_STR
11825 IP_STR
11826 EXTCOMMUNITY_LIST_STR
11827 "Specify standard extcommunity-list\n"
11828 "Extended Community list name\n"
11829 "Specify community to reject\n"
11830 "Specify community to accept\n"
11831 EXTCOMMUNITY_VAL_STR)
11832{
11833 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
11834}
11835
11836DEFUN (no_ip_extcommunity_list_name_expanded,
11837 no_ip_extcommunity_list_name_expanded_cmd,
11838 "no ip extcommunity-list expanded WORD (deny|permit) .LINE",
11839 NO_STR
11840 IP_STR
11841 EXTCOMMUNITY_LIST_STR
11842 "Specify expanded extcommunity-list\n"
11843 "Community list name\n"
11844 "Specify community to reject\n"
11845 "Specify community to accept\n"
11846 "An ordered list as a regular-expression\n")
11847{
11848 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
11849}
11850
paul94f2b392005-06-28 12:44:16 +000011851static void
paul718e3742002-12-13 20:15:29 +000011852extcommunity_list_show (struct vty *vty, struct community_list *list)
11853{
11854 struct community_entry *entry;
11855
11856 for (entry = list->head; entry; entry = entry->next)
11857 {
11858 if (entry == list->head)
11859 {
11860 if (all_digit (list->name))
11861 vty_out (vty, "Extended community %s list %s%s",
11862 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
11863 "standard" : "(expanded) access",
11864 list->name, VTY_NEWLINE);
11865 else
11866 vty_out (vty, "Named extended community %s list %s%s",
11867 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
11868 "standard" : "expanded",
11869 list->name, VTY_NEWLINE);
11870 }
11871 if (entry->any)
11872 vty_out (vty, " %s%s",
11873 community_direct_str (entry->direct), VTY_NEWLINE);
11874 else
11875 vty_out (vty, " %s %s%s",
11876 community_direct_str (entry->direct),
11877 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
11878 entry->u.ecom->str : entry->config,
11879 VTY_NEWLINE);
11880 }
11881}
11882
11883DEFUN (show_ip_extcommunity_list,
11884 show_ip_extcommunity_list_cmd,
11885 "show ip extcommunity-list",
11886 SHOW_STR
11887 IP_STR
11888 "List extended-community list\n")
11889{
11890 struct community_list *list;
11891 struct community_list_master *cm;
11892
hassofee6e4e2005-02-02 16:29:31 +000011893 cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011894 if (! cm)
11895 return CMD_SUCCESS;
11896
11897 for (list = cm->num.head; list; list = list->next)
11898 extcommunity_list_show (vty, list);
11899
11900 for (list = cm->str.head; list; list = list->next)
11901 extcommunity_list_show (vty, list);
11902
11903 return CMD_SUCCESS;
11904}
11905
11906DEFUN (show_ip_extcommunity_list_arg,
11907 show_ip_extcommunity_list_arg_cmd,
hassofee6e4e2005-02-02 16:29:31 +000011908 "show ip extcommunity-list (<1-500>|WORD)",
paul718e3742002-12-13 20:15:29 +000011909 SHOW_STR
11910 IP_STR
11911 "List extended-community list\n"
11912 "Extcommunity-list number\n"
11913 "Extcommunity-list name\n")
11914{
11915 struct community_list *list;
11916
hassofee6e4e2005-02-02 16:29:31 +000011917 list = community_list_lookup (bgp_clist, argv[0], EXTCOMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011918 if (! list)
11919 {
Denis Ovsienkob7292942010-12-08 18:51:37 +030011920 vty_out (vty, "%% Can't find extcommunity-list%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000011921 return CMD_WARNING;
11922 }
11923
11924 extcommunity_list_show (vty, list);
11925
11926 return CMD_SUCCESS;
11927}
David Lamparter6b0655a2014-06-04 06:53:35 +020011928
paul718e3742002-12-13 20:15:29 +000011929/* Return configuration string of community-list entry. */
paulfd79ac92004-10-13 05:06:08 +000011930static const char *
paul718e3742002-12-13 20:15:29 +000011931community_list_config_str (struct community_entry *entry)
11932{
paulfd79ac92004-10-13 05:06:08 +000011933 const char *str;
paul718e3742002-12-13 20:15:29 +000011934
11935 if (entry->any)
11936 str = "";
11937 else
11938 {
11939 if (entry->style == COMMUNITY_LIST_STANDARD)
11940 str = community_str (entry->u.com);
11941 else
11942 str = entry->config;
11943 }
11944 return str;
11945}
11946
11947/* Display community-list and extcommunity-list configuration. */
paul94f2b392005-06-28 12:44:16 +000011948static int
paul718e3742002-12-13 20:15:29 +000011949community_list_config_write (struct vty *vty)
11950{
11951 struct community_list *list;
11952 struct community_entry *entry;
11953 struct community_list_master *cm;
11954 int write = 0;
11955
11956 /* Community-list. */
hassofee6e4e2005-02-02 16:29:31 +000011957 cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011958
11959 for (list = cm->num.head; list; list = list->next)
11960 for (entry = list->head; entry; entry = entry->next)
11961 {
hassofee6e4e2005-02-02 16:29:31 +000011962 vty_out (vty, "ip community-list %s %s %s%s",
11963 list->name, community_direct_str (entry->direct),
11964 community_list_config_str (entry),
11965 VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000011966 write++;
11967 }
11968 for (list = cm->str.head; list; list = list->next)
11969 for (entry = list->head; entry; entry = entry->next)
11970 {
11971 vty_out (vty, "ip community-list %s %s %s %s%s",
11972 entry->style == COMMUNITY_LIST_STANDARD
11973 ? "standard" : "expanded",
11974 list->name, community_direct_str (entry->direct),
11975 community_list_config_str (entry),
11976 VTY_NEWLINE);
11977 write++;
11978 }
11979
11980 /* Extcommunity-list. */
hassofee6e4e2005-02-02 16:29:31 +000011981 cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011982
11983 for (list = cm->num.head; list; list = list->next)
11984 for (entry = list->head; entry; entry = entry->next)
11985 {
hassofee6e4e2005-02-02 16:29:31 +000011986 vty_out (vty, "ip extcommunity-list %s %s %s%s",
11987 list->name, community_direct_str (entry->direct),
11988 community_list_config_str (entry), VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000011989 write++;
11990 }
11991 for (list = cm->str.head; list; list = list->next)
11992 for (entry = list->head; entry; entry = entry->next)
11993 {
11994 vty_out (vty, "ip extcommunity-list %s %s %s %s%s",
11995 entry->style == EXTCOMMUNITY_LIST_STANDARD
11996 ? "standard" : "expanded",
11997 list->name, community_direct_str (entry->direct),
11998 community_list_config_str (entry), VTY_NEWLINE);
11999 write++;
12000 }
12001 return write;
12002}
12003
Stephen Hemminger7fc626d2008-12-01 11:10:34 -080012004static struct cmd_node community_list_node =
paul718e3742002-12-13 20:15:29 +000012005{
12006 COMMUNITY_LIST_NODE,
12007 "",
12008 1 /* Export to vtysh. */
12009};
12010
paul94f2b392005-06-28 12:44:16 +000012011static void
12012community_list_vty (void)
paul718e3742002-12-13 20:15:29 +000012013{
12014 install_node (&community_list_node, community_list_config_write);
12015
12016 /* Community-list. */
paul718e3742002-12-13 20:15:29 +000012017 install_element (CONFIG_NODE, &ip_community_list_standard_cmd);
12018 install_element (CONFIG_NODE, &ip_community_list_standard2_cmd);
12019 install_element (CONFIG_NODE, &ip_community_list_expanded_cmd);
12020 install_element (CONFIG_NODE, &ip_community_list_name_standard_cmd);
12021 install_element (CONFIG_NODE, &ip_community_list_name_standard2_cmd);
12022 install_element (CONFIG_NODE, &ip_community_list_name_expanded_cmd);
hassofee6e4e2005-02-02 16:29:31 +000012023 install_element (CONFIG_NODE, &no_ip_community_list_standard_all_cmd);
12024 install_element (CONFIG_NODE, &no_ip_community_list_expanded_all_cmd);
12025 install_element (CONFIG_NODE, &no_ip_community_list_name_standard_all_cmd);
12026 install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_all_cmd);
paul718e3742002-12-13 20:15:29 +000012027 install_element (CONFIG_NODE, &no_ip_community_list_standard_cmd);
12028 install_element (CONFIG_NODE, &no_ip_community_list_expanded_cmd);
12029 install_element (CONFIG_NODE, &no_ip_community_list_name_standard_cmd);
12030 install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_cmd);
12031 install_element (VIEW_NODE, &show_ip_community_list_cmd);
12032 install_element (VIEW_NODE, &show_ip_community_list_arg_cmd);
12033 install_element (ENABLE_NODE, &show_ip_community_list_cmd);
12034 install_element (ENABLE_NODE, &show_ip_community_list_arg_cmd);
12035
12036 /* Extcommunity-list. */
12037 install_element (CONFIG_NODE, &ip_extcommunity_list_standard_cmd);
12038 install_element (CONFIG_NODE, &ip_extcommunity_list_standard2_cmd);
12039 install_element (CONFIG_NODE, &ip_extcommunity_list_expanded_cmd);
12040 install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard_cmd);
12041 install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard2_cmd);
12042 install_element (CONFIG_NODE, &ip_extcommunity_list_name_expanded_cmd);
hassofee6e4e2005-02-02 16:29:31 +000012043 install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_all_cmd);
12044 install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_all_cmd);
12045 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_all_cmd);
12046 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_all_cmd);
paul718e3742002-12-13 20:15:29 +000012047 install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_cmd);
12048 install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_cmd);
12049 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_cmd);
12050 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_cmd);
12051 install_element (VIEW_NODE, &show_ip_extcommunity_list_cmd);
12052 install_element (VIEW_NODE, &show_ip_extcommunity_list_arg_cmd);
12053 install_element (ENABLE_NODE, &show_ip_extcommunity_list_cmd);
12054 install_element (ENABLE_NODE, &show_ip_extcommunity_list_arg_cmd);
12055}