blob: 2df23096678a6692f2e48a4774602dbfb5ba102e [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 }
110#ifdef HAVE_IPV6
111 if (!strcmp(str, "ipv6")) {
112 *afi = AFI_IP6;
113 return 0;
114 }
115#endif /* HAVE_IPV6 */
116 return -1;
117}
118
119int
120bgp_parse_safi(const char *str, safi_t *safi)
121{
122 if (!strcmp(str, "encap")) {
123 *safi = SAFI_ENCAP;
124 return 0;
125 }
126 if (!strcmp(str, "multicast")) {
127 *safi = SAFI_MULTICAST;
128 return 0;
129 }
130 if (!strcmp(str, "unicast")) {
131 *safi = SAFI_UNICAST;
132 return 0;
133 }
134 if (!strcmp(str, "vpn")) {
135 *safi = SAFI_MPLS_VPN;
136 return 0;
137 }
138 return -1;
139}
140
paul94f2b392005-06-28 12:44:16 +0000141static int
paul718e3742002-12-13 20:15:29 +0000142peer_address_self_check (union sockunion *su)
143{
144 struct interface *ifp = NULL;
145
146 if (su->sa.sa_family == AF_INET)
147 ifp = if_lookup_by_ipv4_exact (&su->sin.sin_addr);
148#ifdef HAVE_IPV6
149 else if (su->sa.sa_family == AF_INET6)
150 ifp = if_lookup_by_ipv6_exact (&su->sin6.sin6_addr);
151#endif /* HAVE IPV6 */
152
153 if (ifp)
154 return 1;
155
156 return 0;
157}
158
159/* Utility function for looking up peer from VTY. */
paul94f2b392005-06-28 12:44:16 +0000160static struct peer *
paulfd79ac92004-10-13 05:06:08 +0000161peer_lookup_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +0000162{
163 int ret;
164 struct bgp *bgp;
165 union sockunion su;
166 struct peer *peer;
167
168 bgp = vty->index;
169
170 ret = str2sockunion (ip_str, &su);
171 if (ret < 0)
172 {
173 vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE);
174 return NULL;
175 }
176
177 peer = peer_lookup (bgp, &su);
178 if (! peer)
179 {
180 vty_out (vty, "%% Specify remote-as or peer-group commands first%s", VTY_NEWLINE);
181 return NULL;
182 }
183 return peer;
184}
185
186/* Utility function for looking up peer or peer group. */
paul94f2b392005-06-28 12:44:16 +0000187static struct peer *
paulfd79ac92004-10-13 05:06:08 +0000188peer_and_group_lookup_vty (struct vty *vty, const char *peer_str)
paul718e3742002-12-13 20:15:29 +0000189{
190 int ret;
191 struct bgp *bgp;
192 union sockunion su;
193 struct peer *peer;
194 struct peer_group *group;
195
196 bgp = vty->index;
197
198 ret = str2sockunion (peer_str, &su);
199 if (ret == 0)
200 {
201 peer = peer_lookup (bgp, &su);
202 if (peer)
203 return peer;
204 }
205 else
206 {
207 group = peer_group_lookup (bgp, peer_str);
208 if (group)
209 return group->conf;
210 }
211
212 vty_out (vty, "%% Specify remote-as or peer-group commands first%s",
213 VTY_NEWLINE);
214
215 return NULL;
216}
217
paul94f2b392005-06-28 12:44:16 +0000218static int
paul718e3742002-12-13 20:15:29 +0000219bgp_vty_return (struct vty *vty, int ret)
220{
paulfd79ac92004-10-13 05:06:08 +0000221 const char *str = NULL;
paul718e3742002-12-13 20:15:29 +0000222
223 switch (ret)
224 {
225 case BGP_ERR_INVALID_VALUE:
226 str = "Invalid value";
227 break;
228 case BGP_ERR_INVALID_FLAG:
229 str = "Invalid flag";
230 break;
231 case BGP_ERR_PEER_INACTIVE:
232 str = "Activate the neighbor for the address family first";
233 break;
234 case BGP_ERR_INVALID_FOR_PEER_GROUP_MEMBER:
235 str = "Invalid command for a peer-group member";
236 break;
237 case BGP_ERR_PEER_GROUP_SHUTDOWN:
238 str = "Peer-group has been shutdown. Activate the peer-group first";
239 break;
240 case BGP_ERR_PEER_GROUP_HAS_THE_FLAG:
241 str = "This peer is a peer-group member. Please change peer-group configuration";
242 break;
243 case BGP_ERR_PEER_FLAG_CONFLICT:
244 str = "Can't set override-capability and strict-capability-match at the same time";
245 break;
246 case BGP_ERR_PEER_GROUP_MEMBER_EXISTS:
247 str = "No activate for peergroup can be given only if peer-group has no members";
248 break;
249 case BGP_ERR_PEER_BELONGS_TO_GROUP:
250 str = "No activate for an individual peer-group member is invalid";
251 break;
252 case BGP_ERR_PEER_GROUP_AF_UNCONFIGURED:
253 str = "Activate the peer-group for the address family first";
254 break;
255 case BGP_ERR_PEER_GROUP_NO_REMOTE_AS:
256 str = "Specify remote-as or peer-group remote AS first";
257 break;
258 case BGP_ERR_PEER_GROUP_CANT_CHANGE:
259 str = "Cannot change the peer-group. Deconfigure first";
260 break;
261 case BGP_ERR_PEER_GROUP_MISMATCH:
262 str = "Cannot have different peer-group for the neighbor";
263 break;
264 case BGP_ERR_PEER_FILTER_CONFLICT:
265 str = "Prefix/distribute list can not co-exist";
266 break;
267 case BGP_ERR_NOT_INTERNAL_PEER:
268 str = "Invalid command. Not an internal neighbor";
269 break;
270 case BGP_ERR_REMOVE_PRIVATE_AS:
271 str = "Private AS cannot be removed for IBGP peers";
272 break;
273 case BGP_ERR_LOCAL_AS_ALLOWED_ONLY_FOR_EBGP:
274 str = "Local-AS allowed only for EBGP peers";
275 break;
276 case BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS:
277 str = "Cannot have local-as same as BGP AS number";
278 break;
Paul Jakma0df7c912008-07-21 21:02:49 +0000279 case BGP_ERR_TCPSIG_FAILED:
280 str = "Error while applying TCP-Sig to session(s)";
281 break;
Nick Hilliardfa411a22011-03-23 15:33:17 +0000282 case BGP_ERR_NO_EBGP_MULTIHOP_WITH_TTLHACK:
283 str = "ebgp-multihop and ttl-security cannot be configured together";
284 break;
Stephen Hemmingerf5a48272011-03-24 17:30:21 +0000285 case BGP_ERR_NO_IBGP_WITH_TTLHACK:
286 str = "ttl-security only allowed for EBGP peers";
287 break;
paul718e3742002-12-13 20:15:29 +0000288 }
289 if (str)
290 {
291 vty_out (vty, "%% %s%s", str, VTY_NEWLINE);
292 return CMD_WARNING;
293 }
294 return CMD_SUCCESS;
295}
296
297/* BGP global configuration. */
298
299DEFUN (bgp_multiple_instance_func,
300 bgp_multiple_instance_cmd,
301 "bgp multiple-instance",
302 BGP_STR
303 "Enable bgp multiple instance\n")
304{
305 bgp_option_set (BGP_OPT_MULTIPLE_INSTANCE);
306 return CMD_SUCCESS;
307}
308
309DEFUN (no_bgp_multiple_instance,
310 no_bgp_multiple_instance_cmd,
311 "no bgp multiple-instance",
312 NO_STR
313 BGP_STR
314 "BGP multiple instance\n")
315{
316 int ret;
317
318 ret = bgp_option_unset (BGP_OPT_MULTIPLE_INSTANCE);
319 if (ret < 0)
320 {
321 vty_out (vty, "%% There are more than two BGP instances%s", VTY_NEWLINE);
322 return CMD_WARNING;
323 }
324 return CMD_SUCCESS;
325}
326
327DEFUN (bgp_config_type,
328 bgp_config_type_cmd,
329 "bgp config-type (cisco|zebra)",
330 BGP_STR
331 "Configuration type\n"
332 "cisco\n"
333 "zebra\n")
334{
335 if (strncmp (argv[0], "c", 1) == 0)
336 bgp_option_set (BGP_OPT_CONFIG_CISCO);
337 else
338 bgp_option_unset (BGP_OPT_CONFIG_CISCO);
339
340 return CMD_SUCCESS;
341}
342
343DEFUN (no_bgp_config_type,
344 no_bgp_config_type_cmd,
345 "no bgp config-type",
346 NO_STR
347 BGP_STR
348 "Display configuration type\n")
349{
350 bgp_option_unset (BGP_OPT_CONFIG_CISCO);
351 return CMD_SUCCESS;
352}
353
354DEFUN (no_synchronization,
355 no_synchronization_cmd,
356 "no synchronization",
357 NO_STR
358 "Perform IGP synchronization\n")
359{
360 return CMD_SUCCESS;
361}
362
363DEFUN (no_auto_summary,
364 no_auto_summary_cmd,
365 "no auto-summary",
366 NO_STR
367 "Enable automatic network number summarization\n")
368{
369 return CMD_SUCCESS;
370}
hasso3d515fd2005-02-01 21:30:04 +0000371
372DEFUN_DEPRECATED (neighbor_version,
373 neighbor_version_cmd,
374 NEIGHBOR_CMD "version (4|4-)",
375 NEIGHBOR_STR
376 NEIGHBOR_ADDR_STR
377 "Set the BGP version to match a neighbor\n"
378 "Neighbor's BGP version\n")
379{
380 return CMD_SUCCESS;
381}
David Lamparter6b0655a2014-06-04 06:53:35 +0200382
paul718e3742002-12-13 20:15:29 +0000383/* "router bgp" commands. */
384DEFUN (router_bgp,
385 router_bgp_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000386 "router bgp " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000387 ROUTER_STR
388 BGP_STR
389 AS_STR)
390{
391 int ret;
392 as_t as;
393 struct bgp *bgp;
paulfd79ac92004-10-13 05:06:08 +0000394 const char *name = NULL;
paul718e3742002-12-13 20:15:29 +0000395
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000396 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +0000397
398 if (argc == 2)
399 name = argv[1];
400
401 ret = bgp_get (&bgp, &as, name);
402 switch (ret)
403 {
404 case BGP_ERR_MULTIPLE_INSTANCE_NOT_SET:
405 vty_out (vty, "Please specify 'bgp multiple-instance' first%s",
406 VTY_NEWLINE);
407 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +0000408 case BGP_ERR_AS_MISMATCH:
Denis Ovsienkoaea339f2009-04-30 17:16:22 +0400409 vty_out (vty, "BGP is already running; AS is %u%s", as, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +0000410 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +0000411 case BGP_ERR_INSTANCE_MISMATCH:
412 vty_out (vty, "BGP view name and AS number mismatch%s", VTY_NEWLINE);
Denis Ovsienkoaea339f2009-04-30 17:16:22 +0400413 vty_out (vty, "BGP instance is already running; AS is %u%s",
paul718e3742002-12-13 20:15:29 +0000414 as, VTY_NEWLINE);
415 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +0000416 }
417
418 vty->node = BGP_NODE;
419 vty->index = bgp;
420
421 return CMD_SUCCESS;
422}
423
424ALIAS (router_bgp,
425 router_bgp_view_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000426 "router bgp " CMD_AS_RANGE " view WORD",
paul718e3742002-12-13 20:15:29 +0000427 ROUTER_STR
428 BGP_STR
429 AS_STR
430 "BGP view\n"
431 "view name\n")
David Lamparter6b0655a2014-06-04 06:53:35 +0200432
paul718e3742002-12-13 20:15:29 +0000433/* "no router bgp" commands. */
434DEFUN (no_router_bgp,
435 no_router_bgp_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000436 "no router bgp " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000437 NO_STR
438 ROUTER_STR
439 BGP_STR
440 AS_STR)
441{
442 as_t as;
443 struct bgp *bgp;
paulfd79ac92004-10-13 05:06:08 +0000444 const char *name = NULL;
paul718e3742002-12-13 20:15:29 +0000445
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000446 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +0000447
448 if (argc == 2)
449 name = argv[1];
450
451 /* Lookup bgp structure. */
452 bgp = bgp_lookup (as, name);
453 if (! bgp)
454 {
455 vty_out (vty, "%% Can't find BGP instance%s", VTY_NEWLINE);
456 return CMD_WARNING;
457 }
458
459 bgp_delete (bgp);
460
461 return CMD_SUCCESS;
462}
463
464ALIAS (no_router_bgp,
465 no_router_bgp_view_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000466 "no router bgp " CMD_AS_RANGE " view WORD",
paul718e3742002-12-13 20:15:29 +0000467 NO_STR
468 ROUTER_STR
469 BGP_STR
470 AS_STR
471 "BGP view\n"
472 "view name\n")
David Lamparter6b0655a2014-06-04 06:53:35 +0200473
paul718e3742002-12-13 20:15:29 +0000474/* BGP router-id. */
475
476DEFUN (bgp_router_id,
477 bgp_router_id_cmd,
478 "bgp router-id A.B.C.D",
479 BGP_STR
480 "Override configured router identifier\n"
481 "Manually configured router identifier\n")
482{
483 int ret;
484 struct in_addr id;
485 struct bgp *bgp;
486
487 bgp = vty->index;
488
489 ret = inet_aton (argv[0], &id);
490 if (! ret)
491 {
492 vty_out (vty, "%% Malformed bgp router identifier%s", VTY_NEWLINE);
493 return CMD_WARNING;
494 }
495
hasso18a6dce2004-10-03 18:18:34 +0000496 bgp->router_id_static = id;
paul718e3742002-12-13 20:15:29 +0000497 bgp_router_id_set (bgp, &id);
498
499 return CMD_SUCCESS;
500}
501
502DEFUN (no_bgp_router_id,
503 no_bgp_router_id_cmd,
504 "no bgp router-id",
505 NO_STR
506 BGP_STR
507 "Override configured router identifier\n")
508{
509 int ret;
510 struct in_addr id;
511 struct bgp *bgp;
512
513 bgp = vty->index;
514
515 if (argc == 1)
516 {
517 ret = inet_aton (argv[0], &id);
518 if (! ret)
519 {
520 vty_out (vty, "%% Malformed BGP router identifier%s", VTY_NEWLINE);
521 return CMD_WARNING;
522 }
523
hasso18a6dce2004-10-03 18:18:34 +0000524 if (! IPV4_ADDR_SAME (&bgp->router_id_static, &id))
paul718e3742002-12-13 20:15:29 +0000525 {
526 vty_out (vty, "%% BGP router-id doesn't match%s", VTY_NEWLINE);
527 return CMD_WARNING;
528 }
529 }
530
hasso18a6dce2004-10-03 18:18:34 +0000531 bgp->router_id_static.s_addr = 0;
532 bgp_router_id_set (bgp, &router_id_zebra);
paul718e3742002-12-13 20:15:29 +0000533
534 return CMD_SUCCESS;
535}
536
537ALIAS (no_bgp_router_id,
538 no_bgp_router_id_val_cmd,
539 "no bgp router-id A.B.C.D",
540 NO_STR
541 BGP_STR
542 "Override configured router identifier\n"
543 "Manually configured router identifier\n")
David Lamparter6b0655a2014-06-04 06:53:35 +0200544
paul718e3742002-12-13 20:15:29 +0000545/* BGP Cluster ID. */
546
547DEFUN (bgp_cluster_id,
548 bgp_cluster_id_cmd,
549 "bgp cluster-id A.B.C.D",
550 BGP_STR
551 "Configure Route-Reflector Cluster-id\n"
552 "Route-Reflector Cluster-id in IP address format\n")
553{
554 int ret;
555 struct bgp *bgp;
556 struct in_addr cluster;
557
558 bgp = vty->index;
559
560 ret = inet_aton (argv[0], &cluster);
561 if (! ret)
562 {
563 vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE);
564 return CMD_WARNING;
565 }
566
567 bgp_cluster_id_set (bgp, &cluster);
568
569 return CMD_SUCCESS;
570}
571
572ALIAS (bgp_cluster_id,
573 bgp_cluster_id32_cmd,
574 "bgp cluster-id <1-4294967295>",
575 BGP_STR
576 "Configure Route-Reflector Cluster-id\n"
577 "Route-Reflector Cluster-id as 32 bit quantity\n")
578
579DEFUN (no_bgp_cluster_id,
580 no_bgp_cluster_id_cmd,
581 "no bgp cluster-id",
582 NO_STR
583 BGP_STR
584 "Configure Route-Reflector Cluster-id\n")
585{
586 int ret;
587 struct bgp *bgp;
588 struct in_addr cluster;
589
590 bgp = vty->index;
591
592 if (argc == 1)
593 {
594 ret = inet_aton (argv[0], &cluster);
595 if (! ret)
596 {
597 vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE);
598 return CMD_WARNING;
599 }
600 }
601
602 bgp_cluster_id_unset (bgp);
603
604 return CMD_SUCCESS;
605}
606
607ALIAS (no_bgp_cluster_id,
608 no_bgp_cluster_id_arg_cmd,
609 "no bgp cluster-id A.B.C.D",
610 NO_STR
611 BGP_STR
612 "Configure Route-Reflector Cluster-id\n"
613 "Route-Reflector Cluster-id in IP address format\n")
David Lamparter6b0655a2014-06-04 06:53:35 +0200614
paul718e3742002-12-13 20:15:29 +0000615DEFUN (bgp_confederation_identifier,
616 bgp_confederation_identifier_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000617 "bgp confederation identifier " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000618 "BGP specific commands\n"
619 "AS confederation parameters\n"
620 "AS number\n"
621 "Set routing domain confederation AS\n")
622{
623 struct bgp *bgp;
624 as_t as;
625
626 bgp = vty->index;
627
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000628 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +0000629
630 bgp_confederation_id_set (bgp, as);
631
632 return CMD_SUCCESS;
633}
634
635DEFUN (no_bgp_confederation_identifier,
636 no_bgp_confederation_identifier_cmd,
637 "no bgp confederation identifier",
638 NO_STR
639 "BGP specific commands\n"
640 "AS confederation parameters\n"
641 "AS number\n")
642{
643 struct bgp *bgp;
Paul Jakma7aa9dce2014-09-19 14:42:23 +0100644 as_t as __attribute__((unused)); /* Dummy for VTY_GET_INTEGER_RANGE */
paul718e3742002-12-13 20:15:29 +0000645
646 bgp = vty->index;
647
648 if (argc == 1)
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000649 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +0000650
651 bgp_confederation_id_unset (bgp);
652
653 return CMD_SUCCESS;
654}
655
656ALIAS (no_bgp_confederation_identifier,
657 no_bgp_confederation_identifier_arg_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000658 "no bgp confederation identifier " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000659 NO_STR
660 "BGP specific commands\n"
661 "AS confederation parameters\n"
662 "AS number\n"
663 "Set routing domain confederation AS\n")
David Lamparter6b0655a2014-06-04 06:53:35 +0200664
paul718e3742002-12-13 20:15:29 +0000665DEFUN (bgp_confederation_peers,
666 bgp_confederation_peers_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000667 "bgp confederation peers ." CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000668 "BGP specific commands\n"
669 "AS confederation parameters\n"
670 "Peer ASs in BGP confederation\n"
671 AS_STR)
672{
673 struct bgp *bgp;
674 as_t as;
675 int i;
676
677 bgp = vty->index;
678
679 for (i = 0; i < argc; i++)
680 {
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000681 VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +0000682
683 if (bgp->as == as)
684 {
685 vty_out (vty, "%% Local member-AS not allowed in confed peer list%s",
686 VTY_NEWLINE);
687 continue;
688 }
689
690 bgp_confederation_peers_add (bgp, as);
691 }
692 return CMD_SUCCESS;
693}
694
695DEFUN (no_bgp_confederation_peers,
696 no_bgp_confederation_peers_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000697 "no bgp confederation peers ." CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000698 NO_STR
699 "BGP specific commands\n"
700 "AS confederation parameters\n"
701 "Peer ASs in BGP confederation\n"
702 AS_STR)
703{
704 struct bgp *bgp;
705 as_t as;
706 int i;
707
708 bgp = vty->index;
709
710 for (i = 0; i < argc; i++)
711 {
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000712 VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX);
713
paul718e3742002-12-13 20:15:29 +0000714 bgp_confederation_peers_remove (bgp, as);
715 }
716 return CMD_SUCCESS;
717}
David Lamparter6b0655a2014-06-04 06:53:35 +0200718
Josh Bailey165b5ff2011-07-20 20:43:22 -0700719/* Maximum-paths configuration */
720DEFUN (bgp_maxpaths,
721 bgp_maxpaths_cmd,
722 "maximum-paths <1-255>",
723 "Forward packets over multiple paths\n"
724 "Number of paths\n")
725{
726 struct bgp *bgp;
727 u_int16_t maxpaths;
728 int ret;
729
730 bgp = vty->index;
731
732 VTY_GET_INTEGER_RANGE ("maximum-paths", maxpaths, argv[0], 1, 255);
733
734 ret = bgp_maximum_paths_set (bgp, bgp_node_afi (vty), bgp_node_safi(vty),
735 BGP_PEER_EBGP, maxpaths);
736 if (ret < 0)
737 {
738 vty_out (vty,
739 "%% Failed to set maximum-paths %u for afi %u, safi %u%s",
740 maxpaths, bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE);
741 return CMD_WARNING;
742 }
743
Donald Sharp58a83f22015-09-11 10:11:42 -0400744 if ((MULTIPATH_NUM != 0) && (maxpaths > MULTIPATH_NUM))
745 vty_out (vty,
746 "%% Warning: maximum-paths set to %d is greater than %d that zebra is compiled to support%s",
747 maxpaths, MULTIPATH_NUM, VTY_NEWLINE);
748
Josh Bailey165b5ff2011-07-20 20:43:22 -0700749 return CMD_SUCCESS;
750}
751
752DEFUN (bgp_maxpaths_ibgp,
753 bgp_maxpaths_ibgp_cmd,
754 "maximum-paths ibgp <1-255>",
755 "Forward packets over multiple paths\n"
756 "iBGP-multipath\n"
757 "Number of paths\n")
758{
759 struct bgp *bgp;
760 u_int16_t maxpaths;
761 int ret;
762
763 bgp = vty->index;
764
765 VTY_GET_INTEGER_RANGE ("maximum-paths", maxpaths, argv[0], 1, 255);
766
767 ret = bgp_maximum_paths_set (bgp, bgp_node_afi (vty), bgp_node_safi(vty),
768 BGP_PEER_IBGP, maxpaths);
769 if (ret < 0)
770 {
771 vty_out (vty,
772 "%% Failed to set maximum-paths ibgp %u for afi %u, safi %u%s",
773 maxpaths, bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE);
774 return CMD_WARNING;
775 }
776
Donald Sharp58a83f22015-09-11 10:11:42 -0400777 if ((MULTIPATH_NUM != 0) && (maxpaths > MULTIPATH_NUM))
778 vty_out (vty,
779 "%% Warning: maximum-paths set to %d is greater than %d that zebra is compiled to support%s",
780 maxpaths, MULTIPATH_NUM, VTY_NEWLINE);
781
Josh Bailey165b5ff2011-07-20 20:43:22 -0700782 return CMD_SUCCESS;
783}
784
785DEFUN (no_bgp_maxpaths,
786 no_bgp_maxpaths_cmd,
787 "no maximum-paths",
788 NO_STR
789 "Forward packets over multiple paths\n"
790 "Number of paths\n")
791{
792 struct bgp *bgp;
793 int ret;
794
795 bgp = vty->index;
796
797 ret = bgp_maximum_paths_unset (bgp, bgp_node_afi (vty), bgp_node_safi(vty),
798 BGP_PEER_EBGP);
799 if (ret < 0)
800 {
801 vty_out (vty,
802 "%% Failed to unset maximum-paths for afi %u, safi %u%s",
803 bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE);
804 return CMD_WARNING;
805 }
806
807 return CMD_SUCCESS;
808}
809
810ALIAS (no_bgp_maxpaths,
811 no_bgp_maxpaths_arg_cmd,
812 "no maximum-paths <1-255>",
813 NO_STR
814 "Forward packets over multiple paths\n"
815 "Number of paths\n")
816
817DEFUN (no_bgp_maxpaths_ibgp,
818 no_bgp_maxpaths_ibgp_cmd,
819 "no maximum-paths ibgp",
820 NO_STR
821 "Forward packets over multiple paths\n"
822 "iBGP-multipath\n"
823 "Number of paths\n")
824{
825 struct bgp *bgp;
826 int ret;
827
828 bgp = vty->index;
829
830 ret = bgp_maximum_paths_unset (bgp, bgp_node_afi (vty), bgp_node_safi(vty),
831 BGP_PEER_IBGP);
832 if (ret < 0)
833 {
834 vty_out (vty,
835 "%% Failed to unset maximum-paths ibgp for afi %u, safi %u%s",
836 bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE);
837 return CMD_WARNING;
838 }
839
840 return CMD_SUCCESS;
841}
842
843ALIAS (no_bgp_maxpaths_ibgp,
844 no_bgp_maxpaths_ibgp_arg_cmd,
845 "no maximum-paths ibgp <1-255>",
846 NO_STR
847 "Forward packets over multiple paths\n"
848 "iBGP-multipath\n"
849 "Number of paths\n")
850
851int
852bgp_config_write_maxpaths (struct vty *vty, struct bgp *bgp, afi_t afi,
853 safi_t safi, int *write)
854{
855 if (bgp->maxpaths[afi][safi].maxpaths_ebgp != BGP_DEFAULT_MAXPATHS)
856 {
857 bgp_config_write_family_header (vty, afi, safi, write);
858 vty_out (vty, " maximum-paths %d%s",
859 bgp->maxpaths[afi][safi].maxpaths_ebgp, VTY_NEWLINE);
860 }
861
862 if (bgp->maxpaths[afi][safi].maxpaths_ibgp != BGP_DEFAULT_MAXPATHS)
863 {
864 bgp_config_write_family_header (vty, afi, safi, write);
865 vty_out (vty, " maximum-paths ibgp %d%s",
866 bgp->maxpaths[afi][safi].maxpaths_ibgp, VTY_NEWLINE);
867 }
868
869 return 0;
870}
David Lamparter6b0655a2014-06-04 06:53:35 +0200871
paul718e3742002-12-13 20:15:29 +0000872/* BGP timers. */
873
874DEFUN (bgp_timers,
875 bgp_timers_cmd,
876 "timers bgp <0-65535> <0-65535>",
877 "Adjust routing timers\n"
878 "BGP timers\n"
879 "Keepalive interval\n"
880 "Holdtime\n")
881{
882 struct bgp *bgp;
883 unsigned long keepalive = 0;
884 unsigned long holdtime = 0;
885
886 bgp = vty->index;
887
888 VTY_GET_INTEGER ("keepalive", keepalive, argv[0]);
889 VTY_GET_INTEGER ("holdtime", holdtime, argv[1]);
890
891 /* Holdtime value check. */
892 if (holdtime < 3 && holdtime != 0)
893 {
894 vty_out (vty, "%% hold time value must be either 0 or greater than 3%s",
895 VTY_NEWLINE);
896 return CMD_WARNING;
897 }
898
899 bgp_timers_set (bgp, keepalive, holdtime);
900
901 return CMD_SUCCESS;
902}
903
904DEFUN (no_bgp_timers,
905 no_bgp_timers_cmd,
906 "no timers bgp",
907 NO_STR
908 "Adjust routing timers\n"
909 "BGP timers\n")
910{
911 struct bgp *bgp;
912
913 bgp = vty->index;
914 bgp_timers_unset (bgp);
915
916 return CMD_SUCCESS;
917}
918
919ALIAS (no_bgp_timers,
920 no_bgp_timers_arg_cmd,
921 "no timers bgp <0-65535> <0-65535>",
922 NO_STR
923 "Adjust routing timers\n"
924 "BGP timers\n"
925 "Keepalive interval\n"
926 "Holdtime\n")
David Lamparter6b0655a2014-06-04 06:53:35 +0200927
paul718e3742002-12-13 20:15:29 +0000928DEFUN (bgp_client_to_client_reflection,
929 bgp_client_to_client_reflection_cmd,
930 "bgp client-to-client reflection",
931 "BGP specific commands\n"
932 "Configure client to client route reflection\n"
933 "reflection of routes allowed\n")
934{
935 struct bgp *bgp;
936
937 bgp = vty->index;
938 bgp_flag_unset (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT);
939 return CMD_SUCCESS;
940}
941
942DEFUN (no_bgp_client_to_client_reflection,
943 no_bgp_client_to_client_reflection_cmd,
944 "no bgp client-to-client reflection",
945 NO_STR
946 "BGP specific commands\n"
947 "Configure client to client route reflection\n"
948 "reflection of routes allowed\n")
949{
950 struct bgp *bgp;
951
952 bgp = vty->index;
953 bgp_flag_set (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT);
954 return CMD_SUCCESS;
955}
956
957/* "bgp always-compare-med" configuration. */
958DEFUN (bgp_always_compare_med,
959 bgp_always_compare_med_cmd,
960 "bgp always-compare-med",
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_set (bgp, BGP_FLAG_ALWAYS_COMPARE_MED);
968 return CMD_SUCCESS;
969}
970
971DEFUN (no_bgp_always_compare_med,
972 no_bgp_always_compare_med_cmd,
973 "no bgp always-compare-med",
974 NO_STR
975 "BGP specific commands\n"
976 "Allow comparing MED from different neighbors\n")
977{
978 struct bgp *bgp;
979
980 bgp = vty->index;
981 bgp_flag_unset (bgp, BGP_FLAG_ALWAYS_COMPARE_MED);
982 return CMD_SUCCESS;
983}
David Lamparter6b0655a2014-06-04 06:53:35 +0200984
paul718e3742002-12-13 20:15:29 +0000985/* "bgp deterministic-med" configuration. */
986DEFUN (bgp_deterministic_med,
987 bgp_deterministic_med_cmd,
988 "bgp deterministic-med",
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_set (bgp, BGP_FLAG_DETERMINISTIC_MED);
996 return CMD_SUCCESS;
997}
998
999DEFUN (no_bgp_deterministic_med,
1000 no_bgp_deterministic_med_cmd,
1001 "no bgp deterministic-med",
1002 NO_STR
1003 "BGP specific commands\n"
1004 "Pick the best-MED path among paths advertised from the neighboring AS\n")
1005{
1006 struct bgp *bgp;
1007
1008 bgp = vty->index;
1009 bgp_flag_unset (bgp, BGP_FLAG_DETERMINISTIC_MED);
1010 return CMD_SUCCESS;
1011}
hasso538621f2004-05-21 09:31:30 +00001012
1013/* "bgp graceful-restart" configuration. */
1014DEFUN (bgp_graceful_restart,
1015 bgp_graceful_restart_cmd,
1016 "bgp graceful-restart",
1017 "BGP specific commands\n"
1018 "Graceful restart capability parameters\n")
1019{
1020 struct bgp *bgp;
1021
1022 bgp = vty->index;
1023 bgp_flag_set (bgp, BGP_FLAG_GRACEFUL_RESTART);
1024 return CMD_SUCCESS;
1025}
1026
1027DEFUN (no_bgp_graceful_restart,
1028 no_bgp_graceful_restart_cmd,
1029 "no bgp graceful-restart",
1030 NO_STR
1031 "BGP specific commands\n"
1032 "Graceful restart capability parameters\n")
1033{
1034 struct bgp *bgp;
1035
1036 bgp = vty->index;
1037 bgp_flag_unset (bgp, BGP_FLAG_GRACEFUL_RESTART);
1038 return CMD_SUCCESS;
1039}
1040
hasso93406d82005-02-02 14:40:33 +00001041DEFUN (bgp_graceful_restart_stalepath_time,
1042 bgp_graceful_restart_stalepath_time_cmd,
1043 "bgp graceful-restart stalepath-time <1-3600>",
1044 "BGP specific commands\n"
1045 "Graceful restart capability parameters\n"
1046 "Set the max time to hold onto restarting peer's stale paths\n"
1047 "Delay value (seconds)\n")
1048{
1049 struct bgp *bgp;
1050 u_int32_t stalepath;
1051
1052 bgp = vty->index;
1053 if (! bgp)
1054 return CMD_WARNING;
1055
1056 VTY_GET_INTEGER_RANGE ("stalepath-time", stalepath, argv[0], 1, 3600);
1057 bgp->stalepath_time = stalepath;
1058 return CMD_SUCCESS;
1059}
1060
1061DEFUN (no_bgp_graceful_restart_stalepath_time,
1062 no_bgp_graceful_restart_stalepath_time_cmd,
1063 "no bgp graceful-restart stalepath-time",
1064 NO_STR
1065 "BGP specific commands\n"
1066 "Graceful restart capability parameters\n"
1067 "Set the max time to hold onto restarting peer's stale paths\n")
1068{
1069 struct bgp *bgp;
1070
1071 bgp = vty->index;
1072 if (! bgp)
1073 return CMD_WARNING;
1074
1075 bgp->stalepath_time = BGP_DEFAULT_STALEPATH_TIME;
1076 return CMD_SUCCESS;
1077}
1078
1079ALIAS (no_bgp_graceful_restart_stalepath_time,
1080 no_bgp_graceful_restart_stalepath_time_val_cmd,
1081 "no bgp graceful-restart stalepath-time <1-3600>",
1082 NO_STR
1083 "BGP specific commands\n"
1084 "Graceful restart capability parameters\n"
1085 "Set the max time to hold onto restarting peer's stale paths\n"
1086 "Delay value (seconds)\n")
1087
paul718e3742002-12-13 20:15:29 +00001088/* "bgp fast-external-failover" configuration. */
1089DEFUN (bgp_fast_external_failover,
1090 bgp_fast_external_failover_cmd,
1091 "bgp fast-external-failover",
1092 BGP_STR
1093 "Immediately reset session if a link to a directly connected external peer goes down\n")
1094{
1095 struct bgp *bgp;
1096
1097 bgp = vty->index;
1098 bgp_flag_unset (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER);
1099 return CMD_SUCCESS;
1100}
1101
1102DEFUN (no_bgp_fast_external_failover,
1103 no_bgp_fast_external_failover_cmd,
1104 "no bgp fast-external-failover",
1105 NO_STR
1106 BGP_STR
1107 "Immediately reset session if a link to a directly connected external peer goes down\n")
1108{
1109 struct bgp *bgp;
1110
1111 bgp = vty->index;
1112 bgp_flag_set (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER);
1113 return CMD_SUCCESS;
1114}
David Lamparter6b0655a2014-06-04 06:53:35 +02001115
paul718e3742002-12-13 20:15:29 +00001116/* "bgp enforce-first-as" configuration. */
1117DEFUN (bgp_enforce_first_as,
1118 bgp_enforce_first_as_cmd,
1119 "bgp enforce-first-as",
1120 BGP_STR
1121 "Enforce the first AS for EBGP routes\n")
1122{
1123 struct bgp *bgp;
1124
1125 bgp = vty->index;
1126 bgp_flag_set (bgp, BGP_FLAG_ENFORCE_FIRST_AS);
1127 return CMD_SUCCESS;
1128}
1129
1130DEFUN (no_bgp_enforce_first_as,
1131 no_bgp_enforce_first_as_cmd,
1132 "no bgp enforce-first-as",
1133 NO_STR
1134 BGP_STR
1135 "Enforce the first AS for EBGP routes\n")
1136{
1137 struct bgp *bgp;
1138
1139 bgp = vty->index;
1140 bgp_flag_unset (bgp, BGP_FLAG_ENFORCE_FIRST_AS);
1141 return CMD_SUCCESS;
1142}
David Lamparter6b0655a2014-06-04 06:53:35 +02001143
paul718e3742002-12-13 20:15:29 +00001144/* "bgp bestpath compare-routerid" configuration. */
1145DEFUN (bgp_bestpath_compare_router_id,
1146 bgp_bestpath_compare_router_id_cmd,
1147 "bgp bestpath compare-routerid",
1148 "BGP specific commands\n"
1149 "Change the default bestpath selection\n"
1150 "Compare router-id for identical EBGP paths\n")
1151{
1152 struct bgp *bgp;
1153
1154 bgp = vty->index;
1155 bgp_flag_set (bgp, BGP_FLAG_COMPARE_ROUTER_ID);
1156 return CMD_SUCCESS;
1157}
1158
1159DEFUN (no_bgp_bestpath_compare_router_id,
1160 no_bgp_bestpath_compare_router_id_cmd,
1161 "no bgp bestpath compare-routerid",
1162 NO_STR
1163 "BGP specific commands\n"
1164 "Change the default bestpath selection\n"
1165 "Compare router-id for identical EBGP paths\n")
1166{
1167 struct bgp *bgp;
1168
1169 bgp = vty->index;
1170 bgp_flag_unset (bgp, BGP_FLAG_COMPARE_ROUTER_ID);
1171 return CMD_SUCCESS;
1172}
David Lamparter6b0655a2014-06-04 06:53:35 +02001173
paul718e3742002-12-13 20:15:29 +00001174/* "bgp bestpath as-path ignore" configuration. */
1175DEFUN (bgp_bestpath_aspath_ignore,
1176 bgp_bestpath_aspath_ignore_cmd,
1177 "bgp bestpath as-path ignore",
1178 "BGP specific commands\n"
1179 "Change the default bestpath selection\n"
1180 "AS-path attribute\n"
1181 "Ignore as-path length in selecting a route\n")
1182{
1183 struct bgp *bgp;
1184
1185 bgp = vty->index;
1186 bgp_flag_set (bgp, BGP_FLAG_ASPATH_IGNORE);
1187 return CMD_SUCCESS;
1188}
1189
1190DEFUN (no_bgp_bestpath_aspath_ignore,
1191 no_bgp_bestpath_aspath_ignore_cmd,
1192 "no bgp bestpath as-path ignore",
1193 NO_STR
1194 "BGP specific commands\n"
1195 "Change the default bestpath selection\n"
1196 "AS-path attribute\n"
1197 "Ignore as-path length in selecting a route\n")
1198{
1199 struct bgp *bgp;
1200
1201 bgp = vty->index;
1202 bgp_flag_unset (bgp, BGP_FLAG_ASPATH_IGNORE);
1203 return CMD_SUCCESS;
1204}
David Lamparter6b0655a2014-06-04 06:53:35 +02001205
hasso68118452005-04-08 15:40:36 +00001206/* "bgp bestpath as-path confed" configuration. */
1207DEFUN (bgp_bestpath_aspath_confed,
1208 bgp_bestpath_aspath_confed_cmd,
1209 "bgp bestpath as-path confed",
1210 "BGP specific commands\n"
1211 "Change the default bestpath selection\n"
1212 "AS-path attribute\n"
1213 "Compare path lengths including confederation sets & sequences in selecting a route\n")
1214{
1215 struct bgp *bgp;
1216
1217 bgp = vty->index;
1218 bgp_flag_set (bgp, BGP_FLAG_ASPATH_CONFED);
1219 return CMD_SUCCESS;
1220}
1221
1222DEFUN (no_bgp_bestpath_aspath_confed,
1223 no_bgp_bestpath_aspath_confed_cmd,
1224 "no bgp bestpath as-path confed",
1225 NO_STR
1226 "BGP specific commands\n"
1227 "Change the default bestpath selection\n"
1228 "AS-path attribute\n"
1229 "Compare path lengths including confederation sets & sequences in selecting a route\n")
1230{
1231 struct bgp *bgp;
1232
1233 bgp = vty->index;
1234 bgp_flag_unset (bgp, BGP_FLAG_ASPATH_CONFED);
1235 return CMD_SUCCESS;
1236}
David Lamparter6b0655a2014-06-04 06:53:35 +02001237
Pradosh Mohapatra2fdd4552013-09-07 07:02:36 +00001238/* "bgp bestpath as-path multipath-relax" configuration. */
1239DEFUN (bgp_bestpath_aspath_multipath_relax,
1240 bgp_bestpath_aspath_multipath_relax_cmd,
1241 "bgp bestpath as-path multipath-relax",
1242 "BGP specific commands\n"
1243 "Change the default bestpath selection\n"
1244 "AS-path attribute\n"
1245 "Allow load sharing across routes that have different AS paths (but same length)\n")
1246{
1247 struct bgp *bgp;
1248
1249 bgp = vty->index;
1250 bgp_flag_set (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX);
1251 return CMD_SUCCESS;
1252}
1253
1254DEFUN (no_bgp_bestpath_aspath_multipath_relax,
1255 no_bgp_bestpath_aspath_multipath_relax_cmd,
1256 "no bgp bestpath as-path multipath-relax",
1257 NO_STR
1258 "BGP specific commands\n"
1259 "Change the default bestpath selection\n"
1260 "AS-path attribute\n"
1261 "Allow load sharing across routes that have different AS paths (but same length)\n")
1262{
1263 struct bgp *bgp;
1264
1265 bgp = vty->index;
1266 bgp_flag_unset (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX);
1267 return CMD_SUCCESS;
1268}
David Lamparter6b0655a2014-06-04 06:53:35 +02001269
paul848973c2003-08-13 00:32:49 +00001270/* "bgp log-neighbor-changes" configuration. */
1271DEFUN (bgp_log_neighbor_changes,
1272 bgp_log_neighbor_changes_cmd,
1273 "bgp log-neighbor-changes",
1274 "BGP specific commands\n"
1275 "Log neighbor up/down and reset reason\n")
1276{
1277 struct bgp *bgp;
1278
1279 bgp = vty->index;
1280 bgp_flag_set (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES);
1281 return CMD_SUCCESS;
1282}
1283
1284DEFUN (no_bgp_log_neighbor_changes,
1285 no_bgp_log_neighbor_changes_cmd,
1286 "no bgp log-neighbor-changes",
1287 NO_STR
1288 "BGP specific commands\n"
1289 "Log neighbor up/down and reset reason\n")
1290{
1291 struct bgp *bgp;
1292
1293 bgp = vty->index;
1294 bgp_flag_unset (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES);
1295 return CMD_SUCCESS;
1296}
David Lamparter6b0655a2014-06-04 06:53:35 +02001297
paul718e3742002-12-13 20:15:29 +00001298/* "bgp bestpath med" configuration. */
1299DEFUN (bgp_bestpath_med,
1300 bgp_bestpath_med_cmd,
1301 "bgp bestpath med (confed|missing-as-worst)",
1302 "BGP specific commands\n"
1303 "Change the default bestpath selection\n"
1304 "MED attribute\n"
1305 "Compare MED among confederation paths\n"
1306 "Treat missing MED as the least preferred one\n")
1307{
1308 struct bgp *bgp;
1309
1310 bgp = vty->index;
1311
1312 if (strncmp (argv[0], "confed", 1) == 0)
1313 bgp_flag_set (bgp, BGP_FLAG_MED_CONFED);
1314 else
1315 bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1316
1317 return CMD_SUCCESS;
1318}
1319
1320DEFUN (bgp_bestpath_med2,
1321 bgp_bestpath_med2_cmd,
1322 "bgp bestpath med confed missing-as-worst",
1323 "BGP specific commands\n"
1324 "Change the default bestpath selection\n"
1325 "MED attribute\n"
1326 "Compare MED among confederation paths\n"
1327 "Treat missing MED as the least preferred one\n")
1328{
1329 struct bgp *bgp;
1330
1331 bgp = vty->index;
1332 bgp_flag_set (bgp, BGP_FLAG_MED_CONFED);
1333 bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1334 return CMD_SUCCESS;
1335}
1336
1337ALIAS (bgp_bestpath_med2,
1338 bgp_bestpath_med3_cmd,
1339 "bgp bestpath med missing-as-worst confed",
1340 "BGP specific commands\n"
1341 "Change the default bestpath selection\n"
1342 "MED attribute\n"
1343 "Treat missing MED as the least preferred one\n"
1344 "Compare MED among confederation paths\n")
1345
1346DEFUN (no_bgp_bestpath_med,
1347 no_bgp_bestpath_med_cmd,
1348 "no bgp bestpath med (confed|missing-as-worst)",
1349 NO_STR
1350 "BGP specific commands\n"
1351 "Change the default bestpath selection\n"
1352 "MED attribute\n"
1353 "Compare MED among confederation paths\n"
1354 "Treat missing MED as the least preferred one\n")
1355{
1356 struct bgp *bgp;
1357
1358 bgp = vty->index;
1359
1360 if (strncmp (argv[0], "confed", 1) == 0)
1361 bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED);
1362 else
1363 bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1364
1365 return CMD_SUCCESS;
1366}
1367
1368DEFUN (no_bgp_bestpath_med2,
1369 no_bgp_bestpath_med2_cmd,
1370 "no bgp bestpath med confed missing-as-worst",
1371 NO_STR
1372 "BGP specific commands\n"
1373 "Change the default bestpath selection\n"
1374 "MED attribute\n"
1375 "Compare MED among confederation paths\n"
1376 "Treat missing MED as the least preferred one\n")
1377{
1378 struct bgp *bgp;
1379
1380 bgp = vty->index;
1381 bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED);
1382 bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1383 return CMD_SUCCESS;
1384}
1385
1386ALIAS (no_bgp_bestpath_med2,
1387 no_bgp_bestpath_med3_cmd,
1388 "no bgp bestpath med missing-as-worst confed",
1389 NO_STR
1390 "BGP specific commands\n"
1391 "Change the default bestpath selection\n"
1392 "MED attribute\n"
1393 "Treat missing MED as the least preferred one\n"
1394 "Compare MED among confederation paths\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02001395
paul718e3742002-12-13 20:15:29 +00001396/* "no bgp default ipv4-unicast". */
1397DEFUN (no_bgp_default_ipv4_unicast,
1398 no_bgp_default_ipv4_unicast_cmd,
1399 "no bgp default ipv4-unicast",
1400 NO_STR
1401 "BGP specific commands\n"
1402 "Configure BGP defaults\n"
1403 "Activate ipv4-unicast for a peer by default\n")
1404{
1405 struct bgp *bgp;
1406
1407 bgp = vty->index;
1408 bgp_flag_set (bgp, BGP_FLAG_NO_DEFAULT_IPV4);
1409 return CMD_SUCCESS;
1410}
1411
1412DEFUN (bgp_default_ipv4_unicast,
1413 bgp_default_ipv4_unicast_cmd,
1414 "bgp default ipv4-unicast",
1415 "BGP specific commands\n"
1416 "Configure BGP defaults\n"
1417 "Activate ipv4-unicast for a peer by default\n")
1418{
1419 struct bgp *bgp;
1420
1421 bgp = vty->index;
1422 bgp_flag_unset (bgp, BGP_FLAG_NO_DEFAULT_IPV4);
1423 return CMD_SUCCESS;
1424}
David Lamparter6b0655a2014-06-04 06:53:35 +02001425
paul718e3742002-12-13 20:15:29 +00001426/* "bgp import-check" configuration. */
1427DEFUN (bgp_network_import_check,
1428 bgp_network_import_check_cmd,
1429 "bgp network import-check",
1430 "BGP specific commands\n"
1431 "BGP network command\n"
1432 "Check BGP network route exists in IGP\n")
1433{
1434 struct bgp *bgp;
1435
1436 bgp = vty->index;
1437 bgp_flag_set (bgp, BGP_FLAG_IMPORT_CHECK);
1438 return CMD_SUCCESS;
1439}
1440
1441DEFUN (no_bgp_network_import_check,
1442 no_bgp_network_import_check_cmd,
1443 "no bgp network import-check",
1444 NO_STR
1445 "BGP specific commands\n"
1446 "BGP network command\n"
1447 "Check BGP network route exists in IGP\n")
1448{
1449 struct bgp *bgp;
1450
1451 bgp = vty->index;
1452 bgp_flag_unset (bgp, BGP_FLAG_IMPORT_CHECK);
1453 return CMD_SUCCESS;
1454}
David Lamparter6b0655a2014-06-04 06:53:35 +02001455
paul718e3742002-12-13 20:15:29 +00001456DEFUN (bgp_default_local_preference,
1457 bgp_default_local_preference_cmd,
1458 "bgp default local-preference <0-4294967295>",
1459 "BGP specific commands\n"
1460 "Configure BGP defaults\n"
1461 "local preference (higher=more preferred)\n"
1462 "Configure default local preference value\n")
1463{
1464 struct bgp *bgp;
1465 u_int32_t local_pref;
1466
1467 bgp = vty->index;
1468
1469 VTY_GET_INTEGER ("local preference", local_pref, argv[0]);
1470
1471 bgp_default_local_preference_set (bgp, local_pref);
1472
1473 return CMD_SUCCESS;
1474}
1475
1476DEFUN (no_bgp_default_local_preference,
1477 no_bgp_default_local_preference_cmd,
1478 "no bgp default local-preference",
1479 NO_STR
1480 "BGP specific commands\n"
1481 "Configure BGP defaults\n"
1482 "local preference (higher=more preferred)\n")
1483{
1484 struct bgp *bgp;
1485
1486 bgp = vty->index;
1487 bgp_default_local_preference_unset (bgp);
1488 return CMD_SUCCESS;
1489}
1490
1491ALIAS (no_bgp_default_local_preference,
1492 no_bgp_default_local_preference_val_cmd,
1493 "no bgp default local-preference <0-4294967295>",
1494 NO_STR
1495 "BGP specific commands\n"
1496 "Configure BGP defaults\n"
1497 "local preference (higher=more preferred)\n"
1498 "Configure default local preference value\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02001499
paul718e3742002-12-13 20:15:29 +00001500static int
paulfd79ac92004-10-13 05:06:08 +00001501peer_remote_as_vty (struct vty *vty, const char *peer_str,
1502 const char *as_str, afi_t afi, safi_t safi)
paul718e3742002-12-13 20:15:29 +00001503{
1504 int ret;
1505 struct bgp *bgp;
1506 as_t as;
1507 union sockunion su;
1508
1509 bgp = vty->index;
1510
1511 /* Get AS number. */
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00001512 VTY_GET_INTEGER_RANGE ("AS", as, as_str, 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +00001513
1514 /* If peer is peer group, call proper function. */
1515 ret = str2sockunion (peer_str, &su);
1516 if (ret < 0)
1517 {
1518 ret = peer_group_remote_as (bgp, peer_str, &as);
1519 if (ret < 0)
1520 {
1521 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1522 return CMD_WARNING;
1523 }
1524 return CMD_SUCCESS;
1525 }
1526
1527 if (peer_address_self_check (&su))
1528 {
1529 vty_out (vty, "%% Can not configure the local system as neighbor%s",
1530 VTY_NEWLINE);
1531 return CMD_WARNING;
1532 }
1533
1534 ret = peer_remote_as (bgp, &su, &as, afi, safi);
1535
1536 /* This peer belongs to peer group. */
1537 switch (ret)
1538 {
1539 case BGP_ERR_PEER_GROUP_MEMBER:
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04001540 vty_out (vty, "%% Peer-group AS %u. Cannot configure remote-as for member%s", as, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00001541 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00001542 case BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT:
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04001543 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 +00001544 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00001545 }
1546 return bgp_vty_return (vty, ret);
1547}
1548
1549DEFUN (neighbor_remote_as,
1550 neighbor_remote_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001551 NEIGHBOR_CMD2 "remote-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001552 NEIGHBOR_STR
1553 NEIGHBOR_ADDR_STR2
1554 "Specify a BGP neighbor\n"
1555 AS_STR)
1556{
1557 return peer_remote_as_vty (vty, argv[0], argv[1], AFI_IP, SAFI_UNICAST);
1558}
David Lamparter6b0655a2014-06-04 06:53:35 +02001559
paul718e3742002-12-13 20:15:29 +00001560DEFUN (neighbor_peer_group,
1561 neighbor_peer_group_cmd,
1562 "neighbor WORD peer-group",
1563 NEIGHBOR_STR
1564 "Neighbor tag\n"
1565 "Configure peer-group\n")
1566{
1567 struct bgp *bgp;
1568 struct peer_group *group;
1569
1570 bgp = vty->index;
1571
1572 group = peer_group_get (bgp, argv[0]);
1573 if (! group)
1574 return CMD_WARNING;
1575
1576 return CMD_SUCCESS;
1577}
1578
1579DEFUN (no_neighbor,
1580 no_neighbor_cmd,
1581 NO_NEIGHBOR_CMD2,
1582 NO_STR
1583 NEIGHBOR_STR
1584 NEIGHBOR_ADDR_STR2)
1585{
1586 int ret;
1587 union sockunion su;
1588 struct peer_group *group;
1589 struct peer *peer;
1590
1591 ret = str2sockunion (argv[0], &su);
1592 if (ret < 0)
1593 {
1594 group = peer_group_lookup (vty->index, argv[0]);
1595 if (group)
1596 peer_group_delete (group);
1597 else
1598 {
1599 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1600 return CMD_WARNING;
1601 }
1602 }
1603 else
1604 {
1605 peer = peer_lookup (vty->index, &su);
1606 if (peer)
paul200df112005-06-01 11:17:05 +00001607 peer_delete (peer);
paul718e3742002-12-13 20:15:29 +00001608 }
1609
1610 return CMD_SUCCESS;
1611}
1612
1613ALIAS (no_neighbor,
1614 no_neighbor_remote_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001615 NO_NEIGHBOR_CMD "remote-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001616 NO_STR
1617 NEIGHBOR_STR
1618 NEIGHBOR_ADDR_STR
1619 "Specify a BGP neighbor\n"
1620 AS_STR)
1621
1622DEFUN (no_neighbor_peer_group,
1623 no_neighbor_peer_group_cmd,
1624 "no neighbor WORD peer-group",
1625 NO_STR
1626 NEIGHBOR_STR
1627 "Neighbor tag\n"
1628 "Configure peer-group\n")
1629{
1630 struct peer_group *group;
1631
1632 group = peer_group_lookup (vty->index, argv[0]);
1633 if (group)
1634 peer_group_delete (group);
1635 else
1636 {
1637 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1638 return CMD_WARNING;
1639 }
1640 return CMD_SUCCESS;
1641}
1642
1643DEFUN (no_neighbor_peer_group_remote_as,
1644 no_neighbor_peer_group_remote_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001645 "no neighbor WORD remote-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001646 NO_STR
1647 NEIGHBOR_STR
1648 "Neighbor tag\n"
1649 "Specify a BGP neighbor\n"
1650 AS_STR)
1651{
1652 struct peer_group *group;
1653
1654 group = peer_group_lookup (vty->index, argv[0]);
1655 if (group)
1656 peer_group_remote_as_delete (group);
1657 else
1658 {
1659 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1660 return CMD_WARNING;
1661 }
1662 return CMD_SUCCESS;
1663}
David Lamparter6b0655a2014-06-04 06:53:35 +02001664
paul718e3742002-12-13 20:15:29 +00001665DEFUN (neighbor_local_as,
1666 neighbor_local_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001667 NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001668 NEIGHBOR_STR
1669 NEIGHBOR_ADDR_STR2
1670 "Specify a local-as number\n"
1671 "AS number used as local AS\n")
1672{
1673 struct peer *peer;
1674 int ret;
1675
1676 peer = peer_and_group_lookup_vty (vty, argv[0]);
1677 if (! peer)
1678 return CMD_WARNING;
1679
Andrew Certain9d3f9702012-11-07 23:50:07 +00001680 ret = peer_local_as_set (peer, atoi (argv[1]), 0, 0);
paul718e3742002-12-13 20:15:29 +00001681 return bgp_vty_return (vty, ret);
1682}
1683
1684DEFUN (neighbor_local_as_no_prepend,
1685 neighbor_local_as_no_prepend_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001686 NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend",
paul718e3742002-12-13 20:15:29 +00001687 NEIGHBOR_STR
1688 NEIGHBOR_ADDR_STR2
1689 "Specify a local-as number\n"
1690 "AS number used as local AS\n"
1691 "Do not prepend local-as to updates from ebgp peers\n")
1692{
1693 struct peer *peer;
1694 int ret;
1695
1696 peer = peer_and_group_lookup_vty (vty, argv[0]);
1697 if (! peer)
1698 return CMD_WARNING;
1699
Andrew Certain9d3f9702012-11-07 23:50:07 +00001700 ret = peer_local_as_set (peer, atoi (argv[1]), 1, 0);
paul718e3742002-12-13 20:15:29 +00001701 return bgp_vty_return (vty, ret);
1702}
1703
Andrew Certain9d3f9702012-11-07 23:50:07 +00001704DEFUN (neighbor_local_as_no_prepend_replace_as,
1705 neighbor_local_as_no_prepend_replace_as_cmd,
1706 NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as",
1707 NEIGHBOR_STR
1708 NEIGHBOR_ADDR_STR2
1709 "Specify a local-as number\n"
1710 "AS number used as local AS\n"
1711 "Do not prepend local-as to updates from ebgp peers\n"
1712 "Do not prepend local-as to updates from ibgp peers\n")
1713{
1714 struct peer *peer;
1715 int ret;
1716
1717 peer = peer_and_group_lookup_vty (vty, argv[0]);
1718 if (! peer)
1719 return CMD_WARNING;
1720
1721 ret = peer_local_as_set (peer, atoi (argv[1]), 1, 1);
1722 return bgp_vty_return (vty, ret);
1723}
1724
1725
paul718e3742002-12-13 20:15:29 +00001726DEFUN (no_neighbor_local_as,
1727 no_neighbor_local_as_cmd,
1728 NO_NEIGHBOR_CMD2 "local-as",
1729 NO_STR
1730 NEIGHBOR_STR
1731 NEIGHBOR_ADDR_STR2
1732 "Specify a local-as number\n")
1733{
1734 struct peer *peer;
1735 int ret;
1736
1737 peer = peer_and_group_lookup_vty (vty, argv[0]);
1738 if (! peer)
1739 return CMD_WARNING;
1740
1741 ret = peer_local_as_unset (peer);
1742 return bgp_vty_return (vty, ret);
1743}
1744
1745ALIAS (no_neighbor_local_as,
1746 no_neighbor_local_as_val_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001747 NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001748 NO_STR
1749 NEIGHBOR_STR
1750 NEIGHBOR_ADDR_STR2
1751 "Specify a local-as number\n"
1752 "AS number used as local AS\n")
1753
1754ALIAS (no_neighbor_local_as,
1755 no_neighbor_local_as_val2_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001756 NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend",
paul718e3742002-12-13 20:15:29 +00001757 NO_STR
1758 NEIGHBOR_STR
1759 NEIGHBOR_ADDR_STR2
1760 "Specify a local-as number\n"
1761 "AS number used as local AS\n"
1762 "Do not prepend local-as to updates from ebgp peers\n")
Andrew Certain9d3f9702012-11-07 23:50:07 +00001763
1764ALIAS (no_neighbor_local_as,
1765 no_neighbor_local_as_val3_cmd,
1766 NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as",
1767 NO_STR
1768 NEIGHBOR_STR
1769 NEIGHBOR_ADDR_STR2
1770 "Specify a local-as number\n"
1771 "AS number used as local AS\n"
1772 "Do not prepend local-as to updates from ebgp peers\n"
1773 "Do not prepend local-as to updates from ibgp peers\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02001774
Paul Jakma0df7c912008-07-21 21:02:49 +00001775DEFUN (neighbor_password,
1776 neighbor_password_cmd,
1777 NEIGHBOR_CMD2 "password LINE",
1778 NEIGHBOR_STR
1779 NEIGHBOR_ADDR_STR2
1780 "Set a password\n"
1781 "The password\n")
1782{
1783 struct peer *peer;
1784 int ret;
1785
1786 peer = peer_and_group_lookup_vty (vty, argv[0]);
1787 if (! peer)
1788 return CMD_WARNING;
1789
1790 ret = peer_password_set (peer, argv[1]);
1791 return bgp_vty_return (vty, ret);
1792}
1793
1794DEFUN (no_neighbor_password,
1795 no_neighbor_password_cmd,
1796 NO_NEIGHBOR_CMD2 "password",
1797 NO_STR
1798 NEIGHBOR_STR
1799 NEIGHBOR_ADDR_STR2
1800 "Set a password\n")
1801{
1802 struct peer *peer;
1803 int ret;
1804
1805 peer = peer_and_group_lookup_vty (vty, argv[0]);
1806 if (! peer)
1807 return CMD_WARNING;
1808
1809 ret = peer_password_unset (peer);
1810 return bgp_vty_return (vty, ret);
1811}
David Lamparter6b0655a2014-06-04 06:53:35 +02001812
paul718e3742002-12-13 20:15:29 +00001813DEFUN (neighbor_activate,
1814 neighbor_activate_cmd,
1815 NEIGHBOR_CMD2 "activate",
1816 NEIGHBOR_STR
1817 NEIGHBOR_ADDR_STR2
1818 "Enable the Address Family for this Neighbor\n")
1819{
1820 struct peer *peer;
1821
1822 peer = peer_and_group_lookup_vty (vty, argv[0]);
1823 if (! peer)
1824 return CMD_WARNING;
1825
1826 peer_activate (peer, bgp_node_afi (vty), bgp_node_safi (vty));
1827
1828 return CMD_SUCCESS;
1829}
1830
1831DEFUN (no_neighbor_activate,
1832 no_neighbor_activate_cmd,
1833 NO_NEIGHBOR_CMD2 "activate",
1834 NO_STR
1835 NEIGHBOR_STR
1836 NEIGHBOR_ADDR_STR2
1837 "Enable the Address Family for this Neighbor\n")
1838{
1839 int ret;
1840 struct peer *peer;
1841
1842 /* Lookup peer. */
1843 peer = peer_and_group_lookup_vty (vty, argv[0]);
1844 if (! peer)
1845 return CMD_WARNING;
1846
1847 ret = peer_deactivate (peer, bgp_node_afi (vty), bgp_node_safi (vty));
1848
1849 return bgp_vty_return (vty, ret);
1850}
David Lamparter6b0655a2014-06-04 06:53:35 +02001851
paul718e3742002-12-13 20:15:29 +00001852DEFUN (neighbor_set_peer_group,
1853 neighbor_set_peer_group_cmd,
1854 NEIGHBOR_CMD "peer-group WORD",
1855 NEIGHBOR_STR
1856 NEIGHBOR_ADDR_STR
1857 "Member of the peer-group\n"
1858 "peer-group name\n")
1859{
1860 int ret;
1861 as_t as;
1862 union sockunion su;
1863 struct bgp *bgp;
1864 struct peer_group *group;
1865
1866 bgp = vty->index;
1867
1868 ret = str2sockunion (argv[0], &su);
1869 if (ret < 0)
1870 {
1871 vty_out (vty, "%% Malformed address: %s%s", argv[0], VTY_NEWLINE);
1872 return CMD_WARNING;
1873 }
1874
1875 group = peer_group_lookup (bgp, argv[1]);
1876 if (! group)
1877 {
1878 vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE);
1879 return CMD_WARNING;
1880 }
1881
1882 if (peer_address_self_check (&su))
1883 {
1884 vty_out (vty, "%% Can not configure the local system as neighbor%s",
1885 VTY_NEWLINE);
1886 return CMD_WARNING;
1887 }
1888
1889 ret = peer_group_bind (bgp, &su, group, bgp_node_afi (vty),
1890 bgp_node_safi (vty), &as);
1891
1892 if (ret == BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT)
1893 {
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04001894 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 +00001895 return CMD_WARNING;
1896 }
1897
1898 return bgp_vty_return (vty, ret);
1899}
1900
1901DEFUN (no_neighbor_set_peer_group,
1902 no_neighbor_set_peer_group_cmd,
1903 NO_NEIGHBOR_CMD "peer-group WORD",
1904 NO_STR
1905 NEIGHBOR_STR
1906 NEIGHBOR_ADDR_STR
1907 "Member of the peer-group\n"
1908 "peer-group name\n")
1909{
1910 int ret;
1911 struct bgp *bgp;
1912 struct peer *peer;
1913 struct peer_group *group;
1914
1915 bgp = vty->index;
1916
1917 peer = peer_lookup_vty (vty, argv[0]);
1918 if (! peer)
1919 return CMD_WARNING;
1920
1921 group = peer_group_lookup (bgp, argv[1]);
1922 if (! group)
1923 {
1924 vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE);
1925 return CMD_WARNING;
1926 }
1927
1928 ret = peer_group_unbind (bgp, peer, group, bgp_node_afi (vty),
1929 bgp_node_safi (vty));
1930
1931 return bgp_vty_return (vty, ret);
1932}
David Lamparter6b0655a2014-06-04 06:53:35 +02001933
paul94f2b392005-06-28 12:44:16 +00001934static int
paulfd79ac92004-10-13 05:06:08 +00001935peer_flag_modify_vty (struct vty *vty, const char *ip_str,
1936 u_int16_t flag, int set)
paul718e3742002-12-13 20:15:29 +00001937{
1938 int ret;
1939 struct peer *peer;
1940
1941 peer = peer_and_group_lookup_vty (vty, ip_str);
1942 if (! peer)
1943 return CMD_WARNING;
1944
1945 if (set)
1946 ret = peer_flag_set (peer, flag);
1947 else
1948 ret = peer_flag_unset (peer, flag);
1949
1950 return bgp_vty_return (vty, ret);
1951}
1952
paul94f2b392005-06-28 12:44:16 +00001953static int
paulfd79ac92004-10-13 05:06:08 +00001954peer_flag_set_vty (struct vty *vty, const char *ip_str, u_int16_t flag)
paul718e3742002-12-13 20:15:29 +00001955{
1956 return peer_flag_modify_vty (vty, ip_str, flag, 1);
1957}
1958
paul94f2b392005-06-28 12:44:16 +00001959static int
paulfd79ac92004-10-13 05:06:08 +00001960peer_flag_unset_vty (struct vty *vty, const char *ip_str, u_int16_t flag)
paul718e3742002-12-13 20:15:29 +00001961{
1962 return peer_flag_modify_vty (vty, ip_str, flag, 0);
1963}
1964
1965/* neighbor passive. */
1966DEFUN (neighbor_passive,
1967 neighbor_passive_cmd,
1968 NEIGHBOR_CMD2 "passive",
1969 NEIGHBOR_STR
1970 NEIGHBOR_ADDR_STR2
1971 "Don't send open messages to this neighbor\n")
1972{
1973 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_PASSIVE);
1974}
1975
1976DEFUN (no_neighbor_passive,
1977 no_neighbor_passive_cmd,
1978 NO_NEIGHBOR_CMD2 "passive",
1979 NO_STR
1980 NEIGHBOR_STR
1981 NEIGHBOR_ADDR_STR2
1982 "Don't send open messages to this neighbor\n")
1983{
1984 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_PASSIVE);
1985}
David Lamparter6b0655a2014-06-04 06:53:35 +02001986
paul718e3742002-12-13 20:15:29 +00001987/* neighbor shutdown. */
1988DEFUN (neighbor_shutdown,
1989 neighbor_shutdown_cmd,
1990 NEIGHBOR_CMD2 "shutdown",
1991 NEIGHBOR_STR
1992 NEIGHBOR_ADDR_STR2
1993 "Administratively shut down this neighbor\n")
1994{
1995 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_SHUTDOWN);
1996}
1997
1998DEFUN (no_neighbor_shutdown,
1999 no_neighbor_shutdown_cmd,
2000 NO_NEIGHBOR_CMD2 "shutdown",
2001 NO_STR
2002 NEIGHBOR_STR
2003 NEIGHBOR_ADDR_STR2
2004 "Administratively shut down this neighbor\n")
2005{
2006 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_SHUTDOWN);
2007}
David Lamparter6b0655a2014-06-04 06:53:35 +02002008
hassoc9502432005-02-01 22:01:48 +00002009/* Deprecated neighbor capability route-refresh. */
2010DEFUN_DEPRECATED (neighbor_capability_route_refresh,
2011 neighbor_capability_route_refresh_cmd,
2012 NEIGHBOR_CMD2 "capability route-refresh",
2013 NEIGHBOR_STR
2014 NEIGHBOR_ADDR_STR2
2015 "Advertise capability to the peer\n"
2016 "Advertise route-refresh capability to this neighbor\n")
paul718e3742002-12-13 20:15:29 +00002017{
hassoc9502432005-02-01 22:01:48 +00002018 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00002019}
2020
hassoc9502432005-02-01 22:01:48 +00002021DEFUN_DEPRECATED (no_neighbor_capability_route_refresh,
2022 no_neighbor_capability_route_refresh_cmd,
2023 NO_NEIGHBOR_CMD2 "capability route-refresh",
2024 NO_STR
2025 NEIGHBOR_STR
2026 NEIGHBOR_ADDR_STR2
2027 "Advertise capability to the peer\n"
2028 "Advertise route-refresh capability to this neighbor\n")
paul718e3742002-12-13 20:15:29 +00002029{
hassoc9502432005-02-01 22:01:48 +00002030 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00002031}
David Lamparter6b0655a2014-06-04 06:53:35 +02002032
paul718e3742002-12-13 20:15:29 +00002033/* neighbor capability dynamic. */
2034DEFUN (neighbor_capability_dynamic,
2035 neighbor_capability_dynamic_cmd,
2036 NEIGHBOR_CMD2 "capability dynamic",
2037 NEIGHBOR_STR
2038 NEIGHBOR_ADDR_STR2
2039 "Advertise capability to the peer\n"
2040 "Advertise dynamic capability to this neighbor\n")
2041{
2042 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY);
2043}
2044
2045DEFUN (no_neighbor_capability_dynamic,
2046 no_neighbor_capability_dynamic_cmd,
2047 NO_NEIGHBOR_CMD2 "capability dynamic",
2048 NO_STR
2049 NEIGHBOR_STR
2050 NEIGHBOR_ADDR_STR2
2051 "Advertise capability to the peer\n"
2052 "Advertise dynamic capability to this neighbor\n")
2053{
2054 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY);
2055}
David Lamparter6b0655a2014-06-04 06:53:35 +02002056
paul718e3742002-12-13 20:15:29 +00002057/* neighbor dont-capability-negotiate */
2058DEFUN (neighbor_dont_capability_negotiate,
2059 neighbor_dont_capability_negotiate_cmd,
2060 NEIGHBOR_CMD2 "dont-capability-negotiate",
2061 NEIGHBOR_STR
2062 NEIGHBOR_ADDR_STR2
2063 "Do not perform capability negotiation\n")
2064{
2065 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY);
2066}
2067
2068DEFUN (no_neighbor_dont_capability_negotiate,
2069 no_neighbor_dont_capability_negotiate_cmd,
2070 NO_NEIGHBOR_CMD2 "dont-capability-negotiate",
2071 NO_STR
2072 NEIGHBOR_STR
2073 NEIGHBOR_ADDR_STR2
2074 "Do not perform capability negotiation\n")
2075{
2076 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY);
2077}
David Lamparter6b0655a2014-06-04 06:53:35 +02002078
paul94f2b392005-06-28 12:44:16 +00002079static int
paulfd79ac92004-10-13 05:06:08 +00002080peer_af_flag_modify_vty (struct vty *vty, const char *peer_str, afi_t afi,
paulfee0f4c2004-09-13 05:12:46 +00002081 safi_t safi, u_int32_t flag, int set)
paul718e3742002-12-13 20:15:29 +00002082{
2083 int ret;
2084 struct peer *peer;
2085
2086 peer = peer_and_group_lookup_vty (vty, peer_str);
2087 if (! peer)
2088 return CMD_WARNING;
2089
2090 if (set)
2091 ret = peer_af_flag_set (peer, afi, safi, flag);
2092 else
2093 ret = peer_af_flag_unset (peer, afi, safi, flag);
2094
2095 return bgp_vty_return (vty, ret);
2096}
2097
paul94f2b392005-06-28 12:44:16 +00002098static int
paulfd79ac92004-10-13 05:06:08 +00002099peer_af_flag_set_vty (struct vty *vty, const char *peer_str, afi_t afi,
paulfee0f4c2004-09-13 05:12:46 +00002100 safi_t safi, u_int32_t flag)
paul718e3742002-12-13 20:15:29 +00002101{
2102 return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 1);
2103}
2104
paul94f2b392005-06-28 12:44:16 +00002105static int
paulfd79ac92004-10-13 05:06:08 +00002106peer_af_flag_unset_vty (struct vty *vty, const char *peer_str, afi_t afi,
paulfee0f4c2004-09-13 05:12:46 +00002107 safi_t safi, u_int32_t flag)
paul718e3742002-12-13 20:15:29 +00002108{
2109 return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 0);
2110}
David Lamparter6b0655a2014-06-04 06:53:35 +02002111
paul718e3742002-12-13 20:15:29 +00002112/* neighbor capability orf prefix-list. */
2113DEFUN (neighbor_capability_orf_prefix,
2114 neighbor_capability_orf_prefix_cmd,
2115 NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)",
2116 NEIGHBOR_STR
2117 NEIGHBOR_ADDR_STR2
2118 "Advertise capability to the peer\n"
2119 "Advertise ORF capability to the peer\n"
2120 "Advertise prefixlist ORF capability to this neighbor\n"
2121 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
2122 "Capability to RECEIVE the ORF from this neighbor\n"
2123 "Capability to SEND the ORF to this neighbor\n")
2124{
2125 u_int16_t flag = 0;
2126
2127 if (strncmp (argv[1], "s", 1) == 0)
2128 flag = PEER_FLAG_ORF_PREFIX_SM;
2129 else if (strncmp (argv[1], "r", 1) == 0)
2130 flag = PEER_FLAG_ORF_PREFIX_RM;
2131 else if (strncmp (argv[1], "b", 1) == 0)
2132 flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM;
2133 else
2134 return CMD_WARNING;
2135
2136 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2137 bgp_node_safi (vty), flag);
2138}
2139
2140DEFUN (no_neighbor_capability_orf_prefix,
2141 no_neighbor_capability_orf_prefix_cmd,
2142 NO_NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)",
2143 NO_STR
2144 NEIGHBOR_STR
2145 NEIGHBOR_ADDR_STR2
2146 "Advertise capability to the peer\n"
2147 "Advertise ORF capability to the peer\n"
2148 "Advertise prefixlist ORF capability to this neighbor\n"
2149 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
2150 "Capability to RECEIVE the ORF from this neighbor\n"
2151 "Capability to SEND the ORF to this neighbor\n")
2152{
2153 u_int16_t flag = 0;
2154
2155 if (strncmp (argv[1], "s", 1) == 0)
2156 flag = PEER_FLAG_ORF_PREFIX_SM;
2157 else if (strncmp (argv[1], "r", 1) == 0)
2158 flag = PEER_FLAG_ORF_PREFIX_RM;
2159 else if (strncmp (argv[1], "b", 1) == 0)
2160 flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM;
2161 else
2162 return CMD_WARNING;
2163
2164 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2165 bgp_node_safi (vty), flag);
2166}
David Lamparter6b0655a2014-06-04 06:53:35 +02002167
paul718e3742002-12-13 20:15:29 +00002168/* neighbor next-hop-self. */
2169DEFUN (neighbor_nexthop_self,
2170 neighbor_nexthop_self_cmd,
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002171 NEIGHBOR_CMD2 "next-hop-self {all}",
paul718e3742002-12-13 20:15:29 +00002172 NEIGHBOR_STR
2173 NEIGHBOR_ADDR_STR2
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002174 "Disable the next hop calculation for this neighbor\n"
2175 "Apply also to ibgp-learned routes when acting as a route reflector\n")
paul718e3742002-12-13 20:15:29 +00002176{
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002177 u_int32_t flags = PEER_FLAG_NEXTHOP_SELF, unset = 0;
2178 int rc;
2179
2180 /* Check if "all" is specified */
2181 if (argv[1] != NULL)
2182 flags |= PEER_FLAG_NEXTHOP_SELF_ALL;
2183 else
2184 unset |= PEER_FLAG_NEXTHOP_SELF_ALL;
2185
2186 rc = peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2187 bgp_node_safi (vty), flags);
2188 if ( rc == CMD_SUCCESS && unset )
2189 rc = peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2190 bgp_node_safi (vty), unset);
2191 return rc;
paul718e3742002-12-13 20:15:29 +00002192}
2193
2194DEFUN (no_neighbor_nexthop_self,
2195 no_neighbor_nexthop_self_cmd,
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002196 NO_NEIGHBOR_CMD2 "next-hop-self {all}",
paul718e3742002-12-13 20:15:29 +00002197 NO_STR
2198 NEIGHBOR_STR
2199 NEIGHBOR_ADDR_STR2
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002200 "Disable the next hop calculation for this neighbor\n"
2201 "Apply also to ibgp-learned routes when acting as a route reflector\n")
paul718e3742002-12-13 20:15:29 +00002202{
2203 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002204 bgp_node_safi (vty),
2205 PEER_FLAG_NEXTHOP_SELF|PEER_FLAG_NEXTHOP_SELF_ALL);
paul718e3742002-12-13 20:15:29 +00002206}
David Lamparter6b0655a2014-06-04 06:53:35 +02002207
paul718e3742002-12-13 20:15:29 +00002208/* neighbor remove-private-AS. */
2209DEFUN (neighbor_remove_private_as,
2210 neighbor_remove_private_as_cmd,
2211 NEIGHBOR_CMD2 "remove-private-AS",
2212 NEIGHBOR_STR
2213 NEIGHBOR_ADDR_STR2
2214 "Remove private AS number from outbound updates\n")
2215{
2216 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2217 bgp_node_safi (vty),
2218 PEER_FLAG_REMOVE_PRIVATE_AS);
2219}
2220
2221DEFUN (no_neighbor_remove_private_as,
2222 no_neighbor_remove_private_as_cmd,
2223 NO_NEIGHBOR_CMD2 "remove-private-AS",
2224 NO_STR
2225 NEIGHBOR_STR
2226 NEIGHBOR_ADDR_STR2
2227 "Remove private AS number from outbound updates\n")
2228{
2229 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2230 bgp_node_safi (vty),
2231 PEER_FLAG_REMOVE_PRIVATE_AS);
2232}
David Lamparter6b0655a2014-06-04 06:53:35 +02002233
paul718e3742002-12-13 20:15:29 +00002234/* neighbor send-community. */
2235DEFUN (neighbor_send_community,
2236 neighbor_send_community_cmd,
2237 NEIGHBOR_CMD2 "send-community",
2238 NEIGHBOR_STR
2239 NEIGHBOR_ADDR_STR2
2240 "Send Community attribute to this neighbor\n")
2241{
2242 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2243 bgp_node_safi (vty),
2244 PEER_FLAG_SEND_COMMUNITY);
2245}
2246
2247DEFUN (no_neighbor_send_community,
2248 no_neighbor_send_community_cmd,
2249 NO_NEIGHBOR_CMD2 "send-community",
2250 NO_STR
2251 NEIGHBOR_STR
2252 NEIGHBOR_ADDR_STR2
2253 "Send Community attribute to this neighbor\n")
2254{
2255 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2256 bgp_node_safi (vty),
2257 PEER_FLAG_SEND_COMMUNITY);
2258}
David Lamparter6b0655a2014-06-04 06:53:35 +02002259
paul718e3742002-12-13 20:15:29 +00002260/* neighbor send-community extended. */
2261DEFUN (neighbor_send_community_type,
2262 neighbor_send_community_type_cmd,
2263 NEIGHBOR_CMD2 "send-community (both|extended|standard)",
2264 NEIGHBOR_STR
2265 NEIGHBOR_ADDR_STR2
2266 "Send Community attribute to this neighbor\n"
2267 "Send Standard and Extended Community attributes\n"
2268 "Send Extended Community attributes\n"
2269 "Send Standard Community attributes\n")
2270{
2271 if (strncmp (argv[1], "s", 1) == 0)
2272 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2273 bgp_node_safi (vty),
2274 PEER_FLAG_SEND_COMMUNITY);
2275 if (strncmp (argv[1], "e", 1) == 0)
2276 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2277 bgp_node_safi (vty),
2278 PEER_FLAG_SEND_EXT_COMMUNITY);
2279
2280 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2281 bgp_node_safi (vty),
2282 (PEER_FLAG_SEND_COMMUNITY|
2283 PEER_FLAG_SEND_EXT_COMMUNITY));
2284}
2285
2286DEFUN (no_neighbor_send_community_type,
2287 no_neighbor_send_community_type_cmd,
2288 NO_NEIGHBOR_CMD2 "send-community (both|extended|standard)",
2289 NO_STR
2290 NEIGHBOR_STR
2291 NEIGHBOR_ADDR_STR2
2292 "Send Community attribute to this neighbor\n"
2293 "Send Standard and Extended Community attributes\n"
2294 "Send Extended Community attributes\n"
2295 "Send Standard Community attributes\n")
2296{
2297 if (strncmp (argv[1], "s", 1) == 0)
2298 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2299 bgp_node_safi (vty),
2300 PEER_FLAG_SEND_COMMUNITY);
2301 if (strncmp (argv[1], "e", 1) == 0)
2302 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2303 bgp_node_safi (vty),
2304 PEER_FLAG_SEND_EXT_COMMUNITY);
2305
2306 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2307 bgp_node_safi (vty),
2308 (PEER_FLAG_SEND_COMMUNITY |
2309 PEER_FLAG_SEND_EXT_COMMUNITY));
2310}
David Lamparter6b0655a2014-06-04 06:53:35 +02002311
paul718e3742002-12-13 20:15:29 +00002312/* neighbor soft-reconfig. */
2313DEFUN (neighbor_soft_reconfiguration,
2314 neighbor_soft_reconfiguration_cmd,
2315 NEIGHBOR_CMD2 "soft-reconfiguration inbound",
2316 NEIGHBOR_STR
2317 NEIGHBOR_ADDR_STR2
2318 "Per neighbor soft reconfiguration\n"
2319 "Allow inbound soft reconfiguration for this neighbor\n")
2320{
2321 return peer_af_flag_set_vty (vty, argv[0],
2322 bgp_node_afi (vty), bgp_node_safi (vty),
2323 PEER_FLAG_SOFT_RECONFIG);
2324}
2325
2326DEFUN (no_neighbor_soft_reconfiguration,
2327 no_neighbor_soft_reconfiguration_cmd,
2328 NO_NEIGHBOR_CMD2 "soft-reconfiguration inbound",
2329 NO_STR
2330 NEIGHBOR_STR
2331 NEIGHBOR_ADDR_STR2
2332 "Per neighbor soft reconfiguration\n"
2333 "Allow inbound soft reconfiguration for this neighbor\n")
2334{
2335 return peer_af_flag_unset_vty (vty, argv[0],
2336 bgp_node_afi (vty), bgp_node_safi (vty),
2337 PEER_FLAG_SOFT_RECONFIG);
2338}
David Lamparter6b0655a2014-06-04 06:53:35 +02002339
paul718e3742002-12-13 20:15:29 +00002340DEFUN (neighbor_route_reflector_client,
2341 neighbor_route_reflector_client_cmd,
2342 NEIGHBOR_CMD2 "route-reflector-client",
2343 NEIGHBOR_STR
2344 NEIGHBOR_ADDR_STR2
2345 "Configure a neighbor as Route Reflector client\n")
2346{
2347 struct peer *peer;
2348
2349
2350 peer = peer_and_group_lookup_vty (vty, argv[0]);
2351 if (! peer)
2352 return CMD_WARNING;
2353
2354 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2355 bgp_node_safi (vty),
2356 PEER_FLAG_REFLECTOR_CLIENT);
2357}
2358
2359DEFUN (no_neighbor_route_reflector_client,
2360 no_neighbor_route_reflector_client_cmd,
2361 NO_NEIGHBOR_CMD2 "route-reflector-client",
2362 NO_STR
2363 NEIGHBOR_STR
2364 NEIGHBOR_ADDR_STR2
2365 "Configure a neighbor as Route Reflector client\n")
2366{
2367 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2368 bgp_node_safi (vty),
2369 PEER_FLAG_REFLECTOR_CLIENT);
2370}
David Lamparter6b0655a2014-06-04 06:53:35 +02002371
paul94f2b392005-06-28 12:44:16 +00002372static int
paulfd79ac92004-10-13 05:06:08 +00002373peer_rsclient_set_vty (struct vty *vty, const char *peer_str,
2374 int afi, int safi)
paulfee0f4c2004-09-13 05:12:46 +00002375{
2376 int ret;
2377 struct bgp *bgp;
2378 struct peer *peer;
2379 struct peer_group *group;
paul1eb8ef22005-04-07 07:30:20 +00002380 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00002381 struct bgp_filter *pfilter;
2382 struct bgp_filter *gfilter;
Chris Caputo228da422009-07-18 05:44:03 +00002383 int locked_and_added = 0;
paulfee0f4c2004-09-13 05:12:46 +00002384
2385 bgp = vty->index;
2386
2387 peer = peer_and_group_lookup_vty (vty, peer_str);
2388 if ( ! peer )
2389 return CMD_WARNING;
2390
2391 /* If it is already a RS-Client, don't do anything. */
2392 if ( CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) )
2393 return CMD_SUCCESS;
2394
2395 if ( ! peer_rsclient_active (peer) )
paul200df112005-06-01 11:17:05 +00002396 {
2397 peer = peer_lock (peer); /* rsclient peer list reference */
2398 listnode_add_sort (bgp->rsclient, peer);
Chris Caputo228da422009-07-18 05:44:03 +00002399 locked_and_added = 1;
paul200df112005-06-01 11:17:05 +00002400 }
paulfee0f4c2004-09-13 05:12:46 +00002401
2402 ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2403 if (ret < 0)
Chris Caputo228da422009-07-18 05:44:03 +00002404 {
2405 if (locked_and_added)
2406 {
2407 listnode_delete (bgp->rsclient, peer);
2408 peer_unlock (peer); /* rsclient peer list reference */
2409 }
2410
2411 return bgp_vty_return (vty, ret);
2412 }
paulfee0f4c2004-09-13 05:12:46 +00002413
Paul Jakma64e580a2006-02-21 01:09:01 +00002414 peer->rib[afi][safi] = bgp_table_init (afi, safi);
paulfee0f4c2004-09-13 05:12:46 +00002415 peer->rib[afi][safi]->type = BGP_TABLE_RSCLIENT;
Chris Caputo228da422009-07-18 05:44:03 +00002416 /* RIB peer reference. Released when table is free'd in bgp_table_free. */
2417 peer->rib[afi][safi]->owner = peer_lock (peer);
paulfee0f4c2004-09-13 05:12:46 +00002418
2419 /* Check for existing 'network' and 'redistribute' routes. */
2420 bgp_check_local_routes_rsclient (peer, afi, safi);
2421
2422 /* Check for routes for peers configured with 'soft-reconfiguration'. */
2423 bgp_soft_reconfig_rsclient (peer, afi, safi);
2424
2425 if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP))
2426 {
2427 group = peer->group;
2428 gfilter = &peer->filter[afi][safi];
2429
paul1eb8ef22005-04-07 07:30:20 +00002430 for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00002431 {
2432 pfilter = &peer->filter[afi][safi];
2433
2434 /* Members of a non-RS-Client group should not be RS-Clients, as that
2435 is checked when the become part of the peer-group */
2436 ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2437 if (ret < 0)
2438 return bgp_vty_return (vty, ret);
2439
2440 /* Make peer's RIB point to group's RIB. */
2441 peer->rib[afi][safi] = group->conf->rib[afi][safi];
2442
2443 /* Import policy. */
2444 if (pfilter->map[RMAP_IMPORT].name)
2445 free (pfilter->map[RMAP_IMPORT].name);
2446 if (gfilter->map[RMAP_IMPORT].name)
2447 {
2448 pfilter->map[RMAP_IMPORT].name = strdup (gfilter->map[RMAP_IMPORT].name);
2449 pfilter->map[RMAP_IMPORT].map = gfilter->map[RMAP_IMPORT].map;
2450 }
2451 else
2452 {
2453 pfilter->map[RMAP_IMPORT].name = NULL;
2454 pfilter->map[RMAP_IMPORT].map =NULL;
2455 }
2456
2457 /* Export policy. */
2458 if (gfilter->map[RMAP_EXPORT].name && ! pfilter->map[RMAP_EXPORT].name)
2459 {
2460 pfilter->map[RMAP_EXPORT].name = strdup (gfilter->map[RMAP_EXPORT].name);
2461 pfilter->map[RMAP_EXPORT].map = gfilter->map[RMAP_EXPORT].map;
2462 }
2463 }
2464 }
2465 return CMD_SUCCESS;
2466}
2467
paul94f2b392005-06-28 12:44:16 +00002468static int
paulfd79ac92004-10-13 05:06:08 +00002469peer_rsclient_unset_vty (struct vty *vty, const char *peer_str,
2470 int afi, int safi)
paulfee0f4c2004-09-13 05:12:46 +00002471{
2472 int ret;
2473 struct bgp *bgp;
2474 struct peer *peer;
2475 struct peer_group *group;
paul1eb8ef22005-04-07 07:30:20 +00002476 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00002477
2478 bgp = vty->index;
2479
2480 peer = peer_and_group_lookup_vty (vty, peer_str);
2481 if ( ! peer )
2482 return CMD_WARNING;
2483
2484 /* If it is not a RS-Client, don't do anything. */
2485 if ( ! CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) )
2486 return CMD_SUCCESS;
2487
2488 if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP))
2489 {
2490 group = peer->group;
2491
paul1eb8ef22005-04-07 07:30:20 +00002492 for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00002493 {
2494 ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2495 if (ret < 0)
2496 return bgp_vty_return (vty, ret);
2497
2498 peer->rib[afi][safi] = NULL;
2499 }
2500
2501 peer = group->conf;
2502 }
2503
2504 ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2505 if (ret < 0)
2506 return bgp_vty_return (vty, ret);
2507
2508 if ( ! peer_rsclient_active (peer) )
paul200df112005-06-01 11:17:05 +00002509 {
Chris Caputo228da422009-07-18 05:44:03 +00002510 bgp_clear_route (peer, afi, safi, BGP_CLEAR_ROUTE_MY_RSCLIENT);
paul200df112005-06-01 11:17:05 +00002511 listnode_delete (bgp->rsclient, peer);
Chris Caputo228da422009-07-18 05:44:03 +00002512 peer_unlock (peer); /* peer bgp rsclient reference */
paul200df112005-06-01 11:17:05 +00002513 }
paulfee0f4c2004-09-13 05:12:46 +00002514
Paul Jakmab608d5b2008-07-02 02:12:07 +00002515 bgp_table_finish (&peer->rib[bgp_node_afi(vty)][bgp_node_safi(vty)]);
paulfee0f4c2004-09-13 05:12:46 +00002516
2517 return CMD_SUCCESS;
2518}
David Lamparter6b0655a2014-06-04 06:53:35 +02002519
paul718e3742002-12-13 20:15:29 +00002520/* neighbor route-server-client. */
2521DEFUN (neighbor_route_server_client,
2522 neighbor_route_server_client_cmd,
2523 NEIGHBOR_CMD2 "route-server-client",
2524 NEIGHBOR_STR
2525 NEIGHBOR_ADDR_STR2
2526 "Configure a neighbor as Route Server client\n")
2527{
paulfee0f4c2004-09-13 05:12:46 +00002528 return peer_rsclient_set_vty (vty, argv[0], bgp_node_afi(vty),
2529 bgp_node_safi(vty));
paul718e3742002-12-13 20:15:29 +00002530}
2531
2532DEFUN (no_neighbor_route_server_client,
2533 no_neighbor_route_server_client_cmd,
2534 NO_NEIGHBOR_CMD2 "route-server-client",
2535 NO_STR
2536 NEIGHBOR_STR
2537 NEIGHBOR_ADDR_STR2
2538 "Configure a neighbor as Route Server client\n")
2539{
paulfee0f4c2004-09-13 05:12:46 +00002540 return peer_rsclient_unset_vty (vty, argv[0], bgp_node_afi(vty),
2541 bgp_node_safi(vty));
2542}
David Lamparter6b0655a2014-06-04 06:53:35 +02002543
paulfee0f4c2004-09-13 05:12:46 +00002544DEFUN (neighbor_nexthop_local_unchanged,
2545 neighbor_nexthop_local_unchanged_cmd,
2546 NEIGHBOR_CMD2 "nexthop-local unchanged",
2547 NEIGHBOR_STR
2548 NEIGHBOR_ADDR_STR2
2549 "Configure treatment of outgoing link-local nexthop attribute\n"
2550 "Leave link-local nexthop unchanged for this peer\n")
2551{
2552 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2553 bgp_node_safi (vty),
2554 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED );
2555}
David Lamparter6b0655a2014-06-04 06:53:35 +02002556
paulfee0f4c2004-09-13 05:12:46 +00002557DEFUN (no_neighbor_nexthop_local_unchanged,
2558 no_neighbor_nexthop_local_unchanged_cmd,
2559 NO_NEIGHBOR_CMD2 "nexthop-local unchanged",
2560 NO_STR
2561 NEIGHBOR_STR
2562 NEIGHBOR_ADDR_STR2
2563 "Configure treatment of outgoing link-local-nexthop attribute\n"
2564 "Leave link-local nexthop unchanged for this peer\n")
2565{
paul718e3742002-12-13 20:15:29 +00002566 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2567 bgp_node_safi (vty),
paulfee0f4c2004-09-13 05:12:46 +00002568 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED );
paul718e3742002-12-13 20:15:29 +00002569}
David Lamparter6b0655a2014-06-04 06:53:35 +02002570
paul718e3742002-12-13 20:15:29 +00002571DEFUN (neighbor_attr_unchanged,
2572 neighbor_attr_unchanged_cmd,
2573 NEIGHBOR_CMD2 "attribute-unchanged",
2574 NEIGHBOR_STR
2575 NEIGHBOR_ADDR_STR2
2576 "BGP attribute is propagated unchanged to this neighbor\n")
2577{
2578 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2579 bgp_node_safi (vty),
2580 (PEER_FLAG_AS_PATH_UNCHANGED |
2581 PEER_FLAG_NEXTHOP_UNCHANGED |
2582 PEER_FLAG_MED_UNCHANGED));
2583}
2584
2585DEFUN (neighbor_attr_unchanged1,
2586 neighbor_attr_unchanged1_cmd,
2587 NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)",
2588 NEIGHBOR_STR
2589 NEIGHBOR_ADDR_STR2
2590 "BGP attribute is propagated unchanged to this neighbor\n"
2591 "As-path attribute\n"
2592 "Nexthop attribute\n"
2593 "Med attribute\n")
2594{
2595 u_int16_t flags = 0;
2596
2597 if (strncmp (argv[1], "as-path", 1) == 0)
2598 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2599 else if (strncmp (argv[1], "next-hop", 1) == 0)
2600 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2601 else if (strncmp (argv[1], "med", 1) == 0)
2602 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2603
2604 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2605 bgp_node_safi (vty), flags);
2606}
2607
2608DEFUN (neighbor_attr_unchanged2,
2609 neighbor_attr_unchanged2_cmd,
2610 NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)",
2611 NEIGHBOR_STR
2612 NEIGHBOR_ADDR_STR2
2613 "BGP attribute is propagated unchanged to this neighbor\n"
2614 "As-path attribute\n"
2615 "Nexthop attribute\n"
2616 "Med attribute\n")
2617{
2618 u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED;
2619
2620 if (strncmp (argv[1], "next-hop", 1) == 0)
2621 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2622 else if (strncmp (argv[1], "med", 1) == 0)
2623 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2624
2625 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2626 bgp_node_safi (vty), flags);
2627
2628}
2629
2630DEFUN (neighbor_attr_unchanged3,
2631 neighbor_attr_unchanged3_cmd,
2632 NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)",
2633 NEIGHBOR_STR
2634 NEIGHBOR_ADDR_STR2
2635 "BGP attribute is propagated unchanged to this neighbor\n"
2636 "Nexthop attribute\n"
2637 "As-path attribute\n"
2638 "Med attribute\n")
2639{
2640 u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED;
2641
2642 if (strncmp (argv[1], "as-path", 1) == 0)
2643 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2644 else if (strncmp (argv[1], "med", 1) == 0)
2645 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2646
2647 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2648 bgp_node_safi (vty), flags);
2649}
2650
2651DEFUN (neighbor_attr_unchanged4,
2652 neighbor_attr_unchanged4_cmd,
2653 NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)",
2654 NEIGHBOR_STR
2655 NEIGHBOR_ADDR_STR2
2656 "BGP attribute is propagated unchanged to this neighbor\n"
2657 "Med attribute\n"
2658 "As-path attribute\n"
2659 "Nexthop attribute\n")
2660{
2661 u_int16_t flags = PEER_FLAG_MED_UNCHANGED;
2662
2663 if (strncmp (argv[1], "as-path", 1) == 0)
2664 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2665 else if (strncmp (argv[1], "next-hop", 1) == 0)
2666 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2667
2668 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2669 bgp_node_safi (vty), flags);
2670}
2671
2672ALIAS (neighbor_attr_unchanged,
2673 neighbor_attr_unchanged5_cmd,
2674 NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med",
2675 NEIGHBOR_STR
2676 NEIGHBOR_ADDR_STR2
2677 "BGP attribute is propagated unchanged to this neighbor\n"
2678 "As-path attribute\n"
2679 "Nexthop attribute\n"
2680 "Med attribute\n")
2681
2682ALIAS (neighbor_attr_unchanged,
2683 neighbor_attr_unchanged6_cmd,
2684 NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop",
2685 NEIGHBOR_STR
2686 NEIGHBOR_ADDR_STR2
2687 "BGP attribute is propagated unchanged to this neighbor\n"
2688 "As-path attribute\n"
2689 "Med attribute\n"
2690 "Nexthop attribute\n")
2691
2692ALIAS (neighbor_attr_unchanged,
2693 neighbor_attr_unchanged7_cmd,
2694 NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path",
2695 NEIGHBOR_STR
2696 NEIGHBOR_ADDR_STR2
2697 "BGP attribute is propagated unchanged to this neighbor\n"
2698 "Nexthop attribute\n"
2699 "Med attribute\n"
2700 "As-path attribute\n")
2701
2702ALIAS (neighbor_attr_unchanged,
2703 neighbor_attr_unchanged8_cmd,
2704 NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med",
2705 NEIGHBOR_STR
2706 NEIGHBOR_ADDR_STR2
2707 "BGP attribute is propagated unchanged to this neighbor\n"
2708 "Nexthop attribute\n"
2709 "As-path attribute\n"
2710 "Med attribute\n")
2711
2712ALIAS (neighbor_attr_unchanged,
2713 neighbor_attr_unchanged9_cmd,
2714 NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path",
2715 NEIGHBOR_STR
2716 NEIGHBOR_ADDR_STR2
2717 "BGP attribute is propagated unchanged to this neighbor\n"
2718 "Med attribute\n"
2719 "Nexthop attribute\n"
2720 "As-path attribute\n")
2721
2722ALIAS (neighbor_attr_unchanged,
2723 neighbor_attr_unchanged10_cmd,
2724 NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop",
2725 NEIGHBOR_STR
2726 NEIGHBOR_ADDR_STR2
2727 "BGP attribute is propagated unchanged to this neighbor\n"
2728 "Med attribute\n"
2729 "As-path attribute\n"
2730 "Nexthop attribute\n")
2731
2732DEFUN (no_neighbor_attr_unchanged,
2733 no_neighbor_attr_unchanged_cmd,
2734 NO_NEIGHBOR_CMD2 "attribute-unchanged",
2735 NO_STR
2736 NEIGHBOR_STR
2737 NEIGHBOR_ADDR_STR2
2738 "BGP attribute is propagated unchanged to this neighbor\n")
2739{
2740 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2741 bgp_node_safi (vty),
2742 (PEER_FLAG_AS_PATH_UNCHANGED |
2743 PEER_FLAG_NEXTHOP_UNCHANGED |
2744 PEER_FLAG_MED_UNCHANGED));
2745}
2746
2747DEFUN (no_neighbor_attr_unchanged1,
2748 no_neighbor_attr_unchanged1_cmd,
2749 NO_NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)",
2750 NO_STR
2751 NEIGHBOR_STR
2752 NEIGHBOR_ADDR_STR2
2753 "BGP attribute is propagated unchanged to this neighbor\n"
2754 "As-path attribute\n"
2755 "Nexthop attribute\n"
2756 "Med attribute\n")
2757{
2758 u_int16_t flags = 0;
2759
2760 if (strncmp (argv[1], "as-path", 1) == 0)
2761 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2762 else if (strncmp (argv[1], "next-hop", 1) == 0)
2763 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2764 else if (strncmp (argv[1], "med", 1) == 0)
2765 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2766
2767 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2768 bgp_node_safi (vty), flags);
2769}
2770
2771DEFUN (no_neighbor_attr_unchanged2,
2772 no_neighbor_attr_unchanged2_cmd,
2773 NO_NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)",
2774 NO_STR
2775 NEIGHBOR_STR
2776 NEIGHBOR_ADDR_STR2
2777 "BGP attribute is propagated unchanged to this neighbor\n"
2778 "As-path attribute\n"
2779 "Nexthop attribute\n"
2780 "Med attribute\n")
2781{
2782 u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED;
2783
2784 if (strncmp (argv[1], "next-hop", 1) == 0)
2785 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2786 else if (strncmp (argv[1], "med", 1) == 0)
2787 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2788
2789 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2790 bgp_node_safi (vty), flags);
2791}
2792
2793DEFUN (no_neighbor_attr_unchanged3,
2794 no_neighbor_attr_unchanged3_cmd,
2795 NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)",
2796 NO_STR
2797 NEIGHBOR_STR
2798 NEIGHBOR_ADDR_STR2
2799 "BGP attribute is propagated unchanged to this neighbor\n"
2800 "Nexthop attribute\n"
2801 "As-path attribute\n"
2802 "Med attribute\n")
2803{
2804 u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED;
2805
2806 if (strncmp (argv[1], "as-path", 1) == 0)
2807 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2808 else if (strncmp (argv[1], "med", 1) == 0)
2809 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2810
2811 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2812 bgp_node_safi (vty), flags);
2813}
2814
2815DEFUN (no_neighbor_attr_unchanged4,
2816 no_neighbor_attr_unchanged4_cmd,
2817 NO_NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)",
2818 NO_STR
2819 NEIGHBOR_STR
2820 NEIGHBOR_ADDR_STR2
2821 "BGP attribute is propagated unchanged to this neighbor\n"
2822 "Med attribute\n"
2823 "As-path attribute\n"
2824 "Nexthop attribute\n")
2825{
2826 u_int16_t flags = PEER_FLAG_MED_UNCHANGED;
2827
2828 if (strncmp (argv[1], "as-path", 1) == 0)
2829 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2830 else if (strncmp (argv[1], "next-hop", 1) == 0)
2831 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2832
2833 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2834 bgp_node_safi (vty), flags);
2835}
2836
2837ALIAS (no_neighbor_attr_unchanged,
2838 no_neighbor_attr_unchanged5_cmd,
2839 NO_NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med",
2840 NO_STR
2841 NEIGHBOR_STR
2842 NEIGHBOR_ADDR_STR2
2843 "BGP attribute is propagated unchanged to this neighbor\n"
2844 "As-path attribute\n"
2845 "Nexthop attribute\n"
2846 "Med attribute\n")
2847
2848ALIAS (no_neighbor_attr_unchanged,
2849 no_neighbor_attr_unchanged6_cmd,
2850 NO_NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop",
2851 NO_STR
2852 NEIGHBOR_STR
2853 NEIGHBOR_ADDR_STR2
2854 "BGP attribute is propagated unchanged to this neighbor\n"
2855 "As-path attribute\n"
2856 "Med attribute\n"
2857 "Nexthop attribute\n")
2858
2859ALIAS (no_neighbor_attr_unchanged,
2860 no_neighbor_attr_unchanged7_cmd,
2861 NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path",
2862 NO_STR
2863 NEIGHBOR_STR
2864 NEIGHBOR_ADDR_STR2
2865 "BGP attribute is propagated unchanged to this neighbor\n"
2866 "Nexthop attribute\n"
2867 "Med attribute\n"
2868 "As-path attribute\n")
2869
2870ALIAS (no_neighbor_attr_unchanged,
2871 no_neighbor_attr_unchanged8_cmd,
2872 NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med",
2873 NO_STR
2874 NEIGHBOR_STR
2875 NEIGHBOR_ADDR_STR2
2876 "BGP attribute is propagated unchanged to this neighbor\n"
2877 "Nexthop attribute\n"
2878 "As-path attribute\n"
2879 "Med attribute\n")
2880
2881ALIAS (no_neighbor_attr_unchanged,
2882 no_neighbor_attr_unchanged9_cmd,
2883 NO_NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path",
2884 NO_STR
2885 NEIGHBOR_STR
2886 NEIGHBOR_ADDR_STR2
2887 "BGP attribute is propagated unchanged to this neighbor\n"
2888 "Med attribute\n"
2889 "Nexthop attribute\n"
2890 "As-path attribute\n")
2891
2892ALIAS (no_neighbor_attr_unchanged,
2893 no_neighbor_attr_unchanged10_cmd,
2894 NO_NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop",
2895 NO_STR
2896 NEIGHBOR_STR
2897 NEIGHBOR_ADDR_STR2
2898 "BGP attribute is propagated unchanged to this neighbor\n"
2899 "Med attribute\n"
2900 "As-path attribute\n"
2901 "Nexthop attribute\n")
2902
2903/* For old version Zebra compatibility. */
hassodd4c5932005-02-02 17:15:34 +00002904DEFUN_DEPRECATED (neighbor_transparent_as,
2905 neighbor_transparent_as_cmd,
2906 NEIGHBOR_CMD "transparent-as",
2907 NEIGHBOR_STR
2908 NEIGHBOR_ADDR_STR
2909 "Do not append my AS number even peer is EBGP peer\n")
paul718e3742002-12-13 20:15:29 +00002910{
2911 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2912 bgp_node_safi (vty),
2913 PEER_FLAG_AS_PATH_UNCHANGED);
2914}
2915
hassodd4c5932005-02-02 17:15:34 +00002916DEFUN_DEPRECATED (neighbor_transparent_nexthop,
2917 neighbor_transparent_nexthop_cmd,
2918 NEIGHBOR_CMD "transparent-nexthop",
2919 NEIGHBOR_STR
2920 NEIGHBOR_ADDR_STR
2921 "Do not change nexthop even peer is EBGP peer\n")
paul718e3742002-12-13 20:15:29 +00002922{
2923 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2924 bgp_node_safi (vty),
2925 PEER_FLAG_NEXTHOP_UNCHANGED);
2926}
David Lamparter6b0655a2014-06-04 06:53:35 +02002927
paul718e3742002-12-13 20:15:29 +00002928/* EBGP multihop configuration. */
paul94f2b392005-06-28 12:44:16 +00002929static int
paulfd79ac92004-10-13 05:06:08 +00002930peer_ebgp_multihop_set_vty (struct vty *vty, const char *ip_str,
2931 const char *ttl_str)
paul718e3742002-12-13 20:15:29 +00002932{
2933 struct peer *peer;
paulfd79ac92004-10-13 05:06:08 +00002934 unsigned int ttl;
paul718e3742002-12-13 20:15:29 +00002935
2936 peer = peer_and_group_lookup_vty (vty, ip_str);
2937 if (! peer)
2938 return CMD_WARNING;
2939
2940 if (! ttl_str)
2941 ttl = TTL_MAX;
2942 else
2943 VTY_GET_INTEGER_RANGE ("TTL", ttl, ttl_str, 1, 255);
2944
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00002945 return bgp_vty_return (vty, peer_ebgp_multihop_set (peer, ttl));
paul718e3742002-12-13 20:15:29 +00002946}
2947
paul94f2b392005-06-28 12:44:16 +00002948static int
paulfd79ac92004-10-13 05:06:08 +00002949peer_ebgp_multihop_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00002950{
2951 struct peer *peer;
2952
2953 peer = peer_and_group_lookup_vty (vty, ip_str);
2954 if (! peer)
2955 return CMD_WARNING;
2956
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00002957 return bgp_vty_return (vty, peer_ebgp_multihop_unset (peer));
paul718e3742002-12-13 20:15:29 +00002958}
2959
2960/* neighbor ebgp-multihop. */
2961DEFUN (neighbor_ebgp_multihop,
2962 neighbor_ebgp_multihop_cmd,
2963 NEIGHBOR_CMD2 "ebgp-multihop",
2964 NEIGHBOR_STR
2965 NEIGHBOR_ADDR_STR2
2966 "Allow EBGP neighbors not on directly connected networks\n")
2967{
2968 return peer_ebgp_multihop_set_vty (vty, argv[0], NULL);
2969}
2970
2971DEFUN (neighbor_ebgp_multihop_ttl,
2972 neighbor_ebgp_multihop_ttl_cmd,
2973 NEIGHBOR_CMD2 "ebgp-multihop <1-255>",
2974 NEIGHBOR_STR
2975 NEIGHBOR_ADDR_STR2
2976 "Allow EBGP neighbors not on directly connected networks\n"
2977 "maximum hop count\n")
2978{
2979 return peer_ebgp_multihop_set_vty (vty, argv[0], argv[1]);
2980}
2981
2982DEFUN (no_neighbor_ebgp_multihop,
2983 no_neighbor_ebgp_multihop_cmd,
2984 NO_NEIGHBOR_CMD2 "ebgp-multihop",
2985 NO_STR
2986 NEIGHBOR_STR
2987 NEIGHBOR_ADDR_STR2
2988 "Allow EBGP neighbors not on directly connected networks\n")
2989{
2990 return peer_ebgp_multihop_unset_vty (vty, argv[0]);
2991}
2992
2993ALIAS (no_neighbor_ebgp_multihop,
2994 no_neighbor_ebgp_multihop_ttl_cmd,
2995 NO_NEIGHBOR_CMD2 "ebgp-multihop <1-255>",
2996 NO_STR
2997 NEIGHBOR_STR
2998 NEIGHBOR_ADDR_STR2
2999 "Allow EBGP neighbors not on directly connected networks\n"
3000 "maximum hop count\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003001
hasso6ffd2072005-02-02 14:50:11 +00003002/* disable-connected-check */
3003DEFUN (neighbor_disable_connected_check,
3004 neighbor_disable_connected_check_cmd,
3005 NEIGHBOR_CMD2 "disable-connected-check",
3006 NEIGHBOR_STR
3007 NEIGHBOR_ADDR_STR2
3008 "one-hop away EBGP peer using loopback address\n")
3009{
3010 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK);
3011}
3012
3013DEFUN (no_neighbor_disable_connected_check,
3014 no_neighbor_disable_connected_check_cmd,
3015 NO_NEIGHBOR_CMD2 "disable-connected-check",
3016 NO_STR
3017 NEIGHBOR_STR
3018 NEIGHBOR_ADDR_STR2
3019 "one-hop away EBGP peer using loopback address\n")
3020{
3021 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK);
3022}
3023
paul718e3742002-12-13 20:15:29 +00003024/* Enforce multihop. */
hasso6ffd2072005-02-02 14:50:11 +00003025ALIAS (neighbor_disable_connected_check,
paul718e3742002-12-13 20:15:29 +00003026 neighbor_enforce_multihop_cmd,
3027 NEIGHBOR_CMD2 "enforce-multihop",
3028 NEIGHBOR_STR
3029 NEIGHBOR_ADDR_STR2
paule8e19462006-01-19 20:16:55 +00003030 "Enforce EBGP neighbors perform multihop\n")
paul718e3742002-12-13 20:15:29 +00003031
hasso6ffd2072005-02-02 14:50:11 +00003032/* Enforce multihop. */
3033ALIAS (no_neighbor_disable_connected_check,
paul718e3742002-12-13 20:15:29 +00003034 no_neighbor_enforce_multihop_cmd,
3035 NO_NEIGHBOR_CMD2 "enforce-multihop",
3036 NO_STR
3037 NEIGHBOR_STR
3038 NEIGHBOR_ADDR_STR2
paule8e19462006-01-19 20:16:55 +00003039 "Enforce EBGP neighbors perform multihop\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003040
paul718e3742002-12-13 20:15:29 +00003041DEFUN (neighbor_description,
3042 neighbor_description_cmd,
3043 NEIGHBOR_CMD2 "description .LINE",
3044 NEIGHBOR_STR
3045 NEIGHBOR_ADDR_STR2
3046 "Neighbor specific description\n"
3047 "Up to 80 characters describing this neighbor\n")
3048{
3049 struct peer *peer;
paul718e3742002-12-13 20:15:29 +00003050 char *str;
paul718e3742002-12-13 20:15:29 +00003051
3052 peer = peer_and_group_lookup_vty (vty, argv[0]);
3053 if (! peer)
3054 return CMD_WARNING;
3055
3056 if (argc == 1)
3057 return CMD_SUCCESS;
3058
ajs3b8b1852005-01-29 18:19:13 +00003059 str = argv_concat(argv, argc, 1);
paul718e3742002-12-13 20:15:29 +00003060
3061 peer_description_set (peer, str);
3062
ajs3b8b1852005-01-29 18:19:13 +00003063 XFREE (MTYPE_TMP, str);
paul718e3742002-12-13 20:15:29 +00003064
3065 return CMD_SUCCESS;
3066}
3067
3068DEFUN (no_neighbor_description,
3069 no_neighbor_description_cmd,
3070 NO_NEIGHBOR_CMD2 "description",
3071 NO_STR
3072 NEIGHBOR_STR
3073 NEIGHBOR_ADDR_STR2
3074 "Neighbor specific description\n")
3075{
3076 struct peer *peer;
3077
3078 peer = peer_and_group_lookup_vty (vty, argv[0]);
3079 if (! peer)
3080 return CMD_WARNING;
3081
3082 peer_description_unset (peer);
3083
3084 return CMD_SUCCESS;
3085}
3086
3087ALIAS (no_neighbor_description,
3088 no_neighbor_description_val_cmd,
3089 NO_NEIGHBOR_CMD2 "description .LINE",
3090 NO_STR
3091 NEIGHBOR_STR
3092 NEIGHBOR_ADDR_STR2
3093 "Neighbor specific description\n"
3094 "Up to 80 characters describing this neighbor\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003095
paul718e3742002-12-13 20:15:29 +00003096/* Neighbor update-source. */
paul94f2b392005-06-28 12:44:16 +00003097static int
paulfd79ac92004-10-13 05:06:08 +00003098peer_update_source_vty (struct vty *vty, const char *peer_str,
3099 const char *source_str)
paul718e3742002-12-13 20:15:29 +00003100{
3101 struct peer *peer;
paul718e3742002-12-13 20:15:29 +00003102
3103 peer = peer_and_group_lookup_vty (vty, peer_str);
3104 if (! peer)
3105 return CMD_WARNING;
3106
3107 if (source_str)
3108 {
Jorge Boncompte [DTI2]c63b83f2012-04-10 16:57:24 +02003109 union sockunion su;
3110 int ret = str2sockunion (source_str, &su);
3111
3112 if (ret == 0)
3113 peer_update_source_addr_set (peer, &su);
paul718e3742002-12-13 20:15:29 +00003114 else
3115 peer_update_source_if_set (peer, source_str);
3116 }
3117 else
3118 peer_update_source_unset (peer);
3119
3120 return CMD_SUCCESS;
3121}
3122
Paul Jakma9a1a3312009-07-27 12:27:55 +01003123#define BGP_UPDATE_SOURCE_STR "(A.B.C.D|X:X::X:X|WORD)"
Paul Jakma369688c2006-05-23 22:27:55 +00003124#define BGP_UPDATE_SOURCE_HELP_STR \
3125 "IPv4 address\n" \
Paul Jakma9a1a3312009-07-27 12:27:55 +01003126 "IPv6 address\n" \
3127 "Interface name (requires zebra to be running)\n"
Paul Jakma369688c2006-05-23 22:27:55 +00003128
paul718e3742002-12-13 20:15:29 +00003129DEFUN (neighbor_update_source,
3130 neighbor_update_source_cmd,
Paul Jakma369688c2006-05-23 22:27:55 +00003131 NEIGHBOR_CMD2 "update-source " BGP_UPDATE_SOURCE_STR,
paul718e3742002-12-13 20:15:29 +00003132 NEIGHBOR_STR
3133 NEIGHBOR_ADDR_STR2
3134 "Source of routing updates\n"
Paul Jakma369688c2006-05-23 22:27:55 +00003135 BGP_UPDATE_SOURCE_HELP_STR)
paul718e3742002-12-13 20:15:29 +00003136{
3137 return peer_update_source_vty (vty, argv[0], argv[1]);
3138}
3139
3140DEFUN (no_neighbor_update_source,
3141 no_neighbor_update_source_cmd,
3142 NO_NEIGHBOR_CMD2 "update-source",
3143 NO_STR
3144 NEIGHBOR_STR
3145 NEIGHBOR_ADDR_STR2
Paul Jakma369688c2006-05-23 22:27:55 +00003146 "Source of routing updates\n")
paul718e3742002-12-13 20:15:29 +00003147{
3148 return peer_update_source_vty (vty, argv[0], NULL);
3149}
David Lamparter6b0655a2014-06-04 06:53:35 +02003150
paul94f2b392005-06-28 12:44:16 +00003151static int
paulfd79ac92004-10-13 05:06:08 +00003152peer_default_originate_set_vty (struct vty *vty, const char *peer_str,
3153 afi_t afi, safi_t safi,
3154 const char *rmap, int set)
paul718e3742002-12-13 20:15:29 +00003155{
3156 int ret;
3157 struct peer *peer;
3158
3159 peer = peer_and_group_lookup_vty (vty, peer_str);
3160 if (! peer)
3161 return CMD_WARNING;
3162
3163 if (set)
3164 ret = peer_default_originate_set (peer, afi, safi, rmap);
3165 else
3166 ret = peer_default_originate_unset (peer, afi, safi);
3167
3168 return bgp_vty_return (vty, ret);
3169}
3170
3171/* neighbor default-originate. */
3172DEFUN (neighbor_default_originate,
3173 neighbor_default_originate_cmd,
3174 NEIGHBOR_CMD2 "default-originate",
3175 NEIGHBOR_STR
3176 NEIGHBOR_ADDR_STR2
3177 "Originate default route to this neighbor\n")
3178{
3179 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
3180 bgp_node_safi (vty), NULL, 1);
3181}
3182
3183DEFUN (neighbor_default_originate_rmap,
3184 neighbor_default_originate_rmap_cmd,
3185 NEIGHBOR_CMD2 "default-originate route-map WORD",
3186 NEIGHBOR_STR
3187 NEIGHBOR_ADDR_STR2
3188 "Originate default route to this neighbor\n"
3189 "Route-map to specify criteria to originate default\n"
3190 "route-map name\n")
3191{
3192 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
3193 bgp_node_safi (vty), argv[1], 1);
3194}
3195
3196DEFUN (no_neighbor_default_originate,
3197 no_neighbor_default_originate_cmd,
3198 NO_NEIGHBOR_CMD2 "default-originate",
3199 NO_STR
3200 NEIGHBOR_STR
3201 NEIGHBOR_ADDR_STR2
3202 "Originate default route to this neighbor\n")
3203{
3204 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
3205 bgp_node_safi (vty), NULL, 0);
3206}
3207
3208ALIAS (no_neighbor_default_originate,
3209 no_neighbor_default_originate_rmap_cmd,
3210 NO_NEIGHBOR_CMD2 "default-originate route-map WORD",
3211 NO_STR
3212 NEIGHBOR_STR
3213 NEIGHBOR_ADDR_STR2
3214 "Originate default route to this neighbor\n"
3215 "Route-map to specify criteria to originate default\n"
3216 "route-map name\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003217
paul718e3742002-12-13 20:15:29 +00003218/* Set neighbor's BGP port. */
paul94f2b392005-06-28 12:44:16 +00003219static int
paulfd79ac92004-10-13 05:06:08 +00003220peer_port_vty (struct vty *vty, const char *ip_str, int afi,
3221 const char *port_str)
paul718e3742002-12-13 20:15:29 +00003222{
3223 struct peer *peer;
3224 u_int16_t port;
3225 struct servent *sp;
3226
3227 peer = peer_lookup_vty (vty, ip_str);
3228 if (! peer)
3229 return CMD_WARNING;
3230
3231 if (! port_str)
3232 {
3233 sp = getservbyname ("bgp", "tcp");
3234 port = (sp == NULL) ? BGP_PORT_DEFAULT : ntohs (sp->s_port);
3235 }
3236 else
3237 {
3238 VTY_GET_INTEGER("port", port, port_str);
3239 }
3240
3241 peer_port_set (peer, port);
3242
3243 return CMD_SUCCESS;
3244}
3245
hassof4184462005-02-01 20:13:16 +00003246/* Set specified peer's BGP port. */
paul718e3742002-12-13 20:15:29 +00003247DEFUN (neighbor_port,
3248 neighbor_port_cmd,
3249 NEIGHBOR_CMD "port <0-65535>",
3250 NEIGHBOR_STR
3251 NEIGHBOR_ADDR_STR
3252 "Neighbor's BGP port\n"
3253 "TCP port number\n")
3254{
3255 return peer_port_vty (vty, argv[0], AFI_IP, argv[1]);
3256}
3257
3258DEFUN (no_neighbor_port,
3259 no_neighbor_port_cmd,
3260 NO_NEIGHBOR_CMD "port",
3261 NO_STR
3262 NEIGHBOR_STR
3263 NEIGHBOR_ADDR_STR
3264 "Neighbor's BGP port\n")
3265{
3266 return peer_port_vty (vty, argv[0], AFI_IP, NULL);
3267}
3268
3269ALIAS (no_neighbor_port,
3270 no_neighbor_port_val_cmd,
3271 NO_NEIGHBOR_CMD "port <0-65535>",
3272 NO_STR
3273 NEIGHBOR_STR
3274 NEIGHBOR_ADDR_STR
3275 "Neighbor's BGP port\n"
3276 "TCP port number\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003277
paul718e3742002-12-13 20:15:29 +00003278/* neighbor weight. */
paul94f2b392005-06-28 12:44:16 +00003279static int
paulfd79ac92004-10-13 05:06:08 +00003280peer_weight_set_vty (struct vty *vty, const char *ip_str,
3281 const char *weight_str)
paul718e3742002-12-13 20:15:29 +00003282{
paul718e3742002-12-13 20:15:29 +00003283 struct peer *peer;
3284 unsigned long weight;
3285
3286 peer = peer_and_group_lookup_vty (vty, ip_str);
3287 if (! peer)
3288 return CMD_WARNING;
3289
3290 VTY_GET_INTEGER_RANGE("weight", weight, weight_str, 0, 65535);
3291
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003292 return bgp_vty_return (vty, peer_weight_set (peer, weight));
paul718e3742002-12-13 20:15:29 +00003293}
3294
paul94f2b392005-06-28 12:44:16 +00003295static int
paulfd79ac92004-10-13 05:06:08 +00003296peer_weight_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00003297{
3298 struct peer *peer;
3299
3300 peer = peer_and_group_lookup_vty (vty, ip_str);
3301 if (! peer)
3302 return CMD_WARNING;
3303
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003304 return bgp_vty_return (vty, peer_weight_unset (peer));
paul718e3742002-12-13 20:15:29 +00003305}
3306
3307DEFUN (neighbor_weight,
3308 neighbor_weight_cmd,
3309 NEIGHBOR_CMD2 "weight <0-65535>",
3310 NEIGHBOR_STR
3311 NEIGHBOR_ADDR_STR2
3312 "Set default weight for routes from this neighbor\n"
3313 "default weight\n")
3314{
3315 return peer_weight_set_vty (vty, argv[0], argv[1]);
3316}
3317
3318DEFUN (no_neighbor_weight,
3319 no_neighbor_weight_cmd,
3320 NO_NEIGHBOR_CMD2 "weight",
3321 NO_STR
3322 NEIGHBOR_STR
3323 NEIGHBOR_ADDR_STR2
3324 "Set default weight for routes from this neighbor\n")
3325{
3326 return peer_weight_unset_vty (vty, argv[0]);
3327}
3328
3329ALIAS (no_neighbor_weight,
3330 no_neighbor_weight_val_cmd,
3331 NO_NEIGHBOR_CMD2 "weight <0-65535>",
3332 NO_STR
3333 NEIGHBOR_STR
3334 NEIGHBOR_ADDR_STR2
3335 "Set default weight for routes from this neighbor\n"
3336 "default weight\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003337
paul718e3742002-12-13 20:15:29 +00003338/* Override capability negotiation. */
3339DEFUN (neighbor_override_capability,
3340 neighbor_override_capability_cmd,
3341 NEIGHBOR_CMD2 "override-capability",
3342 NEIGHBOR_STR
3343 NEIGHBOR_ADDR_STR2
3344 "Override capability negotiation result\n")
3345{
3346 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY);
3347}
3348
3349DEFUN (no_neighbor_override_capability,
3350 no_neighbor_override_capability_cmd,
3351 NO_NEIGHBOR_CMD2 "override-capability",
3352 NO_STR
3353 NEIGHBOR_STR
3354 NEIGHBOR_ADDR_STR2
3355 "Override capability negotiation result\n")
3356{
3357 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY);
3358}
David Lamparter6b0655a2014-06-04 06:53:35 +02003359
paul718e3742002-12-13 20:15:29 +00003360DEFUN (neighbor_strict_capability,
3361 neighbor_strict_capability_cmd,
3362 NEIGHBOR_CMD "strict-capability-match",
3363 NEIGHBOR_STR
3364 NEIGHBOR_ADDR_STR
3365 "Strict capability negotiation match\n")
3366{
3367 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH);
3368}
3369
3370DEFUN (no_neighbor_strict_capability,
3371 no_neighbor_strict_capability_cmd,
3372 NO_NEIGHBOR_CMD "strict-capability-match",
3373 NO_STR
3374 NEIGHBOR_STR
3375 NEIGHBOR_ADDR_STR
3376 "Strict capability negotiation match\n")
3377{
3378 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH);
3379}
David Lamparter6b0655a2014-06-04 06:53:35 +02003380
paul94f2b392005-06-28 12:44:16 +00003381static int
paulfd79ac92004-10-13 05:06:08 +00003382peer_timers_set_vty (struct vty *vty, const char *ip_str,
3383 const char *keep_str, const char *hold_str)
paul718e3742002-12-13 20:15:29 +00003384{
3385 int ret;
3386 struct peer *peer;
3387 u_int32_t keepalive;
3388 u_int32_t holdtime;
3389
3390 peer = peer_and_group_lookup_vty (vty, ip_str);
3391 if (! peer)
3392 return CMD_WARNING;
3393
3394 VTY_GET_INTEGER_RANGE ("Keepalive", keepalive, keep_str, 0, 65535);
3395 VTY_GET_INTEGER_RANGE ("Holdtime", holdtime, hold_str, 0, 65535);
3396
3397 ret = peer_timers_set (peer, keepalive, holdtime);
3398
3399 return bgp_vty_return (vty, ret);
3400}
David Lamparter6b0655a2014-06-04 06:53:35 +02003401
paul94f2b392005-06-28 12:44:16 +00003402static int
paulfd79ac92004-10-13 05:06:08 +00003403peer_timers_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00003404{
3405 int ret;
3406 struct peer *peer;
3407
3408 peer = peer_lookup_vty (vty, ip_str);
3409 if (! peer)
3410 return CMD_WARNING;
3411
3412 ret = peer_timers_unset (peer);
3413
3414 return bgp_vty_return (vty, ret);
3415}
3416
3417DEFUN (neighbor_timers,
3418 neighbor_timers_cmd,
3419 NEIGHBOR_CMD2 "timers <0-65535> <0-65535>",
3420 NEIGHBOR_STR
3421 NEIGHBOR_ADDR_STR2
3422 "BGP per neighbor timers\n"
3423 "Keepalive interval\n"
3424 "Holdtime\n")
3425{
3426 return peer_timers_set_vty (vty, argv[0], argv[1], argv[2]);
3427}
3428
3429DEFUN (no_neighbor_timers,
3430 no_neighbor_timers_cmd,
3431 NO_NEIGHBOR_CMD2 "timers",
3432 NO_STR
3433 NEIGHBOR_STR
3434 NEIGHBOR_ADDR_STR2
3435 "BGP per neighbor timers\n")
3436{
3437 return peer_timers_unset_vty (vty, argv[0]);
3438}
David Lamparter6b0655a2014-06-04 06:53:35 +02003439
paul94f2b392005-06-28 12:44:16 +00003440static int
paulfd79ac92004-10-13 05:06:08 +00003441peer_timers_connect_set_vty (struct vty *vty, const char *ip_str,
3442 const char *time_str)
paul718e3742002-12-13 20:15:29 +00003443{
paul718e3742002-12-13 20:15:29 +00003444 struct peer *peer;
3445 u_int32_t connect;
3446
Daniel Walton0d7435f2015-10-22 11:35:20 +03003447 peer = peer_and_group_lookup_vty (vty, ip_str);
paul718e3742002-12-13 20:15:29 +00003448 if (! peer)
3449 return CMD_WARNING;
3450
3451 VTY_GET_INTEGER_RANGE ("Connect time", connect, time_str, 0, 65535);
3452
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003453 return bgp_vty_return (vty, peer_timers_connect_set (peer, connect));
paul718e3742002-12-13 20:15:29 +00003454}
3455
paul94f2b392005-06-28 12:44:16 +00003456static int
paulfd79ac92004-10-13 05:06:08 +00003457peer_timers_connect_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00003458{
paul718e3742002-12-13 20:15:29 +00003459 struct peer *peer;
3460
3461 peer = peer_and_group_lookup_vty (vty, ip_str);
3462 if (! peer)
3463 return CMD_WARNING;
3464
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003465 return bgp_vty_return (vty, peer_timers_connect_unset (peer));
paul718e3742002-12-13 20:15:29 +00003466}
3467
3468DEFUN (neighbor_timers_connect,
3469 neighbor_timers_connect_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003470 NEIGHBOR_CMD2 "timers connect <1-65535>",
paul718e3742002-12-13 20:15:29 +00003471 NEIGHBOR_STR
Daniel Walton0d7435f2015-10-22 11:35:20 +03003472 NEIGHBOR_ADDR_STR2
paul718e3742002-12-13 20:15:29 +00003473 "BGP per neighbor timers\n"
3474 "BGP connect timer\n"
3475 "Connect timer\n")
3476{
3477 return peer_timers_connect_set_vty (vty, argv[0], argv[1]);
3478}
3479
3480DEFUN (no_neighbor_timers_connect,
3481 no_neighbor_timers_connect_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003482 NO_NEIGHBOR_CMD2 "timers connect",
paul718e3742002-12-13 20:15:29 +00003483 NO_STR
3484 NEIGHBOR_STR
Daniel Walton0d7435f2015-10-22 11:35:20 +03003485 NEIGHBOR_ADDR_STR2
paul718e3742002-12-13 20:15:29 +00003486 "BGP per neighbor timers\n"
3487 "BGP connect timer\n")
3488{
3489 return peer_timers_connect_unset_vty (vty, argv[0]);
3490}
3491
3492ALIAS (no_neighbor_timers_connect,
3493 no_neighbor_timers_connect_val_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003494 NO_NEIGHBOR_CMD2 "timers connect <1-65535>",
paul718e3742002-12-13 20:15:29 +00003495 NO_STR
3496 NEIGHBOR_STR
Daniel Walton0d7435f2015-10-22 11:35:20 +03003497 NEIGHBOR_ADDR_STR2
paul718e3742002-12-13 20:15:29 +00003498 "BGP per neighbor timers\n"
3499 "BGP connect timer\n"
3500 "Connect timer\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003501
paul94f2b392005-06-28 12:44:16 +00003502static int
paulfd79ac92004-10-13 05:06:08 +00003503peer_advertise_interval_vty (struct vty *vty, const char *ip_str,
3504 const char *time_str, int set)
paul718e3742002-12-13 20:15:29 +00003505{
3506 int ret;
3507 struct peer *peer;
3508 u_int32_t routeadv = 0;
3509
Daniel Walton0d7435f2015-10-22 11:35:20 +03003510 peer = peer_and_group_lookup_vty (vty, ip_str);
paul718e3742002-12-13 20:15:29 +00003511 if (! peer)
3512 return CMD_WARNING;
3513
3514 if (time_str)
3515 VTY_GET_INTEGER_RANGE ("advertise interval", routeadv, time_str, 0, 600);
3516
3517 if (set)
3518 ret = peer_advertise_interval_set (peer, routeadv);
3519 else
3520 ret = peer_advertise_interval_unset (peer);
3521
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003522 return bgp_vty_return (vty, ret);
paul718e3742002-12-13 20:15:29 +00003523}
3524
3525DEFUN (neighbor_advertise_interval,
3526 neighbor_advertise_interval_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003527 NEIGHBOR_CMD2 "advertisement-interval <0-600>",
paul718e3742002-12-13 20:15:29 +00003528 NEIGHBOR_STR
Daniel Walton0d7435f2015-10-22 11:35:20 +03003529 NEIGHBOR_ADDR_STR2
paul718e3742002-12-13 20:15:29 +00003530 "Minimum interval between sending BGP routing updates\n"
3531 "time in seconds\n")
3532{
3533 return peer_advertise_interval_vty (vty, argv[0], argv[1], 1);
3534}
3535
3536DEFUN (no_neighbor_advertise_interval,
3537 no_neighbor_advertise_interval_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003538 NO_NEIGHBOR_CMD2 "advertisement-interval",
paul718e3742002-12-13 20:15:29 +00003539 NO_STR
3540 NEIGHBOR_STR
Daniel Walton0d7435f2015-10-22 11:35:20 +03003541 NEIGHBOR_ADDR_STR2
paul718e3742002-12-13 20:15:29 +00003542 "Minimum interval between sending BGP routing updates\n")
3543{
3544 return peer_advertise_interval_vty (vty, argv[0], NULL, 0);
3545}
3546
3547ALIAS (no_neighbor_advertise_interval,
3548 no_neighbor_advertise_interval_val_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003549 NO_NEIGHBOR_CMD2 "advertisement-interval <0-600>",
paul718e3742002-12-13 20:15:29 +00003550 NO_STR
3551 NEIGHBOR_STR
Daniel Walton0d7435f2015-10-22 11:35:20 +03003552 NEIGHBOR_ADDR_STR2
paul718e3742002-12-13 20:15:29 +00003553 "Minimum interval between sending BGP routing updates\n"
3554 "time in seconds\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003555
paul718e3742002-12-13 20:15:29 +00003556/* neighbor interface */
paul94f2b392005-06-28 12:44:16 +00003557static int
paulfd79ac92004-10-13 05:06:08 +00003558peer_interface_vty (struct vty *vty, const char *ip_str, const char *str)
paul718e3742002-12-13 20:15:29 +00003559{
3560 int ret;
3561 struct peer *peer;
3562
3563 peer = peer_lookup_vty (vty, ip_str);
3564 if (! peer)
3565 return CMD_WARNING;
3566
3567 if (str)
3568 ret = peer_interface_set (peer, str);
3569 else
3570 ret = peer_interface_unset (peer);
3571
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003572 return bgp_vty_return (vty, ret);
paul718e3742002-12-13 20:15:29 +00003573}
3574
3575DEFUN (neighbor_interface,
3576 neighbor_interface_cmd,
3577 NEIGHBOR_CMD "interface WORD",
3578 NEIGHBOR_STR
3579 NEIGHBOR_ADDR_STR
3580 "Interface\n"
3581 "Interface name\n")
3582{
3583 return peer_interface_vty (vty, argv[0], argv[1]);
3584}
3585
3586DEFUN (no_neighbor_interface,
3587 no_neighbor_interface_cmd,
3588 NO_NEIGHBOR_CMD "interface WORD",
3589 NO_STR
3590 NEIGHBOR_STR
3591 NEIGHBOR_ADDR_STR
3592 "Interface\n"
3593 "Interface name\n")
3594{
3595 return peer_interface_vty (vty, argv[0], NULL);
3596}
David Lamparter6b0655a2014-06-04 06:53:35 +02003597
paul718e3742002-12-13 20:15:29 +00003598/* Set distribute list to the peer. */
paul94f2b392005-06-28 12:44:16 +00003599static int
paulfd79ac92004-10-13 05:06:08 +00003600peer_distribute_set_vty (struct vty *vty, const char *ip_str,
3601 afi_t afi, safi_t safi,
3602 const char *name_str, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003603{
3604 int ret;
3605 struct peer *peer;
3606 int direct = FILTER_IN;
3607
3608 peer = peer_and_group_lookup_vty (vty, ip_str);
3609 if (! peer)
3610 return CMD_WARNING;
3611
3612 /* Check filter direction. */
3613 if (strncmp (direct_str, "i", 1) == 0)
3614 direct = FILTER_IN;
3615 else if (strncmp (direct_str, "o", 1) == 0)
3616 direct = FILTER_OUT;
3617
3618 ret = peer_distribute_set (peer, afi, safi, direct, name_str);
3619
3620 return bgp_vty_return (vty, ret);
3621}
3622
paul94f2b392005-06-28 12:44:16 +00003623static int
paulfd79ac92004-10-13 05:06:08 +00003624peer_distribute_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
3625 safi_t safi, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003626{
3627 int ret;
3628 struct peer *peer;
3629 int direct = FILTER_IN;
3630
3631 peer = peer_and_group_lookup_vty (vty, ip_str);
3632 if (! peer)
3633 return CMD_WARNING;
3634
3635 /* Check filter direction. */
3636 if (strncmp (direct_str, "i", 1) == 0)
3637 direct = FILTER_IN;
3638 else if (strncmp (direct_str, "o", 1) == 0)
3639 direct = FILTER_OUT;
3640
3641 ret = peer_distribute_unset (peer, afi, safi, direct);
3642
3643 return bgp_vty_return (vty, ret);
3644}
3645
3646DEFUN (neighbor_distribute_list,
3647 neighbor_distribute_list_cmd,
3648 NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)",
3649 NEIGHBOR_STR
3650 NEIGHBOR_ADDR_STR2
3651 "Filter updates to/from this neighbor\n"
3652 "IP access-list number\n"
3653 "IP access-list number (expanded range)\n"
3654 "IP Access-list name\n"
3655 "Filter incoming updates\n"
3656 "Filter outgoing updates\n")
3657{
3658 return peer_distribute_set_vty (vty, argv[0], bgp_node_afi (vty),
3659 bgp_node_safi (vty), argv[1], argv[2]);
3660}
3661
3662DEFUN (no_neighbor_distribute_list,
3663 no_neighbor_distribute_list_cmd,
3664 NO_NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)",
3665 NO_STR
3666 NEIGHBOR_STR
3667 NEIGHBOR_ADDR_STR2
3668 "Filter updates to/from this neighbor\n"
3669 "IP access-list number\n"
3670 "IP access-list number (expanded range)\n"
3671 "IP Access-list name\n"
3672 "Filter incoming updates\n"
3673 "Filter outgoing updates\n")
3674{
3675 return peer_distribute_unset_vty (vty, argv[0], bgp_node_afi (vty),
3676 bgp_node_safi (vty), argv[2]);
3677}
David Lamparter6b0655a2014-06-04 06:53:35 +02003678
paul718e3742002-12-13 20:15:29 +00003679/* Set prefix list to the peer. */
paul94f2b392005-06-28 12:44:16 +00003680static int
paulfd79ac92004-10-13 05:06:08 +00003681peer_prefix_list_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
3682 safi_t safi, const char *name_str,
3683 const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003684{
3685 int ret;
3686 struct peer *peer;
3687 int direct = FILTER_IN;
3688
3689 peer = peer_and_group_lookup_vty (vty, ip_str);
3690 if (! peer)
3691 return CMD_WARNING;
3692
3693 /* Check filter direction. */
3694 if (strncmp (direct_str, "i", 1) == 0)
3695 direct = FILTER_IN;
3696 else if (strncmp (direct_str, "o", 1) == 0)
3697 direct = FILTER_OUT;
3698
3699 ret = peer_prefix_list_set (peer, afi, safi, direct, name_str);
3700
3701 return bgp_vty_return (vty, ret);
3702}
3703
paul94f2b392005-06-28 12:44:16 +00003704static int
paulfd79ac92004-10-13 05:06:08 +00003705peer_prefix_list_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
3706 safi_t safi, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003707{
3708 int ret;
3709 struct peer *peer;
3710 int direct = FILTER_IN;
3711
3712 peer = peer_and_group_lookup_vty (vty, ip_str);
3713 if (! peer)
3714 return CMD_WARNING;
3715
3716 /* Check filter direction. */
3717 if (strncmp (direct_str, "i", 1) == 0)
3718 direct = FILTER_IN;
3719 else if (strncmp (direct_str, "o", 1) == 0)
3720 direct = FILTER_OUT;
3721
3722 ret = peer_prefix_list_unset (peer, afi, safi, direct);
3723
3724 return bgp_vty_return (vty, ret);
3725}
3726
3727DEFUN (neighbor_prefix_list,
3728 neighbor_prefix_list_cmd,
3729 NEIGHBOR_CMD2 "prefix-list WORD (in|out)",
3730 NEIGHBOR_STR
3731 NEIGHBOR_ADDR_STR2
3732 "Filter updates to/from this neighbor\n"
3733 "Name of a prefix list\n"
3734 "Filter incoming updates\n"
3735 "Filter outgoing updates\n")
3736{
3737 return peer_prefix_list_set_vty (vty, argv[0], bgp_node_afi (vty),
3738 bgp_node_safi (vty), argv[1], argv[2]);
3739}
3740
3741DEFUN (no_neighbor_prefix_list,
3742 no_neighbor_prefix_list_cmd,
3743 NO_NEIGHBOR_CMD2 "prefix-list WORD (in|out)",
3744 NO_STR
3745 NEIGHBOR_STR
3746 NEIGHBOR_ADDR_STR2
3747 "Filter updates to/from this neighbor\n"
3748 "Name of a prefix list\n"
3749 "Filter incoming updates\n"
3750 "Filter outgoing updates\n")
3751{
3752 return peer_prefix_list_unset_vty (vty, argv[0], bgp_node_afi (vty),
3753 bgp_node_safi (vty), argv[2]);
3754}
David Lamparter6b0655a2014-06-04 06:53:35 +02003755
paul94f2b392005-06-28 12:44:16 +00003756static int
paulfd79ac92004-10-13 05:06:08 +00003757peer_aslist_set_vty (struct vty *vty, const char *ip_str,
3758 afi_t afi, safi_t safi,
3759 const char *name_str, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003760{
3761 int ret;
3762 struct peer *peer;
3763 int direct = FILTER_IN;
3764
3765 peer = peer_and_group_lookup_vty (vty, ip_str);
3766 if (! peer)
3767 return CMD_WARNING;
3768
3769 /* Check filter direction. */
3770 if (strncmp (direct_str, "i", 1) == 0)
3771 direct = FILTER_IN;
3772 else if (strncmp (direct_str, "o", 1) == 0)
3773 direct = FILTER_OUT;
3774
3775 ret = peer_aslist_set (peer, afi, safi, direct, name_str);
3776
3777 return bgp_vty_return (vty, ret);
3778}
3779
paul94f2b392005-06-28 12:44:16 +00003780static int
paulfd79ac92004-10-13 05:06:08 +00003781peer_aslist_unset_vty (struct vty *vty, const char *ip_str,
3782 afi_t afi, safi_t safi,
3783 const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003784{
3785 int ret;
3786 struct peer *peer;
3787 int direct = FILTER_IN;
3788
3789 peer = peer_and_group_lookup_vty (vty, ip_str);
3790 if (! peer)
3791 return CMD_WARNING;
3792
3793 /* Check filter direction. */
3794 if (strncmp (direct_str, "i", 1) == 0)
3795 direct = FILTER_IN;
3796 else if (strncmp (direct_str, "o", 1) == 0)
3797 direct = FILTER_OUT;
3798
3799 ret = peer_aslist_unset (peer, afi, safi, direct);
3800
3801 return bgp_vty_return (vty, ret);
3802}
3803
3804DEFUN (neighbor_filter_list,
3805 neighbor_filter_list_cmd,
3806 NEIGHBOR_CMD2 "filter-list WORD (in|out)",
3807 NEIGHBOR_STR
3808 NEIGHBOR_ADDR_STR2
3809 "Establish BGP filters\n"
3810 "AS path access-list name\n"
3811 "Filter incoming routes\n"
3812 "Filter outgoing routes\n")
3813{
3814 return peer_aslist_set_vty (vty, argv[0], bgp_node_afi (vty),
3815 bgp_node_safi (vty), argv[1], argv[2]);
3816}
3817
3818DEFUN (no_neighbor_filter_list,
3819 no_neighbor_filter_list_cmd,
3820 NO_NEIGHBOR_CMD2 "filter-list WORD (in|out)",
3821 NO_STR
3822 NEIGHBOR_STR
3823 NEIGHBOR_ADDR_STR2
3824 "Establish BGP filters\n"
3825 "AS path access-list name\n"
3826 "Filter incoming routes\n"
3827 "Filter outgoing routes\n")
3828{
3829 return peer_aslist_unset_vty (vty, argv[0], bgp_node_afi (vty),
3830 bgp_node_safi (vty), argv[2]);
3831}
David Lamparter6b0655a2014-06-04 06:53:35 +02003832
paul718e3742002-12-13 20:15:29 +00003833/* Set route-map to the peer. */
paul94f2b392005-06-28 12:44:16 +00003834static int
paulfd79ac92004-10-13 05:06:08 +00003835peer_route_map_set_vty (struct vty *vty, const char *ip_str,
3836 afi_t afi, safi_t safi,
3837 const char *name_str, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003838{
3839 int ret;
3840 struct peer *peer;
paulfee0f4c2004-09-13 05:12:46 +00003841 int direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003842
3843 peer = peer_and_group_lookup_vty (vty, ip_str);
3844 if (! peer)
3845 return CMD_WARNING;
3846
3847 /* Check filter direction. */
paulfee0f4c2004-09-13 05:12:46 +00003848 if (strncmp (direct_str, "in", 2) == 0)
3849 direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003850 else if (strncmp (direct_str, "o", 1) == 0)
paulfee0f4c2004-09-13 05:12:46 +00003851 direct = RMAP_OUT;
3852 else if (strncmp (direct_str, "im", 2) == 0)
3853 direct = RMAP_IMPORT;
3854 else if (strncmp (direct_str, "e", 1) == 0)
3855 direct = RMAP_EXPORT;
paul718e3742002-12-13 20:15:29 +00003856
3857 ret = peer_route_map_set (peer, afi, safi, direct, name_str);
3858
3859 return bgp_vty_return (vty, ret);
3860}
3861
paul94f2b392005-06-28 12:44:16 +00003862static int
paulfd79ac92004-10-13 05:06:08 +00003863peer_route_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
3864 safi_t safi, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003865{
3866 int ret;
3867 struct peer *peer;
paulfee0f4c2004-09-13 05:12:46 +00003868 int direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003869
3870 peer = peer_and_group_lookup_vty (vty, ip_str);
3871 if (! peer)
3872 return CMD_WARNING;
3873
3874 /* Check filter direction. */
paulfee0f4c2004-09-13 05:12:46 +00003875 if (strncmp (direct_str, "in", 2) == 0)
3876 direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003877 else if (strncmp (direct_str, "o", 1) == 0)
paulfee0f4c2004-09-13 05:12:46 +00003878 direct = RMAP_OUT;
3879 else if (strncmp (direct_str, "im", 2) == 0)
3880 direct = RMAP_IMPORT;
3881 else if (strncmp (direct_str, "e", 1) == 0)
3882 direct = RMAP_EXPORT;
paul718e3742002-12-13 20:15:29 +00003883
3884 ret = peer_route_map_unset (peer, afi, safi, direct);
3885
3886 return bgp_vty_return (vty, ret);
3887}
3888
3889DEFUN (neighbor_route_map,
3890 neighbor_route_map_cmd,
paulfee0f4c2004-09-13 05:12:46 +00003891 NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)",
paul718e3742002-12-13 20:15:29 +00003892 NEIGHBOR_STR
3893 NEIGHBOR_ADDR_STR2
3894 "Apply route map to neighbor\n"
3895 "Name of route map\n"
3896 "Apply map to incoming routes\n"
paulfee0f4c2004-09-13 05:12:46 +00003897 "Apply map to outbound routes\n"
3898 "Apply map to routes going into a Route-Server client's table\n"
3899 "Apply map to routes coming from a Route-Server client")
paul718e3742002-12-13 20:15:29 +00003900{
3901 return peer_route_map_set_vty (vty, argv[0], bgp_node_afi (vty),
3902 bgp_node_safi (vty), argv[1], argv[2]);
3903}
3904
3905DEFUN (no_neighbor_route_map,
3906 no_neighbor_route_map_cmd,
paulfee0f4c2004-09-13 05:12:46 +00003907 NO_NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)",
paul718e3742002-12-13 20:15:29 +00003908 NO_STR
3909 NEIGHBOR_STR
3910 NEIGHBOR_ADDR_STR2
3911 "Apply route map to neighbor\n"
3912 "Name of route map\n"
3913 "Apply map to incoming routes\n"
paulfee0f4c2004-09-13 05:12:46 +00003914 "Apply map to outbound routes\n"
3915 "Apply map to routes going into a Route-Server client's table\n"
3916 "Apply map to routes coming from a Route-Server client")
paul718e3742002-12-13 20:15:29 +00003917{
3918 return peer_route_map_unset_vty (vty, argv[0], bgp_node_afi (vty),
3919 bgp_node_safi (vty), argv[2]);
3920}
David Lamparter6b0655a2014-06-04 06:53:35 +02003921
paul718e3742002-12-13 20:15:29 +00003922/* Set unsuppress-map to the peer. */
paul94f2b392005-06-28 12:44:16 +00003923static int
paulfd79ac92004-10-13 05:06:08 +00003924peer_unsuppress_map_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
3925 safi_t safi, const char *name_str)
paul718e3742002-12-13 20:15:29 +00003926{
3927 int ret;
3928 struct peer *peer;
3929
3930 peer = peer_and_group_lookup_vty (vty, ip_str);
3931 if (! peer)
3932 return CMD_WARNING;
3933
3934 ret = peer_unsuppress_map_set (peer, afi, safi, name_str);
3935
3936 return bgp_vty_return (vty, ret);
3937}
3938
3939/* Unset route-map from the peer. */
paul94f2b392005-06-28 12:44:16 +00003940static int
paulfd79ac92004-10-13 05:06:08 +00003941peer_unsuppress_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
paul718e3742002-12-13 20:15:29 +00003942 safi_t safi)
3943{
3944 int ret;
3945 struct peer *peer;
3946
3947 peer = peer_and_group_lookup_vty (vty, ip_str);
3948 if (! peer)
3949 return CMD_WARNING;
3950
3951 ret = peer_unsuppress_map_unset (peer, afi, safi);
3952
3953 return bgp_vty_return (vty, ret);
3954}
3955
3956DEFUN (neighbor_unsuppress_map,
3957 neighbor_unsuppress_map_cmd,
3958 NEIGHBOR_CMD2 "unsuppress-map WORD",
3959 NEIGHBOR_STR
3960 NEIGHBOR_ADDR_STR2
3961 "Route-map to selectively unsuppress suppressed routes\n"
3962 "Name of route map\n")
3963{
3964 return peer_unsuppress_map_set_vty (vty, argv[0], bgp_node_afi (vty),
3965 bgp_node_safi (vty), argv[1]);
3966}
3967
3968DEFUN (no_neighbor_unsuppress_map,
3969 no_neighbor_unsuppress_map_cmd,
3970 NO_NEIGHBOR_CMD2 "unsuppress-map WORD",
3971 NO_STR
3972 NEIGHBOR_STR
3973 NEIGHBOR_ADDR_STR2
3974 "Route-map to selectively unsuppress suppressed routes\n"
3975 "Name of route map\n")
3976{
3977 return peer_unsuppress_map_unset_vty (vty, argv[0], bgp_node_afi (vty),
3978 bgp_node_safi (vty));
3979}
David Lamparter6b0655a2014-06-04 06:53:35 +02003980
paul94f2b392005-06-28 12:44:16 +00003981static int
paulfd79ac92004-10-13 05:06:08 +00003982peer_maximum_prefix_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
3983 safi_t safi, const char *num_str,
hasso0a486e52005-02-01 20:57:17 +00003984 const char *threshold_str, int warning,
3985 const char *restart_str)
paul718e3742002-12-13 20:15:29 +00003986{
3987 int ret;
3988 struct peer *peer;
3989 u_int32_t max;
hassoe0701b72004-05-20 09:19:34 +00003990 u_char threshold;
hasso0a486e52005-02-01 20:57:17 +00003991 u_int16_t restart;
paul718e3742002-12-13 20:15:29 +00003992
3993 peer = peer_and_group_lookup_vty (vty, ip_str);
3994 if (! peer)
3995 return CMD_WARNING;
3996
Denis Ovsienkoe6ec1c32011-09-10 21:50:53 +04003997 VTY_GET_INTEGER ("maximum number", max, num_str);
hassoe0701b72004-05-20 09:19:34 +00003998 if (threshold_str)
3999 threshold = atoi (threshold_str);
4000 else
4001 threshold = MAXIMUM_PREFIX_THRESHOLD_DEFAULT;
paul718e3742002-12-13 20:15:29 +00004002
hasso0a486e52005-02-01 20:57:17 +00004003 if (restart_str)
4004 restart = atoi (restart_str);
4005 else
4006 restart = 0;
4007
4008 ret = peer_maximum_prefix_set (peer, afi, safi, max, threshold, warning, restart);
paul718e3742002-12-13 20:15:29 +00004009
4010 return bgp_vty_return (vty, ret);
4011}
4012
paul94f2b392005-06-28 12:44:16 +00004013static int
paulfd79ac92004-10-13 05:06:08 +00004014peer_maximum_prefix_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
paul718e3742002-12-13 20:15:29 +00004015 safi_t safi)
4016{
4017 int ret;
4018 struct peer *peer;
4019
4020 peer = peer_and_group_lookup_vty (vty, ip_str);
4021 if (! peer)
4022 return CMD_WARNING;
4023
4024 ret = peer_maximum_prefix_unset (peer, afi, safi);
4025
4026 return bgp_vty_return (vty, ret);
4027}
4028
4029/* Maximum number of prefix configuration. prefix count is different
4030 for each peer configuration. So this configuration can be set for
4031 each peer configuration. */
4032DEFUN (neighbor_maximum_prefix,
4033 neighbor_maximum_prefix_cmd,
4034 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>",
4035 NEIGHBOR_STR
4036 NEIGHBOR_ADDR_STR2
4037 "Maximum number of prefix accept from this peer\n"
4038 "maximum no. of prefix limit\n")
4039{
4040 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00004041 bgp_node_safi (vty), argv[1], NULL, 0,
4042 NULL);
paul718e3742002-12-13 20:15:29 +00004043}
4044
hassoe0701b72004-05-20 09:19:34 +00004045DEFUN (neighbor_maximum_prefix_threshold,
4046 neighbor_maximum_prefix_threshold_cmd,
4047 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100>",
4048 NEIGHBOR_STR
4049 NEIGHBOR_ADDR_STR2
4050 "Maximum number of prefix accept from this peer\n"
4051 "maximum no. of prefix limit\n"
4052 "Threshold value (%) at which to generate a warning msg\n")
4053{
4054 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00004055 bgp_node_safi (vty), argv[1], argv[2], 0,
4056 NULL);
4057}
hassoe0701b72004-05-20 09:19:34 +00004058
paul718e3742002-12-13 20:15:29 +00004059DEFUN (neighbor_maximum_prefix_warning,
4060 neighbor_maximum_prefix_warning_cmd,
4061 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
4062 NEIGHBOR_STR
4063 NEIGHBOR_ADDR_STR2
4064 "Maximum number of prefix accept from this peer\n"
4065 "maximum no. of prefix limit\n"
4066 "Only give warning message when limit is exceeded\n")
4067{
4068 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00004069 bgp_node_safi (vty), argv[1], NULL, 1,
4070 NULL);
paul718e3742002-12-13 20:15:29 +00004071}
4072
hassoe0701b72004-05-20 09:19:34 +00004073DEFUN (neighbor_maximum_prefix_threshold_warning,
4074 neighbor_maximum_prefix_threshold_warning_cmd,
4075 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only",
4076 NEIGHBOR_STR
4077 NEIGHBOR_ADDR_STR2
4078 "Maximum number of prefix accept from this peer\n"
4079 "maximum no. of prefix limit\n"
4080 "Threshold value (%) at which to generate a warning msg\n"
4081 "Only give warning message when limit is exceeded\n")
4082{
4083 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00004084 bgp_node_safi (vty), argv[1], argv[2], 1, NULL);
4085}
4086
4087DEFUN (neighbor_maximum_prefix_restart,
4088 neighbor_maximum_prefix_restart_cmd,
4089 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>",
4090 NEIGHBOR_STR
4091 NEIGHBOR_ADDR_STR2
4092 "Maximum number of prefix accept from this peer\n"
4093 "maximum no. of prefix limit\n"
4094 "Restart bgp connection after limit is exceeded\n"
4095 "Restart interval in minutes")
4096{
4097 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
4098 bgp_node_safi (vty), argv[1], NULL, 0, argv[2]);
4099}
4100
4101DEFUN (neighbor_maximum_prefix_threshold_restart,
4102 neighbor_maximum_prefix_threshold_restart_cmd,
4103 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>",
4104 NEIGHBOR_STR
4105 NEIGHBOR_ADDR_STR2
4106 "Maximum number of prefix accept from this peer\n"
4107 "maximum no. of prefix limit\n"
4108 "Threshold value (%) at which to generate a warning msg\n"
4109 "Restart bgp connection after limit is exceeded\n"
4110 "Restart interval in minutes")
4111{
4112 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
4113 bgp_node_safi (vty), argv[1], argv[2], 0, argv[3]);
4114}
hassoe0701b72004-05-20 09:19:34 +00004115
paul718e3742002-12-13 20:15:29 +00004116DEFUN (no_neighbor_maximum_prefix,
4117 no_neighbor_maximum_prefix_cmd,
4118 NO_NEIGHBOR_CMD2 "maximum-prefix",
4119 NO_STR
4120 NEIGHBOR_STR
4121 NEIGHBOR_ADDR_STR2
4122 "Maximum number of prefix accept from this peer\n")
4123{
4124 return peer_maximum_prefix_unset_vty (vty, argv[0], bgp_node_afi (vty),
4125 bgp_node_safi (vty));
4126}
4127
4128ALIAS (no_neighbor_maximum_prefix,
4129 no_neighbor_maximum_prefix_val_cmd,
4130 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>",
4131 NO_STR
4132 NEIGHBOR_STR
4133 NEIGHBOR_ADDR_STR2
4134 "Maximum number of prefix accept from this peer\n"
4135 "maximum no. of prefix limit\n")
4136
4137ALIAS (no_neighbor_maximum_prefix,
hasso0a486e52005-02-01 20:57:17 +00004138 no_neighbor_maximum_prefix_threshold_cmd,
4139 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
4140 NO_STR
4141 NEIGHBOR_STR
4142 NEIGHBOR_ADDR_STR2
4143 "Maximum number of prefix accept from this peer\n"
4144 "maximum no. of prefix limit\n"
4145 "Threshold value (%) at which to generate a warning msg\n")
4146
4147ALIAS (no_neighbor_maximum_prefix,
4148 no_neighbor_maximum_prefix_warning_cmd,
4149 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
4150 NO_STR
4151 NEIGHBOR_STR
4152 NEIGHBOR_ADDR_STR2
4153 "Maximum number of prefix accept from this peer\n"
4154 "maximum no. of prefix limit\n"
paule8e19462006-01-19 20:16:55 +00004155 "Only give warning message when limit is exceeded\n")
hasso0a486e52005-02-01 20:57:17 +00004156
4157ALIAS (no_neighbor_maximum_prefix,
4158 no_neighbor_maximum_prefix_threshold_warning_cmd,
hassoe0701b72004-05-20 09:19:34 +00004159 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only",
4160 NO_STR
4161 NEIGHBOR_STR
4162 NEIGHBOR_ADDR_STR2
4163 "Maximum number of prefix accept from this peer\n"
4164 "maximum no. of prefix limit\n"
4165 "Threshold value (%) at which to generate a warning msg\n"
paule8e19462006-01-19 20:16:55 +00004166 "Only give warning message when limit is exceeded\n")
hassoe0701b72004-05-20 09:19:34 +00004167
4168ALIAS (no_neighbor_maximum_prefix,
hasso0a486e52005-02-01 20:57:17 +00004169 no_neighbor_maximum_prefix_restart_cmd,
4170 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>",
paul718e3742002-12-13 20:15:29 +00004171 NO_STR
4172 NEIGHBOR_STR
4173 NEIGHBOR_ADDR_STR2
4174 "Maximum number of prefix accept from this peer\n"
4175 "maximum no. of prefix limit\n"
hasso0a486e52005-02-01 20:57:17 +00004176 "Restart bgp connection after limit is exceeded\n"
4177 "Restart interval in minutes")
4178
4179ALIAS (no_neighbor_maximum_prefix,
4180 no_neighbor_maximum_prefix_threshold_restart_cmd,
4181 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>",
4182 NO_STR
4183 NEIGHBOR_STR
4184 NEIGHBOR_ADDR_STR2
4185 "Maximum number of prefix accept from this peer\n"
4186 "maximum no. of prefix limit\n"
4187 "Threshold value (%) at which to generate a warning msg\n"
4188 "Restart bgp connection after limit is exceeded\n"
4189 "Restart interval in minutes")
David Lamparter6b0655a2014-06-04 06:53:35 +02004190
paul718e3742002-12-13 20:15:29 +00004191/* "neighbor allowas-in" */
4192DEFUN (neighbor_allowas_in,
4193 neighbor_allowas_in_cmd,
4194 NEIGHBOR_CMD2 "allowas-in",
4195 NEIGHBOR_STR
4196 NEIGHBOR_ADDR_STR2
4197 "Accept as-path with my AS present in it\n")
4198{
4199 int ret;
4200 struct peer *peer;
paulfd79ac92004-10-13 05:06:08 +00004201 unsigned int allow_num;
paul718e3742002-12-13 20:15:29 +00004202
4203 peer = peer_and_group_lookup_vty (vty, argv[0]);
4204 if (! peer)
4205 return CMD_WARNING;
4206
4207 if (argc == 1)
4208 allow_num = 3;
4209 else
4210 VTY_GET_INTEGER_RANGE ("AS number", allow_num, argv[1], 1, 10);
4211
4212 ret = peer_allowas_in_set (peer, bgp_node_afi (vty), bgp_node_safi (vty),
4213 allow_num);
4214
4215 return bgp_vty_return (vty, ret);
4216}
4217
4218ALIAS (neighbor_allowas_in,
4219 neighbor_allowas_in_arg_cmd,
4220 NEIGHBOR_CMD2 "allowas-in <1-10>",
4221 NEIGHBOR_STR
4222 NEIGHBOR_ADDR_STR2
4223 "Accept as-path with my AS present in it\n"
4224 "Number of occurances of AS number\n")
4225
4226DEFUN (no_neighbor_allowas_in,
4227 no_neighbor_allowas_in_cmd,
4228 NO_NEIGHBOR_CMD2 "allowas-in",
4229 NO_STR
4230 NEIGHBOR_STR
4231 NEIGHBOR_ADDR_STR2
4232 "allow local ASN appears in aspath attribute\n")
4233{
4234 int ret;
4235 struct peer *peer;
4236
4237 peer = peer_and_group_lookup_vty (vty, argv[0]);
4238 if (! peer)
4239 return CMD_WARNING;
4240
4241 ret = peer_allowas_in_unset (peer, bgp_node_afi (vty), bgp_node_safi (vty));
4242
4243 return bgp_vty_return (vty, ret);
4244}
David Lamparter6b0655a2014-06-04 06:53:35 +02004245
Nick Hilliardfa411a22011-03-23 15:33:17 +00004246DEFUN (neighbor_ttl_security,
4247 neighbor_ttl_security_cmd,
4248 NEIGHBOR_CMD2 "ttl-security hops <1-254>",
4249 NEIGHBOR_STR
4250 NEIGHBOR_ADDR_STR2
4251 "Specify the maximum number of hops to the BGP peer\n")
4252{
4253 struct peer *peer;
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00004254 int gtsm_hops;
Nick Hilliardfa411a22011-03-23 15:33:17 +00004255
4256 peer = peer_and_group_lookup_vty (vty, argv[0]);
4257 if (! peer)
4258 return CMD_WARNING;
4259
4260 VTY_GET_INTEGER_RANGE ("", gtsm_hops, argv[1], 1, 254);
4261
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00004262 return bgp_vty_return (vty, peer_ttl_security_hops_set (peer, gtsm_hops));
Nick Hilliardfa411a22011-03-23 15:33:17 +00004263}
4264
4265DEFUN (no_neighbor_ttl_security,
4266 no_neighbor_ttl_security_cmd,
4267 NO_NEIGHBOR_CMD2 "ttl-security hops <1-254>",
4268 NO_STR
4269 NEIGHBOR_STR
4270 NEIGHBOR_ADDR_STR2
4271 "Specify the maximum number of hops to the BGP peer\n")
4272{
4273 struct peer *peer;
Nick Hilliardfa411a22011-03-23 15:33:17 +00004274
4275 peer = peer_and_group_lookup_vty (vty, argv[0]);
4276 if (! peer)
4277 return CMD_WARNING;
4278
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00004279 return bgp_vty_return (vty, peer_ttl_security_hops_unset (peer));
Nick Hilliardfa411a22011-03-23 15:33:17 +00004280}
David Lamparter6b0655a2014-06-04 06:53:35 +02004281
paul718e3742002-12-13 20:15:29 +00004282/* Address family configuration. */
4283DEFUN (address_family_ipv4,
4284 address_family_ipv4_cmd,
4285 "address-family ipv4",
4286 "Enter Address Family command mode\n"
4287 "Address family\n")
4288{
4289 vty->node = BGP_IPV4_NODE;
4290 return CMD_SUCCESS;
4291}
4292
4293DEFUN (address_family_ipv4_safi,
4294 address_family_ipv4_safi_cmd,
4295 "address-family ipv4 (unicast|multicast)",
4296 "Enter Address Family command mode\n"
4297 "Address family\n"
4298 "Address Family modifier\n"
4299 "Address Family modifier\n")
4300{
4301 if (strncmp (argv[0], "m", 1) == 0)
4302 vty->node = BGP_IPV4M_NODE;
4303 else
4304 vty->node = BGP_IPV4_NODE;
4305
4306 return CMD_SUCCESS;
4307}
4308
paul25ffbdc2005-08-22 22:42:08 +00004309DEFUN (address_family_ipv6,
4310 address_family_ipv6_cmd,
4311 "address-family ipv6",
paul718e3742002-12-13 20:15:29 +00004312 "Enter Address Family command mode\n"
paul25ffbdc2005-08-22 22:42:08 +00004313 "Address family\n")
paul718e3742002-12-13 20:15:29 +00004314{
4315 vty->node = BGP_IPV6_NODE;
4316 return CMD_SUCCESS;
4317}
4318
paul25ffbdc2005-08-22 22:42:08 +00004319DEFUN (address_family_ipv6_safi,
4320 address_family_ipv6_safi_cmd,
4321 "address-family ipv6 (unicast|multicast)",
paul718e3742002-12-13 20:15:29 +00004322 "Enter Address Family command mode\n"
paul25ffbdc2005-08-22 22:42:08 +00004323 "Address family\n"
4324 "Address Family modifier\n"
4325 "Address Family modifier\n")
4326{
4327 if (strncmp (argv[0], "m", 1) == 0)
4328 vty->node = BGP_IPV6M_NODE;
4329 else
4330 vty->node = BGP_IPV6_NODE;
4331
4332 return CMD_SUCCESS;
4333}
paul718e3742002-12-13 20:15:29 +00004334
4335DEFUN (address_family_vpnv4,
4336 address_family_vpnv4_cmd,
4337 "address-family vpnv4",
4338 "Enter Address Family command mode\n"
4339 "Address family\n")
4340{
4341 vty->node = BGP_VPNV4_NODE;
4342 return CMD_SUCCESS;
4343}
4344
4345ALIAS (address_family_vpnv4,
4346 address_family_vpnv4_unicast_cmd,
4347 "address-family vpnv4 unicast",
4348 "Enter Address Family command mode\n"
4349 "Address family\n"
4350 "Address Family Modifier\n")
4351
Lou Berger13c378d2016-01-12 13:41:56 -05004352DEFUN (address_family_vpnv6,
4353 address_family_vpnv6_cmd,
4354 "address-family vpnv6",
4355 "Enter Address Family command mode\n"
4356 "Address family\n")
4357{
4358 vty->node = BGP_VPNV6_NODE;
4359 return CMD_SUCCESS;
4360}
4361
4362ALIAS (address_family_vpnv6,
4363 address_family_vpnv6_unicast_cmd,
4364 "address-family vpnv6 unicast",
4365 "Enter Address Family command mode\n"
4366 "Address family\n"
4367 "Address Family Modifier\n")
4368
Lou Bergera3fda882016-01-12 13:42:04 -05004369DEFUN (address_family_encap,
4370 address_family_encap_cmd,
4371 "address-family encap",
4372 "Enter Address Family command mode\n"
4373 "Address family\n")
4374{
4375 vty->node = BGP_ENCAP_NODE;
4376 return CMD_SUCCESS;
4377}
4378
4379ALIAS (address_family_encap,
4380 address_family_encapv4_cmd,
4381 "address-family encapv4",
4382 "Enter Address Family command mode\n"
4383 "Address family\n")
4384
4385DEFUN (address_family_encapv6,
4386 address_family_encapv6_cmd,
4387 "address-family encapv6",
4388 "Enter Address Family command mode\n"
4389 "Address family\n")
4390{
4391 vty->node = BGP_ENCAPV6_NODE;
4392 return CMD_SUCCESS;
4393}
4394
paul718e3742002-12-13 20:15:29 +00004395DEFUN (exit_address_family,
4396 exit_address_family_cmd,
4397 "exit-address-family",
4398 "Exit from Address Family configuration mode\n")
4399{
Lou Bergera3fda882016-01-12 13:42:04 -05004400 /* should match list in command.c:config_exit */
hassoa8a80d52005-04-09 13:07:47 +00004401 if (vty->node == BGP_IPV4_NODE
Lou Bergera3fda882016-01-12 13:42:04 -05004402 || vty->node == BGP_ENCAP_NODE
4403 || vty->node == BGP_ENCAPV6_NODE
hassoa8a80d52005-04-09 13:07:47 +00004404 || vty->node == BGP_IPV4M_NODE
paul718e3742002-12-13 20:15:29 +00004405 || vty->node == BGP_VPNV4_NODE
Lou Berger13c378d2016-01-12 13:41:56 -05004406 || vty->node == BGP_VPNV6_NODE
paul25ffbdc2005-08-22 22:42:08 +00004407 || vty->node == BGP_IPV6_NODE
4408 || vty->node == BGP_IPV6M_NODE)
paul718e3742002-12-13 20:15:29 +00004409 vty->node = BGP_NODE;
4410 return CMD_SUCCESS;
4411}
David Lamparter6b0655a2014-06-04 06:53:35 +02004412
paul718e3742002-12-13 20:15:29 +00004413/* BGP clear sort. */
4414enum clear_sort
4415{
4416 clear_all,
4417 clear_peer,
4418 clear_group,
4419 clear_external,
4420 clear_as
4421};
4422
paul94f2b392005-06-28 12:44:16 +00004423static void
paul718e3742002-12-13 20:15:29 +00004424bgp_clear_vty_error (struct vty *vty, struct peer *peer, afi_t afi,
4425 safi_t safi, int error)
4426{
4427 switch (error)
4428 {
4429 case BGP_ERR_AF_UNCONFIGURED:
4430 vty_out (vty,
4431 "%%BGP: Enable %s %s address family for the neighbor %s%s",
4432 afi == AFI_IP6 ? "IPv6" : safi == SAFI_MPLS_VPN ? "VPNv4" : "IPv4",
4433 safi == SAFI_MULTICAST ? "Multicast" : "Unicast",
4434 peer->host, VTY_NEWLINE);
4435 break;
4436 case BGP_ERR_SOFT_RECONFIG_UNCONFIGURED:
4437 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);
4438 break;
4439 default:
4440 break;
4441 }
4442}
4443
4444/* `clear ip bgp' functions. */
paul94f2b392005-06-28 12:44:16 +00004445static int
paul718e3742002-12-13 20:15:29 +00004446bgp_clear (struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi,
paulfd79ac92004-10-13 05:06:08 +00004447 enum clear_sort sort,enum bgp_clear_type stype, const char *arg)
paul718e3742002-12-13 20:15:29 +00004448{
4449 int ret;
4450 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00004451 struct listnode *node, *nnode;
paul718e3742002-12-13 20:15:29 +00004452
4453 /* Clear all neighbors. */
4454 if (sort == clear_all)
4455 {
paul1eb8ef22005-04-07 07:30:20 +00004456 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004457 {
4458 if (stype == BGP_CLEAR_SOFT_NONE)
4459 ret = peer_clear (peer);
4460 else
4461 ret = peer_clear_soft (peer, afi, safi, stype);
4462
4463 if (ret < 0)
4464 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4465 }
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004466 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004467 }
4468
4469 /* Clear specified neighbors. */
4470 if (sort == clear_peer)
4471 {
4472 union sockunion su;
4473 int ret;
4474
4475 /* Make sockunion for lookup. */
4476 ret = str2sockunion (arg, &su);
4477 if (ret < 0)
4478 {
4479 vty_out (vty, "Malformed address: %s%s", arg, VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004480 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00004481 }
4482 peer = peer_lookup (bgp, &su);
4483 if (! peer)
4484 {
4485 vty_out (vty, "%%BGP: Unknown neighbor - \"%s\"%s", arg, VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004486 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00004487 }
4488
4489 if (stype == BGP_CLEAR_SOFT_NONE)
4490 ret = peer_clear (peer);
4491 else
4492 ret = peer_clear_soft (peer, afi, safi, stype);
4493
4494 if (ret < 0)
4495 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4496
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004497 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004498 }
4499
4500 /* Clear all peer-group members. */
4501 if (sort == clear_group)
4502 {
4503 struct peer_group *group;
4504
4505 group = peer_group_lookup (bgp, arg);
4506 if (! group)
4507 {
4508 vty_out (vty, "%%BGP: No such peer-group %s%s", arg, VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004509 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00004510 }
4511
paul1eb8ef22005-04-07 07:30:20 +00004512 for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004513 {
4514 if (stype == BGP_CLEAR_SOFT_NONE)
4515 {
4516 ret = peer_clear (peer);
4517 continue;
4518 }
4519
4520 if (! peer->af_group[afi][safi])
4521 continue;
4522
4523 ret = peer_clear_soft (peer, afi, safi, stype);
4524
4525 if (ret < 0)
4526 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4527 }
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004528 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004529 }
4530
4531 if (sort == clear_external)
4532 {
paul1eb8ef22005-04-07 07:30:20 +00004533 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004534 {
Jorge Boncompte [DTI2]6d85b152012-05-07 16:52:54 +00004535 if (peer->sort == BGP_PEER_IBGP)
paul718e3742002-12-13 20:15:29 +00004536 continue;
4537
4538 if (stype == BGP_CLEAR_SOFT_NONE)
4539 ret = peer_clear (peer);
4540 else
4541 ret = peer_clear_soft (peer, afi, safi, stype);
4542
4543 if (ret < 0)
4544 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4545 }
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004546 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004547 }
4548
4549 if (sort == clear_as)
4550 {
4551 as_t as;
paul718e3742002-12-13 20:15:29 +00004552 int find = 0;
4553
Ulrich Weberbde12e32011-11-16 19:32:12 +04004554 VTY_GET_INTEGER_RANGE ("AS", as, arg, 1, BGP_AS4_MAX);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004555
paul1eb8ef22005-04-07 07:30:20 +00004556 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004557 {
4558 if (peer->as != as)
4559 continue;
4560
4561 find = 1;
4562 if (stype == BGP_CLEAR_SOFT_NONE)
4563 ret = peer_clear (peer);
4564 else
4565 ret = peer_clear_soft (peer, afi, safi, stype);
4566
4567 if (ret < 0)
4568 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4569 }
4570 if (! find)
4571 vty_out (vty, "%%BGP: No peer is configured with AS %s%s", arg,
4572 VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004573 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004574 }
4575
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004576 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004577}
4578
paul94f2b392005-06-28 12:44:16 +00004579static int
paulfd79ac92004-10-13 05:06:08 +00004580bgp_clear_vty (struct vty *vty, const char *name, afi_t afi, safi_t safi,
4581 enum clear_sort sort, enum bgp_clear_type stype,
4582 const char *arg)
paul718e3742002-12-13 20:15:29 +00004583{
paul718e3742002-12-13 20:15:29 +00004584 struct bgp *bgp;
4585
4586 /* BGP structure lookup. */
4587 if (name)
4588 {
4589 bgp = bgp_lookup_by_name (name);
4590 if (bgp == NULL)
4591 {
4592 vty_out (vty, "Can't find BGP view %s%s", name, VTY_NEWLINE);
4593 return CMD_WARNING;
4594 }
4595 }
4596 else
4597 {
4598 bgp = bgp_get_default ();
4599 if (bgp == NULL)
4600 {
4601 vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE);
4602 return CMD_WARNING;
4603 }
4604 }
4605
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004606 return bgp_clear (vty, bgp, afi, safi, sort, stype, arg);
paul718e3742002-12-13 20:15:29 +00004607}
4608
4609DEFUN (clear_ip_bgp_all,
4610 clear_ip_bgp_all_cmd,
4611 "clear ip bgp *",
4612 CLEAR_STR
4613 IP_STR
4614 BGP_STR
4615 "Clear all peers\n")
4616{
4617 if (argc == 1)
4618 return bgp_clear_vty (vty, argv[0], 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL);
4619
4620 return bgp_clear_vty (vty, NULL, 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL);
4621}
4622
4623ALIAS (clear_ip_bgp_all,
4624 clear_bgp_all_cmd,
4625 "clear bgp *",
4626 CLEAR_STR
4627 BGP_STR
4628 "Clear all peers\n")
4629
4630ALIAS (clear_ip_bgp_all,
4631 clear_bgp_ipv6_all_cmd,
4632 "clear bgp ipv6 *",
4633 CLEAR_STR
4634 BGP_STR
4635 "Address family\n"
4636 "Clear all peers\n")
4637
4638ALIAS (clear_ip_bgp_all,
4639 clear_ip_bgp_instance_all_cmd,
4640 "clear ip bgp view WORD *",
4641 CLEAR_STR
4642 IP_STR
4643 BGP_STR
4644 "BGP view\n"
4645 "view name\n"
4646 "Clear all peers\n")
4647
4648ALIAS (clear_ip_bgp_all,
4649 clear_bgp_instance_all_cmd,
4650 "clear bgp view WORD *",
4651 CLEAR_STR
4652 BGP_STR
4653 "BGP view\n"
4654 "view name\n"
4655 "Clear all peers\n")
4656
4657DEFUN (clear_ip_bgp_peer,
4658 clear_ip_bgp_peer_cmd,
4659 "clear ip bgp (A.B.C.D|X:X::X:X)",
4660 CLEAR_STR
4661 IP_STR
4662 BGP_STR
4663 "BGP neighbor IP address to clear\n"
4664 "BGP IPv6 neighbor to clear\n")
4665{
4666 return bgp_clear_vty (vty, NULL, 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[0]);
4667}
4668
4669ALIAS (clear_ip_bgp_peer,
4670 clear_bgp_peer_cmd,
4671 "clear bgp (A.B.C.D|X:X::X:X)",
4672 CLEAR_STR
4673 BGP_STR
4674 "BGP neighbor address to clear\n"
4675 "BGP IPv6 neighbor to clear\n")
4676
4677ALIAS (clear_ip_bgp_peer,
4678 clear_bgp_ipv6_peer_cmd,
4679 "clear bgp ipv6 (A.B.C.D|X:X::X:X)",
4680 CLEAR_STR
4681 BGP_STR
4682 "Address family\n"
4683 "BGP neighbor address to clear\n"
4684 "BGP IPv6 neighbor to clear\n")
4685
4686DEFUN (clear_ip_bgp_peer_group,
4687 clear_ip_bgp_peer_group_cmd,
4688 "clear ip bgp peer-group WORD",
4689 CLEAR_STR
4690 IP_STR
4691 BGP_STR
4692 "Clear all members of peer-group\n"
4693 "BGP peer-group name\n")
4694{
4695 return bgp_clear_vty (vty, NULL, 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[0]);
4696}
4697
4698ALIAS (clear_ip_bgp_peer_group,
4699 clear_bgp_peer_group_cmd,
4700 "clear bgp peer-group WORD",
4701 CLEAR_STR
4702 BGP_STR
4703 "Clear all members of peer-group\n"
4704 "BGP peer-group name\n")
4705
4706ALIAS (clear_ip_bgp_peer_group,
4707 clear_bgp_ipv6_peer_group_cmd,
4708 "clear bgp ipv6 peer-group WORD",
4709 CLEAR_STR
4710 BGP_STR
4711 "Address family\n"
4712 "Clear all members of peer-group\n"
4713 "BGP peer-group name\n")
4714
4715DEFUN (clear_ip_bgp_external,
4716 clear_ip_bgp_external_cmd,
4717 "clear ip bgp external",
4718 CLEAR_STR
4719 IP_STR
4720 BGP_STR
4721 "Clear all external peers\n")
4722{
4723 return bgp_clear_vty (vty, NULL, 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL);
4724}
4725
4726ALIAS (clear_ip_bgp_external,
4727 clear_bgp_external_cmd,
4728 "clear bgp external",
4729 CLEAR_STR
4730 BGP_STR
4731 "Clear all external peers\n")
4732
4733ALIAS (clear_ip_bgp_external,
4734 clear_bgp_ipv6_external_cmd,
4735 "clear bgp ipv6 external",
4736 CLEAR_STR
4737 BGP_STR
4738 "Address family\n"
4739 "Clear all external peers\n")
4740
4741DEFUN (clear_ip_bgp_as,
4742 clear_ip_bgp_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00004743 "clear ip bgp " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00004744 CLEAR_STR
4745 IP_STR
4746 BGP_STR
4747 "Clear peers with the AS number\n")
4748{
4749 return bgp_clear_vty (vty, NULL, 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[0]);
4750}
4751
4752ALIAS (clear_ip_bgp_as,
4753 clear_bgp_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00004754 "clear bgp " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00004755 CLEAR_STR
4756 BGP_STR
4757 "Clear peers with the AS number\n")
4758
4759ALIAS (clear_ip_bgp_as,
4760 clear_bgp_ipv6_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00004761 "clear bgp ipv6 " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00004762 CLEAR_STR
4763 BGP_STR
4764 "Address family\n"
4765 "Clear peers with the AS number\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02004766
paul718e3742002-12-13 20:15:29 +00004767/* Outbound soft-reconfiguration */
4768DEFUN (clear_ip_bgp_all_soft_out,
4769 clear_ip_bgp_all_soft_out_cmd,
4770 "clear ip bgp * soft out",
4771 CLEAR_STR
4772 IP_STR
4773 BGP_STR
4774 "Clear all peers\n"
4775 "Soft reconfig\n"
4776 "Soft reconfig outbound update\n")
4777{
4778 if (argc == 1)
4779 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
4780 BGP_CLEAR_SOFT_OUT, NULL);
4781
4782 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
4783 BGP_CLEAR_SOFT_OUT, NULL);
4784}
4785
4786ALIAS (clear_ip_bgp_all_soft_out,
4787 clear_ip_bgp_all_out_cmd,
4788 "clear ip bgp * out",
4789 CLEAR_STR
4790 IP_STR
4791 BGP_STR
4792 "Clear all peers\n"
4793 "Soft reconfig outbound update\n")
4794
4795ALIAS (clear_ip_bgp_all_soft_out,
4796 clear_ip_bgp_instance_all_soft_out_cmd,
4797 "clear ip bgp view WORD * soft out",
4798 CLEAR_STR
4799 IP_STR
4800 BGP_STR
4801 "BGP view\n"
4802 "view name\n"
4803 "Clear all peers\n"
4804 "Soft reconfig\n"
4805 "Soft reconfig outbound update\n")
4806
4807DEFUN (clear_ip_bgp_all_ipv4_soft_out,
4808 clear_ip_bgp_all_ipv4_soft_out_cmd,
4809 "clear ip bgp * ipv4 (unicast|multicast) soft out",
4810 CLEAR_STR
4811 IP_STR
4812 BGP_STR
4813 "Clear all peers\n"
4814 "Address family\n"
4815 "Address Family modifier\n"
4816 "Address Family modifier\n"
4817 "Soft reconfig\n"
4818 "Soft reconfig outbound update\n")
4819{
4820 if (strncmp (argv[0], "m", 1) == 0)
4821 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
4822 BGP_CLEAR_SOFT_OUT, NULL);
4823
4824 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
4825 BGP_CLEAR_SOFT_OUT, NULL);
4826}
4827
4828ALIAS (clear_ip_bgp_all_ipv4_soft_out,
4829 clear_ip_bgp_all_ipv4_out_cmd,
4830 "clear ip bgp * ipv4 (unicast|multicast) out",
4831 CLEAR_STR
4832 IP_STR
4833 BGP_STR
4834 "Clear all peers\n"
4835 "Address family\n"
4836 "Address Family modifier\n"
4837 "Address Family modifier\n"
4838 "Soft reconfig outbound update\n")
4839
4840DEFUN (clear_ip_bgp_instance_all_ipv4_soft_out,
4841 clear_ip_bgp_instance_all_ipv4_soft_out_cmd,
4842 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft out",
4843 CLEAR_STR
4844 IP_STR
4845 BGP_STR
4846 "BGP view\n"
4847 "view name\n"
4848 "Clear all peers\n"
4849 "Address family\n"
4850 "Address Family modifier\n"
4851 "Address Family modifier\n"
4852 "Soft reconfig outbound update\n")
4853{
4854 if (strncmp (argv[1], "m", 1) == 0)
4855 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
4856 BGP_CLEAR_SOFT_OUT, NULL);
4857
4858 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
4859 BGP_CLEAR_SOFT_OUT, NULL);
4860}
4861
4862DEFUN (clear_ip_bgp_all_vpnv4_soft_out,
4863 clear_ip_bgp_all_vpnv4_soft_out_cmd,
4864 "clear ip bgp * vpnv4 unicast soft out",
4865 CLEAR_STR
4866 IP_STR
4867 BGP_STR
4868 "Clear all peers\n"
4869 "Address family\n"
4870 "Address Family Modifier\n"
4871 "Soft reconfig\n"
4872 "Soft reconfig outbound update\n")
4873{
4874 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
4875 BGP_CLEAR_SOFT_OUT, NULL);
4876}
4877
4878ALIAS (clear_ip_bgp_all_vpnv4_soft_out,
4879 clear_ip_bgp_all_vpnv4_out_cmd,
4880 "clear ip bgp * vpnv4 unicast out",
4881 CLEAR_STR
4882 IP_STR
4883 BGP_STR
4884 "Clear all peers\n"
4885 "Address family\n"
4886 "Address Family Modifier\n"
4887 "Soft reconfig outbound update\n")
4888
Lou Berger298cc2f2016-01-12 13:42:02 -05004889DEFUN (clear_ip_bgp_all_encap_soft_out,
4890 clear_ip_bgp_all_encap_soft_out_cmd,
4891 "clear ip bgp * encap unicast soft out",
4892 CLEAR_STR
4893 IP_STR
4894 BGP_STR
4895 "Clear all peers\n"
4896 "Address family\n"
4897 "Address Family Modifier\n"
4898 "Soft reconfig\n"
4899 "Soft reconfig outbound update\n")
4900{
4901 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_all,
4902 BGP_CLEAR_SOFT_OUT, NULL);
4903}
4904
4905ALIAS (clear_ip_bgp_all_encap_soft_out,
4906 clear_ip_bgp_all_encap_out_cmd,
4907 "clear ip bgp * encap unicast out",
4908 CLEAR_STR
4909 IP_STR
4910 BGP_STR
4911 "Clear all peers\n"
4912 "Address family\n"
4913 "Address Family Modifier\n"
4914 "Soft reconfig outbound update\n")
4915
paul718e3742002-12-13 20:15:29 +00004916DEFUN (clear_bgp_all_soft_out,
4917 clear_bgp_all_soft_out_cmd,
4918 "clear bgp * soft out",
4919 CLEAR_STR
4920 BGP_STR
4921 "Clear all peers\n"
4922 "Soft reconfig\n"
4923 "Soft reconfig outbound update\n")
4924{
4925 if (argc == 1)
4926 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
4927 BGP_CLEAR_SOFT_OUT, NULL);
4928
4929 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
4930 BGP_CLEAR_SOFT_OUT, NULL);
4931}
4932
4933ALIAS (clear_bgp_all_soft_out,
4934 clear_bgp_instance_all_soft_out_cmd,
4935 "clear bgp view WORD * soft out",
4936 CLEAR_STR
4937 BGP_STR
4938 "BGP view\n"
4939 "view name\n"
4940 "Clear all peers\n"
4941 "Soft reconfig\n"
4942 "Soft reconfig outbound update\n")
4943
4944ALIAS (clear_bgp_all_soft_out,
4945 clear_bgp_all_out_cmd,
4946 "clear bgp * out",
4947 CLEAR_STR
4948 BGP_STR
4949 "Clear all peers\n"
4950 "Soft reconfig outbound update\n")
4951
4952ALIAS (clear_bgp_all_soft_out,
4953 clear_bgp_ipv6_all_soft_out_cmd,
4954 "clear bgp ipv6 * soft out",
4955 CLEAR_STR
4956 BGP_STR
4957 "Address family\n"
4958 "Clear all peers\n"
4959 "Soft reconfig\n"
4960 "Soft reconfig outbound update\n")
4961
4962ALIAS (clear_bgp_all_soft_out,
4963 clear_bgp_ipv6_all_out_cmd,
4964 "clear bgp ipv6 * out",
4965 CLEAR_STR
4966 BGP_STR
4967 "Address family\n"
4968 "Clear all peers\n"
4969 "Soft reconfig outbound update\n")
4970
4971DEFUN (clear_ip_bgp_peer_soft_out,
4972 clear_ip_bgp_peer_soft_out_cmd,
4973 "clear ip bgp A.B.C.D soft out",
4974 CLEAR_STR
4975 IP_STR
4976 BGP_STR
4977 "BGP neighbor address to clear\n"
4978 "Soft reconfig\n"
4979 "Soft reconfig outbound update\n")
4980{
4981 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
4982 BGP_CLEAR_SOFT_OUT, argv[0]);
4983}
4984
4985ALIAS (clear_ip_bgp_peer_soft_out,
4986 clear_ip_bgp_peer_out_cmd,
4987 "clear ip bgp A.B.C.D out",
4988 CLEAR_STR
4989 IP_STR
4990 BGP_STR
4991 "BGP neighbor address to clear\n"
4992 "Soft reconfig outbound update\n")
4993
4994DEFUN (clear_ip_bgp_peer_ipv4_soft_out,
4995 clear_ip_bgp_peer_ipv4_soft_out_cmd,
4996 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft out",
4997 CLEAR_STR
4998 IP_STR
4999 BGP_STR
5000 "BGP neighbor address to clear\n"
5001 "Address family\n"
5002 "Address Family modifier\n"
5003 "Address Family modifier\n"
5004 "Soft reconfig\n"
5005 "Soft reconfig outbound update\n")
5006{
5007 if (strncmp (argv[1], "m", 1) == 0)
5008 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
5009 BGP_CLEAR_SOFT_OUT, argv[0]);
5010
5011 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5012 BGP_CLEAR_SOFT_OUT, argv[0]);
5013}
5014
5015ALIAS (clear_ip_bgp_peer_ipv4_soft_out,
5016 clear_ip_bgp_peer_ipv4_out_cmd,
5017 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) out",
5018 CLEAR_STR
5019 IP_STR
5020 BGP_STR
5021 "BGP neighbor address to clear\n"
5022 "Address family\n"
5023 "Address Family modifier\n"
5024 "Address Family modifier\n"
5025 "Soft reconfig outbound update\n")
5026
5027DEFUN (clear_ip_bgp_peer_vpnv4_soft_out,
5028 clear_ip_bgp_peer_vpnv4_soft_out_cmd,
5029 "clear ip bgp A.B.C.D vpnv4 unicast 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 "Soft reconfig\n"
5037 "Soft reconfig outbound update\n")
5038{
5039 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
5040 BGP_CLEAR_SOFT_OUT, argv[0]);
5041}
5042
5043ALIAS (clear_ip_bgp_peer_vpnv4_soft_out,
5044 clear_ip_bgp_peer_vpnv4_out_cmd,
5045 "clear ip bgp A.B.C.D vpnv4 unicast out",
5046 CLEAR_STR
5047 IP_STR
5048 BGP_STR
5049 "BGP neighbor address to clear\n"
5050 "Address family\n"
5051 "Address Family Modifier\n"
5052 "Soft reconfig outbound update\n")
5053
Lou Berger298cc2f2016-01-12 13:42:02 -05005054DEFUN (clear_ip_bgp_peer_encap_soft_out,
5055 clear_ip_bgp_peer_encap_soft_out_cmd,
5056 "clear ip bgp A.B.C.D encap unicast soft out",
5057 CLEAR_STR
5058 IP_STR
5059 BGP_STR
5060 "BGP neighbor address to clear\n"
5061 "Address family\n"
5062 "Address Family Modifier\n"
5063 "Soft reconfig\n"
5064 "Soft reconfig outbound update\n")
5065{
5066 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_peer,
5067 BGP_CLEAR_SOFT_OUT, argv[0]);
5068}
5069
5070ALIAS (clear_ip_bgp_peer_encap_soft_out,
5071 clear_ip_bgp_peer_encap_out_cmd,
5072 "clear ip bgp A.B.C.D encap unicast out",
5073 CLEAR_STR
5074 IP_STR
5075 BGP_STR
5076 "BGP neighbor address to clear\n"
5077 "Address family\n"
5078 "Address Family Modifier\n"
5079 "Soft reconfig outbound update\n")
5080
paul718e3742002-12-13 20:15:29 +00005081DEFUN (clear_bgp_peer_soft_out,
5082 clear_bgp_peer_soft_out_cmd,
5083 "clear bgp (A.B.C.D|X:X::X:X) soft out",
5084 CLEAR_STR
5085 BGP_STR
5086 "BGP neighbor address to clear\n"
5087 "BGP IPv6 neighbor to clear\n"
5088 "Soft reconfig\n"
5089 "Soft reconfig outbound update\n")
5090{
5091 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
5092 BGP_CLEAR_SOFT_OUT, argv[0]);
5093}
5094
5095ALIAS (clear_bgp_peer_soft_out,
5096 clear_bgp_ipv6_peer_soft_out_cmd,
5097 "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft out",
5098 CLEAR_STR
5099 BGP_STR
5100 "Address family\n"
5101 "BGP neighbor address to clear\n"
5102 "BGP IPv6 neighbor to clear\n"
5103 "Soft reconfig\n"
5104 "Soft reconfig outbound update\n")
5105
5106ALIAS (clear_bgp_peer_soft_out,
5107 clear_bgp_peer_out_cmd,
5108 "clear bgp (A.B.C.D|X:X::X:X) out",
5109 CLEAR_STR
5110 BGP_STR
5111 "BGP neighbor address to clear\n"
5112 "BGP IPv6 neighbor to clear\n"
5113 "Soft reconfig outbound update\n")
5114
5115ALIAS (clear_bgp_peer_soft_out,
5116 clear_bgp_ipv6_peer_out_cmd,
5117 "clear bgp ipv6 (A.B.C.D|X:X::X:X) out",
5118 CLEAR_STR
5119 BGP_STR
5120 "Address family\n"
5121 "BGP neighbor address to clear\n"
5122 "BGP IPv6 neighbor to clear\n"
5123 "Soft reconfig outbound update\n")
5124
5125DEFUN (clear_ip_bgp_peer_group_soft_out,
5126 clear_ip_bgp_peer_group_soft_out_cmd,
5127 "clear ip bgp peer-group WORD soft out",
5128 CLEAR_STR
5129 IP_STR
5130 BGP_STR
5131 "Clear all members of peer-group\n"
5132 "BGP peer-group name\n"
5133 "Soft reconfig\n"
5134 "Soft reconfig outbound update\n")
5135{
5136 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5137 BGP_CLEAR_SOFT_OUT, argv[0]);
5138}
5139
5140ALIAS (clear_ip_bgp_peer_group_soft_out,
5141 clear_ip_bgp_peer_group_out_cmd,
5142 "clear ip bgp peer-group WORD out",
5143 CLEAR_STR
5144 IP_STR
5145 BGP_STR
5146 "Clear all members of peer-group\n"
5147 "BGP peer-group name\n"
5148 "Soft reconfig outbound update\n")
5149
5150DEFUN (clear_ip_bgp_peer_group_ipv4_soft_out,
5151 clear_ip_bgp_peer_group_ipv4_soft_out_cmd,
5152 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft out",
5153 CLEAR_STR
5154 IP_STR
5155 BGP_STR
5156 "Clear all members of peer-group\n"
5157 "BGP peer-group name\n"
5158 "Address family\n"
5159 "Address Family modifier\n"
5160 "Address Family modifier\n"
5161 "Soft reconfig\n"
5162 "Soft reconfig outbound update\n")
5163{
5164 if (strncmp (argv[1], "m", 1) == 0)
5165 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
5166 BGP_CLEAR_SOFT_OUT, argv[0]);
5167
5168 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5169 BGP_CLEAR_SOFT_OUT, argv[0]);
5170}
5171
5172ALIAS (clear_ip_bgp_peer_group_ipv4_soft_out,
5173 clear_ip_bgp_peer_group_ipv4_out_cmd,
5174 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) out",
5175 CLEAR_STR
5176 IP_STR
5177 BGP_STR
5178 "Clear all members of peer-group\n"
5179 "BGP peer-group name\n"
5180 "Address family\n"
5181 "Address Family modifier\n"
5182 "Address Family modifier\n"
5183 "Soft reconfig outbound update\n")
5184
5185DEFUN (clear_bgp_peer_group_soft_out,
5186 clear_bgp_peer_group_soft_out_cmd,
5187 "clear bgp peer-group WORD soft out",
5188 CLEAR_STR
5189 BGP_STR
5190 "Clear all members of peer-group\n"
5191 "BGP peer-group name\n"
5192 "Soft reconfig\n"
5193 "Soft reconfig outbound update\n")
5194{
5195 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
5196 BGP_CLEAR_SOFT_OUT, argv[0]);
5197}
5198
5199ALIAS (clear_bgp_peer_group_soft_out,
5200 clear_bgp_ipv6_peer_group_soft_out_cmd,
5201 "clear bgp ipv6 peer-group WORD soft out",
5202 CLEAR_STR
5203 BGP_STR
5204 "Address family\n"
5205 "Clear all members of peer-group\n"
5206 "BGP peer-group name\n"
5207 "Soft reconfig\n"
5208 "Soft reconfig outbound update\n")
5209
5210ALIAS (clear_bgp_peer_group_soft_out,
5211 clear_bgp_peer_group_out_cmd,
5212 "clear bgp peer-group WORD out",
5213 CLEAR_STR
5214 BGP_STR
5215 "Clear all members of peer-group\n"
5216 "BGP peer-group name\n"
5217 "Soft reconfig outbound update\n")
5218
5219ALIAS (clear_bgp_peer_group_soft_out,
5220 clear_bgp_ipv6_peer_group_out_cmd,
5221 "clear bgp ipv6 peer-group WORD out",
5222 CLEAR_STR
5223 BGP_STR
5224 "Address family\n"
5225 "Clear all members of peer-group\n"
5226 "BGP peer-group name\n"
5227 "Soft reconfig outbound update\n")
5228
5229DEFUN (clear_ip_bgp_external_soft_out,
5230 clear_ip_bgp_external_soft_out_cmd,
5231 "clear ip bgp external soft out",
5232 CLEAR_STR
5233 IP_STR
5234 BGP_STR
5235 "Clear all external peers\n"
5236 "Soft reconfig\n"
5237 "Soft reconfig outbound update\n")
5238{
5239 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5240 BGP_CLEAR_SOFT_OUT, NULL);
5241}
5242
5243ALIAS (clear_ip_bgp_external_soft_out,
5244 clear_ip_bgp_external_out_cmd,
5245 "clear ip bgp external out",
5246 CLEAR_STR
5247 IP_STR
5248 BGP_STR
5249 "Clear all external peers\n"
5250 "Soft reconfig outbound update\n")
5251
5252DEFUN (clear_ip_bgp_external_ipv4_soft_out,
5253 clear_ip_bgp_external_ipv4_soft_out_cmd,
5254 "clear ip bgp external ipv4 (unicast|multicast) soft out",
5255 CLEAR_STR
5256 IP_STR
5257 BGP_STR
5258 "Clear all external peers\n"
5259 "Address family\n"
5260 "Address Family modifier\n"
5261 "Address Family modifier\n"
5262 "Soft reconfig\n"
5263 "Soft reconfig outbound update\n")
5264{
5265 if (strncmp (argv[0], "m", 1) == 0)
5266 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
5267 BGP_CLEAR_SOFT_OUT, NULL);
5268
5269 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5270 BGP_CLEAR_SOFT_OUT, NULL);
5271}
5272
5273ALIAS (clear_ip_bgp_external_ipv4_soft_out,
5274 clear_ip_bgp_external_ipv4_out_cmd,
5275 "clear ip bgp external ipv4 (unicast|multicast) out",
5276 CLEAR_STR
5277 IP_STR
5278 BGP_STR
5279 "Clear all external peers\n"
5280 "Address family\n"
5281 "Address Family modifier\n"
5282 "Address Family modifier\n"
5283 "Soft reconfig outbound update\n")
5284
5285DEFUN (clear_bgp_external_soft_out,
5286 clear_bgp_external_soft_out_cmd,
5287 "clear bgp external soft out",
5288 CLEAR_STR
5289 BGP_STR
5290 "Clear all external peers\n"
5291 "Soft reconfig\n"
5292 "Soft reconfig outbound update\n")
5293{
5294 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
5295 BGP_CLEAR_SOFT_OUT, NULL);
5296}
5297
5298ALIAS (clear_bgp_external_soft_out,
5299 clear_bgp_ipv6_external_soft_out_cmd,
5300 "clear bgp ipv6 external soft out",
5301 CLEAR_STR
5302 BGP_STR
5303 "Address family\n"
5304 "Clear all external peers\n"
5305 "Soft reconfig\n"
5306 "Soft reconfig outbound update\n")
5307
5308ALIAS (clear_bgp_external_soft_out,
5309 clear_bgp_external_out_cmd,
5310 "clear bgp external out",
5311 CLEAR_STR
5312 BGP_STR
5313 "Clear all external peers\n"
5314 "Soft reconfig outbound update\n")
5315
5316ALIAS (clear_bgp_external_soft_out,
5317 clear_bgp_ipv6_external_out_cmd,
5318 "clear bgp ipv6 external WORD out",
5319 CLEAR_STR
5320 BGP_STR
5321 "Address family\n"
5322 "Clear all external peers\n"
5323 "Soft reconfig outbound update\n")
5324
5325DEFUN (clear_ip_bgp_as_soft_out,
5326 clear_ip_bgp_as_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005327 "clear ip bgp " CMD_AS_RANGE " soft out",
paul718e3742002-12-13 20:15:29 +00005328 CLEAR_STR
5329 IP_STR
5330 BGP_STR
5331 "Clear peers with the AS number\n"
5332 "Soft reconfig\n"
5333 "Soft reconfig outbound update\n")
5334{
5335 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
5336 BGP_CLEAR_SOFT_OUT, argv[0]);
5337}
5338
5339ALIAS (clear_ip_bgp_as_soft_out,
5340 clear_ip_bgp_as_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005341 "clear ip bgp " CMD_AS_RANGE " out",
paul718e3742002-12-13 20:15:29 +00005342 CLEAR_STR
5343 IP_STR
5344 BGP_STR
5345 "Clear peers with the AS number\n"
5346 "Soft reconfig outbound update\n")
5347
5348DEFUN (clear_ip_bgp_as_ipv4_soft_out,
5349 clear_ip_bgp_as_ipv4_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005350 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft out",
paul718e3742002-12-13 20:15:29 +00005351 CLEAR_STR
5352 IP_STR
5353 BGP_STR
5354 "Clear peers with the AS number\n"
5355 "Address family\n"
5356 "Address Family modifier\n"
5357 "Address Family modifier\n"
5358 "Soft reconfig\n"
5359 "Soft reconfig outbound update\n")
5360{
5361 if (strncmp (argv[1], "m", 1) == 0)
5362 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
5363 BGP_CLEAR_SOFT_OUT, argv[0]);
5364
5365 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
5366 BGP_CLEAR_SOFT_OUT, argv[0]);
5367}
5368
5369ALIAS (clear_ip_bgp_as_ipv4_soft_out,
5370 clear_ip_bgp_as_ipv4_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005371 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) out",
paul718e3742002-12-13 20:15:29 +00005372 CLEAR_STR
5373 IP_STR
5374 BGP_STR
5375 "Clear peers with the AS number\n"
5376 "Address family\n"
5377 "Address Family modifier\n"
5378 "Address Family modifier\n"
5379 "Soft reconfig outbound update\n")
5380
5381DEFUN (clear_ip_bgp_as_vpnv4_soft_out,
5382 clear_ip_bgp_as_vpnv4_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005383 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast 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 "Soft reconfig\n"
5391 "Soft reconfig outbound update\n")
5392{
5393 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
5394 BGP_CLEAR_SOFT_OUT, argv[0]);
5395}
5396
5397ALIAS (clear_ip_bgp_as_vpnv4_soft_out,
5398 clear_ip_bgp_as_vpnv4_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005399 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast out",
paul718e3742002-12-13 20:15:29 +00005400 CLEAR_STR
5401 IP_STR
5402 BGP_STR
5403 "Clear peers with the AS number\n"
5404 "Address family\n"
5405 "Address Family modifier\n"
5406 "Soft reconfig outbound update\n")
5407
Lou Berger298cc2f2016-01-12 13:42:02 -05005408DEFUN (clear_ip_bgp_as_encap_soft_out,
5409 clear_ip_bgp_as_encap_soft_out_cmd,
5410 "clear ip bgp " CMD_AS_RANGE " encap unicast soft out",
5411 CLEAR_STR
5412 IP_STR
5413 BGP_STR
5414 "Clear peers with the AS number\n"
5415 "Address family\n"
5416 "Address Family modifier\n"
5417 "Soft reconfig\n"
5418 "Soft reconfig outbound update\n")
5419{
5420 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_as,
5421 BGP_CLEAR_SOFT_OUT, argv[0]);
5422}
5423
5424ALIAS (clear_ip_bgp_as_encap_soft_out,
5425 clear_ip_bgp_as_encap_out_cmd,
5426 "clear ip bgp " CMD_AS_RANGE " encap unicast out",
5427 CLEAR_STR
5428 IP_STR
5429 BGP_STR
5430 "Clear peers with the AS number\n"
5431 "Address family\n"
5432 "Address Family modifier\n"
5433 "Soft reconfig outbound update\n")
5434
paul718e3742002-12-13 20:15:29 +00005435DEFUN (clear_bgp_as_soft_out,
5436 clear_bgp_as_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005437 "clear bgp " CMD_AS_RANGE " soft out",
paul718e3742002-12-13 20:15:29 +00005438 CLEAR_STR
5439 BGP_STR
5440 "Clear peers with the AS number\n"
5441 "Soft reconfig\n"
5442 "Soft reconfig outbound update\n")
5443{
5444 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
5445 BGP_CLEAR_SOFT_OUT, argv[0]);
5446}
5447
5448ALIAS (clear_bgp_as_soft_out,
5449 clear_bgp_ipv6_as_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005450 "clear bgp ipv6 " CMD_AS_RANGE " soft out",
paul718e3742002-12-13 20:15:29 +00005451 CLEAR_STR
5452 BGP_STR
5453 "Address family\n"
5454 "Clear peers with the AS number\n"
5455 "Soft reconfig\n"
5456 "Soft reconfig outbound update\n")
5457
5458ALIAS (clear_bgp_as_soft_out,
5459 clear_bgp_as_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005460 "clear bgp " CMD_AS_RANGE " out",
paul718e3742002-12-13 20:15:29 +00005461 CLEAR_STR
5462 BGP_STR
5463 "Clear peers with the AS number\n"
5464 "Soft reconfig outbound update\n")
5465
5466ALIAS (clear_bgp_as_soft_out,
5467 clear_bgp_ipv6_as_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005468 "clear bgp ipv6 " CMD_AS_RANGE " out",
paul718e3742002-12-13 20:15:29 +00005469 CLEAR_STR
5470 BGP_STR
5471 "Address family\n"
5472 "Clear peers with the AS number\n"
5473 "Soft reconfig outbound update\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02005474
paul718e3742002-12-13 20:15:29 +00005475/* Inbound soft-reconfiguration */
5476DEFUN (clear_ip_bgp_all_soft_in,
5477 clear_ip_bgp_all_soft_in_cmd,
5478 "clear ip bgp * soft in",
5479 CLEAR_STR
5480 IP_STR
5481 BGP_STR
5482 "Clear all peers\n"
5483 "Soft reconfig\n"
5484 "Soft reconfig inbound update\n")
5485{
5486 if (argc == 1)
5487 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5488 BGP_CLEAR_SOFT_IN, NULL);
5489
5490 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5491 BGP_CLEAR_SOFT_IN, NULL);
5492}
5493
5494ALIAS (clear_ip_bgp_all_soft_in,
5495 clear_ip_bgp_instance_all_soft_in_cmd,
5496 "clear ip bgp view WORD * soft in",
5497 CLEAR_STR
5498 IP_STR
5499 BGP_STR
5500 "BGP view\n"
5501 "view name\n"
5502 "Clear all peers\n"
5503 "Soft reconfig\n"
5504 "Soft reconfig inbound update\n")
5505
5506ALIAS (clear_ip_bgp_all_soft_in,
5507 clear_ip_bgp_all_in_cmd,
5508 "clear ip bgp * in",
5509 CLEAR_STR
5510 IP_STR
5511 BGP_STR
5512 "Clear all peers\n"
5513 "Soft reconfig inbound update\n")
5514
5515DEFUN (clear_ip_bgp_all_in_prefix_filter,
5516 clear_ip_bgp_all_in_prefix_filter_cmd,
5517 "clear ip bgp * in prefix-filter",
5518 CLEAR_STR
5519 IP_STR
5520 BGP_STR
5521 "Clear all peers\n"
5522 "Soft reconfig inbound update\n"
5523 "Push out prefix-list ORF and do inbound soft reconfig\n")
5524{
5525 if (argc== 1)
5526 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5527 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5528
5529 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5530 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5531}
5532
5533ALIAS (clear_ip_bgp_all_in_prefix_filter,
5534 clear_ip_bgp_instance_all_in_prefix_filter_cmd,
5535 "clear ip bgp view WORD * in prefix-filter",
5536 CLEAR_STR
5537 IP_STR
5538 BGP_STR
5539 "BGP view\n"
5540 "view name\n"
5541 "Clear all peers\n"
5542 "Soft reconfig inbound update\n"
5543 "Push out prefix-list ORF and do inbound soft reconfig\n")
5544
5545
5546DEFUN (clear_ip_bgp_all_ipv4_soft_in,
5547 clear_ip_bgp_all_ipv4_soft_in_cmd,
5548 "clear ip bgp * ipv4 (unicast|multicast) soft in",
5549 CLEAR_STR
5550 IP_STR
5551 BGP_STR
5552 "Clear all peers\n"
5553 "Address family\n"
5554 "Address Family modifier\n"
5555 "Address Family modifier\n"
5556 "Soft reconfig\n"
5557 "Soft reconfig inbound update\n")
5558{
5559 if (strncmp (argv[0], "m", 1) == 0)
5560 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
5561 BGP_CLEAR_SOFT_IN, NULL);
5562
5563 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5564 BGP_CLEAR_SOFT_IN, NULL);
5565}
5566
5567ALIAS (clear_ip_bgp_all_ipv4_soft_in,
5568 clear_ip_bgp_all_ipv4_in_cmd,
5569 "clear ip bgp * ipv4 (unicast|multicast) in",
5570 CLEAR_STR
5571 IP_STR
5572 BGP_STR
5573 "Clear all peers\n"
5574 "Address family\n"
5575 "Address Family modifier\n"
5576 "Address Family modifier\n"
5577 "Soft reconfig inbound update\n")
5578
5579DEFUN (clear_ip_bgp_instance_all_ipv4_soft_in,
5580 clear_ip_bgp_instance_all_ipv4_soft_in_cmd,
5581 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft in",
5582 CLEAR_STR
5583 IP_STR
5584 BGP_STR
5585 "BGP view\n"
5586 "view name\n"
5587 "Clear all peers\n"
5588 "Address family\n"
5589 "Address Family modifier\n"
5590 "Address Family modifier\n"
5591 "Soft reconfig\n"
5592 "Soft reconfig inbound update\n")
5593{
5594 if (strncmp (argv[1], "m", 1) == 0)
5595 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
5596 BGP_CLEAR_SOFT_IN, NULL);
5597
5598 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5599 BGP_CLEAR_SOFT_IN, NULL);
5600}
5601
5602DEFUN (clear_ip_bgp_all_ipv4_in_prefix_filter,
5603 clear_ip_bgp_all_ipv4_in_prefix_filter_cmd,
5604 "clear ip bgp * ipv4 (unicast|multicast) in prefix-filter",
5605 CLEAR_STR
5606 IP_STR
5607 BGP_STR
5608 "Clear all peers\n"
5609 "Address family\n"
5610 "Address Family modifier\n"
5611 "Address Family modifier\n"
5612 "Soft reconfig inbound update\n"
5613 "Push out prefix-list ORF and do inbound soft reconfig\n")
5614{
5615 if (strncmp (argv[0], "m", 1) == 0)
5616 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
5617 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5618
5619 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5620 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5621}
5622
5623DEFUN (clear_ip_bgp_instance_all_ipv4_in_prefix_filter,
5624 clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd,
5625 "clear ip bgp view WORD * ipv4 (unicast|multicast) in prefix-filter",
5626 CLEAR_STR
5627 IP_STR
5628 BGP_STR
5629 "Clear all peers\n"
5630 "Address family\n"
5631 "Address Family modifier\n"
5632 "Address Family modifier\n"
5633 "Soft reconfig inbound update\n"
5634 "Push out prefix-list ORF and do inbound soft reconfig\n")
5635{
5636 if (strncmp (argv[1], "m", 1) == 0)
5637 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
5638 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5639
5640 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5641 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5642}
5643
5644DEFUN (clear_ip_bgp_all_vpnv4_soft_in,
5645 clear_ip_bgp_all_vpnv4_soft_in_cmd,
5646 "clear ip bgp * vpnv4 unicast soft in",
5647 CLEAR_STR
5648 IP_STR
5649 BGP_STR
5650 "Clear all peers\n"
5651 "Address family\n"
5652 "Address Family Modifier\n"
5653 "Soft reconfig\n"
5654 "Soft reconfig inbound update\n")
5655{
5656 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
5657 BGP_CLEAR_SOFT_IN, NULL);
5658}
5659
5660ALIAS (clear_ip_bgp_all_vpnv4_soft_in,
5661 clear_ip_bgp_all_vpnv4_in_cmd,
5662 "clear ip bgp * vpnv4 unicast in",
5663 CLEAR_STR
5664 IP_STR
5665 BGP_STR
5666 "Clear all peers\n"
5667 "Address family\n"
5668 "Address Family Modifier\n"
5669 "Soft reconfig inbound update\n")
5670
Lou Berger298cc2f2016-01-12 13:42:02 -05005671DEFUN (clear_ip_bgp_all_encap_soft_in,
5672 clear_ip_bgp_all_encap_soft_in_cmd,
5673 "clear ip bgp * encap unicast soft in",
5674 CLEAR_STR
5675 IP_STR
5676 BGP_STR
5677 "Clear all peers\n"
5678 "Address family\n"
5679 "Address Family Modifier\n"
5680 "Soft reconfig\n"
5681 "Soft reconfig inbound update\n")
5682{
5683 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_all,
5684 BGP_CLEAR_SOFT_IN, NULL);
5685}
5686
5687ALIAS (clear_ip_bgp_all_encap_soft_in,
5688 clear_ip_bgp_all_encap_in_cmd,
5689 "clear ip bgp * encap unicast in",
5690 CLEAR_STR
5691 IP_STR
5692 BGP_STR
5693 "Clear all peers\n"
5694 "Address family\n"
5695 "Address Family Modifier\n"
5696 "Soft reconfig inbound update\n")
5697
paul718e3742002-12-13 20:15:29 +00005698DEFUN (clear_bgp_all_soft_in,
5699 clear_bgp_all_soft_in_cmd,
5700 "clear bgp * soft in",
5701 CLEAR_STR
5702 BGP_STR
5703 "Clear all peers\n"
5704 "Soft reconfig\n"
5705 "Soft reconfig inbound update\n")
5706{
5707 if (argc == 1)
5708 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
5709 BGP_CLEAR_SOFT_IN, NULL);
5710
5711 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
5712 BGP_CLEAR_SOFT_IN, NULL);
5713}
5714
5715ALIAS (clear_bgp_all_soft_in,
5716 clear_bgp_instance_all_soft_in_cmd,
5717 "clear bgp view WORD * soft in",
5718 CLEAR_STR
5719 BGP_STR
5720 "BGP view\n"
5721 "view name\n"
5722 "Clear all peers\n"
5723 "Soft reconfig\n"
5724 "Soft reconfig inbound update\n")
5725
5726ALIAS (clear_bgp_all_soft_in,
5727 clear_bgp_ipv6_all_soft_in_cmd,
5728 "clear bgp ipv6 * soft in",
5729 CLEAR_STR
5730 BGP_STR
5731 "Address family\n"
5732 "Clear all peers\n"
5733 "Soft reconfig\n"
5734 "Soft reconfig inbound update\n")
5735
5736ALIAS (clear_bgp_all_soft_in,
5737 clear_bgp_all_in_cmd,
5738 "clear bgp * in",
5739 CLEAR_STR
5740 BGP_STR
5741 "Clear all peers\n"
5742 "Soft reconfig inbound update\n")
5743
5744ALIAS (clear_bgp_all_soft_in,
5745 clear_bgp_ipv6_all_in_cmd,
5746 "clear bgp ipv6 * in",
5747 CLEAR_STR
5748 BGP_STR
5749 "Address family\n"
5750 "Clear all peers\n"
5751 "Soft reconfig inbound update\n")
5752
5753DEFUN (clear_bgp_all_in_prefix_filter,
5754 clear_bgp_all_in_prefix_filter_cmd,
5755 "clear bgp * in prefix-filter",
5756 CLEAR_STR
5757 BGP_STR
5758 "Clear all peers\n"
5759 "Soft reconfig inbound update\n"
5760 "Push out prefix-list ORF and do inbound soft reconfig\n")
5761{
5762 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
5763 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5764}
5765
5766ALIAS (clear_bgp_all_in_prefix_filter,
5767 clear_bgp_ipv6_all_in_prefix_filter_cmd,
5768 "clear bgp ipv6 * in prefix-filter",
5769 CLEAR_STR
5770 BGP_STR
5771 "Address family\n"
5772 "Clear all peers\n"
5773 "Soft reconfig inbound update\n"
5774 "Push out prefix-list ORF and do inbound soft reconfig\n")
5775
5776DEFUN (clear_ip_bgp_peer_soft_in,
5777 clear_ip_bgp_peer_soft_in_cmd,
5778 "clear ip bgp A.B.C.D soft in",
5779 CLEAR_STR
5780 IP_STR
5781 BGP_STR
5782 "BGP neighbor address to clear\n"
5783 "Soft reconfig\n"
5784 "Soft reconfig inbound update\n")
5785{
5786 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5787 BGP_CLEAR_SOFT_IN, argv[0]);
5788}
5789
5790ALIAS (clear_ip_bgp_peer_soft_in,
5791 clear_ip_bgp_peer_in_cmd,
5792 "clear ip bgp A.B.C.D in",
5793 CLEAR_STR
5794 IP_STR
5795 BGP_STR
5796 "BGP neighbor address to clear\n"
5797 "Soft reconfig inbound update\n")
5798
5799DEFUN (clear_ip_bgp_peer_in_prefix_filter,
5800 clear_ip_bgp_peer_in_prefix_filter_cmd,
5801 "clear ip bgp A.B.C.D in prefix-filter",
5802 CLEAR_STR
5803 IP_STR
5804 BGP_STR
5805 "BGP neighbor address to clear\n"
5806 "Soft reconfig inbound update\n"
5807 "Push out the existing ORF prefix-list\n")
5808{
5809 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5810 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5811}
5812
5813DEFUN (clear_ip_bgp_peer_ipv4_soft_in,
5814 clear_ip_bgp_peer_ipv4_soft_in_cmd,
5815 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft in",
5816 CLEAR_STR
5817 IP_STR
5818 BGP_STR
5819 "BGP neighbor address to clear\n"
5820 "Address family\n"
5821 "Address Family modifier\n"
5822 "Address Family modifier\n"
5823 "Soft reconfig\n"
5824 "Soft reconfig inbound update\n")
5825{
5826 if (strncmp (argv[1], "m", 1) == 0)
5827 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
5828 BGP_CLEAR_SOFT_IN, argv[0]);
5829
5830 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5831 BGP_CLEAR_SOFT_IN, argv[0]);
5832}
5833
5834ALIAS (clear_ip_bgp_peer_ipv4_soft_in,
5835 clear_ip_bgp_peer_ipv4_in_cmd,
5836 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in",
5837 CLEAR_STR
5838 IP_STR
5839 BGP_STR
5840 "BGP neighbor address to clear\n"
5841 "Address family\n"
5842 "Address Family modifier\n"
5843 "Address Family modifier\n"
5844 "Soft reconfig inbound update\n")
5845
5846DEFUN (clear_ip_bgp_peer_ipv4_in_prefix_filter,
5847 clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd,
5848 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in prefix-filter",
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 inbound update\n"
5857 "Push out the existing ORF prefix-list\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_ORF_PREFIX, argv[0]);
5862
5863 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5864 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5865}
5866
5867DEFUN (clear_ip_bgp_peer_vpnv4_soft_in,
5868 clear_ip_bgp_peer_vpnv4_soft_in_cmd,
5869 "clear ip bgp A.B.C.D vpnv4 unicast soft 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 "Soft reconfig\n"
5877 "Soft reconfig inbound update\n")
5878{
5879 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
5880 BGP_CLEAR_SOFT_IN, argv[0]);
5881}
5882
5883ALIAS (clear_ip_bgp_peer_vpnv4_soft_in,
5884 clear_ip_bgp_peer_vpnv4_in_cmd,
5885 "clear ip bgp A.B.C.D vpnv4 unicast in",
5886 CLEAR_STR
5887 IP_STR
5888 BGP_STR
5889 "BGP neighbor address to clear\n"
5890 "Address family\n"
5891 "Address Family Modifier\n"
5892 "Soft reconfig inbound update\n")
5893
Lou Berger298cc2f2016-01-12 13:42:02 -05005894DEFUN (clear_ip_bgp_peer_encap_soft_in,
5895 clear_ip_bgp_peer_encap_soft_in_cmd,
5896 "clear ip bgp A.B.C.D encap unicast soft in",
5897 CLEAR_STR
5898 IP_STR
5899 BGP_STR
5900 "BGP neighbor address to clear\n"
5901 "Address family\n"
5902 "Address Family Modifier\n"
5903 "Soft reconfig\n"
5904 "Soft reconfig inbound update\n")
5905{
5906 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_peer,
5907 BGP_CLEAR_SOFT_IN, argv[0]);
5908}
5909
5910ALIAS (clear_ip_bgp_peer_encap_soft_in,
5911 clear_ip_bgp_peer_encap_in_cmd,
5912 "clear ip bgp A.B.C.D encap unicast in",
5913 CLEAR_STR
5914 IP_STR
5915 BGP_STR
5916 "BGP neighbor address to clear\n"
5917 "Address family\n"
5918 "Address Family Modifier\n"
5919 "Soft reconfig inbound update\n")
5920
paul718e3742002-12-13 20:15:29 +00005921DEFUN (clear_bgp_peer_soft_in,
5922 clear_bgp_peer_soft_in_cmd,
5923 "clear bgp (A.B.C.D|X:X::X:X) soft in",
5924 CLEAR_STR
5925 BGP_STR
5926 "BGP neighbor address to clear\n"
5927 "BGP IPv6 neighbor to clear\n"
5928 "Soft reconfig\n"
5929 "Soft reconfig inbound update\n")
5930{
5931 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
5932 BGP_CLEAR_SOFT_IN, argv[0]);
5933}
5934
5935ALIAS (clear_bgp_peer_soft_in,
5936 clear_bgp_ipv6_peer_soft_in_cmd,
5937 "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft in",
5938 CLEAR_STR
5939 BGP_STR
5940 "Address family\n"
5941 "BGP neighbor address to clear\n"
5942 "BGP IPv6 neighbor to clear\n"
5943 "Soft reconfig\n"
5944 "Soft reconfig inbound update\n")
5945
5946ALIAS (clear_bgp_peer_soft_in,
5947 clear_bgp_peer_in_cmd,
5948 "clear bgp (A.B.C.D|X:X::X:X) in",
5949 CLEAR_STR
5950 BGP_STR
5951 "BGP neighbor address to clear\n"
5952 "BGP IPv6 neighbor to clear\n"
5953 "Soft reconfig inbound update\n")
5954
5955ALIAS (clear_bgp_peer_soft_in,
5956 clear_bgp_ipv6_peer_in_cmd,
5957 "clear bgp ipv6 (A.B.C.D|X:X::X:X) in",
5958 CLEAR_STR
5959 BGP_STR
5960 "Address family\n"
5961 "BGP neighbor address to clear\n"
5962 "BGP IPv6 neighbor to clear\n"
5963 "Soft reconfig inbound update\n")
5964
5965DEFUN (clear_bgp_peer_in_prefix_filter,
5966 clear_bgp_peer_in_prefix_filter_cmd,
5967 "clear bgp (A.B.C.D|X:X::X:X) in prefix-filter",
5968 CLEAR_STR
5969 BGP_STR
5970 "BGP neighbor address to clear\n"
5971 "BGP IPv6 neighbor to clear\n"
5972 "Soft reconfig inbound update\n"
5973 "Push out the existing ORF prefix-list\n")
5974{
5975 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
5976 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5977}
5978
5979ALIAS (clear_bgp_peer_in_prefix_filter,
5980 clear_bgp_ipv6_peer_in_prefix_filter_cmd,
5981 "clear bgp ipv6 (A.B.C.D|X:X::X:X) in prefix-filter",
5982 CLEAR_STR
5983 BGP_STR
5984 "Address family\n"
5985 "BGP neighbor address to clear\n"
5986 "BGP IPv6 neighbor to clear\n"
5987 "Soft reconfig inbound update\n"
5988 "Push out the existing ORF prefix-list\n")
5989
5990DEFUN (clear_ip_bgp_peer_group_soft_in,
5991 clear_ip_bgp_peer_group_soft_in_cmd,
5992 "clear ip bgp peer-group WORD soft in",
5993 CLEAR_STR
5994 IP_STR
5995 BGP_STR
5996 "Clear all members of peer-group\n"
5997 "BGP peer-group name\n"
5998 "Soft reconfig\n"
5999 "Soft reconfig inbound update\n")
6000{
6001 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6002 BGP_CLEAR_SOFT_IN, argv[0]);
6003}
6004
6005ALIAS (clear_ip_bgp_peer_group_soft_in,
6006 clear_ip_bgp_peer_group_in_cmd,
6007 "clear ip bgp peer-group WORD in",
6008 CLEAR_STR
6009 IP_STR
6010 BGP_STR
6011 "Clear all members of peer-group\n"
6012 "BGP peer-group name\n"
6013 "Soft reconfig inbound update\n")
6014
6015DEFUN (clear_ip_bgp_peer_group_in_prefix_filter,
6016 clear_ip_bgp_peer_group_in_prefix_filter_cmd,
6017 "clear ip bgp peer-group WORD in prefix-filter",
6018 CLEAR_STR
6019 IP_STR
6020 BGP_STR
6021 "Clear all members of peer-group\n"
6022 "BGP peer-group name\n"
6023 "Soft reconfig inbound update\n"
6024 "Push out prefix-list ORF and do inbound soft reconfig\n")
6025{
6026 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6027 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6028}
6029
6030DEFUN (clear_ip_bgp_peer_group_ipv4_soft_in,
6031 clear_ip_bgp_peer_group_ipv4_soft_in_cmd,
6032 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft in",
6033 CLEAR_STR
6034 IP_STR
6035 BGP_STR
6036 "Clear all members of peer-group\n"
6037 "BGP peer-group name\n"
6038 "Address family\n"
6039 "Address Family modifier\n"
6040 "Address Family modifier\n"
6041 "Soft reconfig\n"
6042 "Soft reconfig inbound update\n")
6043{
6044 if (strncmp (argv[1], "m", 1) == 0)
6045 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
6046 BGP_CLEAR_SOFT_IN, argv[0]);
6047
6048 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6049 BGP_CLEAR_SOFT_IN, argv[0]);
6050}
6051
6052ALIAS (clear_ip_bgp_peer_group_ipv4_soft_in,
6053 clear_ip_bgp_peer_group_ipv4_in_cmd,
6054 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in",
6055 CLEAR_STR
6056 IP_STR
6057 BGP_STR
6058 "Clear all members of peer-group\n"
6059 "BGP peer-group name\n"
6060 "Address family\n"
6061 "Address Family modifier\n"
6062 "Address Family modifier\n"
6063 "Soft reconfig inbound update\n")
6064
6065DEFUN (clear_ip_bgp_peer_group_ipv4_in_prefix_filter,
6066 clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd,
6067 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in prefix-filter",
6068 CLEAR_STR
6069 IP_STR
6070 BGP_STR
6071 "Clear all members of peer-group\n"
6072 "BGP peer-group name\n"
6073 "Address family\n"
6074 "Address Family modifier\n"
6075 "Address Family modifier\n"
6076 "Soft reconfig inbound update\n"
6077 "Push out prefix-list ORF and do inbound soft reconfig\n")
6078{
6079 if (strncmp (argv[1], "m", 1) == 0)
6080 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
6081 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6082
6083 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6084 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6085}
6086
6087DEFUN (clear_bgp_peer_group_soft_in,
6088 clear_bgp_peer_group_soft_in_cmd,
6089 "clear bgp peer-group WORD soft in",
6090 CLEAR_STR
6091 BGP_STR
6092 "Clear all members of peer-group\n"
6093 "BGP peer-group name\n"
6094 "Soft reconfig\n"
6095 "Soft reconfig inbound update\n")
6096{
6097 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
6098 BGP_CLEAR_SOFT_IN, argv[0]);
6099}
6100
6101ALIAS (clear_bgp_peer_group_soft_in,
6102 clear_bgp_ipv6_peer_group_soft_in_cmd,
6103 "clear bgp ipv6 peer-group WORD soft in",
6104 CLEAR_STR
6105 BGP_STR
6106 "Address family\n"
6107 "Clear all members of peer-group\n"
6108 "BGP peer-group name\n"
6109 "Soft reconfig\n"
6110 "Soft reconfig inbound update\n")
6111
6112ALIAS (clear_bgp_peer_group_soft_in,
6113 clear_bgp_peer_group_in_cmd,
6114 "clear bgp peer-group WORD in",
6115 CLEAR_STR
6116 BGP_STR
6117 "Clear all members of peer-group\n"
6118 "BGP peer-group name\n"
6119 "Soft reconfig inbound update\n")
6120
6121ALIAS (clear_bgp_peer_group_soft_in,
6122 clear_bgp_ipv6_peer_group_in_cmd,
6123 "clear bgp ipv6 peer-group WORD in",
6124 CLEAR_STR
6125 BGP_STR
6126 "Address family\n"
6127 "Clear all members of peer-group\n"
6128 "BGP peer-group name\n"
6129 "Soft reconfig inbound update\n")
6130
6131DEFUN (clear_bgp_peer_group_in_prefix_filter,
6132 clear_bgp_peer_group_in_prefix_filter_cmd,
6133 "clear bgp peer-group WORD in prefix-filter",
6134 CLEAR_STR
6135 BGP_STR
6136 "Clear all members of peer-group\n"
6137 "BGP peer-group name\n"
6138 "Soft reconfig inbound update\n"
6139 "Push out prefix-list ORF and do inbound soft reconfig\n")
6140{
6141 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
6142 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6143}
6144
6145ALIAS (clear_bgp_peer_group_in_prefix_filter,
6146 clear_bgp_ipv6_peer_group_in_prefix_filter_cmd,
6147 "clear bgp ipv6 peer-group WORD in prefix-filter",
6148 CLEAR_STR
6149 BGP_STR
6150 "Address family\n"
6151 "Clear all members of peer-group\n"
6152 "BGP peer-group name\n"
6153 "Soft reconfig inbound update\n"
6154 "Push out prefix-list ORF and do inbound soft reconfig\n")
6155
6156DEFUN (clear_ip_bgp_external_soft_in,
6157 clear_ip_bgp_external_soft_in_cmd,
6158 "clear ip bgp external soft in",
6159 CLEAR_STR
6160 IP_STR
6161 BGP_STR
6162 "Clear all external peers\n"
6163 "Soft reconfig\n"
6164 "Soft reconfig inbound update\n")
6165{
6166 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6167 BGP_CLEAR_SOFT_IN, NULL);
6168}
6169
6170ALIAS (clear_ip_bgp_external_soft_in,
6171 clear_ip_bgp_external_in_cmd,
6172 "clear ip bgp external in",
6173 CLEAR_STR
6174 IP_STR
6175 BGP_STR
6176 "Clear all external peers\n"
6177 "Soft reconfig inbound update\n")
6178
6179DEFUN (clear_ip_bgp_external_in_prefix_filter,
6180 clear_ip_bgp_external_in_prefix_filter_cmd,
6181 "clear ip bgp external in prefix-filter",
6182 CLEAR_STR
6183 IP_STR
6184 BGP_STR
6185 "Clear all external peers\n"
6186 "Soft reconfig inbound update\n"
6187 "Push out prefix-list ORF and do inbound soft reconfig\n")
6188{
6189 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6190 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
6191}
6192
6193DEFUN (clear_ip_bgp_external_ipv4_soft_in,
6194 clear_ip_bgp_external_ipv4_soft_in_cmd,
6195 "clear ip bgp external ipv4 (unicast|multicast) soft in",
6196 CLEAR_STR
6197 IP_STR
6198 BGP_STR
6199 "Clear all external peers\n"
6200 "Address family\n"
6201 "Address Family modifier\n"
6202 "Address Family modifier\n"
6203 "Soft reconfig\n"
6204 "Soft reconfig inbound update\n")
6205{
6206 if (strncmp (argv[0], "m", 1) == 0)
6207 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
6208 BGP_CLEAR_SOFT_IN, NULL);
6209
6210 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6211 BGP_CLEAR_SOFT_IN, NULL);
6212}
6213
6214ALIAS (clear_ip_bgp_external_ipv4_soft_in,
6215 clear_ip_bgp_external_ipv4_in_cmd,
6216 "clear ip bgp external ipv4 (unicast|multicast) in",
6217 CLEAR_STR
6218 IP_STR
6219 BGP_STR
6220 "Clear all external peers\n"
6221 "Address family\n"
6222 "Address Family modifier\n"
6223 "Address Family modifier\n"
6224 "Soft reconfig inbound update\n")
6225
6226DEFUN (clear_ip_bgp_external_ipv4_in_prefix_filter,
6227 clear_ip_bgp_external_ipv4_in_prefix_filter_cmd,
6228 "clear ip bgp external ipv4 (unicast|multicast) in prefix-filter",
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 inbound update\n"
6237 "Push out prefix-list ORF and do inbound soft reconfig\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_ORF_PREFIX, NULL);
6242
6243 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6244 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
6245}
6246
6247DEFUN (clear_bgp_external_soft_in,
6248 clear_bgp_external_soft_in_cmd,
6249 "clear bgp external soft in",
6250 CLEAR_STR
6251 BGP_STR
6252 "Clear all external peers\n"
6253 "Soft reconfig\n"
6254 "Soft reconfig inbound update\n")
6255{
6256 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
6257 BGP_CLEAR_SOFT_IN, NULL);
6258}
6259
6260ALIAS (clear_bgp_external_soft_in,
6261 clear_bgp_ipv6_external_soft_in_cmd,
6262 "clear bgp ipv6 external soft in",
6263 CLEAR_STR
6264 BGP_STR
6265 "Address family\n"
6266 "Clear all external peers\n"
6267 "Soft reconfig\n"
6268 "Soft reconfig inbound update\n")
6269
6270ALIAS (clear_bgp_external_soft_in,
6271 clear_bgp_external_in_cmd,
6272 "clear bgp external in",
6273 CLEAR_STR
6274 BGP_STR
6275 "Clear all external peers\n"
6276 "Soft reconfig inbound update\n")
6277
6278ALIAS (clear_bgp_external_soft_in,
6279 clear_bgp_ipv6_external_in_cmd,
6280 "clear bgp ipv6 external WORD in",
6281 CLEAR_STR
6282 BGP_STR
6283 "Address family\n"
6284 "Clear all external peers\n"
6285 "Soft reconfig inbound update\n")
6286
6287DEFUN (clear_bgp_external_in_prefix_filter,
6288 clear_bgp_external_in_prefix_filter_cmd,
6289 "clear bgp external in prefix-filter",
6290 CLEAR_STR
6291 BGP_STR
6292 "Clear all external peers\n"
6293 "Soft reconfig inbound update\n"
6294 "Push out prefix-list ORF and do inbound soft reconfig\n")
6295{
6296 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
6297 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
6298}
6299
6300ALIAS (clear_bgp_external_in_prefix_filter,
6301 clear_bgp_ipv6_external_in_prefix_filter_cmd,
6302 "clear bgp ipv6 external in prefix-filter",
6303 CLEAR_STR
6304 BGP_STR
6305 "Address family\n"
6306 "Clear all external peers\n"
6307 "Soft reconfig inbound update\n"
6308 "Push out prefix-list ORF and do inbound soft reconfig\n")
6309
6310DEFUN (clear_ip_bgp_as_soft_in,
6311 clear_ip_bgp_as_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006312 "clear ip bgp " CMD_AS_RANGE " soft in",
paul718e3742002-12-13 20:15:29 +00006313 CLEAR_STR
6314 IP_STR
6315 BGP_STR
6316 "Clear peers with the AS number\n"
6317 "Soft reconfig\n"
6318 "Soft reconfig inbound update\n")
6319{
6320 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6321 BGP_CLEAR_SOFT_IN, argv[0]);
6322}
6323
6324ALIAS (clear_ip_bgp_as_soft_in,
6325 clear_ip_bgp_as_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006326 "clear ip bgp " CMD_AS_RANGE " in",
paul718e3742002-12-13 20:15:29 +00006327 CLEAR_STR
6328 IP_STR
6329 BGP_STR
6330 "Clear peers with the AS number\n"
6331 "Soft reconfig inbound update\n")
6332
6333DEFUN (clear_ip_bgp_as_in_prefix_filter,
6334 clear_ip_bgp_as_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006335 "clear ip bgp " CMD_AS_RANGE " in prefix-filter",
paul718e3742002-12-13 20:15:29 +00006336 CLEAR_STR
6337 IP_STR
6338 BGP_STR
6339 "Clear peers with the AS number\n"
6340 "Soft reconfig inbound update\n"
6341 "Push out prefix-list ORF and do inbound soft reconfig\n")
6342{
6343 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6344 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6345}
6346
6347DEFUN (clear_ip_bgp_as_ipv4_soft_in,
6348 clear_ip_bgp_as_ipv4_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006349 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft in",
paul718e3742002-12-13 20:15:29 +00006350 CLEAR_STR
6351 IP_STR
6352 BGP_STR
6353 "Clear peers with the AS number\n"
6354 "Address family\n"
6355 "Address Family modifier\n"
6356 "Address Family modifier\n"
6357 "Soft reconfig\n"
6358 "Soft reconfig inbound update\n")
6359{
6360 if (strncmp (argv[1], "m", 1) == 0)
6361 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
6362 BGP_CLEAR_SOFT_IN, argv[0]);
6363
6364 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6365 BGP_CLEAR_SOFT_IN, argv[0]);
6366}
6367
6368ALIAS (clear_ip_bgp_as_ipv4_soft_in,
6369 clear_ip_bgp_as_ipv4_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006370 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in",
paul718e3742002-12-13 20:15:29 +00006371 CLEAR_STR
6372 IP_STR
6373 BGP_STR
6374 "Clear peers with the AS number\n"
6375 "Address family\n"
6376 "Address Family modifier\n"
6377 "Address Family modifier\n"
6378 "Soft reconfig inbound update\n")
6379
6380DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter,
6381 clear_ip_bgp_as_ipv4_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006382 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in prefix-filter",
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 inbound update\n"
6391 "Push out prefix-list ORF and do inbound soft reconfig\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_ORF_PREFIX, argv[0]);
6396
6397 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6398 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6399}
6400
6401DEFUN (clear_ip_bgp_as_vpnv4_soft_in,
6402 clear_ip_bgp_as_vpnv4_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006403 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft 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 "Soft reconfig\n"
6411 "Soft reconfig inbound update\n")
6412{
6413 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
6414 BGP_CLEAR_SOFT_IN, argv[0]);
6415}
6416
6417ALIAS (clear_ip_bgp_as_vpnv4_soft_in,
6418 clear_ip_bgp_as_vpnv4_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006419 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast in",
paul718e3742002-12-13 20:15:29 +00006420 CLEAR_STR
6421 IP_STR
6422 BGP_STR
6423 "Clear peers with the AS number\n"
6424 "Address family\n"
6425 "Address Family modifier\n"
6426 "Soft reconfig inbound update\n")
6427
Lou Berger298cc2f2016-01-12 13:42:02 -05006428DEFUN (clear_ip_bgp_as_encap_soft_in,
6429 clear_ip_bgp_as_encap_soft_in_cmd,
6430 "clear ip bgp " CMD_AS_RANGE " encap unicast soft in",
6431 CLEAR_STR
6432 IP_STR
6433 BGP_STR
6434 "Clear peers with the AS number\n"
6435 "Address family\n"
6436 "Address Family modifier\n"
6437 "Soft reconfig\n"
6438 "Soft reconfig inbound update\n")
6439{
6440 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_as,
6441 BGP_CLEAR_SOFT_IN, argv[0]);
6442}
6443
6444ALIAS (clear_ip_bgp_as_encap_soft_in,
6445 clear_ip_bgp_as_encap_in_cmd,
6446 "clear ip bgp " CMD_AS_RANGE " encap unicast in",
6447 CLEAR_STR
6448 IP_STR
6449 BGP_STR
6450 "Clear peers with the AS number\n"
6451 "Address family\n"
6452 "Address Family modifier\n"
6453 "Soft reconfig inbound update\n")
6454
paul718e3742002-12-13 20:15:29 +00006455DEFUN (clear_bgp_as_soft_in,
6456 clear_bgp_as_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006457 "clear bgp " CMD_AS_RANGE " soft in",
paul718e3742002-12-13 20:15:29 +00006458 CLEAR_STR
6459 BGP_STR
6460 "Clear peers with the AS number\n"
6461 "Soft reconfig\n"
6462 "Soft reconfig inbound update\n")
6463{
6464 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
6465 BGP_CLEAR_SOFT_IN, argv[0]);
6466}
6467
6468ALIAS (clear_bgp_as_soft_in,
6469 clear_bgp_ipv6_as_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006470 "clear bgp ipv6 " CMD_AS_RANGE " soft in",
paul718e3742002-12-13 20:15:29 +00006471 CLEAR_STR
6472 BGP_STR
6473 "Address family\n"
6474 "Clear peers with the AS number\n"
6475 "Soft reconfig\n"
6476 "Soft reconfig inbound update\n")
6477
6478ALIAS (clear_bgp_as_soft_in,
6479 clear_bgp_as_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006480 "clear bgp " CMD_AS_RANGE " in",
paul718e3742002-12-13 20:15:29 +00006481 CLEAR_STR
6482 BGP_STR
6483 "Clear peers with the AS number\n"
6484 "Soft reconfig inbound update\n")
6485
6486ALIAS (clear_bgp_as_soft_in,
6487 clear_bgp_ipv6_as_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006488 "clear bgp ipv6 " CMD_AS_RANGE " in",
paul718e3742002-12-13 20:15:29 +00006489 CLEAR_STR
6490 BGP_STR
6491 "Address family\n"
6492 "Clear peers with the AS number\n"
6493 "Soft reconfig inbound update\n")
6494
6495DEFUN (clear_bgp_as_in_prefix_filter,
6496 clear_bgp_as_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006497 "clear bgp " CMD_AS_RANGE " in prefix-filter",
paul718e3742002-12-13 20:15:29 +00006498 CLEAR_STR
6499 BGP_STR
6500 "Clear peers with the AS number\n"
6501 "Soft reconfig inbound update\n"
6502 "Push out prefix-list ORF and do inbound soft reconfig\n")
6503{
6504 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
6505 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6506}
6507
6508ALIAS (clear_bgp_as_in_prefix_filter,
6509 clear_bgp_ipv6_as_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006510 "clear bgp ipv6 " CMD_AS_RANGE " in prefix-filter",
paul718e3742002-12-13 20:15:29 +00006511 CLEAR_STR
6512 BGP_STR
6513 "Address family\n"
6514 "Clear peers with the AS number\n"
6515 "Soft reconfig inbound update\n"
6516 "Push out prefix-list ORF and do inbound soft reconfig\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02006517
paul718e3742002-12-13 20:15:29 +00006518/* Both soft-reconfiguration */
6519DEFUN (clear_ip_bgp_all_soft,
6520 clear_ip_bgp_all_soft_cmd,
6521 "clear ip bgp * soft",
6522 CLEAR_STR
6523 IP_STR
6524 BGP_STR
6525 "Clear all peers\n"
6526 "Soft reconfig\n")
6527{
6528 if (argc == 1)
6529 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
6530 BGP_CLEAR_SOFT_BOTH, NULL);
6531
6532 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6533 BGP_CLEAR_SOFT_BOTH, NULL);
6534}
6535
6536ALIAS (clear_ip_bgp_all_soft,
6537 clear_ip_bgp_instance_all_soft_cmd,
6538 "clear ip bgp view WORD * soft",
6539 CLEAR_STR
6540 IP_STR
6541 BGP_STR
6542 "BGP view\n"
6543 "view name\n"
6544 "Clear all peers\n"
6545 "Soft reconfig\n")
6546
6547
6548DEFUN (clear_ip_bgp_all_ipv4_soft,
6549 clear_ip_bgp_all_ipv4_soft_cmd,
6550 "clear ip bgp * ipv4 (unicast|multicast) soft",
6551 CLEAR_STR
6552 IP_STR
6553 BGP_STR
6554 "Clear all peers\n"
6555 "Address family\n"
6556 "Address Family Modifier\n"
6557 "Address Family Modifier\n"
6558 "Soft reconfig\n")
6559{
6560 if (strncmp (argv[0], "m", 1) == 0)
6561 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
6562 BGP_CLEAR_SOFT_BOTH, NULL);
6563
6564 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6565 BGP_CLEAR_SOFT_BOTH, NULL);
6566}
6567
6568DEFUN (clear_ip_bgp_instance_all_ipv4_soft,
6569 clear_ip_bgp_instance_all_ipv4_soft_cmd,
6570 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft",
6571 CLEAR_STR
6572 IP_STR
6573 BGP_STR
6574 "BGP view\n"
6575 "view name\n"
6576 "Clear all peers\n"
6577 "Address family\n"
6578 "Address Family Modifier\n"
6579 "Address Family Modifier\n"
6580 "Soft reconfig\n")
6581{
6582 if (strncmp (argv[1], "m", 1) == 0)
6583 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
6584 BGP_CLEAR_SOFT_BOTH, NULL);
6585
6586 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6587 BGP_CLEAR_SOFT_BOTH, NULL);
6588}
6589
6590DEFUN (clear_ip_bgp_all_vpnv4_soft,
6591 clear_ip_bgp_all_vpnv4_soft_cmd,
6592 "clear ip bgp * vpnv4 unicast soft",
6593 CLEAR_STR
6594 IP_STR
6595 BGP_STR
6596 "Clear all peers\n"
6597 "Address family\n"
6598 "Address Family Modifier\n"
6599 "Soft reconfig\n")
6600{
6601 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
6602 BGP_CLEAR_SOFT_BOTH, argv[0]);
6603}
6604
Lou Berger298cc2f2016-01-12 13:42:02 -05006605DEFUN (clear_ip_bgp_all_encap_soft,
6606 clear_ip_bgp_all_encap_soft_cmd,
6607 "clear ip bgp * encap unicast soft",
6608 CLEAR_STR
6609 IP_STR
6610 BGP_STR
6611 "Clear all peers\n"
6612 "Address family\n"
6613 "Address Family Modifier\n"
6614 "Soft reconfig\n")
6615{
6616 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_all,
6617 BGP_CLEAR_SOFT_BOTH, argv[0]);
6618}
6619
paul718e3742002-12-13 20:15:29 +00006620DEFUN (clear_bgp_all_soft,
6621 clear_bgp_all_soft_cmd,
6622 "clear bgp * soft",
6623 CLEAR_STR
6624 BGP_STR
6625 "Clear all peers\n"
6626 "Soft reconfig\n")
6627{
6628 if (argc == 1)
6629 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
6630 BGP_CLEAR_SOFT_BOTH, argv[0]);
6631
6632 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
6633 BGP_CLEAR_SOFT_BOTH, argv[0]);
6634}
6635
6636ALIAS (clear_bgp_all_soft,
6637 clear_bgp_instance_all_soft_cmd,
6638 "clear bgp view WORD * soft",
6639 CLEAR_STR
6640 BGP_STR
6641 "BGP view\n"
6642 "view name\n"
6643 "Clear all peers\n"
6644 "Soft reconfig\n")
6645
6646ALIAS (clear_bgp_all_soft,
6647 clear_bgp_ipv6_all_soft_cmd,
6648 "clear bgp ipv6 * soft",
6649 CLEAR_STR
6650 BGP_STR
6651 "Address family\n"
6652 "Clear all peers\n"
6653 "Soft reconfig\n")
6654
6655DEFUN (clear_ip_bgp_peer_soft,
6656 clear_ip_bgp_peer_soft_cmd,
6657 "clear ip bgp A.B.C.D soft",
6658 CLEAR_STR
6659 IP_STR
6660 BGP_STR
6661 "BGP neighbor address to clear\n"
6662 "Soft reconfig\n")
6663{
6664 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6665 BGP_CLEAR_SOFT_BOTH, argv[0]);
6666}
6667
6668DEFUN (clear_ip_bgp_peer_ipv4_soft,
6669 clear_ip_bgp_peer_ipv4_soft_cmd,
6670 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft",
6671 CLEAR_STR
6672 IP_STR
6673 BGP_STR
6674 "BGP neighbor address to clear\n"
6675 "Address family\n"
6676 "Address Family Modifier\n"
6677 "Address Family Modifier\n"
6678 "Soft reconfig\n")
6679{
6680 if (strncmp (argv[1], "m", 1) == 0)
6681 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
6682 BGP_CLEAR_SOFT_BOTH, argv[0]);
6683
6684 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6685 BGP_CLEAR_SOFT_BOTH, argv[0]);
6686}
6687
6688DEFUN (clear_ip_bgp_peer_vpnv4_soft,
6689 clear_ip_bgp_peer_vpnv4_soft_cmd,
6690 "clear ip bgp A.B.C.D vpnv4 unicast soft",
6691 CLEAR_STR
6692 IP_STR
6693 BGP_STR
6694 "BGP neighbor address to clear\n"
6695 "Address family\n"
6696 "Address Family Modifier\n"
6697 "Soft reconfig\n")
6698{
6699 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
6700 BGP_CLEAR_SOFT_BOTH, argv[0]);
6701}
6702
Lou Berger298cc2f2016-01-12 13:42:02 -05006703DEFUN (clear_ip_bgp_peer_encap_soft,
6704 clear_ip_bgp_peer_encap_soft_cmd,
6705 "clear ip bgp A.B.C.D encap unicast soft",
6706 CLEAR_STR
6707 IP_STR
6708 BGP_STR
6709 "BGP neighbor address to clear\n"
6710 "Address family\n"
6711 "Address Family Modifier\n"
6712 "Soft reconfig\n")
6713{
6714 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_peer,
6715 BGP_CLEAR_SOFT_BOTH, argv[0]);
6716}
6717
paul718e3742002-12-13 20:15:29 +00006718DEFUN (clear_bgp_peer_soft,
6719 clear_bgp_peer_soft_cmd,
6720 "clear bgp (A.B.C.D|X:X::X:X) soft",
6721 CLEAR_STR
6722 BGP_STR
6723 "BGP neighbor address to clear\n"
6724 "BGP IPv6 neighbor to clear\n"
6725 "Soft reconfig\n")
6726{
6727 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
6728 BGP_CLEAR_SOFT_BOTH, argv[0]);
6729}
6730
6731ALIAS (clear_bgp_peer_soft,
6732 clear_bgp_ipv6_peer_soft_cmd,
6733 "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft",
6734 CLEAR_STR
6735 BGP_STR
6736 "Address family\n"
6737 "BGP neighbor address to clear\n"
6738 "BGP IPv6 neighbor to clear\n"
6739 "Soft reconfig\n")
6740
6741DEFUN (clear_ip_bgp_peer_group_soft,
6742 clear_ip_bgp_peer_group_soft_cmd,
6743 "clear ip bgp peer-group WORD soft",
6744 CLEAR_STR
6745 IP_STR
6746 BGP_STR
6747 "Clear all members of peer-group\n"
6748 "BGP peer-group name\n"
6749 "Soft reconfig\n")
6750{
6751 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6752 BGP_CLEAR_SOFT_BOTH, argv[0]);
6753}
6754
6755DEFUN (clear_ip_bgp_peer_group_ipv4_soft,
6756 clear_ip_bgp_peer_group_ipv4_soft_cmd,
6757 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft",
6758 CLEAR_STR
6759 IP_STR
6760 BGP_STR
6761 "Clear all members of peer-group\n"
6762 "BGP peer-group name\n"
6763 "Address family\n"
6764 "Address Family modifier\n"
6765 "Address Family modifier\n"
6766 "Soft reconfig\n")
6767{
6768 if (strncmp (argv[1], "m", 1) == 0)
6769 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
6770 BGP_CLEAR_SOFT_BOTH, argv[0]);
6771
6772 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6773 BGP_CLEAR_SOFT_BOTH, argv[0]);
6774}
6775
6776DEFUN (clear_bgp_peer_group_soft,
6777 clear_bgp_peer_group_soft_cmd,
6778 "clear bgp peer-group WORD soft",
6779 CLEAR_STR
6780 BGP_STR
6781 "Clear all members of peer-group\n"
6782 "BGP peer-group name\n"
6783 "Soft reconfig\n")
6784{
6785 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
6786 BGP_CLEAR_SOFT_BOTH, argv[0]);
6787}
6788
6789ALIAS (clear_bgp_peer_group_soft,
6790 clear_bgp_ipv6_peer_group_soft_cmd,
6791 "clear bgp ipv6 peer-group WORD soft",
6792 CLEAR_STR
6793 BGP_STR
6794 "Address family\n"
6795 "Clear all members of peer-group\n"
6796 "BGP peer-group name\n"
6797 "Soft reconfig\n")
6798
6799DEFUN (clear_ip_bgp_external_soft,
6800 clear_ip_bgp_external_soft_cmd,
6801 "clear ip bgp external soft",
6802 CLEAR_STR
6803 IP_STR
6804 BGP_STR
6805 "Clear all external peers\n"
6806 "Soft reconfig\n")
6807{
6808 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6809 BGP_CLEAR_SOFT_BOTH, NULL);
6810}
6811
6812DEFUN (clear_ip_bgp_external_ipv4_soft,
6813 clear_ip_bgp_external_ipv4_soft_cmd,
6814 "clear ip bgp external ipv4 (unicast|multicast) soft",
6815 CLEAR_STR
6816 IP_STR
6817 BGP_STR
6818 "Clear all external peers\n"
6819 "Address family\n"
6820 "Address Family modifier\n"
6821 "Address Family modifier\n"
6822 "Soft reconfig\n")
6823{
6824 if (strncmp (argv[0], "m", 1) == 0)
6825 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
6826 BGP_CLEAR_SOFT_BOTH, NULL);
6827
6828 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6829 BGP_CLEAR_SOFT_BOTH, NULL);
6830}
6831
6832DEFUN (clear_bgp_external_soft,
6833 clear_bgp_external_soft_cmd,
6834 "clear bgp external soft",
6835 CLEAR_STR
6836 BGP_STR
6837 "Clear all external peers\n"
6838 "Soft reconfig\n")
6839{
6840 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
6841 BGP_CLEAR_SOFT_BOTH, NULL);
6842}
6843
6844ALIAS (clear_bgp_external_soft,
6845 clear_bgp_ipv6_external_soft_cmd,
6846 "clear bgp ipv6 external soft",
6847 CLEAR_STR
6848 BGP_STR
6849 "Address family\n"
6850 "Clear all external peers\n"
6851 "Soft reconfig\n")
6852
6853DEFUN (clear_ip_bgp_as_soft,
6854 clear_ip_bgp_as_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006855 "clear ip bgp " CMD_AS_RANGE " soft",
paul718e3742002-12-13 20:15:29 +00006856 CLEAR_STR
6857 IP_STR
6858 BGP_STR
6859 "Clear peers with the AS number\n"
6860 "Soft reconfig\n")
6861{
6862 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6863 BGP_CLEAR_SOFT_BOTH, argv[0]);
6864}
6865
6866DEFUN (clear_ip_bgp_as_ipv4_soft,
6867 clear_ip_bgp_as_ipv4_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006868 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft",
paul718e3742002-12-13 20:15:29 +00006869 CLEAR_STR
6870 IP_STR
6871 BGP_STR
6872 "Clear peers with the AS number\n"
6873 "Address family\n"
6874 "Address Family Modifier\n"
6875 "Address Family Modifier\n"
6876 "Soft reconfig\n")
6877{
6878 if (strncmp (argv[1], "m", 1) == 0)
6879 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
6880 BGP_CLEAR_SOFT_BOTH, argv[0]);
6881
6882 return bgp_clear_vty (vty, NULL,AFI_IP, SAFI_UNICAST, clear_as,
6883 BGP_CLEAR_SOFT_BOTH, argv[0]);
6884}
6885
6886DEFUN (clear_ip_bgp_as_vpnv4_soft,
6887 clear_ip_bgp_as_vpnv4_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006888 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast 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 "Address family\n"
6894 "Address Family Modifier\n"
6895 "Soft reconfig\n")
6896{
6897 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
6898 BGP_CLEAR_SOFT_BOTH, argv[0]);
6899}
6900
Lou Berger298cc2f2016-01-12 13:42:02 -05006901DEFUN (clear_ip_bgp_as_encap_soft,
6902 clear_ip_bgp_as_encap_soft_cmd,
6903 "clear ip bgp " CMD_AS_RANGE " encap unicast soft",
6904 CLEAR_STR
6905 IP_STR
6906 BGP_STR
6907 "Clear peers with the AS number\n"
6908 "Address family\n"
6909 "Address Family Modifier\n"
6910 "Soft reconfig\n")
6911{
6912 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_ENCAP, clear_as,
6913 BGP_CLEAR_SOFT_BOTH, argv[0]);
6914}
6915
paul718e3742002-12-13 20:15:29 +00006916DEFUN (clear_bgp_as_soft,
6917 clear_bgp_as_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006918 "clear bgp " CMD_AS_RANGE " soft",
paul718e3742002-12-13 20:15:29 +00006919 CLEAR_STR
6920 BGP_STR
6921 "Clear peers with the AS number\n"
6922 "Soft reconfig\n")
6923{
6924 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
6925 BGP_CLEAR_SOFT_BOTH, argv[0]);
6926}
6927
6928ALIAS (clear_bgp_as_soft,
6929 clear_bgp_ipv6_as_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006930 "clear bgp ipv6 " CMD_AS_RANGE " soft",
paul718e3742002-12-13 20:15:29 +00006931 CLEAR_STR
6932 BGP_STR
6933 "Address family\n"
6934 "Clear peers with the AS number\n"
6935 "Soft reconfig\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02006936
paulfee0f4c2004-09-13 05:12:46 +00006937/* RS-client soft reconfiguration. */
6938#ifdef HAVE_IPV6
6939DEFUN (clear_bgp_all_rsclient,
6940 clear_bgp_all_rsclient_cmd,
6941 "clear bgp * rsclient",
6942 CLEAR_STR
6943 BGP_STR
6944 "Clear all peers\n"
6945 "Soft reconfig for rsclient RIB\n")
6946{
6947 if (argc == 1)
6948 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
6949 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6950
6951 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
6952 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6953}
6954
6955ALIAS (clear_bgp_all_rsclient,
6956 clear_bgp_ipv6_all_rsclient_cmd,
6957 "clear bgp ipv6 * rsclient",
6958 CLEAR_STR
6959 BGP_STR
6960 "Address family\n"
6961 "Clear all peers\n"
6962 "Soft reconfig for rsclient RIB\n")
6963
6964ALIAS (clear_bgp_all_rsclient,
6965 clear_bgp_instance_all_rsclient_cmd,
6966 "clear bgp view WORD * rsclient",
6967 CLEAR_STR
6968 BGP_STR
6969 "BGP view\n"
6970 "view name\n"
6971 "Clear all peers\n"
6972 "Soft reconfig for rsclient RIB\n")
6973
6974ALIAS (clear_bgp_all_rsclient,
6975 clear_bgp_ipv6_instance_all_rsclient_cmd,
6976 "clear bgp ipv6 view WORD * rsclient",
6977 CLEAR_STR
6978 BGP_STR
6979 "Address family\n"
6980 "BGP view\n"
6981 "view name\n"
6982 "Clear all peers\n"
6983 "Soft reconfig for rsclient RIB\n")
6984#endif /* HAVE_IPV6 */
6985
6986DEFUN (clear_ip_bgp_all_rsclient,
6987 clear_ip_bgp_all_rsclient_cmd,
6988 "clear ip bgp * rsclient",
6989 CLEAR_STR
6990 IP_STR
6991 BGP_STR
6992 "Clear all peers\n"
6993 "Soft reconfig for rsclient RIB\n")
6994{
6995 if (argc == 1)
6996 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
6997 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6998
6999 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
7000 BGP_CLEAR_SOFT_RSCLIENT, NULL);
7001}
7002
7003ALIAS (clear_ip_bgp_all_rsclient,
7004 clear_ip_bgp_instance_all_rsclient_cmd,
7005 "clear ip bgp view WORD * rsclient",
7006 CLEAR_STR
7007 IP_STR
7008 BGP_STR
7009 "BGP view\n"
7010 "view name\n"
7011 "Clear all peers\n"
7012 "Soft reconfig for rsclient RIB\n")
7013
7014#ifdef HAVE_IPV6
7015DEFUN (clear_bgp_peer_rsclient,
7016 clear_bgp_peer_rsclient_cmd,
7017 "clear bgp (A.B.C.D|X:X::X:X) rsclient",
7018 CLEAR_STR
7019 BGP_STR
7020 "BGP neighbor IP address to clear\n"
7021 "BGP IPv6 neighbor to clear\n"
7022 "Soft reconfig for rsclient RIB\n")
7023{
7024 if (argc == 2)
7025 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_peer,
7026 BGP_CLEAR_SOFT_RSCLIENT, argv[1]);
7027
7028 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
7029 BGP_CLEAR_SOFT_RSCLIENT, argv[0]);
7030}
7031
7032ALIAS (clear_bgp_peer_rsclient,
7033 clear_bgp_ipv6_peer_rsclient_cmd,
7034 "clear bgp ipv6 (A.B.C.D|X:X::X:X) rsclient",
7035 CLEAR_STR
7036 BGP_STR
7037 "Address family\n"
7038 "BGP neighbor IP address to clear\n"
7039 "BGP IPv6 neighbor to clear\n"
7040 "Soft reconfig for rsclient RIB\n")
7041
7042ALIAS (clear_bgp_peer_rsclient,
7043 clear_bgp_instance_peer_rsclient_cmd,
7044 "clear bgp view WORD (A.B.C.D|X:X::X:X) rsclient",
7045 CLEAR_STR
7046 BGP_STR
7047 "BGP view\n"
7048 "view name\n"
7049 "BGP neighbor IP address to clear\n"
7050 "BGP IPv6 neighbor to clear\n"
7051 "Soft reconfig for rsclient RIB\n")
7052
7053ALIAS (clear_bgp_peer_rsclient,
7054 clear_bgp_ipv6_instance_peer_rsclient_cmd,
7055 "clear bgp ipv6 view WORD (A.B.C.D|X:X::X:X) rsclient",
7056 CLEAR_STR
7057 BGP_STR
7058 "Address family\n"
7059 "BGP view\n"
7060 "view name\n"
7061 "BGP neighbor IP address to clear\n"
7062 "BGP IPv6 neighbor to clear\n"
7063 "Soft reconfig for rsclient RIB\n")
7064#endif /* HAVE_IPV6 */
7065
7066DEFUN (clear_ip_bgp_peer_rsclient,
7067 clear_ip_bgp_peer_rsclient_cmd,
7068 "clear ip bgp (A.B.C.D|X:X::X:X) rsclient",
7069 CLEAR_STR
7070 IP_STR
7071 BGP_STR
7072 "BGP neighbor IP address to clear\n"
7073 "BGP IPv6 neighbor to clear\n"
7074 "Soft reconfig for rsclient RIB\n")
7075{
7076 if (argc == 2)
7077 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_peer,
7078 BGP_CLEAR_SOFT_RSCLIENT, argv[1]);
7079
7080 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
7081 BGP_CLEAR_SOFT_RSCLIENT, argv[0]);
7082}
7083
7084ALIAS (clear_ip_bgp_peer_rsclient,
7085 clear_ip_bgp_instance_peer_rsclient_cmd,
7086 "clear ip bgp view WORD (A.B.C.D|X:X::X:X) rsclient",
7087 CLEAR_STR
7088 IP_STR
7089 BGP_STR
7090 "BGP view\n"
7091 "view name\n"
7092 "BGP neighbor IP address to clear\n"
7093 "BGP IPv6 neighbor to clear\n"
7094 "Soft reconfig for rsclient RIB\n")
7095
Michael Lamberte0081f72008-11-16 20:12:04 +00007096DEFUN (show_bgp_views,
7097 show_bgp_views_cmd,
7098 "show bgp views",
7099 SHOW_STR
7100 BGP_STR
7101 "Show the defined BGP views\n")
7102{
7103 struct list *inst = bm->bgp;
7104 struct listnode *node;
7105 struct bgp *bgp;
7106
7107 if (!bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE))
7108 {
7109 vty_out (vty, "Multiple BGP views are not defined%s", VTY_NEWLINE);
7110 return CMD_WARNING;
7111 }
7112
7113 vty_out (vty, "Defined BGP views:%s", VTY_NEWLINE);
7114 for (ALL_LIST_ELEMENTS_RO(inst, node, bgp))
7115 vty_out (vty, "\t%s (AS%u)%s",
7116 bgp->name ? bgp->name : "(null)",
7117 bgp->as, VTY_NEWLINE);
7118
7119 return CMD_SUCCESS;
7120}
7121
Paul Jakma4bf6a362006-03-30 14:05:23 +00007122DEFUN (show_bgp_memory,
7123 show_bgp_memory_cmd,
7124 "show bgp memory",
7125 SHOW_STR
7126 BGP_STR
7127 "Global BGP memory statistics\n")
7128{
7129 char memstrbuf[MTYPE_MEMSTR_LEN];
7130 unsigned long count;
7131
7132 /* RIB related usage stats */
7133 count = mtype_stats_alloc (MTYPE_BGP_NODE);
7134 vty_out (vty, "%ld RIB nodes, using %s of memory%s", count,
7135 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7136 count * sizeof (struct bgp_node)),
7137 VTY_NEWLINE);
7138
7139 count = mtype_stats_alloc (MTYPE_BGP_ROUTE);
7140 vty_out (vty, "%ld BGP routes, using %s of memory%s", count,
7141 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7142 count * sizeof (struct bgp_info)),
7143 VTY_NEWLINE);
Paul Jakmafb982c22007-05-04 20:15:47 +00007144 if ((count = mtype_stats_alloc (MTYPE_BGP_ROUTE_EXTRA)))
7145 vty_out (vty, "%ld BGP route ancillaries, using %s of memory%s", count,
7146 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7147 count * sizeof (struct bgp_info_extra)),
7148 VTY_NEWLINE);
Paul Jakma4bf6a362006-03-30 14:05:23 +00007149
7150 if ((count = mtype_stats_alloc (MTYPE_BGP_STATIC)))
7151 vty_out (vty, "%ld Static routes, using %s of memory%s", count,
7152 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7153 count * sizeof (struct bgp_static)),
7154 VTY_NEWLINE);
7155
7156 /* Adj-In/Out */
7157 if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_IN)))
7158 vty_out (vty, "%ld Adj-In entries, using %s of memory%s", count,
7159 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7160 count * sizeof (struct bgp_adj_in)),
7161 VTY_NEWLINE);
7162 if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_OUT)))
7163 vty_out (vty, "%ld Adj-Out entries, using %s of memory%s", count,
7164 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7165 count * sizeof (struct bgp_adj_out)),
7166 VTY_NEWLINE);
7167
7168 if ((count = mtype_stats_alloc (MTYPE_BGP_NEXTHOP_CACHE)))
7169 vty_out (vty, "%ld Nexthop cache entries, using %s of memory%s", count,
7170 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7171 count * sizeof (struct bgp_nexthop_cache)),
7172 VTY_NEWLINE);
7173
7174 if ((count = mtype_stats_alloc (MTYPE_BGP_DAMP_INFO)))
7175 vty_out (vty, "%ld Dampening entries, using %s of memory%s", count,
7176 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7177 count * sizeof (struct bgp_damp_info)),
7178 VTY_NEWLINE);
7179
7180 /* Attributes */
7181 count = attr_count();
7182 vty_out (vty, "%ld BGP attributes, using %s of memory%s", count,
7183 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7184 count * sizeof(struct attr)),
7185 VTY_NEWLINE);
Paul Jakmafb982c22007-05-04 20:15:47 +00007186 if ((count = mtype_stats_alloc (MTYPE_ATTR_EXTRA)))
7187 vty_out (vty, "%ld BGP extra attributes, using %s of memory%s", count,
7188 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7189 count * sizeof(struct attr_extra)),
7190 VTY_NEWLINE);
Paul Jakma4bf6a362006-03-30 14:05:23 +00007191
7192 if ((count = attr_unknown_count()))
7193 vty_out (vty, "%ld unknown attributes%s", count, VTY_NEWLINE);
7194
7195 /* AS_PATH attributes */
7196 count = aspath_count ();
7197 vty_out (vty, "%ld BGP AS-PATH entries, using %s of memory%s", count,
7198 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7199 count * sizeof (struct aspath)),
7200 VTY_NEWLINE);
7201
7202 count = mtype_stats_alloc (MTYPE_AS_SEG);
7203 vty_out (vty, "%ld BGP AS-PATH segments, using %s of memory%s", count,
7204 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7205 count * sizeof (struct assegment)),
7206 VTY_NEWLINE);
7207
7208 /* Other attributes */
7209 if ((count = community_count ()))
7210 vty_out (vty, "%ld BGP community entries, using %s of memory%s", count,
7211 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7212 count * sizeof (struct community)),
7213 VTY_NEWLINE);
7214 if ((count = mtype_stats_alloc (MTYPE_ECOMMUNITY)))
7215 vty_out (vty, "%ld BGP community entries, using %s of memory%s", count,
7216 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7217 count * sizeof (struct ecommunity)),
7218 VTY_NEWLINE);
7219
7220 if ((count = mtype_stats_alloc (MTYPE_CLUSTER)))
7221 vty_out (vty, "%ld Cluster lists, using %s of memory%s", count,
7222 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7223 count * sizeof (struct cluster_list)),
7224 VTY_NEWLINE);
7225
7226 /* Peer related usage */
7227 count = mtype_stats_alloc (MTYPE_BGP_PEER);
7228 vty_out (vty, "%ld peers, using %s of memory%s", count,
7229 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7230 count * sizeof (struct peer)),
7231 VTY_NEWLINE);
7232
7233 if ((count = mtype_stats_alloc (MTYPE_PEER_GROUP)))
7234 vty_out (vty, "%ld peer groups, using %s of memory%s", count,
7235 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7236 count * sizeof (struct peer_group)),
7237 VTY_NEWLINE);
7238
7239 /* Other */
7240 if ((count = mtype_stats_alloc (MTYPE_HASH)))
7241 vty_out (vty, "%ld hash tables, using %s of memory%s", count,
7242 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7243 count * sizeof (struct hash)),
7244 VTY_NEWLINE);
7245 if ((count = mtype_stats_alloc (MTYPE_HASH_BACKET)))
7246 vty_out (vty, "%ld hash buckets, using %s of memory%s", count,
7247 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7248 count * sizeof (struct hash_backet)),
7249 VTY_NEWLINE);
7250 if ((count = mtype_stats_alloc (MTYPE_BGP_REGEXP)))
7251 vty_out (vty, "%ld compiled regexes, using %s of memory%s", count,
7252 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7253 count * sizeof (regex_t)),
7254 VTY_NEWLINE);
7255 return CMD_SUCCESS;
7256}
paulfee0f4c2004-09-13 05:12:46 +00007257
paul718e3742002-12-13 20:15:29 +00007258/* Show BGP peer's summary information. */
paul94f2b392005-06-28 12:44:16 +00007259static int
paul718e3742002-12-13 20:15:29 +00007260bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi)
7261{
7262 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00007263 struct listnode *node, *nnode;
Paul Jakma4bf6a362006-03-30 14:05:23 +00007264 unsigned int count = 0;
paul718e3742002-12-13 20:15:29 +00007265 char timebuf[BGP_UPTIME_LEN];
7266 int len;
7267
7268 /* Header string for each address family. */
Milan Kociancb4fc592014-12-01 12:48:25 +00007269 static char header[] = "Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd";
Paul Jakma4bf6a362006-03-30 14:05:23 +00007270
paul1eb8ef22005-04-07 07:30:20 +00007271 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00007272 {
7273 if (peer->afc[afi][safi])
7274 {
Paul Jakma4bf6a362006-03-30 14:05:23 +00007275 if (!count)
7276 {
7277 unsigned long ents;
7278 char memstrbuf[MTYPE_MEMSTR_LEN];
7279
7280 /* Usage summary and header */
7281 vty_out (vty,
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04007282 "BGP router identifier %s, local AS number %u%s",
Paul Jakma4bf6a362006-03-30 14:05:23 +00007283 inet_ntoa (bgp->router_id), bgp->as, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007284
Paul Jakma4bf6a362006-03-30 14:05:23 +00007285 ents = bgp_table_count (bgp->rib[afi][safi]);
7286 vty_out (vty, "RIB entries %ld, using %s of memory%s", ents,
7287 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7288 ents * sizeof (struct bgp_node)),
7289 VTY_NEWLINE);
7290
7291 /* Peer related usage */
7292 ents = listcount (bgp->peer);
7293 vty_out (vty, "Peers %ld, using %s of memory%s",
7294 ents,
7295 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7296 ents * sizeof (struct peer)),
7297 VTY_NEWLINE);
7298
7299 if ((ents = listcount (bgp->rsclient)))
7300 vty_out (vty, "RS-Client peers %ld, using %s of memory%s",
7301 ents,
7302 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7303 ents * sizeof (struct peer)),
7304 VTY_NEWLINE);
7305
7306 if ((ents = listcount (bgp->group)))
7307 vty_out (vty, "Peer groups %ld, using %s of memory%s", ents,
7308 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7309 ents * sizeof (struct peer_group)),
7310 VTY_NEWLINE);
7311
7312 if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING))
7313 vty_out (vty, "Dampening enabled.%s", VTY_NEWLINE);
7314 vty_out (vty, "%s", VTY_NEWLINE);
7315 vty_out (vty, "%s%s", header, VTY_NEWLINE);
7316 }
7317
paul718e3742002-12-13 20:15:29 +00007318 count++;
7319
7320 len = vty_out (vty, "%s", peer->host);
7321 len = 16 - len;
7322 if (len < 1)
7323 vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " ");
7324 else
7325 vty_out (vty, "%*s", len, " ");
7326
hasso3d515fd2005-02-01 21:30:04 +00007327 vty_out (vty, "4 ");
paul718e3742002-12-13 20:15:29 +00007328
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04007329 vty_out (vty, "%5u %7d %7d %8d %4d %4lu ",
paul718e3742002-12-13 20:15:29 +00007330 peer->as,
7331 peer->open_in + peer->update_in + peer->keepalive_in
7332 + peer->notify_in + peer->refresh_in + peer->dynamic_cap_in,
7333 peer->open_out + peer->update_out + peer->keepalive_out
7334 + peer->notify_out + peer->refresh_out
7335 + peer->dynamic_cap_out,
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00007336 0, 0, (unsigned long) peer->obuf->count);
paul718e3742002-12-13 20:15:29 +00007337
7338 vty_out (vty, "%8s",
7339 peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN));
7340
7341 if (peer->status == Established)
7342 {
7343 vty_out (vty, " %8ld", peer->pcount[afi][safi]);
7344 }
7345 else
7346 {
7347 if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN))
7348 vty_out (vty, " Idle (Admin)");
7349 else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW))
7350 vty_out (vty, " Idle (PfxCt)");
7351 else
7352 vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, peer->status));
7353 }
7354
7355 vty_out (vty, "%s", VTY_NEWLINE);
7356 }
7357 }
7358
7359 if (count)
7360 vty_out (vty, "%sTotal number of neighbors %d%s", VTY_NEWLINE,
7361 count, VTY_NEWLINE);
7362 else
7363 vty_out (vty, "No %s neighbor is configured%s",
7364 afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE);
7365 return CMD_SUCCESS;
7366}
7367
paul94f2b392005-06-28 12:44:16 +00007368static int
paulfd79ac92004-10-13 05:06:08 +00007369bgp_show_summary_vty (struct vty *vty, const char *name,
7370 afi_t afi, safi_t safi)
paul718e3742002-12-13 20:15:29 +00007371{
7372 struct bgp *bgp;
7373
7374 if (name)
7375 {
7376 bgp = bgp_lookup_by_name (name);
7377
7378 if (! bgp)
7379 {
7380 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
7381 return CMD_WARNING;
7382 }
7383
7384 bgp_show_summary (vty, bgp, afi, safi);
7385 return CMD_SUCCESS;
7386 }
7387
7388 bgp = bgp_get_default ();
7389
7390 if (bgp)
7391 bgp_show_summary (vty, bgp, afi, safi);
7392
7393 return CMD_SUCCESS;
7394}
7395
7396/* `show ip bgp summary' commands. */
Lou Berger651b4022016-01-12 13:42:07 -05007397DEFUN (show_bgp_ipv4_safi_summary,
7398 show_bgp_ipv4_safi_summary_cmd,
7399 "show bgp ipv4 (unicast|multicast) summary",
paul718e3742002-12-13 20:15:29 +00007400 SHOW_STR
paul718e3742002-12-13 20:15:29 +00007401 BGP_STR
7402 "Address family\n"
7403 "Address Family modifier\n"
7404 "Address Family modifier\n"
7405 "Summary of BGP neighbor status\n")
7406{
7407 if (strncmp (argv[0], "m", 1) == 0)
7408 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
7409
7410 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
7411}
7412
Lou Berger651b4022016-01-12 13:42:07 -05007413DEFUN (show_bgp_instance_ipv4_safi_summary,
7414 show_bgp_instance_ipv4_safi_summary_cmd,
7415 "show bgp view WORD ipv4 (unicast|multicast) summary",
Michael Lambert95cbbd22010-07-23 14:43:04 -04007416 SHOW_STR
7417 BGP_STR
paul718e3742002-12-13 20:15:29 +00007418 "BGP view\n"
7419 "View name\n"
7420 "Address family\n"
7421 "Address Family modifier\n"
7422 "Address Family modifier\n"
7423 "Summary of BGP neighbor status\n")
7424{
7425 if (strncmp (argv[1], "m", 1) == 0)
7426 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
7427 else
7428 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
7429}
7430
Lou Berger651b4022016-01-12 13:42:07 -05007431DEFUN (show_bgp_ipv4_vpn_summary,
7432 show_bgp_ipv4_vpn_summary_cmd,
7433 "show bgp ipv4 vpn summary",
Michael Lambert95cbbd22010-07-23 14:43:04 -04007434 SHOW_STR
7435 BGP_STR
Lou Berger651b4022016-01-12 13:42:07 -05007436 "IPv4\n"
7437 "Display VPN NLRI specific information\n"
paul718e3742002-12-13 20:15:29 +00007438 "Summary of BGP neighbor status\n")
7439{
7440 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
7441}
7442
paul718e3742002-12-13 20:15:29 +00007443#ifdef HAVE_IPV6
Lou Berger651b4022016-01-12 13:42:07 -05007444
7445/* `show ip bgp summary' commands. */
7446DEFUN (show_bgp_ipv6_vpn_summary,
7447 show_bgp_ipv6_vpn_summary_cmd,
7448 "show bgp ipv6 vpn summary",
paul718e3742002-12-13 20:15:29 +00007449 SHOW_STR
7450 BGP_STR
Lou Berger651b4022016-01-12 13:42:07 -05007451 "IPv6\n"
7452 "Display VPN NLRI specific information\n"
paul718e3742002-12-13 20:15:29 +00007453 "Summary of BGP neighbor status\n")
7454{
Lou Berger651b4022016-01-12 13:42:07 -05007455 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MPLS_VPN);
paul718e3742002-12-13 20:15:29 +00007456}
Lou Berger651b4022016-01-12 13:42:07 -05007457#endif
7458
7459DEFUN (show_bgp_ipv4_encap_summary,
7460 show_bgp_ipv4_encap_summary_cmd,
7461 "show bgp ipv4 encap summary",
7462 SHOW_STR
7463 BGP_STR
7464 "IPv4\n"
7465 "Display ENCAP NLRI specific information\n"
7466 "Summary of BGP neighbor status\n")
7467{
7468 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_ENCAP);
7469}
7470
7471#ifdef HAVE_IPV6
7472
7473DEFUN (show_bgp_ipv6_encap_summary,
7474 show_bgp_ipv6_encap_summary_cmd,
7475 "show bgp ipv6 encap summary",
7476 SHOW_STR
7477 BGP_STR
7478 "IPv6\n"
7479 "Display ENCAP NLRI specific information\n"
7480 "Summary of BGP neighbor status\n")
7481{
7482 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_ENCAP);
7483}
7484
7485#endif
7486
7487
paul718e3742002-12-13 20:15:29 +00007488
7489DEFUN (show_bgp_instance_summary,
7490 show_bgp_instance_summary_cmd,
7491 "show bgp view WORD summary",
7492 SHOW_STR
7493 BGP_STR
7494 "BGP view\n"
7495 "View name\n"
7496 "Summary of BGP neighbor status\n")
7497{
Lou Berger651b4022016-01-12 13:42:07 -05007498 vty_out(vty, "%sIPv4 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7499 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7500 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
7501 vty_out(vty, "%sIPv4 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7502 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7503 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
7504 vty_out(vty, "%sIPv4 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7505 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7506 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MPLS_VPN);
7507 vty_out(vty, "%sIPv4 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7508 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7509 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_ENCAP);
7510
7511#ifdef HAVE_IPV6
7512 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7513 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7514 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
7515 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7516 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7517 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST);
7518 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7519 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7520 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MPLS_VPN);
7521 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7522 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7523 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_ENCAP);
7524#endif
7525 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00007526}
7527
Lou Berger651b4022016-01-12 13:42:07 -05007528DEFUN (show_bgp_instance_ipv4_summary,
7529 show_bgp_instance_ipv4_summary_cmd,
7530 "show bgp view WORD ipv4 summary",
paul718e3742002-12-13 20:15:29 +00007531 SHOW_STR
7532 BGP_STR
Lou Berger651b4022016-01-12 13:42:07 -05007533 IP_STR
7534 "Address Family modifier\n"
7535 "Address Family modifier\n"
7536 "BGP view\n"
7537 "View name\n"
paul718e3742002-12-13 20:15:29 +00007538 "Summary of BGP neighbor status\n")
Lou Berger651b4022016-01-12 13:42:07 -05007539{
7540 vty_out(vty, "%sIPv4 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7541 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7542 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
7543 vty_out(vty, "%sIPv4 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7544 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7545 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
7546 vty_out(vty, "%sIPv4 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7547 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7548 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MPLS_VPN);
7549 vty_out(vty, "%sIPv4 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7550 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7551 bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_ENCAP);
paul718e3742002-12-13 20:15:29 +00007552
Lou Berger651b4022016-01-12 13:42:07 -05007553 return CMD_SUCCESS;
7554}
7555
7556
7557#ifdef HAVE_IPV6
7558DEFUN (show_bgp_instance_ipv6_summary,
paul718e3742002-12-13 20:15:29 +00007559 show_bgp_instance_ipv6_summary_cmd,
7560 "show bgp view WORD ipv6 summary",
7561 SHOW_STR
7562 BGP_STR
Lou Berger651b4022016-01-12 13:42:07 -05007563 IPV6_STR
7564 "Address Family modifier\n"
7565 "Address Family modifier\n"
paul718e3742002-12-13 20:15:29 +00007566 "BGP view\n"
7567 "View name\n"
paul718e3742002-12-13 20:15:29 +00007568 "Summary of BGP neighbor status\n")
Lou Berger651b4022016-01-12 13:42:07 -05007569{
7570 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7571 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7572 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
7573 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7574 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7575 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST);
7576 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7577 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7578 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MPLS_VPN);
7579 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7580 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7581 bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_ENCAP);
7582
7583 return CMD_SUCCESS;
7584}
paul718e3742002-12-13 20:15:29 +00007585
Michael Lambert95cbbd22010-07-23 14:43:04 -04007586DEFUN (show_bgp_ipv6_safi_summary,
7587 show_bgp_ipv6_safi_summary_cmd,
7588 "show bgp ipv6 (unicast|multicast) summary",
7589 SHOW_STR
7590 BGP_STR
7591 "Address family\n"
7592 "Address Family modifier\n"
7593 "Address Family modifier\n"
7594 "Summary of BGP neighbor status\n")
7595{
7596 if (strncmp (argv[0], "m", 1) == 0)
7597 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
7598
7599 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
7600}
7601
7602DEFUN (show_bgp_instance_ipv6_safi_summary,
7603 show_bgp_instance_ipv6_safi_summary_cmd,
7604 "show bgp view WORD ipv6 (unicast|multicast) summary",
7605 SHOW_STR
7606 BGP_STR
7607 "BGP view\n"
7608 "View name\n"
7609 "Address family\n"
7610 "Address Family modifier\n"
7611 "Address Family modifier\n"
7612 "Summary of BGP neighbor status\n")
7613{
7614 if (strncmp (argv[1], "m", 1) == 0)
7615 return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST);
7616
7617 return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
7618}
7619
Lou Berger651b4022016-01-12 13:42:07 -05007620#endif /* HAVE_IPV6 */
7621
7622/* variations of show bgp [...] summary */
7623
7624/* This one is for the 0-keyword variant */
7625DEFUN (show_bgp_summary,
7626 show_bgp_summary_cmd,
7627 "show bgp summary",
paul718e3742002-12-13 20:15:29 +00007628 SHOW_STR
paul718e3742002-12-13 20:15:29 +00007629 BGP_STR
7630 "Summary of BGP neighbor status\n")
7631{
Lou Berger651b4022016-01-12 13:42:07 -05007632 vty_out(vty, "%sIPv4 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7633 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7634 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
7635 vty_out(vty, "%sIPv4 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7636 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7637 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
7638 vty_out(vty, "%sIPv4 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7639 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7640 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
7641 vty_out(vty, "%sIPv4 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7642 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7643 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_ENCAP);
7644
7645#ifdef HAVE_IPV6
7646 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7647 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7648 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
7649 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7650 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7651 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
7652 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7653 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7654 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MPLS_VPN);
7655 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7656 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7657 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_ENCAP);
7658#endif
7659 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00007660}
7661
Lou Berger651b4022016-01-12 13:42:07 -05007662DEFUN (show_bgp_summary_1w,
7663 show_bgp_summary_1w_cmd,
7664#ifdef HAVE_IPV6
7665 "show bgp (ipv4|ipv6|unicast|multicast|vpn|encap) summary",
7666#else
7667 "show bgp (ipv4|unicast|multicast|vpn|encap) summary",
7668#endif
paul718e3742002-12-13 20:15:29 +00007669 SHOW_STR
Lou Berger651b4022016-01-12 13:42:07 -05007670 BGP_STR
7671 IP_STR
7672#ifdef HAVE_IPV6
7673 IP6_STR
7674#endif
7675 "Address Family modifier\n"
7676 "Address Family modifier\n"
7677 "Address Family modifier\n"
7678 "Address Family modifier\n"
paul718e3742002-12-13 20:15:29 +00007679 "Summary of BGP neighbor status\n")
7680{
Lou Berger651b4022016-01-12 13:42:07 -05007681 if (strcmp (argv[0], "ipv4") == 0) {
7682 vty_out(vty, "%sIPv4 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7683 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7684 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
7685 vty_out(vty, "%sIPv4 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7686 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7687 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
7688 vty_out(vty, "%sIPv4 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7689 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7690 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
7691 vty_out(vty, "%sIPv4 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7692 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7693 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_ENCAP);
7694 return CMD_SUCCESS;
7695 }
7696#ifdef HAVE_IPV6
7697 if (strcmp (argv[0], "ipv6") == 0) {
7698 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7699 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7700 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
7701 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7702 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7703 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
7704 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7705 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7706 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MPLS_VPN);
7707 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
7708 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7709 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_ENCAP);
7710 return CMD_SUCCESS;
7711 }
7712#endif
7713 if (strcmp (argv[0], "unicast") == 0) {
7714 vty_out(vty, "IPv4 Unicast Summary:%s", VTY_NEWLINE);
7715 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7716 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
7717#ifdef HAVE_IPV6
7718 vty_out(vty, "%s", VTY_NEWLINE);
7719 vty_out(vty, "IPv6 Unicast Summary:%s", VTY_NEWLINE);
7720 vty_out(vty, "---------------------%s", VTY_NEWLINE);
7721 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
7722#endif
7723 return CMD_SUCCESS;
7724 }
7725 if (strcmp (argv[0], "multicast") == 0) {
7726 vty_out(vty, "IPv4 Multicast Summary:%s", VTY_NEWLINE);
7727 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7728 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
7729#ifdef HAVE_IPV6
7730 vty_out(vty, "%s", VTY_NEWLINE);
7731 vty_out(vty, "IPv6 Multicast Summary:%s", VTY_NEWLINE);
7732 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
7733 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
7734#endif
7735 return CMD_SUCCESS;
7736 }
7737 if (strcmp (argv[0], "vpn") == 0) {
7738 vty_out(vty, "IPv4 VPN Summary:%s", VTY_NEWLINE);
7739 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7740 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
7741#ifdef HAVE_IPV6
7742 vty_out(vty, "%s", VTY_NEWLINE);
7743 vty_out(vty, "IPv6 VPN Summary:%s", VTY_NEWLINE);
7744 vty_out(vty, "-----------------%s", VTY_NEWLINE);
7745 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MPLS_VPN);
7746#endif
7747 return CMD_SUCCESS;
7748 }
7749 if (strcmp (argv[0], "encap") == 0) {
7750 vty_out(vty, "IPv4 Encap Summary:%s", VTY_NEWLINE);
7751 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7752 bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_ENCAP);
7753#ifdef HAVE_IPV6
7754 vty_out(vty, "%s", VTY_NEWLINE);
7755 vty_out(vty, "IPv6 Encap Summary:%s", VTY_NEWLINE);
7756 vty_out(vty, "-------------------%s", VTY_NEWLINE);
7757 bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_ENCAP);
7758#endif
7759 return CMD_SUCCESS;
7760 }
7761 vty_out(vty, "Unknown keyword: %s%s", argv[0], VTY_NEWLINE);
7762 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00007763}
Lou Berger651b4022016-01-12 13:42:07 -05007764
7765
David Lamparter6b0655a2014-06-04 06:53:35 +02007766
paulfd79ac92004-10-13 05:06:08 +00007767const char *
hasso538621f2004-05-21 09:31:30 +00007768afi_safi_print (afi_t afi, safi_t safi)
7769{
7770 if (afi == AFI_IP && safi == SAFI_UNICAST)
7771 return "IPv4 Unicast";
7772 else if (afi == AFI_IP && safi == SAFI_MULTICAST)
7773 return "IPv4 Multicast";
7774 else if (afi == AFI_IP && safi == SAFI_MPLS_VPN)
Lou Berger9da04bc2016-01-12 13:41:55 -05007775 return "VPN-IPv4 Unicast";
Lou Bergera3fda882016-01-12 13:42:04 -05007776 else if (afi == AFI_IP && safi == SAFI_ENCAP)
7777 return "ENCAP-IPv4 Unicast";
hasso538621f2004-05-21 09:31:30 +00007778 else if (afi == AFI_IP6 && safi == SAFI_UNICAST)
7779 return "IPv6 Unicast";
7780 else if (afi == AFI_IP6 && safi == SAFI_MULTICAST)
7781 return "IPv6 Multicast";
Lou Berger9da04bc2016-01-12 13:41:55 -05007782 else if (afi == AFI_IP6 && safi == SAFI_MPLS_VPN)
7783 return "VPN-IPv6 Unicast";
Lou Bergera3fda882016-01-12 13:42:04 -05007784 else if (afi == AFI_IP6 && safi == SAFI_ENCAP)
7785 return "ENCAP-IPv6 Unicast";
hasso538621f2004-05-21 09:31:30 +00007786 else
7787 return "Unknown";
7788}
7789
paul718e3742002-12-13 20:15:29 +00007790/* Show BGP peer's information. */
7791enum show_type
7792{
7793 show_all,
7794 show_peer
7795};
7796
paul94f2b392005-06-28 12:44:16 +00007797static void
paul718e3742002-12-13 20:15:29 +00007798bgp_show_peer_afi_orf_cap (struct vty *vty, struct peer *p,
7799 afi_t afi, safi_t safi,
7800 u_int16_t adv_smcap, u_int16_t adv_rmcap,
7801 u_int16_t rcv_smcap, u_int16_t rcv_rmcap)
7802{
7803 /* Send-Mode */
7804 if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap)
7805 || CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap))
7806 {
7807 vty_out (vty, " Send-mode: ");
7808 if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap))
7809 vty_out (vty, "advertised");
7810 if (CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap))
7811 vty_out (vty, "%sreceived",
7812 CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) ?
7813 ", " : "");
7814 vty_out (vty, "%s", VTY_NEWLINE);
7815 }
7816
7817 /* Receive-Mode */
7818 if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap)
7819 || CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap))
7820 {
7821 vty_out (vty, " Receive-mode: ");
7822 if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap))
7823 vty_out (vty, "advertised");
7824 if (CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap))
7825 vty_out (vty, "%sreceived",
7826 CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) ?
7827 ", " : "");
7828 vty_out (vty, "%s", VTY_NEWLINE);
7829 }
7830}
7831
paul94f2b392005-06-28 12:44:16 +00007832static void
paul718e3742002-12-13 20:15:29 +00007833bgp_show_peer_afi (struct vty *vty, struct peer *p, afi_t afi, safi_t safi)
7834{
7835 struct bgp_filter *filter;
7836 char orf_pfx_name[BUFSIZ];
7837 int orf_pfx_count;
7838
7839 filter = &p->filter[afi][safi];
7840
hasso538621f2004-05-21 09:31:30 +00007841 vty_out (vty, " For address family: %s%s", afi_safi_print (afi, safi),
paul718e3742002-12-13 20:15:29 +00007842 VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00007843
paul718e3742002-12-13 20:15:29 +00007844 if (p->af_group[afi][safi])
7845 vty_out (vty, " %s peer-group member%s", p->group->name, VTY_NEWLINE);
7846
7847 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
7848 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
7849 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)
7850 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
7851 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV)
7852 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
7853 vty_out (vty, " AF-dependant capabilities:%s", VTY_NEWLINE);
7854
7855 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
7856 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
7857 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
7858 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV))
7859 {
7860 vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
7861 ORF_TYPE_PREFIX, VTY_NEWLINE);
7862 bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
7863 PEER_CAP_ORF_PREFIX_SM_ADV,
7864 PEER_CAP_ORF_PREFIX_RM_ADV,
7865 PEER_CAP_ORF_PREFIX_SM_RCV,
7866 PEER_CAP_ORF_PREFIX_RM_RCV);
7867 }
7868 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
7869 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)
7870 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
7871 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
7872 {
7873 vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
7874 ORF_TYPE_PREFIX_OLD, VTY_NEWLINE);
7875 bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
7876 PEER_CAP_ORF_PREFIX_SM_ADV,
7877 PEER_CAP_ORF_PREFIX_RM_ADV,
7878 PEER_CAP_ORF_PREFIX_SM_OLD_RCV,
7879 PEER_CAP_ORF_PREFIX_RM_OLD_RCV);
7880 }
7881
7882 sprintf (orf_pfx_name, "%s.%d.%d", p->host, afi, safi);
7883 orf_pfx_count = prefix_bgp_show_prefix_list (NULL, afi, orf_pfx_name);
7884
7885 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND)
7886 || orf_pfx_count)
7887 {
7888 vty_out (vty, " Outbound Route Filter (ORF):");
7889 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND))
7890 vty_out (vty, " sent;");
7891 if (orf_pfx_count)
7892 vty_out (vty, " received (%d entries)", orf_pfx_count);
7893 vty_out (vty, "%s", VTY_NEWLINE);
7894 }
7895 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH))
7896 vty_out (vty, " First update is deferred until ORF or ROUTE-REFRESH is received%s", VTY_NEWLINE);
7897
7898 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT))
7899 vty_out (vty, " Route-Reflector Client%s", VTY_NEWLINE);
7900 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT))
7901 vty_out (vty, " Route-Server Client%s", VTY_NEWLINE);
7902 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG))
7903 vty_out (vty, " Inbound soft reconfiguration allowed%s", VTY_NEWLINE);
7904 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS))
7905 vty_out (vty, " Private AS number removed from updates to this neighbor%s", VTY_NEWLINE);
7906 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF))
7907 vty_out (vty, " NEXT_HOP is always this router%s", VTY_NEWLINE);
7908 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED))
7909 vty_out (vty, " AS_PATH is propagated unchanged to this neighbor%s", VTY_NEWLINE);
7910 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED))
7911 vty_out (vty, " NEXT_HOP is propagated unchanged to this neighbor%s", VTY_NEWLINE);
7912 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED))
7913 vty_out (vty, " MED is propagated unchanged to this neighbor%s", VTY_NEWLINE);
7914 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
7915 || CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
7916 {
7917 vty_out (vty, " Community attribute sent to this neighbor");
7918 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
7919 && CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
hasso538621f2004-05-21 09:31:30 +00007920 vty_out (vty, "(both)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007921 else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
hasso538621f2004-05-21 09:31:30 +00007922 vty_out (vty, "(extended)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007923 else
hasso538621f2004-05-21 09:31:30 +00007924 vty_out (vty, "(standard)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007925 }
7926 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE))
7927 {
7928 vty_out (vty, " Default information originate,");
7929
7930 if (p->default_rmap[afi][safi].name)
7931 vty_out (vty, " default route-map %s%s,",
7932 p->default_rmap[afi][safi].map ? "*" : "",
7933 p->default_rmap[afi][safi].name);
7934 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_DEFAULT_ORIGINATE))
7935 vty_out (vty, " default sent%s", VTY_NEWLINE);
7936 else
7937 vty_out (vty, " default not sent%s", VTY_NEWLINE);
7938 }
7939
7940 if (filter->plist[FILTER_IN].name
7941 || filter->dlist[FILTER_IN].name
7942 || filter->aslist[FILTER_IN].name
paulfee0f4c2004-09-13 05:12:46 +00007943 || filter->map[RMAP_IN].name)
paul718e3742002-12-13 20:15:29 +00007944 vty_out (vty, " Inbound path policy configured%s", VTY_NEWLINE);
7945 if (filter->plist[FILTER_OUT].name
7946 || filter->dlist[FILTER_OUT].name
7947 || filter->aslist[FILTER_OUT].name
paulfee0f4c2004-09-13 05:12:46 +00007948 || filter->map[RMAP_OUT].name
paul718e3742002-12-13 20:15:29 +00007949 || filter->usmap.name)
7950 vty_out (vty, " Outbound path policy configured%s", VTY_NEWLINE);
paulfee0f4c2004-09-13 05:12:46 +00007951 if (filter->map[RMAP_IMPORT].name)
7952 vty_out (vty, " Import policy for this RS-client configured%s", VTY_NEWLINE);
7953 if (filter->map[RMAP_EXPORT].name)
7954 vty_out (vty, " Export policy for this RS-client configured%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007955
7956 /* prefix-list */
7957 if (filter->plist[FILTER_IN].name)
7958 vty_out (vty, " Incoming update prefix filter list is %s%s%s",
7959 filter->plist[FILTER_IN].plist ? "*" : "",
7960 filter->plist[FILTER_IN].name,
7961 VTY_NEWLINE);
7962 if (filter->plist[FILTER_OUT].name)
7963 vty_out (vty, " Outgoing update prefix filter list is %s%s%s",
7964 filter->plist[FILTER_OUT].plist ? "*" : "",
7965 filter->plist[FILTER_OUT].name,
7966 VTY_NEWLINE);
7967
7968 /* distribute-list */
7969 if (filter->dlist[FILTER_IN].name)
7970 vty_out (vty, " Incoming update network filter list is %s%s%s",
7971 filter->dlist[FILTER_IN].alist ? "*" : "",
7972 filter->dlist[FILTER_IN].name,
7973 VTY_NEWLINE);
7974 if (filter->dlist[FILTER_OUT].name)
7975 vty_out (vty, " Outgoing update network filter list is %s%s%s",
7976 filter->dlist[FILTER_OUT].alist ? "*" : "",
7977 filter->dlist[FILTER_OUT].name,
7978 VTY_NEWLINE);
7979
7980 /* filter-list. */
7981 if (filter->aslist[FILTER_IN].name)
7982 vty_out (vty, " Incoming update AS path filter list is %s%s%s",
7983 filter->aslist[FILTER_IN].aslist ? "*" : "",
7984 filter->aslist[FILTER_IN].name,
7985 VTY_NEWLINE);
7986 if (filter->aslist[FILTER_OUT].name)
7987 vty_out (vty, " Outgoing update AS path filter list is %s%s%s",
7988 filter->aslist[FILTER_OUT].aslist ? "*" : "",
7989 filter->aslist[FILTER_OUT].name,
7990 VTY_NEWLINE);
7991
7992 /* route-map. */
paulfee0f4c2004-09-13 05:12:46 +00007993 if (filter->map[RMAP_IN].name)
paul718e3742002-12-13 20:15:29 +00007994 vty_out (vty, " Route map for incoming advertisements is %s%s%s",
paulfee0f4c2004-09-13 05:12:46 +00007995 filter->map[RMAP_IN].map ? "*" : "",
7996 filter->map[RMAP_IN].name,
paul718e3742002-12-13 20:15:29 +00007997 VTY_NEWLINE);
paulfee0f4c2004-09-13 05:12:46 +00007998 if (filter->map[RMAP_OUT].name)
paul718e3742002-12-13 20:15:29 +00007999 vty_out (vty, " Route map for outgoing advertisements is %s%s%s",
paulfee0f4c2004-09-13 05:12:46 +00008000 filter->map[RMAP_OUT].map ? "*" : "",
8001 filter->map[RMAP_OUT].name,
8002 VTY_NEWLINE);
8003 if (filter->map[RMAP_IMPORT].name)
8004 vty_out (vty, " Route map for advertisements going into this RS-client's table is %s%s%s",
8005 filter->map[RMAP_IMPORT].map ? "*" : "",
8006 filter->map[RMAP_IMPORT].name,
8007 VTY_NEWLINE);
8008 if (filter->map[RMAP_EXPORT].name)
8009 vty_out (vty, " Route map for advertisements coming from this RS-client is %s%s%s",
8010 filter->map[RMAP_EXPORT].map ? "*" : "",
8011 filter->map[RMAP_EXPORT].name,
paul718e3742002-12-13 20:15:29 +00008012 VTY_NEWLINE);
8013
8014 /* unsuppress-map */
8015 if (filter->usmap.name)
8016 vty_out (vty, " Route map for selective unsuppress is %s%s%s",
8017 filter->usmap.map ? "*" : "",
8018 filter->usmap.name, VTY_NEWLINE);
8019
8020 /* Receive prefix count */
hassoe0701b72004-05-20 09:19:34 +00008021 vty_out (vty, " %ld accepted prefixes%s", p->pcount[afi][safi], VTY_NEWLINE);
8022
paul718e3742002-12-13 20:15:29 +00008023 /* Maximum prefix */
8024 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX))
8025 {
hasso0a486e52005-02-01 20:57:17 +00008026 vty_out (vty, " Maximum prefixes allowed %ld%s%s", p->pmax[afi][safi],
paul718e3742002-12-13 20:15:29 +00008027 CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING)
hasso0a486e52005-02-01 20:57:17 +00008028 ? " (warning-only)" : "", VTY_NEWLINE);
8029 vty_out (vty, " Threshold for warning message %d%%",
8030 p->pmax_threshold[afi][safi]);
8031 if (p->pmax_restart[afi][safi])
8032 vty_out (vty, ", restart interval %d min", p->pmax_restart[afi][safi]);
8033 vty_out (vty, "%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008034 }
paul718e3742002-12-13 20:15:29 +00008035
8036 vty_out (vty, "%s", VTY_NEWLINE);
8037}
8038
paul94f2b392005-06-28 12:44:16 +00008039static void
paul718e3742002-12-13 20:15:29 +00008040bgp_show_peer (struct vty *vty, struct peer *p)
8041{
8042 struct bgp *bgp;
8043 char buf1[BUFSIZ];
8044 char timebuf[BGP_UPTIME_LEN];
hasso538621f2004-05-21 09:31:30 +00008045 afi_t afi;
8046 safi_t safi;
paul718e3742002-12-13 20:15:29 +00008047
8048 bgp = p->bgp;
8049
8050 /* Configured IP address. */
8051 vty_out (vty, "BGP neighbor is %s, ", p->host);
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04008052 vty_out (vty, "remote AS %u, ", p->as);
Andrew Certain9d3f9702012-11-07 23:50:07 +00008053 vty_out (vty, "local AS %u%s%s, ",
paul718e3742002-12-13 20:15:29 +00008054 p->change_local_as ? p->change_local_as : p->local_as,
8055 CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND) ?
Andrew Certain9d3f9702012-11-07 23:50:07 +00008056 " no-prepend" : "",
8057 CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_REPLACE_AS) ?
8058 " replace-as" : "");
paul718e3742002-12-13 20:15:29 +00008059 vty_out (vty, "%s link%s",
8060 p->as == p->local_as ? "internal" : "external",
8061 VTY_NEWLINE);
8062
8063 /* Description. */
8064 if (p->desc)
8065 vty_out (vty, " Description: %s%s", p->desc, VTY_NEWLINE);
8066
8067 /* Peer-group */
8068 if (p->group)
8069 vty_out (vty, " Member of peer-group %s for session parameters%s",
8070 p->group->name, VTY_NEWLINE);
8071
8072 /* Administrative shutdown. */
8073 if (CHECK_FLAG (p->flags, PEER_FLAG_SHUTDOWN))
8074 vty_out (vty, " Administratively shut down%s", VTY_NEWLINE);
8075
8076 /* BGP Version. */
8077 vty_out (vty, " BGP version 4");
paul718e3742002-12-13 20:15:29 +00008078 vty_out (vty, ", remote router ID %s%s",
8079 inet_ntop (AF_INET, &p->remote_id, buf1, BUFSIZ),
8080 VTY_NEWLINE);
8081
8082 /* Confederation */
hassoe0701b72004-05-20 09:19:34 +00008083 if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION)
8084 && bgp_confederation_peers_check (bgp, p->as))
paul718e3742002-12-13 20:15:29 +00008085 vty_out (vty, " Neighbor under common administration%s", VTY_NEWLINE);
8086
8087 /* Status. */
8088 vty_out (vty, " BGP state = %s",
8089 LOOKUP (bgp_status_msg, p->status));
8090 if (p->status == Established)
8091 vty_out (vty, ", up for %8s",
8092 peer_uptime (p->uptime, timebuf, BGP_UPTIME_LEN));
hasso93406d82005-02-02 14:40:33 +00008093 else if (p->status == Active)
8094 {
8095 if (CHECK_FLAG (p->flags, PEER_FLAG_PASSIVE))
8096 vty_out (vty, " (passive)");
8097 else if (CHECK_FLAG (p->sflags, PEER_STATUS_NSF_WAIT))
8098 vty_out (vty, " (NSF passive)");
8099 }
paul718e3742002-12-13 20:15:29 +00008100 vty_out (vty, "%s", VTY_NEWLINE);
8101
8102 /* read timer */
8103 vty_out (vty, " Last read %s", peer_uptime (p->readtime, timebuf, BGP_UPTIME_LEN));
8104
8105 /* Configured timer values. */
8106 vty_out (vty, ", hold time is %d, keepalive interval is %d seconds%s",
8107 p->v_holdtime, p->v_keepalive, VTY_NEWLINE);
8108 if (CHECK_FLAG (p->config, PEER_CONFIG_TIMER))
8109 {
8110 vty_out (vty, " Configured hold time is %d", p->holdtime);
8111 vty_out (vty, ", keepalive interval is %d seconds%s",
8112 p->keepalive, VTY_NEWLINE);
8113 }
hasso93406d82005-02-02 14:40:33 +00008114
paul718e3742002-12-13 20:15:29 +00008115 /* Capability. */
8116 if (p->status == Established)
8117 {
hasso538621f2004-05-21 09:31:30 +00008118 if (p->cap
paul718e3742002-12-13 20:15:29 +00008119 || p->afc_adv[AFI_IP][SAFI_UNICAST]
8120 || p->afc_recv[AFI_IP][SAFI_UNICAST]
8121 || p->afc_adv[AFI_IP][SAFI_MULTICAST]
8122 || p->afc_recv[AFI_IP][SAFI_MULTICAST]
8123#ifdef HAVE_IPV6
8124 || p->afc_adv[AFI_IP6][SAFI_UNICAST]
8125 || p->afc_recv[AFI_IP6][SAFI_UNICAST]
8126 || p->afc_adv[AFI_IP6][SAFI_MULTICAST]
8127 || p->afc_recv[AFI_IP6][SAFI_MULTICAST]
Lou Berger9da04bc2016-01-12 13:41:55 -05008128 || p->afc_adv[AFI_IP6][SAFI_MPLS_VPN]
8129 || p->afc_recv[AFI_IP6][SAFI_MPLS_VPN]
Lou Bergera3fda882016-01-12 13:42:04 -05008130 || p->afc_adv[AFI_IP6][SAFI_ENCAP]
8131 || p->afc_recv[AFI_IP6][SAFI_ENCAP]
paul718e3742002-12-13 20:15:29 +00008132#endif /* HAVE_IPV6 */
Lou Bergera3fda882016-01-12 13:42:04 -05008133 || p->afc_adv[AFI_IP][SAFI_ENCAP]
8134 || p->afc_recv[AFI_IP][SAFI_ENCAP]
paul718e3742002-12-13 20:15:29 +00008135 || p->afc_adv[AFI_IP][SAFI_MPLS_VPN]
8136 || p->afc_recv[AFI_IP][SAFI_MPLS_VPN])
8137 {
8138 vty_out (vty, " Neighbor capabilities:%s", VTY_NEWLINE);
8139
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00008140 /* AS4 */
8141 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV)
8142 || CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV))
8143 {
8144 vty_out (vty, " 4 Byte AS:");
8145 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV))
8146 vty_out (vty, " advertised");
8147 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV))
8148 vty_out (vty, " %sreceived",
8149 CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV) ? "and " : "");
8150 vty_out (vty, "%s", VTY_NEWLINE);
8151 }
paul718e3742002-12-13 20:15:29 +00008152 /* Dynamic */
8153 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)
8154 || CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV))
8155 {
8156 vty_out (vty, " Dynamic:");
8157 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV))
8158 vty_out (vty, " advertised");
8159 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV))
hasso538621f2004-05-21 09:31:30 +00008160 vty_out (vty, " %sreceived",
8161 CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV) ? "and " : "");
paul718e3742002-12-13 20:15:29 +00008162 vty_out (vty, "%s", VTY_NEWLINE);
8163 }
8164
8165 /* Route Refresh */
8166 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV)
8167 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)
8168 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
8169 {
8170 vty_out (vty, " Route refresh:");
8171 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV))
8172 vty_out (vty, " advertised");
8173 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)
8174 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
hasso538621f2004-05-21 09:31:30 +00008175 vty_out (vty, " %sreceived(%s)",
8176 CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) ? "and " : "",
8177 (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)
8178 && CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)) ?
8179 "old & new" : CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) ? "old" : "new");
8180
paul718e3742002-12-13 20:15:29 +00008181 vty_out (vty, "%s", VTY_NEWLINE);
8182 }
8183
hasso538621f2004-05-21 09:31:30 +00008184 /* Multiprotocol Extensions */
8185 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
8186 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
8187 if (p->afc_adv[afi][safi] || p->afc_recv[afi][safi])
paul718e3742002-12-13 20:15:29 +00008188 {
hasso538621f2004-05-21 09:31:30 +00008189 vty_out (vty, " Address family %s:", afi_safi_print (afi, safi));
8190 if (p->afc_adv[afi][safi])
8191 vty_out (vty, " advertised");
8192 if (p->afc_recv[afi][safi])
8193 vty_out (vty, " %sreceived", p->afc_adv[afi][safi] ? "and " : "");
8194 vty_out (vty, "%s", VTY_NEWLINE);
8195 }
8196
8197 /* Gracefull Restart */
8198 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)
8199 || CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
paul718e3742002-12-13 20:15:29 +00008200 {
hasso538621f2004-05-21 09:31:30 +00008201 vty_out (vty, " Graceful Restart Capabilty:");
8202 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
paul718e3742002-12-13 20:15:29 +00008203 vty_out (vty, " advertised");
hasso538621f2004-05-21 09:31:30 +00008204 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
8205 vty_out (vty, " %sreceived",
8206 CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV) ? "and " : "");
paul718e3742002-12-13 20:15:29 +00008207 vty_out (vty, "%s", VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00008208
8209 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
paul718e3742002-12-13 20:15:29 +00008210 {
hasso538621f2004-05-21 09:31:30 +00008211 int restart_af_count = 0;
8212
8213 vty_out (vty, " Remote Restart timer is %d seconds%s",
hasso93406d82005-02-02 14:40:33 +00008214 p->v_gr_restart, VTY_NEWLINE);
8215 vty_out (vty, " Address families by peer:%s ", VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00008216
8217 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
8218 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
8219 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_RCV))
8220 {
hasso93406d82005-02-02 14:40:33 +00008221 vty_out (vty, "%s%s(%s)", restart_af_count ? ", " : "",
8222 afi_safi_print (afi, safi),
8223 CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_PRESERVE_RCV) ?
8224 "preserved" : "not preserved");
hasso538621f2004-05-21 09:31:30 +00008225 restart_af_count++;
hasso93406d82005-02-02 14:40:33 +00008226 }
hasso538621f2004-05-21 09:31:30 +00008227 if (! restart_af_count)
8228 vty_out (vty, "none");
8229 vty_out (vty, "%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008230 }
paul718e3742002-12-13 20:15:29 +00008231 }
paul718e3742002-12-13 20:15:29 +00008232 }
8233 }
8234
hasso93406d82005-02-02 14:40:33 +00008235 /* graceful restart information */
8236 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)
8237 || p->t_gr_restart
8238 || p->t_gr_stale)
8239 {
8240 int eor_send_af_count = 0;
8241 int eor_receive_af_count = 0;
8242
8243 vty_out (vty, " Graceful restart informations:%s", VTY_NEWLINE);
8244 if (p->status == Established)
8245 {
8246 vty_out (vty, " End-of-RIB send: ");
8247 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
8248 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
8249 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_SEND))
8250 {
8251 vty_out (vty, "%s%s", eor_send_af_count ? ", " : "",
8252 afi_safi_print (afi, safi));
8253 eor_send_af_count++;
8254 }
8255 vty_out (vty, "%s", VTY_NEWLINE);
8256
8257 vty_out (vty, " End-of-RIB received: ");
8258 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
8259 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
8260 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_RECEIVED))
8261 {
8262 vty_out (vty, "%s%s", eor_receive_af_count ? ", " : "",
8263 afi_safi_print (afi, safi));
8264 eor_receive_af_count++;
8265 }
8266 vty_out (vty, "%s", VTY_NEWLINE);
8267 }
8268
8269 if (p->t_gr_restart)
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00008270 vty_out (vty, " The remaining time of restart timer is %ld%s",
8271 thread_timer_remain_second (p->t_gr_restart), VTY_NEWLINE);
8272
hasso93406d82005-02-02 14:40:33 +00008273 if (p->t_gr_stale)
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00008274 vty_out (vty, " The remaining time of stalepath timer is %ld%s",
8275 thread_timer_remain_second (p->t_gr_stale), VTY_NEWLINE);
hasso93406d82005-02-02 14:40:33 +00008276 }
8277
paul718e3742002-12-13 20:15:29 +00008278 /* Packet counts. */
hasso93406d82005-02-02 14:40:33 +00008279 vty_out (vty, " Message statistics:%s", VTY_NEWLINE);
8280 vty_out (vty, " Inq depth is 0%s", VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00008281 vty_out (vty, " Outq depth is %lu%s", (unsigned long) p->obuf->count, VTY_NEWLINE);
hasso93406d82005-02-02 14:40:33 +00008282 vty_out (vty, " Sent Rcvd%s", VTY_NEWLINE);
8283 vty_out (vty, " Opens: %10d %10d%s", p->open_out, p->open_in, VTY_NEWLINE);
8284 vty_out (vty, " Notifications: %10d %10d%s", p->notify_out, p->notify_in, VTY_NEWLINE);
8285 vty_out (vty, " Updates: %10d %10d%s", p->update_out, p->update_in, VTY_NEWLINE);
8286 vty_out (vty, " Keepalives: %10d %10d%s", p->keepalive_out, p->keepalive_in, VTY_NEWLINE);
8287 vty_out (vty, " Route Refresh: %10d %10d%s", p->refresh_out, p->refresh_in, VTY_NEWLINE);
8288 vty_out (vty, " Capability: %10d %10d%s", p->dynamic_cap_out, p->dynamic_cap_in, VTY_NEWLINE);
8289 vty_out (vty, " Total: %10d %10d%s", p->open_out + p->notify_out +
8290 p->update_out + p->keepalive_out + p->refresh_out + p->dynamic_cap_out,
8291 p->open_in + p->notify_in + p->update_in + p->keepalive_in + p->refresh_in +
8292 p->dynamic_cap_in, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008293
8294 /* advertisement-interval */
8295 vty_out (vty, " Minimum time between advertisement runs is %d seconds%s",
8296 p->v_routeadv, VTY_NEWLINE);
8297
8298 /* Update-source. */
8299 if (p->update_if || p->update_source)
8300 {
8301 vty_out (vty, " Update source is ");
8302 if (p->update_if)
8303 vty_out (vty, "%s", p->update_if);
8304 else if (p->update_source)
8305 vty_out (vty, "%s",
8306 sockunion2str (p->update_source, buf1, SU_ADDRSTRLEN));
8307 vty_out (vty, "%s", VTY_NEWLINE);
8308 }
8309
8310 /* Default weight */
8311 if (CHECK_FLAG (p->config, PEER_CONFIG_WEIGHT))
8312 vty_out (vty, " Default weight %d%s", p->weight,
8313 VTY_NEWLINE);
8314
8315 vty_out (vty, "%s", VTY_NEWLINE);
8316
8317 /* Address Family Information */
hasso538621f2004-05-21 09:31:30 +00008318 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
8319 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
8320 if (p->afc[afi][safi])
8321 bgp_show_peer_afi (vty, p, afi, safi);
paul718e3742002-12-13 20:15:29 +00008322
8323 vty_out (vty, " Connections established %d; dropped %d%s",
8324 p->established, p->dropped,
8325 VTY_NEWLINE);
8326
hassoe0701b72004-05-20 09:19:34 +00008327 if (! p->dropped)
8328 vty_out (vty, " Last reset never%s", VTY_NEWLINE);
8329 else
8330 vty_out (vty, " Last reset %s, due to %s%s",
8331 peer_uptime (p->resettime, timebuf, BGP_UPTIME_LEN),
8332 peer_down_str[(int) p->last_reset], VTY_NEWLINE);
paul848973c2003-08-13 00:32:49 +00008333
paul718e3742002-12-13 20:15:29 +00008334 if (CHECK_FLAG (p->sflags, PEER_STATUS_PREFIX_OVERFLOW))
8335 {
8336 vty_out (vty, " Peer had exceeded the max. no. of prefixes configured.%s", VTY_NEWLINE);
hasso0a486e52005-02-01 20:57:17 +00008337
8338 if (p->t_pmax_restart)
8339 vty_out (vty, " Reduce the no. of prefix from %s, will restart in %ld seconds%s",
8340 p->host, thread_timer_remain_second (p->t_pmax_restart),
8341 VTY_NEWLINE);
8342 else
8343 vty_out (vty, " Reduce the no. of prefix and clear ip bgp %s to restore peering%s",
8344 p->host, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008345 }
8346
Stephen Hemmingerf5a48272011-03-24 17:30:21 +00008347 /* EBGP Multihop and GTSM */
Jorge Boncompte [DTI2]6d85b152012-05-07 16:52:54 +00008348 if (p->sort != BGP_PEER_IBGP)
Stephen Hemmingerf5a48272011-03-24 17:30:21 +00008349 {
8350 if (p->gtsm_hops > 0)
8351 vty_out (vty, " External BGP neighbor may be up to %d hops away.%s",
8352 p->gtsm_hops, VTY_NEWLINE);
8353 else if (p->ttl > 1)
8354 vty_out (vty, " External BGP neighbor may be up to %d hops away.%s",
8355 p->ttl, VTY_NEWLINE);
8356 }
Pradosh Mohapatra5d804b42013-09-12 03:37:07 +00008357 else
8358 {
8359 if (p->gtsm_hops > 0)
8360 vty_out (vty, " Internal BGP neighbor may be up to %d hops away.%s",
8361 p->gtsm_hops, VTY_NEWLINE);
8362 }
paul718e3742002-12-13 20:15:29 +00008363
8364 /* Local address. */
8365 if (p->su_local)
8366 {
hasso93406d82005-02-02 14:40:33 +00008367 vty_out (vty, "Local host: %s, Local port: %d%s",
paul718e3742002-12-13 20:15:29 +00008368 sockunion2str (p->su_local, buf1, SU_ADDRSTRLEN),
8369 ntohs (p->su_local->sin.sin_port),
paul718e3742002-12-13 20:15:29 +00008370 VTY_NEWLINE);
8371 }
8372
8373 /* Remote address. */
8374 if (p->su_remote)
8375 {
8376 vty_out (vty, "Foreign host: %s, Foreign port: %d%s",
8377 sockunion2str (p->su_remote, buf1, SU_ADDRSTRLEN),
8378 ntohs (p->su_remote->sin.sin_port),
8379 VTY_NEWLINE);
8380 }
8381
8382 /* Nexthop display. */
8383 if (p->su_local)
8384 {
8385 vty_out (vty, "Nexthop: %s%s",
8386 inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ),
8387 VTY_NEWLINE);
8388#ifdef HAVE_IPV6
8389 vty_out (vty, "Nexthop global: %s%s",
8390 inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ),
8391 VTY_NEWLINE);
8392 vty_out (vty, "Nexthop local: %s%s",
8393 inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ),
8394 VTY_NEWLINE);
8395 vty_out (vty, "BGP connection: %s%s",
8396 p->shared_network ? "shared network" : "non shared network",
8397 VTY_NEWLINE);
8398#endif /* HAVE_IPV6 */
8399 }
8400
Timo Teräsef757702015-04-29 09:43:04 +03008401 /* TCP metrics. */
8402 if (p->status == Established && p->rtt)
8403 vty_out (vty, "Estimated round trip time: %d ms%s",
8404 p->rtt, VTY_NEWLINE);
8405
paul718e3742002-12-13 20:15:29 +00008406 /* Timer information. */
8407 if (p->t_start)
8408 vty_out (vty, "Next start timer due in %ld seconds%s",
8409 thread_timer_remain_second (p->t_start), VTY_NEWLINE);
8410 if (p->t_connect)
8411 vty_out (vty, "Next connect timer due in %ld seconds%s",
8412 thread_timer_remain_second (p->t_connect), VTY_NEWLINE);
8413
8414 vty_out (vty, "Read thread: %s Write thread: %s%s",
8415 p->t_read ? "on" : "off",
8416 p->t_write ? "on" : "off",
8417 VTY_NEWLINE);
8418
8419 if (p->notify.code == BGP_NOTIFY_OPEN_ERR
8420 && p->notify.subcode == BGP_NOTIFY_OPEN_UNSUP_CAPBL)
8421 bgp_capability_vty_out (vty, p);
8422
8423 vty_out (vty, "%s", VTY_NEWLINE);
8424}
8425
paul94f2b392005-06-28 12:44:16 +00008426static int
paul718e3742002-12-13 20:15:29 +00008427bgp_show_neighbor (struct vty *vty, struct bgp *bgp,
8428 enum show_type type, union sockunion *su)
8429{
paul1eb8ef22005-04-07 07:30:20 +00008430 struct listnode *node, *nnode;
paul718e3742002-12-13 20:15:29 +00008431 struct peer *peer;
8432 int find = 0;
8433
paul1eb8ef22005-04-07 07:30:20 +00008434 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00008435 {
8436 switch (type)
8437 {
8438 case show_all:
8439 bgp_show_peer (vty, peer);
8440 break;
8441 case show_peer:
8442 if (sockunion_same (&peer->su, su))
8443 {
8444 find = 1;
8445 bgp_show_peer (vty, peer);
8446 }
8447 break;
8448 }
8449 }
8450
8451 if (type == show_peer && ! find)
8452 vty_out (vty, "%% No such neighbor%s", VTY_NEWLINE);
8453
8454 return CMD_SUCCESS;
8455}
8456
paul94f2b392005-06-28 12:44:16 +00008457static int
paulfd79ac92004-10-13 05:06:08 +00008458bgp_show_neighbor_vty (struct vty *vty, const char *name,
8459 enum show_type type, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00008460{
8461 int ret;
8462 struct bgp *bgp;
8463 union sockunion su;
8464
8465 if (ip_str)
8466 {
8467 ret = str2sockunion (ip_str, &su);
8468 if (ret < 0)
8469 {
8470 vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE);
8471 return CMD_WARNING;
8472 }
8473 }
8474
8475 if (name)
8476 {
8477 bgp = bgp_lookup_by_name (name);
8478
8479 if (! bgp)
8480 {
8481 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
8482 return CMD_WARNING;
8483 }
8484
8485 bgp_show_neighbor (vty, bgp, type, &su);
8486
8487 return CMD_SUCCESS;
8488 }
8489
8490 bgp = bgp_get_default ();
8491
8492 if (bgp)
8493 bgp_show_neighbor (vty, bgp, type, &su);
8494
8495 return CMD_SUCCESS;
8496}
8497
8498/* "show ip bgp neighbors" commands. */
Lou Berger651b4022016-01-12 13:42:07 -05008499DEFUN (show_bgp_neighbors,
8500 show_bgp_neighbors_cmd,
8501 "show bgp neighbors",
paul718e3742002-12-13 20:15:29 +00008502 SHOW_STR
paul718e3742002-12-13 20:15:29 +00008503 BGP_STR
8504 "Detailed information on TCP and BGP neighbor connections\n")
8505{
8506 return bgp_show_neighbor_vty (vty, NULL, show_all, NULL);
8507}
8508
Lou Berger651b4022016-01-12 13:42:07 -05008509DEFUN (show_bgp_neighbors_peer,
8510 show_bgp_neighbors_peer_cmd,
8511#ifdef HAVE_IPV6
8512 "show bgp neighbors (A.B.C.D|X:X::X:X)",
8513#else
8514 "show bgp neighbors (A.B.C.D)",
8515#endif /* HAVE_IPV6 */
paul718e3742002-12-13 20:15:29 +00008516 SHOW_STR
paul718e3742002-12-13 20:15:29 +00008517 BGP_STR
8518 "Detailed information on TCP and BGP neighbor connections\n"
8519 "Neighbor to display information about\n"
8520 "Neighbor to display information about\n")
8521{
8522 return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 1]);
8523}
8524
Lou Berger651b4022016-01-12 13:42:07 -05008525DEFUN (show_bgp_instance_neighbors,
8526 show_bgp_instance_neighbors_cmd,
8527 "show bgp view WORD neighbors",
paul718e3742002-12-13 20:15:29 +00008528 SHOW_STR
paul718e3742002-12-13 20:15:29 +00008529 BGP_STR
8530 "BGP view\n"
8531 "View name\n"
8532 "Detailed information on TCP and BGP neighbor connections\n")
8533{
8534 return bgp_show_neighbor_vty (vty, argv[0], show_all, NULL);
8535}
8536
Lou Berger651b4022016-01-12 13:42:07 -05008537ALIAS (show_bgp_instance_neighbors,
paulbb46e942003-10-24 19:02:03 +00008538 show_bgp_instance_ipv6_neighbors_cmd,
8539 "show bgp view WORD ipv6 neighbors",
8540 SHOW_STR
8541 BGP_STR
8542 "BGP view\n"
8543 "View name\n"
8544 "Address family\n"
8545 "Detailed information on TCP and BGP neighbor connections\n")
8546
Lou Berger651b4022016-01-12 13:42:07 -05008547DEFUN (show_bgp_instance_neighbors_peer,
8548 show_bgp_instance_neighbors_peer_cmd,
8549#ifdef HAVE_IPV6
8550 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X)",
8551#else
8552 "show bgp view WORD neighbors (A.B.C.D)",
8553#endif
paul718e3742002-12-13 20:15:29 +00008554 SHOW_STR
paul718e3742002-12-13 20:15:29 +00008555 BGP_STR
8556 "BGP view\n"
8557 "View name\n"
8558 "Detailed information on TCP and BGP neighbor connections\n"
8559 "Neighbor to display information about\n"
8560 "Neighbor to display information about\n")
8561{
8562 return bgp_show_neighbor_vty (vty, argv[0], show_peer, argv[1]);
8563}
paulbb46e942003-10-24 19:02:03 +00008564
Lou Berger651b4022016-01-12 13:42:07 -05008565ALIAS (show_bgp_instance_neighbors_peer,
paulbb46e942003-10-24 19:02:03 +00008566 show_bgp_instance_ipv6_neighbors_peer_cmd,
8567 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X)",
8568 SHOW_STR
8569 BGP_STR
8570 "BGP view\n"
8571 "View name\n"
8572 "Address family\n"
8573 "Detailed information on TCP and BGP neighbor connections\n"
8574 "Neighbor to display information about\n"
8575 "Neighbor to display information about\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02008576
paul718e3742002-12-13 20:15:29 +00008577/* Show BGP's AS paths internal data. There are both `show ip bgp
8578 paths' and `show ip mbgp paths'. Those functions results are the
8579 same.*/
Lou Berger651b4022016-01-12 13:42:07 -05008580DEFUN (show_bgp_ipv4_paths,
8581 show_bgp_ipv4_paths_cmd,
8582 "show bgp paths",
paul718e3742002-12-13 20:15:29 +00008583 SHOW_STR
paul718e3742002-12-13 20:15:29 +00008584 BGP_STR
8585 "Path information\n")
8586{
8587 vty_out (vty, "Address Refcnt Path%s", VTY_NEWLINE);
8588 aspath_print_all_vty (vty);
8589 return CMD_SUCCESS;
8590}
8591
paul718e3742002-12-13 20:15:29 +00008592#include "hash.h"
8593
paul94f2b392005-06-28 12:44:16 +00008594static void
paul718e3742002-12-13 20:15:29 +00008595community_show_all_iterator (struct hash_backet *backet, struct vty *vty)
8596{
8597 struct community *com;
8598
8599 com = (struct community *) backet->data;
David Lampartereed3c482015-03-03 08:51:53 +01008600 vty_out (vty, "[%p] (%ld) %s%s", (void *)backet, com->refcnt,
paul718e3742002-12-13 20:15:29 +00008601 community_str (com), VTY_NEWLINE);
8602}
8603
8604/* Show BGP's community internal data. */
8605DEFUN (show_ip_bgp_community_info,
8606 show_ip_bgp_community_info_cmd,
8607 "show ip bgp community-info",
8608 SHOW_STR
8609 IP_STR
8610 BGP_STR
8611 "List all bgp community information\n")
8612{
8613 vty_out (vty, "Address Refcnt Community%s", VTY_NEWLINE);
8614
8615 hash_iterate (community_hash (),
8616 (void (*) (struct hash_backet *, void *))
8617 community_show_all_iterator,
8618 vty);
8619
8620 return CMD_SUCCESS;
8621}
8622
8623DEFUN (show_ip_bgp_attr_info,
8624 show_ip_bgp_attr_info_cmd,
8625 "show ip bgp attribute-info",
8626 SHOW_STR
8627 IP_STR
8628 BGP_STR
8629 "List all bgp attribute information\n")
8630{
8631 attr_show_all (vty);
8632 return CMD_SUCCESS;
8633}
David Lamparter6b0655a2014-06-04 06:53:35 +02008634
paul94f2b392005-06-28 12:44:16 +00008635static int
paulfee0f4c2004-09-13 05:12:46 +00008636bgp_write_rsclient_summary (struct vty *vty, struct peer *rsclient,
8637 afi_t afi, safi_t safi)
8638{
8639 char timebuf[BGP_UPTIME_LEN];
8640 char rmbuf[14];
paulfd79ac92004-10-13 05:06:08 +00008641 const char *rmname;
paulfee0f4c2004-09-13 05:12:46 +00008642 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00008643 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00008644 int len;
8645 int count = 0;
8646
8647 if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_GROUP))
8648 {
paul1eb8ef22005-04-07 07:30:20 +00008649 for (ALL_LIST_ELEMENTS (rsclient->group->peer, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00008650 {
8651 count++;
8652 bgp_write_rsclient_summary (vty, peer, afi, safi);
8653 }
8654 return count;
8655 }
8656
8657 len = vty_out (vty, "%s", rsclient->host);
8658 len = 16 - len;
8659
8660 if (len < 1)
8661 vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " ");
8662 else
8663 vty_out (vty, "%*s", len, " ");
8664
hasso3d515fd2005-02-01 21:30:04 +00008665 vty_out (vty, "4 ");
paulfee0f4c2004-09-13 05:12:46 +00008666
Milan Kociancb4fc592014-12-01 12:48:25 +00008667 vty_out (vty, "%10u ", rsclient->as);
paulfee0f4c2004-09-13 05:12:46 +00008668
8669 rmname = ROUTE_MAP_EXPORT_NAME(&rsclient->filter[afi][safi]);
8670 if ( rmname && strlen (rmname) > 13 )
8671 {
8672 sprintf (rmbuf, "%13s", "...");
8673 rmname = strncpy (rmbuf, rmname, 10);
8674 }
8675 else if (! rmname)
8676 rmname = "<none>";
8677 vty_out (vty, " %13s ", rmname);
8678
8679 rmname = ROUTE_MAP_IMPORT_NAME(&rsclient->filter[afi][safi]);
8680 if ( rmname && strlen (rmname) > 13 )
8681 {
8682 sprintf (rmbuf, "%13s", "...");
8683 rmname = strncpy (rmbuf, rmname, 10);
8684 }
8685 else if (! rmname)
8686 rmname = "<none>";
8687 vty_out (vty, " %13s ", rmname);
8688
8689 vty_out (vty, "%8s", peer_uptime (rsclient->uptime, timebuf, BGP_UPTIME_LEN));
8690
8691 if (CHECK_FLAG (rsclient->flags, PEER_FLAG_SHUTDOWN))
8692 vty_out (vty, " Idle (Admin)");
8693 else if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_PREFIX_OVERFLOW))
8694 vty_out (vty, " Idle (PfxCt)");
8695 else
8696 vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, rsclient->status));
8697
8698 vty_out (vty, "%s", VTY_NEWLINE);
8699
8700 return 1;
8701}
8702
paul94f2b392005-06-28 12:44:16 +00008703static int
paulfd79ac92004-10-13 05:06:08 +00008704bgp_show_rsclient_summary (struct vty *vty, struct bgp *bgp,
8705 afi_t afi, safi_t safi)
paulfee0f4c2004-09-13 05:12:46 +00008706{
8707 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00008708 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00008709 int count = 0;
8710
8711 /* Header string for each address family. */
Milan Kociancb4fc592014-12-01 12:48:25 +00008712 static char header[] = "Neighbor V AS Export-Policy Import-Policy Up/Down State";
paulfee0f4c2004-09-13 05:12:46 +00008713
paul1eb8ef22005-04-07 07:30:20 +00008714 for (ALL_LIST_ELEMENTS (bgp->rsclient, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00008715 {
8716 if (peer->afc[afi][safi] &&
8717 CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT))
8718 {
8719 if (! count)
8720 {
8721 vty_out (vty,
8722 "Route Server's BGP router identifier %s%s",
8723 inet_ntoa (bgp->router_id), VTY_NEWLINE);
8724 vty_out (vty,
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04008725 "Route Server's local AS number %u%s", bgp->as,
paulfee0f4c2004-09-13 05:12:46 +00008726 VTY_NEWLINE);
8727
8728 vty_out (vty, "%s", VTY_NEWLINE);
8729 vty_out (vty, "%s%s", header, VTY_NEWLINE);
8730 }
8731
8732 count += bgp_write_rsclient_summary (vty, peer, afi, safi);
8733 }
8734 }
8735
8736 if (count)
8737 vty_out (vty, "%sTotal number of Route Server Clients %d%s", VTY_NEWLINE,
8738 count, VTY_NEWLINE);
8739 else
8740 vty_out (vty, "No %s Route Server Client is configured%s",
8741 afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE);
8742
8743 return CMD_SUCCESS;
8744}
8745
paul94f2b392005-06-28 12:44:16 +00008746static int
paulfd79ac92004-10-13 05:06:08 +00008747bgp_show_rsclient_summary_vty (struct vty *vty, const char *name,
8748 afi_t afi, safi_t safi)
paulfee0f4c2004-09-13 05:12:46 +00008749{
8750 struct bgp *bgp;
8751
8752 if (name)
8753 {
8754 bgp = bgp_lookup_by_name (name);
8755
8756 if (! bgp)
8757 {
8758 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
8759 return CMD_WARNING;
8760 }
8761
8762 bgp_show_rsclient_summary (vty, bgp, afi, safi);
8763 return CMD_SUCCESS;
8764 }
8765
8766 bgp = bgp_get_default ();
8767
8768 if (bgp)
8769 bgp_show_rsclient_summary (vty, bgp, afi, safi);
8770
8771 return CMD_SUCCESS;
8772}
8773
8774/* 'show bgp rsclient' commands. */
paulfee0f4c2004-09-13 05:12:46 +00008775
Michael Lambert95cbbd22010-07-23 14:43:04 -04008776DEFUN (show_bgp_instance_ipv4_safi_rsclient_summary,
8777 show_bgp_instance_ipv4_safi_rsclient_summary_cmd,
8778 "show bgp view WORD ipv4 (unicast|multicast) rsclient summary",
8779 SHOW_STR
8780 BGP_STR
8781 "BGP view\n"
8782 "View name\n"
8783 "Address family\n"
8784 "Address Family modifier\n"
8785 "Address Family modifier\n"
8786 "Information about Route Server Clients\n"
8787 "Summary of all Route Server Clients\n")
8788{
8789 safi_t safi;
8790
8791 if (argc == 2) {
8792 safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
8793 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, safi);
8794 } else {
8795 safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
8796 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, safi);
8797 }
8798}
8799
8800ALIAS (show_bgp_instance_ipv4_safi_rsclient_summary,
8801 show_bgp_ipv4_safi_rsclient_summary_cmd,
8802 "show bgp ipv4 (unicast|multicast) rsclient summary",
8803 SHOW_STR
8804 BGP_STR
8805 "Address family\n"
8806 "Address Family modifier\n"
8807 "Address Family modifier\n"
8808 "Information about Route Server Clients\n"
8809 "Summary of all Route Server Clients\n")
8810
paulfee0f4c2004-09-13 05:12:46 +00008811DEFUN (show_bgp_rsclient_summary,
8812 show_bgp_rsclient_summary_cmd,
8813 "show bgp rsclient summary",
8814 SHOW_STR
8815 BGP_STR
8816 "Information about Route Server Clients\n"
8817 "Summary of all Route Server Clients\n")
8818{
Lou Berger651b4022016-01-12 13:42:07 -05008819 vty_out(vty, "%sIPv4 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
8820 vty_out(vty, "---------------------%s", VTY_NEWLINE);
8821 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
8822 vty_out(vty, "%sIPv4 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
8823 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
8824 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
8825 vty_out(vty, "%sIPv4 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
8826 vty_out(vty, "-----------------%s", VTY_NEWLINE);
8827 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
8828 vty_out(vty, "%sIPv4 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
8829 vty_out(vty, "-------------------%s", VTY_NEWLINE);
8830 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_ENCAP);
8831
8832#ifdef HAVE_IPV6
8833 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
8834 vty_out(vty, "---------------------%s", VTY_NEWLINE);
8835 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
8836 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
8837 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
8838 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
8839 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
8840 vty_out(vty, "-----------------%s", VTY_NEWLINE);
8841 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_MPLS_VPN);
8842 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
8843 vty_out(vty, "-------------------%s", VTY_NEWLINE);
8844 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_ENCAP);
8845#endif
8846 return CMD_SUCCESS;
paulfee0f4c2004-09-13 05:12:46 +00008847}
8848
8849DEFUN (show_bgp_instance_rsclient_summary,
8850 show_bgp_instance_rsclient_summary_cmd,
8851 "show bgp view WORD rsclient summary",
8852 SHOW_STR
8853 BGP_STR
8854 "BGP view\n"
8855 "View name\n"
8856 "Information about Route Server Clients\n"
8857 "Summary of all Route Server Clients\n")
8858{
Lou Berger651b4022016-01-12 13:42:07 -05008859 vty_out(vty, "%sIPv4 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
8860 vty_out(vty, "---------------------%s", VTY_NEWLINE);
8861 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
8862 vty_out(vty, "%sIPv4 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
8863 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
8864 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
8865 vty_out(vty, "%sIPv4 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
8866 vty_out(vty, "-----------------%s", VTY_NEWLINE);
8867 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_MPLS_VPN);
8868 vty_out(vty, "%sIPv4 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
8869 vty_out(vty, "-------------------%s", VTY_NEWLINE);
8870 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_ENCAP);
8871
8872#ifdef HAVE_IPV6
8873 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
8874 vty_out(vty, "---------------------%s", VTY_NEWLINE);
8875 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
8876 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
8877 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
8878 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST);
8879 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
8880 vty_out(vty, "-----------------%s", VTY_NEWLINE);
8881 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_MPLS_VPN);
8882 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
8883 vty_out(vty, "-------------------%s", VTY_NEWLINE);
8884 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_ENCAP);
8885#endif
8886 return CMD_SUCCESS;
paulfee0f4c2004-09-13 05:12:46 +00008887}
8888
Lou Berger651b4022016-01-12 13:42:07 -05008889#ifdef HAVE_IPV6
8890DEFUN (show_bgp_ipv6_rsclient_summary,
paulfee0f4c2004-09-13 05:12:46 +00008891 show_bgp_ipv6_rsclient_summary_cmd,
8892 "show bgp ipv6 rsclient summary",
8893 SHOW_STR
8894 BGP_STR
8895 "Address family\n"
8896 "Information about Route Server Clients\n"
8897 "Summary of all Route Server Clients\n")
Lou Berger651b4022016-01-12 13:42:07 -05008898{
8899 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
8900 vty_out(vty, "---------------------%s", VTY_NEWLINE);
8901 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
8902 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
8903 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
8904 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
8905 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
8906 vty_out(vty, "-----------------%s", VTY_NEWLINE);
8907 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_MPLS_VPN);
8908 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
8909 vty_out(vty, "-------------------%s", VTY_NEWLINE);
8910 bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_ENCAP);
paulfee0f4c2004-09-13 05:12:46 +00008911
Lou Berger651b4022016-01-12 13:42:07 -05008912 return CMD_SUCCESS;
8913}
8914
8915DEFUN (show_bgp_instance_ipv6_rsclient_summary,
paulfee0f4c2004-09-13 05:12:46 +00008916 show_bgp_instance_ipv6_rsclient_summary_cmd,
8917 "show bgp view WORD ipv6 rsclient summary",
8918 SHOW_STR
8919 BGP_STR
8920 "BGP view\n"
8921 "View name\n"
8922 "Address family\n"
8923 "Information about Route Server Clients\n"
8924 "Summary of all Route Server Clients\n")
Lou Berger651b4022016-01-12 13:42:07 -05008925{
8926 vty_out(vty, "%sIPv6 Unicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
8927 vty_out(vty, "---------------------%s", VTY_NEWLINE);
8928 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
8929 vty_out(vty, "%sIPv6 Multicast Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
8930 vty_out(vty, "-----------------------%s", VTY_NEWLINE);
8931 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST);
8932 vty_out(vty, "%sIPv6 VPN Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
8933 vty_out(vty, "-----------------%s", VTY_NEWLINE);
8934 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_MPLS_VPN);
8935 vty_out(vty, "%sIPv6 Encap Summary:%s", VTY_NEWLINE, VTY_NEWLINE);
8936 vty_out(vty, "-------------------%s", VTY_NEWLINE);
8937 bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_ENCAP);
8938
8939 return CMD_SUCCESS;
8940}
Michael Lambert95cbbd22010-07-23 14:43:04 -04008941
8942DEFUN (show_bgp_instance_ipv6_safi_rsclient_summary,
8943 show_bgp_instance_ipv6_safi_rsclient_summary_cmd,
8944 "show bgp view WORD ipv6 (unicast|multicast) rsclient summary",
8945 SHOW_STR
8946 BGP_STR
8947 "BGP view\n"
8948 "View name\n"
8949 "Address family\n"
8950 "Address Family modifier\n"
8951 "Address Family modifier\n"
8952 "Information about Route Server Clients\n"
8953 "Summary of all Route Server Clients\n")
8954{
8955 safi_t safi;
8956
8957 if (argc == 2) {
8958 safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
8959 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, safi);
8960 } else {
8961 safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
8962 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, safi);
8963 }
8964}
8965
8966ALIAS (show_bgp_instance_ipv6_safi_rsclient_summary,
8967 show_bgp_ipv6_safi_rsclient_summary_cmd,
8968 "show bgp ipv6 (unicast|multicast) rsclient summary",
8969 SHOW_STR
8970 BGP_STR
Lou Berger651b4022016-01-12 13:42:07 -05008971 IPV6_STR
Michael Lambert95cbbd22010-07-23 14:43:04 -04008972 "Address Family modifier\n"
8973 "Address Family modifier\n"
8974 "Information about Route Server Clients\n"
8975 "Summary of all Route Server Clients\n")
8976
paulfee0f4c2004-09-13 05:12:46 +00008977#endif /* HAVE IPV6 */
David Lamparter6b0655a2014-06-04 06:53:35 +02008978
paul718e3742002-12-13 20:15:29 +00008979/* Redistribute VTY commands. */
8980
paul718e3742002-12-13 20:15:29 +00008981DEFUN (bgp_redistribute_ipv4,
8982 bgp_redistribute_ipv4_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008983 "redistribute " QUAGGA_IP_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00008984 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008985 QUAGGA_IP_REDIST_HELP_STR_BGPD)
paul718e3742002-12-13 20:15:29 +00008986{
8987 int type;
8988
David Lampartere0ca5fd2009-09-16 01:52:42 +02008989 type = proto_redistnum (AFI_IP, argv[0]);
8990 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008991 {
8992 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8993 return CMD_WARNING;
8994 }
8995 return bgp_redistribute_set (vty->index, AFI_IP, type);
8996}
8997
8998DEFUN (bgp_redistribute_ipv4_rmap,
8999 bgp_redistribute_ipv4_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009000 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00009001 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009002 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009003 "Route map reference\n"
9004 "Pointer to route-map entries\n")
9005{
9006 int type;
9007
David Lampartere0ca5fd2009-09-16 01:52:42 +02009008 type = proto_redistnum (AFI_IP, argv[0]);
9009 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009010 {
9011 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9012 return CMD_WARNING;
9013 }
9014
9015 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]);
9016 return bgp_redistribute_set (vty->index, AFI_IP, type);
9017}
9018
9019DEFUN (bgp_redistribute_ipv4_metric,
9020 bgp_redistribute_ipv4_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009021 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009022 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009023 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009024 "Metric for redistributed routes\n"
9025 "Default metric\n")
9026{
9027 int type;
9028 u_int32_t metric;
9029
David Lampartere0ca5fd2009-09-16 01:52:42 +02009030 type = proto_redistnum (AFI_IP, argv[0]);
9031 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009032 {
9033 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9034 return CMD_WARNING;
9035 }
9036 VTY_GET_INTEGER ("metric", metric, argv[1]);
9037
9038 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
9039 return bgp_redistribute_set (vty->index, AFI_IP, type);
9040}
9041
9042DEFUN (bgp_redistribute_ipv4_rmap_metric,
9043 bgp_redistribute_ipv4_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009044 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009045 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009046 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009047 "Route map reference\n"
9048 "Pointer to route-map entries\n"
9049 "Metric for redistributed routes\n"
9050 "Default metric\n")
9051{
9052 int type;
9053 u_int32_t metric;
9054
David Lampartere0ca5fd2009-09-16 01:52:42 +02009055 type = proto_redistnum (AFI_IP, argv[0]);
9056 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009057 {
9058 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9059 return CMD_WARNING;
9060 }
9061 VTY_GET_INTEGER ("metric", metric, argv[2]);
9062
9063 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]);
9064 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
9065 return bgp_redistribute_set (vty->index, AFI_IP, type);
9066}
9067
9068DEFUN (bgp_redistribute_ipv4_metric_rmap,
9069 bgp_redistribute_ipv4_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009070 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00009071 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009072 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009073 "Metric for redistributed routes\n"
9074 "Default metric\n"
9075 "Route map reference\n"
9076 "Pointer to route-map entries\n")
9077{
9078 int type;
9079 u_int32_t metric;
9080
David Lampartere0ca5fd2009-09-16 01:52:42 +02009081 type = proto_redistnum (AFI_IP, argv[0]);
9082 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009083 {
9084 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9085 return CMD_WARNING;
9086 }
9087 VTY_GET_INTEGER ("metric", metric, argv[1]);
9088
9089 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
9090 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[2]);
9091 return bgp_redistribute_set (vty->index, AFI_IP, type);
9092}
9093
9094DEFUN (no_bgp_redistribute_ipv4,
9095 no_bgp_redistribute_ipv4_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009096 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00009097 NO_STR
9098 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009099 QUAGGA_IP_REDIST_HELP_STR_BGPD)
paul718e3742002-12-13 20:15:29 +00009100{
9101 int type;
9102
David Lampartere0ca5fd2009-09-16 01:52:42 +02009103 type = proto_redistnum (AFI_IP, argv[0]);
9104 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009105 {
9106 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9107 return CMD_WARNING;
9108 }
9109
9110 return bgp_redistribute_unset (vty->index, AFI_IP, type);
9111}
9112
9113DEFUN (no_bgp_redistribute_ipv4_rmap,
9114 no_bgp_redistribute_ipv4_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009115 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00009116 NO_STR
9117 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009118 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009119 "Route map reference\n"
9120 "Pointer to route-map entries\n")
9121{
9122 int type;
9123
David Lampartere0ca5fd2009-09-16 01:52:42 +02009124 type = proto_redistnum (AFI_IP, argv[0]);
9125 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009126 {
9127 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9128 return CMD_WARNING;
9129 }
9130
9131 bgp_redistribute_routemap_unset (vty->index, AFI_IP, type);
9132 return CMD_SUCCESS;
9133}
9134
9135DEFUN (no_bgp_redistribute_ipv4_metric,
9136 no_bgp_redistribute_ipv4_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009137 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009138 NO_STR
9139 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009140 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009141 "Metric for redistributed routes\n"
9142 "Default metric\n")
9143{
9144 int type;
9145
David Lampartere0ca5fd2009-09-16 01:52:42 +02009146 type = proto_redistnum (AFI_IP, argv[0]);
9147 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009148 {
9149 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9150 return CMD_WARNING;
9151 }
9152
9153 bgp_redistribute_metric_unset (vty->index, AFI_IP, type);
9154 return CMD_SUCCESS;
9155}
9156
9157DEFUN (no_bgp_redistribute_ipv4_rmap_metric,
9158 no_bgp_redistribute_ipv4_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009159 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009160 NO_STR
9161 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009162 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009163 "Route map reference\n"
9164 "Pointer to route-map entries\n"
9165 "Metric for redistributed routes\n"
9166 "Default metric\n")
9167{
9168 int type;
9169
David Lampartere0ca5fd2009-09-16 01:52:42 +02009170 type = proto_redistnum (AFI_IP, argv[0]);
9171 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009172 {
9173 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9174 return CMD_WARNING;
9175 }
9176
9177 bgp_redistribute_metric_unset (vty->index, AFI_IP, type);
9178 bgp_redistribute_routemap_unset (vty->index, AFI_IP, type);
9179 return CMD_SUCCESS;
9180}
9181
9182ALIAS (no_bgp_redistribute_ipv4_rmap_metric,
9183 no_bgp_redistribute_ipv4_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009184 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00009185 NO_STR
9186 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009187 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009188 "Metric for redistributed routes\n"
9189 "Default metric\n"
9190 "Route map reference\n"
9191 "Pointer to route-map entries\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02009192
paul718e3742002-12-13 20:15:29 +00009193#ifdef HAVE_IPV6
9194DEFUN (bgp_redistribute_ipv6,
9195 bgp_redistribute_ipv6_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009196 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00009197 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009198 QUAGGA_IP6_REDIST_HELP_STR_BGPD)
paul718e3742002-12-13 20:15:29 +00009199{
9200 int type;
9201
David Lampartere0ca5fd2009-09-16 01:52:42 +02009202 type = proto_redistnum (AFI_IP6, argv[0]);
9203 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009204 {
9205 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9206 return CMD_WARNING;
9207 }
9208
9209 return bgp_redistribute_set (vty->index, AFI_IP6, type);
9210}
9211
9212DEFUN (bgp_redistribute_ipv6_rmap,
9213 bgp_redistribute_ipv6_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009214 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00009215 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009216 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009217 "Route map reference\n"
9218 "Pointer to route-map entries\n")
9219{
9220 int type;
9221
David Lampartere0ca5fd2009-09-16 01:52:42 +02009222 type = proto_redistnum (AFI_IP6, argv[0]);
9223 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009224 {
9225 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9226 return CMD_WARNING;
9227 }
9228
9229 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]);
9230 return bgp_redistribute_set (vty->index, AFI_IP6, type);
9231}
9232
9233DEFUN (bgp_redistribute_ipv6_metric,
9234 bgp_redistribute_ipv6_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009235 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009236 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009237 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009238 "Metric for redistributed routes\n"
9239 "Default metric\n")
9240{
9241 int type;
9242 u_int32_t metric;
9243
David Lampartere0ca5fd2009-09-16 01:52:42 +02009244 type = proto_redistnum (AFI_IP6, argv[0]);
9245 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009246 {
9247 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9248 return CMD_WARNING;
9249 }
9250 VTY_GET_INTEGER ("metric", metric, argv[1]);
9251
9252 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
9253 return bgp_redistribute_set (vty->index, AFI_IP6, type);
9254}
9255
9256DEFUN (bgp_redistribute_ipv6_rmap_metric,
9257 bgp_redistribute_ipv6_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009258 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009259 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009260 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009261 "Route map reference\n"
9262 "Pointer to route-map entries\n"
9263 "Metric for redistributed routes\n"
9264 "Default metric\n")
9265{
9266 int type;
9267 u_int32_t metric;
9268
David Lampartere0ca5fd2009-09-16 01:52:42 +02009269 type = proto_redistnum (AFI_IP6, argv[0]);
9270 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009271 {
9272 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9273 return CMD_WARNING;
9274 }
9275 VTY_GET_INTEGER ("metric", metric, argv[2]);
9276
9277 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]);
9278 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
9279 return bgp_redistribute_set (vty->index, AFI_IP6, type);
9280}
9281
9282DEFUN (bgp_redistribute_ipv6_metric_rmap,
9283 bgp_redistribute_ipv6_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009284 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00009285 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009286 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009287 "Metric for redistributed routes\n"
9288 "Default metric\n"
9289 "Route map reference\n"
9290 "Pointer to route-map entries\n")
9291{
9292 int type;
9293 u_int32_t metric;
9294
David Lampartere0ca5fd2009-09-16 01:52:42 +02009295 type = proto_redistnum (AFI_IP6, argv[0]);
9296 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009297 {
9298 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9299 return CMD_WARNING;
9300 }
9301 VTY_GET_INTEGER ("metric", metric, argv[1]);
9302
9303 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
9304 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[2]);
9305 return bgp_redistribute_set (vty->index, AFI_IP6, type);
9306}
9307
9308DEFUN (no_bgp_redistribute_ipv6,
9309 no_bgp_redistribute_ipv6_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009310 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00009311 NO_STR
9312 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009313 QUAGGA_IP6_REDIST_HELP_STR_BGPD)
paul718e3742002-12-13 20:15:29 +00009314{
9315 int type;
9316
David Lampartere0ca5fd2009-09-16 01:52:42 +02009317 type = proto_redistnum (AFI_IP6, argv[0]);
9318 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009319 {
9320 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9321 return CMD_WARNING;
9322 }
9323
9324 return bgp_redistribute_unset (vty->index, AFI_IP6, type);
9325}
9326
9327DEFUN (no_bgp_redistribute_ipv6_rmap,
9328 no_bgp_redistribute_ipv6_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009329 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00009330 NO_STR
9331 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009332 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009333 "Route map reference\n"
9334 "Pointer to route-map entries\n")
9335{
9336 int type;
9337
David Lampartere0ca5fd2009-09-16 01:52:42 +02009338 type = proto_redistnum (AFI_IP6, argv[0]);
9339 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009340 {
9341 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9342 return CMD_WARNING;
9343 }
9344
9345 bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type);
9346 return CMD_SUCCESS;
9347}
9348
9349DEFUN (no_bgp_redistribute_ipv6_metric,
9350 no_bgp_redistribute_ipv6_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009351 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009352 NO_STR
9353 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009354 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009355 "Metric for redistributed routes\n"
9356 "Default metric\n")
9357{
9358 int type;
9359
David Lampartere0ca5fd2009-09-16 01:52:42 +02009360 type = proto_redistnum (AFI_IP6, argv[0]);
9361 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009362 {
9363 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9364 return CMD_WARNING;
9365 }
9366
9367 bgp_redistribute_metric_unset (vty->index, AFI_IP6, type);
9368 return CMD_SUCCESS;
9369}
9370
9371DEFUN (no_bgp_redistribute_ipv6_rmap_metric,
9372 no_bgp_redistribute_ipv6_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009373 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009374 NO_STR
9375 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009376 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009377 "Route map reference\n"
9378 "Pointer to route-map entries\n"
9379 "Metric for redistributed routes\n"
9380 "Default metric\n")
9381{
9382 int type;
9383
David Lampartere0ca5fd2009-09-16 01:52:42 +02009384 type = proto_redistnum (AFI_IP6, argv[0]);
9385 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009386 {
9387 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9388 return CMD_WARNING;
9389 }
9390
9391 bgp_redistribute_metric_unset (vty->index, AFI_IP6, type);
9392 bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type);
9393 return CMD_SUCCESS;
9394}
9395
9396ALIAS (no_bgp_redistribute_ipv6_rmap_metric,
9397 no_bgp_redistribute_ipv6_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009398 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00009399 NO_STR
9400 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009401 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009402 "Metric for redistributed routes\n"
9403 "Default metric\n"
9404 "Route map reference\n"
9405 "Pointer to route-map entries\n")
9406#endif /* HAVE_IPV6 */
David Lamparter6b0655a2014-06-04 06:53:35 +02009407
paul718e3742002-12-13 20:15:29 +00009408int
9409bgp_config_write_redistribute (struct vty *vty, struct bgp *bgp, afi_t afi,
9410 safi_t safi, int *write)
9411{
9412 int i;
paul718e3742002-12-13 20:15:29 +00009413
9414 /* Unicast redistribution only. */
9415 if (safi != SAFI_UNICAST)
9416 return 0;
9417
9418 for (i = 0; i < ZEBRA_ROUTE_MAX; i++)
9419 {
9420 /* Redistribute BGP does not make sense. */
9421 if (bgp->redist[afi][i] && i != ZEBRA_ROUTE_BGP)
9422 {
9423 /* Display "address-family" when it is not yet diplayed. */
9424 bgp_config_write_family_header (vty, afi, safi, write);
9425
9426 /* "redistribute" configuration. */
ajsf52d13c2005-10-01 17:38:06 +00009427 vty_out (vty, " redistribute %s", zebra_route_string(i));
paul718e3742002-12-13 20:15:29 +00009428
9429 if (bgp->redist_metric_flag[afi][i])
Jorge Boncompte [DTI2]ddc943d2012-04-13 13:46:07 +02009430 vty_out (vty, " metric %u", bgp->redist_metric[afi][i]);
paul718e3742002-12-13 20:15:29 +00009431
9432 if (bgp->rmap[afi][i].name)
9433 vty_out (vty, " route-map %s", bgp->rmap[afi][i].name);
9434
9435 vty_out (vty, "%s", VTY_NEWLINE);
9436 }
9437 }
9438 return *write;
9439}
David Lamparter6b0655a2014-06-04 06:53:35 +02009440
paul718e3742002-12-13 20:15:29 +00009441/* BGP node structure. */
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009442static struct cmd_node bgp_node =
paul718e3742002-12-13 20:15:29 +00009443{
9444 BGP_NODE,
9445 "%s(config-router)# ",
9446 1,
9447};
9448
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009449static struct cmd_node bgp_ipv4_unicast_node =
paul718e3742002-12-13 20:15:29 +00009450{
9451 BGP_IPV4_NODE,
9452 "%s(config-router-af)# ",
9453 1,
9454};
9455
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009456static struct cmd_node bgp_ipv4_multicast_node =
paul718e3742002-12-13 20:15:29 +00009457{
9458 BGP_IPV4M_NODE,
9459 "%s(config-router-af)# ",
9460 1,
9461};
9462
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009463static struct cmd_node bgp_ipv6_unicast_node =
paul718e3742002-12-13 20:15:29 +00009464{
9465 BGP_IPV6_NODE,
9466 "%s(config-router-af)# ",
9467 1,
9468};
9469
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009470static struct cmd_node bgp_ipv6_multicast_node =
paul25ffbdc2005-08-22 22:42:08 +00009471{
9472 BGP_IPV6M_NODE,
9473 "%s(config-router-af)# ",
9474 1,
9475};
9476
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009477static struct cmd_node bgp_vpnv4_node =
paul718e3742002-12-13 20:15:29 +00009478{
9479 BGP_VPNV4_NODE,
9480 "%s(config-router-af)# ",
9481 1
9482};
David Lamparter6b0655a2014-06-04 06:53:35 +02009483
Lou Berger13c378d2016-01-12 13:41:56 -05009484static struct cmd_node bgp_vpnv6_node =
9485{
9486 BGP_VPNV6_NODE,
9487 "%s(config-router-af-vpnv6)# ",
9488 1
9489};
9490
Lou Bergera3fda882016-01-12 13:42:04 -05009491static struct cmd_node bgp_encap_node =
9492{
9493 BGP_ENCAP_NODE,
9494 "%s(config-router-af-encap)# ",
9495 1
9496};
9497
9498static struct cmd_node bgp_encapv6_node =
9499{
9500 BGP_ENCAPV6_NODE,
9501 "%s(config-router-af-encapv6)# ",
9502 1
9503};
9504
paul1f8ae702005-09-09 23:49:49 +00009505static void community_list_vty (void);
9506
paul718e3742002-12-13 20:15:29 +00009507void
paul94f2b392005-06-28 12:44:16 +00009508bgp_vty_init (void)
paul718e3742002-12-13 20:15:29 +00009509{
paul718e3742002-12-13 20:15:29 +00009510 /* Install bgp top node. */
9511 install_node (&bgp_node, bgp_config_write);
9512 install_node (&bgp_ipv4_unicast_node, NULL);
9513 install_node (&bgp_ipv4_multicast_node, NULL);
9514 install_node (&bgp_ipv6_unicast_node, NULL);
paul25ffbdc2005-08-22 22:42:08 +00009515 install_node (&bgp_ipv6_multicast_node, NULL);
paul718e3742002-12-13 20:15:29 +00009516 install_node (&bgp_vpnv4_node, NULL);
Lou Berger13c378d2016-01-12 13:41:56 -05009517 install_node (&bgp_vpnv6_node, NULL);
Lou Bergera3fda882016-01-12 13:42:04 -05009518 install_node (&bgp_encap_node, NULL);
9519 install_node (&bgp_encapv6_node, NULL);
paul718e3742002-12-13 20:15:29 +00009520
9521 /* Install default VTY commands to new nodes. */
9522 install_default (BGP_NODE);
9523 install_default (BGP_IPV4_NODE);
9524 install_default (BGP_IPV4M_NODE);
9525 install_default (BGP_IPV6_NODE);
paul25ffbdc2005-08-22 22:42:08 +00009526 install_default (BGP_IPV6M_NODE);
paul718e3742002-12-13 20:15:29 +00009527 install_default (BGP_VPNV4_NODE);
Lou Berger13c378d2016-01-12 13:41:56 -05009528 install_default (BGP_VPNV6_NODE);
Lou Bergera3fda882016-01-12 13:42:04 -05009529 install_default (BGP_ENCAP_NODE);
9530 install_default (BGP_ENCAPV6_NODE);
paul718e3742002-12-13 20:15:29 +00009531
9532 /* "bgp multiple-instance" commands. */
9533 install_element (CONFIG_NODE, &bgp_multiple_instance_cmd);
9534 install_element (CONFIG_NODE, &no_bgp_multiple_instance_cmd);
9535
9536 /* "bgp config-type" commands. */
9537 install_element (CONFIG_NODE, &bgp_config_type_cmd);
9538 install_element (CONFIG_NODE, &no_bgp_config_type_cmd);
9539
9540 /* Dummy commands (Currently not supported) */
9541 install_element (BGP_NODE, &no_synchronization_cmd);
9542 install_element (BGP_NODE, &no_auto_summary_cmd);
9543
9544 /* "router bgp" commands. */
9545 install_element (CONFIG_NODE, &router_bgp_cmd);
9546 install_element (CONFIG_NODE, &router_bgp_view_cmd);
9547
9548 /* "no router bgp" commands. */
9549 install_element (CONFIG_NODE, &no_router_bgp_cmd);
9550 install_element (CONFIG_NODE, &no_router_bgp_view_cmd);
9551
9552 /* "bgp router-id" commands. */
9553 install_element (BGP_NODE, &bgp_router_id_cmd);
9554 install_element (BGP_NODE, &no_bgp_router_id_cmd);
9555 install_element (BGP_NODE, &no_bgp_router_id_val_cmd);
9556
9557 /* "bgp cluster-id" commands. */
9558 install_element (BGP_NODE, &bgp_cluster_id_cmd);
9559 install_element (BGP_NODE, &bgp_cluster_id32_cmd);
9560 install_element (BGP_NODE, &no_bgp_cluster_id_cmd);
9561 install_element (BGP_NODE, &no_bgp_cluster_id_arg_cmd);
9562
9563 /* "bgp confederation" commands. */
9564 install_element (BGP_NODE, &bgp_confederation_identifier_cmd);
9565 install_element (BGP_NODE, &no_bgp_confederation_identifier_cmd);
9566 install_element (BGP_NODE, &no_bgp_confederation_identifier_arg_cmd);
9567
9568 /* "bgp confederation peers" commands. */
9569 install_element (BGP_NODE, &bgp_confederation_peers_cmd);
9570 install_element (BGP_NODE, &no_bgp_confederation_peers_cmd);
9571
Josh Bailey165b5ff2011-07-20 20:43:22 -07009572 /* "maximum-paths" commands. */
9573 install_element (BGP_NODE, &bgp_maxpaths_cmd);
9574 install_element (BGP_NODE, &no_bgp_maxpaths_cmd);
9575 install_element (BGP_NODE, &no_bgp_maxpaths_arg_cmd);
9576 install_element (BGP_IPV4_NODE, &bgp_maxpaths_cmd);
9577 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_cmd);
9578 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_arg_cmd);
9579 install_element (BGP_NODE, &bgp_maxpaths_ibgp_cmd);
9580 install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_cmd);
9581 install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_arg_cmd);
9582 install_element (BGP_IPV4_NODE, &bgp_maxpaths_ibgp_cmd);
9583 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_cmd);
9584 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_arg_cmd);
9585
paul718e3742002-12-13 20:15:29 +00009586 /* "timers bgp" commands. */
9587 install_element (BGP_NODE, &bgp_timers_cmd);
9588 install_element (BGP_NODE, &no_bgp_timers_cmd);
9589 install_element (BGP_NODE, &no_bgp_timers_arg_cmd);
9590
9591 /* "bgp client-to-client reflection" commands */
9592 install_element (BGP_NODE, &no_bgp_client_to_client_reflection_cmd);
9593 install_element (BGP_NODE, &bgp_client_to_client_reflection_cmd);
9594
9595 /* "bgp always-compare-med" commands */
9596 install_element (BGP_NODE, &bgp_always_compare_med_cmd);
9597 install_element (BGP_NODE, &no_bgp_always_compare_med_cmd);
9598
9599 /* "bgp deterministic-med" commands */
9600 install_element (BGP_NODE, &bgp_deterministic_med_cmd);
9601 install_element (BGP_NODE, &no_bgp_deterministic_med_cmd);
hasso538621f2004-05-21 09:31:30 +00009602
hasso538621f2004-05-21 09:31:30 +00009603 /* "bgp graceful-restart" commands */
9604 install_element (BGP_NODE, &bgp_graceful_restart_cmd);
9605 install_element (BGP_NODE, &no_bgp_graceful_restart_cmd);
hasso93406d82005-02-02 14:40:33 +00009606 install_element (BGP_NODE, &bgp_graceful_restart_stalepath_time_cmd);
9607 install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_cmd);
9608 install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_val_cmd);
paul718e3742002-12-13 20:15:29 +00009609
9610 /* "bgp fast-external-failover" commands */
9611 install_element (BGP_NODE, &bgp_fast_external_failover_cmd);
9612 install_element (BGP_NODE, &no_bgp_fast_external_failover_cmd);
9613
9614 /* "bgp enforce-first-as" commands */
9615 install_element (BGP_NODE, &bgp_enforce_first_as_cmd);
9616 install_element (BGP_NODE, &no_bgp_enforce_first_as_cmd);
9617
9618 /* "bgp bestpath compare-routerid" commands */
9619 install_element (BGP_NODE, &bgp_bestpath_compare_router_id_cmd);
9620 install_element (BGP_NODE, &no_bgp_bestpath_compare_router_id_cmd);
9621
9622 /* "bgp bestpath as-path ignore" commands */
9623 install_element (BGP_NODE, &bgp_bestpath_aspath_ignore_cmd);
9624 install_element (BGP_NODE, &no_bgp_bestpath_aspath_ignore_cmd);
9625
hasso68118452005-04-08 15:40:36 +00009626 /* "bgp bestpath as-path confed" commands */
9627 install_element (BGP_NODE, &bgp_bestpath_aspath_confed_cmd);
9628 install_element (BGP_NODE, &no_bgp_bestpath_aspath_confed_cmd);
9629
Pradosh Mohapatra2fdd4552013-09-07 07:02:36 +00009630 /* "bgp bestpath as-path multipath-relax" commands */
9631 install_element (BGP_NODE, &bgp_bestpath_aspath_multipath_relax_cmd);
9632 install_element (BGP_NODE, &no_bgp_bestpath_aspath_multipath_relax_cmd);
9633
paul848973c2003-08-13 00:32:49 +00009634 /* "bgp log-neighbor-changes" commands */
9635 install_element (BGP_NODE, &bgp_log_neighbor_changes_cmd);
9636 install_element (BGP_NODE, &no_bgp_log_neighbor_changes_cmd);
9637
paul718e3742002-12-13 20:15:29 +00009638 /* "bgp bestpath med" commands */
9639 install_element (BGP_NODE, &bgp_bestpath_med_cmd);
9640 install_element (BGP_NODE, &bgp_bestpath_med2_cmd);
9641 install_element (BGP_NODE, &bgp_bestpath_med3_cmd);
9642 install_element (BGP_NODE, &no_bgp_bestpath_med_cmd);
9643 install_element (BGP_NODE, &no_bgp_bestpath_med2_cmd);
9644 install_element (BGP_NODE, &no_bgp_bestpath_med3_cmd);
9645
9646 /* "no bgp default ipv4-unicast" commands. */
9647 install_element (BGP_NODE, &no_bgp_default_ipv4_unicast_cmd);
9648 install_element (BGP_NODE, &bgp_default_ipv4_unicast_cmd);
9649
9650 /* "bgp network import-check" commands. */
9651 install_element (BGP_NODE, &bgp_network_import_check_cmd);
9652 install_element (BGP_NODE, &no_bgp_network_import_check_cmd);
9653
9654 /* "bgp default local-preference" commands. */
9655 install_element (BGP_NODE, &bgp_default_local_preference_cmd);
9656 install_element (BGP_NODE, &no_bgp_default_local_preference_cmd);
9657 install_element (BGP_NODE, &no_bgp_default_local_preference_val_cmd);
9658
9659 /* "neighbor remote-as" commands. */
9660 install_element (BGP_NODE, &neighbor_remote_as_cmd);
9661 install_element (BGP_NODE, &no_neighbor_cmd);
9662 install_element (BGP_NODE, &no_neighbor_remote_as_cmd);
9663
9664 /* "neighbor peer-group" commands. */
9665 install_element (BGP_NODE, &neighbor_peer_group_cmd);
9666 install_element (BGP_NODE, &no_neighbor_peer_group_cmd);
9667 install_element (BGP_NODE, &no_neighbor_peer_group_remote_as_cmd);
9668
9669 /* "neighbor local-as" commands. */
9670 install_element (BGP_NODE, &neighbor_local_as_cmd);
9671 install_element (BGP_NODE, &neighbor_local_as_no_prepend_cmd);
Andrew Certain9d3f9702012-11-07 23:50:07 +00009672 install_element (BGP_NODE, &neighbor_local_as_no_prepend_replace_as_cmd);
paul718e3742002-12-13 20:15:29 +00009673 install_element (BGP_NODE, &no_neighbor_local_as_cmd);
9674 install_element (BGP_NODE, &no_neighbor_local_as_val_cmd);
9675 install_element (BGP_NODE, &no_neighbor_local_as_val2_cmd);
Andrew Certain9d3f9702012-11-07 23:50:07 +00009676 install_element (BGP_NODE, &no_neighbor_local_as_val3_cmd);
paul718e3742002-12-13 20:15:29 +00009677
Paul Jakma0df7c912008-07-21 21:02:49 +00009678 /* "neighbor password" commands. */
9679 install_element (BGP_NODE, &neighbor_password_cmd);
9680 install_element (BGP_NODE, &no_neighbor_password_cmd);
9681
paul718e3742002-12-13 20:15:29 +00009682 /* "neighbor activate" commands. */
9683 install_element (BGP_NODE, &neighbor_activate_cmd);
9684 install_element (BGP_IPV4_NODE, &neighbor_activate_cmd);
9685 install_element (BGP_IPV4M_NODE, &neighbor_activate_cmd);
9686 install_element (BGP_IPV6_NODE, &neighbor_activate_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009687 install_element (BGP_IPV6M_NODE, &neighbor_activate_cmd);
paul718e3742002-12-13 20:15:29 +00009688 install_element (BGP_VPNV4_NODE, &neighbor_activate_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -05009689 install_element (BGP_VPNV6_NODE, &neighbor_activate_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -05009690 install_element (BGP_ENCAP_NODE, &neighbor_activate_cmd);
9691 install_element (BGP_ENCAPV6_NODE, &neighbor_activate_cmd);
paul718e3742002-12-13 20:15:29 +00009692
9693 /* "no neighbor activate" commands. */
9694 install_element (BGP_NODE, &no_neighbor_activate_cmd);
9695 install_element (BGP_IPV4_NODE, &no_neighbor_activate_cmd);
9696 install_element (BGP_IPV4M_NODE, &no_neighbor_activate_cmd);
9697 install_element (BGP_IPV6_NODE, &no_neighbor_activate_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009698 install_element (BGP_IPV6M_NODE, &no_neighbor_activate_cmd);
paul718e3742002-12-13 20:15:29 +00009699 install_element (BGP_VPNV4_NODE, &no_neighbor_activate_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -05009700 install_element (BGP_VPNV6_NODE, &no_neighbor_activate_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -05009701 install_element (BGP_ENCAP_NODE, &no_neighbor_activate_cmd);
9702 install_element (BGP_ENCAPV6_NODE, &no_neighbor_activate_cmd);
paul718e3742002-12-13 20:15:29 +00009703
9704 /* "neighbor peer-group set" commands. */
9705 install_element (BGP_NODE, &neighbor_set_peer_group_cmd);
9706 install_element (BGP_IPV4_NODE, &neighbor_set_peer_group_cmd);
9707 install_element (BGP_IPV4M_NODE, &neighbor_set_peer_group_cmd);
9708 install_element (BGP_IPV6_NODE, &neighbor_set_peer_group_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009709 install_element (BGP_IPV6M_NODE, &neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +00009710 install_element (BGP_VPNV4_NODE, &neighbor_set_peer_group_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -05009711 install_element (BGP_VPNV6_NODE, &neighbor_set_peer_group_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -05009712 install_element (BGP_ENCAP_NODE, &neighbor_set_peer_group_cmd);
9713 install_element (BGP_ENCAPV6_NODE, &neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +00009714
paul718e3742002-12-13 20:15:29 +00009715 /* "no neighbor peer-group unset" commands. */
9716 install_element (BGP_NODE, &no_neighbor_set_peer_group_cmd);
9717 install_element (BGP_IPV4_NODE, &no_neighbor_set_peer_group_cmd);
9718 install_element (BGP_IPV4M_NODE, &no_neighbor_set_peer_group_cmd);
9719 install_element (BGP_IPV6_NODE, &no_neighbor_set_peer_group_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009720 install_element (BGP_IPV6M_NODE, &no_neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +00009721 install_element (BGP_VPNV4_NODE, &no_neighbor_set_peer_group_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -05009722 install_element (BGP_VPNV6_NODE, &no_neighbor_set_peer_group_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -05009723 install_element (BGP_ENCAP_NODE, &no_neighbor_set_peer_group_cmd);
9724 install_element (BGP_ENCAPV6_NODE, &no_neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +00009725
paul718e3742002-12-13 20:15:29 +00009726 /* "neighbor softreconfiguration inbound" commands.*/
9727 install_element (BGP_NODE, &neighbor_soft_reconfiguration_cmd);
9728 install_element (BGP_NODE, &no_neighbor_soft_reconfiguration_cmd);
9729 install_element (BGP_IPV4_NODE, &neighbor_soft_reconfiguration_cmd);
9730 install_element (BGP_IPV4_NODE, &no_neighbor_soft_reconfiguration_cmd);
9731 install_element (BGP_IPV4M_NODE, &neighbor_soft_reconfiguration_cmd);
9732 install_element (BGP_IPV4M_NODE, &no_neighbor_soft_reconfiguration_cmd);
9733 install_element (BGP_IPV6_NODE, &neighbor_soft_reconfiguration_cmd);
9734 install_element (BGP_IPV6_NODE, &no_neighbor_soft_reconfiguration_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009735 install_element (BGP_IPV6M_NODE, &neighbor_soft_reconfiguration_cmd);
9736 install_element (BGP_IPV6M_NODE, &no_neighbor_soft_reconfiguration_cmd);
paula58545b2003-07-12 21:43:01 +00009737 install_element (BGP_VPNV4_NODE, &neighbor_soft_reconfiguration_cmd);
9738 install_element (BGP_VPNV4_NODE, &no_neighbor_soft_reconfiguration_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -05009739 install_element (BGP_VPNV6_NODE, &neighbor_soft_reconfiguration_cmd);
9740 install_element (BGP_VPNV6_NODE, &no_neighbor_soft_reconfiguration_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -05009741 install_element (BGP_ENCAP_NODE, &neighbor_soft_reconfiguration_cmd);
9742 install_element (BGP_ENCAP_NODE, &no_neighbor_soft_reconfiguration_cmd);
9743 install_element (BGP_ENCAPV6_NODE, &neighbor_soft_reconfiguration_cmd);
9744 install_element (BGP_ENCAPV6_NODE, &no_neighbor_soft_reconfiguration_cmd);
paul718e3742002-12-13 20:15:29 +00009745
9746 /* "neighbor attribute-unchanged" commands. */
9747 install_element (BGP_NODE, &neighbor_attr_unchanged_cmd);
9748 install_element (BGP_NODE, &neighbor_attr_unchanged1_cmd);
9749 install_element (BGP_NODE, &neighbor_attr_unchanged2_cmd);
9750 install_element (BGP_NODE, &neighbor_attr_unchanged3_cmd);
9751 install_element (BGP_NODE, &neighbor_attr_unchanged4_cmd);
9752 install_element (BGP_NODE, &neighbor_attr_unchanged5_cmd);
9753 install_element (BGP_NODE, &neighbor_attr_unchanged6_cmd);
9754 install_element (BGP_NODE, &neighbor_attr_unchanged7_cmd);
9755 install_element (BGP_NODE, &neighbor_attr_unchanged8_cmd);
9756 install_element (BGP_NODE, &neighbor_attr_unchanged9_cmd);
9757 install_element (BGP_NODE, &neighbor_attr_unchanged10_cmd);
9758 install_element (BGP_NODE, &no_neighbor_attr_unchanged_cmd);
9759 install_element (BGP_NODE, &no_neighbor_attr_unchanged1_cmd);
9760 install_element (BGP_NODE, &no_neighbor_attr_unchanged2_cmd);
9761 install_element (BGP_NODE, &no_neighbor_attr_unchanged3_cmd);
9762 install_element (BGP_NODE, &no_neighbor_attr_unchanged4_cmd);
9763 install_element (BGP_NODE, &no_neighbor_attr_unchanged5_cmd);
9764 install_element (BGP_NODE, &no_neighbor_attr_unchanged6_cmd);
9765 install_element (BGP_NODE, &no_neighbor_attr_unchanged7_cmd);
9766 install_element (BGP_NODE, &no_neighbor_attr_unchanged8_cmd);
9767 install_element (BGP_NODE, &no_neighbor_attr_unchanged9_cmd);
9768 install_element (BGP_NODE, &no_neighbor_attr_unchanged10_cmd);
9769 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged_cmd);
9770 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged1_cmd);
9771 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged2_cmd);
9772 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged3_cmd);
9773 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged4_cmd);
9774 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged5_cmd);
9775 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged6_cmd);
9776 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged7_cmd);
9777 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged8_cmd);
9778 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged9_cmd);
9779 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged10_cmd);
9780 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged_cmd);
9781 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged1_cmd);
9782 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged2_cmd);
9783 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged3_cmd);
9784 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged4_cmd);
9785 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged5_cmd);
9786 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged6_cmd);
9787 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged7_cmd);
9788 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged8_cmd);
9789 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged9_cmd);
9790 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged10_cmd);
9791 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged_cmd);
9792 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged1_cmd);
9793 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged2_cmd);
9794 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged3_cmd);
9795 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged4_cmd);
9796 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged5_cmd);
9797 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged6_cmd);
9798 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged7_cmd);
9799 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged8_cmd);
9800 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged9_cmd);
9801 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged10_cmd);
9802 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged_cmd);
9803 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged1_cmd);
9804 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged2_cmd);
9805 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged3_cmd);
9806 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged4_cmd);
9807 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged5_cmd);
9808 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged6_cmd);
9809 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged7_cmd);
9810 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged8_cmd);
9811 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged9_cmd);
9812 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged10_cmd);
9813 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged_cmd);
9814 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged1_cmd);
9815 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged2_cmd);
9816 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged3_cmd);
9817 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged4_cmd);
9818 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged5_cmd);
9819 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged6_cmd);
9820 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged7_cmd);
9821 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged8_cmd);
9822 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged9_cmd);
9823 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged10_cmd);
9824 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged_cmd);
9825 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged1_cmd);
9826 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged2_cmd);
9827 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged3_cmd);
9828 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged4_cmd);
9829 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged5_cmd);
9830 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged6_cmd);
9831 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged7_cmd);
9832 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged8_cmd);
9833 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged9_cmd);
9834 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged10_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009835 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged_cmd);
9836 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged1_cmd);
9837 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged2_cmd);
9838 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged3_cmd);
9839 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged4_cmd);
9840 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged5_cmd);
9841 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged6_cmd);
9842 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged7_cmd);
9843 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged8_cmd);
9844 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged9_cmd);
9845 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged10_cmd);
9846 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged_cmd);
9847 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged1_cmd);
9848 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged2_cmd);
9849 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged3_cmd);
9850 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged4_cmd);
9851 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged5_cmd);
9852 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged6_cmd);
9853 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged7_cmd);
9854 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged8_cmd);
9855 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged9_cmd);
9856 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged10_cmd);
paul718e3742002-12-13 20:15:29 +00009857 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged_cmd);
9858 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged1_cmd);
9859 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged2_cmd);
9860 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged3_cmd);
9861 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged4_cmd);
9862 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged5_cmd);
9863 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged6_cmd);
9864 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged7_cmd);
9865 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged8_cmd);
9866 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged9_cmd);
9867 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged10_cmd);
9868 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged_cmd);
9869 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged1_cmd);
9870 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged2_cmd);
9871 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged3_cmd);
9872 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged4_cmd);
9873 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged5_cmd);
9874 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged6_cmd);
9875 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged7_cmd);
9876 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged8_cmd);
9877 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged9_cmd);
9878 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged10_cmd);
9879
Lou Berger13c378d2016-01-12 13:41:56 -05009880 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged_cmd);
9881 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged1_cmd);
9882 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged2_cmd);
9883 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged3_cmd);
9884 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged4_cmd);
9885 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged5_cmd);
9886 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged6_cmd);
9887 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged7_cmd);
9888 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged8_cmd);
9889 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged9_cmd);
9890 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged10_cmd);
9891 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged_cmd);
9892 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged1_cmd);
9893 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged2_cmd);
9894 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged3_cmd);
9895 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged4_cmd);
9896 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged5_cmd);
9897 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged6_cmd);
9898 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged7_cmd);
9899 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged8_cmd);
9900 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged9_cmd);
9901 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged10_cmd);
9902
Lou Bergera3fda882016-01-12 13:42:04 -05009903 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged_cmd);
9904 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged1_cmd);
9905 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged2_cmd);
9906 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged3_cmd);
9907 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged4_cmd);
9908 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged5_cmd);
9909 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged6_cmd);
9910 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged7_cmd);
9911 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged8_cmd);
9912 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged9_cmd);
9913 install_element (BGP_ENCAP_NODE, &neighbor_attr_unchanged10_cmd);
9914 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged_cmd);
9915 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged1_cmd);
9916 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged2_cmd);
9917 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged3_cmd);
9918 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged4_cmd);
9919 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged5_cmd);
9920 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged6_cmd);
9921 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged7_cmd);
9922 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged8_cmd);
9923 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged9_cmd);
9924 install_element (BGP_ENCAP_NODE, &no_neighbor_attr_unchanged10_cmd);
9925
9926 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged_cmd);
9927 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged1_cmd);
9928 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged2_cmd);
9929 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged3_cmd);
9930 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged4_cmd);
9931 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged5_cmd);
9932 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged6_cmd);
9933 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged7_cmd);
9934 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged8_cmd);
9935 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged9_cmd);
9936 install_element (BGP_ENCAPV6_NODE, &neighbor_attr_unchanged10_cmd);
9937 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged_cmd);
9938 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged1_cmd);
9939 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged2_cmd);
9940 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged3_cmd);
9941 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged4_cmd);
9942 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged5_cmd);
9943 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged6_cmd);
9944 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged7_cmd);
9945 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged8_cmd);
9946 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged9_cmd);
9947 install_element (BGP_ENCAPV6_NODE, &no_neighbor_attr_unchanged10_cmd);
9948
paulfee0f4c2004-09-13 05:12:46 +00009949 /* "nexthop-local unchanged" commands */
9950 install_element (BGP_IPV6_NODE, &neighbor_nexthop_local_unchanged_cmd);
9951 install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_local_unchanged_cmd);
9952
paul718e3742002-12-13 20:15:29 +00009953 /* "transparent-as" and "transparent-nexthop" for old version
9954 compatibility. */
9955 install_element (BGP_NODE, &neighbor_transparent_as_cmd);
9956 install_element (BGP_NODE, &neighbor_transparent_nexthop_cmd);
9957
9958 /* "neighbor next-hop-self" commands. */
9959 install_element (BGP_NODE, &neighbor_nexthop_self_cmd);
9960 install_element (BGP_NODE, &no_neighbor_nexthop_self_cmd);
9961 install_element (BGP_IPV4_NODE, &neighbor_nexthop_self_cmd);
9962 install_element (BGP_IPV4_NODE, &no_neighbor_nexthop_self_cmd);
9963 install_element (BGP_IPV4M_NODE, &neighbor_nexthop_self_cmd);
9964 install_element (BGP_IPV4M_NODE, &no_neighbor_nexthop_self_cmd);
9965 install_element (BGP_IPV6_NODE, &neighbor_nexthop_self_cmd);
9966 install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_self_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009967 install_element (BGP_IPV6M_NODE, &neighbor_nexthop_self_cmd);
9968 install_element (BGP_IPV6M_NODE, &no_neighbor_nexthop_self_cmd);
paul718e3742002-12-13 20:15:29 +00009969 install_element (BGP_VPNV4_NODE, &neighbor_nexthop_self_cmd);
9970 install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -05009971 install_element (BGP_VPNV6_NODE, &neighbor_nexthop_self_cmd);
9972 install_element (BGP_VPNV6_NODE, &no_neighbor_nexthop_self_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -05009973 install_element (BGP_ENCAP_NODE, &neighbor_nexthop_self_cmd);
9974 install_element (BGP_ENCAP_NODE, &no_neighbor_nexthop_self_cmd);
9975 install_element (BGP_ENCAPV6_NODE, &neighbor_nexthop_self_cmd);
9976 install_element (BGP_ENCAPV6_NODE, &no_neighbor_nexthop_self_cmd);
paul718e3742002-12-13 20:15:29 +00009977
9978 /* "neighbor remove-private-AS" commands. */
9979 install_element (BGP_NODE, &neighbor_remove_private_as_cmd);
9980 install_element (BGP_NODE, &no_neighbor_remove_private_as_cmd);
9981 install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_cmd);
9982 install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_cmd);
9983 install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_cmd);
9984 install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_cmd);
9985 install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_cmd);
9986 install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009987 install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_cmd);
9988 install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_cmd);
paul718e3742002-12-13 20:15:29 +00009989 install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_cmd);
9990 install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -05009991 install_element (BGP_VPNV6_NODE, &neighbor_remove_private_as_cmd);
9992 install_element (BGP_VPNV6_NODE, &no_neighbor_remove_private_as_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -05009993 install_element (BGP_ENCAP_NODE, &neighbor_remove_private_as_cmd);
9994 install_element (BGP_ENCAP_NODE, &no_neighbor_remove_private_as_cmd);
9995 install_element (BGP_ENCAPV6_NODE, &neighbor_remove_private_as_cmd);
9996 install_element (BGP_ENCAPV6_NODE, &no_neighbor_remove_private_as_cmd);
paul718e3742002-12-13 20:15:29 +00009997
9998 /* "neighbor send-community" commands.*/
9999 install_element (BGP_NODE, &neighbor_send_community_cmd);
10000 install_element (BGP_NODE, &neighbor_send_community_type_cmd);
10001 install_element (BGP_NODE, &no_neighbor_send_community_cmd);
10002 install_element (BGP_NODE, &no_neighbor_send_community_type_cmd);
10003 install_element (BGP_IPV4_NODE, &neighbor_send_community_cmd);
10004 install_element (BGP_IPV4_NODE, &neighbor_send_community_type_cmd);
10005 install_element (BGP_IPV4_NODE, &no_neighbor_send_community_cmd);
10006 install_element (BGP_IPV4_NODE, &no_neighbor_send_community_type_cmd);
10007 install_element (BGP_IPV4M_NODE, &neighbor_send_community_cmd);
10008 install_element (BGP_IPV4M_NODE, &neighbor_send_community_type_cmd);
10009 install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_cmd);
10010 install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_type_cmd);
10011 install_element (BGP_IPV6_NODE, &neighbor_send_community_cmd);
10012 install_element (BGP_IPV6_NODE, &neighbor_send_community_type_cmd);
10013 install_element (BGP_IPV6_NODE, &no_neighbor_send_community_cmd);
10014 install_element (BGP_IPV6_NODE, &no_neighbor_send_community_type_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010015 install_element (BGP_IPV6M_NODE, &neighbor_send_community_cmd);
10016 install_element (BGP_IPV6M_NODE, &neighbor_send_community_type_cmd);
10017 install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_cmd);
10018 install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_type_cmd);
paul718e3742002-12-13 20:15:29 +000010019 install_element (BGP_VPNV4_NODE, &neighbor_send_community_cmd);
10020 install_element (BGP_VPNV4_NODE, &neighbor_send_community_type_cmd);
10021 install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_cmd);
10022 install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_type_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010023 install_element (BGP_VPNV6_NODE, &neighbor_send_community_cmd);
10024 install_element (BGP_VPNV6_NODE, &neighbor_send_community_type_cmd);
10025 install_element (BGP_VPNV6_NODE, &no_neighbor_send_community_cmd);
10026 install_element (BGP_VPNV6_NODE, &no_neighbor_send_community_type_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010027 install_element (BGP_ENCAP_NODE, &neighbor_send_community_cmd);
10028 install_element (BGP_ENCAP_NODE, &neighbor_send_community_type_cmd);
10029 install_element (BGP_ENCAP_NODE, &no_neighbor_send_community_cmd);
10030 install_element (BGP_ENCAP_NODE, &no_neighbor_send_community_type_cmd);
10031 install_element (BGP_ENCAPV6_NODE, &neighbor_send_community_cmd);
10032 install_element (BGP_ENCAPV6_NODE, &neighbor_send_community_type_cmd);
10033 install_element (BGP_ENCAPV6_NODE, &no_neighbor_send_community_cmd);
10034 install_element (BGP_ENCAPV6_NODE, &no_neighbor_send_community_type_cmd);
paul718e3742002-12-13 20:15:29 +000010035
10036 /* "neighbor route-reflector" commands.*/
10037 install_element (BGP_NODE, &neighbor_route_reflector_client_cmd);
10038 install_element (BGP_NODE, &no_neighbor_route_reflector_client_cmd);
10039 install_element (BGP_IPV4_NODE, &neighbor_route_reflector_client_cmd);
10040 install_element (BGP_IPV4_NODE, &no_neighbor_route_reflector_client_cmd);
10041 install_element (BGP_IPV4M_NODE, &neighbor_route_reflector_client_cmd);
10042 install_element (BGP_IPV4M_NODE, &no_neighbor_route_reflector_client_cmd);
10043 install_element (BGP_IPV6_NODE, &neighbor_route_reflector_client_cmd);
10044 install_element (BGP_IPV6_NODE, &no_neighbor_route_reflector_client_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010045 install_element (BGP_IPV6M_NODE, &neighbor_route_reflector_client_cmd);
10046 install_element (BGP_IPV6M_NODE, &no_neighbor_route_reflector_client_cmd);
paul718e3742002-12-13 20:15:29 +000010047 install_element (BGP_VPNV4_NODE, &neighbor_route_reflector_client_cmd);
10048 install_element (BGP_VPNV4_NODE, &no_neighbor_route_reflector_client_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010049 install_element (BGP_VPNV6_NODE, &neighbor_route_reflector_client_cmd);
10050 install_element (BGP_VPNV6_NODE, &no_neighbor_route_reflector_client_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010051 install_element (BGP_ENCAP_NODE, &neighbor_route_reflector_client_cmd);
10052 install_element (BGP_ENCAP_NODE, &no_neighbor_route_reflector_client_cmd);
10053 install_element (BGP_ENCAPV6_NODE, &neighbor_route_reflector_client_cmd);
10054 install_element (BGP_ENCAPV6_NODE, &no_neighbor_route_reflector_client_cmd);
paul718e3742002-12-13 20:15:29 +000010055
10056 /* "neighbor route-server" commands.*/
10057 install_element (BGP_NODE, &neighbor_route_server_client_cmd);
10058 install_element (BGP_NODE, &no_neighbor_route_server_client_cmd);
10059 install_element (BGP_IPV4_NODE, &neighbor_route_server_client_cmd);
10060 install_element (BGP_IPV4_NODE, &no_neighbor_route_server_client_cmd);
10061 install_element (BGP_IPV4M_NODE, &neighbor_route_server_client_cmd);
10062 install_element (BGP_IPV4M_NODE, &no_neighbor_route_server_client_cmd);
10063 install_element (BGP_IPV6_NODE, &neighbor_route_server_client_cmd);
10064 install_element (BGP_IPV6_NODE, &no_neighbor_route_server_client_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010065 install_element (BGP_IPV6M_NODE, &neighbor_route_server_client_cmd);
10066 install_element (BGP_IPV6M_NODE, &no_neighbor_route_server_client_cmd);
paul718e3742002-12-13 20:15:29 +000010067 install_element (BGP_VPNV4_NODE, &neighbor_route_server_client_cmd);
10068 install_element (BGP_VPNV4_NODE, &no_neighbor_route_server_client_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010069 install_element (BGP_VPNV6_NODE, &neighbor_route_server_client_cmd);
10070 install_element (BGP_VPNV6_NODE, &no_neighbor_route_server_client_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010071 install_element (BGP_ENCAP_NODE, &neighbor_route_server_client_cmd);
10072 install_element (BGP_ENCAP_NODE, &no_neighbor_route_server_client_cmd);
10073 install_element (BGP_ENCAPV6_NODE, &neighbor_route_server_client_cmd);
10074 install_element (BGP_ENCAPV6_NODE, &no_neighbor_route_server_client_cmd);
paul718e3742002-12-13 20:15:29 +000010075
10076 /* "neighbor passive" commands. */
10077 install_element (BGP_NODE, &neighbor_passive_cmd);
10078 install_element (BGP_NODE, &no_neighbor_passive_cmd);
10079
10080 /* "neighbor shutdown" commands. */
10081 install_element (BGP_NODE, &neighbor_shutdown_cmd);
10082 install_element (BGP_NODE, &no_neighbor_shutdown_cmd);
10083
hassoc9502432005-02-01 22:01:48 +000010084 /* Deprecated "neighbor capability route-refresh" commands.*/
paul718e3742002-12-13 20:15:29 +000010085 install_element (BGP_NODE, &neighbor_capability_route_refresh_cmd);
10086 install_element (BGP_NODE, &no_neighbor_capability_route_refresh_cmd);
10087
10088 /* "neighbor capability orf prefix-list" commands.*/
10089 install_element (BGP_NODE, &neighbor_capability_orf_prefix_cmd);
10090 install_element (BGP_NODE, &no_neighbor_capability_orf_prefix_cmd);
10091 install_element (BGP_IPV4_NODE, &neighbor_capability_orf_prefix_cmd);
10092 install_element (BGP_IPV4_NODE, &no_neighbor_capability_orf_prefix_cmd);
10093 install_element (BGP_IPV4M_NODE, &neighbor_capability_orf_prefix_cmd);
10094 install_element (BGP_IPV4M_NODE, &no_neighbor_capability_orf_prefix_cmd);
10095 install_element (BGP_IPV6_NODE, &neighbor_capability_orf_prefix_cmd);
10096 install_element (BGP_IPV6_NODE, &no_neighbor_capability_orf_prefix_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010097 install_element (BGP_IPV6M_NODE, &neighbor_capability_orf_prefix_cmd);
10098 install_element (BGP_IPV6M_NODE, &no_neighbor_capability_orf_prefix_cmd);
paul718e3742002-12-13 20:15:29 +000010099
10100 /* "neighbor capability dynamic" commands.*/
10101 install_element (BGP_NODE, &neighbor_capability_dynamic_cmd);
10102 install_element (BGP_NODE, &no_neighbor_capability_dynamic_cmd);
10103
10104 /* "neighbor dont-capability-negotiate" commands. */
10105 install_element (BGP_NODE, &neighbor_dont_capability_negotiate_cmd);
10106 install_element (BGP_NODE, &no_neighbor_dont_capability_negotiate_cmd);
10107
10108 /* "neighbor ebgp-multihop" commands. */
10109 install_element (BGP_NODE, &neighbor_ebgp_multihop_cmd);
10110 install_element (BGP_NODE, &neighbor_ebgp_multihop_ttl_cmd);
10111 install_element (BGP_NODE, &no_neighbor_ebgp_multihop_cmd);
10112 install_element (BGP_NODE, &no_neighbor_ebgp_multihop_ttl_cmd);
10113
hasso6ffd2072005-02-02 14:50:11 +000010114 /* "neighbor disable-connected-check" commands. */
10115 install_element (BGP_NODE, &neighbor_disable_connected_check_cmd);
10116 install_element (BGP_NODE, &no_neighbor_disable_connected_check_cmd);
paul718e3742002-12-13 20:15:29 +000010117 install_element (BGP_NODE, &neighbor_enforce_multihop_cmd);
10118 install_element (BGP_NODE, &no_neighbor_enforce_multihop_cmd);
10119
10120 /* "neighbor description" commands. */
10121 install_element (BGP_NODE, &neighbor_description_cmd);
10122 install_element (BGP_NODE, &no_neighbor_description_cmd);
10123 install_element (BGP_NODE, &no_neighbor_description_val_cmd);
10124
10125 /* "neighbor update-source" commands. "*/
10126 install_element (BGP_NODE, &neighbor_update_source_cmd);
10127 install_element (BGP_NODE, &no_neighbor_update_source_cmd);
10128
10129 /* "neighbor default-originate" commands. */
10130 install_element (BGP_NODE, &neighbor_default_originate_cmd);
10131 install_element (BGP_NODE, &neighbor_default_originate_rmap_cmd);
10132 install_element (BGP_NODE, &no_neighbor_default_originate_cmd);
10133 install_element (BGP_NODE, &no_neighbor_default_originate_rmap_cmd);
10134 install_element (BGP_IPV4_NODE, &neighbor_default_originate_cmd);
10135 install_element (BGP_IPV4_NODE, &neighbor_default_originate_rmap_cmd);
10136 install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_cmd);
10137 install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_rmap_cmd);
10138 install_element (BGP_IPV4M_NODE, &neighbor_default_originate_cmd);
10139 install_element (BGP_IPV4M_NODE, &neighbor_default_originate_rmap_cmd);
10140 install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_cmd);
10141 install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_rmap_cmd);
10142 install_element (BGP_IPV6_NODE, &neighbor_default_originate_cmd);
10143 install_element (BGP_IPV6_NODE, &neighbor_default_originate_rmap_cmd);
10144 install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_cmd);
10145 install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_rmap_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010146 install_element (BGP_IPV6M_NODE, &neighbor_default_originate_cmd);
10147 install_element (BGP_IPV6M_NODE, &neighbor_default_originate_rmap_cmd);
10148 install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_cmd);
10149 install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_rmap_cmd);
paul718e3742002-12-13 20:15:29 +000010150
10151 /* "neighbor port" commands. */
10152 install_element (BGP_NODE, &neighbor_port_cmd);
10153 install_element (BGP_NODE, &no_neighbor_port_cmd);
10154 install_element (BGP_NODE, &no_neighbor_port_val_cmd);
10155
10156 /* "neighbor weight" commands. */
10157 install_element (BGP_NODE, &neighbor_weight_cmd);
10158 install_element (BGP_NODE, &no_neighbor_weight_cmd);
10159 install_element (BGP_NODE, &no_neighbor_weight_val_cmd);
10160
10161 /* "neighbor override-capability" commands. */
10162 install_element (BGP_NODE, &neighbor_override_capability_cmd);
10163 install_element (BGP_NODE, &no_neighbor_override_capability_cmd);
10164
10165 /* "neighbor strict-capability-match" commands. */
10166 install_element (BGP_NODE, &neighbor_strict_capability_cmd);
10167 install_element (BGP_NODE, &no_neighbor_strict_capability_cmd);
10168
10169 /* "neighbor timers" commands. */
10170 install_element (BGP_NODE, &neighbor_timers_cmd);
10171 install_element (BGP_NODE, &no_neighbor_timers_cmd);
10172
10173 /* "neighbor timers connect" commands. */
10174 install_element (BGP_NODE, &neighbor_timers_connect_cmd);
10175 install_element (BGP_NODE, &no_neighbor_timers_connect_cmd);
10176 install_element (BGP_NODE, &no_neighbor_timers_connect_val_cmd);
10177
10178 /* "neighbor advertisement-interval" commands. */
10179 install_element (BGP_NODE, &neighbor_advertise_interval_cmd);
10180 install_element (BGP_NODE, &no_neighbor_advertise_interval_cmd);
10181 install_element (BGP_NODE, &no_neighbor_advertise_interval_val_cmd);
10182
10183 /* "neighbor version" commands. */
10184 install_element (BGP_NODE, &neighbor_version_cmd);
paul718e3742002-12-13 20:15:29 +000010185
10186 /* "neighbor interface" commands. */
10187 install_element (BGP_NODE, &neighbor_interface_cmd);
10188 install_element (BGP_NODE, &no_neighbor_interface_cmd);
10189
10190 /* "neighbor distribute" commands. */
10191 install_element (BGP_NODE, &neighbor_distribute_list_cmd);
10192 install_element (BGP_NODE, &no_neighbor_distribute_list_cmd);
10193 install_element (BGP_IPV4_NODE, &neighbor_distribute_list_cmd);
10194 install_element (BGP_IPV4_NODE, &no_neighbor_distribute_list_cmd);
10195 install_element (BGP_IPV4M_NODE, &neighbor_distribute_list_cmd);
10196 install_element (BGP_IPV4M_NODE, &no_neighbor_distribute_list_cmd);
10197 install_element (BGP_IPV6_NODE, &neighbor_distribute_list_cmd);
10198 install_element (BGP_IPV6_NODE, &no_neighbor_distribute_list_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010199 install_element (BGP_IPV6M_NODE, &neighbor_distribute_list_cmd);
10200 install_element (BGP_IPV6M_NODE, &no_neighbor_distribute_list_cmd);
paul718e3742002-12-13 20:15:29 +000010201 install_element (BGP_VPNV4_NODE, &neighbor_distribute_list_cmd);
10202 install_element (BGP_VPNV4_NODE, &no_neighbor_distribute_list_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010203 install_element (BGP_VPNV6_NODE, &neighbor_distribute_list_cmd);
10204 install_element (BGP_VPNV6_NODE, &no_neighbor_distribute_list_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010205 install_element (BGP_ENCAP_NODE, &neighbor_distribute_list_cmd);
10206 install_element (BGP_ENCAP_NODE, &no_neighbor_distribute_list_cmd);
10207 install_element (BGP_ENCAPV6_NODE, &neighbor_distribute_list_cmd);
10208 install_element (BGP_ENCAPV6_NODE, &no_neighbor_distribute_list_cmd);
paul718e3742002-12-13 20:15:29 +000010209
10210 /* "neighbor prefix-list" commands. */
10211 install_element (BGP_NODE, &neighbor_prefix_list_cmd);
10212 install_element (BGP_NODE, &no_neighbor_prefix_list_cmd);
10213 install_element (BGP_IPV4_NODE, &neighbor_prefix_list_cmd);
10214 install_element (BGP_IPV4_NODE, &no_neighbor_prefix_list_cmd);
10215 install_element (BGP_IPV4M_NODE, &neighbor_prefix_list_cmd);
10216 install_element (BGP_IPV4M_NODE, &no_neighbor_prefix_list_cmd);
10217 install_element (BGP_IPV6_NODE, &neighbor_prefix_list_cmd);
10218 install_element (BGP_IPV6_NODE, &no_neighbor_prefix_list_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010219 install_element (BGP_IPV6M_NODE, &neighbor_prefix_list_cmd);
10220 install_element (BGP_IPV6M_NODE, &no_neighbor_prefix_list_cmd);
paul718e3742002-12-13 20:15:29 +000010221 install_element (BGP_VPNV4_NODE, &neighbor_prefix_list_cmd);
10222 install_element (BGP_VPNV4_NODE, &no_neighbor_prefix_list_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010223 install_element (BGP_VPNV6_NODE, &neighbor_prefix_list_cmd);
10224 install_element (BGP_VPNV6_NODE, &no_neighbor_prefix_list_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010225 install_element (BGP_ENCAP_NODE, &neighbor_prefix_list_cmd);
10226 install_element (BGP_ENCAP_NODE, &no_neighbor_prefix_list_cmd);
10227 install_element (BGP_ENCAPV6_NODE, &neighbor_prefix_list_cmd);
10228 install_element (BGP_ENCAPV6_NODE, &no_neighbor_prefix_list_cmd);
paul718e3742002-12-13 20:15:29 +000010229
10230 /* "neighbor filter-list" commands. */
10231 install_element (BGP_NODE, &neighbor_filter_list_cmd);
10232 install_element (BGP_NODE, &no_neighbor_filter_list_cmd);
10233 install_element (BGP_IPV4_NODE, &neighbor_filter_list_cmd);
10234 install_element (BGP_IPV4_NODE, &no_neighbor_filter_list_cmd);
10235 install_element (BGP_IPV4M_NODE, &neighbor_filter_list_cmd);
10236 install_element (BGP_IPV4M_NODE, &no_neighbor_filter_list_cmd);
10237 install_element (BGP_IPV6_NODE, &neighbor_filter_list_cmd);
10238 install_element (BGP_IPV6_NODE, &no_neighbor_filter_list_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010239 install_element (BGP_IPV6M_NODE, &neighbor_filter_list_cmd);
10240 install_element (BGP_IPV6M_NODE, &no_neighbor_filter_list_cmd);
paul718e3742002-12-13 20:15:29 +000010241 install_element (BGP_VPNV4_NODE, &neighbor_filter_list_cmd);
10242 install_element (BGP_VPNV4_NODE, &no_neighbor_filter_list_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010243 install_element (BGP_VPNV6_NODE, &neighbor_filter_list_cmd);
10244 install_element (BGP_VPNV6_NODE, &no_neighbor_filter_list_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010245 install_element (BGP_ENCAP_NODE, &neighbor_filter_list_cmd);
10246 install_element (BGP_ENCAP_NODE, &no_neighbor_filter_list_cmd);
10247 install_element (BGP_ENCAPV6_NODE, &neighbor_filter_list_cmd);
10248 install_element (BGP_ENCAPV6_NODE, &no_neighbor_filter_list_cmd);
paul718e3742002-12-13 20:15:29 +000010249
10250 /* "neighbor route-map" commands. */
10251 install_element (BGP_NODE, &neighbor_route_map_cmd);
10252 install_element (BGP_NODE, &no_neighbor_route_map_cmd);
10253 install_element (BGP_IPV4_NODE, &neighbor_route_map_cmd);
10254 install_element (BGP_IPV4_NODE, &no_neighbor_route_map_cmd);
10255 install_element (BGP_IPV4M_NODE, &neighbor_route_map_cmd);
10256 install_element (BGP_IPV4M_NODE, &no_neighbor_route_map_cmd);
10257 install_element (BGP_IPV6_NODE, &neighbor_route_map_cmd);
10258 install_element (BGP_IPV6_NODE, &no_neighbor_route_map_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010259 install_element (BGP_IPV6M_NODE, &neighbor_route_map_cmd);
10260 install_element (BGP_IPV6M_NODE, &no_neighbor_route_map_cmd);
paul718e3742002-12-13 20:15:29 +000010261 install_element (BGP_VPNV4_NODE, &neighbor_route_map_cmd);
10262 install_element (BGP_VPNV4_NODE, &no_neighbor_route_map_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010263 install_element (BGP_VPNV6_NODE, &neighbor_route_map_cmd);
10264 install_element (BGP_VPNV6_NODE, &no_neighbor_route_map_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010265 install_element (BGP_ENCAP_NODE, &neighbor_route_map_cmd);
10266 install_element (BGP_ENCAP_NODE, &no_neighbor_route_map_cmd);
10267 install_element (BGP_ENCAPV6_NODE, &neighbor_route_map_cmd);
10268 install_element (BGP_ENCAPV6_NODE, &no_neighbor_route_map_cmd);
paul718e3742002-12-13 20:15:29 +000010269
10270 /* "neighbor unsuppress-map" commands. */
10271 install_element (BGP_NODE, &neighbor_unsuppress_map_cmd);
10272 install_element (BGP_NODE, &no_neighbor_unsuppress_map_cmd);
10273 install_element (BGP_IPV4_NODE, &neighbor_unsuppress_map_cmd);
10274 install_element (BGP_IPV4_NODE, &no_neighbor_unsuppress_map_cmd);
10275 install_element (BGP_IPV4M_NODE, &neighbor_unsuppress_map_cmd);
10276 install_element (BGP_IPV4M_NODE, &no_neighbor_unsuppress_map_cmd);
10277 install_element (BGP_IPV6_NODE, &neighbor_unsuppress_map_cmd);
10278 install_element (BGP_IPV6_NODE, &no_neighbor_unsuppress_map_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010279 install_element (BGP_IPV6M_NODE, &neighbor_unsuppress_map_cmd);
10280 install_element (BGP_IPV6M_NODE, &no_neighbor_unsuppress_map_cmd);
paula58545b2003-07-12 21:43:01 +000010281 install_element (BGP_VPNV4_NODE, &neighbor_unsuppress_map_cmd);
Lou Berger82dd7072016-01-12 13:41:57 -050010282 install_element (BGP_VPNV4_NODE, &no_neighbor_unsuppress_map_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010283 install_element (BGP_VPNV6_NODE, &neighbor_unsuppress_map_cmd);
Lou Berger82dd7072016-01-12 13:41:57 -050010284 install_element (BGP_VPNV6_NODE, &no_neighbor_unsuppress_map_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010285 install_element (BGP_ENCAP_NODE, &neighbor_unsuppress_map_cmd);
10286 install_element (BGP_ENCAP_NODE, &no_neighbor_unsuppress_map_cmd);
10287 install_element (BGP_ENCAPV6_NODE, &neighbor_unsuppress_map_cmd);
10288 install_element (BGP_ENCAPV6_NODE, &no_neighbor_unsuppress_map_cmd);
paul718e3742002-12-13 20:15:29 +000010289
10290 /* "neighbor maximum-prefix" commands. */
10291 install_element (BGP_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +000010292 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +000010293 install_element (BGP_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +000010294 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +000010295 install_element (BGP_NODE, &neighbor_maximum_prefix_restart_cmd);
10296 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010297 install_element (BGP_NODE, &no_neighbor_maximum_prefix_cmd);
10298 install_element (BGP_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +000010299 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10300 install_element (BGP_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10301 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10302 install_element (BGP_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10303 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010304 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +000010305 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +000010306 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +000010307 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +000010308 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_restart_cmd);
10309 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010310 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_cmd);
10311 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +000010312 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10313 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10314 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10315 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10316 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010317 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +000010318 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +000010319 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +000010320 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +000010321 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_restart_cmd);
10322 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010323 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_cmd);
10324 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +000010325 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10326 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10327 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10328 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10329 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010330 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +000010331 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +000010332 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +000010333 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +000010334 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_restart_cmd);
10335 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010336 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_cmd);
10337 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +000010338 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10339 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10340 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10341 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10342 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010343 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_cmd);
10344 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_cmd);
10345 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_warning_cmd);
10346 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
10347 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_restart_cmd);
10348 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
10349 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_cmd);
10350 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_val_cmd);
10351 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10352 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10353 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10354 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10355 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010356 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +000010357 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +000010358 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +000010359 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +000010360 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_restart_cmd);
10361 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010362 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_cmd);
10363 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +000010364 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10365 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10366 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10367 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10368 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +000010369
Lou Berger13c378d2016-01-12 13:41:56 -050010370 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_cmd);
10371 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_threshold_cmd);
10372 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_warning_cmd);
10373 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
10374 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_restart_cmd);
10375 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
10376 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_cmd);
10377 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_val_cmd);
10378 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10379 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10380 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10381 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10382 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
10383
Lou Bergera3fda882016-01-12 13:42:04 -050010384 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_cmd);
10385 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_threshold_cmd);
10386 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_warning_cmd);
10387 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
10388 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_restart_cmd);
10389 install_element (BGP_ENCAP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
10390 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_cmd);
10391 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_val_cmd);
10392 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10393 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10394 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10395 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10396 install_element (BGP_ENCAP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
10397
10398 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_cmd);
10399 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_threshold_cmd);
10400 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_warning_cmd);
10401 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
10402 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_restart_cmd);
10403 install_element (BGP_ENCAPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
10404 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_cmd);
10405 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_val_cmd);
10406 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10407 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10408 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10409 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10410 install_element (BGP_ENCAPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
10411
paul718e3742002-12-13 20:15:29 +000010412 /* "neighbor allowas-in" */
10413 install_element (BGP_NODE, &neighbor_allowas_in_cmd);
10414 install_element (BGP_NODE, &neighbor_allowas_in_arg_cmd);
10415 install_element (BGP_NODE, &no_neighbor_allowas_in_cmd);
10416 install_element (BGP_IPV4_NODE, &neighbor_allowas_in_cmd);
10417 install_element (BGP_IPV4_NODE, &neighbor_allowas_in_arg_cmd);
10418 install_element (BGP_IPV4_NODE, &no_neighbor_allowas_in_cmd);
10419 install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_cmd);
10420 install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_arg_cmd);
10421 install_element (BGP_IPV4M_NODE, &no_neighbor_allowas_in_cmd);
10422 install_element (BGP_IPV6_NODE, &neighbor_allowas_in_cmd);
10423 install_element (BGP_IPV6_NODE, &neighbor_allowas_in_arg_cmd);
10424 install_element (BGP_IPV6_NODE, &no_neighbor_allowas_in_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010425 install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_cmd);
10426 install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_arg_cmd);
10427 install_element (BGP_IPV6M_NODE, &no_neighbor_allowas_in_cmd);
paul718e3742002-12-13 20:15:29 +000010428 install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_cmd);
10429 install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_arg_cmd);
10430 install_element (BGP_VPNV4_NODE, &no_neighbor_allowas_in_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010431 install_element (BGP_VPNV6_NODE, &neighbor_allowas_in_cmd);
10432 install_element (BGP_VPNV6_NODE, &neighbor_allowas_in_arg_cmd);
10433 install_element (BGP_VPNV6_NODE, &no_neighbor_allowas_in_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010434 install_element (BGP_ENCAP_NODE, &neighbor_allowas_in_cmd);
10435 install_element (BGP_ENCAP_NODE, &neighbor_allowas_in_arg_cmd);
10436 install_element (BGP_ENCAP_NODE, &no_neighbor_allowas_in_cmd);
10437 install_element (BGP_ENCAPV6_NODE, &neighbor_allowas_in_cmd);
10438 install_element (BGP_ENCAPV6_NODE, &neighbor_allowas_in_arg_cmd);
10439 install_element (BGP_ENCAPV6_NODE, &no_neighbor_allowas_in_cmd);
paul718e3742002-12-13 20:15:29 +000010440
10441 /* address-family commands. */
10442 install_element (BGP_NODE, &address_family_ipv4_cmd);
10443 install_element (BGP_NODE, &address_family_ipv4_safi_cmd);
10444#ifdef HAVE_IPV6
10445 install_element (BGP_NODE, &address_family_ipv6_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010446 install_element (BGP_NODE, &address_family_ipv6_safi_cmd);
paul718e3742002-12-13 20:15:29 +000010447#endif /* HAVE_IPV6 */
10448 install_element (BGP_NODE, &address_family_vpnv4_cmd);
10449 install_element (BGP_NODE, &address_family_vpnv4_unicast_cmd);
10450
Lou Berger13c378d2016-01-12 13:41:56 -050010451 install_element (BGP_NODE, &address_family_vpnv6_cmd);
10452 install_element (BGP_NODE, &address_family_vpnv6_unicast_cmd);
10453
Lou Bergera3fda882016-01-12 13:42:04 -050010454 install_element (BGP_NODE, &address_family_encap_cmd);
10455 install_element (BGP_NODE, &address_family_encapv4_cmd);
10456#ifdef HAVE_IPV6
10457 install_element (BGP_NODE, &address_family_encapv6_cmd);
10458#endif
10459
paul718e3742002-12-13 20:15:29 +000010460 /* "exit-address-family" command. */
10461 install_element (BGP_IPV4_NODE, &exit_address_family_cmd);
10462 install_element (BGP_IPV4M_NODE, &exit_address_family_cmd);
10463 install_element (BGP_IPV6_NODE, &exit_address_family_cmd);
paul25ffbdc2005-08-22 22:42:08 +000010464 install_element (BGP_IPV6M_NODE, &exit_address_family_cmd);
paul718e3742002-12-13 20:15:29 +000010465 install_element (BGP_VPNV4_NODE, &exit_address_family_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -050010466 install_element (BGP_VPNV6_NODE, &exit_address_family_cmd);
Lou Bergera3fda882016-01-12 13:42:04 -050010467 install_element (BGP_ENCAP_NODE, &exit_address_family_cmd);
10468 install_element (BGP_ENCAPV6_NODE, &exit_address_family_cmd);
paul718e3742002-12-13 20:15:29 +000010469
10470 /* "clear ip bgp commands" */
10471 install_element (ENABLE_NODE, &clear_ip_bgp_all_cmd);
10472 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_cmd);
10473 install_element (ENABLE_NODE, &clear_ip_bgp_as_cmd);
10474 install_element (ENABLE_NODE, &clear_ip_bgp_peer_cmd);
10475 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_cmd);
10476 install_element (ENABLE_NODE, &clear_ip_bgp_external_cmd);
10477#ifdef HAVE_IPV6
10478 install_element (ENABLE_NODE, &clear_bgp_all_cmd);
10479 install_element (ENABLE_NODE, &clear_bgp_instance_all_cmd);
10480 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_cmd);
10481 install_element (ENABLE_NODE, &clear_bgp_peer_cmd);
10482 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_cmd);
10483 install_element (ENABLE_NODE, &clear_bgp_peer_group_cmd);
10484 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_cmd);
10485 install_element (ENABLE_NODE, &clear_bgp_external_cmd);
10486 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_cmd);
10487 install_element (ENABLE_NODE, &clear_bgp_as_cmd);
10488 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_cmd);
10489#endif /* HAVE_IPV6 */
10490
10491 /* "clear ip bgp neighbor soft in" */
10492 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_in_cmd);
10493 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_in_cmd);
10494 install_element (ENABLE_NODE, &clear_ip_bgp_all_in_cmd);
10495 install_element (ENABLE_NODE, &clear_ip_bgp_all_in_prefix_filter_cmd);
10496 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_in_prefix_filter_cmd);
10497 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_in_cmd);
10498 install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_cmd);
10499 install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_prefix_filter_cmd);
10500 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_in_cmd);
10501 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_cmd);
10502 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_prefix_filter_cmd);
10503 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_in_cmd);
10504 install_element (ENABLE_NODE, &clear_ip_bgp_external_in_cmd);
10505 install_element (ENABLE_NODE, &clear_ip_bgp_external_in_prefix_filter_cmd);
10506 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_in_cmd);
10507 install_element (ENABLE_NODE, &clear_ip_bgp_as_in_cmd);
10508 install_element (ENABLE_NODE, &clear_ip_bgp_as_in_prefix_filter_cmd);
10509 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_in_cmd);
10510 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_in_cmd);
10511 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_cmd);
10512 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_prefix_filter_cmd);
10513 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd);
10514 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_in_cmd);
10515 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_cmd);
10516 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd);
10517 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_in_cmd);
10518 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_cmd);
10519 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd);
10520 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_in_cmd);
10521 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_cmd);
10522 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_prefix_filter_cmd);
10523 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_in_cmd);
10524 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_cmd);
10525 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_prefix_filter_cmd);
10526 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_in_cmd);
10527 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_in_cmd);
10528 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_in_cmd);
10529 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_in_cmd);
10530 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_in_cmd);
10531 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_in_cmd);
Lou Berger298cc2f2016-01-12 13:42:02 -050010532 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_soft_in_cmd);
10533 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_in_cmd);
10534 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_soft_in_cmd);
10535 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_in_cmd);
10536 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_soft_in_cmd);
10537 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_in_cmd);
paul718e3742002-12-13 20:15:29 +000010538#ifdef HAVE_IPV6
10539 install_element (ENABLE_NODE, &clear_bgp_all_soft_in_cmd);
10540 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_in_cmd);
10541 install_element (ENABLE_NODE, &clear_bgp_all_in_cmd);
10542 install_element (ENABLE_NODE, &clear_bgp_all_in_prefix_filter_cmd);
10543 install_element (ENABLE_NODE, &clear_bgp_peer_soft_in_cmd);
10544 install_element (ENABLE_NODE, &clear_bgp_peer_in_cmd);
10545 install_element (ENABLE_NODE, &clear_bgp_peer_in_prefix_filter_cmd);
10546 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_in_cmd);
10547 install_element (ENABLE_NODE, &clear_bgp_peer_group_in_cmd);
10548 install_element (ENABLE_NODE, &clear_bgp_peer_group_in_prefix_filter_cmd);
10549 install_element (ENABLE_NODE, &clear_bgp_external_soft_in_cmd);
10550 install_element (ENABLE_NODE, &clear_bgp_external_in_cmd);
10551 install_element (ENABLE_NODE, &clear_bgp_external_in_prefix_filter_cmd);
10552 install_element (ENABLE_NODE, &clear_bgp_as_soft_in_cmd);
10553 install_element (ENABLE_NODE, &clear_bgp_as_in_cmd);
10554 install_element (ENABLE_NODE, &clear_bgp_as_in_prefix_filter_cmd);
10555 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_in_cmd);
10556 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_cmd);
10557 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_prefix_filter_cmd);
10558 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_in_cmd);
10559 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_cmd);
10560 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_prefix_filter_cmd);
10561 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_in_cmd);
10562 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_cmd);
10563 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_prefix_filter_cmd);
10564 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_in_cmd);
10565 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_cmd);
10566 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_prefix_filter_cmd);
10567 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_in_cmd);
10568 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_cmd);
10569 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_prefix_filter_cmd);
10570#endif /* HAVE_IPV6 */
10571
10572 /* "clear ip bgp neighbor soft out" */
10573 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_out_cmd);
10574 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_out_cmd);
10575 install_element (ENABLE_NODE, &clear_ip_bgp_all_out_cmd);
10576 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_out_cmd);
10577 install_element (ENABLE_NODE, &clear_ip_bgp_peer_out_cmd);
10578 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_out_cmd);
10579 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_out_cmd);
10580 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_out_cmd);
10581 install_element (ENABLE_NODE, &clear_ip_bgp_external_out_cmd);
10582 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_out_cmd);
10583 install_element (ENABLE_NODE, &clear_ip_bgp_as_out_cmd);
10584 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_out_cmd);
10585 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_out_cmd);
10586 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_out_cmd);
10587 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_out_cmd);
10588 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_out_cmd);
10589 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_out_cmd);
10590 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_out_cmd);
10591 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_out_cmd);
10592 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_out_cmd);
10593 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_out_cmd);
10594 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_out_cmd);
10595 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_out_cmd);
10596 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_out_cmd);
10597 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_out_cmd);
10598 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_out_cmd);
10599 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_out_cmd);
10600 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_out_cmd);
Lou Berger298cc2f2016-01-12 13:42:02 -050010601 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_soft_out_cmd);
10602 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_out_cmd);
10603 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_soft_out_cmd);
10604 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_out_cmd);
10605 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_soft_out_cmd);
10606 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_out_cmd);
paul718e3742002-12-13 20:15:29 +000010607#ifdef HAVE_IPV6
10608 install_element (ENABLE_NODE, &clear_bgp_all_soft_out_cmd);
10609 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_out_cmd);
10610 install_element (ENABLE_NODE, &clear_bgp_all_out_cmd);
10611 install_element (ENABLE_NODE, &clear_bgp_peer_soft_out_cmd);
10612 install_element (ENABLE_NODE, &clear_bgp_peer_out_cmd);
10613 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_out_cmd);
10614 install_element (ENABLE_NODE, &clear_bgp_peer_group_out_cmd);
10615 install_element (ENABLE_NODE, &clear_bgp_external_soft_out_cmd);
10616 install_element (ENABLE_NODE, &clear_bgp_external_out_cmd);
10617 install_element (ENABLE_NODE, &clear_bgp_as_soft_out_cmd);
10618 install_element (ENABLE_NODE, &clear_bgp_as_out_cmd);
10619 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_out_cmd);
10620 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_out_cmd);
10621 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_out_cmd);
10622 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_out_cmd);
10623 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_out_cmd);
10624 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_out_cmd);
10625 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_out_cmd);
10626 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_out_cmd);
10627 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_out_cmd);
10628 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_out_cmd);
10629#endif /* HAVE_IPV6 */
10630
10631 /* "clear ip bgp neighbor soft" */
10632 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_cmd);
10633 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_cmd);
10634 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_cmd);
10635 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_cmd);
10636 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_cmd);
10637 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_cmd);
10638 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_cmd);
10639 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_cmd);
10640 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_cmd);
10641 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_cmd);
10642 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_cmd);
10643 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_cmd);
10644 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_cmd);
10645 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_cmd);
10646 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_cmd);
Lou Berger298cc2f2016-01-12 13:42:02 -050010647 install_element (ENABLE_NODE, &clear_ip_bgp_all_encap_soft_cmd);
10648 install_element (ENABLE_NODE, &clear_ip_bgp_peer_encap_soft_cmd);
10649 install_element (ENABLE_NODE, &clear_ip_bgp_as_encap_soft_cmd);
paul718e3742002-12-13 20:15:29 +000010650#ifdef HAVE_IPV6
10651 install_element (ENABLE_NODE, &clear_bgp_all_soft_cmd);
10652 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_cmd);
10653 install_element (ENABLE_NODE, &clear_bgp_peer_soft_cmd);
10654 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_cmd);
10655 install_element (ENABLE_NODE, &clear_bgp_external_soft_cmd);
10656 install_element (ENABLE_NODE, &clear_bgp_as_soft_cmd);
10657 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_cmd);
10658 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_cmd);
10659 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_cmd);
10660 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_cmd);
10661 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_cmd);
10662#endif /* HAVE_IPV6 */
10663
paulfee0f4c2004-09-13 05:12:46 +000010664 /* "clear ip bgp neighbor rsclient" */
10665 install_element (ENABLE_NODE, &clear_ip_bgp_all_rsclient_cmd);
10666 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_rsclient_cmd);
10667 install_element (ENABLE_NODE, &clear_ip_bgp_peer_rsclient_cmd);
10668 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_rsclient_cmd);
10669#ifdef HAVE_IPV6
10670 install_element (ENABLE_NODE, &clear_bgp_all_rsclient_cmd);
10671 install_element (ENABLE_NODE, &clear_bgp_instance_all_rsclient_cmd);
10672 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_rsclient_cmd);
10673 install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_all_rsclient_cmd);
10674 install_element (ENABLE_NODE, &clear_bgp_peer_rsclient_cmd);
10675 install_element (ENABLE_NODE, &clear_bgp_instance_peer_rsclient_cmd);
10676 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_rsclient_cmd);
10677 install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_peer_rsclient_cmd);
10678#endif /* HAVE_IPV6 */
10679
paul718e3742002-12-13 20:15:29 +000010680 /* "show ip bgp summary" commands. */
paul718e3742002-12-13 20:15:29 +000010681 install_element (VIEW_NODE, &show_bgp_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050010682 install_element (RESTRICTED_NODE, &show_bgp_summary_cmd);
10683 install_element (ENABLE_NODE, &show_bgp_summary_cmd);
10684
10685 install_element (VIEW_NODE, &show_bgp_summary_1w_cmd);
10686 install_element (RESTRICTED_NODE, &show_bgp_summary_1w_cmd);
10687 install_element (ENABLE_NODE, &show_bgp_summary_1w_cmd);
10688
10689 install_element (VIEW_NODE, &show_bgp_ipv4_safi_summary_cmd);
10690 install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_summary_cmd);
10691 install_element (VIEW_NODE, &show_bgp_instance_ipv4_summary_cmd);
10692
10693 install_element (VIEW_NODE, &show_bgp_ipv4_vpn_summary_cmd);
10694 install_element (VIEW_NODE, &show_bgp_ipv4_encap_summary_cmd);
10695#ifdef HAVE_IPV6
10696 install_element (VIEW_NODE, &show_bgp_ipv6_vpn_summary_cmd);
10697 install_element (VIEW_NODE, &show_bgp_ipv6_encap_summary_cmd);
10698#endif
10699
paul718e3742002-12-13 20:15:29 +000010700 install_element (VIEW_NODE, &show_bgp_instance_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050010701#ifdef HAVE_IPV6
Michael Lambert95cbbd22010-07-23 14:43:04 -040010702 install_element (VIEW_NODE, &show_bgp_ipv6_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010703 install_element (VIEW_NODE, &show_bgp_instance_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010704 install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010705#endif /* HAVE_IPV6 */
Michael Lambert95cbbd22010-07-23 14:43:04 -040010706 install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050010707 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010708 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050010709
10710 install_element (RESTRICTED_NODE, &show_bgp_ipv4_vpn_summary_cmd);
10711 install_element (RESTRICTED_NODE, &show_bgp_ipv4_encap_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010712#ifdef HAVE_IPV6
Lou Berger651b4022016-01-12 13:42:07 -050010713 install_element (RESTRICTED_NODE, &show_bgp_ipv6_vpn_summary_cmd);
10714 install_element (RESTRICTED_NODE, &show_bgp_ipv6_encap_summary_cmd);
10715 install_element (RESTRICTED_NODE, &show_bgp_ipv6_encap_summary_cmd);
10716#endif
10717
Paul Jakma62687ff2008-08-23 14:27:06 +010010718 install_element (RESTRICTED_NODE, &show_bgp_instance_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050010719#ifdef HAVE_IPV6
Michael Lambert95cbbd22010-07-23 14:43:04 -040010720 install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010721 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010722 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010723#endif /* HAVE_IPV6 */
Michael Lambert95cbbd22010-07-23 14:43:04 -040010724 install_element (ENABLE_NODE, &show_bgp_ipv4_safi_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050010725 install_element (ENABLE_NODE, &show_bgp_instance_ipv4_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010726 install_element (ENABLE_NODE, &show_bgp_instance_ipv4_safi_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050010727
10728 install_element (ENABLE_NODE, &show_bgp_ipv4_vpn_summary_cmd);
10729 install_element (ENABLE_NODE, &show_bgp_ipv4_encap_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010730#ifdef HAVE_IPV6
Lou Berger651b4022016-01-12 13:42:07 -050010731 install_element (ENABLE_NODE, &show_bgp_ipv6_vpn_summary_cmd);
10732 install_element (ENABLE_NODE, &show_bgp_ipv6_encap_summary_cmd);
10733#endif
10734
paul718e3742002-12-13 20:15:29 +000010735 install_element (ENABLE_NODE, &show_bgp_instance_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050010736#ifdef HAVE_IPV6
Michael Lambert95cbbd22010-07-23 14:43:04 -040010737 install_element (ENABLE_NODE, &show_bgp_ipv6_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010738 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010739 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010740#endif /* HAVE_IPV6 */
10741
10742 /* "show ip bgp neighbors" commands. */
paulbb46e942003-10-24 19:02:03 +000010743 install_element (VIEW_NODE, &show_bgp_instance_neighbors_cmd);
paulbb46e942003-10-24 19:02:03 +000010744 install_element (ENABLE_NODE, &show_bgp_instance_neighbors_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050010745
10746 install_element (VIEW_NODE, &show_bgp_neighbors_cmd);
10747 install_element (VIEW_NODE, &show_bgp_neighbors_peer_cmd);
10748 install_element (VIEW_NODE, &show_bgp_instance_neighbors_peer_cmd);
10749 install_element (RESTRICTED_NODE, &show_bgp_neighbors_peer_cmd);
10750 install_element (RESTRICTED_NODE, &show_bgp_instance_neighbors_peer_cmd);
10751 install_element (ENABLE_NODE, &show_bgp_neighbors_cmd);
10752 install_element (ENABLE_NODE, &show_bgp_neighbors_peer_cmd);
paulbb46e942003-10-24 19:02:03 +000010753 install_element (ENABLE_NODE, &show_bgp_instance_neighbors_peer_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050010754#ifdef HAVE_IPV6
10755 install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_cmd);
10756 install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
10757 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
10758 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_cmd);
paulbb46e942003-10-24 19:02:03 +000010759 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
paul718e3742002-12-13 20:15:29 +000010760
paul718e3742002-12-13 20:15:29 +000010761#endif /* HAVE_IPV6 */
10762
paulfee0f4c2004-09-13 05:12:46 +000010763 /* "show ip bgp rsclient" commands. */
Michael Lambert95cbbd22010-07-23 14:43:04 -040010764 install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd);
10765 install_element (VIEW_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010766 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd);
10767 install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010768 install_element (ENABLE_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd);
10769 install_element (ENABLE_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000010770
paulfee0f4c2004-09-13 05:12:46 +000010771 install_element (VIEW_NODE, &show_bgp_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000010772 install_element (VIEW_NODE, &show_bgp_instance_rsclient_summary_cmd);
Lou Berger651b4022016-01-12 13:42:07 -050010773 install_element (RESTRICTED_NODE, &show_bgp_rsclient_summary_cmd);
10774 install_element (RESTRICTED_NODE, &show_bgp_instance_rsclient_summary_cmd);
10775 install_element (ENABLE_NODE, &show_bgp_rsclient_summary_cmd);
10776 install_element (ENABLE_NODE, &show_bgp_instance_rsclient_summary_cmd);
10777#ifdef HAVE_IPV6
10778 install_element (VIEW_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000010779 install_element (VIEW_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010780 install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd);
10781 install_element (VIEW_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010782 install_element (RESTRICTED_NODE, &show_bgp_rsclient_summary_cmd);
10783 install_element (RESTRICTED_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010784 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010785 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd);
10786 install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000010787 install_element (ENABLE_NODE, &show_bgp_rsclient_summary_cmd);
10788 install_element (ENABLE_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000010789 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010790 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd);
10791 install_element (ENABLE_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000010792#endif /* HAVE_IPV6 */
10793
paul718e3742002-12-13 20:15:29 +000010794 /* "show ip bgp paths" commands. */
Lou Berger651b4022016-01-12 13:42:07 -050010795 install_element (VIEW_NODE, &show_bgp_ipv4_paths_cmd);
10796 install_element (ENABLE_NODE, &show_bgp_ipv4_paths_cmd);
paul718e3742002-12-13 20:15:29 +000010797
10798 /* "show ip bgp community" commands. */
10799 install_element (VIEW_NODE, &show_ip_bgp_community_info_cmd);
10800 install_element (ENABLE_NODE, &show_ip_bgp_community_info_cmd);
10801
10802 /* "show ip bgp attribute-info" commands. */
10803 install_element (VIEW_NODE, &show_ip_bgp_attr_info_cmd);
10804 install_element (ENABLE_NODE, &show_ip_bgp_attr_info_cmd);
10805
10806 /* "redistribute" commands. */
10807 install_element (BGP_NODE, &bgp_redistribute_ipv4_cmd);
10808 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_cmd);
10809 install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_cmd);
10810 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_cmd);
10811 install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_cmd);
10812 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_cmd);
10813 install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_metric_cmd);
10814 install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_rmap_cmd);
10815 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_metric_cmd);
10816 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_rmap_cmd);
10817#ifdef HAVE_IPV6
10818 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_cmd);
10819 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_cmd);
10820 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_cmd);
10821 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_cmd);
10822 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_cmd);
10823 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_cmd);
10824 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_metric_cmd);
10825 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_rmap_cmd);
10826 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_metric_cmd);
10827 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_rmap_cmd);
10828#endif /* HAVE_IPV6 */
10829
Nick Hilliardfa411a22011-03-23 15:33:17 +000010830 /* ttl_security commands */
10831 install_element (BGP_NODE, &neighbor_ttl_security_cmd);
10832 install_element (BGP_NODE, &no_neighbor_ttl_security_cmd);
10833
Paul Jakma4bf6a362006-03-30 14:05:23 +000010834 /* "show bgp memory" commands. */
10835 install_element (VIEW_NODE, &show_bgp_memory_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010836 install_element (RESTRICTED_NODE, &show_bgp_memory_cmd);
Paul Jakma4bf6a362006-03-30 14:05:23 +000010837 install_element (ENABLE_NODE, &show_bgp_memory_cmd);
10838
Michael Lamberte0081f72008-11-16 20:12:04 +000010839 /* "show bgp views" commands. */
10840 install_element (VIEW_NODE, &show_bgp_views_cmd);
10841 install_element (RESTRICTED_NODE, &show_bgp_views_cmd);
10842 install_element (ENABLE_NODE, &show_bgp_views_cmd);
10843
paul718e3742002-12-13 20:15:29 +000010844 /* Community-list. */
10845 community_list_vty ();
10846}
David Lamparter6b0655a2014-06-04 06:53:35 +020010847
paul718e3742002-12-13 20:15:29 +000010848#include "memory.h"
10849#include "bgp_regex.h"
10850#include "bgp_clist.h"
10851#include "bgp_ecommunity.h"
10852
10853/* VTY functions. */
10854
10855/* Direction value to string conversion. */
paul94f2b392005-06-28 12:44:16 +000010856static const char *
paul718e3742002-12-13 20:15:29 +000010857community_direct_str (int direct)
10858{
10859 switch (direct)
10860 {
10861 case COMMUNITY_DENY:
10862 return "deny";
paul718e3742002-12-13 20:15:29 +000010863 case COMMUNITY_PERMIT:
10864 return "permit";
paul718e3742002-12-13 20:15:29 +000010865 default:
10866 return "unknown";
paul718e3742002-12-13 20:15:29 +000010867 }
10868}
10869
10870/* Display error string. */
paul94f2b392005-06-28 12:44:16 +000010871static void
paul718e3742002-12-13 20:15:29 +000010872community_list_perror (struct vty *vty, int ret)
10873{
10874 switch (ret)
10875 {
10876 case COMMUNITY_LIST_ERR_CANT_FIND_LIST:
Denis Ovsienkob7292942010-12-08 18:51:37 +030010877 vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000010878 break;
10879 case COMMUNITY_LIST_ERR_MALFORMED_VAL:
10880 vty_out (vty, "%% Malformed community-list value%s", VTY_NEWLINE);
10881 break;
10882 case COMMUNITY_LIST_ERR_STANDARD_CONFLICT:
10883 vty_out (vty, "%% Community name conflict, previously defined as standard community%s", VTY_NEWLINE);
10884 break;
10885 case COMMUNITY_LIST_ERR_EXPANDED_CONFLICT:
10886 vty_out (vty, "%% Community name conflict, previously defined as expanded community%s", VTY_NEWLINE);
10887 break;
10888 }
10889}
10890
10891/* VTY interface for community_set() function. */
paul94f2b392005-06-28 12:44:16 +000010892static int
paulfd79ac92004-10-13 05:06:08 +000010893community_list_set_vty (struct vty *vty, int argc, const char **argv,
10894 int style, int reject_all_digit_name)
paul718e3742002-12-13 20:15:29 +000010895{
10896 int ret;
10897 int direct;
10898 char *str;
10899
10900 /* Check the list type. */
10901 if (strncmp (argv[1], "p", 1) == 0)
10902 direct = COMMUNITY_PERMIT;
10903 else if (strncmp (argv[1], "d", 1) == 0)
10904 direct = COMMUNITY_DENY;
10905 else
10906 {
10907 vty_out (vty, "%% Matching condition must be permit or deny%s",
10908 VTY_NEWLINE);
10909 return CMD_WARNING;
10910 }
10911
10912 /* All digit name check. */
10913 if (reject_all_digit_name && all_digit (argv[0]))
10914 {
10915 vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE);
10916 return CMD_WARNING;
10917 }
10918
10919 /* Concat community string argument. */
10920 if (argc > 1)
10921 str = argv_concat (argv, argc, 2);
10922 else
10923 str = NULL;
10924
10925 /* When community_list_set() return nevetive value, it means
10926 malformed community string. */
10927 ret = community_list_set (bgp_clist, argv[0], str, direct, style);
10928
10929 /* Free temporary community list string allocated by
10930 argv_concat(). */
10931 if (str)
10932 XFREE (MTYPE_TMP, str);
10933
10934 if (ret < 0)
10935 {
10936 /* Display error string. */
10937 community_list_perror (vty, ret);
10938 return CMD_WARNING;
10939 }
10940
10941 return CMD_SUCCESS;
10942}
10943
paul718e3742002-12-13 20:15:29 +000010944/* Communiyt-list entry delete. */
paul94f2b392005-06-28 12:44:16 +000010945static int
hassofee6e4e2005-02-02 16:29:31 +000010946community_list_unset_vty (struct vty *vty, int argc, const char **argv,
10947 int style)
paul718e3742002-12-13 20:15:29 +000010948{
10949 int ret;
hassofee6e4e2005-02-02 16:29:31 +000010950 int direct = 0;
10951 char *str = NULL;
paul718e3742002-12-13 20:15:29 +000010952
hassofee6e4e2005-02-02 16:29:31 +000010953 if (argc > 1)
paul718e3742002-12-13 20:15:29 +000010954 {
hassofee6e4e2005-02-02 16:29:31 +000010955 /* Check the list direct. */
10956 if (strncmp (argv[1], "p", 1) == 0)
10957 direct = COMMUNITY_PERMIT;
10958 else if (strncmp (argv[1], "d", 1) == 0)
10959 direct = COMMUNITY_DENY;
10960 else
10961 {
10962 vty_out (vty, "%% Matching condition must be permit or deny%s",
10963 VTY_NEWLINE);
10964 return CMD_WARNING;
10965 }
paul718e3742002-12-13 20:15:29 +000010966
hassofee6e4e2005-02-02 16:29:31 +000010967 /* Concat community string argument. */
10968 str = argv_concat (argv, argc, 2);
10969 }
paul718e3742002-12-13 20:15:29 +000010970
10971 /* Unset community list. */
10972 ret = community_list_unset (bgp_clist, argv[0], str, direct, style);
10973
10974 /* Free temporary community list string allocated by
10975 argv_concat(). */
hassofee6e4e2005-02-02 16:29:31 +000010976 if (str)
10977 XFREE (MTYPE_TMP, str);
paul718e3742002-12-13 20:15:29 +000010978
10979 if (ret < 0)
10980 {
10981 community_list_perror (vty, ret);
10982 return CMD_WARNING;
10983 }
10984
10985 return CMD_SUCCESS;
10986}
10987
10988/* "community-list" keyword help string. */
10989#define COMMUNITY_LIST_STR "Add a community list entry\n"
10990#define COMMUNITY_VAL_STR "Community number in aa:nn format or internet|local-AS|no-advertise|no-export\n"
10991
paul718e3742002-12-13 20:15:29 +000010992DEFUN (ip_community_list_standard,
10993 ip_community_list_standard_cmd,
10994 "ip community-list <1-99> (deny|permit) .AA:NN",
10995 IP_STR
10996 COMMUNITY_LIST_STR
10997 "Community list number (standard)\n"
10998 "Specify community to reject\n"
10999 "Specify community to accept\n"
11000 COMMUNITY_VAL_STR)
11001{
11002 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0);
11003}
11004
11005ALIAS (ip_community_list_standard,
11006 ip_community_list_standard2_cmd,
11007 "ip community-list <1-99> (deny|permit)",
11008 IP_STR
11009 COMMUNITY_LIST_STR
11010 "Community list number (standard)\n"
11011 "Specify community to reject\n"
11012 "Specify community to accept\n")
11013
11014DEFUN (ip_community_list_expanded,
11015 ip_community_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000011016 "ip community-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000011017 IP_STR
11018 COMMUNITY_LIST_STR
11019 "Community list number (expanded)\n"
11020 "Specify community to reject\n"
11021 "Specify community to accept\n"
11022 "An ordered list as a regular-expression\n")
11023{
11024 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0);
11025}
11026
11027DEFUN (ip_community_list_name_standard,
11028 ip_community_list_name_standard_cmd,
11029 "ip community-list standard WORD (deny|permit) .AA:NN",
11030 IP_STR
11031 COMMUNITY_LIST_STR
11032 "Add a standard community-list entry\n"
11033 "Community list name\n"
11034 "Specify community to reject\n"
11035 "Specify community to accept\n"
11036 COMMUNITY_VAL_STR)
11037{
11038 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1);
11039}
11040
11041ALIAS (ip_community_list_name_standard,
11042 ip_community_list_name_standard2_cmd,
11043 "ip community-list standard WORD (deny|permit)",
11044 IP_STR
11045 COMMUNITY_LIST_STR
11046 "Add a standard community-list entry\n"
11047 "Community list name\n"
11048 "Specify community to reject\n"
11049 "Specify community to accept\n")
11050
11051DEFUN (ip_community_list_name_expanded,
11052 ip_community_list_name_expanded_cmd,
11053 "ip community-list expanded WORD (deny|permit) .LINE",
11054 IP_STR
11055 COMMUNITY_LIST_STR
11056 "Add an expanded community-list entry\n"
11057 "Community list name\n"
11058 "Specify community to reject\n"
11059 "Specify community to accept\n"
11060 "An ordered list as a regular-expression\n")
11061{
11062 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1);
11063}
11064
hassofee6e4e2005-02-02 16:29:31 +000011065DEFUN (no_ip_community_list_standard_all,
11066 no_ip_community_list_standard_all_cmd,
11067 "no ip community-list <1-99>",
paul718e3742002-12-13 20:15:29 +000011068 NO_STR
11069 IP_STR
11070 COMMUNITY_LIST_STR
hassofee6e4e2005-02-02 16:29:31 +000011071 "Community list number (standard)\n")
paul718e3742002-12-13 20:15:29 +000011072{
hassofee6e4e2005-02-02 16:29:31 +000011073 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
paul718e3742002-12-13 20:15:29 +000011074}
11075
hassofee6e4e2005-02-02 16:29:31 +000011076DEFUN (no_ip_community_list_expanded_all,
11077 no_ip_community_list_expanded_all_cmd,
11078 "no ip community-list <100-500>",
11079 NO_STR
11080 IP_STR
11081 COMMUNITY_LIST_STR
11082 "Community list number (expanded)\n")
11083{
11084 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
11085}
11086
11087DEFUN (no_ip_community_list_name_standard_all,
11088 no_ip_community_list_name_standard_all_cmd,
11089 "no ip community-list standard WORD",
paul718e3742002-12-13 20:15:29 +000011090 NO_STR
11091 IP_STR
11092 COMMUNITY_LIST_STR
11093 "Add a standard community-list entry\n"
paul718e3742002-12-13 20:15:29 +000011094 "Community list name\n")
11095{
hassofee6e4e2005-02-02 16:29:31 +000011096 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
paul718e3742002-12-13 20:15:29 +000011097}
11098
hassofee6e4e2005-02-02 16:29:31 +000011099DEFUN (no_ip_community_list_name_expanded_all,
11100 no_ip_community_list_name_expanded_all_cmd,
11101 "no ip community-list expanded WORD",
paul718e3742002-12-13 20:15:29 +000011102 NO_STR
11103 IP_STR
11104 COMMUNITY_LIST_STR
hassofee6e4e2005-02-02 16:29:31 +000011105 "Add an expanded community-list entry\n"
11106 "Community list name\n")
paul718e3742002-12-13 20:15:29 +000011107{
hassofee6e4e2005-02-02 16:29:31 +000011108 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
paul718e3742002-12-13 20:15:29 +000011109}
11110
11111DEFUN (no_ip_community_list_standard,
11112 no_ip_community_list_standard_cmd,
11113 "no ip community-list <1-99> (deny|permit) .AA:NN",
11114 NO_STR
11115 IP_STR
11116 COMMUNITY_LIST_STR
11117 "Community list number (standard)\n"
11118 "Specify community to reject\n"
11119 "Specify community to accept\n"
11120 COMMUNITY_VAL_STR)
11121{
11122 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
11123}
11124
11125DEFUN (no_ip_community_list_expanded,
11126 no_ip_community_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000011127 "no ip community-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000011128 NO_STR
11129 IP_STR
11130 COMMUNITY_LIST_STR
11131 "Community list number (expanded)\n"
11132 "Specify community to reject\n"
11133 "Specify community to accept\n"
11134 "An ordered list as a regular-expression\n")
11135{
11136 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
11137}
11138
11139DEFUN (no_ip_community_list_name_standard,
11140 no_ip_community_list_name_standard_cmd,
11141 "no ip community-list standard WORD (deny|permit) .AA:NN",
11142 NO_STR
11143 IP_STR
11144 COMMUNITY_LIST_STR
11145 "Specify a standard community-list\n"
11146 "Community list name\n"
11147 "Specify community to reject\n"
11148 "Specify community to accept\n"
11149 COMMUNITY_VAL_STR)
11150{
11151 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
11152}
11153
11154DEFUN (no_ip_community_list_name_expanded,
11155 no_ip_community_list_name_expanded_cmd,
11156 "no ip community-list expanded WORD (deny|permit) .LINE",
11157 NO_STR
11158 IP_STR
11159 COMMUNITY_LIST_STR
11160 "Specify an expanded community-list\n"
11161 "Community list name\n"
11162 "Specify community to reject\n"
11163 "Specify community to accept\n"
11164 "An ordered list as a regular-expression\n")
11165{
11166 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
11167}
11168
paul94f2b392005-06-28 12:44:16 +000011169static void
paul718e3742002-12-13 20:15:29 +000011170community_list_show (struct vty *vty, struct community_list *list)
11171{
11172 struct community_entry *entry;
11173
11174 for (entry = list->head; entry; entry = entry->next)
11175 {
11176 if (entry == list->head)
11177 {
11178 if (all_digit (list->name))
11179 vty_out (vty, "Community %s list %s%s",
11180 entry->style == COMMUNITY_LIST_STANDARD ?
11181 "standard" : "(expanded) access",
11182 list->name, VTY_NEWLINE);
11183 else
11184 vty_out (vty, "Named Community %s list %s%s",
11185 entry->style == COMMUNITY_LIST_STANDARD ?
11186 "standard" : "expanded",
11187 list->name, VTY_NEWLINE);
11188 }
11189 if (entry->any)
11190 vty_out (vty, " %s%s",
11191 community_direct_str (entry->direct), VTY_NEWLINE);
11192 else
11193 vty_out (vty, " %s %s%s",
11194 community_direct_str (entry->direct),
11195 entry->style == COMMUNITY_LIST_STANDARD
11196 ? community_str (entry->u.com) : entry->config,
11197 VTY_NEWLINE);
11198 }
11199}
11200
11201DEFUN (show_ip_community_list,
11202 show_ip_community_list_cmd,
11203 "show ip community-list",
11204 SHOW_STR
11205 IP_STR
11206 "List community-list\n")
11207{
11208 struct community_list *list;
11209 struct community_list_master *cm;
11210
hassofee6e4e2005-02-02 16:29:31 +000011211 cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011212 if (! cm)
11213 return CMD_SUCCESS;
11214
11215 for (list = cm->num.head; list; list = list->next)
11216 community_list_show (vty, list);
11217
11218 for (list = cm->str.head; list; list = list->next)
11219 community_list_show (vty, list);
11220
11221 return CMD_SUCCESS;
11222}
11223
11224DEFUN (show_ip_community_list_arg,
11225 show_ip_community_list_arg_cmd,
hassofee6e4e2005-02-02 16:29:31 +000011226 "show ip community-list (<1-500>|WORD)",
paul718e3742002-12-13 20:15:29 +000011227 SHOW_STR
11228 IP_STR
11229 "List community-list\n"
11230 "Community-list number\n"
11231 "Community-list name\n")
11232{
11233 struct community_list *list;
11234
hassofee6e4e2005-02-02 16:29:31 +000011235 list = community_list_lookup (bgp_clist, argv[0], COMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011236 if (! list)
11237 {
Denis Ovsienkob7292942010-12-08 18:51:37 +030011238 vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000011239 return CMD_WARNING;
11240 }
11241
11242 community_list_show (vty, list);
11243
11244 return CMD_SUCCESS;
11245}
David Lamparter6b0655a2014-06-04 06:53:35 +020011246
paul94f2b392005-06-28 12:44:16 +000011247static int
paulfd79ac92004-10-13 05:06:08 +000011248extcommunity_list_set_vty (struct vty *vty, int argc, const char **argv,
11249 int style, int reject_all_digit_name)
paul718e3742002-12-13 20:15:29 +000011250{
11251 int ret;
11252 int direct;
11253 char *str;
11254
11255 /* Check the list type. */
11256 if (strncmp (argv[1], "p", 1) == 0)
11257 direct = COMMUNITY_PERMIT;
11258 else if (strncmp (argv[1], "d", 1) == 0)
11259 direct = COMMUNITY_DENY;
11260 else
11261 {
11262 vty_out (vty, "%% Matching condition must be permit or deny%s",
11263 VTY_NEWLINE);
11264 return CMD_WARNING;
11265 }
11266
11267 /* All digit name check. */
11268 if (reject_all_digit_name && all_digit (argv[0]))
11269 {
11270 vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE);
11271 return CMD_WARNING;
11272 }
11273
11274 /* Concat community string argument. */
11275 if (argc > 1)
11276 str = argv_concat (argv, argc, 2);
11277 else
11278 str = NULL;
11279
11280 ret = extcommunity_list_set (bgp_clist, argv[0], str, direct, style);
11281
11282 /* Free temporary community list string allocated by
11283 argv_concat(). */
11284 if (str)
11285 XFREE (MTYPE_TMP, str);
11286
11287 if (ret < 0)
11288 {
11289 community_list_perror (vty, ret);
11290 return CMD_WARNING;
11291 }
11292 return CMD_SUCCESS;
11293}
11294
paul94f2b392005-06-28 12:44:16 +000011295static int
hassofee6e4e2005-02-02 16:29:31 +000011296extcommunity_list_unset_vty (struct vty *vty, int argc, const char **argv,
11297 int style)
paul718e3742002-12-13 20:15:29 +000011298{
11299 int ret;
hassofee6e4e2005-02-02 16:29:31 +000011300 int direct = 0;
11301 char *str = NULL;
paul718e3742002-12-13 20:15:29 +000011302
hassofee6e4e2005-02-02 16:29:31 +000011303 if (argc > 1)
paul718e3742002-12-13 20:15:29 +000011304 {
hassofee6e4e2005-02-02 16:29:31 +000011305 /* Check the list direct. */
11306 if (strncmp (argv[1], "p", 1) == 0)
11307 direct = COMMUNITY_PERMIT;
11308 else if (strncmp (argv[1], "d", 1) == 0)
11309 direct = COMMUNITY_DENY;
11310 else
11311 {
11312 vty_out (vty, "%% Matching condition must be permit or deny%s",
11313 VTY_NEWLINE);
11314 return CMD_WARNING;
11315 }
11316
11317 /* Concat community string argument. */
11318 str = argv_concat (argv, argc, 2);
paul718e3742002-12-13 20:15:29 +000011319 }
paul718e3742002-12-13 20:15:29 +000011320
11321 /* Unset community list. */
11322 ret = extcommunity_list_unset (bgp_clist, argv[0], str, direct, style);
11323
11324 /* Free temporary community list string allocated by
11325 argv_concat(). */
hassofee6e4e2005-02-02 16:29:31 +000011326 if (str)
11327 XFREE (MTYPE_TMP, str);
paul718e3742002-12-13 20:15:29 +000011328
11329 if (ret < 0)
11330 {
11331 community_list_perror (vty, ret);
11332 return CMD_WARNING;
11333 }
11334
11335 return CMD_SUCCESS;
11336}
11337
11338/* "extcommunity-list" keyword help string. */
11339#define EXTCOMMUNITY_LIST_STR "Add a extended community list entry\n"
11340#define EXTCOMMUNITY_VAL_STR "Extended community attribute in 'rt aa:nn_or_IPaddr:nn' OR 'soo aa:nn_or_IPaddr:nn' format\n"
11341
11342DEFUN (ip_extcommunity_list_standard,
11343 ip_extcommunity_list_standard_cmd,
11344 "ip extcommunity-list <1-99> (deny|permit) .AA:NN",
11345 IP_STR
11346 EXTCOMMUNITY_LIST_STR
11347 "Extended Community list number (standard)\n"
11348 "Specify community to reject\n"
11349 "Specify community to accept\n"
11350 EXTCOMMUNITY_VAL_STR)
11351{
11352 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0);
11353}
11354
11355ALIAS (ip_extcommunity_list_standard,
11356 ip_extcommunity_list_standard2_cmd,
11357 "ip extcommunity-list <1-99> (deny|permit)",
11358 IP_STR
11359 EXTCOMMUNITY_LIST_STR
11360 "Extended Community list number (standard)\n"
11361 "Specify community to reject\n"
11362 "Specify community to accept\n")
11363
11364DEFUN (ip_extcommunity_list_expanded,
11365 ip_extcommunity_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000011366 "ip extcommunity-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000011367 IP_STR
11368 EXTCOMMUNITY_LIST_STR
11369 "Extended Community list number (expanded)\n"
11370 "Specify community to reject\n"
11371 "Specify community to accept\n"
11372 "An ordered list as a regular-expression\n")
11373{
11374 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0);
11375}
11376
11377DEFUN (ip_extcommunity_list_name_standard,
11378 ip_extcommunity_list_name_standard_cmd,
11379 "ip extcommunity-list standard WORD (deny|permit) .AA:NN",
11380 IP_STR
11381 EXTCOMMUNITY_LIST_STR
11382 "Specify standard extcommunity-list\n"
11383 "Extended Community list name\n"
11384 "Specify community to reject\n"
11385 "Specify community to accept\n"
11386 EXTCOMMUNITY_VAL_STR)
11387{
11388 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1);
11389}
11390
11391ALIAS (ip_extcommunity_list_name_standard,
11392 ip_extcommunity_list_name_standard2_cmd,
11393 "ip extcommunity-list standard WORD (deny|permit)",
11394 IP_STR
11395 EXTCOMMUNITY_LIST_STR
11396 "Specify standard extcommunity-list\n"
11397 "Extended Community list name\n"
11398 "Specify community to reject\n"
11399 "Specify community to accept\n")
11400
11401DEFUN (ip_extcommunity_list_name_expanded,
11402 ip_extcommunity_list_name_expanded_cmd,
11403 "ip extcommunity-list expanded WORD (deny|permit) .LINE",
11404 IP_STR
11405 EXTCOMMUNITY_LIST_STR
11406 "Specify expanded extcommunity-list\n"
11407 "Extended Community list name\n"
11408 "Specify community to reject\n"
11409 "Specify community to accept\n"
11410 "An ordered list as a regular-expression\n")
11411{
11412 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1);
11413}
11414
hassofee6e4e2005-02-02 16:29:31 +000011415DEFUN (no_ip_extcommunity_list_standard_all,
11416 no_ip_extcommunity_list_standard_all_cmd,
11417 "no ip extcommunity-list <1-99>",
paul718e3742002-12-13 20:15:29 +000011418 NO_STR
11419 IP_STR
11420 EXTCOMMUNITY_LIST_STR
hassofee6e4e2005-02-02 16:29:31 +000011421 "Extended Community list number (standard)\n")
paul718e3742002-12-13 20:15:29 +000011422{
hassofee6e4e2005-02-02 16:29:31 +000011423 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
paul718e3742002-12-13 20:15:29 +000011424}
11425
hassofee6e4e2005-02-02 16:29:31 +000011426DEFUN (no_ip_extcommunity_list_expanded_all,
11427 no_ip_extcommunity_list_expanded_all_cmd,
11428 "no ip extcommunity-list <100-500>",
11429 NO_STR
11430 IP_STR
11431 EXTCOMMUNITY_LIST_STR
11432 "Extended Community list number (expanded)\n")
11433{
11434 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
11435}
11436
11437DEFUN (no_ip_extcommunity_list_name_standard_all,
11438 no_ip_extcommunity_list_name_standard_all_cmd,
11439 "no ip extcommunity-list standard WORD",
paul718e3742002-12-13 20:15:29 +000011440 NO_STR
11441 IP_STR
11442 EXTCOMMUNITY_LIST_STR
11443 "Specify standard extcommunity-list\n"
hassofee6e4e2005-02-02 16:29:31 +000011444 "Extended Community list name\n")
11445{
11446 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
11447}
11448
11449DEFUN (no_ip_extcommunity_list_name_expanded_all,
11450 no_ip_extcommunity_list_name_expanded_all_cmd,
11451 "no ip extcommunity-list expanded WORD",
11452 NO_STR
11453 IP_STR
11454 EXTCOMMUNITY_LIST_STR
paul718e3742002-12-13 20:15:29 +000011455 "Specify expanded extcommunity-list\n"
11456 "Extended Community list name\n")
11457{
hassofee6e4e2005-02-02 16:29:31 +000011458 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
paul718e3742002-12-13 20:15:29 +000011459}
11460
11461DEFUN (no_ip_extcommunity_list_standard,
11462 no_ip_extcommunity_list_standard_cmd,
11463 "no ip extcommunity-list <1-99> (deny|permit) .AA:NN",
11464 NO_STR
11465 IP_STR
11466 EXTCOMMUNITY_LIST_STR
11467 "Extended Community list number (standard)\n"
11468 "Specify community to reject\n"
11469 "Specify community to accept\n"
11470 EXTCOMMUNITY_VAL_STR)
11471{
11472 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
11473}
11474
11475DEFUN (no_ip_extcommunity_list_expanded,
11476 no_ip_extcommunity_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000011477 "no ip extcommunity-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000011478 NO_STR
11479 IP_STR
11480 EXTCOMMUNITY_LIST_STR
11481 "Extended Community list number (expanded)\n"
11482 "Specify community to reject\n"
11483 "Specify community to accept\n"
11484 "An ordered list as a regular-expression\n")
11485{
11486 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
11487}
11488
11489DEFUN (no_ip_extcommunity_list_name_standard,
11490 no_ip_extcommunity_list_name_standard_cmd,
11491 "no ip extcommunity-list standard WORD (deny|permit) .AA:NN",
11492 NO_STR
11493 IP_STR
11494 EXTCOMMUNITY_LIST_STR
11495 "Specify standard extcommunity-list\n"
11496 "Extended Community list name\n"
11497 "Specify community to reject\n"
11498 "Specify community to accept\n"
11499 EXTCOMMUNITY_VAL_STR)
11500{
11501 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
11502}
11503
11504DEFUN (no_ip_extcommunity_list_name_expanded,
11505 no_ip_extcommunity_list_name_expanded_cmd,
11506 "no ip extcommunity-list expanded WORD (deny|permit) .LINE",
11507 NO_STR
11508 IP_STR
11509 EXTCOMMUNITY_LIST_STR
11510 "Specify expanded extcommunity-list\n"
11511 "Community list name\n"
11512 "Specify community to reject\n"
11513 "Specify community to accept\n"
11514 "An ordered list as a regular-expression\n")
11515{
11516 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
11517}
11518
paul94f2b392005-06-28 12:44:16 +000011519static void
paul718e3742002-12-13 20:15:29 +000011520extcommunity_list_show (struct vty *vty, struct community_list *list)
11521{
11522 struct community_entry *entry;
11523
11524 for (entry = list->head; entry; entry = entry->next)
11525 {
11526 if (entry == list->head)
11527 {
11528 if (all_digit (list->name))
11529 vty_out (vty, "Extended community %s list %s%s",
11530 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
11531 "standard" : "(expanded) access",
11532 list->name, VTY_NEWLINE);
11533 else
11534 vty_out (vty, "Named extended community %s list %s%s",
11535 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
11536 "standard" : "expanded",
11537 list->name, VTY_NEWLINE);
11538 }
11539 if (entry->any)
11540 vty_out (vty, " %s%s",
11541 community_direct_str (entry->direct), VTY_NEWLINE);
11542 else
11543 vty_out (vty, " %s %s%s",
11544 community_direct_str (entry->direct),
11545 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
11546 entry->u.ecom->str : entry->config,
11547 VTY_NEWLINE);
11548 }
11549}
11550
11551DEFUN (show_ip_extcommunity_list,
11552 show_ip_extcommunity_list_cmd,
11553 "show ip extcommunity-list",
11554 SHOW_STR
11555 IP_STR
11556 "List extended-community list\n")
11557{
11558 struct community_list *list;
11559 struct community_list_master *cm;
11560
hassofee6e4e2005-02-02 16:29:31 +000011561 cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011562 if (! cm)
11563 return CMD_SUCCESS;
11564
11565 for (list = cm->num.head; list; list = list->next)
11566 extcommunity_list_show (vty, list);
11567
11568 for (list = cm->str.head; list; list = list->next)
11569 extcommunity_list_show (vty, list);
11570
11571 return CMD_SUCCESS;
11572}
11573
11574DEFUN (show_ip_extcommunity_list_arg,
11575 show_ip_extcommunity_list_arg_cmd,
hassofee6e4e2005-02-02 16:29:31 +000011576 "show ip extcommunity-list (<1-500>|WORD)",
paul718e3742002-12-13 20:15:29 +000011577 SHOW_STR
11578 IP_STR
11579 "List extended-community list\n"
11580 "Extcommunity-list number\n"
11581 "Extcommunity-list name\n")
11582{
11583 struct community_list *list;
11584
hassofee6e4e2005-02-02 16:29:31 +000011585 list = community_list_lookup (bgp_clist, argv[0], EXTCOMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011586 if (! list)
11587 {
Denis Ovsienkob7292942010-12-08 18:51:37 +030011588 vty_out (vty, "%% Can't find extcommunity-list%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000011589 return CMD_WARNING;
11590 }
11591
11592 extcommunity_list_show (vty, list);
11593
11594 return CMD_SUCCESS;
11595}
David Lamparter6b0655a2014-06-04 06:53:35 +020011596
paul718e3742002-12-13 20:15:29 +000011597/* Return configuration string of community-list entry. */
paulfd79ac92004-10-13 05:06:08 +000011598static const char *
paul718e3742002-12-13 20:15:29 +000011599community_list_config_str (struct community_entry *entry)
11600{
paulfd79ac92004-10-13 05:06:08 +000011601 const char *str;
paul718e3742002-12-13 20:15:29 +000011602
11603 if (entry->any)
11604 str = "";
11605 else
11606 {
11607 if (entry->style == COMMUNITY_LIST_STANDARD)
11608 str = community_str (entry->u.com);
11609 else
11610 str = entry->config;
11611 }
11612 return str;
11613}
11614
11615/* Display community-list and extcommunity-list configuration. */
paul94f2b392005-06-28 12:44:16 +000011616static int
paul718e3742002-12-13 20:15:29 +000011617community_list_config_write (struct vty *vty)
11618{
11619 struct community_list *list;
11620 struct community_entry *entry;
11621 struct community_list_master *cm;
11622 int write = 0;
11623
11624 /* Community-list. */
hassofee6e4e2005-02-02 16:29:31 +000011625 cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011626
11627 for (list = cm->num.head; list; list = list->next)
11628 for (entry = list->head; entry; entry = entry->next)
11629 {
hassofee6e4e2005-02-02 16:29:31 +000011630 vty_out (vty, "ip community-list %s %s %s%s",
11631 list->name, community_direct_str (entry->direct),
11632 community_list_config_str (entry),
11633 VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000011634 write++;
11635 }
11636 for (list = cm->str.head; list; list = list->next)
11637 for (entry = list->head; entry; entry = entry->next)
11638 {
11639 vty_out (vty, "ip community-list %s %s %s %s%s",
11640 entry->style == COMMUNITY_LIST_STANDARD
11641 ? "standard" : "expanded",
11642 list->name, community_direct_str (entry->direct),
11643 community_list_config_str (entry),
11644 VTY_NEWLINE);
11645 write++;
11646 }
11647
11648 /* Extcommunity-list. */
hassofee6e4e2005-02-02 16:29:31 +000011649 cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011650
11651 for (list = cm->num.head; list; list = list->next)
11652 for (entry = list->head; entry; entry = entry->next)
11653 {
hassofee6e4e2005-02-02 16:29:31 +000011654 vty_out (vty, "ip extcommunity-list %s %s %s%s",
11655 list->name, community_direct_str (entry->direct),
11656 community_list_config_str (entry), VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000011657 write++;
11658 }
11659 for (list = cm->str.head; list; list = list->next)
11660 for (entry = list->head; entry; entry = entry->next)
11661 {
11662 vty_out (vty, "ip extcommunity-list %s %s %s %s%s",
11663 entry->style == EXTCOMMUNITY_LIST_STANDARD
11664 ? "standard" : "expanded",
11665 list->name, community_direct_str (entry->direct),
11666 community_list_config_str (entry), VTY_NEWLINE);
11667 write++;
11668 }
11669 return write;
11670}
11671
Stephen Hemminger7fc626d2008-12-01 11:10:34 -080011672static struct cmd_node community_list_node =
paul718e3742002-12-13 20:15:29 +000011673{
11674 COMMUNITY_LIST_NODE,
11675 "",
11676 1 /* Export to vtysh. */
11677};
11678
paul94f2b392005-06-28 12:44:16 +000011679static void
11680community_list_vty (void)
paul718e3742002-12-13 20:15:29 +000011681{
11682 install_node (&community_list_node, community_list_config_write);
11683
11684 /* Community-list. */
paul718e3742002-12-13 20:15:29 +000011685 install_element (CONFIG_NODE, &ip_community_list_standard_cmd);
11686 install_element (CONFIG_NODE, &ip_community_list_standard2_cmd);
11687 install_element (CONFIG_NODE, &ip_community_list_expanded_cmd);
11688 install_element (CONFIG_NODE, &ip_community_list_name_standard_cmd);
11689 install_element (CONFIG_NODE, &ip_community_list_name_standard2_cmd);
11690 install_element (CONFIG_NODE, &ip_community_list_name_expanded_cmd);
hassofee6e4e2005-02-02 16:29:31 +000011691 install_element (CONFIG_NODE, &no_ip_community_list_standard_all_cmd);
11692 install_element (CONFIG_NODE, &no_ip_community_list_expanded_all_cmd);
11693 install_element (CONFIG_NODE, &no_ip_community_list_name_standard_all_cmd);
11694 install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_all_cmd);
paul718e3742002-12-13 20:15:29 +000011695 install_element (CONFIG_NODE, &no_ip_community_list_standard_cmd);
11696 install_element (CONFIG_NODE, &no_ip_community_list_expanded_cmd);
11697 install_element (CONFIG_NODE, &no_ip_community_list_name_standard_cmd);
11698 install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_cmd);
11699 install_element (VIEW_NODE, &show_ip_community_list_cmd);
11700 install_element (VIEW_NODE, &show_ip_community_list_arg_cmd);
11701 install_element (ENABLE_NODE, &show_ip_community_list_cmd);
11702 install_element (ENABLE_NODE, &show_ip_community_list_arg_cmd);
11703
11704 /* Extcommunity-list. */
11705 install_element (CONFIG_NODE, &ip_extcommunity_list_standard_cmd);
11706 install_element (CONFIG_NODE, &ip_extcommunity_list_standard2_cmd);
11707 install_element (CONFIG_NODE, &ip_extcommunity_list_expanded_cmd);
11708 install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard_cmd);
11709 install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard2_cmd);
11710 install_element (CONFIG_NODE, &ip_extcommunity_list_name_expanded_cmd);
hassofee6e4e2005-02-02 16:29:31 +000011711 install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_all_cmd);
11712 install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_all_cmd);
11713 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_all_cmd);
11714 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_all_cmd);
paul718e3742002-12-13 20:15:29 +000011715 install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_cmd);
11716 install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_cmd);
11717 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_cmd);
11718 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_cmd);
11719 install_element (VIEW_NODE, &show_ip_extcommunity_list_cmd);
11720 install_element (VIEW_NODE, &show_ip_extcommunity_list_arg_cmd);
11721 install_element (ENABLE_NODE, &show_ip_extcommunity_list_cmd);
11722 install_element (ENABLE_NODE, &show_ip_extcommunity_list_arg_cmd);
11723}