blob: 041a6a1fad0d1052e225499e7e554dbce48bd94a [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 Berger13c378d2016-01-12 13:41:56 -050060 switch (vty->node)
61 {
62 case BGP_IPV6_NODE:
63 case BGP_IPV6M_NODE:
64 case BGP_VPNV6_NODE:
65 return AFI_IP6;
66 break;
67 }
68
paul718e3742002-12-13 20:15:29 +000069 return AFI_IP;
70}
71
72/* Utility function to get subsequent address family from current
73 node. */
74safi_t
75bgp_node_safi (struct vty *vty)
76{
Lou Berger13c378d2016-01-12 13:41:56 -050077 if (vty->node == BGP_VPNV6_NODE)
78 return SAFI_MPLS_VPN;
paul718e3742002-12-13 20:15:29 +000079 if (vty->node == BGP_VPNV4_NODE)
80 return SAFI_MPLS_VPN;
paul25ffbdc2005-08-22 22:42:08 +000081 if (vty->node == BGP_IPV4M_NODE || vty->node == BGP_IPV6M_NODE)
paul718e3742002-12-13 20:15:29 +000082 return SAFI_MULTICAST;
83 return SAFI_UNICAST;
84}
85
paul94f2b392005-06-28 12:44:16 +000086static int
paul718e3742002-12-13 20:15:29 +000087peer_address_self_check (union sockunion *su)
88{
89 struct interface *ifp = NULL;
90
91 if (su->sa.sa_family == AF_INET)
92 ifp = if_lookup_by_ipv4_exact (&su->sin.sin_addr);
93#ifdef HAVE_IPV6
94 else if (su->sa.sa_family == AF_INET6)
95 ifp = if_lookup_by_ipv6_exact (&su->sin6.sin6_addr);
96#endif /* HAVE IPV6 */
97
98 if (ifp)
99 return 1;
100
101 return 0;
102}
103
104/* Utility function for looking up peer from VTY. */
paul94f2b392005-06-28 12:44:16 +0000105static struct peer *
paulfd79ac92004-10-13 05:06:08 +0000106peer_lookup_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +0000107{
108 int ret;
109 struct bgp *bgp;
110 union sockunion su;
111 struct peer *peer;
112
113 bgp = vty->index;
114
115 ret = str2sockunion (ip_str, &su);
116 if (ret < 0)
117 {
118 vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE);
119 return NULL;
120 }
121
122 peer = peer_lookup (bgp, &su);
123 if (! peer)
124 {
125 vty_out (vty, "%% Specify remote-as or peer-group commands first%s", VTY_NEWLINE);
126 return NULL;
127 }
128 return peer;
129}
130
131/* Utility function for looking up peer or peer group. */
paul94f2b392005-06-28 12:44:16 +0000132static struct peer *
paulfd79ac92004-10-13 05:06:08 +0000133peer_and_group_lookup_vty (struct vty *vty, const char *peer_str)
paul718e3742002-12-13 20:15:29 +0000134{
135 int ret;
136 struct bgp *bgp;
137 union sockunion su;
138 struct peer *peer;
139 struct peer_group *group;
140
141 bgp = vty->index;
142
143 ret = str2sockunion (peer_str, &su);
144 if (ret == 0)
145 {
146 peer = peer_lookup (bgp, &su);
147 if (peer)
148 return peer;
149 }
150 else
151 {
152 group = peer_group_lookup (bgp, peer_str);
153 if (group)
154 return group->conf;
155 }
156
157 vty_out (vty, "%% Specify remote-as or peer-group commands first%s",
158 VTY_NEWLINE);
159
160 return NULL;
161}
162
paul94f2b392005-06-28 12:44:16 +0000163static int
paul718e3742002-12-13 20:15:29 +0000164bgp_vty_return (struct vty *vty, int ret)
165{
paulfd79ac92004-10-13 05:06:08 +0000166 const char *str = NULL;
paul718e3742002-12-13 20:15:29 +0000167
168 switch (ret)
169 {
170 case BGP_ERR_INVALID_VALUE:
171 str = "Invalid value";
172 break;
173 case BGP_ERR_INVALID_FLAG:
174 str = "Invalid flag";
175 break;
176 case BGP_ERR_PEER_INACTIVE:
177 str = "Activate the neighbor for the address family first";
178 break;
179 case BGP_ERR_INVALID_FOR_PEER_GROUP_MEMBER:
180 str = "Invalid command for a peer-group member";
181 break;
182 case BGP_ERR_PEER_GROUP_SHUTDOWN:
183 str = "Peer-group has been shutdown. Activate the peer-group first";
184 break;
185 case BGP_ERR_PEER_GROUP_HAS_THE_FLAG:
186 str = "This peer is a peer-group member. Please change peer-group configuration";
187 break;
188 case BGP_ERR_PEER_FLAG_CONFLICT:
189 str = "Can't set override-capability and strict-capability-match at the same time";
190 break;
191 case BGP_ERR_PEER_GROUP_MEMBER_EXISTS:
192 str = "No activate for peergroup can be given only if peer-group has no members";
193 break;
194 case BGP_ERR_PEER_BELONGS_TO_GROUP:
195 str = "No activate for an individual peer-group member is invalid";
196 break;
197 case BGP_ERR_PEER_GROUP_AF_UNCONFIGURED:
198 str = "Activate the peer-group for the address family first";
199 break;
200 case BGP_ERR_PEER_GROUP_NO_REMOTE_AS:
201 str = "Specify remote-as or peer-group remote AS first";
202 break;
203 case BGP_ERR_PEER_GROUP_CANT_CHANGE:
204 str = "Cannot change the peer-group. Deconfigure first";
205 break;
206 case BGP_ERR_PEER_GROUP_MISMATCH:
207 str = "Cannot have different peer-group for the neighbor";
208 break;
209 case BGP_ERR_PEER_FILTER_CONFLICT:
210 str = "Prefix/distribute list can not co-exist";
211 break;
212 case BGP_ERR_NOT_INTERNAL_PEER:
213 str = "Invalid command. Not an internal neighbor";
214 break;
215 case BGP_ERR_REMOVE_PRIVATE_AS:
216 str = "Private AS cannot be removed for IBGP peers";
217 break;
218 case BGP_ERR_LOCAL_AS_ALLOWED_ONLY_FOR_EBGP:
219 str = "Local-AS allowed only for EBGP peers";
220 break;
221 case BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS:
222 str = "Cannot have local-as same as BGP AS number";
223 break;
Paul Jakma0df7c912008-07-21 21:02:49 +0000224 case BGP_ERR_TCPSIG_FAILED:
225 str = "Error while applying TCP-Sig to session(s)";
226 break;
Nick Hilliardfa411a22011-03-23 15:33:17 +0000227 case BGP_ERR_NO_EBGP_MULTIHOP_WITH_TTLHACK:
228 str = "ebgp-multihop and ttl-security cannot be configured together";
229 break;
Stephen Hemmingerf5a48272011-03-24 17:30:21 +0000230 case BGP_ERR_NO_IBGP_WITH_TTLHACK:
231 str = "ttl-security only allowed for EBGP peers";
232 break;
paul718e3742002-12-13 20:15:29 +0000233 }
234 if (str)
235 {
236 vty_out (vty, "%% %s%s", str, VTY_NEWLINE);
237 return CMD_WARNING;
238 }
239 return CMD_SUCCESS;
240}
241
242/* BGP global configuration. */
243
244DEFUN (bgp_multiple_instance_func,
245 bgp_multiple_instance_cmd,
246 "bgp multiple-instance",
247 BGP_STR
248 "Enable bgp multiple instance\n")
249{
250 bgp_option_set (BGP_OPT_MULTIPLE_INSTANCE);
251 return CMD_SUCCESS;
252}
253
254DEFUN (no_bgp_multiple_instance,
255 no_bgp_multiple_instance_cmd,
256 "no bgp multiple-instance",
257 NO_STR
258 BGP_STR
259 "BGP multiple instance\n")
260{
261 int ret;
262
263 ret = bgp_option_unset (BGP_OPT_MULTIPLE_INSTANCE);
264 if (ret < 0)
265 {
266 vty_out (vty, "%% There are more than two BGP instances%s", VTY_NEWLINE);
267 return CMD_WARNING;
268 }
269 return CMD_SUCCESS;
270}
271
272DEFUN (bgp_config_type,
273 bgp_config_type_cmd,
274 "bgp config-type (cisco|zebra)",
275 BGP_STR
276 "Configuration type\n"
277 "cisco\n"
278 "zebra\n")
279{
280 if (strncmp (argv[0], "c", 1) == 0)
281 bgp_option_set (BGP_OPT_CONFIG_CISCO);
282 else
283 bgp_option_unset (BGP_OPT_CONFIG_CISCO);
284
285 return CMD_SUCCESS;
286}
287
288DEFUN (no_bgp_config_type,
289 no_bgp_config_type_cmd,
290 "no bgp config-type",
291 NO_STR
292 BGP_STR
293 "Display configuration type\n")
294{
295 bgp_option_unset (BGP_OPT_CONFIG_CISCO);
296 return CMD_SUCCESS;
297}
298
299DEFUN (no_synchronization,
300 no_synchronization_cmd,
301 "no synchronization",
302 NO_STR
303 "Perform IGP synchronization\n")
304{
305 return CMD_SUCCESS;
306}
307
308DEFUN (no_auto_summary,
309 no_auto_summary_cmd,
310 "no auto-summary",
311 NO_STR
312 "Enable automatic network number summarization\n")
313{
314 return CMD_SUCCESS;
315}
hasso3d515fd2005-02-01 21:30:04 +0000316
317DEFUN_DEPRECATED (neighbor_version,
318 neighbor_version_cmd,
319 NEIGHBOR_CMD "version (4|4-)",
320 NEIGHBOR_STR
321 NEIGHBOR_ADDR_STR
322 "Set the BGP version to match a neighbor\n"
323 "Neighbor's BGP version\n")
324{
325 return CMD_SUCCESS;
326}
David Lamparter6b0655a2014-06-04 06:53:35 +0200327
paul718e3742002-12-13 20:15:29 +0000328/* "router bgp" commands. */
329DEFUN (router_bgp,
330 router_bgp_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000331 "router bgp " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000332 ROUTER_STR
333 BGP_STR
334 AS_STR)
335{
336 int ret;
337 as_t as;
338 struct bgp *bgp;
paulfd79ac92004-10-13 05:06:08 +0000339 const char *name = NULL;
paul718e3742002-12-13 20:15:29 +0000340
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000341 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +0000342
343 if (argc == 2)
344 name = argv[1];
345
346 ret = bgp_get (&bgp, &as, name);
347 switch (ret)
348 {
349 case BGP_ERR_MULTIPLE_INSTANCE_NOT_SET:
350 vty_out (vty, "Please specify 'bgp multiple-instance' first%s",
351 VTY_NEWLINE);
352 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +0000353 case BGP_ERR_AS_MISMATCH:
Denis Ovsienkoaea339f2009-04-30 17:16:22 +0400354 vty_out (vty, "BGP is already running; AS is %u%s", as, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +0000355 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +0000356 case BGP_ERR_INSTANCE_MISMATCH:
357 vty_out (vty, "BGP view name and AS number mismatch%s", VTY_NEWLINE);
Denis Ovsienkoaea339f2009-04-30 17:16:22 +0400358 vty_out (vty, "BGP instance is already running; AS is %u%s",
paul718e3742002-12-13 20:15:29 +0000359 as, VTY_NEWLINE);
360 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +0000361 }
362
363 vty->node = BGP_NODE;
364 vty->index = bgp;
365
366 return CMD_SUCCESS;
367}
368
369ALIAS (router_bgp,
370 router_bgp_view_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000371 "router bgp " CMD_AS_RANGE " view WORD",
paul718e3742002-12-13 20:15:29 +0000372 ROUTER_STR
373 BGP_STR
374 AS_STR
375 "BGP view\n"
376 "view name\n")
David Lamparter6b0655a2014-06-04 06:53:35 +0200377
paul718e3742002-12-13 20:15:29 +0000378/* "no router bgp" commands. */
379DEFUN (no_router_bgp,
380 no_router_bgp_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000381 "no router bgp " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000382 NO_STR
383 ROUTER_STR
384 BGP_STR
385 AS_STR)
386{
387 as_t as;
388 struct bgp *bgp;
paulfd79ac92004-10-13 05:06:08 +0000389 const char *name = NULL;
paul718e3742002-12-13 20:15:29 +0000390
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000391 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +0000392
393 if (argc == 2)
394 name = argv[1];
395
396 /* Lookup bgp structure. */
397 bgp = bgp_lookup (as, name);
398 if (! bgp)
399 {
400 vty_out (vty, "%% Can't find BGP instance%s", VTY_NEWLINE);
401 return CMD_WARNING;
402 }
403
404 bgp_delete (bgp);
405
406 return CMD_SUCCESS;
407}
408
409ALIAS (no_router_bgp,
410 no_router_bgp_view_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000411 "no router bgp " CMD_AS_RANGE " view WORD",
paul718e3742002-12-13 20:15:29 +0000412 NO_STR
413 ROUTER_STR
414 BGP_STR
415 AS_STR
416 "BGP view\n"
417 "view name\n")
David Lamparter6b0655a2014-06-04 06:53:35 +0200418
paul718e3742002-12-13 20:15:29 +0000419/* BGP router-id. */
420
421DEFUN (bgp_router_id,
422 bgp_router_id_cmd,
423 "bgp router-id A.B.C.D",
424 BGP_STR
425 "Override configured router identifier\n"
426 "Manually configured router identifier\n")
427{
428 int ret;
429 struct in_addr id;
430 struct bgp *bgp;
431
432 bgp = vty->index;
433
434 ret = inet_aton (argv[0], &id);
435 if (! ret)
436 {
437 vty_out (vty, "%% Malformed bgp router identifier%s", VTY_NEWLINE);
438 return CMD_WARNING;
439 }
440
hasso18a6dce2004-10-03 18:18:34 +0000441 bgp->router_id_static = id;
paul718e3742002-12-13 20:15:29 +0000442 bgp_router_id_set (bgp, &id);
443
444 return CMD_SUCCESS;
445}
446
447DEFUN (no_bgp_router_id,
448 no_bgp_router_id_cmd,
449 "no bgp router-id",
450 NO_STR
451 BGP_STR
452 "Override configured router identifier\n")
453{
454 int ret;
455 struct in_addr id;
456 struct bgp *bgp;
457
458 bgp = vty->index;
459
460 if (argc == 1)
461 {
462 ret = inet_aton (argv[0], &id);
463 if (! ret)
464 {
465 vty_out (vty, "%% Malformed BGP router identifier%s", VTY_NEWLINE);
466 return CMD_WARNING;
467 }
468
hasso18a6dce2004-10-03 18:18:34 +0000469 if (! IPV4_ADDR_SAME (&bgp->router_id_static, &id))
paul718e3742002-12-13 20:15:29 +0000470 {
471 vty_out (vty, "%% BGP router-id doesn't match%s", VTY_NEWLINE);
472 return CMD_WARNING;
473 }
474 }
475
hasso18a6dce2004-10-03 18:18:34 +0000476 bgp->router_id_static.s_addr = 0;
477 bgp_router_id_set (bgp, &router_id_zebra);
paul718e3742002-12-13 20:15:29 +0000478
479 return CMD_SUCCESS;
480}
481
482ALIAS (no_bgp_router_id,
483 no_bgp_router_id_val_cmd,
484 "no bgp router-id A.B.C.D",
485 NO_STR
486 BGP_STR
487 "Override configured router identifier\n"
488 "Manually configured router identifier\n")
David Lamparter6b0655a2014-06-04 06:53:35 +0200489
paul718e3742002-12-13 20:15:29 +0000490/* BGP Cluster ID. */
491
492DEFUN (bgp_cluster_id,
493 bgp_cluster_id_cmd,
494 "bgp cluster-id A.B.C.D",
495 BGP_STR
496 "Configure Route-Reflector Cluster-id\n"
497 "Route-Reflector Cluster-id in IP address format\n")
498{
499 int ret;
500 struct bgp *bgp;
501 struct in_addr cluster;
502
503 bgp = vty->index;
504
505 ret = inet_aton (argv[0], &cluster);
506 if (! ret)
507 {
508 vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE);
509 return CMD_WARNING;
510 }
511
512 bgp_cluster_id_set (bgp, &cluster);
513
514 return CMD_SUCCESS;
515}
516
517ALIAS (bgp_cluster_id,
518 bgp_cluster_id32_cmd,
519 "bgp cluster-id <1-4294967295>",
520 BGP_STR
521 "Configure Route-Reflector Cluster-id\n"
522 "Route-Reflector Cluster-id as 32 bit quantity\n")
523
524DEFUN (no_bgp_cluster_id,
525 no_bgp_cluster_id_cmd,
526 "no bgp cluster-id",
527 NO_STR
528 BGP_STR
529 "Configure Route-Reflector Cluster-id\n")
530{
531 int ret;
532 struct bgp *bgp;
533 struct in_addr cluster;
534
535 bgp = vty->index;
536
537 if (argc == 1)
538 {
539 ret = inet_aton (argv[0], &cluster);
540 if (! ret)
541 {
542 vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE);
543 return CMD_WARNING;
544 }
545 }
546
547 bgp_cluster_id_unset (bgp);
548
549 return CMD_SUCCESS;
550}
551
552ALIAS (no_bgp_cluster_id,
553 no_bgp_cluster_id_arg_cmd,
554 "no bgp cluster-id A.B.C.D",
555 NO_STR
556 BGP_STR
557 "Configure Route-Reflector Cluster-id\n"
558 "Route-Reflector Cluster-id in IP address format\n")
David Lamparter6b0655a2014-06-04 06:53:35 +0200559
paul718e3742002-12-13 20:15:29 +0000560DEFUN (bgp_confederation_identifier,
561 bgp_confederation_identifier_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000562 "bgp confederation identifier " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000563 "BGP specific commands\n"
564 "AS confederation parameters\n"
565 "AS number\n"
566 "Set routing domain confederation AS\n")
567{
568 struct bgp *bgp;
569 as_t as;
570
571 bgp = vty->index;
572
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000573 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +0000574
575 bgp_confederation_id_set (bgp, as);
576
577 return CMD_SUCCESS;
578}
579
580DEFUN (no_bgp_confederation_identifier,
581 no_bgp_confederation_identifier_cmd,
582 "no bgp confederation identifier",
583 NO_STR
584 "BGP specific commands\n"
585 "AS confederation parameters\n"
586 "AS number\n")
587{
588 struct bgp *bgp;
Paul Jakma7aa9dce2014-09-19 14:42:23 +0100589 as_t as __attribute__((unused)); /* Dummy for VTY_GET_INTEGER_RANGE */
paul718e3742002-12-13 20:15:29 +0000590
591 bgp = vty->index;
592
593 if (argc == 1)
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000594 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +0000595
596 bgp_confederation_id_unset (bgp);
597
598 return CMD_SUCCESS;
599}
600
601ALIAS (no_bgp_confederation_identifier,
602 no_bgp_confederation_identifier_arg_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000603 "no bgp confederation identifier " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000604 NO_STR
605 "BGP specific commands\n"
606 "AS confederation parameters\n"
607 "AS number\n"
608 "Set routing domain confederation AS\n")
David Lamparter6b0655a2014-06-04 06:53:35 +0200609
paul718e3742002-12-13 20:15:29 +0000610DEFUN (bgp_confederation_peers,
611 bgp_confederation_peers_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000612 "bgp confederation peers ." CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000613 "BGP specific commands\n"
614 "AS confederation parameters\n"
615 "Peer ASs in BGP confederation\n"
616 AS_STR)
617{
618 struct bgp *bgp;
619 as_t as;
620 int i;
621
622 bgp = vty->index;
623
624 for (i = 0; i < argc; i++)
625 {
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000626 VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +0000627
628 if (bgp->as == as)
629 {
630 vty_out (vty, "%% Local member-AS not allowed in confed peer list%s",
631 VTY_NEWLINE);
632 continue;
633 }
634
635 bgp_confederation_peers_add (bgp, as);
636 }
637 return CMD_SUCCESS;
638}
639
640DEFUN (no_bgp_confederation_peers,
641 no_bgp_confederation_peers_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000642 "no bgp confederation peers ." CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000643 NO_STR
644 "BGP specific commands\n"
645 "AS confederation parameters\n"
646 "Peer ASs in BGP confederation\n"
647 AS_STR)
648{
649 struct bgp *bgp;
650 as_t as;
651 int i;
652
653 bgp = vty->index;
654
655 for (i = 0; i < argc; i++)
656 {
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000657 VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX);
658
paul718e3742002-12-13 20:15:29 +0000659 bgp_confederation_peers_remove (bgp, as);
660 }
661 return CMD_SUCCESS;
662}
David Lamparter6b0655a2014-06-04 06:53:35 +0200663
Josh Bailey165b5ff2011-07-20 20:43:22 -0700664/* Maximum-paths configuration */
665DEFUN (bgp_maxpaths,
666 bgp_maxpaths_cmd,
667 "maximum-paths <1-255>",
668 "Forward packets over multiple paths\n"
669 "Number of paths\n")
670{
671 struct bgp *bgp;
672 u_int16_t maxpaths;
673 int ret;
674
675 bgp = vty->index;
676
677 VTY_GET_INTEGER_RANGE ("maximum-paths", maxpaths, argv[0], 1, 255);
678
679 ret = bgp_maximum_paths_set (bgp, bgp_node_afi (vty), bgp_node_safi(vty),
680 BGP_PEER_EBGP, maxpaths);
681 if (ret < 0)
682 {
683 vty_out (vty,
684 "%% Failed to set maximum-paths %u for afi %u, safi %u%s",
685 maxpaths, bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE);
686 return CMD_WARNING;
687 }
688
Donald Sharp58a83f22015-09-11 10:11:42 -0400689 if ((MULTIPATH_NUM != 0) && (maxpaths > MULTIPATH_NUM))
690 vty_out (vty,
691 "%% Warning: maximum-paths set to %d is greater than %d that zebra is compiled to support%s",
692 maxpaths, MULTIPATH_NUM, VTY_NEWLINE);
693
Josh Bailey165b5ff2011-07-20 20:43:22 -0700694 return CMD_SUCCESS;
695}
696
697DEFUN (bgp_maxpaths_ibgp,
698 bgp_maxpaths_ibgp_cmd,
699 "maximum-paths ibgp <1-255>",
700 "Forward packets over multiple paths\n"
701 "iBGP-multipath\n"
702 "Number of paths\n")
703{
704 struct bgp *bgp;
705 u_int16_t maxpaths;
706 int ret;
707
708 bgp = vty->index;
709
710 VTY_GET_INTEGER_RANGE ("maximum-paths", maxpaths, argv[0], 1, 255);
711
712 ret = bgp_maximum_paths_set (bgp, bgp_node_afi (vty), bgp_node_safi(vty),
713 BGP_PEER_IBGP, maxpaths);
714 if (ret < 0)
715 {
716 vty_out (vty,
717 "%% Failed to set maximum-paths ibgp %u for afi %u, safi %u%s",
718 maxpaths, bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE);
719 return CMD_WARNING;
720 }
721
Donald Sharp58a83f22015-09-11 10:11:42 -0400722 if ((MULTIPATH_NUM != 0) && (maxpaths > MULTIPATH_NUM))
723 vty_out (vty,
724 "%% Warning: maximum-paths set to %d is greater than %d that zebra is compiled to support%s",
725 maxpaths, MULTIPATH_NUM, VTY_NEWLINE);
726
Josh Bailey165b5ff2011-07-20 20:43:22 -0700727 return CMD_SUCCESS;
728}
729
730DEFUN (no_bgp_maxpaths,
731 no_bgp_maxpaths_cmd,
732 "no maximum-paths",
733 NO_STR
734 "Forward packets over multiple paths\n"
735 "Number of paths\n")
736{
737 struct bgp *bgp;
738 int ret;
739
740 bgp = vty->index;
741
742 ret = bgp_maximum_paths_unset (bgp, bgp_node_afi (vty), bgp_node_safi(vty),
743 BGP_PEER_EBGP);
744 if (ret < 0)
745 {
746 vty_out (vty,
747 "%% Failed to unset maximum-paths for afi %u, safi %u%s",
748 bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE);
749 return CMD_WARNING;
750 }
751
752 return CMD_SUCCESS;
753}
754
755ALIAS (no_bgp_maxpaths,
756 no_bgp_maxpaths_arg_cmd,
757 "no maximum-paths <1-255>",
758 NO_STR
759 "Forward packets over multiple paths\n"
760 "Number of paths\n")
761
762DEFUN (no_bgp_maxpaths_ibgp,
763 no_bgp_maxpaths_ibgp_cmd,
764 "no maximum-paths ibgp",
765 NO_STR
766 "Forward packets over multiple paths\n"
767 "iBGP-multipath\n"
768 "Number of paths\n")
769{
770 struct bgp *bgp;
771 int ret;
772
773 bgp = vty->index;
774
775 ret = bgp_maximum_paths_unset (bgp, bgp_node_afi (vty), bgp_node_safi(vty),
776 BGP_PEER_IBGP);
777 if (ret < 0)
778 {
779 vty_out (vty,
780 "%% Failed to unset maximum-paths ibgp for afi %u, safi %u%s",
781 bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE);
782 return CMD_WARNING;
783 }
784
785 return CMD_SUCCESS;
786}
787
788ALIAS (no_bgp_maxpaths_ibgp,
789 no_bgp_maxpaths_ibgp_arg_cmd,
790 "no maximum-paths ibgp <1-255>",
791 NO_STR
792 "Forward packets over multiple paths\n"
793 "iBGP-multipath\n"
794 "Number of paths\n")
795
796int
797bgp_config_write_maxpaths (struct vty *vty, struct bgp *bgp, afi_t afi,
798 safi_t safi, int *write)
799{
800 if (bgp->maxpaths[afi][safi].maxpaths_ebgp != BGP_DEFAULT_MAXPATHS)
801 {
802 bgp_config_write_family_header (vty, afi, safi, write);
803 vty_out (vty, " maximum-paths %d%s",
804 bgp->maxpaths[afi][safi].maxpaths_ebgp, VTY_NEWLINE);
805 }
806
807 if (bgp->maxpaths[afi][safi].maxpaths_ibgp != BGP_DEFAULT_MAXPATHS)
808 {
809 bgp_config_write_family_header (vty, afi, safi, write);
810 vty_out (vty, " maximum-paths ibgp %d%s",
811 bgp->maxpaths[afi][safi].maxpaths_ibgp, VTY_NEWLINE);
812 }
813
814 return 0;
815}
David Lamparter6b0655a2014-06-04 06:53:35 +0200816
paul718e3742002-12-13 20:15:29 +0000817/* BGP timers. */
818
819DEFUN (bgp_timers,
820 bgp_timers_cmd,
821 "timers bgp <0-65535> <0-65535>",
822 "Adjust routing timers\n"
823 "BGP timers\n"
824 "Keepalive interval\n"
825 "Holdtime\n")
826{
827 struct bgp *bgp;
828 unsigned long keepalive = 0;
829 unsigned long holdtime = 0;
830
831 bgp = vty->index;
832
833 VTY_GET_INTEGER ("keepalive", keepalive, argv[0]);
834 VTY_GET_INTEGER ("holdtime", holdtime, argv[1]);
835
836 /* Holdtime value check. */
837 if (holdtime < 3 && holdtime != 0)
838 {
839 vty_out (vty, "%% hold time value must be either 0 or greater than 3%s",
840 VTY_NEWLINE);
841 return CMD_WARNING;
842 }
843
844 bgp_timers_set (bgp, keepalive, holdtime);
845
846 return CMD_SUCCESS;
847}
848
849DEFUN (no_bgp_timers,
850 no_bgp_timers_cmd,
851 "no timers bgp",
852 NO_STR
853 "Adjust routing timers\n"
854 "BGP timers\n")
855{
856 struct bgp *bgp;
857
858 bgp = vty->index;
859 bgp_timers_unset (bgp);
860
861 return CMD_SUCCESS;
862}
863
864ALIAS (no_bgp_timers,
865 no_bgp_timers_arg_cmd,
866 "no timers bgp <0-65535> <0-65535>",
867 NO_STR
868 "Adjust routing timers\n"
869 "BGP timers\n"
870 "Keepalive interval\n"
871 "Holdtime\n")
David Lamparter6b0655a2014-06-04 06:53:35 +0200872
paul718e3742002-12-13 20:15:29 +0000873DEFUN (bgp_client_to_client_reflection,
874 bgp_client_to_client_reflection_cmd,
875 "bgp client-to-client reflection",
876 "BGP specific commands\n"
877 "Configure client to client route reflection\n"
878 "reflection of routes allowed\n")
879{
880 struct bgp *bgp;
881
882 bgp = vty->index;
883 bgp_flag_unset (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT);
884 return CMD_SUCCESS;
885}
886
887DEFUN (no_bgp_client_to_client_reflection,
888 no_bgp_client_to_client_reflection_cmd,
889 "no bgp client-to-client reflection",
890 NO_STR
891 "BGP specific commands\n"
892 "Configure client to client route reflection\n"
893 "reflection of routes allowed\n")
894{
895 struct bgp *bgp;
896
897 bgp = vty->index;
898 bgp_flag_set (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT);
899 return CMD_SUCCESS;
900}
901
902/* "bgp always-compare-med" configuration. */
903DEFUN (bgp_always_compare_med,
904 bgp_always_compare_med_cmd,
905 "bgp always-compare-med",
906 "BGP specific commands\n"
907 "Allow comparing MED from different neighbors\n")
908{
909 struct bgp *bgp;
910
911 bgp = vty->index;
912 bgp_flag_set (bgp, BGP_FLAG_ALWAYS_COMPARE_MED);
913 return CMD_SUCCESS;
914}
915
916DEFUN (no_bgp_always_compare_med,
917 no_bgp_always_compare_med_cmd,
918 "no bgp always-compare-med",
919 NO_STR
920 "BGP specific commands\n"
921 "Allow comparing MED from different neighbors\n")
922{
923 struct bgp *bgp;
924
925 bgp = vty->index;
926 bgp_flag_unset (bgp, BGP_FLAG_ALWAYS_COMPARE_MED);
927 return CMD_SUCCESS;
928}
David Lamparter6b0655a2014-06-04 06:53:35 +0200929
paul718e3742002-12-13 20:15:29 +0000930/* "bgp deterministic-med" configuration. */
931DEFUN (bgp_deterministic_med,
932 bgp_deterministic_med_cmd,
933 "bgp deterministic-med",
934 "BGP specific commands\n"
935 "Pick the best-MED path among paths advertised from the neighboring AS\n")
936{
937 struct bgp *bgp;
938
939 bgp = vty->index;
940 bgp_flag_set (bgp, BGP_FLAG_DETERMINISTIC_MED);
941 return CMD_SUCCESS;
942}
943
944DEFUN (no_bgp_deterministic_med,
945 no_bgp_deterministic_med_cmd,
946 "no bgp deterministic-med",
947 NO_STR
948 "BGP specific commands\n"
949 "Pick the best-MED path among paths advertised from the neighboring AS\n")
950{
951 struct bgp *bgp;
952
953 bgp = vty->index;
954 bgp_flag_unset (bgp, BGP_FLAG_DETERMINISTIC_MED);
955 return CMD_SUCCESS;
956}
hasso538621f2004-05-21 09:31:30 +0000957
958/* "bgp graceful-restart" configuration. */
959DEFUN (bgp_graceful_restart,
960 bgp_graceful_restart_cmd,
961 "bgp graceful-restart",
962 "BGP specific commands\n"
963 "Graceful restart capability parameters\n")
964{
965 struct bgp *bgp;
966
967 bgp = vty->index;
968 bgp_flag_set (bgp, BGP_FLAG_GRACEFUL_RESTART);
969 return CMD_SUCCESS;
970}
971
972DEFUN (no_bgp_graceful_restart,
973 no_bgp_graceful_restart_cmd,
974 "no bgp graceful-restart",
975 NO_STR
976 "BGP specific commands\n"
977 "Graceful restart capability parameters\n")
978{
979 struct bgp *bgp;
980
981 bgp = vty->index;
982 bgp_flag_unset (bgp, BGP_FLAG_GRACEFUL_RESTART);
983 return CMD_SUCCESS;
984}
985
hasso93406d82005-02-02 14:40:33 +0000986DEFUN (bgp_graceful_restart_stalepath_time,
987 bgp_graceful_restart_stalepath_time_cmd,
988 "bgp graceful-restart stalepath-time <1-3600>",
989 "BGP specific commands\n"
990 "Graceful restart capability parameters\n"
991 "Set the max time to hold onto restarting peer's stale paths\n"
992 "Delay value (seconds)\n")
993{
994 struct bgp *bgp;
995 u_int32_t stalepath;
996
997 bgp = vty->index;
998 if (! bgp)
999 return CMD_WARNING;
1000
1001 VTY_GET_INTEGER_RANGE ("stalepath-time", stalepath, argv[0], 1, 3600);
1002 bgp->stalepath_time = stalepath;
1003 return CMD_SUCCESS;
1004}
1005
1006DEFUN (no_bgp_graceful_restart_stalepath_time,
1007 no_bgp_graceful_restart_stalepath_time_cmd,
1008 "no bgp graceful-restart stalepath-time",
1009 NO_STR
1010 "BGP specific commands\n"
1011 "Graceful restart capability parameters\n"
1012 "Set the max time to hold onto restarting peer's stale paths\n")
1013{
1014 struct bgp *bgp;
1015
1016 bgp = vty->index;
1017 if (! bgp)
1018 return CMD_WARNING;
1019
1020 bgp->stalepath_time = BGP_DEFAULT_STALEPATH_TIME;
1021 return CMD_SUCCESS;
1022}
1023
1024ALIAS (no_bgp_graceful_restart_stalepath_time,
1025 no_bgp_graceful_restart_stalepath_time_val_cmd,
1026 "no bgp graceful-restart stalepath-time <1-3600>",
1027 NO_STR
1028 "BGP specific commands\n"
1029 "Graceful restart capability parameters\n"
1030 "Set the max time to hold onto restarting peer's stale paths\n"
1031 "Delay value (seconds)\n")
1032
paul718e3742002-12-13 20:15:29 +00001033/* "bgp fast-external-failover" configuration. */
1034DEFUN (bgp_fast_external_failover,
1035 bgp_fast_external_failover_cmd,
1036 "bgp fast-external-failover",
1037 BGP_STR
1038 "Immediately reset session if a link to a directly connected external peer goes down\n")
1039{
1040 struct bgp *bgp;
1041
1042 bgp = vty->index;
1043 bgp_flag_unset (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER);
1044 return CMD_SUCCESS;
1045}
1046
1047DEFUN (no_bgp_fast_external_failover,
1048 no_bgp_fast_external_failover_cmd,
1049 "no bgp fast-external-failover",
1050 NO_STR
1051 BGP_STR
1052 "Immediately reset session if a link to a directly connected external peer goes down\n")
1053{
1054 struct bgp *bgp;
1055
1056 bgp = vty->index;
1057 bgp_flag_set (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER);
1058 return CMD_SUCCESS;
1059}
David Lamparter6b0655a2014-06-04 06:53:35 +02001060
paul718e3742002-12-13 20:15:29 +00001061/* "bgp enforce-first-as" configuration. */
1062DEFUN (bgp_enforce_first_as,
1063 bgp_enforce_first_as_cmd,
1064 "bgp enforce-first-as",
1065 BGP_STR
1066 "Enforce the first AS for EBGP routes\n")
1067{
1068 struct bgp *bgp;
1069
1070 bgp = vty->index;
1071 bgp_flag_set (bgp, BGP_FLAG_ENFORCE_FIRST_AS);
1072 return CMD_SUCCESS;
1073}
1074
1075DEFUN (no_bgp_enforce_first_as,
1076 no_bgp_enforce_first_as_cmd,
1077 "no bgp enforce-first-as",
1078 NO_STR
1079 BGP_STR
1080 "Enforce the first AS for EBGP routes\n")
1081{
1082 struct bgp *bgp;
1083
1084 bgp = vty->index;
1085 bgp_flag_unset (bgp, BGP_FLAG_ENFORCE_FIRST_AS);
1086 return CMD_SUCCESS;
1087}
David Lamparter6b0655a2014-06-04 06:53:35 +02001088
paul718e3742002-12-13 20:15:29 +00001089/* "bgp bestpath compare-routerid" configuration. */
1090DEFUN (bgp_bestpath_compare_router_id,
1091 bgp_bestpath_compare_router_id_cmd,
1092 "bgp bestpath compare-routerid",
1093 "BGP specific commands\n"
1094 "Change the default bestpath selection\n"
1095 "Compare router-id for identical EBGP paths\n")
1096{
1097 struct bgp *bgp;
1098
1099 bgp = vty->index;
1100 bgp_flag_set (bgp, BGP_FLAG_COMPARE_ROUTER_ID);
1101 return CMD_SUCCESS;
1102}
1103
1104DEFUN (no_bgp_bestpath_compare_router_id,
1105 no_bgp_bestpath_compare_router_id_cmd,
1106 "no bgp bestpath compare-routerid",
1107 NO_STR
1108 "BGP specific commands\n"
1109 "Change the default bestpath selection\n"
1110 "Compare router-id for identical EBGP paths\n")
1111{
1112 struct bgp *bgp;
1113
1114 bgp = vty->index;
1115 bgp_flag_unset (bgp, BGP_FLAG_COMPARE_ROUTER_ID);
1116 return CMD_SUCCESS;
1117}
David Lamparter6b0655a2014-06-04 06:53:35 +02001118
paul718e3742002-12-13 20:15:29 +00001119/* "bgp bestpath as-path ignore" configuration. */
1120DEFUN (bgp_bestpath_aspath_ignore,
1121 bgp_bestpath_aspath_ignore_cmd,
1122 "bgp bestpath as-path ignore",
1123 "BGP specific commands\n"
1124 "Change the default bestpath selection\n"
1125 "AS-path attribute\n"
1126 "Ignore as-path length in selecting a route\n")
1127{
1128 struct bgp *bgp;
1129
1130 bgp = vty->index;
1131 bgp_flag_set (bgp, BGP_FLAG_ASPATH_IGNORE);
1132 return CMD_SUCCESS;
1133}
1134
1135DEFUN (no_bgp_bestpath_aspath_ignore,
1136 no_bgp_bestpath_aspath_ignore_cmd,
1137 "no bgp bestpath as-path ignore",
1138 NO_STR
1139 "BGP specific commands\n"
1140 "Change the default bestpath selection\n"
1141 "AS-path attribute\n"
1142 "Ignore as-path length in selecting a route\n")
1143{
1144 struct bgp *bgp;
1145
1146 bgp = vty->index;
1147 bgp_flag_unset (bgp, BGP_FLAG_ASPATH_IGNORE);
1148 return CMD_SUCCESS;
1149}
David Lamparter6b0655a2014-06-04 06:53:35 +02001150
hasso68118452005-04-08 15:40:36 +00001151/* "bgp bestpath as-path confed" configuration. */
1152DEFUN (bgp_bestpath_aspath_confed,
1153 bgp_bestpath_aspath_confed_cmd,
1154 "bgp bestpath as-path confed",
1155 "BGP specific commands\n"
1156 "Change the default bestpath selection\n"
1157 "AS-path attribute\n"
1158 "Compare path lengths including confederation sets & sequences in selecting a route\n")
1159{
1160 struct bgp *bgp;
1161
1162 bgp = vty->index;
1163 bgp_flag_set (bgp, BGP_FLAG_ASPATH_CONFED);
1164 return CMD_SUCCESS;
1165}
1166
1167DEFUN (no_bgp_bestpath_aspath_confed,
1168 no_bgp_bestpath_aspath_confed_cmd,
1169 "no bgp bestpath as-path confed",
1170 NO_STR
1171 "BGP specific commands\n"
1172 "Change the default bestpath selection\n"
1173 "AS-path attribute\n"
1174 "Compare path lengths including confederation sets & sequences in selecting a route\n")
1175{
1176 struct bgp *bgp;
1177
1178 bgp = vty->index;
1179 bgp_flag_unset (bgp, BGP_FLAG_ASPATH_CONFED);
1180 return CMD_SUCCESS;
1181}
David Lamparter6b0655a2014-06-04 06:53:35 +02001182
Pradosh Mohapatra2fdd4552013-09-07 07:02:36 +00001183/* "bgp bestpath as-path multipath-relax" configuration. */
1184DEFUN (bgp_bestpath_aspath_multipath_relax,
1185 bgp_bestpath_aspath_multipath_relax_cmd,
1186 "bgp bestpath as-path multipath-relax",
1187 "BGP specific commands\n"
1188 "Change the default bestpath selection\n"
1189 "AS-path attribute\n"
1190 "Allow load sharing across routes that have different AS paths (but same length)\n")
1191{
1192 struct bgp *bgp;
1193
1194 bgp = vty->index;
1195 bgp_flag_set (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX);
1196 return CMD_SUCCESS;
1197}
1198
1199DEFUN (no_bgp_bestpath_aspath_multipath_relax,
1200 no_bgp_bestpath_aspath_multipath_relax_cmd,
1201 "no bgp bestpath as-path multipath-relax",
1202 NO_STR
1203 "BGP specific commands\n"
1204 "Change the default bestpath selection\n"
1205 "AS-path attribute\n"
1206 "Allow load sharing across routes that have different AS paths (but same length)\n")
1207{
1208 struct bgp *bgp;
1209
1210 bgp = vty->index;
1211 bgp_flag_unset (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX);
1212 return CMD_SUCCESS;
1213}
David Lamparter6b0655a2014-06-04 06:53:35 +02001214
paul848973c2003-08-13 00:32:49 +00001215/* "bgp log-neighbor-changes" configuration. */
1216DEFUN (bgp_log_neighbor_changes,
1217 bgp_log_neighbor_changes_cmd,
1218 "bgp log-neighbor-changes",
1219 "BGP specific commands\n"
1220 "Log neighbor up/down and reset reason\n")
1221{
1222 struct bgp *bgp;
1223
1224 bgp = vty->index;
1225 bgp_flag_set (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES);
1226 return CMD_SUCCESS;
1227}
1228
1229DEFUN (no_bgp_log_neighbor_changes,
1230 no_bgp_log_neighbor_changes_cmd,
1231 "no bgp log-neighbor-changes",
1232 NO_STR
1233 "BGP specific commands\n"
1234 "Log neighbor up/down and reset reason\n")
1235{
1236 struct bgp *bgp;
1237
1238 bgp = vty->index;
1239 bgp_flag_unset (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES);
1240 return CMD_SUCCESS;
1241}
David Lamparter6b0655a2014-06-04 06:53:35 +02001242
paul718e3742002-12-13 20:15:29 +00001243/* "bgp bestpath med" configuration. */
1244DEFUN (bgp_bestpath_med,
1245 bgp_bestpath_med_cmd,
1246 "bgp bestpath med (confed|missing-as-worst)",
1247 "BGP specific commands\n"
1248 "Change the default bestpath selection\n"
1249 "MED attribute\n"
1250 "Compare MED among confederation paths\n"
1251 "Treat missing MED as the least preferred one\n")
1252{
1253 struct bgp *bgp;
1254
1255 bgp = vty->index;
1256
1257 if (strncmp (argv[0], "confed", 1) == 0)
1258 bgp_flag_set (bgp, BGP_FLAG_MED_CONFED);
1259 else
1260 bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1261
1262 return CMD_SUCCESS;
1263}
1264
1265DEFUN (bgp_bestpath_med2,
1266 bgp_bestpath_med2_cmd,
1267 "bgp bestpath med confed missing-as-worst",
1268 "BGP specific commands\n"
1269 "Change the default bestpath selection\n"
1270 "MED attribute\n"
1271 "Compare MED among confederation paths\n"
1272 "Treat missing MED as the least preferred one\n")
1273{
1274 struct bgp *bgp;
1275
1276 bgp = vty->index;
1277 bgp_flag_set (bgp, BGP_FLAG_MED_CONFED);
1278 bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1279 return CMD_SUCCESS;
1280}
1281
1282ALIAS (bgp_bestpath_med2,
1283 bgp_bestpath_med3_cmd,
1284 "bgp bestpath med missing-as-worst confed",
1285 "BGP specific commands\n"
1286 "Change the default bestpath selection\n"
1287 "MED attribute\n"
1288 "Treat missing MED as the least preferred one\n"
1289 "Compare MED among confederation paths\n")
1290
1291DEFUN (no_bgp_bestpath_med,
1292 no_bgp_bestpath_med_cmd,
1293 "no bgp bestpath med (confed|missing-as-worst)",
1294 NO_STR
1295 "BGP specific commands\n"
1296 "Change the default bestpath selection\n"
1297 "MED attribute\n"
1298 "Compare MED among confederation paths\n"
1299 "Treat missing MED as the least preferred one\n")
1300{
1301 struct bgp *bgp;
1302
1303 bgp = vty->index;
1304
1305 if (strncmp (argv[0], "confed", 1) == 0)
1306 bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED);
1307 else
1308 bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1309
1310 return CMD_SUCCESS;
1311}
1312
1313DEFUN (no_bgp_bestpath_med2,
1314 no_bgp_bestpath_med2_cmd,
1315 "no bgp bestpath med confed missing-as-worst",
1316 NO_STR
1317 "BGP specific commands\n"
1318 "Change the default bestpath selection\n"
1319 "MED attribute\n"
1320 "Compare MED among confederation paths\n"
1321 "Treat missing MED as the least preferred one\n")
1322{
1323 struct bgp *bgp;
1324
1325 bgp = vty->index;
1326 bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED);
1327 bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1328 return CMD_SUCCESS;
1329}
1330
1331ALIAS (no_bgp_bestpath_med2,
1332 no_bgp_bestpath_med3_cmd,
1333 "no bgp bestpath med missing-as-worst confed",
1334 NO_STR
1335 "BGP specific commands\n"
1336 "Change the default bestpath selection\n"
1337 "MED attribute\n"
1338 "Treat missing MED as the least preferred one\n"
1339 "Compare MED among confederation paths\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02001340
paul718e3742002-12-13 20:15:29 +00001341/* "no bgp default ipv4-unicast". */
1342DEFUN (no_bgp_default_ipv4_unicast,
1343 no_bgp_default_ipv4_unicast_cmd,
1344 "no bgp default ipv4-unicast",
1345 NO_STR
1346 "BGP specific commands\n"
1347 "Configure BGP defaults\n"
1348 "Activate ipv4-unicast for a peer by default\n")
1349{
1350 struct bgp *bgp;
1351
1352 bgp = vty->index;
1353 bgp_flag_set (bgp, BGP_FLAG_NO_DEFAULT_IPV4);
1354 return CMD_SUCCESS;
1355}
1356
1357DEFUN (bgp_default_ipv4_unicast,
1358 bgp_default_ipv4_unicast_cmd,
1359 "bgp default ipv4-unicast",
1360 "BGP specific commands\n"
1361 "Configure BGP defaults\n"
1362 "Activate ipv4-unicast for a peer by default\n")
1363{
1364 struct bgp *bgp;
1365
1366 bgp = vty->index;
1367 bgp_flag_unset (bgp, BGP_FLAG_NO_DEFAULT_IPV4);
1368 return CMD_SUCCESS;
1369}
David Lamparter6b0655a2014-06-04 06:53:35 +02001370
paul718e3742002-12-13 20:15:29 +00001371/* "bgp import-check" configuration. */
1372DEFUN (bgp_network_import_check,
1373 bgp_network_import_check_cmd,
1374 "bgp network import-check",
1375 "BGP specific commands\n"
1376 "BGP network command\n"
1377 "Check BGP network route exists in IGP\n")
1378{
1379 struct bgp *bgp;
1380
1381 bgp = vty->index;
1382 bgp_flag_set (bgp, BGP_FLAG_IMPORT_CHECK);
1383 return CMD_SUCCESS;
1384}
1385
1386DEFUN (no_bgp_network_import_check,
1387 no_bgp_network_import_check_cmd,
1388 "no bgp network import-check",
1389 NO_STR
1390 "BGP specific commands\n"
1391 "BGP network command\n"
1392 "Check BGP network route exists in IGP\n")
1393{
1394 struct bgp *bgp;
1395
1396 bgp = vty->index;
1397 bgp_flag_unset (bgp, BGP_FLAG_IMPORT_CHECK);
1398 return CMD_SUCCESS;
1399}
David Lamparter6b0655a2014-06-04 06:53:35 +02001400
paul718e3742002-12-13 20:15:29 +00001401DEFUN (bgp_default_local_preference,
1402 bgp_default_local_preference_cmd,
1403 "bgp default local-preference <0-4294967295>",
1404 "BGP specific commands\n"
1405 "Configure BGP defaults\n"
1406 "local preference (higher=more preferred)\n"
1407 "Configure default local preference value\n")
1408{
1409 struct bgp *bgp;
1410 u_int32_t local_pref;
1411
1412 bgp = vty->index;
1413
1414 VTY_GET_INTEGER ("local preference", local_pref, argv[0]);
1415
1416 bgp_default_local_preference_set (bgp, local_pref);
1417
1418 return CMD_SUCCESS;
1419}
1420
1421DEFUN (no_bgp_default_local_preference,
1422 no_bgp_default_local_preference_cmd,
1423 "no bgp default local-preference",
1424 NO_STR
1425 "BGP specific commands\n"
1426 "Configure BGP defaults\n"
1427 "local preference (higher=more preferred)\n")
1428{
1429 struct bgp *bgp;
1430
1431 bgp = vty->index;
1432 bgp_default_local_preference_unset (bgp);
1433 return CMD_SUCCESS;
1434}
1435
1436ALIAS (no_bgp_default_local_preference,
1437 no_bgp_default_local_preference_val_cmd,
1438 "no bgp default local-preference <0-4294967295>",
1439 NO_STR
1440 "BGP specific commands\n"
1441 "Configure BGP defaults\n"
1442 "local preference (higher=more preferred)\n"
1443 "Configure default local preference value\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02001444
paul718e3742002-12-13 20:15:29 +00001445static int
paulfd79ac92004-10-13 05:06:08 +00001446peer_remote_as_vty (struct vty *vty, const char *peer_str,
1447 const char *as_str, afi_t afi, safi_t safi)
paul718e3742002-12-13 20:15:29 +00001448{
1449 int ret;
1450 struct bgp *bgp;
1451 as_t as;
1452 union sockunion su;
1453
1454 bgp = vty->index;
1455
1456 /* Get AS number. */
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00001457 VTY_GET_INTEGER_RANGE ("AS", as, as_str, 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +00001458
1459 /* If peer is peer group, call proper function. */
1460 ret = str2sockunion (peer_str, &su);
1461 if (ret < 0)
1462 {
1463 ret = peer_group_remote_as (bgp, peer_str, &as);
1464 if (ret < 0)
1465 {
1466 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1467 return CMD_WARNING;
1468 }
1469 return CMD_SUCCESS;
1470 }
1471
1472 if (peer_address_self_check (&su))
1473 {
1474 vty_out (vty, "%% Can not configure the local system as neighbor%s",
1475 VTY_NEWLINE);
1476 return CMD_WARNING;
1477 }
1478
1479 ret = peer_remote_as (bgp, &su, &as, afi, safi);
1480
1481 /* This peer belongs to peer group. */
1482 switch (ret)
1483 {
1484 case BGP_ERR_PEER_GROUP_MEMBER:
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04001485 vty_out (vty, "%% Peer-group AS %u. Cannot configure remote-as for member%s", as, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00001486 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00001487 case BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT:
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04001488 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 +00001489 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00001490 }
1491 return bgp_vty_return (vty, ret);
1492}
1493
1494DEFUN (neighbor_remote_as,
1495 neighbor_remote_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001496 NEIGHBOR_CMD2 "remote-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001497 NEIGHBOR_STR
1498 NEIGHBOR_ADDR_STR2
1499 "Specify a BGP neighbor\n"
1500 AS_STR)
1501{
1502 return peer_remote_as_vty (vty, argv[0], argv[1], AFI_IP, SAFI_UNICAST);
1503}
David Lamparter6b0655a2014-06-04 06:53:35 +02001504
paul718e3742002-12-13 20:15:29 +00001505DEFUN (neighbor_peer_group,
1506 neighbor_peer_group_cmd,
1507 "neighbor WORD peer-group",
1508 NEIGHBOR_STR
1509 "Neighbor tag\n"
1510 "Configure peer-group\n")
1511{
1512 struct bgp *bgp;
1513 struct peer_group *group;
1514
1515 bgp = vty->index;
1516
1517 group = peer_group_get (bgp, argv[0]);
1518 if (! group)
1519 return CMD_WARNING;
1520
1521 return CMD_SUCCESS;
1522}
1523
1524DEFUN (no_neighbor,
1525 no_neighbor_cmd,
1526 NO_NEIGHBOR_CMD2,
1527 NO_STR
1528 NEIGHBOR_STR
1529 NEIGHBOR_ADDR_STR2)
1530{
1531 int ret;
1532 union sockunion su;
1533 struct peer_group *group;
1534 struct peer *peer;
1535
1536 ret = str2sockunion (argv[0], &su);
1537 if (ret < 0)
1538 {
1539 group = peer_group_lookup (vty->index, argv[0]);
1540 if (group)
1541 peer_group_delete (group);
1542 else
1543 {
1544 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1545 return CMD_WARNING;
1546 }
1547 }
1548 else
1549 {
1550 peer = peer_lookup (vty->index, &su);
1551 if (peer)
paul200df112005-06-01 11:17:05 +00001552 peer_delete (peer);
paul718e3742002-12-13 20:15:29 +00001553 }
1554
1555 return CMD_SUCCESS;
1556}
1557
1558ALIAS (no_neighbor,
1559 no_neighbor_remote_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001560 NO_NEIGHBOR_CMD "remote-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001561 NO_STR
1562 NEIGHBOR_STR
1563 NEIGHBOR_ADDR_STR
1564 "Specify a BGP neighbor\n"
1565 AS_STR)
1566
1567DEFUN (no_neighbor_peer_group,
1568 no_neighbor_peer_group_cmd,
1569 "no neighbor WORD peer-group",
1570 NO_STR
1571 NEIGHBOR_STR
1572 "Neighbor tag\n"
1573 "Configure peer-group\n")
1574{
1575 struct peer_group *group;
1576
1577 group = peer_group_lookup (vty->index, argv[0]);
1578 if (group)
1579 peer_group_delete (group);
1580 else
1581 {
1582 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1583 return CMD_WARNING;
1584 }
1585 return CMD_SUCCESS;
1586}
1587
1588DEFUN (no_neighbor_peer_group_remote_as,
1589 no_neighbor_peer_group_remote_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001590 "no neighbor WORD remote-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001591 NO_STR
1592 NEIGHBOR_STR
1593 "Neighbor tag\n"
1594 "Specify a BGP neighbor\n"
1595 AS_STR)
1596{
1597 struct peer_group *group;
1598
1599 group = peer_group_lookup (vty->index, argv[0]);
1600 if (group)
1601 peer_group_remote_as_delete (group);
1602 else
1603 {
1604 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1605 return CMD_WARNING;
1606 }
1607 return CMD_SUCCESS;
1608}
David Lamparter6b0655a2014-06-04 06:53:35 +02001609
paul718e3742002-12-13 20:15:29 +00001610DEFUN (neighbor_local_as,
1611 neighbor_local_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001612 NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001613 NEIGHBOR_STR
1614 NEIGHBOR_ADDR_STR2
1615 "Specify a local-as number\n"
1616 "AS number used as local AS\n")
1617{
1618 struct peer *peer;
1619 int ret;
1620
1621 peer = peer_and_group_lookup_vty (vty, argv[0]);
1622 if (! peer)
1623 return CMD_WARNING;
1624
Andrew Certain9d3f9702012-11-07 23:50:07 +00001625 ret = peer_local_as_set (peer, atoi (argv[1]), 0, 0);
paul718e3742002-12-13 20:15:29 +00001626 return bgp_vty_return (vty, ret);
1627}
1628
1629DEFUN (neighbor_local_as_no_prepend,
1630 neighbor_local_as_no_prepend_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001631 NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend",
paul718e3742002-12-13 20:15:29 +00001632 NEIGHBOR_STR
1633 NEIGHBOR_ADDR_STR2
1634 "Specify a local-as number\n"
1635 "AS number used as local AS\n"
1636 "Do not prepend local-as to updates from ebgp peers\n")
1637{
1638 struct peer *peer;
1639 int ret;
1640
1641 peer = peer_and_group_lookup_vty (vty, argv[0]);
1642 if (! peer)
1643 return CMD_WARNING;
1644
Andrew Certain9d3f9702012-11-07 23:50:07 +00001645 ret = peer_local_as_set (peer, atoi (argv[1]), 1, 0);
paul718e3742002-12-13 20:15:29 +00001646 return bgp_vty_return (vty, ret);
1647}
1648
Andrew Certain9d3f9702012-11-07 23:50:07 +00001649DEFUN (neighbor_local_as_no_prepend_replace_as,
1650 neighbor_local_as_no_prepend_replace_as_cmd,
1651 NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as",
1652 NEIGHBOR_STR
1653 NEIGHBOR_ADDR_STR2
1654 "Specify a local-as number\n"
1655 "AS number used as local AS\n"
1656 "Do not prepend local-as to updates from ebgp peers\n"
1657 "Do not prepend local-as to updates from ibgp peers\n")
1658{
1659 struct peer *peer;
1660 int ret;
1661
1662 peer = peer_and_group_lookup_vty (vty, argv[0]);
1663 if (! peer)
1664 return CMD_WARNING;
1665
1666 ret = peer_local_as_set (peer, atoi (argv[1]), 1, 1);
1667 return bgp_vty_return (vty, ret);
1668}
1669
1670
paul718e3742002-12-13 20:15:29 +00001671DEFUN (no_neighbor_local_as,
1672 no_neighbor_local_as_cmd,
1673 NO_NEIGHBOR_CMD2 "local-as",
1674 NO_STR
1675 NEIGHBOR_STR
1676 NEIGHBOR_ADDR_STR2
1677 "Specify a local-as number\n")
1678{
1679 struct peer *peer;
1680 int ret;
1681
1682 peer = peer_and_group_lookup_vty (vty, argv[0]);
1683 if (! peer)
1684 return CMD_WARNING;
1685
1686 ret = peer_local_as_unset (peer);
1687 return bgp_vty_return (vty, ret);
1688}
1689
1690ALIAS (no_neighbor_local_as,
1691 no_neighbor_local_as_val_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001692 NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001693 NO_STR
1694 NEIGHBOR_STR
1695 NEIGHBOR_ADDR_STR2
1696 "Specify a local-as number\n"
1697 "AS number used as local AS\n")
1698
1699ALIAS (no_neighbor_local_as,
1700 no_neighbor_local_as_val2_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001701 NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend",
paul718e3742002-12-13 20:15:29 +00001702 NO_STR
1703 NEIGHBOR_STR
1704 NEIGHBOR_ADDR_STR2
1705 "Specify a local-as number\n"
1706 "AS number used as local AS\n"
1707 "Do not prepend local-as to updates from ebgp peers\n")
Andrew Certain9d3f9702012-11-07 23:50:07 +00001708
1709ALIAS (no_neighbor_local_as,
1710 no_neighbor_local_as_val3_cmd,
1711 NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as",
1712 NO_STR
1713 NEIGHBOR_STR
1714 NEIGHBOR_ADDR_STR2
1715 "Specify a local-as number\n"
1716 "AS number used as local AS\n"
1717 "Do not prepend local-as to updates from ebgp peers\n"
1718 "Do not prepend local-as to updates from ibgp peers\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02001719
Paul Jakma0df7c912008-07-21 21:02:49 +00001720DEFUN (neighbor_password,
1721 neighbor_password_cmd,
1722 NEIGHBOR_CMD2 "password LINE",
1723 NEIGHBOR_STR
1724 NEIGHBOR_ADDR_STR2
1725 "Set a password\n"
1726 "The password\n")
1727{
1728 struct peer *peer;
1729 int ret;
1730
1731 peer = peer_and_group_lookup_vty (vty, argv[0]);
1732 if (! peer)
1733 return CMD_WARNING;
1734
1735 ret = peer_password_set (peer, argv[1]);
1736 return bgp_vty_return (vty, ret);
1737}
1738
1739DEFUN (no_neighbor_password,
1740 no_neighbor_password_cmd,
1741 NO_NEIGHBOR_CMD2 "password",
1742 NO_STR
1743 NEIGHBOR_STR
1744 NEIGHBOR_ADDR_STR2
1745 "Set a password\n")
1746{
1747 struct peer *peer;
1748 int ret;
1749
1750 peer = peer_and_group_lookup_vty (vty, argv[0]);
1751 if (! peer)
1752 return CMD_WARNING;
1753
1754 ret = peer_password_unset (peer);
1755 return bgp_vty_return (vty, ret);
1756}
David Lamparter6b0655a2014-06-04 06:53:35 +02001757
paul718e3742002-12-13 20:15:29 +00001758DEFUN (neighbor_activate,
1759 neighbor_activate_cmd,
1760 NEIGHBOR_CMD2 "activate",
1761 NEIGHBOR_STR
1762 NEIGHBOR_ADDR_STR2
1763 "Enable the Address Family for this Neighbor\n")
1764{
1765 struct peer *peer;
1766
1767 peer = peer_and_group_lookup_vty (vty, argv[0]);
1768 if (! peer)
1769 return CMD_WARNING;
1770
1771 peer_activate (peer, bgp_node_afi (vty), bgp_node_safi (vty));
1772
1773 return CMD_SUCCESS;
1774}
1775
1776DEFUN (no_neighbor_activate,
1777 no_neighbor_activate_cmd,
1778 NO_NEIGHBOR_CMD2 "activate",
1779 NO_STR
1780 NEIGHBOR_STR
1781 NEIGHBOR_ADDR_STR2
1782 "Enable the Address Family for this Neighbor\n")
1783{
1784 int ret;
1785 struct peer *peer;
1786
1787 /* Lookup peer. */
1788 peer = peer_and_group_lookup_vty (vty, argv[0]);
1789 if (! peer)
1790 return CMD_WARNING;
1791
1792 ret = peer_deactivate (peer, bgp_node_afi (vty), bgp_node_safi (vty));
1793
1794 return bgp_vty_return (vty, ret);
1795}
David Lamparter6b0655a2014-06-04 06:53:35 +02001796
paul718e3742002-12-13 20:15:29 +00001797DEFUN (neighbor_set_peer_group,
1798 neighbor_set_peer_group_cmd,
1799 NEIGHBOR_CMD "peer-group WORD",
1800 NEIGHBOR_STR
1801 NEIGHBOR_ADDR_STR
1802 "Member of the peer-group\n"
1803 "peer-group name\n")
1804{
1805 int ret;
1806 as_t as;
1807 union sockunion su;
1808 struct bgp *bgp;
1809 struct peer_group *group;
1810
1811 bgp = vty->index;
1812
1813 ret = str2sockunion (argv[0], &su);
1814 if (ret < 0)
1815 {
1816 vty_out (vty, "%% Malformed address: %s%s", argv[0], VTY_NEWLINE);
1817 return CMD_WARNING;
1818 }
1819
1820 group = peer_group_lookup (bgp, argv[1]);
1821 if (! group)
1822 {
1823 vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE);
1824 return CMD_WARNING;
1825 }
1826
1827 if (peer_address_self_check (&su))
1828 {
1829 vty_out (vty, "%% Can not configure the local system as neighbor%s",
1830 VTY_NEWLINE);
1831 return CMD_WARNING;
1832 }
1833
1834 ret = peer_group_bind (bgp, &su, group, bgp_node_afi (vty),
1835 bgp_node_safi (vty), &as);
1836
1837 if (ret == BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT)
1838 {
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04001839 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 +00001840 return CMD_WARNING;
1841 }
1842
1843 return bgp_vty_return (vty, ret);
1844}
1845
1846DEFUN (no_neighbor_set_peer_group,
1847 no_neighbor_set_peer_group_cmd,
1848 NO_NEIGHBOR_CMD "peer-group WORD",
1849 NO_STR
1850 NEIGHBOR_STR
1851 NEIGHBOR_ADDR_STR
1852 "Member of the peer-group\n"
1853 "peer-group name\n")
1854{
1855 int ret;
1856 struct bgp *bgp;
1857 struct peer *peer;
1858 struct peer_group *group;
1859
1860 bgp = vty->index;
1861
1862 peer = peer_lookup_vty (vty, argv[0]);
1863 if (! peer)
1864 return CMD_WARNING;
1865
1866 group = peer_group_lookup (bgp, argv[1]);
1867 if (! group)
1868 {
1869 vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE);
1870 return CMD_WARNING;
1871 }
1872
1873 ret = peer_group_unbind (bgp, peer, group, bgp_node_afi (vty),
1874 bgp_node_safi (vty));
1875
1876 return bgp_vty_return (vty, ret);
1877}
David Lamparter6b0655a2014-06-04 06:53:35 +02001878
paul94f2b392005-06-28 12:44:16 +00001879static int
paulfd79ac92004-10-13 05:06:08 +00001880peer_flag_modify_vty (struct vty *vty, const char *ip_str,
1881 u_int16_t flag, int set)
paul718e3742002-12-13 20:15:29 +00001882{
1883 int ret;
1884 struct peer *peer;
1885
1886 peer = peer_and_group_lookup_vty (vty, ip_str);
1887 if (! peer)
1888 return CMD_WARNING;
1889
1890 if (set)
1891 ret = peer_flag_set (peer, flag);
1892 else
1893 ret = peer_flag_unset (peer, flag);
1894
1895 return bgp_vty_return (vty, ret);
1896}
1897
paul94f2b392005-06-28 12:44:16 +00001898static int
paulfd79ac92004-10-13 05:06:08 +00001899peer_flag_set_vty (struct vty *vty, const char *ip_str, u_int16_t flag)
paul718e3742002-12-13 20:15:29 +00001900{
1901 return peer_flag_modify_vty (vty, ip_str, flag, 1);
1902}
1903
paul94f2b392005-06-28 12:44:16 +00001904static int
paulfd79ac92004-10-13 05:06:08 +00001905peer_flag_unset_vty (struct vty *vty, const char *ip_str, u_int16_t flag)
paul718e3742002-12-13 20:15:29 +00001906{
1907 return peer_flag_modify_vty (vty, ip_str, flag, 0);
1908}
1909
1910/* neighbor passive. */
1911DEFUN (neighbor_passive,
1912 neighbor_passive_cmd,
1913 NEIGHBOR_CMD2 "passive",
1914 NEIGHBOR_STR
1915 NEIGHBOR_ADDR_STR2
1916 "Don't send open messages to this neighbor\n")
1917{
1918 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_PASSIVE);
1919}
1920
1921DEFUN (no_neighbor_passive,
1922 no_neighbor_passive_cmd,
1923 NO_NEIGHBOR_CMD2 "passive",
1924 NO_STR
1925 NEIGHBOR_STR
1926 NEIGHBOR_ADDR_STR2
1927 "Don't send open messages to this neighbor\n")
1928{
1929 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_PASSIVE);
1930}
David Lamparter6b0655a2014-06-04 06:53:35 +02001931
paul718e3742002-12-13 20:15:29 +00001932/* neighbor shutdown. */
1933DEFUN (neighbor_shutdown,
1934 neighbor_shutdown_cmd,
1935 NEIGHBOR_CMD2 "shutdown",
1936 NEIGHBOR_STR
1937 NEIGHBOR_ADDR_STR2
1938 "Administratively shut down this neighbor\n")
1939{
1940 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_SHUTDOWN);
1941}
1942
1943DEFUN (no_neighbor_shutdown,
1944 no_neighbor_shutdown_cmd,
1945 NO_NEIGHBOR_CMD2 "shutdown",
1946 NO_STR
1947 NEIGHBOR_STR
1948 NEIGHBOR_ADDR_STR2
1949 "Administratively shut down this neighbor\n")
1950{
1951 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_SHUTDOWN);
1952}
David Lamparter6b0655a2014-06-04 06:53:35 +02001953
hassoc9502432005-02-01 22:01:48 +00001954/* Deprecated neighbor capability route-refresh. */
1955DEFUN_DEPRECATED (neighbor_capability_route_refresh,
1956 neighbor_capability_route_refresh_cmd,
1957 NEIGHBOR_CMD2 "capability route-refresh",
1958 NEIGHBOR_STR
1959 NEIGHBOR_ADDR_STR2
1960 "Advertise capability to the peer\n"
1961 "Advertise route-refresh capability to this neighbor\n")
paul718e3742002-12-13 20:15:29 +00001962{
hassoc9502432005-02-01 22:01:48 +00001963 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00001964}
1965
hassoc9502432005-02-01 22:01:48 +00001966DEFUN_DEPRECATED (no_neighbor_capability_route_refresh,
1967 no_neighbor_capability_route_refresh_cmd,
1968 NO_NEIGHBOR_CMD2 "capability route-refresh",
1969 NO_STR
1970 NEIGHBOR_STR
1971 NEIGHBOR_ADDR_STR2
1972 "Advertise capability to the peer\n"
1973 "Advertise route-refresh capability to this neighbor\n")
paul718e3742002-12-13 20:15:29 +00001974{
hassoc9502432005-02-01 22:01:48 +00001975 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00001976}
David Lamparter6b0655a2014-06-04 06:53:35 +02001977
paul718e3742002-12-13 20:15:29 +00001978/* neighbor capability dynamic. */
1979DEFUN (neighbor_capability_dynamic,
1980 neighbor_capability_dynamic_cmd,
1981 NEIGHBOR_CMD2 "capability dynamic",
1982 NEIGHBOR_STR
1983 NEIGHBOR_ADDR_STR2
1984 "Advertise capability to the peer\n"
1985 "Advertise dynamic capability to this neighbor\n")
1986{
1987 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY);
1988}
1989
1990DEFUN (no_neighbor_capability_dynamic,
1991 no_neighbor_capability_dynamic_cmd,
1992 NO_NEIGHBOR_CMD2 "capability dynamic",
1993 NO_STR
1994 NEIGHBOR_STR
1995 NEIGHBOR_ADDR_STR2
1996 "Advertise capability to the peer\n"
1997 "Advertise dynamic capability to this neighbor\n")
1998{
1999 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY);
2000}
David Lamparter6b0655a2014-06-04 06:53:35 +02002001
paul718e3742002-12-13 20:15:29 +00002002/* neighbor dont-capability-negotiate */
2003DEFUN (neighbor_dont_capability_negotiate,
2004 neighbor_dont_capability_negotiate_cmd,
2005 NEIGHBOR_CMD2 "dont-capability-negotiate",
2006 NEIGHBOR_STR
2007 NEIGHBOR_ADDR_STR2
2008 "Do not perform capability negotiation\n")
2009{
2010 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY);
2011}
2012
2013DEFUN (no_neighbor_dont_capability_negotiate,
2014 no_neighbor_dont_capability_negotiate_cmd,
2015 NO_NEIGHBOR_CMD2 "dont-capability-negotiate",
2016 NO_STR
2017 NEIGHBOR_STR
2018 NEIGHBOR_ADDR_STR2
2019 "Do not perform capability negotiation\n")
2020{
2021 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY);
2022}
David Lamparter6b0655a2014-06-04 06:53:35 +02002023
paul94f2b392005-06-28 12:44:16 +00002024static int
paulfd79ac92004-10-13 05:06:08 +00002025peer_af_flag_modify_vty (struct vty *vty, const char *peer_str, afi_t afi,
paulfee0f4c2004-09-13 05:12:46 +00002026 safi_t safi, u_int32_t flag, int set)
paul718e3742002-12-13 20:15:29 +00002027{
2028 int ret;
2029 struct peer *peer;
2030
2031 peer = peer_and_group_lookup_vty (vty, peer_str);
2032 if (! peer)
2033 return CMD_WARNING;
2034
2035 if (set)
2036 ret = peer_af_flag_set (peer, afi, safi, flag);
2037 else
2038 ret = peer_af_flag_unset (peer, afi, safi, flag);
2039
2040 return bgp_vty_return (vty, ret);
2041}
2042
paul94f2b392005-06-28 12:44:16 +00002043static int
paulfd79ac92004-10-13 05:06:08 +00002044peer_af_flag_set_vty (struct vty *vty, const char *peer_str, afi_t afi,
paulfee0f4c2004-09-13 05:12:46 +00002045 safi_t safi, u_int32_t flag)
paul718e3742002-12-13 20:15:29 +00002046{
2047 return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 1);
2048}
2049
paul94f2b392005-06-28 12:44:16 +00002050static int
paulfd79ac92004-10-13 05:06:08 +00002051peer_af_flag_unset_vty (struct vty *vty, const char *peer_str, afi_t afi,
paulfee0f4c2004-09-13 05:12:46 +00002052 safi_t safi, u_int32_t flag)
paul718e3742002-12-13 20:15:29 +00002053{
2054 return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 0);
2055}
David Lamparter6b0655a2014-06-04 06:53:35 +02002056
paul718e3742002-12-13 20:15:29 +00002057/* neighbor capability orf prefix-list. */
2058DEFUN (neighbor_capability_orf_prefix,
2059 neighbor_capability_orf_prefix_cmd,
2060 NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)",
2061 NEIGHBOR_STR
2062 NEIGHBOR_ADDR_STR2
2063 "Advertise capability to the peer\n"
2064 "Advertise ORF capability to the peer\n"
2065 "Advertise prefixlist ORF capability to this neighbor\n"
2066 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
2067 "Capability to RECEIVE the ORF from this neighbor\n"
2068 "Capability to SEND the ORF to this neighbor\n")
2069{
2070 u_int16_t flag = 0;
2071
2072 if (strncmp (argv[1], "s", 1) == 0)
2073 flag = PEER_FLAG_ORF_PREFIX_SM;
2074 else if (strncmp (argv[1], "r", 1) == 0)
2075 flag = PEER_FLAG_ORF_PREFIX_RM;
2076 else if (strncmp (argv[1], "b", 1) == 0)
2077 flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM;
2078 else
2079 return CMD_WARNING;
2080
2081 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2082 bgp_node_safi (vty), flag);
2083}
2084
2085DEFUN (no_neighbor_capability_orf_prefix,
2086 no_neighbor_capability_orf_prefix_cmd,
2087 NO_NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)",
2088 NO_STR
2089 NEIGHBOR_STR
2090 NEIGHBOR_ADDR_STR2
2091 "Advertise capability to the peer\n"
2092 "Advertise ORF capability to the peer\n"
2093 "Advertise prefixlist ORF capability to this neighbor\n"
2094 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
2095 "Capability to RECEIVE the ORF from this neighbor\n"
2096 "Capability to SEND the ORF to this neighbor\n")
2097{
2098 u_int16_t flag = 0;
2099
2100 if (strncmp (argv[1], "s", 1) == 0)
2101 flag = PEER_FLAG_ORF_PREFIX_SM;
2102 else if (strncmp (argv[1], "r", 1) == 0)
2103 flag = PEER_FLAG_ORF_PREFIX_RM;
2104 else if (strncmp (argv[1], "b", 1) == 0)
2105 flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM;
2106 else
2107 return CMD_WARNING;
2108
2109 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2110 bgp_node_safi (vty), flag);
2111}
David Lamparter6b0655a2014-06-04 06:53:35 +02002112
paul718e3742002-12-13 20:15:29 +00002113/* neighbor next-hop-self. */
2114DEFUN (neighbor_nexthop_self,
2115 neighbor_nexthop_self_cmd,
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002116 NEIGHBOR_CMD2 "next-hop-self {all}",
paul718e3742002-12-13 20:15:29 +00002117 NEIGHBOR_STR
2118 NEIGHBOR_ADDR_STR2
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002119 "Disable the next hop calculation for this neighbor\n"
2120 "Apply also to ibgp-learned routes when acting as a route reflector\n")
paul718e3742002-12-13 20:15:29 +00002121{
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002122 u_int32_t flags = PEER_FLAG_NEXTHOP_SELF, unset = 0;
2123 int rc;
2124
2125 /* Check if "all" is specified */
2126 if (argv[1] != NULL)
2127 flags |= PEER_FLAG_NEXTHOP_SELF_ALL;
2128 else
2129 unset |= PEER_FLAG_NEXTHOP_SELF_ALL;
2130
2131 rc = peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2132 bgp_node_safi (vty), flags);
2133 if ( rc == CMD_SUCCESS && unset )
2134 rc = peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2135 bgp_node_safi (vty), unset);
2136 return rc;
paul718e3742002-12-13 20:15:29 +00002137}
2138
2139DEFUN (no_neighbor_nexthop_self,
2140 no_neighbor_nexthop_self_cmd,
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002141 NO_NEIGHBOR_CMD2 "next-hop-self {all}",
paul718e3742002-12-13 20:15:29 +00002142 NO_STR
2143 NEIGHBOR_STR
2144 NEIGHBOR_ADDR_STR2
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002145 "Disable the next hop calculation for this neighbor\n"
2146 "Apply also to ibgp-learned routes when acting as a route reflector\n")
paul718e3742002-12-13 20:15:29 +00002147{
2148 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002149 bgp_node_safi (vty),
2150 PEER_FLAG_NEXTHOP_SELF|PEER_FLAG_NEXTHOP_SELF_ALL);
paul718e3742002-12-13 20:15:29 +00002151}
David Lamparter6b0655a2014-06-04 06:53:35 +02002152
paul718e3742002-12-13 20:15:29 +00002153/* neighbor remove-private-AS. */
2154DEFUN (neighbor_remove_private_as,
2155 neighbor_remove_private_as_cmd,
2156 NEIGHBOR_CMD2 "remove-private-AS",
2157 NEIGHBOR_STR
2158 NEIGHBOR_ADDR_STR2
2159 "Remove private AS number from outbound updates\n")
2160{
2161 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2162 bgp_node_safi (vty),
2163 PEER_FLAG_REMOVE_PRIVATE_AS);
2164}
2165
2166DEFUN (no_neighbor_remove_private_as,
2167 no_neighbor_remove_private_as_cmd,
2168 NO_NEIGHBOR_CMD2 "remove-private-AS",
2169 NO_STR
2170 NEIGHBOR_STR
2171 NEIGHBOR_ADDR_STR2
2172 "Remove private AS number from outbound updates\n")
2173{
2174 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2175 bgp_node_safi (vty),
2176 PEER_FLAG_REMOVE_PRIVATE_AS);
2177}
David Lamparter6b0655a2014-06-04 06:53:35 +02002178
paul718e3742002-12-13 20:15:29 +00002179/* neighbor send-community. */
2180DEFUN (neighbor_send_community,
2181 neighbor_send_community_cmd,
2182 NEIGHBOR_CMD2 "send-community",
2183 NEIGHBOR_STR
2184 NEIGHBOR_ADDR_STR2
2185 "Send Community attribute to this neighbor\n")
2186{
2187 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2188 bgp_node_safi (vty),
2189 PEER_FLAG_SEND_COMMUNITY);
2190}
2191
2192DEFUN (no_neighbor_send_community,
2193 no_neighbor_send_community_cmd,
2194 NO_NEIGHBOR_CMD2 "send-community",
2195 NO_STR
2196 NEIGHBOR_STR
2197 NEIGHBOR_ADDR_STR2
2198 "Send Community attribute to this neighbor\n")
2199{
2200 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2201 bgp_node_safi (vty),
2202 PEER_FLAG_SEND_COMMUNITY);
2203}
David Lamparter6b0655a2014-06-04 06:53:35 +02002204
paul718e3742002-12-13 20:15:29 +00002205/* neighbor send-community extended. */
2206DEFUN (neighbor_send_community_type,
2207 neighbor_send_community_type_cmd,
2208 NEIGHBOR_CMD2 "send-community (both|extended|standard)",
2209 NEIGHBOR_STR
2210 NEIGHBOR_ADDR_STR2
2211 "Send Community attribute to this neighbor\n"
2212 "Send Standard and Extended Community attributes\n"
2213 "Send Extended Community attributes\n"
2214 "Send Standard Community attributes\n")
2215{
2216 if (strncmp (argv[1], "s", 1) == 0)
2217 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2218 bgp_node_safi (vty),
2219 PEER_FLAG_SEND_COMMUNITY);
2220 if (strncmp (argv[1], "e", 1) == 0)
2221 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2222 bgp_node_safi (vty),
2223 PEER_FLAG_SEND_EXT_COMMUNITY);
2224
2225 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2226 bgp_node_safi (vty),
2227 (PEER_FLAG_SEND_COMMUNITY|
2228 PEER_FLAG_SEND_EXT_COMMUNITY));
2229}
2230
2231DEFUN (no_neighbor_send_community_type,
2232 no_neighbor_send_community_type_cmd,
2233 NO_NEIGHBOR_CMD2 "send-community (both|extended|standard)",
2234 NO_STR
2235 NEIGHBOR_STR
2236 NEIGHBOR_ADDR_STR2
2237 "Send Community attribute to this neighbor\n"
2238 "Send Standard and Extended Community attributes\n"
2239 "Send Extended Community attributes\n"
2240 "Send Standard Community attributes\n")
2241{
2242 if (strncmp (argv[1], "s", 1) == 0)
2243 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2244 bgp_node_safi (vty),
2245 PEER_FLAG_SEND_COMMUNITY);
2246 if (strncmp (argv[1], "e", 1) == 0)
2247 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2248 bgp_node_safi (vty),
2249 PEER_FLAG_SEND_EXT_COMMUNITY);
2250
2251 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2252 bgp_node_safi (vty),
2253 (PEER_FLAG_SEND_COMMUNITY |
2254 PEER_FLAG_SEND_EXT_COMMUNITY));
2255}
David Lamparter6b0655a2014-06-04 06:53:35 +02002256
paul718e3742002-12-13 20:15:29 +00002257/* neighbor soft-reconfig. */
2258DEFUN (neighbor_soft_reconfiguration,
2259 neighbor_soft_reconfiguration_cmd,
2260 NEIGHBOR_CMD2 "soft-reconfiguration inbound",
2261 NEIGHBOR_STR
2262 NEIGHBOR_ADDR_STR2
2263 "Per neighbor soft reconfiguration\n"
2264 "Allow inbound soft reconfiguration for this neighbor\n")
2265{
2266 return peer_af_flag_set_vty (vty, argv[0],
2267 bgp_node_afi (vty), bgp_node_safi (vty),
2268 PEER_FLAG_SOFT_RECONFIG);
2269}
2270
2271DEFUN (no_neighbor_soft_reconfiguration,
2272 no_neighbor_soft_reconfiguration_cmd,
2273 NO_NEIGHBOR_CMD2 "soft-reconfiguration inbound",
2274 NO_STR
2275 NEIGHBOR_STR
2276 NEIGHBOR_ADDR_STR2
2277 "Per neighbor soft reconfiguration\n"
2278 "Allow inbound soft reconfiguration for this neighbor\n")
2279{
2280 return peer_af_flag_unset_vty (vty, argv[0],
2281 bgp_node_afi (vty), bgp_node_safi (vty),
2282 PEER_FLAG_SOFT_RECONFIG);
2283}
David Lamparter6b0655a2014-06-04 06:53:35 +02002284
paul718e3742002-12-13 20:15:29 +00002285DEFUN (neighbor_route_reflector_client,
2286 neighbor_route_reflector_client_cmd,
2287 NEIGHBOR_CMD2 "route-reflector-client",
2288 NEIGHBOR_STR
2289 NEIGHBOR_ADDR_STR2
2290 "Configure a neighbor as Route Reflector client\n")
2291{
2292 struct peer *peer;
2293
2294
2295 peer = peer_and_group_lookup_vty (vty, argv[0]);
2296 if (! peer)
2297 return CMD_WARNING;
2298
2299 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2300 bgp_node_safi (vty),
2301 PEER_FLAG_REFLECTOR_CLIENT);
2302}
2303
2304DEFUN (no_neighbor_route_reflector_client,
2305 no_neighbor_route_reflector_client_cmd,
2306 NO_NEIGHBOR_CMD2 "route-reflector-client",
2307 NO_STR
2308 NEIGHBOR_STR
2309 NEIGHBOR_ADDR_STR2
2310 "Configure a neighbor as Route Reflector client\n")
2311{
2312 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2313 bgp_node_safi (vty),
2314 PEER_FLAG_REFLECTOR_CLIENT);
2315}
David Lamparter6b0655a2014-06-04 06:53:35 +02002316
paul94f2b392005-06-28 12:44:16 +00002317static int
paulfd79ac92004-10-13 05:06:08 +00002318peer_rsclient_set_vty (struct vty *vty, const char *peer_str,
2319 int afi, int safi)
paulfee0f4c2004-09-13 05:12:46 +00002320{
2321 int ret;
2322 struct bgp *bgp;
2323 struct peer *peer;
2324 struct peer_group *group;
paul1eb8ef22005-04-07 07:30:20 +00002325 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00002326 struct bgp_filter *pfilter;
2327 struct bgp_filter *gfilter;
Chris Caputo228da422009-07-18 05:44:03 +00002328 int locked_and_added = 0;
paulfee0f4c2004-09-13 05:12:46 +00002329
2330 bgp = vty->index;
2331
2332 peer = peer_and_group_lookup_vty (vty, peer_str);
2333 if ( ! peer )
2334 return CMD_WARNING;
2335
2336 /* If it is already a RS-Client, don't do anything. */
2337 if ( CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) )
2338 return CMD_SUCCESS;
2339
2340 if ( ! peer_rsclient_active (peer) )
paul200df112005-06-01 11:17:05 +00002341 {
2342 peer = peer_lock (peer); /* rsclient peer list reference */
2343 listnode_add_sort (bgp->rsclient, peer);
Chris Caputo228da422009-07-18 05:44:03 +00002344 locked_and_added = 1;
paul200df112005-06-01 11:17:05 +00002345 }
paulfee0f4c2004-09-13 05:12:46 +00002346
2347 ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2348 if (ret < 0)
Chris Caputo228da422009-07-18 05:44:03 +00002349 {
2350 if (locked_and_added)
2351 {
2352 listnode_delete (bgp->rsclient, peer);
2353 peer_unlock (peer); /* rsclient peer list reference */
2354 }
2355
2356 return bgp_vty_return (vty, ret);
2357 }
paulfee0f4c2004-09-13 05:12:46 +00002358
Paul Jakma64e580a2006-02-21 01:09:01 +00002359 peer->rib[afi][safi] = bgp_table_init (afi, safi);
paulfee0f4c2004-09-13 05:12:46 +00002360 peer->rib[afi][safi]->type = BGP_TABLE_RSCLIENT;
Chris Caputo228da422009-07-18 05:44:03 +00002361 /* RIB peer reference. Released when table is free'd in bgp_table_free. */
2362 peer->rib[afi][safi]->owner = peer_lock (peer);
paulfee0f4c2004-09-13 05:12:46 +00002363
2364 /* Check for existing 'network' and 'redistribute' routes. */
2365 bgp_check_local_routes_rsclient (peer, afi, safi);
2366
2367 /* Check for routes for peers configured with 'soft-reconfiguration'. */
2368 bgp_soft_reconfig_rsclient (peer, afi, safi);
2369
2370 if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP))
2371 {
2372 group = peer->group;
2373 gfilter = &peer->filter[afi][safi];
2374
paul1eb8ef22005-04-07 07:30:20 +00002375 for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00002376 {
2377 pfilter = &peer->filter[afi][safi];
2378
2379 /* Members of a non-RS-Client group should not be RS-Clients, as that
2380 is checked when the become part of the peer-group */
2381 ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2382 if (ret < 0)
2383 return bgp_vty_return (vty, ret);
2384
2385 /* Make peer's RIB point to group's RIB. */
2386 peer->rib[afi][safi] = group->conf->rib[afi][safi];
2387
2388 /* Import policy. */
2389 if (pfilter->map[RMAP_IMPORT].name)
2390 free (pfilter->map[RMAP_IMPORT].name);
2391 if (gfilter->map[RMAP_IMPORT].name)
2392 {
2393 pfilter->map[RMAP_IMPORT].name = strdup (gfilter->map[RMAP_IMPORT].name);
2394 pfilter->map[RMAP_IMPORT].map = gfilter->map[RMAP_IMPORT].map;
2395 }
2396 else
2397 {
2398 pfilter->map[RMAP_IMPORT].name = NULL;
2399 pfilter->map[RMAP_IMPORT].map =NULL;
2400 }
2401
2402 /* Export policy. */
2403 if (gfilter->map[RMAP_EXPORT].name && ! pfilter->map[RMAP_EXPORT].name)
2404 {
2405 pfilter->map[RMAP_EXPORT].name = strdup (gfilter->map[RMAP_EXPORT].name);
2406 pfilter->map[RMAP_EXPORT].map = gfilter->map[RMAP_EXPORT].map;
2407 }
2408 }
2409 }
2410 return CMD_SUCCESS;
2411}
2412
paul94f2b392005-06-28 12:44:16 +00002413static int
paulfd79ac92004-10-13 05:06:08 +00002414peer_rsclient_unset_vty (struct vty *vty, const char *peer_str,
2415 int afi, int safi)
paulfee0f4c2004-09-13 05:12:46 +00002416{
2417 int ret;
2418 struct bgp *bgp;
2419 struct peer *peer;
2420 struct peer_group *group;
paul1eb8ef22005-04-07 07:30:20 +00002421 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00002422
2423 bgp = vty->index;
2424
2425 peer = peer_and_group_lookup_vty (vty, peer_str);
2426 if ( ! peer )
2427 return CMD_WARNING;
2428
2429 /* If it is not a RS-Client, don't do anything. */
2430 if ( ! CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) )
2431 return CMD_SUCCESS;
2432
2433 if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP))
2434 {
2435 group = peer->group;
2436
paul1eb8ef22005-04-07 07:30:20 +00002437 for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00002438 {
2439 ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2440 if (ret < 0)
2441 return bgp_vty_return (vty, ret);
2442
2443 peer->rib[afi][safi] = NULL;
2444 }
2445
2446 peer = group->conf;
2447 }
2448
2449 ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2450 if (ret < 0)
2451 return bgp_vty_return (vty, ret);
2452
2453 if ( ! peer_rsclient_active (peer) )
paul200df112005-06-01 11:17:05 +00002454 {
Chris Caputo228da422009-07-18 05:44:03 +00002455 bgp_clear_route (peer, afi, safi, BGP_CLEAR_ROUTE_MY_RSCLIENT);
paul200df112005-06-01 11:17:05 +00002456 listnode_delete (bgp->rsclient, peer);
Chris Caputo228da422009-07-18 05:44:03 +00002457 peer_unlock (peer); /* peer bgp rsclient reference */
paul200df112005-06-01 11:17:05 +00002458 }
paulfee0f4c2004-09-13 05:12:46 +00002459
Paul Jakmab608d5b2008-07-02 02:12:07 +00002460 bgp_table_finish (&peer->rib[bgp_node_afi(vty)][bgp_node_safi(vty)]);
paulfee0f4c2004-09-13 05:12:46 +00002461
2462 return CMD_SUCCESS;
2463}
David Lamparter6b0655a2014-06-04 06:53:35 +02002464
paul718e3742002-12-13 20:15:29 +00002465/* neighbor route-server-client. */
2466DEFUN (neighbor_route_server_client,
2467 neighbor_route_server_client_cmd,
2468 NEIGHBOR_CMD2 "route-server-client",
2469 NEIGHBOR_STR
2470 NEIGHBOR_ADDR_STR2
2471 "Configure a neighbor as Route Server client\n")
2472{
paulfee0f4c2004-09-13 05:12:46 +00002473 return peer_rsclient_set_vty (vty, argv[0], bgp_node_afi(vty),
2474 bgp_node_safi(vty));
paul718e3742002-12-13 20:15:29 +00002475}
2476
2477DEFUN (no_neighbor_route_server_client,
2478 no_neighbor_route_server_client_cmd,
2479 NO_NEIGHBOR_CMD2 "route-server-client",
2480 NO_STR
2481 NEIGHBOR_STR
2482 NEIGHBOR_ADDR_STR2
2483 "Configure a neighbor as Route Server client\n")
2484{
paulfee0f4c2004-09-13 05:12:46 +00002485 return peer_rsclient_unset_vty (vty, argv[0], bgp_node_afi(vty),
2486 bgp_node_safi(vty));
2487}
David Lamparter6b0655a2014-06-04 06:53:35 +02002488
paulfee0f4c2004-09-13 05:12:46 +00002489DEFUN (neighbor_nexthop_local_unchanged,
2490 neighbor_nexthop_local_unchanged_cmd,
2491 NEIGHBOR_CMD2 "nexthop-local unchanged",
2492 NEIGHBOR_STR
2493 NEIGHBOR_ADDR_STR2
2494 "Configure treatment of outgoing link-local nexthop attribute\n"
2495 "Leave link-local nexthop unchanged for this peer\n")
2496{
2497 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2498 bgp_node_safi (vty),
2499 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED );
2500}
David Lamparter6b0655a2014-06-04 06:53:35 +02002501
paulfee0f4c2004-09-13 05:12:46 +00002502DEFUN (no_neighbor_nexthop_local_unchanged,
2503 no_neighbor_nexthop_local_unchanged_cmd,
2504 NO_NEIGHBOR_CMD2 "nexthop-local unchanged",
2505 NO_STR
2506 NEIGHBOR_STR
2507 NEIGHBOR_ADDR_STR2
2508 "Configure treatment of outgoing link-local-nexthop attribute\n"
2509 "Leave link-local nexthop unchanged for this peer\n")
2510{
paul718e3742002-12-13 20:15:29 +00002511 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2512 bgp_node_safi (vty),
paulfee0f4c2004-09-13 05:12:46 +00002513 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED );
paul718e3742002-12-13 20:15:29 +00002514}
David Lamparter6b0655a2014-06-04 06:53:35 +02002515
paul718e3742002-12-13 20:15:29 +00002516DEFUN (neighbor_attr_unchanged,
2517 neighbor_attr_unchanged_cmd,
2518 NEIGHBOR_CMD2 "attribute-unchanged",
2519 NEIGHBOR_STR
2520 NEIGHBOR_ADDR_STR2
2521 "BGP attribute is propagated unchanged to this neighbor\n")
2522{
2523 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2524 bgp_node_safi (vty),
2525 (PEER_FLAG_AS_PATH_UNCHANGED |
2526 PEER_FLAG_NEXTHOP_UNCHANGED |
2527 PEER_FLAG_MED_UNCHANGED));
2528}
2529
2530DEFUN (neighbor_attr_unchanged1,
2531 neighbor_attr_unchanged1_cmd,
2532 NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)",
2533 NEIGHBOR_STR
2534 NEIGHBOR_ADDR_STR2
2535 "BGP attribute is propagated unchanged to this neighbor\n"
2536 "As-path attribute\n"
2537 "Nexthop attribute\n"
2538 "Med attribute\n")
2539{
2540 u_int16_t flags = 0;
2541
2542 if (strncmp (argv[1], "as-path", 1) == 0)
2543 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2544 else if (strncmp (argv[1], "next-hop", 1) == 0)
2545 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2546 else if (strncmp (argv[1], "med", 1) == 0)
2547 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2548
2549 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2550 bgp_node_safi (vty), flags);
2551}
2552
2553DEFUN (neighbor_attr_unchanged2,
2554 neighbor_attr_unchanged2_cmd,
2555 NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)",
2556 NEIGHBOR_STR
2557 NEIGHBOR_ADDR_STR2
2558 "BGP attribute is propagated unchanged to this neighbor\n"
2559 "As-path attribute\n"
2560 "Nexthop attribute\n"
2561 "Med attribute\n")
2562{
2563 u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED;
2564
2565 if (strncmp (argv[1], "next-hop", 1) == 0)
2566 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2567 else if (strncmp (argv[1], "med", 1) == 0)
2568 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2569
2570 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2571 bgp_node_safi (vty), flags);
2572
2573}
2574
2575DEFUN (neighbor_attr_unchanged3,
2576 neighbor_attr_unchanged3_cmd,
2577 NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)",
2578 NEIGHBOR_STR
2579 NEIGHBOR_ADDR_STR2
2580 "BGP attribute is propagated unchanged to this neighbor\n"
2581 "Nexthop attribute\n"
2582 "As-path attribute\n"
2583 "Med attribute\n")
2584{
2585 u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED;
2586
2587 if (strncmp (argv[1], "as-path", 1) == 0)
2588 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2589 else if (strncmp (argv[1], "med", 1) == 0)
2590 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2591
2592 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2593 bgp_node_safi (vty), flags);
2594}
2595
2596DEFUN (neighbor_attr_unchanged4,
2597 neighbor_attr_unchanged4_cmd,
2598 NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)",
2599 NEIGHBOR_STR
2600 NEIGHBOR_ADDR_STR2
2601 "BGP attribute is propagated unchanged to this neighbor\n"
2602 "Med attribute\n"
2603 "As-path attribute\n"
2604 "Nexthop attribute\n")
2605{
2606 u_int16_t flags = PEER_FLAG_MED_UNCHANGED;
2607
2608 if (strncmp (argv[1], "as-path", 1) == 0)
2609 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2610 else if (strncmp (argv[1], "next-hop", 1) == 0)
2611 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2612
2613 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2614 bgp_node_safi (vty), flags);
2615}
2616
2617ALIAS (neighbor_attr_unchanged,
2618 neighbor_attr_unchanged5_cmd,
2619 NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med",
2620 NEIGHBOR_STR
2621 NEIGHBOR_ADDR_STR2
2622 "BGP attribute is propagated unchanged to this neighbor\n"
2623 "As-path attribute\n"
2624 "Nexthop attribute\n"
2625 "Med attribute\n")
2626
2627ALIAS (neighbor_attr_unchanged,
2628 neighbor_attr_unchanged6_cmd,
2629 NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop",
2630 NEIGHBOR_STR
2631 NEIGHBOR_ADDR_STR2
2632 "BGP attribute is propagated unchanged to this neighbor\n"
2633 "As-path attribute\n"
2634 "Med attribute\n"
2635 "Nexthop attribute\n")
2636
2637ALIAS (neighbor_attr_unchanged,
2638 neighbor_attr_unchanged7_cmd,
2639 NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path",
2640 NEIGHBOR_STR
2641 NEIGHBOR_ADDR_STR2
2642 "BGP attribute is propagated unchanged to this neighbor\n"
2643 "Nexthop attribute\n"
2644 "Med attribute\n"
2645 "As-path attribute\n")
2646
2647ALIAS (neighbor_attr_unchanged,
2648 neighbor_attr_unchanged8_cmd,
2649 NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med",
2650 NEIGHBOR_STR
2651 NEIGHBOR_ADDR_STR2
2652 "BGP attribute is propagated unchanged to this neighbor\n"
2653 "Nexthop attribute\n"
2654 "As-path attribute\n"
2655 "Med attribute\n")
2656
2657ALIAS (neighbor_attr_unchanged,
2658 neighbor_attr_unchanged9_cmd,
2659 NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path",
2660 NEIGHBOR_STR
2661 NEIGHBOR_ADDR_STR2
2662 "BGP attribute is propagated unchanged to this neighbor\n"
2663 "Med attribute\n"
2664 "Nexthop attribute\n"
2665 "As-path attribute\n")
2666
2667ALIAS (neighbor_attr_unchanged,
2668 neighbor_attr_unchanged10_cmd,
2669 NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop",
2670 NEIGHBOR_STR
2671 NEIGHBOR_ADDR_STR2
2672 "BGP attribute is propagated unchanged to this neighbor\n"
2673 "Med attribute\n"
2674 "As-path attribute\n"
2675 "Nexthop attribute\n")
2676
2677DEFUN (no_neighbor_attr_unchanged,
2678 no_neighbor_attr_unchanged_cmd,
2679 NO_NEIGHBOR_CMD2 "attribute-unchanged",
2680 NO_STR
2681 NEIGHBOR_STR
2682 NEIGHBOR_ADDR_STR2
2683 "BGP attribute is propagated unchanged to this neighbor\n")
2684{
2685 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2686 bgp_node_safi (vty),
2687 (PEER_FLAG_AS_PATH_UNCHANGED |
2688 PEER_FLAG_NEXTHOP_UNCHANGED |
2689 PEER_FLAG_MED_UNCHANGED));
2690}
2691
2692DEFUN (no_neighbor_attr_unchanged1,
2693 no_neighbor_attr_unchanged1_cmd,
2694 NO_NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)",
2695 NO_STR
2696 NEIGHBOR_STR
2697 NEIGHBOR_ADDR_STR2
2698 "BGP attribute is propagated unchanged to this neighbor\n"
2699 "As-path attribute\n"
2700 "Nexthop attribute\n"
2701 "Med attribute\n")
2702{
2703 u_int16_t flags = 0;
2704
2705 if (strncmp (argv[1], "as-path", 1) == 0)
2706 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2707 else if (strncmp (argv[1], "next-hop", 1) == 0)
2708 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2709 else if (strncmp (argv[1], "med", 1) == 0)
2710 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2711
2712 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2713 bgp_node_safi (vty), flags);
2714}
2715
2716DEFUN (no_neighbor_attr_unchanged2,
2717 no_neighbor_attr_unchanged2_cmd,
2718 NO_NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)",
2719 NO_STR
2720 NEIGHBOR_STR
2721 NEIGHBOR_ADDR_STR2
2722 "BGP attribute is propagated unchanged to this neighbor\n"
2723 "As-path attribute\n"
2724 "Nexthop attribute\n"
2725 "Med attribute\n")
2726{
2727 u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED;
2728
2729 if (strncmp (argv[1], "next-hop", 1) == 0)
2730 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2731 else if (strncmp (argv[1], "med", 1) == 0)
2732 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2733
2734 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2735 bgp_node_safi (vty), flags);
2736}
2737
2738DEFUN (no_neighbor_attr_unchanged3,
2739 no_neighbor_attr_unchanged3_cmd,
2740 NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)",
2741 NO_STR
2742 NEIGHBOR_STR
2743 NEIGHBOR_ADDR_STR2
2744 "BGP attribute is propagated unchanged to this neighbor\n"
2745 "Nexthop attribute\n"
2746 "As-path attribute\n"
2747 "Med attribute\n")
2748{
2749 u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED;
2750
2751 if (strncmp (argv[1], "as-path", 1) == 0)
2752 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2753 else if (strncmp (argv[1], "med", 1) == 0)
2754 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2755
2756 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2757 bgp_node_safi (vty), flags);
2758}
2759
2760DEFUN (no_neighbor_attr_unchanged4,
2761 no_neighbor_attr_unchanged4_cmd,
2762 NO_NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)",
2763 NO_STR
2764 NEIGHBOR_STR
2765 NEIGHBOR_ADDR_STR2
2766 "BGP attribute is propagated unchanged to this neighbor\n"
2767 "Med attribute\n"
2768 "As-path attribute\n"
2769 "Nexthop attribute\n")
2770{
2771 u_int16_t flags = PEER_FLAG_MED_UNCHANGED;
2772
2773 if (strncmp (argv[1], "as-path", 1) == 0)
2774 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2775 else if (strncmp (argv[1], "next-hop", 1) == 0)
2776 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2777
2778 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2779 bgp_node_safi (vty), flags);
2780}
2781
2782ALIAS (no_neighbor_attr_unchanged,
2783 no_neighbor_attr_unchanged5_cmd,
2784 NO_NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med",
2785 NO_STR
2786 NEIGHBOR_STR
2787 NEIGHBOR_ADDR_STR2
2788 "BGP attribute is propagated unchanged to this neighbor\n"
2789 "As-path attribute\n"
2790 "Nexthop attribute\n"
2791 "Med attribute\n")
2792
2793ALIAS (no_neighbor_attr_unchanged,
2794 no_neighbor_attr_unchanged6_cmd,
2795 NO_NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop",
2796 NO_STR
2797 NEIGHBOR_STR
2798 NEIGHBOR_ADDR_STR2
2799 "BGP attribute is propagated unchanged to this neighbor\n"
2800 "As-path attribute\n"
2801 "Med attribute\n"
2802 "Nexthop attribute\n")
2803
2804ALIAS (no_neighbor_attr_unchanged,
2805 no_neighbor_attr_unchanged7_cmd,
2806 NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path",
2807 NO_STR
2808 NEIGHBOR_STR
2809 NEIGHBOR_ADDR_STR2
2810 "BGP attribute is propagated unchanged to this neighbor\n"
2811 "Nexthop attribute\n"
2812 "Med attribute\n"
2813 "As-path attribute\n")
2814
2815ALIAS (no_neighbor_attr_unchanged,
2816 no_neighbor_attr_unchanged8_cmd,
2817 NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med",
2818 NO_STR
2819 NEIGHBOR_STR
2820 NEIGHBOR_ADDR_STR2
2821 "BGP attribute is propagated unchanged to this neighbor\n"
2822 "Nexthop attribute\n"
2823 "As-path attribute\n"
2824 "Med attribute\n")
2825
2826ALIAS (no_neighbor_attr_unchanged,
2827 no_neighbor_attr_unchanged9_cmd,
2828 NO_NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path",
2829 NO_STR
2830 NEIGHBOR_STR
2831 NEIGHBOR_ADDR_STR2
2832 "BGP attribute is propagated unchanged to this neighbor\n"
2833 "Med attribute\n"
2834 "Nexthop attribute\n"
2835 "As-path attribute\n")
2836
2837ALIAS (no_neighbor_attr_unchanged,
2838 no_neighbor_attr_unchanged10_cmd,
2839 NO_NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop",
2840 NO_STR
2841 NEIGHBOR_STR
2842 NEIGHBOR_ADDR_STR2
2843 "BGP attribute is propagated unchanged to this neighbor\n"
2844 "Med attribute\n"
2845 "As-path attribute\n"
2846 "Nexthop attribute\n")
2847
2848/* For old version Zebra compatibility. */
hassodd4c5932005-02-02 17:15:34 +00002849DEFUN_DEPRECATED (neighbor_transparent_as,
2850 neighbor_transparent_as_cmd,
2851 NEIGHBOR_CMD "transparent-as",
2852 NEIGHBOR_STR
2853 NEIGHBOR_ADDR_STR
2854 "Do not append my AS number even peer is EBGP peer\n")
paul718e3742002-12-13 20:15:29 +00002855{
2856 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2857 bgp_node_safi (vty),
2858 PEER_FLAG_AS_PATH_UNCHANGED);
2859}
2860
hassodd4c5932005-02-02 17:15:34 +00002861DEFUN_DEPRECATED (neighbor_transparent_nexthop,
2862 neighbor_transparent_nexthop_cmd,
2863 NEIGHBOR_CMD "transparent-nexthop",
2864 NEIGHBOR_STR
2865 NEIGHBOR_ADDR_STR
2866 "Do not change nexthop even peer is EBGP peer\n")
paul718e3742002-12-13 20:15:29 +00002867{
2868 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2869 bgp_node_safi (vty),
2870 PEER_FLAG_NEXTHOP_UNCHANGED);
2871}
David Lamparter6b0655a2014-06-04 06:53:35 +02002872
paul718e3742002-12-13 20:15:29 +00002873/* EBGP multihop configuration. */
paul94f2b392005-06-28 12:44:16 +00002874static int
paulfd79ac92004-10-13 05:06:08 +00002875peer_ebgp_multihop_set_vty (struct vty *vty, const char *ip_str,
2876 const char *ttl_str)
paul718e3742002-12-13 20:15:29 +00002877{
2878 struct peer *peer;
paulfd79ac92004-10-13 05:06:08 +00002879 unsigned int ttl;
paul718e3742002-12-13 20:15:29 +00002880
2881 peer = peer_and_group_lookup_vty (vty, ip_str);
2882 if (! peer)
2883 return CMD_WARNING;
2884
2885 if (! ttl_str)
2886 ttl = TTL_MAX;
2887 else
2888 VTY_GET_INTEGER_RANGE ("TTL", ttl, ttl_str, 1, 255);
2889
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00002890 return bgp_vty_return (vty, peer_ebgp_multihop_set (peer, ttl));
paul718e3742002-12-13 20:15:29 +00002891}
2892
paul94f2b392005-06-28 12:44:16 +00002893static int
paulfd79ac92004-10-13 05:06:08 +00002894peer_ebgp_multihop_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00002895{
2896 struct peer *peer;
2897
2898 peer = peer_and_group_lookup_vty (vty, ip_str);
2899 if (! peer)
2900 return CMD_WARNING;
2901
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00002902 return bgp_vty_return (vty, peer_ebgp_multihop_unset (peer));
paul718e3742002-12-13 20:15:29 +00002903}
2904
2905/* neighbor ebgp-multihop. */
2906DEFUN (neighbor_ebgp_multihop,
2907 neighbor_ebgp_multihop_cmd,
2908 NEIGHBOR_CMD2 "ebgp-multihop",
2909 NEIGHBOR_STR
2910 NEIGHBOR_ADDR_STR2
2911 "Allow EBGP neighbors not on directly connected networks\n")
2912{
2913 return peer_ebgp_multihop_set_vty (vty, argv[0], NULL);
2914}
2915
2916DEFUN (neighbor_ebgp_multihop_ttl,
2917 neighbor_ebgp_multihop_ttl_cmd,
2918 NEIGHBOR_CMD2 "ebgp-multihop <1-255>",
2919 NEIGHBOR_STR
2920 NEIGHBOR_ADDR_STR2
2921 "Allow EBGP neighbors not on directly connected networks\n"
2922 "maximum hop count\n")
2923{
2924 return peer_ebgp_multihop_set_vty (vty, argv[0], argv[1]);
2925}
2926
2927DEFUN (no_neighbor_ebgp_multihop,
2928 no_neighbor_ebgp_multihop_cmd,
2929 NO_NEIGHBOR_CMD2 "ebgp-multihop",
2930 NO_STR
2931 NEIGHBOR_STR
2932 NEIGHBOR_ADDR_STR2
2933 "Allow EBGP neighbors not on directly connected networks\n")
2934{
2935 return peer_ebgp_multihop_unset_vty (vty, argv[0]);
2936}
2937
2938ALIAS (no_neighbor_ebgp_multihop,
2939 no_neighbor_ebgp_multihop_ttl_cmd,
2940 NO_NEIGHBOR_CMD2 "ebgp-multihop <1-255>",
2941 NO_STR
2942 NEIGHBOR_STR
2943 NEIGHBOR_ADDR_STR2
2944 "Allow EBGP neighbors not on directly connected networks\n"
2945 "maximum hop count\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02002946
hasso6ffd2072005-02-02 14:50:11 +00002947/* disable-connected-check */
2948DEFUN (neighbor_disable_connected_check,
2949 neighbor_disable_connected_check_cmd,
2950 NEIGHBOR_CMD2 "disable-connected-check",
2951 NEIGHBOR_STR
2952 NEIGHBOR_ADDR_STR2
2953 "one-hop away EBGP peer using loopback address\n")
2954{
2955 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK);
2956}
2957
2958DEFUN (no_neighbor_disable_connected_check,
2959 no_neighbor_disable_connected_check_cmd,
2960 NO_NEIGHBOR_CMD2 "disable-connected-check",
2961 NO_STR
2962 NEIGHBOR_STR
2963 NEIGHBOR_ADDR_STR2
2964 "one-hop away EBGP peer using loopback address\n")
2965{
2966 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK);
2967}
2968
paul718e3742002-12-13 20:15:29 +00002969/* Enforce multihop. */
hasso6ffd2072005-02-02 14:50:11 +00002970ALIAS (neighbor_disable_connected_check,
paul718e3742002-12-13 20:15:29 +00002971 neighbor_enforce_multihop_cmd,
2972 NEIGHBOR_CMD2 "enforce-multihop",
2973 NEIGHBOR_STR
2974 NEIGHBOR_ADDR_STR2
paule8e19462006-01-19 20:16:55 +00002975 "Enforce EBGP neighbors perform multihop\n")
paul718e3742002-12-13 20:15:29 +00002976
hasso6ffd2072005-02-02 14:50:11 +00002977/* Enforce multihop. */
2978ALIAS (no_neighbor_disable_connected_check,
paul718e3742002-12-13 20:15:29 +00002979 no_neighbor_enforce_multihop_cmd,
2980 NO_NEIGHBOR_CMD2 "enforce-multihop",
2981 NO_STR
2982 NEIGHBOR_STR
2983 NEIGHBOR_ADDR_STR2
paule8e19462006-01-19 20:16:55 +00002984 "Enforce EBGP neighbors perform multihop\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02002985
paul718e3742002-12-13 20:15:29 +00002986DEFUN (neighbor_description,
2987 neighbor_description_cmd,
2988 NEIGHBOR_CMD2 "description .LINE",
2989 NEIGHBOR_STR
2990 NEIGHBOR_ADDR_STR2
2991 "Neighbor specific description\n"
2992 "Up to 80 characters describing this neighbor\n")
2993{
2994 struct peer *peer;
paul718e3742002-12-13 20:15:29 +00002995 char *str;
paul718e3742002-12-13 20:15:29 +00002996
2997 peer = peer_and_group_lookup_vty (vty, argv[0]);
2998 if (! peer)
2999 return CMD_WARNING;
3000
3001 if (argc == 1)
3002 return CMD_SUCCESS;
3003
ajs3b8b1852005-01-29 18:19:13 +00003004 str = argv_concat(argv, argc, 1);
paul718e3742002-12-13 20:15:29 +00003005
3006 peer_description_set (peer, str);
3007
ajs3b8b1852005-01-29 18:19:13 +00003008 XFREE (MTYPE_TMP, str);
paul718e3742002-12-13 20:15:29 +00003009
3010 return CMD_SUCCESS;
3011}
3012
3013DEFUN (no_neighbor_description,
3014 no_neighbor_description_cmd,
3015 NO_NEIGHBOR_CMD2 "description",
3016 NO_STR
3017 NEIGHBOR_STR
3018 NEIGHBOR_ADDR_STR2
3019 "Neighbor specific description\n")
3020{
3021 struct peer *peer;
3022
3023 peer = peer_and_group_lookup_vty (vty, argv[0]);
3024 if (! peer)
3025 return CMD_WARNING;
3026
3027 peer_description_unset (peer);
3028
3029 return CMD_SUCCESS;
3030}
3031
3032ALIAS (no_neighbor_description,
3033 no_neighbor_description_val_cmd,
3034 NO_NEIGHBOR_CMD2 "description .LINE",
3035 NO_STR
3036 NEIGHBOR_STR
3037 NEIGHBOR_ADDR_STR2
3038 "Neighbor specific description\n"
3039 "Up to 80 characters describing this neighbor\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003040
paul718e3742002-12-13 20:15:29 +00003041/* Neighbor update-source. */
paul94f2b392005-06-28 12:44:16 +00003042static int
paulfd79ac92004-10-13 05:06:08 +00003043peer_update_source_vty (struct vty *vty, const char *peer_str,
3044 const char *source_str)
paul718e3742002-12-13 20:15:29 +00003045{
3046 struct peer *peer;
paul718e3742002-12-13 20:15:29 +00003047
3048 peer = peer_and_group_lookup_vty (vty, peer_str);
3049 if (! peer)
3050 return CMD_WARNING;
3051
3052 if (source_str)
3053 {
Jorge Boncompte [DTI2]c63b83f2012-04-10 16:57:24 +02003054 union sockunion su;
3055 int ret = str2sockunion (source_str, &su);
3056
3057 if (ret == 0)
3058 peer_update_source_addr_set (peer, &su);
paul718e3742002-12-13 20:15:29 +00003059 else
3060 peer_update_source_if_set (peer, source_str);
3061 }
3062 else
3063 peer_update_source_unset (peer);
3064
3065 return CMD_SUCCESS;
3066}
3067
Paul Jakma9a1a3312009-07-27 12:27:55 +01003068#define BGP_UPDATE_SOURCE_STR "(A.B.C.D|X:X::X:X|WORD)"
Paul Jakma369688c2006-05-23 22:27:55 +00003069#define BGP_UPDATE_SOURCE_HELP_STR \
3070 "IPv4 address\n" \
Paul Jakma9a1a3312009-07-27 12:27:55 +01003071 "IPv6 address\n" \
3072 "Interface name (requires zebra to be running)\n"
Paul Jakma369688c2006-05-23 22:27:55 +00003073
paul718e3742002-12-13 20:15:29 +00003074DEFUN (neighbor_update_source,
3075 neighbor_update_source_cmd,
Paul Jakma369688c2006-05-23 22:27:55 +00003076 NEIGHBOR_CMD2 "update-source " BGP_UPDATE_SOURCE_STR,
paul718e3742002-12-13 20:15:29 +00003077 NEIGHBOR_STR
3078 NEIGHBOR_ADDR_STR2
3079 "Source of routing updates\n"
Paul Jakma369688c2006-05-23 22:27:55 +00003080 BGP_UPDATE_SOURCE_HELP_STR)
paul718e3742002-12-13 20:15:29 +00003081{
3082 return peer_update_source_vty (vty, argv[0], argv[1]);
3083}
3084
3085DEFUN (no_neighbor_update_source,
3086 no_neighbor_update_source_cmd,
3087 NO_NEIGHBOR_CMD2 "update-source",
3088 NO_STR
3089 NEIGHBOR_STR
3090 NEIGHBOR_ADDR_STR2
Paul Jakma369688c2006-05-23 22:27:55 +00003091 "Source of routing updates\n")
paul718e3742002-12-13 20:15:29 +00003092{
3093 return peer_update_source_vty (vty, argv[0], NULL);
3094}
David Lamparter6b0655a2014-06-04 06:53:35 +02003095
paul94f2b392005-06-28 12:44:16 +00003096static int
paulfd79ac92004-10-13 05:06:08 +00003097peer_default_originate_set_vty (struct vty *vty, const char *peer_str,
3098 afi_t afi, safi_t safi,
3099 const char *rmap, int set)
paul718e3742002-12-13 20:15:29 +00003100{
3101 int ret;
3102 struct peer *peer;
3103
3104 peer = peer_and_group_lookup_vty (vty, peer_str);
3105 if (! peer)
3106 return CMD_WARNING;
3107
3108 if (set)
3109 ret = peer_default_originate_set (peer, afi, safi, rmap);
3110 else
3111 ret = peer_default_originate_unset (peer, afi, safi);
3112
3113 return bgp_vty_return (vty, ret);
3114}
3115
3116/* neighbor default-originate. */
3117DEFUN (neighbor_default_originate,
3118 neighbor_default_originate_cmd,
3119 NEIGHBOR_CMD2 "default-originate",
3120 NEIGHBOR_STR
3121 NEIGHBOR_ADDR_STR2
3122 "Originate default route to this neighbor\n")
3123{
3124 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
3125 bgp_node_safi (vty), NULL, 1);
3126}
3127
3128DEFUN (neighbor_default_originate_rmap,
3129 neighbor_default_originate_rmap_cmd,
3130 NEIGHBOR_CMD2 "default-originate route-map WORD",
3131 NEIGHBOR_STR
3132 NEIGHBOR_ADDR_STR2
3133 "Originate default route to this neighbor\n"
3134 "Route-map to specify criteria to originate default\n"
3135 "route-map name\n")
3136{
3137 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
3138 bgp_node_safi (vty), argv[1], 1);
3139}
3140
3141DEFUN (no_neighbor_default_originate,
3142 no_neighbor_default_originate_cmd,
3143 NO_NEIGHBOR_CMD2 "default-originate",
3144 NO_STR
3145 NEIGHBOR_STR
3146 NEIGHBOR_ADDR_STR2
3147 "Originate default route to this neighbor\n")
3148{
3149 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
3150 bgp_node_safi (vty), NULL, 0);
3151}
3152
3153ALIAS (no_neighbor_default_originate,
3154 no_neighbor_default_originate_rmap_cmd,
3155 NO_NEIGHBOR_CMD2 "default-originate route-map WORD",
3156 NO_STR
3157 NEIGHBOR_STR
3158 NEIGHBOR_ADDR_STR2
3159 "Originate default route to this neighbor\n"
3160 "Route-map to specify criteria to originate default\n"
3161 "route-map name\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003162
paul718e3742002-12-13 20:15:29 +00003163/* Set neighbor's BGP port. */
paul94f2b392005-06-28 12:44:16 +00003164static int
paulfd79ac92004-10-13 05:06:08 +00003165peer_port_vty (struct vty *vty, const char *ip_str, int afi,
3166 const char *port_str)
paul718e3742002-12-13 20:15:29 +00003167{
3168 struct peer *peer;
3169 u_int16_t port;
3170 struct servent *sp;
3171
3172 peer = peer_lookup_vty (vty, ip_str);
3173 if (! peer)
3174 return CMD_WARNING;
3175
3176 if (! port_str)
3177 {
3178 sp = getservbyname ("bgp", "tcp");
3179 port = (sp == NULL) ? BGP_PORT_DEFAULT : ntohs (sp->s_port);
3180 }
3181 else
3182 {
3183 VTY_GET_INTEGER("port", port, port_str);
3184 }
3185
3186 peer_port_set (peer, port);
3187
3188 return CMD_SUCCESS;
3189}
3190
hassof4184462005-02-01 20:13:16 +00003191/* Set specified peer's BGP port. */
paul718e3742002-12-13 20:15:29 +00003192DEFUN (neighbor_port,
3193 neighbor_port_cmd,
3194 NEIGHBOR_CMD "port <0-65535>",
3195 NEIGHBOR_STR
3196 NEIGHBOR_ADDR_STR
3197 "Neighbor's BGP port\n"
3198 "TCP port number\n")
3199{
3200 return peer_port_vty (vty, argv[0], AFI_IP, argv[1]);
3201}
3202
3203DEFUN (no_neighbor_port,
3204 no_neighbor_port_cmd,
3205 NO_NEIGHBOR_CMD "port",
3206 NO_STR
3207 NEIGHBOR_STR
3208 NEIGHBOR_ADDR_STR
3209 "Neighbor's BGP port\n")
3210{
3211 return peer_port_vty (vty, argv[0], AFI_IP, NULL);
3212}
3213
3214ALIAS (no_neighbor_port,
3215 no_neighbor_port_val_cmd,
3216 NO_NEIGHBOR_CMD "port <0-65535>",
3217 NO_STR
3218 NEIGHBOR_STR
3219 NEIGHBOR_ADDR_STR
3220 "Neighbor's BGP port\n"
3221 "TCP port number\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003222
paul718e3742002-12-13 20:15:29 +00003223/* neighbor weight. */
paul94f2b392005-06-28 12:44:16 +00003224static int
paulfd79ac92004-10-13 05:06:08 +00003225peer_weight_set_vty (struct vty *vty, const char *ip_str,
3226 const char *weight_str)
paul718e3742002-12-13 20:15:29 +00003227{
paul718e3742002-12-13 20:15:29 +00003228 struct peer *peer;
3229 unsigned long weight;
3230
3231 peer = peer_and_group_lookup_vty (vty, ip_str);
3232 if (! peer)
3233 return CMD_WARNING;
3234
3235 VTY_GET_INTEGER_RANGE("weight", weight, weight_str, 0, 65535);
3236
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003237 return bgp_vty_return (vty, peer_weight_set (peer, weight));
paul718e3742002-12-13 20:15:29 +00003238}
3239
paul94f2b392005-06-28 12:44:16 +00003240static int
paulfd79ac92004-10-13 05:06:08 +00003241peer_weight_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00003242{
3243 struct peer *peer;
3244
3245 peer = peer_and_group_lookup_vty (vty, ip_str);
3246 if (! peer)
3247 return CMD_WARNING;
3248
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003249 return bgp_vty_return (vty, peer_weight_unset (peer));
paul718e3742002-12-13 20:15:29 +00003250}
3251
3252DEFUN (neighbor_weight,
3253 neighbor_weight_cmd,
3254 NEIGHBOR_CMD2 "weight <0-65535>",
3255 NEIGHBOR_STR
3256 NEIGHBOR_ADDR_STR2
3257 "Set default weight for routes from this neighbor\n"
3258 "default weight\n")
3259{
3260 return peer_weight_set_vty (vty, argv[0], argv[1]);
3261}
3262
3263DEFUN (no_neighbor_weight,
3264 no_neighbor_weight_cmd,
3265 NO_NEIGHBOR_CMD2 "weight",
3266 NO_STR
3267 NEIGHBOR_STR
3268 NEIGHBOR_ADDR_STR2
3269 "Set default weight for routes from this neighbor\n")
3270{
3271 return peer_weight_unset_vty (vty, argv[0]);
3272}
3273
3274ALIAS (no_neighbor_weight,
3275 no_neighbor_weight_val_cmd,
3276 NO_NEIGHBOR_CMD2 "weight <0-65535>",
3277 NO_STR
3278 NEIGHBOR_STR
3279 NEIGHBOR_ADDR_STR2
3280 "Set default weight for routes from this neighbor\n"
3281 "default weight\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003282
paul718e3742002-12-13 20:15:29 +00003283/* Override capability negotiation. */
3284DEFUN (neighbor_override_capability,
3285 neighbor_override_capability_cmd,
3286 NEIGHBOR_CMD2 "override-capability",
3287 NEIGHBOR_STR
3288 NEIGHBOR_ADDR_STR2
3289 "Override capability negotiation result\n")
3290{
3291 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY);
3292}
3293
3294DEFUN (no_neighbor_override_capability,
3295 no_neighbor_override_capability_cmd,
3296 NO_NEIGHBOR_CMD2 "override-capability",
3297 NO_STR
3298 NEIGHBOR_STR
3299 NEIGHBOR_ADDR_STR2
3300 "Override capability negotiation result\n")
3301{
3302 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY);
3303}
David Lamparter6b0655a2014-06-04 06:53:35 +02003304
paul718e3742002-12-13 20:15:29 +00003305DEFUN (neighbor_strict_capability,
3306 neighbor_strict_capability_cmd,
3307 NEIGHBOR_CMD "strict-capability-match",
3308 NEIGHBOR_STR
3309 NEIGHBOR_ADDR_STR
3310 "Strict capability negotiation match\n")
3311{
3312 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH);
3313}
3314
3315DEFUN (no_neighbor_strict_capability,
3316 no_neighbor_strict_capability_cmd,
3317 NO_NEIGHBOR_CMD "strict-capability-match",
3318 NO_STR
3319 NEIGHBOR_STR
3320 NEIGHBOR_ADDR_STR
3321 "Strict capability negotiation match\n")
3322{
3323 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH);
3324}
David Lamparter6b0655a2014-06-04 06:53:35 +02003325
paul94f2b392005-06-28 12:44:16 +00003326static int
paulfd79ac92004-10-13 05:06:08 +00003327peer_timers_set_vty (struct vty *vty, const char *ip_str,
3328 const char *keep_str, const char *hold_str)
paul718e3742002-12-13 20:15:29 +00003329{
3330 int ret;
3331 struct peer *peer;
3332 u_int32_t keepalive;
3333 u_int32_t holdtime;
3334
3335 peer = peer_and_group_lookup_vty (vty, ip_str);
3336 if (! peer)
3337 return CMD_WARNING;
3338
3339 VTY_GET_INTEGER_RANGE ("Keepalive", keepalive, keep_str, 0, 65535);
3340 VTY_GET_INTEGER_RANGE ("Holdtime", holdtime, hold_str, 0, 65535);
3341
3342 ret = peer_timers_set (peer, keepalive, holdtime);
3343
3344 return bgp_vty_return (vty, ret);
3345}
David Lamparter6b0655a2014-06-04 06:53:35 +02003346
paul94f2b392005-06-28 12:44:16 +00003347static int
paulfd79ac92004-10-13 05:06:08 +00003348peer_timers_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00003349{
3350 int ret;
3351 struct peer *peer;
3352
3353 peer = peer_lookup_vty (vty, ip_str);
3354 if (! peer)
3355 return CMD_WARNING;
3356
3357 ret = peer_timers_unset (peer);
3358
3359 return bgp_vty_return (vty, ret);
3360}
3361
3362DEFUN (neighbor_timers,
3363 neighbor_timers_cmd,
3364 NEIGHBOR_CMD2 "timers <0-65535> <0-65535>",
3365 NEIGHBOR_STR
3366 NEIGHBOR_ADDR_STR2
3367 "BGP per neighbor timers\n"
3368 "Keepalive interval\n"
3369 "Holdtime\n")
3370{
3371 return peer_timers_set_vty (vty, argv[0], argv[1], argv[2]);
3372}
3373
3374DEFUN (no_neighbor_timers,
3375 no_neighbor_timers_cmd,
3376 NO_NEIGHBOR_CMD2 "timers",
3377 NO_STR
3378 NEIGHBOR_STR
3379 NEIGHBOR_ADDR_STR2
3380 "BGP per neighbor timers\n")
3381{
3382 return peer_timers_unset_vty (vty, argv[0]);
3383}
David Lamparter6b0655a2014-06-04 06:53:35 +02003384
paul94f2b392005-06-28 12:44:16 +00003385static int
paulfd79ac92004-10-13 05:06:08 +00003386peer_timers_connect_set_vty (struct vty *vty, const char *ip_str,
3387 const char *time_str)
paul718e3742002-12-13 20:15:29 +00003388{
paul718e3742002-12-13 20:15:29 +00003389 struct peer *peer;
3390 u_int32_t connect;
3391
Daniel Walton0d7435f2015-10-22 11:35:20 +03003392 peer = peer_and_group_lookup_vty (vty, ip_str);
paul718e3742002-12-13 20:15:29 +00003393 if (! peer)
3394 return CMD_WARNING;
3395
3396 VTY_GET_INTEGER_RANGE ("Connect time", connect, time_str, 0, 65535);
3397
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003398 return bgp_vty_return (vty, peer_timers_connect_set (peer, connect));
paul718e3742002-12-13 20:15:29 +00003399}
3400
paul94f2b392005-06-28 12:44:16 +00003401static int
paulfd79ac92004-10-13 05:06:08 +00003402peer_timers_connect_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00003403{
paul718e3742002-12-13 20:15:29 +00003404 struct peer *peer;
3405
3406 peer = peer_and_group_lookup_vty (vty, ip_str);
3407 if (! peer)
3408 return CMD_WARNING;
3409
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003410 return bgp_vty_return (vty, peer_timers_connect_unset (peer));
paul718e3742002-12-13 20:15:29 +00003411}
3412
3413DEFUN (neighbor_timers_connect,
3414 neighbor_timers_connect_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003415 NEIGHBOR_CMD2 "timers connect <1-65535>",
paul718e3742002-12-13 20:15:29 +00003416 NEIGHBOR_STR
Daniel Walton0d7435f2015-10-22 11:35:20 +03003417 NEIGHBOR_ADDR_STR2
paul718e3742002-12-13 20:15:29 +00003418 "BGP per neighbor timers\n"
3419 "BGP connect timer\n"
3420 "Connect timer\n")
3421{
3422 return peer_timers_connect_set_vty (vty, argv[0], argv[1]);
3423}
3424
3425DEFUN (no_neighbor_timers_connect,
3426 no_neighbor_timers_connect_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003427 NO_NEIGHBOR_CMD2 "timers connect",
paul718e3742002-12-13 20:15:29 +00003428 NO_STR
3429 NEIGHBOR_STR
Daniel Walton0d7435f2015-10-22 11:35:20 +03003430 NEIGHBOR_ADDR_STR2
paul718e3742002-12-13 20:15:29 +00003431 "BGP per neighbor timers\n"
3432 "BGP connect timer\n")
3433{
3434 return peer_timers_connect_unset_vty (vty, argv[0]);
3435}
3436
3437ALIAS (no_neighbor_timers_connect,
3438 no_neighbor_timers_connect_val_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003439 NO_NEIGHBOR_CMD2 "timers connect <1-65535>",
paul718e3742002-12-13 20:15:29 +00003440 NO_STR
3441 NEIGHBOR_STR
Daniel Walton0d7435f2015-10-22 11:35:20 +03003442 NEIGHBOR_ADDR_STR2
paul718e3742002-12-13 20:15:29 +00003443 "BGP per neighbor timers\n"
3444 "BGP connect timer\n"
3445 "Connect timer\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003446
paul94f2b392005-06-28 12:44:16 +00003447static int
paulfd79ac92004-10-13 05:06:08 +00003448peer_advertise_interval_vty (struct vty *vty, const char *ip_str,
3449 const char *time_str, int set)
paul718e3742002-12-13 20:15:29 +00003450{
3451 int ret;
3452 struct peer *peer;
3453 u_int32_t routeadv = 0;
3454
Daniel Walton0d7435f2015-10-22 11:35:20 +03003455 peer = peer_and_group_lookup_vty (vty, ip_str);
paul718e3742002-12-13 20:15:29 +00003456 if (! peer)
3457 return CMD_WARNING;
3458
3459 if (time_str)
3460 VTY_GET_INTEGER_RANGE ("advertise interval", routeadv, time_str, 0, 600);
3461
3462 if (set)
3463 ret = peer_advertise_interval_set (peer, routeadv);
3464 else
3465 ret = peer_advertise_interval_unset (peer);
3466
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003467 return bgp_vty_return (vty, ret);
paul718e3742002-12-13 20:15:29 +00003468}
3469
3470DEFUN (neighbor_advertise_interval,
3471 neighbor_advertise_interval_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003472 NEIGHBOR_CMD2 "advertisement-interval <0-600>",
paul718e3742002-12-13 20:15:29 +00003473 NEIGHBOR_STR
Daniel Walton0d7435f2015-10-22 11:35:20 +03003474 NEIGHBOR_ADDR_STR2
paul718e3742002-12-13 20:15:29 +00003475 "Minimum interval between sending BGP routing updates\n"
3476 "time in seconds\n")
3477{
3478 return peer_advertise_interval_vty (vty, argv[0], argv[1], 1);
3479}
3480
3481DEFUN (no_neighbor_advertise_interval,
3482 no_neighbor_advertise_interval_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003483 NO_NEIGHBOR_CMD2 "advertisement-interval",
paul718e3742002-12-13 20:15:29 +00003484 NO_STR
3485 NEIGHBOR_STR
Daniel Walton0d7435f2015-10-22 11:35:20 +03003486 NEIGHBOR_ADDR_STR2
paul718e3742002-12-13 20:15:29 +00003487 "Minimum interval between sending BGP routing updates\n")
3488{
3489 return peer_advertise_interval_vty (vty, argv[0], NULL, 0);
3490}
3491
3492ALIAS (no_neighbor_advertise_interval,
3493 no_neighbor_advertise_interval_val_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003494 NO_NEIGHBOR_CMD2 "advertisement-interval <0-600>",
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 "Minimum interval between sending BGP routing updates\n"
3499 "time in seconds\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003500
paul718e3742002-12-13 20:15:29 +00003501/* neighbor interface */
paul94f2b392005-06-28 12:44:16 +00003502static int
paulfd79ac92004-10-13 05:06:08 +00003503peer_interface_vty (struct vty *vty, const char *ip_str, const char *str)
paul718e3742002-12-13 20:15:29 +00003504{
3505 int ret;
3506 struct peer *peer;
3507
3508 peer = peer_lookup_vty (vty, ip_str);
3509 if (! peer)
3510 return CMD_WARNING;
3511
3512 if (str)
3513 ret = peer_interface_set (peer, str);
3514 else
3515 ret = peer_interface_unset (peer);
3516
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003517 return bgp_vty_return (vty, ret);
paul718e3742002-12-13 20:15:29 +00003518}
3519
3520DEFUN (neighbor_interface,
3521 neighbor_interface_cmd,
3522 NEIGHBOR_CMD "interface WORD",
3523 NEIGHBOR_STR
3524 NEIGHBOR_ADDR_STR
3525 "Interface\n"
3526 "Interface name\n")
3527{
3528 return peer_interface_vty (vty, argv[0], argv[1]);
3529}
3530
3531DEFUN (no_neighbor_interface,
3532 no_neighbor_interface_cmd,
3533 NO_NEIGHBOR_CMD "interface WORD",
3534 NO_STR
3535 NEIGHBOR_STR
3536 NEIGHBOR_ADDR_STR
3537 "Interface\n"
3538 "Interface name\n")
3539{
3540 return peer_interface_vty (vty, argv[0], NULL);
3541}
David Lamparter6b0655a2014-06-04 06:53:35 +02003542
paul718e3742002-12-13 20:15:29 +00003543/* Set distribute list to the peer. */
paul94f2b392005-06-28 12:44:16 +00003544static int
paulfd79ac92004-10-13 05:06:08 +00003545peer_distribute_set_vty (struct vty *vty, const char *ip_str,
3546 afi_t afi, safi_t safi,
3547 const char *name_str, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003548{
3549 int ret;
3550 struct peer *peer;
3551 int direct = FILTER_IN;
3552
3553 peer = peer_and_group_lookup_vty (vty, ip_str);
3554 if (! peer)
3555 return CMD_WARNING;
3556
3557 /* Check filter direction. */
3558 if (strncmp (direct_str, "i", 1) == 0)
3559 direct = FILTER_IN;
3560 else if (strncmp (direct_str, "o", 1) == 0)
3561 direct = FILTER_OUT;
3562
3563 ret = peer_distribute_set (peer, afi, safi, direct, name_str);
3564
3565 return bgp_vty_return (vty, ret);
3566}
3567
paul94f2b392005-06-28 12:44:16 +00003568static int
paulfd79ac92004-10-13 05:06:08 +00003569peer_distribute_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
3570 safi_t safi, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003571{
3572 int ret;
3573 struct peer *peer;
3574 int direct = FILTER_IN;
3575
3576 peer = peer_and_group_lookup_vty (vty, ip_str);
3577 if (! peer)
3578 return CMD_WARNING;
3579
3580 /* Check filter direction. */
3581 if (strncmp (direct_str, "i", 1) == 0)
3582 direct = FILTER_IN;
3583 else if (strncmp (direct_str, "o", 1) == 0)
3584 direct = FILTER_OUT;
3585
3586 ret = peer_distribute_unset (peer, afi, safi, direct);
3587
3588 return bgp_vty_return (vty, ret);
3589}
3590
3591DEFUN (neighbor_distribute_list,
3592 neighbor_distribute_list_cmd,
3593 NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)",
3594 NEIGHBOR_STR
3595 NEIGHBOR_ADDR_STR2
3596 "Filter updates to/from this neighbor\n"
3597 "IP access-list number\n"
3598 "IP access-list number (expanded range)\n"
3599 "IP Access-list name\n"
3600 "Filter incoming updates\n"
3601 "Filter outgoing updates\n")
3602{
3603 return peer_distribute_set_vty (vty, argv[0], bgp_node_afi (vty),
3604 bgp_node_safi (vty), argv[1], argv[2]);
3605}
3606
3607DEFUN (no_neighbor_distribute_list,
3608 no_neighbor_distribute_list_cmd,
3609 NO_NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)",
3610 NO_STR
3611 NEIGHBOR_STR
3612 NEIGHBOR_ADDR_STR2
3613 "Filter updates to/from this neighbor\n"
3614 "IP access-list number\n"
3615 "IP access-list number (expanded range)\n"
3616 "IP Access-list name\n"
3617 "Filter incoming updates\n"
3618 "Filter outgoing updates\n")
3619{
3620 return peer_distribute_unset_vty (vty, argv[0], bgp_node_afi (vty),
3621 bgp_node_safi (vty), argv[2]);
3622}
David Lamparter6b0655a2014-06-04 06:53:35 +02003623
paul718e3742002-12-13 20:15:29 +00003624/* Set prefix list to the peer. */
paul94f2b392005-06-28 12:44:16 +00003625static int
paulfd79ac92004-10-13 05:06:08 +00003626peer_prefix_list_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
3627 safi_t safi, const char *name_str,
3628 const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003629{
3630 int ret;
3631 struct peer *peer;
3632 int direct = FILTER_IN;
3633
3634 peer = peer_and_group_lookup_vty (vty, ip_str);
3635 if (! peer)
3636 return CMD_WARNING;
3637
3638 /* Check filter direction. */
3639 if (strncmp (direct_str, "i", 1) == 0)
3640 direct = FILTER_IN;
3641 else if (strncmp (direct_str, "o", 1) == 0)
3642 direct = FILTER_OUT;
3643
3644 ret = peer_prefix_list_set (peer, afi, safi, direct, name_str);
3645
3646 return bgp_vty_return (vty, ret);
3647}
3648
paul94f2b392005-06-28 12:44:16 +00003649static int
paulfd79ac92004-10-13 05:06:08 +00003650peer_prefix_list_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
3651 safi_t safi, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003652{
3653 int ret;
3654 struct peer *peer;
3655 int direct = FILTER_IN;
3656
3657 peer = peer_and_group_lookup_vty (vty, ip_str);
3658 if (! peer)
3659 return CMD_WARNING;
3660
3661 /* Check filter direction. */
3662 if (strncmp (direct_str, "i", 1) == 0)
3663 direct = FILTER_IN;
3664 else if (strncmp (direct_str, "o", 1) == 0)
3665 direct = FILTER_OUT;
3666
3667 ret = peer_prefix_list_unset (peer, afi, safi, direct);
3668
3669 return bgp_vty_return (vty, ret);
3670}
3671
3672DEFUN (neighbor_prefix_list,
3673 neighbor_prefix_list_cmd,
3674 NEIGHBOR_CMD2 "prefix-list WORD (in|out)",
3675 NEIGHBOR_STR
3676 NEIGHBOR_ADDR_STR2
3677 "Filter updates to/from this neighbor\n"
3678 "Name of a prefix list\n"
3679 "Filter incoming updates\n"
3680 "Filter outgoing updates\n")
3681{
3682 return peer_prefix_list_set_vty (vty, argv[0], bgp_node_afi (vty),
3683 bgp_node_safi (vty), argv[1], argv[2]);
3684}
3685
3686DEFUN (no_neighbor_prefix_list,
3687 no_neighbor_prefix_list_cmd,
3688 NO_NEIGHBOR_CMD2 "prefix-list WORD (in|out)",
3689 NO_STR
3690 NEIGHBOR_STR
3691 NEIGHBOR_ADDR_STR2
3692 "Filter updates to/from this neighbor\n"
3693 "Name of a prefix list\n"
3694 "Filter incoming updates\n"
3695 "Filter outgoing updates\n")
3696{
3697 return peer_prefix_list_unset_vty (vty, argv[0], bgp_node_afi (vty),
3698 bgp_node_safi (vty), argv[2]);
3699}
David Lamparter6b0655a2014-06-04 06:53:35 +02003700
paul94f2b392005-06-28 12:44:16 +00003701static int
paulfd79ac92004-10-13 05:06:08 +00003702peer_aslist_set_vty (struct vty *vty, const char *ip_str,
3703 afi_t afi, safi_t safi,
3704 const char *name_str, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003705{
3706 int ret;
3707 struct peer *peer;
3708 int direct = FILTER_IN;
3709
3710 peer = peer_and_group_lookup_vty (vty, ip_str);
3711 if (! peer)
3712 return CMD_WARNING;
3713
3714 /* Check filter direction. */
3715 if (strncmp (direct_str, "i", 1) == 0)
3716 direct = FILTER_IN;
3717 else if (strncmp (direct_str, "o", 1) == 0)
3718 direct = FILTER_OUT;
3719
3720 ret = peer_aslist_set (peer, afi, safi, direct, name_str);
3721
3722 return bgp_vty_return (vty, ret);
3723}
3724
paul94f2b392005-06-28 12:44:16 +00003725static int
paulfd79ac92004-10-13 05:06:08 +00003726peer_aslist_unset_vty (struct vty *vty, const char *ip_str,
3727 afi_t afi, safi_t safi,
3728 const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003729{
3730 int ret;
3731 struct peer *peer;
3732 int direct = FILTER_IN;
3733
3734 peer = peer_and_group_lookup_vty (vty, ip_str);
3735 if (! peer)
3736 return CMD_WARNING;
3737
3738 /* Check filter direction. */
3739 if (strncmp (direct_str, "i", 1) == 0)
3740 direct = FILTER_IN;
3741 else if (strncmp (direct_str, "o", 1) == 0)
3742 direct = FILTER_OUT;
3743
3744 ret = peer_aslist_unset (peer, afi, safi, direct);
3745
3746 return bgp_vty_return (vty, ret);
3747}
3748
3749DEFUN (neighbor_filter_list,
3750 neighbor_filter_list_cmd,
3751 NEIGHBOR_CMD2 "filter-list WORD (in|out)",
3752 NEIGHBOR_STR
3753 NEIGHBOR_ADDR_STR2
3754 "Establish BGP filters\n"
3755 "AS path access-list name\n"
3756 "Filter incoming routes\n"
3757 "Filter outgoing routes\n")
3758{
3759 return peer_aslist_set_vty (vty, argv[0], bgp_node_afi (vty),
3760 bgp_node_safi (vty), argv[1], argv[2]);
3761}
3762
3763DEFUN (no_neighbor_filter_list,
3764 no_neighbor_filter_list_cmd,
3765 NO_NEIGHBOR_CMD2 "filter-list WORD (in|out)",
3766 NO_STR
3767 NEIGHBOR_STR
3768 NEIGHBOR_ADDR_STR2
3769 "Establish BGP filters\n"
3770 "AS path access-list name\n"
3771 "Filter incoming routes\n"
3772 "Filter outgoing routes\n")
3773{
3774 return peer_aslist_unset_vty (vty, argv[0], bgp_node_afi (vty),
3775 bgp_node_safi (vty), argv[2]);
3776}
David Lamparter6b0655a2014-06-04 06:53:35 +02003777
paul718e3742002-12-13 20:15:29 +00003778/* Set route-map to the peer. */
paul94f2b392005-06-28 12:44:16 +00003779static int
paulfd79ac92004-10-13 05:06:08 +00003780peer_route_map_set_vty (struct vty *vty, const char *ip_str,
3781 afi_t afi, safi_t safi,
3782 const char *name_str, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003783{
3784 int ret;
3785 struct peer *peer;
paulfee0f4c2004-09-13 05:12:46 +00003786 int direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003787
3788 peer = peer_and_group_lookup_vty (vty, ip_str);
3789 if (! peer)
3790 return CMD_WARNING;
3791
3792 /* Check filter direction. */
paulfee0f4c2004-09-13 05:12:46 +00003793 if (strncmp (direct_str, "in", 2) == 0)
3794 direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003795 else if (strncmp (direct_str, "o", 1) == 0)
paulfee0f4c2004-09-13 05:12:46 +00003796 direct = RMAP_OUT;
3797 else if (strncmp (direct_str, "im", 2) == 0)
3798 direct = RMAP_IMPORT;
3799 else if (strncmp (direct_str, "e", 1) == 0)
3800 direct = RMAP_EXPORT;
paul718e3742002-12-13 20:15:29 +00003801
3802 ret = peer_route_map_set (peer, afi, safi, direct, name_str);
3803
3804 return bgp_vty_return (vty, ret);
3805}
3806
paul94f2b392005-06-28 12:44:16 +00003807static int
paulfd79ac92004-10-13 05:06:08 +00003808peer_route_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
3809 safi_t safi, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003810{
3811 int ret;
3812 struct peer *peer;
paulfee0f4c2004-09-13 05:12:46 +00003813 int direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003814
3815 peer = peer_and_group_lookup_vty (vty, ip_str);
3816 if (! peer)
3817 return CMD_WARNING;
3818
3819 /* Check filter direction. */
paulfee0f4c2004-09-13 05:12:46 +00003820 if (strncmp (direct_str, "in", 2) == 0)
3821 direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003822 else if (strncmp (direct_str, "o", 1) == 0)
paulfee0f4c2004-09-13 05:12:46 +00003823 direct = RMAP_OUT;
3824 else if (strncmp (direct_str, "im", 2) == 0)
3825 direct = RMAP_IMPORT;
3826 else if (strncmp (direct_str, "e", 1) == 0)
3827 direct = RMAP_EXPORT;
paul718e3742002-12-13 20:15:29 +00003828
3829 ret = peer_route_map_unset (peer, afi, safi, direct);
3830
3831 return bgp_vty_return (vty, ret);
3832}
3833
3834DEFUN (neighbor_route_map,
3835 neighbor_route_map_cmd,
paulfee0f4c2004-09-13 05:12:46 +00003836 NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)",
paul718e3742002-12-13 20:15:29 +00003837 NEIGHBOR_STR
3838 NEIGHBOR_ADDR_STR2
3839 "Apply route map to neighbor\n"
3840 "Name of route map\n"
3841 "Apply map to incoming routes\n"
paulfee0f4c2004-09-13 05:12:46 +00003842 "Apply map to outbound routes\n"
3843 "Apply map to routes going into a Route-Server client's table\n"
3844 "Apply map to routes coming from a Route-Server client")
paul718e3742002-12-13 20:15:29 +00003845{
3846 return peer_route_map_set_vty (vty, argv[0], bgp_node_afi (vty),
3847 bgp_node_safi (vty), argv[1], argv[2]);
3848}
3849
3850DEFUN (no_neighbor_route_map,
3851 no_neighbor_route_map_cmd,
paulfee0f4c2004-09-13 05:12:46 +00003852 NO_NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)",
paul718e3742002-12-13 20:15:29 +00003853 NO_STR
3854 NEIGHBOR_STR
3855 NEIGHBOR_ADDR_STR2
3856 "Apply route map to neighbor\n"
3857 "Name of route map\n"
3858 "Apply map to incoming routes\n"
paulfee0f4c2004-09-13 05:12:46 +00003859 "Apply map to outbound routes\n"
3860 "Apply map to routes going into a Route-Server client's table\n"
3861 "Apply map to routes coming from a Route-Server client")
paul718e3742002-12-13 20:15:29 +00003862{
3863 return peer_route_map_unset_vty (vty, argv[0], bgp_node_afi (vty),
3864 bgp_node_safi (vty), argv[2]);
3865}
David Lamparter6b0655a2014-06-04 06:53:35 +02003866
paul718e3742002-12-13 20:15:29 +00003867/* Set unsuppress-map to the peer. */
paul94f2b392005-06-28 12:44:16 +00003868static int
paulfd79ac92004-10-13 05:06:08 +00003869peer_unsuppress_map_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
3870 safi_t safi, const char *name_str)
paul718e3742002-12-13 20:15:29 +00003871{
3872 int ret;
3873 struct peer *peer;
3874
3875 peer = peer_and_group_lookup_vty (vty, ip_str);
3876 if (! peer)
3877 return CMD_WARNING;
3878
3879 ret = peer_unsuppress_map_set (peer, afi, safi, name_str);
3880
3881 return bgp_vty_return (vty, ret);
3882}
3883
3884/* Unset route-map from the peer. */
paul94f2b392005-06-28 12:44:16 +00003885static int
paulfd79ac92004-10-13 05:06:08 +00003886peer_unsuppress_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
paul718e3742002-12-13 20:15:29 +00003887 safi_t safi)
3888{
3889 int ret;
3890 struct peer *peer;
3891
3892 peer = peer_and_group_lookup_vty (vty, ip_str);
3893 if (! peer)
3894 return CMD_WARNING;
3895
3896 ret = peer_unsuppress_map_unset (peer, afi, safi);
3897
3898 return bgp_vty_return (vty, ret);
3899}
3900
3901DEFUN (neighbor_unsuppress_map,
3902 neighbor_unsuppress_map_cmd,
3903 NEIGHBOR_CMD2 "unsuppress-map WORD",
3904 NEIGHBOR_STR
3905 NEIGHBOR_ADDR_STR2
3906 "Route-map to selectively unsuppress suppressed routes\n"
3907 "Name of route map\n")
3908{
3909 return peer_unsuppress_map_set_vty (vty, argv[0], bgp_node_afi (vty),
3910 bgp_node_safi (vty), argv[1]);
3911}
3912
3913DEFUN (no_neighbor_unsuppress_map,
3914 no_neighbor_unsuppress_map_cmd,
3915 NO_NEIGHBOR_CMD2 "unsuppress-map WORD",
3916 NO_STR
3917 NEIGHBOR_STR
3918 NEIGHBOR_ADDR_STR2
3919 "Route-map to selectively unsuppress suppressed routes\n"
3920 "Name of route map\n")
3921{
3922 return peer_unsuppress_map_unset_vty (vty, argv[0], bgp_node_afi (vty),
3923 bgp_node_safi (vty));
3924}
David Lamparter6b0655a2014-06-04 06:53:35 +02003925
paul94f2b392005-06-28 12:44:16 +00003926static int
paulfd79ac92004-10-13 05:06:08 +00003927peer_maximum_prefix_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
3928 safi_t safi, const char *num_str,
hasso0a486e52005-02-01 20:57:17 +00003929 const char *threshold_str, int warning,
3930 const char *restart_str)
paul718e3742002-12-13 20:15:29 +00003931{
3932 int ret;
3933 struct peer *peer;
3934 u_int32_t max;
hassoe0701b72004-05-20 09:19:34 +00003935 u_char threshold;
hasso0a486e52005-02-01 20:57:17 +00003936 u_int16_t restart;
paul718e3742002-12-13 20:15:29 +00003937
3938 peer = peer_and_group_lookup_vty (vty, ip_str);
3939 if (! peer)
3940 return CMD_WARNING;
3941
Denis Ovsienkoe6ec1c32011-09-10 21:50:53 +04003942 VTY_GET_INTEGER ("maximum number", max, num_str);
hassoe0701b72004-05-20 09:19:34 +00003943 if (threshold_str)
3944 threshold = atoi (threshold_str);
3945 else
3946 threshold = MAXIMUM_PREFIX_THRESHOLD_DEFAULT;
paul718e3742002-12-13 20:15:29 +00003947
hasso0a486e52005-02-01 20:57:17 +00003948 if (restart_str)
3949 restart = atoi (restart_str);
3950 else
3951 restart = 0;
3952
3953 ret = peer_maximum_prefix_set (peer, afi, safi, max, threshold, warning, restart);
paul718e3742002-12-13 20:15:29 +00003954
3955 return bgp_vty_return (vty, ret);
3956}
3957
paul94f2b392005-06-28 12:44:16 +00003958static int
paulfd79ac92004-10-13 05:06:08 +00003959peer_maximum_prefix_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
paul718e3742002-12-13 20:15:29 +00003960 safi_t safi)
3961{
3962 int ret;
3963 struct peer *peer;
3964
3965 peer = peer_and_group_lookup_vty (vty, ip_str);
3966 if (! peer)
3967 return CMD_WARNING;
3968
3969 ret = peer_maximum_prefix_unset (peer, afi, safi);
3970
3971 return bgp_vty_return (vty, ret);
3972}
3973
3974/* Maximum number of prefix configuration. prefix count is different
3975 for each peer configuration. So this configuration can be set for
3976 each peer configuration. */
3977DEFUN (neighbor_maximum_prefix,
3978 neighbor_maximum_prefix_cmd,
3979 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>",
3980 NEIGHBOR_STR
3981 NEIGHBOR_ADDR_STR2
3982 "Maximum number of prefix accept from this peer\n"
3983 "maximum no. of prefix limit\n")
3984{
3985 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00003986 bgp_node_safi (vty), argv[1], NULL, 0,
3987 NULL);
paul718e3742002-12-13 20:15:29 +00003988}
3989
hassoe0701b72004-05-20 09:19:34 +00003990DEFUN (neighbor_maximum_prefix_threshold,
3991 neighbor_maximum_prefix_threshold_cmd,
3992 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100>",
3993 NEIGHBOR_STR
3994 NEIGHBOR_ADDR_STR2
3995 "Maximum number of prefix accept from this peer\n"
3996 "maximum no. of prefix limit\n"
3997 "Threshold value (%) at which to generate a warning msg\n")
3998{
3999 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00004000 bgp_node_safi (vty), argv[1], argv[2], 0,
4001 NULL);
4002}
hassoe0701b72004-05-20 09:19:34 +00004003
paul718e3742002-12-13 20:15:29 +00004004DEFUN (neighbor_maximum_prefix_warning,
4005 neighbor_maximum_prefix_warning_cmd,
4006 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
4007 NEIGHBOR_STR
4008 NEIGHBOR_ADDR_STR2
4009 "Maximum number of prefix accept from this peer\n"
4010 "maximum no. of prefix limit\n"
4011 "Only give warning message when limit is exceeded\n")
4012{
4013 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00004014 bgp_node_safi (vty), argv[1], NULL, 1,
4015 NULL);
paul718e3742002-12-13 20:15:29 +00004016}
4017
hassoe0701b72004-05-20 09:19:34 +00004018DEFUN (neighbor_maximum_prefix_threshold_warning,
4019 neighbor_maximum_prefix_threshold_warning_cmd,
4020 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only",
4021 NEIGHBOR_STR
4022 NEIGHBOR_ADDR_STR2
4023 "Maximum number of prefix accept from this peer\n"
4024 "maximum no. of prefix limit\n"
4025 "Threshold value (%) at which to generate a warning msg\n"
4026 "Only give warning message when limit is exceeded\n")
4027{
4028 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00004029 bgp_node_safi (vty), argv[1], argv[2], 1, NULL);
4030}
4031
4032DEFUN (neighbor_maximum_prefix_restart,
4033 neighbor_maximum_prefix_restart_cmd,
4034 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>",
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 "Restart bgp connection after limit is exceeded\n"
4040 "Restart interval in minutes")
4041{
4042 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
4043 bgp_node_safi (vty), argv[1], NULL, 0, argv[2]);
4044}
4045
4046DEFUN (neighbor_maximum_prefix_threshold_restart,
4047 neighbor_maximum_prefix_threshold_restart_cmd,
4048 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>",
4049 NEIGHBOR_STR
4050 NEIGHBOR_ADDR_STR2
4051 "Maximum number of prefix accept from this peer\n"
4052 "maximum no. of prefix limit\n"
4053 "Threshold value (%) at which to generate a warning msg\n"
4054 "Restart bgp connection after limit is exceeded\n"
4055 "Restart interval in minutes")
4056{
4057 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
4058 bgp_node_safi (vty), argv[1], argv[2], 0, argv[3]);
4059}
hassoe0701b72004-05-20 09:19:34 +00004060
paul718e3742002-12-13 20:15:29 +00004061DEFUN (no_neighbor_maximum_prefix,
4062 no_neighbor_maximum_prefix_cmd,
4063 NO_NEIGHBOR_CMD2 "maximum-prefix",
4064 NO_STR
4065 NEIGHBOR_STR
4066 NEIGHBOR_ADDR_STR2
4067 "Maximum number of prefix accept from this peer\n")
4068{
4069 return peer_maximum_prefix_unset_vty (vty, argv[0], bgp_node_afi (vty),
4070 bgp_node_safi (vty));
4071}
4072
4073ALIAS (no_neighbor_maximum_prefix,
4074 no_neighbor_maximum_prefix_val_cmd,
4075 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>",
4076 NO_STR
4077 NEIGHBOR_STR
4078 NEIGHBOR_ADDR_STR2
4079 "Maximum number of prefix accept from this peer\n"
4080 "maximum no. of prefix limit\n")
4081
4082ALIAS (no_neighbor_maximum_prefix,
hasso0a486e52005-02-01 20:57:17 +00004083 no_neighbor_maximum_prefix_threshold_cmd,
4084 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
4085 NO_STR
4086 NEIGHBOR_STR
4087 NEIGHBOR_ADDR_STR2
4088 "Maximum number of prefix accept from this peer\n"
4089 "maximum no. of prefix limit\n"
4090 "Threshold value (%) at which to generate a warning msg\n")
4091
4092ALIAS (no_neighbor_maximum_prefix,
4093 no_neighbor_maximum_prefix_warning_cmd,
4094 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
4095 NO_STR
4096 NEIGHBOR_STR
4097 NEIGHBOR_ADDR_STR2
4098 "Maximum number of prefix accept from this peer\n"
4099 "maximum no. of prefix limit\n"
paule8e19462006-01-19 20:16:55 +00004100 "Only give warning message when limit is exceeded\n")
hasso0a486e52005-02-01 20:57:17 +00004101
4102ALIAS (no_neighbor_maximum_prefix,
4103 no_neighbor_maximum_prefix_threshold_warning_cmd,
hassoe0701b72004-05-20 09:19:34 +00004104 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only",
4105 NO_STR
4106 NEIGHBOR_STR
4107 NEIGHBOR_ADDR_STR2
4108 "Maximum number of prefix accept from this peer\n"
4109 "maximum no. of prefix limit\n"
4110 "Threshold value (%) at which to generate a warning msg\n"
paule8e19462006-01-19 20:16:55 +00004111 "Only give warning message when limit is exceeded\n")
hassoe0701b72004-05-20 09:19:34 +00004112
4113ALIAS (no_neighbor_maximum_prefix,
hasso0a486e52005-02-01 20:57:17 +00004114 no_neighbor_maximum_prefix_restart_cmd,
4115 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>",
paul718e3742002-12-13 20:15:29 +00004116 NO_STR
4117 NEIGHBOR_STR
4118 NEIGHBOR_ADDR_STR2
4119 "Maximum number of prefix accept from this peer\n"
4120 "maximum no. of prefix limit\n"
hasso0a486e52005-02-01 20:57:17 +00004121 "Restart bgp connection after limit is exceeded\n"
4122 "Restart interval in minutes")
4123
4124ALIAS (no_neighbor_maximum_prefix,
4125 no_neighbor_maximum_prefix_threshold_restart_cmd,
4126 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>",
4127 NO_STR
4128 NEIGHBOR_STR
4129 NEIGHBOR_ADDR_STR2
4130 "Maximum number of prefix accept from this peer\n"
4131 "maximum no. of prefix limit\n"
4132 "Threshold value (%) at which to generate a warning msg\n"
4133 "Restart bgp connection after limit is exceeded\n"
4134 "Restart interval in minutes")
David Lamparter6b0655a2014-06-04 06:53:35 +02004135
paul718e3742002-12-13 20:15:29 +00004136/* "neighbor allowas-in" */
4137DEFUN (neighbor_allowas_in,
4138 neighbor_allowas_in_cmd,
4139 NEIGHBOR_CMD2 "allowas-in",
4140 NEIGHBOR_STR
4141 NEIGHBOR_ADDR_STR2
4142 "Accept as-path with my AS present in it\n")
4143{
4144 int ret;
4145 struct peer *peer;
paulfd79ac92004-10-13 05:06:08 +00004146 unsigned int allow_num;
paul718e3742002-12-13 20:15:29 +00004147
4148 peer = peer_and_group_lookup_vty (vty, argv[0]);
4149 if (! peer)
4150 return CMD_WARNING;
4151
4152 if (argc == 1)
4153 allow_num = 3;
4154 else
4155 VTY_GET_INTEGER_RANGE ("AS number", allow_num, argv[1], 1, 10);
4156
4157 ret = peer_allowas_in_set (peer, bgp_node_afi (vty), bgp_node_safi (vty),
4158 allow_num);
4159
4160 return bgp_vty_return (vty, ret);
4161}
4162
4163ALIAS (neighbor_allowas_in,
4164 neighbor_allowas_in_arg_cmd,
4165 NEIGHBOR_CMD2 "allowas-in <1-10>",
4166 NEIGHBOR_STR
4167 NEIGHBOR_ADDR_STR2
4168 "Accept as-path with my AS present in it\n"
4169 "Number of occurances of AS number\n")
4170
4171DEFUN (no_neighbor_allowas_in,
4172 no_neighbor_allowas_in_cmd,
4173 NO_NEIGHBOR_CMD2 "allowas-in",
4174 NO_STR
4175 NEIGHBOR_STR
4176 NEIGHBOR_ADDR_STR2
4177 "allow local ASN appears in aspath attribute\n")
4178{
4179 int ret;
4180 struct peer *peer;
4181
4182 peer = peer_and_group_lookup_vty (vty, argv[0]);
4183 if (! peer)
4184 return CMD_WARNING;
4185
4186 ret = peer_allowas_in_unset (peer, bgp_node_afi (vty), bgp_node_safi (vty));
4187
4188 return bgp_vty_return (vty, ret);
4189}
David Lamparter6b0655a2014-06-04 06:53:35 +02004190
Nick Hilliardfa411a22011-03-23 15:33:17 +00004191DEFUN (neighbor_ttl_security,
4192 neighbor_ttl_security_cmd,
4193 NEIGHBOR_CMD2 "ttl-security hops <1-254>",
4194 NEIGHBOR_STR
4195 NEIGHBOR_ADDR_STR2
4196 "Specify the maximum number of hops to the BGP peer\n")
4197{
4198 struct peer *peer;
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00004199 int gtsm_hops;
Nick Hilliardfa411a22011-03-23 15:33:17 +00004200
4201 peer = peer_and_group_lookup_vty (vty, argv[0]);
4202 if (! peer)
4203 return CMD_WARNING;
4204
4205 VTY_GET_INTEGER_RANGE ("", gtsm_hops, argv[1], 1, 254);
4206
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00004207 return bgp_vty_return (vty, peer_ttl_security_hops_set (peer, gtsm_hops));
Nick Hilliardfa411a22011-03-23 15:33:17 +00004208}
4209
4210DEFUN (no_neighbor_ttl_security,
4211 no_neighbor_ttl_security_cmd,
4212 NO_NEIGHBOR_CMD2 "ttl-security hops <1-254>",
4213 NO_STR
4214 NEIGHBOR_STR
4215 NEIGHBOR_ADDR_STR2
4216 "Specify the maximum number of hops to the BGP peer\n")
4217{
4218 struct peer *peer;
Nick Hilliardfa411a22011-03-23 15:33:17 +00004219
4220 peer = peer_and_group_lookup_vty (vty, argv[0]);
4221 if (! peer)
4222 return CMD_WARNING;
4223
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00004224 return bgp_vty_return (vty, peer_ttl_security_hops_unset (peer));
Nick Hilliardfa411a22011-03-23 15:33:17 +00004225}
David Lamparter6b0655a2014-06-04 06:53:35 +02004226
paul718e3742002-12-13 20:15:29 +00004227/* Address family configuration. */
4228DEFUN (address_family_ipv4,
4229 address_family_ipv4_cmd,
4230 "address-family ipv4",
4231 "Enter Address Family command mode\n"
4232 "Address family\n")
4233{
4234 vty->node = BGP_IPV4_NODE;
4235 return CMD_SUCCESS;
4236}
4237
4238DEFUN (address_family_ipv4_safi,
4239 address_family_ipv4_safi_cmd,
4240 "address-family ipv4 (unicast|multicast)",
4241 "Enter Address Family command mode\n"
4242 "Address family\n"
4243 "Address Family modifier\n"
4244 "Address Family modifier\n")
4245{
4246 if (strncmp (argv[0], "m", 1) == 0)
4247 vty->node = BGP_IPV4M_NODE;
4248 else
4249 vty->node = BGP_IPV4_NODE;
4250
4251 return CMD_SUCCESS;
4252}
4253
paul25ffbdc2005-08-22 22:42:08 +00004254DEFUN (address_family_ipv6,
4255 address_family_ipv6_cmd,
4256 "address-family ipv6",
paul718e3742002-12-13 20:15:29 +00004257 "Enter Address Family command mode\n"
paul25ffbdc2005-08-22 22:42:08 +00004258 "Address family\n")
paul718e3742002-12-13 20:15:29 +00004259{
4260 vty->node = BGP_IPV6_NODE;
4261 return CMD_SUCCESS;
4262}
4263
paul25ffbdc2005-08-22 22:42:08 +00004264DEFUN (address_family_ipv6_safi,
4265 address_family_ipv6_safi_cmd,
4266 "address-family ipv6 (unicast|multicast)",
paul718e3742002-12-13 20:15:29 +00004267 "Enter Address Family command mode\n"
paul25ffbdc2005-08-22 22:42:08 +00004268 "Address family\n"
4269 "Address Family modifier\n"
4270 "Address Family modifier\n")
4271{
4272 if (strncmp (argv[0], "m", 1) == 0)
4273 vty->node = BGP_IPV6M_NODE;
4274 else
4275 vty->node = BGP_IPV6_NODE;
4276
4277 return CMD_SUCCESS;
4278}
paul718e3742002-12-13 20:15:29 +00004279
4280DEFUN (address_family_vpnv4,
4281 address_family_vpnv4_cmd,
4282 "address-family vpnv4",
4283 "Enter Address Family command mode\n"
4284 "Address family\n")
4285{
4286 vty->node = BGP_VPNV4_NODE;
4287 return CMD_SUCCESS;
4288}
4289
4290ALIAS (address_family_vpnv4,
4291 address_family_vpnv4_unicast_cmd,
4292 "address-family vpnv4 unicast",
4293 "Enter Address Family command mode\n"
4294 "Address family\n"
4295 "Address Family Modifier\n")
4296
Lou Berger13c378d2016-01-12 13:41:56 -05004297DEFUN (address_family_vpnv6,
4298 address_family_vpnv6_cmd,
4299 "address-family vpnv6",
4300 "Enter Address Family command mode\n"
4301 "Address family\n")
4302{
4303 vty->node = BGP_VPNV6_NODE;
4304 return CMD_SUCCESS;
4305}
4306
4307ALIAS (address_family_vpnv6,
4308 address_family_vpnv6_unicast_cmd,
4309 "address-family vpnv6 unicast",
4310 "Enter Address Family command mode\n"
4311 "Address family\n"
4312 "Address Family Modifier\n")
4313
paul718e3742002-12-13 20:15:29 +00004314DEFUN (exit_address_family,
4315 exit_address_family_cmd,
4316 "exit-address-family",
4317 "Exit from Address Family configuration mode\n")
4318{
hassoa8a80d52005-04-09 13:07:47 +00004319 if (vty->node == BGP_IPV4_NODE
4320 || vty->node == BGP_IPV4M_NODE
paul718e3742002-12-13 20:15:29 +00004321 || vty->node == BGP_VPNV4_NODE
Lou Berger13c378d2016-01-12 13:41:56 -05004322 || vty->node == BGP_VPNV6_NODE
paul25ffbdc2005-08-22 22:42:08 +00004323 || vty->node == BGP_IPV6_NODE
4324 || vty->node == BGP_IPV6M_NODE)
paul718e3742002-12-13 20:15:29 +00004325 vty->node = BGP_NODE;
4326 return CMD_SUCCESS;
4327}
David Lamparter6b0655a2014-06-04 06:53:35 +02004328
paul718e3742002-12-13 20:15:29 +00004329/* BGP clear sort. */
4330enum clear_sort
4331{
4332 clear_all,
4333 clear_peer,
4334 clear_group,
4335 clear_external,
4336 clear_as
4337};
4338
paul94f2b392005-06-28 12:44:16 +00004339static void
paul718e3742002-12-13 20:15:29 +00004340bgp_clear_vty_error (struct vty *vty, struct peer *peer, afi_t afi,
4341 safi_t safi, int error)
4342{
4343 switch (error)
4344 {
4345 case BGP_ERR_AF_UNCONFIGURED:
4346 vty_out (vty,
4347 "%%BGP: Enable %s %s address family for the neighbor %s%s",
4348 afi == AFI_IP6 ? "IPv6" : safi == SAFI_MPLS_VPN ? "VPNv4" : "IPv4",
4349 safi == SAFI_MULTICAST ? "Multicast" : "Unicast",
4350 peer->host, VTY_NEWLINE);
4351 break;
4352 case BGP_ERR_SOFT_RECONFIG_UNCONFIGURED:
4353 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);
4354 break;
4355 default:
4356 break;
4357 }
4358}
4359
4360/* `clear ip bgp' functions. */
paul94f2b392005-06-28 12:44:16 +00004361static int
paul718e3742002-12-13 20:15:29 +00004362bgp_clear (struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi,
paulfd79ac92004-10-13 05:06:08 +00004363 enum clear_sort sort,enum bgp_clear_type stype, const char *arg)
paul718e3742002-12-13 20:15:29 +00004364{
4365 int ret;
4366 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00004367 struct listnode *node, *nnode;
paul718e3742002-12-13 20:15:29 +00004368
4369 /* Clear all neighbors. */
4370 if (sort == clear_all)
4371 {
paul1eb8ef22005-04-07 07:30:20 +00004372 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004373 {
4374 if (stype == BGP_CLEAR_SOFT_NONE)
4375 ret = peer_clear (peer);
4376 else
4377 ret = peer_clear_soft (peer, afi, safi, stype);
4378
4379 if (ret < 0)
4380 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4381 }
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004382 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004383 }
4384
4385 /* Clear specified neighbors. */
4386 if (sort == clear_peer)
4387 {
4388 union sockunion su;
4389 int ret;
4390
4391 /* Make sockunion for lookup. */
4392 ret = str2sockunion (arg, &su);
4393 if (ret < 0)
4394 {
4395 vty_out (vty, "Malformed address: %s%s", arg, VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004396 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00004397 }
4398 peer = peer_lookup (bgp, &su);
4399 if (! peer)
4400 {
4401 vty_out (vty, "%%BGP: Unknown neighbor - \"%s\"%s", arg, VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004402 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00004403 }
4404
4405 if (stype == BGP_CLEAR_SOFT_NONE)
4406 ret = peer_clear (peer);
4407 else
4408 ret = peer_clear_soft (peer, afi, safi, stype);
4409
4410 if (ret < 0)
4411 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4412
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004413 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004414 }
4415
4416 /* Clear all peer-group members. */
4417 if (sort == clear_group)
4418 {
4419 struct peer_group *group;
4420
4421 group = peer_group_lookup (bgp, arg);
4422 if (! group)
4423 {
4424 vty_out (vty, "%%BGP: No such peer-group %s%s", arg, VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004425 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00004426 }
4427
paul1eb8ef22005-04-07 07:30:20 +00004428 for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004429 {
4430 if (stype == BGP_CLEAR_SOFT_NONE)
4431 {
4432 ret = peer_clear (peer);
4433 continue;
4434 }
4435
4436 if (! peer->af_group[afi][safi])
4437 continue;
4438
4439 ret = peer_clear_soft (peer, afi, safi, stype);
4440
4441 if (ret < 0)
4442 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4443 }
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004444 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004445 }
4446
4447 if (sort == clear_external)
4448 {
paul1eb8ef22005-04-07 07:30:20 +00004449 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004450 {
Jorge Boncompte [DTI2]6d85b152012-05-07 16:52:54 +00004451 if (peer->sort == BGP_PEER_IBGP)
paul718e3742002-12-13 20:15:29 +00004452 continue;
4453
4454 if (stype == BGP_CLEAR_SOFT_NONE)
4455 ret = peer_clear (peer);
4456 else
4457 ret = peer_clear_soft (peer, afi, safi, stype);
4458
4459 if (ret < 0)
4460 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4461 }
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004462 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004463 }
4464
4465 if (sort == clear_as)
4466 {
4467 as_t as;
paul718e3742002-12-13 20:15:29 +00004468 int find = 0;
4469
Ulrich Weberbde12e32011-11-16 19:32:12 +04004470 VTY_GET_INTEGER_RANGE ("AS", as, arg, 1, BGP_AS4_MAX);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004471
paul1eb8ef22005-04-07 07:30:20 +00004472 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004473 {
4474 if (peer->as != as)
4475 continue;
4476
4477 find = 1;
4478 if (stype == BGP_CLEAR_SOFT_NONE)
4479 ret = peer_clear (peer);
4480 else
4481 ret = peer_clear_soft (peer, afi, safi, stype);
4482
4483 if (ret < 0)
4484 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4485 }
4486 if (! find)
4487 vty_out (vty, "%%BGP: No peer is configured with AS %s%s", arg,
4488 VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004489 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004490 }
4491
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004492 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004493}
4494
paul94f2b392005-06-28 12:44:16 +00004495static int
paulfd79ac92004-10-13 05:06:08 +00004496bgp_clear_vty (struct vty *vty, const char *name, afi_t afi, safi_t safi,
4497 enum clear_sort sort, enum bgp_clear_type stype,
4498 const char *arg)
paul718e3742002-12-13 20:15:29 +00004499{
paul718e3742002-12-13 20:15:29 +00004500 struct bgp *bgp;
4501
4502 /* BGP structure lookup. */
4503 if (name)
4504 {
4505 bgp = bgp_lookup_by_name (name);
4506 if (bgp == NULL)
4507 {
4508 vty_out (vty, "Can't find BGP view %s%s", name, VTY_NEWLINE);
4509 return CMD_WARNING;
4510 }
4511 }
4512 else
4513 {
4514 bgp = bgp_get_default ();
4515 if (bgp == NULL)
4516 {
4517 vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE);
4518 return CMD_WARNING;
4519 }
4520 }
4521
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004522 return bgp_clear (vty, bgp, afi, safi, sort, stype, arg);
paul718e3742002-12-13 20:15:29 +00004523}
4524
4525DEFUN (clear_ip_bgp_all,
4526 clear_ip_bgp_all_cmd,
4527 "clear ip bgp *",
4528 CLEAR_STR
4529 IP_STR
4530 BGP_STR
4531 "Clear all peers\n")
4532{
4533 if (argc == 1)
4534 return bgp_clear_vty (vty, argv[0], 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL);
4535
4536 return bgp_clear_vty (vty, NULL, 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL);
4537}
4538
4539ALIAS (clear_ip_bgp_all,
4540 clear_bgp_all_cmd,
4541 "clear bgp *",
4542 CLEAR_STR
4543 BGP_STR
4544 "Clear all peers\n")
4545
4546ALIAS (clear_ip_bgp_all,
4547 clear_bgp_ipv6_all_cmd,
4548 "clear bgp ipv6 *",
4549 CLEAR_STR
4550 BGP_STR
4551 "Address family\n"
4552 "Clear all peers\n")
4553
4554ALIAS (clear_ip_bgp_all,
4555 clear_ip_bgp_instance_all_cmd,
4556 "clear ip bgp view WORD *",
4557 CLEAR_STR
4558 IP_STR
4559 BGP_STR
4560 "BGP view\n"
4561 "view name\n"
4562 "Clear all peers\n")
4563
4564ALIAS (clear_ip_bgp_all,
4565 clear_bgp_instance_all_cmd,
4566 "clear bgp view WORD *",
4567 CLEAR_STR
4568 BGP_STR
4569 "BGP view\n"
4570 "view name\n"
4571 "Clear all peers\n")
4572
4573DEFUN (clear_ip_bgp_peer,
4574 clear_ip_bgp_peer_cmd,
4575 "clear ip bgp (A.B.C.D|X:X::X:X)",
4576 CLEAR_STR
4577 IP_STR
4578 BGP_STR
4579 "BGP neighbor IP address to clear\n"
4580 "BGP IPv6 neighbor to clear\n")
4581{
4582 return bgp_clear_vty (vty, NULL, 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[0]);
4583}
4584
4585ALIAS (clear_ip_bgp_peer,
4586 clear_bgp_peer_cmd,
4587 "clear bgp (A.B.C.D|X:X::X:X)",
4588 CLEAR_STR
4589 BGP_STR
4590 "BGP neighbor address to clear\n"
4591 "BGP IPv6 neighbor to clear\n")
4592
4593ALIAS (clear_ip_bgp_peer,
4594 clear_bgp_ipv6_peer_cmd,
4595 "clear bgp ipv6 (A.B.C.D|X:X::X:X)",
4596 CLEAR_STR
4597 BGP_STR
4598 "Address family\n"
4599 "BGP neighbor address to clear\n"
4600 "BGP IPv6 neighbor to clear\n")
4601
4602DEFUN (clear_ip_bgp_peer_group,
4603 clear_ip_bgp_peer_group_cmd,
4604 "clear ip bgp peer-group WORD",
4605 CLEAR_STR
4606 IP_STR
4607 BGP_STR
4608 "Clear all members of peer-group\n"
4609 "BGP peer-group name\n")
4610{
4611 return bgp_clear_vty (vty, NULL, 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[0]);
4612}
4613
4614ALIAS (clear_ip_bgp_peer_group,
4615 clear_bgp_peer_group_cmd,
4616 "clear bgp peer-group WORD",
4617 CLEAR_STR
4618 BGP_STR
4619 "Clear all members of peer-group\n"
4620 "BGP peer-group name\n")
4621
4622ALIAS (clear_ip_bgp_peer_group,
4623 clear_bgp_ipv6_peer_group_cmd,
4624 "clear bgp ipv6 peer-group WORD",
4625 CLEAR_STR
4626 BGP_STR
4627 "Address family\n"
4628 "Clear all members of peer-group\n"
4629 "BGP peer-group name\n")
4630
4631DEFUN (clear_ip_bgp_external,
4632 clear_ip_bgp_external_cmd,
4633 "clear ip bgp external",
4634 CLEAR_STR
4635 IP_STR
4636 BGP_STR
4637 "Clear all external peers\n")
4638{
4639 return bgp_clear_vty (vty, NULL, 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL);
4640}
4641
4642ALIAS (clear_ip_bgp_external,
4643 clear_bgp_external_cmd,
4644 "clear bgp external",
4645 CLEAR_STR
4646 BGP_STR
4647 "Clear all external peers\n")
4648
4649ALIAS (clear_ip_bgp_external,
4650 clear_bgp_ipv6_external_cmd,
4651 "clear bgp ipv6 external",
4652 CLEAR_STR
4653 BGP_STR
4654 "Address family\n"
4655 "Clear all external peers\n")
4656
4657DEFUN (clear_ip_bgp_as,
4658 clear_ip_bgp_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00004659 "clear ip bgp " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00004660 CLEAR_STR
4661 IP_STR
4662 BGP_STR
4663 "Clear peers with the AS number\n")
4664{
4665 return bgp_clear_vty (vty, NULL, 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[0]);
4666}
4667
4668ALIAS (clear_ip_bgp_as,
4669 clear_bgp_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00004670 "clear bgp " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00004671 CLEAR_STR
4672 BGP_STR
4673 "Clear peers with the AS number\n")
4674
4675ALIAS (clear_ip_bgp_as,
4676 clear_bgp_ipv6_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00004677 "clear bgp ipv6 " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00004678 CLEAR_STR
4679 BGP_STR
4680 "Address family\n"
4681 "Clear peers with the AS number\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02004682
paul718e3742002-12-13 20:15:29 +00004683/* Outbound soft-reconfiguration */
4684DEFUN (clear_ip_bgp_all_soft_out,
4685 clear_ip_bgp_all_soft_out_cmd,
4686 "clear ip bgp * soft out",
4687 CLEAR_STR
4688 IP_STR
4689 BGP_STR
4690 "Clear all peers\n"
4691 "Soft reconfig\n"
4692 "Soft reconfig outbound update\n")
4693{
4694 if (argc == 1)
4695 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
4696 BGP_CLEAR_SOFT_OUT, NULL);
4697
4698 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
4699 BGP_CLEAR_SOFT_OUT, NULL);
4700}
4701
4702ALIAS (clear_ip_bgp_all_soft_out,
4703 clear_ip_bgp_all_out_cmd,
4704 "clear ip bgp * out",
4705 CLEAR_STR
4706 IP_STR
4707 BGP_STR
4708 "Clear all peers\n"
4709 "Soft reconfig outbound update\n")
4710
4711ALIAS (clear_ip_bgp_all_soft_out,
4712 clear_ip_bgp_instance_all_soft_out_cmd,
4713 "clear ip bgp view WORD * soft out",
4714 CLEAR_STR
4715 IP_STR
4716 BGP_STR
4717 "BGP view\n"
4718 "view name\n"
4719 "Clear all peers\n"
4720 "Soft reconfig\n"
4721 "Soft reconfig outbound update\n")
4722
4723DEFUN (clear_ip_bgp_all_ipv4_soft_out,
4724 clear_ip_bgp_all_ipv4_soft_out_cmd,
4725 "clear ip bgp * ipv4 (unicast|multicast) soft out",
4726 CLEAR_STR
4727 IP_STR
4728 BGP_STR
4729 "Clear all peers\n"
4730 "Address family\n"
4731 "Address Family modifier\n"
4732 "Address Family modifier\n"
4733 "Soft reconfig\n"
4734 "Soft reconfig outbound update\n")
4735{
4736 if (strncmp (argv[0], "m", 1) == 0)
4737 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
4738 BGP_CLEAR_SOFT_OUT, NULL);
4739
4740 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
4741 BGP_CLEAR_SOFT_OUT, NULL);
4742}
4743
4744ALIAS (clear_ip_bgp_all_ipv4_soft_out,
4745 clear_ip_bgp_all_ipv4_out_cmd,
4746 "clear ip bgp * ipv4 (unicast|multicast) out",
4747 CLEAR_STR
4748 IP_STR
4749 BGP_STR
4750 "Clear all peers\n"
4751 "Address family\n"
4752 "Address Family modifier\n"
4753 "Address Family modifier\n"
4754 "Soft reconfig outbound update\n")
4755
4756DEFUN (clear_ip_bgp_instance_all_ipv4_soft_out,
4757 clear_ip_bgp_instance_all_ipv4_soft_out_cmd,
4758 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft out",
4759 CLEAR_STR
4760 IP_STR
4761 BGP_STR
4762 "BGP view\n"
4763 "view name\n"
4764 "Clear all peers\n"
4765 "Address family\n"
4766 "Address Family modifier\n"
4767 "Address Family modifier\n"
4768 "Soft reconfig outbound update\n")
4769{
4770 if (strncmp (argv[1], "m", 1) == 0)
4771 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
4772 BGP_CLEAR_SOFT_OUT, NULL);
4773
4774 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
4775 BGP_CLEAR_SOFT_OUT, NULL);
4776}
4777
4778DEFUN (clear_ip_bgp_all_vpnv4_soft_out,
4779 clear_ip_bgp_all_vpnv4_soft_out_cmd,
4780 "clear ip bgp * vpnv4 unicast soft out",
4781 CLEAR_STR
4782 IP_STR
4783 BGP_STR
4784 "Clear all peers\n"
4785 "Address family\n"
4786 "Address Family Modifier\n"
4787 "Soft reconfig\n"
4788 "Soft reconfig outbound update\n")
4789{
4790 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
4791 BGP_CLEAR_SOFT_OUT, NULL);
4792}
4793
4794ALIAS (clear_ip_bgp_all_vpnv4_soft_out,
4795 clear_ip_bgp_all_vpnv4_out_cmd,
4796 "clear ip bgp * vpnv4 unicast out",
4797 CLEAR_STR
4798 IP_STR
4799 BGP_STR
4800 "Clear all peers\n"
4801 "Address family\n"
4802 "Address Family Modifier\n"
4803 "Soft reconfig outbound update\n")
4804
4805DEFUN (clear_bgp_all_soft_out,
4806 clear_bgp_all_soft_out_cmd,
4807 "clear bgp * soft out",
4808 CLEAR_STR
4809 BGP_STR
4810 "Clear all peers\n"
4811 "Soft reconfig\n"
4812 "Soft reconfig outbound update\n")
4813{
4814 if (argc == 1)
4815 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
4816 BGP_CLEAR_SOFT_OUT, NULL);
4817
4818 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
4819 BGP_CLEAR_SOFT_OUT, NULL);
4820}
4821
4822ALIAS (clear_bgp_all_soft_out,
4823 clear_bgp_instance_all_soft_out_cmd,
4824 "clear bgp view WORD * soft out",
4825 CLEAR_STR
4826 BGP_STR
4827 "BGP view\n"
4828 "view name\n"
4829 "Clear all peers\n"
4830 "Soft reconfig\n"
4831 "Soft reconfig outbound update\n")
4832
4833ALIAS (clear_bgp_all_soft_out,
4834 clear_bgp_all_out_cmd,
4835 "clear bgp * out",
4836 CLEAR_STR
4837 BGP_STR
4838 "Clear all peers\n"
4839 "Soft reconfig outbound update\n")
4840
4841ALIAS (clear_bgp_all_soft_out,
4842 clear_bgp_ipv6_all_soft_out_cmd,
4843 "clear bgp ipv6 * soft out",
4844 CLEAR_STR
4845 BGP_STR
4846 "Address family\n"
4847 "Clear all peers\n"
4848 "Soft reconfig\n"
4849 "Soft reconfig outbound update\n")
4850
4851ALIAS (clear_bgp_all_soft_out,
4852 clear_bgp_ipv6_all_out_cmd,
4853 "clear bgp ipv6 * out",
4854 CLEAR_STR
4855 BGP_STR
4856 "Address family\n"
4857 "Clear all peers\n"
4858 "Soft reconfig outbound update\n")
4859
4860DEFUN (clear_ip_bgp_peer_soft_out,
4861 clear_ip_bgp_peer_soft_out_cmd,
4862 "clear ip bgp A.B.C.D soft out",
4863 CLEAR_STR
4864 IP_STR
4865 BGP_STR
4866 "BGP neighbor address to clear\n"
4867 "Soft reconfig\n"
4868 "Soft reconfig outbound update\n")
4869{
4870 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
4871 BGP_CLEAR_SOFT_OUT, argv[0]);
4872}
4873
4874ALIAS (clear_ip_bgp_peer_soft_out,
4875 clear_ip_bgp_peer_out_cmd,
4876 "clear ip bgp A.B.C.D out",
4877 CLEAR_STR
4878 IP_STR
4879 BGP_STR
4880 "BGP neighbor address to clear\n"
4881 "Soft reconfig outbound update\n")
4882
4883DEFUN (clear_ip_bgp_peer_ipv4_soft_out,
4884 clear_ip_bgp_peer_ipv4_soft_out_cmd,
4885 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft out",
4886 CLEAR_STR
4887 IP_STR
4888 BGP_STR
4889 "BGP neighbor address to clear\n"
4890 "Address family\n"
4891 "Address Family modifier\n"
4892 "Address Family modifier\n"
4893 "Soft reconfig\n"
4894 "Soft reconfig outbound update\n")
4895{
4896 if (strncmp (argv[1], "m", 1) == 0)
4897 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
4898 BGP_CLEAR_SOFT_OUT, argv[0]);
4899
4900 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
4901 BGP_CLEAR_SOFT_OUT, argv[0]);
4902}
4903
4904ALIAS (clear_ip_bgp_peer_ipv4_soft_out,
4905 clear_ip_bgp_peer_ipv4_out_cmd,
4906 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) out",
4907 CLEAR_STR
4908 IP_STR
4909 BGP_STR
4910 "BGP neighbor address to clear\n"
4911 "Address family\n"
4912 "Address Family modifier\n"
4913 "Address Family modifier\n"
4914 "Soft reconfig outbound update\n")
4915
4916DEFUN (clear_ip_bgp_peer_vpnv4_soft_out,
4917 clear_ip_bgp_peer_vpnv4_soft_out_cmd,
4918 "clear ip bgp A.B.C.D vpnv4 unicast soft out",
4919 CLEAR_STR
4920 IP_STR
4921 BGP_STR
4922 "BGP neighbor address to clear\n"
4923 "Address family\n"
4924 "Address Family Modifier\n"
4925 "Soft reconfig\n"
4926 "Soft reconfig outbound update\n")
4927{
4928 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
4929 BGP_CLEAR_SOFT_OUT, argv[0]);
4930}
4931
4932ALIAS (clear_ip_bgp_peer_vpnv4_soft_out,
4933 clear_ip_bgp_peer_vpnv4_out_cmd,
4934 "clear ip bgp A.B.C.D vpnv4 unicast out",
4935 CLEAR_STR
4936 IP_STR
4937 BGP_STR
4938 "BGP neighbor address to clear\n"
4939 "Address family\n"
4940 "Address Family Modifier\n"
4941 "Soft reconfig outbound update\n")
4942
4943DEFUN (clear_bgp_peer_soft_out,
4944 clear_bgp_peer_soft_out_cmd,
4945 "clear bgp (A.B.C.D|X:X::X:X) soft out",
4946 CLEAR_STR
4947 BGP_STR
4948 "BGP neighbor address to clear\n"
4949 "BGP IPv6 neighbor to clear\n"
4950 "Soft reconfig\n"
4951 "Soft reconfig outbound update\n")
4952{
4953 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
4954 BGP_CLEAR_SOFT_OUT, argv[0]);
4955}
4956
4957ALIAS (clear_bgp_peer_soft_out,
4958 clear_bgp_ipv6_peer_soft_out_cmd,
4959 "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft out",
4960 CLEAR_STR
4961 BGP_STR
4962 "Address family\n"
4963 "BGP neighbor address to clear\n"
4964 "BGP IPv6 neighbor to clear\n"
4965 "Soft reconfig\n"
4966 "Soft reconfig outbound update\n")
4967
4968ALIAS (clear_bgp_peer_soft_out,
4969 clear_bgp_peer_out_cmd,
4970 "clear bgp (A.B.C.D|X:X::X:X) out",
4971 CLEAR_STR
4972 BGP_STR
4973 "BGP neighbor address to clear\n"
4974 "BGP IPv6 neighbor to clear\n"
4975 "Soft reconfig outbound update\n")
4976
4977ALIAS (clear_bgp_peer_soft_out,
4978 clear_bgp_ipv6_peer_out_cmd,
4979 "clear bgp ipv6 (A.B.C.D|X:X::X:X) out",
4980 CLEAR_STR
4981 BGP_STR
4982 "Address family\n"
4983 "BGP neighbor address to clear\n"
4984 "BGP IPv6 neighbor to clear\n"
4985 "Soft reconfig outbound update\n")
4986
4987DEFUN (clear_ip_bgp_peer_group_soft_out,
4988 clear_ip_bgp_peer_group_soft_out_cmd,
4989 "clear ip bgp peer-group WORD soft out",
4990 CLEAR_STR
4991 IP_STR
4992 BGP_STR
4993 "Clear all members of peer-group\n"
4994 "BGP peer-group name\n"
4995 "Soft reconfig\n"
4996 "Soft reconfig outbound update\n")
4997{
4998 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
4999 BGP_CLEAR_SOFT_OUT, argv[0]);
5000}
5001
5002ALIAS (clear_ip_bgp_peer_group_soft_out,
5003 clear_ip_bgp_peer_group_out_cmd,
5004 "clear ip bgp peer-group WORD out",
5005 CLEAR_STR
5006 IP_STR
5007 BGP_STR
5008 "Clear all members of peer-group\n"
5009 "BGP peer-group name\n"
5010 "Soft reconfig outbound update\n")
5011
5012DEFUN (clear_ip_bgp_peer_group_ipv4_soft_out,
5013 clear_ip_bgp_peer_group_ipv4_soft_out_cmd,
5014 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft out",
5015 CLEAR_STR
5016 IP_STR
5017 BGP_STR
5018 "Clear all members of peer-group\n"
5019 "BGP peer-group name\n"
5020 "Address family\n"
5021 "Address Family modifier\n"
5022 "Address Family modifier\n"
5023 "Soft reconfig\n"
5024 "Soft reconfig outbound update\n")
5025{
5026 if (strncmp (argv[1], "m", 1) == 0)
5027 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
5028 BGP_CLEAR_SOFT_OUT, argv[0]);
5029
5030 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5031 BGP_CLEAR_SOFT_OUT, argv[0]);
5032}
5033
5034ALIAS (clear_ip_bgp_peer_group_ipv4_soft_out,
5035 clear_ip_bgp_peer_group_ipv4_out_cmd,
5036 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) out",
5037 CLEAR_STR
5038 IP_STR
5039 BGP_STR
5040 "Clear all members of peer-group\n"
5041 "BGP peer-group name\n"
5042 "Address family\n"
5043 "Address Family modifier\n"
5044 "Address Family modifier\n"
5045 "Soft reconfig outbound update\n")
5046
5047DEFUN (clear_bgp_peer_group_soft_out,
5048 clear_bgp_peer_group_soft_out_cmd,
5049 "clear bgp peer-group WORD soft out",
5050 CLEAR_STR
5051 BGP_STR
5052 "Clear all members of peer-group\n"
5053 "BGP peer-group name\n"
5054 "Soft reconfig\n"
5055 "Soft reconfig outbound update\n")
5056{
5057 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
5058 BGP_CLEAR_SOFT_OUT, argv[0]);
5059}
5060
5061ALIAS (clear_bgp_peer_group_soft_out,
5062 clear_bgp_ipv6_peer_group_soft_out_cmd,
5063 "clear bgp ipv6 peer-group WORD soft out",
5064 CLEAR_STR
5065 BGP_STR
5066 "Address family\n"
5067 "Clear all members of peer-group\n"
5068 "BGP peer-group name\n"
5069 "Soft reconfig\n"
5070 "Soft reconfig outbound update\n")
5071
5072ALIAS (clear_bgp_peer_group_soft_out,
5073 clear_bgp_peer_group_out_cmd,
5074 "clear bgp peer-group WORD out",
5075 CLEAR_STR
5076 BGP_STR
5077 "Clear all members of peer-group\n"
5078 "BGP peer-group name\n"
5079 "Soft reconfig outbound update\n")
5080
5081ALIAS (clear_bgp_peer_group_soft_out,
5082 clear_bgp_ipv6_peer_group_out_cmd,
5083 "clear bgp ipv6 peer-group WORD out",
5084 CLEAR_STR
5085 BGP_STR
5086 "Address family\n"
5087 "Clear all members of peer-group\n"
5088 "BGP peer-group name\n"
5089 "Soft reconfig outbound update\n")
5090
5091DEFUN (clear_ip_bgp_external_soft_out,
5092 clear_ip_bgp_external_soft_out_cmd,
5093 "clear ip bgp external soft out",
5094 CLEAR_STR
5095 IP_STR
5096 BGP_STR
5097 "Clear all external peers\n"
5098 "Soft reconfig\n"
5099 "Soft reconfig outbound update\n")
5100{
5101 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5102 BGP_CLEAR_SOFT_OUT, NULL);
5103}
5104
5105ALIAS (clear_ip_bgp_external_soft_out,
5106 clear_ip_bgp_external_out_cmd,
5107 "clear ip bgp external out",
5108 CLEAR_STR
5109 IP_STR
5110 BGP_STR
5111 "Clear all external peers\n"
5112 "Soft reconfig outbound update\n")
5113
5114DEFUN (clear_ip_bgp_external_ipv4_soft_out,
5115 clear_ip_bgp_external_ipv4_soft_out_cmd,
5116 "clear ip bgp external ipv4 (unicast|multicast) soft out",
5117 CLEAR_STR
5118 IP_STR
5119 BGP_STR
5120 "Clear all external peers\n"
5121 "Address family\n"
5122 "Address Family modifier\n"
5123 "Address Family modifier\n"
5124 "Soft reconfig\n"
5125 "Soft reconfig outbound update\n")
5126{
5127 if (strncmp (argv[0], "m", 1) == 0)
5128 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
5129 BGP_CLEAR_SOFT_OUT, NULL);
5130
5131 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5132 BGP_CLEAR_SOFT_OUT, NULL);
5133}
5134
5135ALIAS (clear_ip_bgp_external_ipv4_soft_out,
5136 clear_ip_bgp_external_ipv4_out_cmd,
5137 "clear ip bgp external ipv4 (unicast|multicast) out",
5138 CLEAR_STR
5139 IP_STR
5140 BGP_STR
5141 "Clear all external peers\n"
5142 "Address family\n"
5143 "Address Family modifier\n"
5144 "Address Family modifier\n"
5145 "Soft reconfig outbound update\n")
5146
5147DEFUN (clear_bgp_external_soft_out,
5148 clear_bgp_external_soft_out_cmd,
5149 "clear bgp external soft out",
5150 CLEAR_STR
5151 BGP_STR
5152 "Clear all external peers\n"
5153 "Soft reconfig\n"
5154 "Soft reconfig outbound update\n")
5155{
5156 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
5157 BGP_CLEAR_SOFT_OUT, NULL);
5158}
5159
5160ALIAS (clear_bgp_external_soft_out,
5161 clear_bgp_ipv6_external_soft_out_cmd,
5162 "clear bgp ipv6 external soft out",
5163 CLEAR_STR
5164 BGP_STR
5165 "Address family\n"
5166 "Clear all external peers\n"
5167 "Soft reconfig\n"
5168 "Soft reconfig outbound update\n")
5169
5170ALIAS (clear_bgp_external_soft_out,
5171 clear_bgp_external_out_cmd,
5172 "clear bgp external out",
5173 CLEAR_STR
5174 BGP_STR
5175 "Clear all external peers\n"
5176 "Soft reconfig outbound update\n")
5177
5178ALIAS (clear_bgp_external_soft_out,
5179 clear_bgp_ipv6_external_out_cmd,
5180 "clear bgp ipv6 external WORD out",
5181 CLEAR_STR
5182 BGP_STR
5183 "Address family\n"
5184 "Clear all external peers\n"
5185 "Soft reconfig outbound update\n")
5186
5187DEFUN (clear_ip_bgp_as_soft_out,
5188 clear_ip_bgp_as_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005189 "clear ip bgp " CMD_AS_RANGE " soft out",
paul718e3742002-12-13 20:15:29 +00005190 CLEAR_STR
5191 IP_STR
5192 BGP_STR
5193 "Clear peers with the AS number\n"
5194 "Soft reconfig\n"
5195 "Soft reconfig outbound update\n")
5196{
5197 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
5198 BGP_CLEAR_SOFT_OUT, argv[0]);
5199}
5200
5201ALIAS (clear_ip_bgp_as_soft_out,
5202 clear_ip_bgp_as_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005203 "clear ip bgp " CMD_AS_RANGE " out",
paul718e3742002-12-13 20:15:29 +00005204 CLEAR_STR
5205 IP_STR
5206 BGP_STR
5207 "Clear peers with the AS number\n"
5208 "Soft reconfig outbound update\n")
5209
5210DEFUN (clear_ip_bgp_as_ipv4_soft_out,
5211 clear_ip_bgp_as_ipv4_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005212 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft out",
paul718e3742002-12-13 20:15:29 +00005213 CLEAR_STR
5214 IP_STR
5215 BGP_STR
5216 "Clear peers with the AS number\n"
5217 "Address family\n"
5218 "Address Family modifier\n"
5219 "Address Family modifier\n"
5220 "Soft reconfig\n"
5221 "Soft reconfig outbound update\n")
5222{
5223 if (strncmp (argv[1], "m", 1) == 0)
5224 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
5225 BGP_CLEAR_SOFT_OUT, argv[0]);
5226
5227 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
5228 BGP_CLEAR_SOFT_OUT, argv[0]);
5229}
5230
5231ALIAS (clear_ip_bgp_as_ipv4_soft_out,
5232 clear_ip_bgp_as_ipv4_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005233 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) out",
paul718e3742002-12-13 20:15:29 +00005234 CLEAR_STR
5235 IP_STR
5236 BGP_STR
5237 "Clear peers with the AS number\n"
5238 "Address family\n"
5239 "Address Family modifier\n"
5240 "Address Family modifier\n"
5241 "Soft reconfig outbound update\n")
5242
5243DEFUN (clear_ip_bgp_as_vpnv4_soft_out,
5244 clear_ip_bgp_as_vpnv4_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005245 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft out",
paul718e3742002-12-13 20:15:29 +00005246 CLEAR_STR
5247 IP_STR
5248 BGP_STR
5249 "Clear peers with the AS number\n"
5250 "Address family\n"
5251 "Address Family modifier\n"
5252 "Soft reconfig\n"
5253 "Soft reconfig outbound update\n")
5254{
5255 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
5256 BGP_CLEAR_SOFT_OUT, argv[0]);
5257}
5258
5259ALIAS (clear_ip_bgp_as_vpnv4_soft_out,
5260 clear_ip_bgp_as_vpnv4_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005261 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast out",
paul718e3742002-12-13 20:15:29 +00005262 CLEAR_STR
5263 IP_STR
5264 BGP_STR
5265 "Clear peers with the AS number\n"
5266 "Address family\n"
5267 "Address Family modifier\n"
5268 "Soft reconfig outbound update\n")
5269
5270DEFUN (clear_bgp_as_soft_out,
5271 clear_bgp_as_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005272 "clear bgp " CMD_AS_RANGE " soft out",
paul718e3742002-12-13 20:15:29 +00005273 CLEAR_STR
5274 BGP_STR
5275 "Clear peers with the AS number\n"
5276 "Soft reconfig\n"
5277 "Soft reconfig outbound update\n")
5278{
5279 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
5280 BGP_CLEAR_SOFT_OUT, argv[0]);
5281}
5282
5283ALIAS (clear_bgp_as_soft_out,
5284 clear_bgp_ipv6_as_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005285 "clear bgp ipv6 " CMD_AS_RANGE " soft out",
paul718e3742002-12-13 20:15:29 +00005286 CLEAR_STR
5287 BGP_STR
5288 "Address family\n"
5289 "Clear peers with the AS number\n"
5290 "Soft reconfig\n"
5291 "Soft reconfig outbound update\n")
5292
5293ALIAS (clear_bgp_as_soft_out,
5294 clear_bgp_as_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005295 "clear bgp " CMD_AS_RANGE " out",
paul718e3742002-12-13 20:15:29 +00005296 CLEAR_STR
5297 BGP_STR
5298 "Clear peers with the AS number\n"
5299 "Soft reconfig outbound update\n")
5300
5301ALIAS (clear_bgp_as_soft_out,
5302 clear_bgp_ipv6_as_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005303 "clear bgp ipv6 " CMD_AS_RANGE " out",
paul718e3742002-12-13 20:15:29 +00005304 CLEAR_STR
5305 BGP_STR
5306 "Address family\n"
5307 "Clear peers with the AS number\n"
5308 "Soft reconfig outbound update\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02005309
paul718e3742002-12-13 20:15:29 +00005310/* Inbound soft-reconfiguration */
5311DEFUN (clear_ip_bgp_all_soft_in,
5312 clear_ip_bgp_all_soft_in_cmd,
5313 "clear ip bgp * soft in",
5314 CLEAR_STR
5315 IP_STR
5316 BGP_STR
5317 "Clear all peers\n"
5318 "Soft reconfig\n"
5319 "Soft reconfig inbound update\n")
5320{
5321 if (argc == 1)
5322 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5323 BGP_CLEAR_SOFT_IN, NULL);
5324
5325 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5326 BGP_CLEAR_SOFT_IN, NULL);
5327}
5328
5329ALIAS (clear_ip_bgp_all_soft_in,
5330 clear_ip_bgp_instance_all_soft_in_cmd,
5331 "clear ip bgp view WORD * soft in",
5332 CLEAR_STR
5333 IP_STR
5334 BGP_STR
5335 "BGP view\n"
5336 "view name\n"
5337 "Clear all peers\n"
5338 "Soft reconfig\n"
5339 "Soft reconfig inbound update\n")
5340
5341ALIAS (clear_ip_bgp_all_soft_in,
5342 clear_ip_bgp_all_in_cmd,
5343 "clear ip bgp * in",
5344 CLEAR_STR
5345 IP_STR
5346 BGP_STR
5347 "Clear all peers\n"
5348 "Soft reconfig inbound update\n")
5349
5350DEFUN (clear_ip_bgp_all_in_prefix_filter,
5351 clear_ip_bgp_all_in_prefix_filter_cmd,
5352 "clear ip bgp * in prefix-filter",
5353 CLEAR_STR
5354 IP_STR
5355 BGP_STR
5356 "Clear all peers\n"
5357 "Soft reconfig inbound update\n"
5358 "Push out prefix-list ORF and do inbound soft reconfig\n")
5359{
5360 if (argc== 1)
5361 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5362 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5363
5364 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5365 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5366}
5367
5368ALIAS (clear_ip_bgp_all_in_prefix_filter,
5369 clear_ip_bgp_instance_all_in_prefix_filter_cmd,
5370 "clear ip bgp view WORD * in prefix-filter",
5371 CLEAR_STR
5372 IP_STR
5373 BGP_STR
5374 "BGP view\n"
5375 "view name\n"
5376 "Clear all peers\n"
5377 "Soft reconfig inbound update\n"
5378 "Push out prefix-list ORF and do inbound soft reconfig\n")
5379
5380
5381DEFUN (clear_ip_bgp_all_ipv4_soft_in,
5382 clear_ip_bgp_all_ipv4_soft_in_cmd,
5383 "clear ip bgp * ipv4 (unicast|multicast) soft in",
5384 CLEAR_STR
5385 IP_STR
5386 BGP_STR
5387 "Clear all peers\n"
5388 "Address family\n"
5389 "Address Family modifier\n"
5390 "Address Family modifier\n"
5391 "Soft reconfig\n"
5392 "Soft reconfig inbound update\n")
5393{
5394 if (strncmp (argv[0], "m", 1) == 0)
5395 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
5396 BGP_CLEAR_SOFT_IN, NULL);
5397
5398 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5399 BGP_CLEAR_SOFT_IN, NULL);
5400}
5401
5402ALIAS (clear_ip_bgp_all_ipv4_soft_in,
5403 clear_ip_bgp_all_ipv4_in_cmd,
5404 "clear ip bgp * ipv4 (unicast|multicast) in",
5405 CLEAR_STR
5406 IP_STR
5407 BGP_STR
5408 "Clear all peers\n"
5409 "Address family\n"
5410 "Address Family modifier\n"
5411 "Address Family modifier\n"
5412 "Soft reconfig inbound update\n")
5413
5414DEFUN (clear_ip_bgp_instance_all_ipv4_soft_in,
5415 clear_ip_bgp_instance_all_ipv4_soft_in_cmd,
5416 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft in",
5417 CLEAR_STR
5418 IP_STR
5419 BGP_STR
5420 "BGP view\n"
5421 "view name\n"
5422 "Clear all peers\n"
5423 "Address family\n"
5424 "Address Family modifier\n"
5425 "Address Family modifier\n"
5426 "Soft reconfig\n"
5427 "Soft reconfig inbound update\n")
5428{
5429 if (strncmp (argv[1], "m", 1) == 0)
5430 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
5431 BGP_CLEAR_SOFT_IN, NULL);
5432
5433 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5434 BGP_CLEAR_SOFT_IN, NULL);
5435}
5436
5437DEFUN (clear_ip_bgp_all_ipv4_in_prefix_filter,
5438 clear_ip_bgp_all_ipv4_in_prefix_filter_cmd,
5439 "clear ip bgp * ipv4 (unicast|multicast) in prefix-filter",
5440 CLEAR_STR
5441 IP_STR
5442 BGP_STR
5443 "Clear all peers\n"
5444 "Address family\n"
5445 "Address Family modifier\n"
5446 "Address Family modifier\n"
5447 "Soft reconfig inbound update\n"
5448 "Push out prefix-list ORF and do inbound soft reconfig\n")
5449{
5450 if (strncmp (argv[0], "m", 1) == 0)
5451 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
5452 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5453
5454 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5455 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5456}
5457
5458DEFUN (clear_ip_bgp_instance_all_ipv4_in_prefix_filter,
5459 clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd,
5460 "clear ip bgp view WORD * ipv4 (unicast|multicast) in prefix-filter",
5461 CLEAR_STR
5462 IP_STR
5463 BGP_STR
5464 "Clear all peers\n"
5465 "Address family\n"
5466 "Address Family modifier\n"
5467 "Address Family modifier\n"
5468 "Soft reconfig inbound update\n"
5469 "Push out prefix-list ORF and do inbound soft reconfig\n")
5470{
5471 if (strncmp (argv[1], "m", 1) == 0)
5472 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
5473 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5474
5475 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5476 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5477}
5478
5479DEFUN (clear_ip_bgp_all_vpnv4_soft_in,
5480 clear_ip_bgp_all_vpnv4_soft_in_cmd,
5481 "clear ip bgp * vpnv4 unicast soft in",
5482 CLEAR_STR
5483 IP_STR
5484 BGP_STR
5485 "Clear all peers\n"
5486 "Address family\n"
5487 "Address Family Modifier\n"
5488 "Soft reconfig\n"
5489 "Soft reconfig inbound update\n")
5490{
5491 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
5492 BGP_CLEAR_SOFT_IN, NULL);
5493}
5494
5495ALIAS (clear_ip_bgp_all_vpnv4_soft_in,
5496 clear_ip_bgp_all_vpnv4_in_cmd,
5497 "clear ip bgp * vpnv4 unicast in",
5498 CLEAR_STR
5499 IP_STR
5500 BGP_STR
5501 "Clear all peers\n"
5502 "Address family\n"
5503 "Address Family Modifier\n"
5504 "Soft reconfig inbound update\n")
5505
5506DEFUN (clear_bgp_all_soft_in,
5507 clear_bgp_all_soft_in_cmd,
5508 "clear bgp * soft in",
5509 CLEAR_STR
5510 BGP_STR
5511 "Clear all peers\n"
5512 "Soft reconfig\n"
5513 "Soft reconfig inbound update\n")
5514{
5515 if (argc == 1)
5516 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
5517 BGP_CLEAR_SOFT_IN, NULL);
5518
5519 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
5520 BGP_CLEAR_SOFT_IN, NULL);
5521}
5522
5523ALIAS (clear_bgp_all_soft_in,
5524 clear_bgp_instance_all_soft_in_cmd,
5525 "clear bgp view WORD * soft in",
5526 CLEAR_STR
5527 BGP_STR
5528 "BGP view\n"
5529 "view name\n"
5530 "Clear all peers\n"
5531 "Soft reconfig\n"
5532 "Soft reconfig inbound update\n")
5533
5534ALIAS (clear_bgp_all_soft_in,
5535 clear_bgp_ipv6_all_soft_in_cmd,
5536 "clear bgp ipv6 * soft in",
5537 CLEAR_STR
5538 BGP_STR
5539 "Address family\n"
5540 "Clear all peers\n"
5541 "Soft reconfig\n"
5542 "Soft reconfig inbound update\n")
5543
5544ALIAS (clear_bgp_all_soft_in,
5545 clear_bgp_all_in_cmd,
5546 "clear bgp * in",
5547 CLEAR_STR
5548 BGP_STR
5549 "Clear all peers\n"
5550 "Soft reconfig inbound update\n")
5551
5552ALIAS (clear_bgp_all_soft_in,
5553 clear_bgp_ipv6_all_in_cmd,
5554 "clear bgp ipv6 * in",
5555 CLEAR_STR
5556 BGP_STR
5557 "Address family\n"
5558 "Clear all peers\n"
5559 "Soft reconfig inbound update\n")
5560
5561DEFUN (clear_bgp_all_in_prefix_filter,
5562 clear_bgp_all_in_prefix_filter_cmd,
5563 "clear bgp * in prefix-filter",
5564 CLEAR_STR
5565 BGP_STR
5566 "Clear all peers\n"
5567 "Soft reconfig inbound update\n"
5568 "Push out prefix-list ORF and do inbound soft reconfig\n")
5569{
5570 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
5571 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5572}
5573
5574ALIAS (clear_bgp_all_in_prefix_filter,
5575 clear_bgp_ipv6_all_in_prefix_filter_cmd,
5576 "clear bgp ipv6 * in prefix-filter",
5577 CLEAR_STR
5578 BGP_STR
5579 "Address family\n"
5580 "Clear all peers\n"
5581 "Soft reconfig inbound update\n"
5582 "Push out prefix-list ORF and do inbound soft reconfig\n")
5583
5584DEFUN (clear_ip_bgp_peer_soft_in,
5585 clear_ip_bgp_peer_soft_in_cmd,
5586 "clear ip bgp A.B.C.D soft in",
5587 CLEAR_STR
5588 IP_STR
5589 BGP_STR
5590 "BGP neighbor address to clear\n"
5591 "Soft reconfig\n"
5592 "Soft reconfig inbound update\n")
5593{
5594 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5595 BGP_CLEAR_SOFT_IN, argv[0]);
5596}
5597
5598ALIAS (clear_ip_bgp_peer_soft_in,
5599 clear_ip_bgp_peer_in_cmd,
5600 "clear ip bgp A.B.C.D in",
5601 CLEAR_STR
5602 IP_STR
5603 BGP_STR
5604 "BGP neighbor address to clear\n"
5605 "Soft reconfig inbound update\n")
5606
5607DEFUN (clear_ip_bgp_peer_in_prefix_filter,
5608 clear_ip_bgp_peer_in_prefix_filter_cmd,
5609 "clear ip bgp A.B.C.D in prefix-filter",
5610 CLEAR_STR
5611 IP_STR
5612 BGP_STR
5613 "BGP neighbor address to clear\n"
5614 "Soft reconfig inbound update\n"
5615 "Push out the existing ORF prefix-list\n")
5616{
5617 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5618 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5619}
5620
5621DEFUN (clear_ip_bgp_peer_ipv4_soft_in,
5622 clear_ip_bgp_peer_ipv4_soft_in_cmd,
5623 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft in",
5624 CLEAR_STR
5625 IP_STR
5626 BGP_STR
5627 "BGP neighbor address to clear\n"
5628 "Address family\n"
5629 "Address Family modifier\n"
5630 "Address Family modifier\n"
5631 "Soft reconfig\n"
5632 "Soft reconfig inbound update\n")
5633{
5634 if (strncmp (argv[1], "m", 1) == 0)
5635 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
5636 BGP_CLEAR_SOFT_IN, argv[0]);
5637
5638 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5639 BGP_CLEAR_SOFT_IN, argv[0]);
5640}
5641
5642ALIAS (clear_ip_bgp_peer_ipv4_soft_in,
5643 clear_ip_bgp_peer_ipv4_in_cmd,
5644 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in",
5645 CLEAR_STR
5646 IP_STR
5647 BGP_STR
5648 "BGP neighbor address to clear\n"
5649 "Address family\n"
5650 "Address Family modifier\n"
5651 "Address Family modifier\n"
5652 "Soft reconfig inbound update\n")
5653
5654DEFUN (clear_ip_bgp_peer_ipv4_in_prefix_filter,
5655 clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd,
5656 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in prefix-filter",
5657 CLEAR_STR
5658 IP_STR
5659 BGP_STR
5660 "BGP neighbor address to clear\n"
5661 "Address family\n"
5662 "Address Family modifier\n"
5663 "Address Family modifier\n"
5664 "Soft reconfig inbound update\n"
5665 "Push out the existing ORF prefix-list\n")
5666{
5667 if (strncmp (argv[1], "m", 1) == 0)
5668 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
5669 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5670
5671 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5672 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5673}
5674
5675DEFUN (clear_ip_bgp_peer_vpnv4_soft_in,
5676 clear_ip_bgp_peer_vpnv4_soft_in_cmd,
5677 "clear ip bgp A.B.C.D vpnv4 unicast soft in",
5678 CLEAR_STR
5679 IP_STR
5680 BGP_STR
5681 "BGP neighbor address to clear\n"
5682 "Address family\n"
5683 "Address Family Modifier\n"
5684 "Soft reconfig\n"
5685 "Soft reconfig inbound update\n")
5686{
5687 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
5688 BGP_CLEAR_SOFT_IN, argv[0]);
5689}
5690
5691ALIAS (clear_ip_bgp_peer_vpnv4_soft_in,
5692 clear_ip_bgp_peer_vpnv4_in_cmd,
5693 "clear ip bgp A.B.C.D vpnv4 unicast in",
5694 CLEAR_STR
5695 IP_STR
5696 BGP_STR
5697 "BGP neighbor address to clear\n"
5698 "Address family\n"
5699 "Address Family Modifier\n"
5700 "Soft reconfig inbound update\n")
5701
5702DEFUN (clear_bgp_peer_soft_in,
5703 clear_bgp_peer_soft_in_cmd,
5704 "clear bgp (A.B.C.D|X:X::X:X) soft in",
5705 CLEAR_STR
5706 BGP_STR
5707 "BGP neighbor address to clear\n"
5708 "BGP IPv6 neighbor to clear\n"
5709 "Soft reconfig\n"
5710 "Soft reconfig inbound update\n")
5711{
5712 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
5713 BGP_CLEAR_SOFT_IN, argv[0]);
5714}
5715
5716ALIAS (clear_bgp_peer_soft_in,
5717 clear_bgp_ipv6_peer_soft_in_cmd,
5718 "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft in",
5719 CLEAR_STR
5720 BGP_STR
5721 "Address family\n"
5722 "BGP neighbor address to clear\n"
5723 "BGP IPv6 neighbor to clear\n"
5724 "Soft reconfig\n"
5725 "Soft reconfig inbound update\n")
5726
5727ALIAS (clear_bgp_peer_soft_in,
5728 clear_bgp_peer_in_cmd,
5729 "clear bgp (A.B.C.D|X:X::X:X) in",
5730 CLEAR_STR
5731 BGP_STR
5732 "BGP neighbor address to clear\n"
5733 "BGP IPv6 neighbor to clear\n"
5734 "Soft reconfig inbound update\n")
5735
5736ALIAS (clear_bgp_peer_soft_in,
5737 clear_bgp_ipv6_peer_in_cmd,
5738 "clear bgp ipv6 (A.B.C.D|X:X::X:X) in",
5739 CLEAR_STR
5740 BGP_STR
5741 "Address family\n"
5742 "BGP neighbor address to clear\n"
5743 "BGP IPv6 neighbor to clear\n"
5744 "Soft reconfig inbound update\n")
5745
5746DEFUN (clear_bgp_peer_in_prefix_filter,
5747 clear_bgp_peer_in_prefix_filter_cmd,
5748 "clear bgp (A.B.C.D|X:X::X:X) in prefix-filter",
5749 CLEAR_STR
5750 BGP_STR
5751 "BGP neighbor address to clear\n"
5752 "BGP IPv6 neighbor to clear\n"
5753 "Soft reconfig inbound update\n"
5754 "Push out the existing ORF prefix-list\n")
5755{
5756 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
5757 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5758}
5759
5760ALIAS (clear_bgp_peer_in_prefix_filter,
5761 clear_bgp_ipv6_peer_in_prefix_filter_cmd,
5762 "clear bgp ipv6 (A.B.C.D|X:X::X:X) in prefix-filter",
5763 CLEAR_STR
5764 BGP_STR
5765 "Address family\n"
5766 "BGP neighbor address to clear\n"
5767 "BGP IPv6 neighbor to clear\n"
5768 "Soft reconfig inbound update\n"
5769 "Push out the existing ORF prefix-list\n")
5770
5771DEFUN (clear_ip_bgp_peer_group_soft_in,
5772 clear_ip_bgp_peer_group_soft_in_cmd,
5773 "clear ip bgp peer-group WORD soft in",
5774 CLEAR_STR
5775 IP_STR
5776 BGP_STR
5777 "Clear all members of peer-group\n"
5778 "BGP peer-group name\n"
5779 "Soft reconfig\n"
5780 "Soft reconfig inbound update\n")
5781{
5782 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5783 BGP_CLEAR_SOFT_IN, argv[0]);
5784}
5785
5786ALIAS (clear_ip_bgp_peer_group_soft_in,
5787 clear_ip_bgp_peer_group_in_cmd,
5788 "clear ip bgp peer-group WORD in",
5789 CLEAR_STR
5790 IP_STR
5791 BGP_STR
5792 "Clear all members of peer-group\n"
5793 "BGP peer-group name\n"
5794 "Soft reconfig inbound update\n")
5795
5796DEFUN (clear_ip_bgp_peer_group_in_prefix_filter,
5797 clear_ip_bgp_peer_group_in_prefix_filter_cmd,
5798 "clear ip bgp peer-group WORD in prefix-filter",
5799 CLEAR_STR
5800 IP_STR
5801 BGP_STR
5802 "Clear all members of peer-group\n"
5803 "BGP peer-group name\n"
5804 "Soft reconfig inbound update\n"
5805 "Push out prefix-list ORF and do inbound soft reconfig\n")
5806{
5807 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5808 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5809}
5810
5811DEFUN (clear_ip_bgp_peer_group_ipv4_soft_in,
5812 clear_ip_bgp_peer_group_ipv4_soft_in_cmd,
5813 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft in",
5814 CLEAR_STR
5815 IP_STR
5816 BGP_STR
5817 "Clear all members of peer-group\n"
5818 "BGP peer-group name\n"
5819 "Address family\n"
5820 "Address Family modifier\n"
5821 "Address Family modifier\n"
5822 "Soft reconfig\n"
5823 "Soft reconfig inbound update\n")
5824{
5825 if (strncmp (argv[1], "m", 1) == 0)
5826 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
5827 BGP_CLEAR_SOFT_IN, argv[0]);
5828
5829 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5830 BGP_CLEAR_SOFT_IN, argv[0]);
5831}
5832
5833ALIAS (clear_ip_bgp_peer_group_ipv4_soft_in,
5834 clear_ip_bgp_peer_group_ipv4_in_cmd,
5835 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in",
5836 CLEAR_STR
5837 IP_STR
5838 BGP_STR
5839 "Clear all members of peer-group\n"
5840 "BGP peer-group name\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_group_ipv4_in_prefix_filter,
5847 clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd,
5848 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in prefix-filter",
5849 CLEAR_STR
5850 IP_STR
5851 BGP_STR
5852 "Clear all members of peer-group\n"
5853 "BGP peer-group name\n"
5854 "Address family\n"
5855 "Address Family modifier\n"
5856 "Address Family modifier\n"
5857 "Soft reconfig inbound update\n"
5858 "Push out prefix-list ORF and do inbound soft reconfig\n")
5859{
5860 if (strncmp (argv[1], "m", 1) == 0)
5861 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
5862 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5863
5864 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5865 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5866}
5867
5868DEFUN (clear_bgp_peer_group_soft_in,
5869 clear_bgp_peer_group_soft_in_cmd,
5870 "clear bgp peer-group WORD soft in",
5871 CLEAR_STR
5872 BGP_STR
5873 "Clear all members of peer-group\n"
5874 "BGP peer-group name\n"
5875 "Soft reconfig\n"
5876 "Soft reconfig inbound update\n")
5877{
5878 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
5879 BGP_CLEAR_SOFT_IN, argv[0]);
5880}
5881
5882ALIAS (clear_bgp_peer_group_soft_in,
5883 clear_bgp_ipv6_peer_group_soft_in_cmd,
5884 "clear bgp ipv6 peer-group WORD soft in",
5885 CLEAR_STR
5886 BGP_STR
5887 "Address family\n"
5888 "Clear all members of peer-group\n"
5889 "BGP peer-group name\n"
5890 "Soft reconfig\n"
5891 "Soft reconfig inbound update\n")
5892
5893ALIAS (clear_bgp_peer_group_soft_in,
5894 clear_bgp_peer_group_in_cmd,
5895 "clear bgp peer-group WORD in",
5896 CLEAR_STR
5897 BGP_STR
5898 "Clear all members of peer-group\n"
5899 "BGP peer-group name\n"
5900 "Soft reconfig inbound update\n")
5901
5902ALIAS (clear_bgp_peer_group_soft_in,
5903 clear_bgp_ipv6_peer_group_in_cmd,
5904 "clear bgp ipv6 peer-group WORD in",
5905 CLEAR_STR
5906 BGP_STR
5907 "Address family\n"
5908 "Clear all members of peer-group\n"
5909 "BGP peer-group name\n"
5910 "Soft reconfig inbound update\n")
5911
5912DEFUN (clear_bgp_peer_group_in_prefix_filter,
5913 clear_bgp_peer_group_in_prefix_filter_cmd,
5914 "clear bgp peer-group WORD in prefix-filter",
5915 CLEAR_STR
5916 BGP_STR
5917 "Clear all members of peer-group\n"
5918 "BGP peer-group name\n"
5919 "Soft reconfig inbound update\n"
5920 "Push out prefix-list ORF and do inbound soft reconfig\n")
5921{
5922 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
5923 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5924}
5925
5926ALIAS (clear_bgp_peer_group_in_prefix_filter,
5927 clear_bgp_ipv6_peer_group_in_prefix_filter_cmd,
5928 "clear bgp ipv6 peer-group WORD in prefix-filter",
5929 CLEAR_STR
5930 BGP_STR
5931 "Address family\n"
5932 "Clear all members of peer-group\n"
5933 "BGP peer-group name\n"
5934 "Soft reconfig inbound update\n"
5935 "Push out prefix-list ORF and do inbound soft reconfig\n")
5936
5937DEFUN (clear_ip_bgp_external_soft_in,
5938 clear_ip_bgp_external_soft_in_cmd,
5939 "clear ip bgp external soft in",
5940 CLEAR_STR
5941 IP_STR
5942 BGP_STR
5943 "Clear all external peers\n"
5944 "Soft reconfig\n"
5945 "Soft reconfig inbound update\n")
5946{
5947 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5948 BGP_CLEAR_SOFT_IN, NULL);
5949}
5950
5951ALIAS (clear_ip_bgp_external_soft_in,
5952 clear_ip_bgp_external_in_cmd,
5953 "clear ip bgp external in",
5954 CLEAR_STR
5955 IP_STR
5956 BGP_STR
5957 "Clear all external peers\n"
5958 "Soft reconfig inbound update\n")
5959
5960DEFUN (clear_ip_bgp_external_in_prefix_filter,
5961 clear_ip_bgp_external_in_prefix_filter_cmd,
5962 "clear ip bgp external in prefix-filter",
5963 CLEAR_STR
5964 IP_STR
5965 BGP_STR
5966 "Clear all external peers\n"
5967 "Soft reconfig inbound update\n"
5968 "Push out prefix-list ORF and do inbound soft reconfig\n")
5969{
5970 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5971 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5972}
5973
5974DEFUN (clear_ip_bgp_external_ipv4_soft_in,
5975 clear_ip_bgp_external_ipv4_soft_in_cmd,
5976 "clear ip bgp external ipv4 (unicast|multicast) soft in",
5977 CLEAR_STR
5978 IP_STR
5979 BGP_STR
5980 "Clear all external peers\n"
5981 "Address family\n"
5982 "Address Family modifier\n"
5983 "Address Family modifier\n"
5984 "Soft reconfig\n"
5985 "Soft reconfig inbound update\n")
5986{
5987 if (strncmp (argv[0], "m", 1) == 0)
5988 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
5989 BGP_CLEAR_SOFT_IN, NULL);
5990
5991 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5992 BGP_CLEAR_SOFT_IN, NULL);
5993}
5994
5995ALIAS (clear_ip_bgp_external_ipv4_soft_in,
5996 clear_ip_bgp_external_ipv4_in_cmd,
5997 "clear ip bgp external ipv4 (unicast|multicast) in",
5998 CLEAR_STR
5999 IP_STR
6000 BGP_STR
6001 "Clear all external peers\n"
6002 "Address family\n"
6003 "Address Family modifier\n"
6004 "Address Family modifier\n"
6005 "Soft reconfig inbound update\n")
6006
6007DEFUN (clear_ip_bgp_external_ipv4_in_prefix_filter,
6008 clear_ip_bgp_external_ipv4_in_prefix_filter_cmd,
6009 "clear ip bgp external ipv4 (unicast|multicast) in prefix-filter",
6010 CLEAR_STR
6011 IP_STR
6012 BGP_STR
6013 "Clear all external peers\n"
6014 "Address family\n"
6015 "Address Family modifier\n"
6016 "Address Family modifier\n"
6017 "Soft reconfig inbound update\n"
6018 "Push out prefix-list ORF and do inbound soft reconfig\n")
6019{
6020 if (strncmp (argv[0], "m", 1) == 0)
6021 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
6022 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
6023
6024 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6025 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
6026}
6027
6028DEFUN (clear_bgp_external_soft_in,
6029 clear_bgp_external_soft_in_cmd,
6030 "clear bgp external soft in",
6031 CLEAR_STR
6032 BGP_STR
6033 "Clear all external peers\n"
6034 "Soft reconfig\n"
6035 "Soft reconfig inbound update\n")
6036{
6037 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
6038 BGP_CLEAR_SOFT_IN, NULL);
6039}
6040
6041ALIAS (clear_bgp_external_soft_in,
6042 clear_bgp_ipv6_external_soft_in_cmd,
6043 "clear bgp ipv6 external soft in",
6044 CLEAR_STR
6045 BGP_STR
6046 "Address family\n"
6047 "Clear all external peers\n"
6048 "Soft reconfig\n"
6049 "Soft reconfig inbound update\n")
6050
6051ALIAS (clear_bgp_external_soft_in,
6052 clear_bgp_external_in_cmd,
6053 "clear bgp external in",
6054 CLEAR_STR
6055 BGP_STR
6056 "Clear all external peers\n"
6057 "Soft reconfig inbound update\n")
6058
6059ALIAS (clear_bgp_external_soft_in,
6060 clear_bgp_ipv6_external_in_cmd,
6061 "clear bgp ipv6 external WORD in",
6062 CLEAR_STR
6063 BGP_STR
6064 "Address family\n"
6065 "Clear all external peers\n"
6066 "Soft reconfig inbound update\n")
6067
6068DEFUN (clear_bgp_external_in_prefix_filter,
6069 clear_bgp_external_in_prefix_filter_cmd,
6070 "clear bgp external in prefix-filter",
6071 CLEAR_STR
6072 BGP_STR
6073 "Clear all external peers\n"
6074 "Soft reconfig inbound update\n"
6075 "Push out prefix-list ORF and do inbound soft reconfig\n")
6076{
6077 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
6078 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
6079}
6080
6081ALIAS (clear_bgp_external_in_prefix_filter,
6082 clear_bgp_ipv6_external_in_prefix_filter_cmd,
6083 "clear bgp ipv6 external in prefix-filter",
6084 CLEAR_STR
6085 BGP_STR
6086 "Address family\n"
6087 "Clear all external peers\n"
6088 "Soft reconfig inbound update\n"
6089 "Push out prefix-list ORF and do inbound soft reconfig\n")
6090
6091DEFUN (clear_ip_bgp_as_soft_in,
6092 clear_ip_bgp_as_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006093 "clear ip bgp " CMD_AS_RANGE " soft in",
paul718e3742002-12-13 20:15:29 +00006094 CLEAR_STR
6095 IP_STR
6096 BGP_STR
6097 "Clear peers with the AS number\n"
6098 "Soft reconfig\n"
6099 "Soft reconfig inbound update\n")
6100{
6101 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6102 BGP_CLEAR_SOFT_IN, argv[0]);
6103}
6104
6105ALIAS (clear_ip_bgp_as_soft_in,
6106 clear_ip_bgp_as_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006107 "clear ip bgp " CMD_AS_RANGE " in",
paul718e3742002-12-13 20:15:29 +00006108 CLEAR_STR
6109 IP_STR
6110 BGP_STR
6111 "Clear peers with the AS number\n"
6112 "Soft reconfig inbound update\n")
6113
6114DEFUN (clear_ip_bgp_as_in_prefix_filter,
6115 clear_ip_bgp_as_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006116 "clear ip bgp " CMD_AS_RANGE " in prefix-filter",
paul718e3742002-12-13 20:15:29 +00006117 CLEAR_STR
6118 IP_STR
6119 BGP_STR
6120 "Clear peers with the AS number\n"
6121 "Soft reconfig inbound update\n"
6122 "Push out prefix-list ORF and do inbound soft reconfig\n")
6123{
6124 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6125 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6126}
6127
6128DEFUN (clear_ip_bgp_as_ipv4_soft_in,
6129 clear_ip_bgp_as_ipv4_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006130 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft in",
paul718e3742002-12-13 20:15:29 +00006131 CLEAR_STR
6132 IP_STR
6133 BGP_STR
6134 "Clear peers with the AS number\n"
6135 "Address family\n"
6136 "Address Family modifier\n"
6137 "Address Family modifier\n"
6138 "Soft reconfig\n"
6139 "Soft reconfig inbound update\n")
6140{
6141 if (strncmp (argv[1], "m", 1) == 0)
6142 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
6143 BGP_CLEAR_SOFT_IN, argv[0]);
6144
6145 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6146 BGP_CLEAR_SOFT_IN, argv[0]);
6147}
6148
6149ALIAS (clear_ip_bgp_as_ipv4_soft_in,
6150 clear_ip_bgp_as_ipv4_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006151 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in",
paul718e3742002-12-13 20:15:29 +00006152 CLEAR_STR
6153 IP_STR
6154 BGP_STR
6155 "Clear peers with the AS number\n"
6156 "Address family\n"
6157 "Address Family modifier\n"
6158 "Address Family modifier\n"
6159 "Soft reconfig inbound update\n")
6160
6161DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter,
6162 clear_ip_bgp_as_ipv4_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006163 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in prefix-filter",
paul718e3742002-12-13 20:15:29 +00006164 CLEAR_STR
6165 IP_STR
6166 BGP_STR
6167 "Clear peers with the AS number\n"
6168 "Address family\n"
6169 "Address Family modifier\n"
6170 "Address Family modifier\n"
6171 "Soft reconfig inbound update\n"
6172 "Push out prefix-list ORF and do inbound soft reconfig\n")
6173{
6174 if (strncmp (argv[1], "m", 1) == 0)
6175 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
6176 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6177
6178 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6179 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6180}
6181
6182DEFUN (clear_ip_bgp_as_vpnv4_soft_in,
6183 clear_ip_bgp_as_vpnv4_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006184 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft in",
paul718e3742002-12-13 20:15:29 +00006185 CLEAR_STR
6186 IP_STR
6187 BGP_STR
6188 "Clear peers with the AS number\n"
6189 "Address family\n"
6190 "Address Family modifier\n"
6191 "Soft reconfig\n"
6192 "Soft reconfig inbound update\n")
6193{
6194 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
6195 BGP_CLEAR_SOFT_IN, argv[0]);
6196}
6197
6198ALIAS (clear_ip_bgp_as_vpnv4_soft_in,
6199 clear_ip_bgp_as_vpnv4_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006200 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast in",
paul718e3742002-12-13 20:15:29 +00006201 CLEAR_STR
6202 IP_STR
6203 BGP_STR
6204 "Clear peers with the AS number\n"
6205 "Address family\n"
6206 "Address Family modifier\n"
6207 "Soft reconfig inbound update\n")
6208
6209DEFUN (clear_bgp_as_soft_in,
6210 clear_bgp_as_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006211 "clear bgp " CMD_AS_RANGE " soft in",
paul718e3742002-12-13 20:15:29 +00006212 CLEAR_STR
6213 BGP_STR
6214 "Clear peers with the AS number\n"
6215 "Soft reconfig\n"
6216 "Soft reconfig inbound update\n")
6217{
6218 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
6219 BGP_CLEAR_SOFT_IN, argv[0]);
6220}
6221
6222ALIAS (clear_bgp_as_soft_in,
6223 clear_bgp_ipv6_as_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006224 "clear bgp ipv6 " CMD_AS_RANGE " soft in",
paul718e3742002-12-13 20:15:29 +00006225 CLEAR_STR
6226 BGP_STR
6227 "Address family\n"
6228 "Clear peers with the AS number\n"
6229 "Soft reconfig\n"
6230 "Soft reconfig inbound update\n")
6231
6232ALIAS (clear_bgp_as_soft_in,
6233 clear_bgp_as_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006234 "clear bgp " CMD_AS_RANGE " in",
paul718e3742002-12-13 20:15:29 +00006235 CLEAR_STR
6236 BGP_STR
6237 "Clear peers with the AS number\n"
6238 "Soft reconfig inbound update\n")
6239
6240ALIAS (clear_bgp_as_soft_in,
6241 clear_bgp_ipv6_as_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006242 "clear bgp ipv6 " CMD_AS_RANGE " in",
paul718e3742002-12-13 20:15:29 +00006243 CLEAR_STR
6244 BGP_STR
6245 "Address family\n"
6246 "Clear peers with the AS number\n"
6247 "Soft reconfig inbound update\n")
6248
6249DEFUN (clear_bgp_as_in_prefix_filter,
6250 clear_bgp_as_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006251 "clear bgp " CMD_AS_RANGE " in prefix-filter",
paul718e3742002-12-13 20:15:29 +00006252 CLEAR_STR
6253 BGP_STR
6254 "Clear peers with the AS number\n"
6255 "Soft reconfig inbound update\n"
6256 "Push out prefix-list ORF and do inbound soft reconfig\n")
6257{
6258 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
6259 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6260}
6261
6262ALIAS (clear_bgp_as_in_prefix_filter,
6263 clear_bgp_ipv6_as_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006264 "clear bgp ipv6 " CMD_AS_RANGE " in prefix-filter",
paul718e3742002-12-13 20:15:29 +00006265 CLEAR_STR
6266 BGP_STR
6267 "Address family\n"
6268 "Clear peers with the AS number\n"
6269 "Soft reconfig inbound update\n"
6270 "Push out prefix-list ORF and do inbound soft reconfig\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02006271
paul718e3742002-12-13 20:15:29 +00006272/* Both soft-reconfiguration */
6273DEFUN (clear_ip_bgp_all_soft,
6274 clear_ip_bgp_all_soft_cmd,
6275 "clear ip bgp * soft",
6276 CLEAR_STR
6277 IP_STR
6278 BGP_STR
6279 "Clear all peers\n"
6280 "Soft reconfig\n")
6281{
6282 if (argc == 1)
6283 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
6284 BGP_CLEAR_SOFT_BOTH, NULL);
6285
6286 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6287 BGP_CLEAR_SOFT_BOTH, NULL);
6288}
6289
6290ALIAS (clear_ip_bgp_all_soft,
6291 clear_ip_bgp_instance_all_soft_cmd,
6292 "clear ip bgp view WORD * soft",
6293 CLEAR_STR
6294 IP_STR
6295 BGP_STR
6296 "BGP view\n"
6297 "view name\n"
6298 "Clear all peers\n"
6299 "Soft reconfig\n")
6300
6301
6302DEFUN (clear_ip_bgp_all_ipv4_soft,
6303 clear_ip_bgp_all_ipv4_soft_cmd,
6304 "clear ip bgp * ipv4 (unicast|multicast) soft",
6305 CLEAR_STR
6306 IP_STR
6307 BGP_STR
6308 "Clear all peers\n"
6309 "Address family\n"
6310 "Address Family Modifier\n"
6311 "Address Family Modifier\n"
6312 "Soft reconfig\n")
6313{
6314 if (strncmp (argv[0], "m", 1) == 0)
6315 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
6316 BGP_CLEAR_SOFT_BOTH, NULL);
6317
6318 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6319 BGP_CLEAR_SOFT_BOTH, NULL);
6320}
6321
6322DEFUN (clear_ip_bgp_instance_all_ipv4_soft,
6323 clear_ip_bgp_instance_all_ipv4_soft_cmd,
6324 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft",
6325 CLEAR_STR
6326 IP_STR
6327 BGP_STR
6328 "BGP view\n"
6329 "view name\n"
6330 "Clear all peers\n"
6331 "Address family\n"
6332 "Address Family Modifier\n"
6333 "Address Family Modifier\n"
6334 "Soft reconfig\n")
6335{
6336 if (strncmp (argv[1], "m", 1) == 0)
6337 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
6338 BGP_CLEAR_SOFT_BOTH, NULL);
6339
6340 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6341 BGP_CLEAR_SOFT_BOTH, NULL);
6342}
6343
6344DEFUN (clear_ip_bgp_all_vpnv4_soft,
6345 clear_ip_bgp_all_vpnv4_soft_cmd,
6346 "clear ip bgp * vpnv4 unicast soft",
6347 CLEAR_STR
6348 IP_STR
6349 BGP_STR
6350 "Clear all peers\n"
6351 "Address family\n"
6352 "Address Family Modifier\n"
6353 "Soft reconfig\n")
6354{
6355 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
6356 BGP_CLEAR_SOFT_BOTH, argv[0]);
6357}
6358
6359DEFUN (clear_bgp_all_soft,
6360 clear_bgp_all_soft_cmd,
6361 "clear bgp * soft",
6362 CLEAR_STR
6363 BGP_STR
6364 "Clear all peers\n"
6365 "Soft reconfig\n")
6366{
6367 if (argc == 1)
6368 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
6369 BGP_CLEAR_SOFT_BOTH, argv[0]);
6370
6371 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
6372 BGP_CLEAR_SOFT_BOTH, argv[0]);
6373}
6374
6375ALIAS (clear_bgp_all_soft,
6376 clear_bgp_instance_all_soft_cmd,
6377 "clear bgp view WORD * soft",
6378 CLEAR_STR
6379 BGP_STR
6380 "BGP view\n"
6381 "view name\n"
6382 "Clear all peers\n"
6383 "Soft reconfig\n")
6384
6385ALIAS (clear_bgp_all_soft,
6386 clear_bgp_ipv6_all_soft_cmd,
6387 "clear bgp ipv6 * soft",
6388 CLEAR_STR
6389 BGP_STR
6390 "Address family\n"
6391 "Clear all peers\n"
6392 "Soft reconfig\n")
6393
6394DEFUN (clear_ip_bgp_peer_soft,
6395 clear_ip_bgp_peer_soft_cmd,
6396 "clear ip bgp A.B.C.D soft",
6397 CLEAR_STR
6398 IP_STR
6399 BGP_STR
6400 "BGP neighbor address to clear\n"
6401 "Soft reconfig\n")
6402{
6403 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6404 BGP_CLEAR_SOFT_BOTH, argv[0]);
6405}
6406
6407DEFUN (clear_ip_bgp_peer_ipv4_soft,
6408 clear_ip_bgp_peer_ipv4_soft_cmd,
6409 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft",
6410 CLEAR_STR
6411 IP_STR
6412 BGP_STR
6413 "BGP neighbor address to clear\n"
6414 "Address family\n"
6415 "Address Family Modifier\n"
6416 "Address Family Modifier\n"
6417 "Soft reconfig\n")
6418{
6419 if (strncmp (argv[1], "m", 1) == 0)
6420 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
6421 BGP_CLEAR_SOFT_BOTH, argv[0]);
6422
6423 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6424 BGP_CLEAR_SOFT_BOTH, argv[0]);
6425}
6426
6427DEFUN (clear_ip_bgp_peer_vpnv4_soft,
6428 clear_ip_bgp_peer_vpnv4_soft_cmd,
6429 "clear ip bgp A.B.C.D vpnv4 unicast soft",
6430 CLEAR_STR
6431 IP_STR
6432 BGP_STR
6433 "BGP neighbor address to clear\n"
6434 "Address family\n"
6435 "Address Family Modifier\n"
6436 "Soft reconfig\n")
6437{
6438 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
6439 BGP_CLEAR_SOFT_BOTH, argv[0]);
6440}
6441
6442DEFUN (clear_bgp_peer_soft,
6443 clear_bgp_peer_soft_cmd,
6444 "clear bgp (A.B.C.D|X:X::X:X) soft",
6445 CLEAR_STR
6446 BGP_STR
6447 "BGP neighbor address to clear\n"
6448 "BGP IPv6 neighbor to clear\n"
6449 "Soft reconfig\n")
6450{
6451 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
6452 BGP_CLEAR_SOFT_BOTH, argv[0]);
6453}
6454
6455ALIAS (clear_bgp_peer_soft,
6456 clear_bgp_ipv6_peer_soft_cmd,
6457 "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft",
6458 CLEAR_STR
6459 BGP_STR
6460 "Address family\n"
6461 "BGP neighbor address to clear\n"
6462 "BGP IPv6 neighbor to clear\n"
6463 "Soft reconfig\n")
6464
6465DEFUN (clear_ip_bgp_peer_group_soft,
6466 clear_ip_bgp_peer_group_soft_cmd,
6467 "clear ip bgp peer-group WORD soft",
6468 CLEAR_STR
6469 IP_STR
6470 BGP_STR
6471 "Clear all members of peer-group\n"
6472 "BGP peer-group name\n"
6473 "Soft reconfig\n")
6474{
6475 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6476 BGP_CLEAR_SOFT_BOTH, argv[0]);
6477}
6478
6479DEFUN (clear_ip_bgp_peer_group_ipv4_soft,
6480 clear_ip_bgp_peer_group_ipv4_soft_cmd,
6481 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft",
6482 CLEAR_STR
6483 IP_STR
6484 BGP_STR
6485 "Clear all members of peer-group\n"
6486 "BGP peer-group name\n"
6487 "Address family\n"
6488 "Address Family modifier\n"
6489 "Address Family modifier\n"
6490 "Soft reconfig\n")
6491{
6492 if (strncmp (argv[1], "m", 1) == 0)
6493 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
6494 BGP_CLEAR_SOFT_BOTH, argv[0]);
6495
6496 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6497 BGP_CLEAR_SOFT_BOTH, argv[0]);
6498}
6499
6500DEFUN (clear_bgp_peer_group_soft,
6501 clear_bgp_peer_group_soft_cmd,
6502 "clear bgp peer-group WORD soft",
6503 CLEAR_STR
6504 BGP_STR
6505 "Clear all members of peer-group\n"
6506 "BGP peer-group name\n"
6507 "Soft reconfig\n")
6508{
6509 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
6510 BGP_CLEAR_SOFT_BOTH, argv[0]);
6511}
6512
6513ALIAS (clear_bgp_peer_group_soft,
6514 clear_bgp_ipv6_peer_group_soft_cmd,
6515 "clear bgp ipv6 peer-group WORD soft",
6516 CLEAR_STR
6517 BGP_STR
6518 "Address family\n"
6519 "Clear all members of peer-group\n"
6520 "BGP peer-group name\n"
6521 "Soft reconfig\n")
6522
6523DEFUN (clear_ip_bgp_external_soft,
6524 clear_ip_bgp_external_soft_cmd,
6525 "clear ip bgp external soft",
6526 CLEAR_STR
6527 IP_STR
6528 BGP_STR
6529 "Clear all external peers\n"
6530 "Soft reconfig\n")
6531{
6532 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6533 BGP_CLEAR_SOFT_BOTH, NULL);
6534}
6535
6536DEFUN (clear_ip_bgp_external_ipv4_soft,
6537 clear_ip_bgp_external_ipv4_soft_cmd,
6538 "clear ip bgp external ipv4 (unicast|multicast) soft",
6539 CLEAR_STR
6540 IP_STR
6541 BGP_STR
6542 "Clear all external peers\n"
6543 "Address family\n"
6544 "Address Family modifier\n"
6545 "Address Family modifier\n"
6546 "Soft reconfig\n")
6547{
6548 if (strncmp (argv[0], "m", 1) == 0)
6549 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
6550 BGP_CLEAR_SOFT_BOTH, NULL);
6551
6552 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6553 BGP_CLEAR_SOFT_BOTH, NULL);
6554}
6555
6556DEFUN (clear_bgp_external_soft,
6557 clear_bgp_external_soft_cmd,
6558 "clear bgp external soft",
6559 CLEAR_STR
6560 BGP_STR
6561 "Clear all external peers\n"
6562 "Soft reconfig\n")
6563{
6564 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
6565 BGP_CLEAR_SOFT_BOTH, NULL);
6566}
6567
6568ALIAS (clear_bgp_external_soft,
6569 clear_bgp_ipv6_external_soft_cmd,
6570 "clear bgp ipv6 external soft",
6571 CLEAR_STR
6572 BGP_STR
6573 "Address family\n"
6574 "Clear all external peers\n"
6575 "Soft reconfig\n")
6576
6577DEFUN (clear_ip_bgp_as_soft,
6578 clear_ip_bgp_as_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006579 "clear ip bgp " CMD_AS_RANGE " soft",
paul718e3742002-12-13 20:15:29 +00006580 CLEAR_STR
6581 IP_STR
6582 BGP_STR
6583 "Clear peers with the AS number\n"
6584 "Soft reconfig\n")
6585{
6586 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6587 BGP_CLEAR_SOFT_BOTH, argv[0]);
6588}
6589
6590DEFUN (clear_ip_bgp_as_ipv4_soft,
6591 clear_ip_bgp_as_ipv4_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006592 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft",
paul718e3742002-12-13 20:15:29 +00006593 CLEAR_STR
6594 IP_STR
6595 BGP_STR
6596 "Clear peers with the AS number\n"
6597 "Address family\n"
6598 "Address Family Modifier\n"
6599 "Address Family Modifier\n"
6600 "Soft reconfig\n")
6601{
6602 if (strncmp (argv[1], "m", 1) == 0)
6603 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
6604 BGP_CLEAR_SOFT_BOTH, argv[0]);
6605
6606 return bgp_clear_vty (vty, NULL,AFI_IP, SAFI_UNICAST, clear_as,
6607 BGP_CLEAR_SOFT_BOTH, argv[0]);
6608}
6609
6610DEFUN (clear_ip_bgp_as_vpnv4_soft,
6611 clear_ip_bgp_as_vpnv4_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006612 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft",
paul718e3742002-12-13 20:15:29 +00006613 CLEAR_STR
6614 IP_STR
6615 BGP_STR
6616 "Clear peers with the AS number\n"
6617 "Address family\n"
6618 "Address Family Modifier\n"
6619 "Soft reconfig\n")
6620{
6621 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
6622 BGP_CLEAR_SOFT_BOTH, argv[0]);
6623}
6624
6625DEFUN (clear_bgp_as_soft,
6626 clear_bgp_as_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006627 "clear bgp " CMD_AS_RANGE " soft",
paul718e3742002-12-13 20:15:29 +00006628 CLEAR_STR
6629 BGP_STR
6630 "Clear peers with the AS number\n"
6631 "Soft reconfig\n")
6632{
6633 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
6634 BGP_CLEAR_SOFT_BOTH, argv[0]);
6635}
6636
6637ALIAS (clear_bgp_as_soft,
6638 clear_bgp_ipv6_as_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006639 "clear bgp ipv6 " CMD_AS_RANGE " soft",
paul718e3742002-12-13 20:15:29 +00006640 CLEAR_STR
6641 BGP_STR
6642 "Address family\n"
6643 "Clear peers with the AS number\n"
6644 "Soft reconfig\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02006645
paulfee0f4c2004-09-13 05:12:46 +00006646/* RS-client soft reconfiguration. */
6647#ifdef HAVE_IPV6
6648DEFUN (clear_bgp_all_rsclient,
6649 clear_bgp_all_rsclient_cmd,
6650 "clear bgp * rsclient",
6651 CLEAR_STR
6652 BGP_STR
6653 "Clear all peers\n"
6654 "Soft reconfig for rsclient RIB\n")
6655{
6656 if (argc == 1)
6657 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
6658 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6659
6660 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
6661 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6662}
6663
6664ALIAS (clear_bgp_all_rsclient,
6665 clear_bgp_ipv6_all_rsclient_cmd,
6666 "clear bgp ipv6 * rsclient",
6667 CLEAR_STR
6668 BGP_STR
6669 "Address family\n"
6670 "Clear all peers\n"
6671 "Soft reconfig for rsclient RIB\n")
6672
6673ALIAS (clear_bgp_all_rsclient,
6674 clear_bgp_instance_all_rsclient_cmd,
6675 "clear bgp view WORD * rsclient",
6676 CLEAR_STR
6677 BGP_STR
6678 "BGP view\n"
6679 "view name\n"
6680 "Clear all peers\n"
6681 "Soft reconfig for rsclient RIB\n")
6682
6683ALIAS (clear_bgp_all_rsclient,
6684 clear_bgp_ipv6_instance_all_rsclient_cmd,
6685 "clear bgp ipv6 view WORD * rsclient",
6686 CLEAR_STR
6687 BGP_STR
6688 "Address family\n"
6689 "BGP view\n"
6690 "view name\n"
6691 "Clear all peers\n"
6692 "Soft reconfig for rsclient RIB\n")
6693#endif /* HAVE_IPV6 */
6694
6695DEFUN (clear_ip_bgp_all_rsclient,
6696 clear_ip_bgp_all_rsclient_cmd,
6697 "clear ip bgp * rsclient",
6698 CLEAR_STR
6699 IP_STR
6700 BGP_STR
6701 "Clear all peers\n"
6702 "Soft reconfig for rsclient RIB\n")
6703{
6704 if (argc == 1)
6705 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
6706 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6707
6708 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6709 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6710}
6711
6712ALIAS (clear_ip_bgp_all_rsclient,
6713 clear_ip_bgp_instance_all_rsclient_cmd,
6714 "clear ip bgp view WORD * rsclient",
6715 CLEAR_STR
6716 IP_STR
6717 BGP_STR
6718 "BGP view\n"
6719 "view name\n"
6720 "Clear all peers\n"
6721 "Soft reconfig for rsclient RIB\n")
6722
6723#ifdef HAVE_IPV6
6724DEFUN (clear_bgp_peer_rsclient,
6725 clear_bgp_peer_rsclient_cmd,
6726 "clear bgp (A.B.C.D|X:X::X:X) rsclient",
6727 CLEAR_STR
6728 BGP_STR
6729 "BGP neighbor IP address to clear\n"
6730 "BGP IPv6 neighbor to clear\n"
6731 "Soft reconfig for rsclient RIB\n")
6732{
6733 if (argc == 2)
6734 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_peer,
6735 BGP_CLEAR_SOFT_RSCLIENT, argv[1]);
6736
6737 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
6738 BGP_CLEAR_SOFT_RSCLIENT, argv[0]);
6739}
6740
6741ALIAS (clear_bgp_peer_rsclient,
6742 clear_bgp_ipv6_peer_rsclient_cmd,
6743 "clear bgp ipv6 (A.B.C.D|X:X::X:X) rsclient",
6744 CLEAR_STR
6745 BGP_STR
6746 "Address family\n"
6747 "BGP neighbor IP address to clear\n"
6748 "BGP IPv6 neighbor to clear\n"
6749 "Soft reconfig for rsclient RIB\n")
6750
6751ALIAS (clear_bgp_peer_rsclient,
6752 clear_bgp_instance_peer_rsclient_cmd,
6753 "clear bgp view WORD (A.B.C.D|X:X::X:X) rsclient",
6754 CLEAR_STR
6755 BGP_STR
6756 "BGP view\n"
6757 "view name\n"
6758 "BGP neighbor IP address to clear\n"
6759 "BGP IPv6 neighbor to clear\n"
6760 "Soft reconfig for rsclient RIB\n")
6761
6762ALIAS (clear_bgp_peer_rsclient,
6763 clear_bgp_ipv6_instance_peer_rsclient_cmd,
6764 "clear bgp ipv6 view WORD (A.B.C.D|X:X::X:X) rsclient",
6765 CLEAR_STR
6766 BGP_STR
6767 "Address family\n"
6768 "BGP view\n"
6769 "view name\n"
6770 "BGP neighbor IP address to clear\n"
6771 "BGP IPv6 neighbor to clear\n"
6772 "Soft reconfig for rsclient RIB\n")
6773#endif /* HAVE_IPV6 */
6774
6775DEFUN (clear_ip_bgp_peer_rsclient,
6776 clear_ip_bgp_peer_rsclient_cmd,
6777 "clear ip bgp (A.B.C.D|X:X::X:X) rsclient",
6778 CLEAR_STR
6779 IP_STR
6780 BGP_STR
6781 "BGP neighbor IP address to clear\n"
6782 "BGP IPv6 neighbor to clear\n"
6783 "Soft reconfig for rsclient RIB\n")
6784{
6785 if (argc == 2)
6786 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_peer,
6787 BGP_CLEAR_SOFT_RSCLIENT, argv[1]);
6788
6789 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6790 BGP_CLEAR_SOFT_RSCLIENT, argv[0]);
6791}
6792
6793ALIAS (clear_ip_bgp_peer_rsclient,
6794 clear_ip_bgp_instance_peer_rsclient_cmd,
6795 "clear ip bgp view WORD (A.B.C.D|X:X::X:X) rsclient",
6796 CLEAR_STR
6797 IP_STR
6798 BGP_STR
6799 "BGP view\n"
6800 "view name\n"
6801 "BGP neighbor IP address to clear\n"
6802 "BGP IPv6 neighbor to clear\n"
6803 "Soft reconfig for rsclient RIB\n")
6804
Michael Lamberte0081f72008-11-16 20:12:04 +00006805DEFUN (show_bgp_views,
6806 show_bgp_views_cmd,
6807 "show bgp views",
6808 SHOW_STR
6809 BGP_STR
6810 "Show the defined BGP views\n")
6811{
6812 struct list *inst = bm->bgp;
6813 struct listnode *node;
6814 struct bgp *bgp;
6815
6816 if (!bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE))
6817 {
6818 vty_out (vty, "Multiple BGP views are not defined%s", VTY_NEWLINE);
6819 return CMD_WARNING;
6820 }
6821
6822 vty_out (vty, "Defined BGP views:%s", VTY_NEWLINE);
6823 for (ALL_LIST_ELEMENTS_RO(inst, node, bgp))
6824 vty_out (vty, "\t%s (AS%u)%s",
6825 bgp->name ? bgp->name : "(null)",
6826 bgp->as, VTY_NEWLINE);
6827
6828 return CMD_SUCCESS;
6829}
6830
Paul Jakma4bf6a362006-03-30 14:05:23 +00006831DEFUN (show_bgp_memory,
6832 show_bgp_memory_cmd,
6833 "show bgp memory",
6834 SHOW_STR
6835 BGP_STR
6836 "Global BGP memory statistics\n")
6837{
6838 char memstrbuf[MTYPE_MEMSTR_LEN];
6839 unsigned long count;
6840
6841 /* RIB related usage stats */
6842 count = mtype_stats_alloc (MTYPE_BGP_NODE);
6843 vty_out (vty, "%ld RIB nodes, using %s of memory%s", count,
6844 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6845 count * sizeof (struct bgp_node)),
6846 VTY_NEWLINE);
6847
6848 count = mtype_stats_alloc (MTYPE_BGP_ROUTE);
6849 vty_out (vty, "%ld BGP routes, using %s of memory%s", count,
6850 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6851 count * sizeof (struct bgp_info)),
6852 VTY_NEWLINE);
Paul Jakmafb982c22007-05-04 20:15:47 +00006853 if ((count = mtype_stats_alloc (MTYPE_BGP_ROUTE_EXTRA)))
6854 vty_out (vty, "%ld BGP route ancillaries, using %s of memory%s", count,
6855 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6856 count * sizeof (struct bgp_info_extra)),
6857 VTY_NEWLINE);
Paul Jakma4bf6a362006-03-30 14:05:23 +00006858
6859 if ((count = mtype_stats_alloc (MTYPE_BGP_STATIC)))
6860 vty_out (vty, "%ld Static routes, using %s of memory%s", count,
6861 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6862 count * sizeof (struct bgp_static)),
6863 VTY_NEWLINE);
6864
6865 /* Adj-In/Out */
6866 if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_IN)))
6867 vty_out (vty, "%ld Adj-In entries, using %s of memory%s", count,
6868 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6869 count * sizeof (struct bgp_adj_in)),
6870 VTY_NEWLINE);
6871 if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_OUT)))
6872 vty_out (vty, "%ld Adj-Out entries, using %s of memory%s", count,
6873 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6874 count * sizeof (struct bgp_adj_out)),
6875 VTY_NEWLINE);
6876
6877 if ((count = mtype_stats_alloc (MTYPE_BGP_NEXTHOP_CACHE)))
6878 vty_out (vty, "%ld Nexthop cache entries, using %s of memory%s", count,
6879 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6880 count * sizeof (struct bgp_nexthop_cache)),
6881 VTY_NEWLINE);
6882
6883 if ((count = mtype_stats_alloc (MTYPE_BGP_DAMP_INFO)))
6884 vty_out (vty, "%ld Dampening entries, using %s of memory%s", count,
6885 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6886 count * sizeof (struct bgp_damp_info)),
6887 VTY_NEWLINE);
6888
6889 /* Attributes */
6890 count = attr_count();
6891 vty_out (vty, "%ld BGP attributes, using %s of memory%s", count,
6892 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6893 count * sizeof(struct attr)),
6894 VTY_NEWLINE);
Paul Jakmafb982c22007-05-04 20:15:47 +00006895 if ((count = mtype_stats_alloc (MTYPE_ATTR_EXTRA)))
6896 vty_out (vty, "%ld BGP extra attributes, using %s of memory%s", count,
6897 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6898 count * sizeof(struct attr_extra)),
6899 VTY_NEWLINE);
Paul Jakma4bf6a362006-03-30 14:05:23 +00006900
6901 if ((count = attr_unknown_count()))
6902 vty_out (vty, "%ld unknown attributes%s", count, VTY_NEWLINE);
6903
6904 /* AS_PATH attributes */
6905 count = aspath_count ();
6906 vty_out (vty, "%ld BGP AS-PATH entries, using %s of memory%s", count,
6907 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6908 count * sizeof (struct aspath)),
6909 VTY_NEWLINE);
6910
6911 count = mtype_stats_alloc (MTYPE_AS_SEG);
6912 vty_out (vty, "%ld BGP AS-PATH segments, using %s of memory%s", count,
6913 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6914 count * sizeof (struct assegment)),
6915 VTY_NEWLINE);
6916
6917 /* Other attributes */
6918 if ((count = community_count ()))
6919 vty_out (vty, "%ld BGP community entries, using %s of memory%s", count,
6920 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6921 count * sizeof (struct community)),
6922 VTY_NEWLINE);
6923 if ((count = mtype_stats_alloc (MTYPE_ECOMMUNITY)))
6924 vty_out (vty, "%ld BGP community entries, using %s of memory%s", count,
6925 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6926 count * sizeof (struct ecommunity)),
6927 VTY_NEWLINE);
6928
6929 if ((count = mtype_stats_alloc (MTYPE_CLUSTER)))
6930 vty_out (vty, "%ld Cluster lists, using %s of memory%s", count,
6931 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6932 count * sizeof (struct cluster_list)),
6933 VTY_NEWLINE);
6934
6935 /* Peer related usage */
6936 count = mtype_stats_alloc (MTYPE_BGP_PEER);
6937 vty_out (vty, "%ld peers, using %s of memory%s", count,
6938 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6939 count * sizeof (struct peer)),
6940 VTY_NEWLINE);
6941
6942 if ((count = mtype_stats_alloc (MTYPE_PEER_GROUP)))
6943 vty_out (vty, "%ld peer groups, using %s of memory%s", count,
6944 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6945 count * sizeof (struct peer_group)),
6946 VTY_NEWLINE);
6947
6948 /* Other */
6949 if ((count = mtype_stats_alloc (MTYPE_HASH)))
6950 vty_out (vty, "%ld hash tables, using %s of memory%s", count,
6951 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6952 count * sizeof (struct hash)),
6953 VTY_NEWLINE);
6954 if ((count = mtype_stats_alloc (MTYPE_HASH_BACKET)))
6955 vty_out (vty, "%ld hash buckets, using %s of memory%s", count,
6956 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6957 count * sizeof (struct hash_backet)),
6958 VTY_NEWLINE);
6959 if ((count = mtype_stats_alloc (MTYPE_BGP_REGEXP)))
6960 vty_out (vty, "%ld compiled regexes, using %s of memory%s", count,
6961 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6962 count * sizeof (regex_t)),
6963 VTY_NEWLINE);
6964 return CMD_SUCCESS;
6965}
paulfee0f4c2004-09-13 05:12:46 +00006966
paul718e3742002-12-13 20:15:29 +00006967/* Show BGP peer's summary information. */
paul94f2b392005-06-28 12:44:16 +00006968static int
paul718e3742002-12-13 20:15:29 +00006969bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi)
6970{
6971 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00006972 struct listnode *node, *nnode;
Paul Jakma4bf6a362006-03-30 14:05:23 +00006973 unsigned int count = 0;
paul718e3742002-12-13 20:15:29 +00006974 char timebuf[BGP_UPTIME_LEN];
6975 int len;
6976
6977 /* Header string for each address family. */
Milan Kociancb4fc592014-12-01 12:48:25 +00006978 static char header[] = "Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd";
Paul Jakma4bf6a362006-03-30 14:05:23 +00006979
paul1eb8ef22005-04-07 07:30:20 +00006980 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00006981 {
6982 if (peer->afc[afi][safi])
6983 {
Paul Jakma4bf6a362006-03-30 14:05:23 +00006984 if (!count)
6985 {
6986 unsigned long ents;
6987 char memstrbuf[MTYPE_MEMSTR_LEN];
6988
6989 /* Usage summary and header */
6990 vty_out (vty,
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04006991 "BGP router identifier %s, local AS number %u%s",
Paul Jakma4bf6a362006-03-30 14:05:23 +00006992 inet_ntoa (bgp->router_id), bgp->as, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00006993
Paul Jakma4bf6a362006-03-30 14:05:23 +00006994 ents = bgp_table_count (bgp->rib[afi][safi]);
6995 vty_out (vty, "RIB entries %ld, using %s of memory%s", ents,
6996 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6997 ents * sizeof (struct bgp_node)),
6998 VTY_NEWLINE);
6999
7000 /* Peer related usage */
7001 ents = listcount (bgp->peer);
7002 vty_out (vty, "Peers %ld, using %s of memory%s",
7003 ents,
7004 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7005 ents * sizeof (struct peer)),
7006 VTY_NEWLINE);
7007
7008 if ((ents = listcount (bgp->rsclient)))
7009 vty_out (vty, "RS-Client peers %ld, using %s of memory%s",
7010 ents,
7011 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7012 ents * sizeof (struct peer)),
7013 VTY_NEWLINE);
7014
7015 if ((ents = listcount (bgp->group)))
7016 vty_out (vty, "Peer groups %ld, using %s of memory%s", ents,
7017 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7018 ents * sizeof (struct peer_group)),
7019 VTY_NEWLINE);
7020
7021 if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING))
7022 vty_out (vty, "Dampening enabled.%s", VTY_NEWLINE);
7023 vty_out (vty, "%s", VTY_NEWLINE);
7024 vty_out (vty, "%s%s", header, VTY_NEWLINE);
7025 }
7026
paul718e3742002-12-13 20:15:29 +00007027 count++;
7028
7029 len = vty_out (vty, "%s", peer->host);
7030 len = 16 - len;
7031 if (len < 1)
7032 vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " ");
7033 else
7034 vty_out (vty, "%*s", len, " ");
7035
hasso3d515fd2005-02-01 21:30:04 +00007036 vty_out (vty, "4 ");
paul718e3742002-12-13 20:15:29 +00007037
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04007038 vty_out (vty, "%5u %7d %7d %8d %4d %4lu ",
paul718e3742002-12-13 20:15:29 +00007039 peer->as,
7040 peer->open_in + peer->update_in + peer->keepalive_in
7041 + peer->notify_in + peer->refresh_in + peer->dynamic_cap_in,
7042 peer->open_out + peer->update_out + peer->keepalive_out
7043 + peer->notify_out + peer->refresh_out
7044 + peer->dynamic_cap_out,
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00007045 0, 0, (unsigned long) peer->obuf->count);
paul718e3742002-12-13 20:15:29 +00007046
7047 vty_out (vty, "%8s",
7048 peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN));
7049
7050 if (peer->status == Established)
7051 {
7052 vty_out (vty, " %8ld", peer->pcount[afi][safi]);
7053 }
7054 else
7055 {
7056 if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN))
7057 vty_out (vty, " Idle (Admin)");
7058 else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW))
7059 vty_out (vty, " Idle (PfxCt)");
7060 else
7061 vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, peer->status));
7062 }
7063
7064 vty_out (vty, "%s", VTY_NEWLINE);
7065 }
7066 }
7067
7068 if (count)
7069 vty_out (vty, "%sTotal number of neighbors %d%s", VTY_NEWLINE,
7070 count, VTY_NEWLINE);
7071 else
7072 vty_out (vty, "No %s neighbor is configured%s",
7073 afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE);
7074 return CMD_SUCCESS;
7075}
7076
paul94f2b392005-06-28 12:44:16 +00007077static int
paulfd79ac92004-10-13 05:06:08 +00007078bgp_show_summary_vty (struct vty *vty, const char *name,
7079 afi_t afi, safi_t safi)
paul718e3742002-12-13 20:15:29 +00007080{
7081 struct bgp *bgp;
7082
7083 if (name)
7084 {
7085 bgp = bgp_lookup_by_name (name);
7086
7087 if (! bgp)
7088 {
7089 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
7090 return CMD_WARNING;
7091 }
7092
7093 bgp_show_summary (vty, bgp, afi, safi);
7094 return CMD_SUCCESS;
7095 }
7096
7097 bgp = bgp_get_default ();
7098
7099 if (bgp)
7100 bgp_show_summary (vty, bgp, afi, safi);
7101
7102 return CMD_SUCCESS;
7103}
7104
7105/* `show ip bgp summary' commands. */
7106DEFUN (show_ip_bgp_summary,
7107 show_ip_bgp_summary_cmd,
7108 "show ip bgp summary",
7109 SHOW_STR
7110 IP_STR
7111 BGP_STR
7112 "Summary of BGP neighbor status\n")
7113{
7114 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
7115}
7116
7117DEFUN (show_ip_bgp_instance_summary,
7118 show_ip_bgp_instance_summary_cmd,
7119 "show ip bgp view WORD summary",
7120 SHOW_STR
7121 IP_STR
7122 BGP_STR
7123 "BGP view\n"
7124 "View name\n"
7125 "Summary of BGP neighbor status\n")
7126{
7127 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
7128}
7129
7130DEFUN (show_ip_bgp_ipv4_summary,
7131 show_ip_bgp_ipv4_summary_cmd,
7132 "show ip bgp ipv4 (unicast|multicast) summary",
7133 SHOW_STR
7134 IP_STR
7135 BGP_STR
7136 "Address family\n"
7137 "Address Family modifier\n"
7138 "Address Family modifier\n"
7139 "Summary of BGP neighbor status\n")
7140{
7141 if (strncmp (argv[0], "m", 1) == 0)
7142 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
7143
7144 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
7145}
7146
Michael Lambert95cbbd22010-07-23 14:43:04 -04007147ALIAS (show_ip_bgp_ipv4_summary,
7148 show_bgp_ipv4_safi_summary_cmd,
7149 "show bgp ipv4 (unicast|multicast) summary",
7150 SHOW_STR
7151 BGP_STR
7152 "Address family\n"
7153 "Address Family modifier\n"
7154 "Address Family modifier\n"
7155 "Summary of BGP neighbor status\n")
7156
paul718e3742002-12-13 20:15:29 +00007157DEFUN (show_ip_bgp_instance_ipv4_summary,
7158 show_ip_bgp_instance_ipv4_summary_cmd,
7159 "show ip bgp view WORD ipv4 (unicast|multicast) summary",
7160 SHOW_STR
7161 IP_STR
7162 BGP_STR
7163 "BGP view\n"
7164 "View name\n"
7165 "Address family\n"
7166 "Address Family modifier\n"
7167 "Address Family modifier\n"
7168 "Summary of BGP neighbor status\n")
7169{
7170 if (strncmp (argv[1], "m", 1) == 0)
7171 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
7172 else
7173 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
7174}
7175
Michael Lambert95cbbd22010-07-23 14:43:04 -04007176ALIAS (show_ip_bgp_instance_ipv4_summary,
7177 show_bgp_instance_ipv4_safi_summary_cmd,
7178 "show bgp view WORD ipv4 (unicast|multicast) summary",
7179 SHOW_STR
7180 BGP_STR
7181 "BGP view\n"
7182 "View name\n"
7183 "Address family\n"
7184 "Address Family modifier\n"
7185 "Address Family modifier\n"
7186 "Summary of BGP neighbor status\n")
7187
paul718e3742002-12-13 20:15:29 +00007188DEFUN (show_ip_bgp_vpnv4_all_summary,
7189 show_ip_bgp_vpnv4_all_summary_cmd,
7190 "show ip bgp vpnv4 all summary",
7191 SHOW_STR
7192 IP_STR
7193 BGP_STR
7194 "Display VPNv4 NLRI specific information\n"
7195 "Display information about all VPNv4 NLRIs\n"
7196 "Summary of BGP neighbor status\n")
7197{
7198 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
7199}
7200
7201DEFUN (show_ip_bgp_vpnv4_rd_summary,
7202 show_ip_bgp_vpnv4_rd_summary_cmd,
7203 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn summary",
7204 SHOW_STR
7205 IP_STR
7206 BGP_STR
7207 "Display VPNv4 NLRI specific information\n"
7208 "Display information for a route distinguisher\n"
7209 "VPN Route Distinguisher\n"
7210 "Summary of BGP neighbor status\n")
7211{
7212 int ret;
7213 struct prefix_rd prd;
7214
7215 ret = str2prefix_rd (argv[0], &prd);
7216 if (! ret)
7217 {
7218 vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
7219 return CMD_WARNING;
7220 }
7221
7222 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
7223}
7224
7225#ifdef HAVE_IPV6
7226DEFUN (show_bgp_summary,
7227 show_bgp_summary_cmd,
7228 "show bgp summary",
7229 SHOW_STR
7230 BGP_STR
7231 "Summary of BGP neighbor status\n")
7232{
7233 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
7234}
7235
7236DEFUN (show_bgp_instance_summary,
7237 show_bgp_instance_summary_cmd,
7238 "show bgp view WORD summary",
7239 SHOW_STR
7240 BGP_STR
7241 "BGP view\n"
7242 "View name\n"
7243 "Summary of BGP neighbor status\n")
7244{
7245 return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
7246}
7247
7248ALIAS (show_bgp_summary,
7249 show_bgp_ipv6_summary_cmd,
7250 "show bgp ipv6 summary",
7251 SHOW_STR
7252 BGP_STR
7253 "Address family\n"
7254 "Summary of BGP neighbor status\n")
7255
7256ALIAS (show_bgp_instance_summary,
7257 show_bgp_instance_ipv6_summary_cmd,
7258 "show bgp view WORD ipv6 summary",
7259 SHOW_STR
7260 BGP_STR
7261 "BGP view\n"
7262 "View name\n"
7263 "Address family\n"
7264 "Summary of BGP neighbor status\n")
7265
Michael Lambert95cbbd22010-07-23 14:43:04 -04007266DEFUN (show_bgp_ipv6_safi_summary,
7267 show_bgp_ipv6_safi_summary_cmd,
7268 "show bgp ipv6 (unicast|multicast) summary",
7269 SHOW_STR
7270 BGP_STR
7271 "Address family\n"
7272 "Address Family modifier\n"
7273 "Address Family modifier\n"
7274 "Summary of BGP neighbor status\n")
7275{
7276 if (strncmp (argv[0], "m", 1) == 0)
7277 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
7278
7279 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
7280}
7281
7282DEFUN (show_bgp_instance_ipv6_safi_summary,
7283 show_bgp_instance_ipv6_safi_summary_cmd,
7284 "show bgp view WORD ipv6 (unicast|multicast) summary",
7285 SHOW_STR
7286 BGP_STR
7287 "BGP view\n"
7288 "View name\n"
7289 "Address family\n"
7290 "Address Family modifier\n"
7291 "Address Family modifier\n"
7292 "Summary of BGP neighbor status\n")
7293{
7294 if (strncmp (argv[1], "m", 1) == 0)
7295 return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST);
7296
7297 return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
7298}
7299
paul718e3742002-12-13 20:15:29 +00007300/* old command */
7301DEFUN (show_ipv6_bgp_summary,
7302 show_ipv6_bgp_summary_cmd,
7303 "show ipv6 bgp summary",
7304 SHOW_STR
7305 IPV6_STR
7306 BGP_STR
7307 "Summary of BGP neighbor status\n")
7308{
7309 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
7310}
7311
7312/* old command */
7313DEFUN (show_ipv6_mbgp_summary,
7314 show_ipv6_mbgp_summary_cmd,
7315 "show ipv6 mbgp summary",
7316 SHOW_STR
7317 IPV6_STR
7318 MBGP_STR
7319 "Summary of BGP neighbor status\n")
7320{
7321 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
7322}
7323#endif /* HAVE_IPV6 */
David Lamparter6b0655a2014-06-04 06:53:35 +02007324
paulfd79ac92004-10-13 05:06:08 +00007325const char *
hasso538621f2004-05-21 09:31:30 +00007326afi_safi_print (afi_t afi, safi_t safi)
7327{
7328 if (afi == AFI_IP && safi == SAFI_UNICAST)
7329 return "IPv4 Unicast";
7330 else if (afi == AFI_IP && safi == SAFI_MULTICAST)
7331 return "IPv4 Multicast";
7332 else if (afi == AFI_IP && safi == SAFI_MPLS_VPN)
Lou Berger9da04bc2016-01-12 13:41:55 -05007333 return "VPN-IPv4 Unicast";
hasso538621f2004-05-21 09:31:30 +00007334 else if (afi == AFI_IP6 && safi == SAFI_UNICAST)
7335 return "IPv6 Unicast";
7336 else if (afi == AFI_IP6 && safi == SAFI_MULTICAST)
7337 return "IPv6 Multicast";
Lou Berger9da04bc2016-01-12 13:41:55 -05007338 else if (afi == AFI_IP6 && safi == SAFI_MPLS_VPN)
7339 return "VPN-IPv6 Unicast";
hasso538621f2004-05-21 09:31:30 +00007340 else
7341 return "Unknown";
7342}
7343
paul718e3742002-12-13 20:15:29 +00007344/* Show BGP peer's information. */
7345enum show_type
7346{
7347 show_all,
7348 show_peer
7349};
7350
paul94f2b392005-06-28 12:44:16 +00007351static void
paul718e3742002-12-13 20:15:29 +00007352bgp_show_peer_afi_orf_cap (struct vty *vty, struct peer *p,
7353 afi_t afi, safi_t safi,
7354 u_int16_t adv_smcap, u_int16_t adv_rmcap,
7355 u_int16_t rcv_smcap, u_int16_t rcv_rmcap)
7356{
7357 /* Send-Mode */
7358 if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap)
7359 || CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap))
7360 {
7361 vty_out (vty, " Send-mode: ");
7362 if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap))
7363 vty_out (vty, "advertised");
7364 if (CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap))
7365 vty_out (vty, "%sreceived",
7366 CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) ?
7367 ", " : "");
7368 vty_out (vty, "%s", VTY_NEWLINE);
7369 }
7370
7371 /* Receive-Mode */
7372 if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap)
7373 || CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap))
7374 {
7375 vty_out (vty, " Receive-mode: ");
7376 if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap))
7377 vty_out (vty, "advertised");
7378 if (CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap))
7379 vty_out (vty, "%sreceived",
7380 CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) ?
7381 ", " : "");
7382 vty_out (vty, "%s", VTY_NEWLINE);
7383 }
7384}
7385
paul94f2b392005-06-28 12:44:16 +00007386static void
paul718e3742002-12-13 20:15:29 +00007387bgp_show_peer_afi (struct vty *vty, struct peer *p, afi_t afi, safi_t safi)
7388{
7389 struct bgp_filter *filter;
7390 char orf_pfx_name[BUFSIZ];
7391 int orf_pfx_count;
7392
7393 filter = &p->filter[afi][safi];
7394
hasso538621f2004-05-21 09:31:30 +00007395 vty_out (vty, " For address family: %s%s", afi_safi_print (afi, safi),
paul718e3742002-12-13 20:15:29 +00007396 VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00007397
paul718e3742002-12-13 20:15:29 +00007398 if (p->af_group[afi][safi])
7399 vty_out (vty, " %s peer-group member%s", p->group->name, VTY_NEWLINE);
7400
7401 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
7402 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
7403 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)
7404 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
7405 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV)
7406 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
7407 vty_out (vty, " AF-dependant capabilities:%s", VTY_NEWLINE);
7408
7409 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
7410 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
7411 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
7412 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV))
7413 {
7414 vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
7415 ORF_TYPE_PREFIX, VTY_NEWLINE);
7416 bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
7417 PEER_CAP_ORF_PREFIX_SM_ADV,
7418 PEER_CAP_ORF_PREFIX_RM_ADV,
7419 PEER_CAP_ORF_PREFIX_SM_RCV,
7420 PEER_CAP_ORF_PREFIX_RM_RCV);
7421 }
7422 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
7423 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)
7424 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
7425 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
7426 {
7427 vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
7428 ORF_TYPE_PREFIX_OLD, VTY_NEWLINE);
7429 bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
7430 PEER_CAP_ORF_PREFIX_SM_ADV,
7431 PEER_CAP_ORF_PREFIX_RM_ADV,
7432 PEER_CAP_ORF_PREFIX_SM_OLD_RCV,
7433 PEER_CAP_ORF_PREFIX_RM_OLD_RCV);
7434 }
7435
7436 sprintf (orf_pfx_name, "%s.%d.%d", p->host, afi, safi);
7437 orf_pfx_count = prefix_bgp_show_prefix_list (NULL, afi, orf_pfx_name);
7438
7439 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND)
7440 || orf_pfx_count)
7441 {
7442 vty_out (vty, " Outbound Route Filter (ORF):");
7443 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND))
7444 vty_out (vty, " sent;");
7445 if (orf_pfx_count)
7446 vty_out (vty, " received (%d entries)", orf_pfx_count);
7447 vty_out (vty, "%s", VTY_NEWLINE);
7448 }
7449 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH))
7450 vty_out (vty, " First update is deferred until ORF or ROUTE-REFRESH is received%s", VTY_NEWLINE);
7451
7452 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT))
7453 vty_out (vty, " Route-Reflector Client%s", VTY_NEWLINE);
7454 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT))
7455 vty_out (vty, " Route-Server Client%s", VTY_NEWLINE);
7456 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG))
7457 vty_out (vty, " Inbound soft reconfiguration allowed%s", VTY_NEWLINE);
7458 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS))
7459 vty_out (vty, " Private AS number removed from updates to this neighbor%s", VTY_NEWLINE);
7460 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF))
7461 vty_out (vty, " NEXT_HOP is always this router%s", VTY_NEWLINE);
7462 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED))
7463 vty_out (vty, " AS_PATH is propagated unchanged to this neighbor%s", VTY_NEWLINE);
7464 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED))
7465 vty_out (vty, " NEXT_HOP is propagated unchanged to this neighbor%s", VTY_NEWLINE);
7466 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED))
7467 vty_out (vty, " MED is propagated unchanged to this neighbor%s", VTY_NEWLINE);
7468 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
7469 || CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
7470 {
7471 vty_out (vty, " Community attribute sent to this neighbor");
7472 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
7473 && CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
hasso538621f2004-05-21 09:31:30 +00007474 vty_out (vty, "(both)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007475 else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
hasso538621f2004-05-21 09:31:30 +00007476 vty_out (vty, "(extended)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007477 else
hasso538621f2004-05-21 09:31:30 +00007478 vty_out (vty, "(standard)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007479 }
7480 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE))
7481 {
7482 vty_out (vty, " Default information originate,");
7483
7484 if (p->default_rmap[afi][safi].name)
7485 vty_out (vty, " default route-map %s%s,",
7486 p->default_rmap[afi][safi].map ? "*" : "",
7487 p->default_rmap[afi][safi].name);
7488 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_DEFAULT_ORIGINATE))
7489 vty_out (vty, " default sent%s", VTY_NEWLINE);
7490 else
7491 vty_out (vty, " default not sent%s", VTY_NEWLINE);
7492 }
7493
7494 if (filter->plist[FILTER_IN].name
7495 || filter->dlist[FILTER_IN].name
7496 || filter->aslist[FILTER_IN].name
paulfee0f4c2004-09-13 05:12:46 +00007497 || filter->map[RMAP_IN].name)
paul718e3742002-12-13 20:15:29 +00007498 vty_out (vty, " Inbound path policy configured%s", VTY_NEWLINE);
7499 if (filter->plist[FILTER_OUT].name
7500 || filter->dlist[FILTER_OUT].name
7501 || filter->aslist[FILTER_OUT].name
paulfee0f4c2004-09-13 05:12:46 +00007502 || filter->map[RMAP_OUT].name
paul718e3742002-12-13 20:15:29 +00007503 || filter->usmap.name)
7504 vty_out (vty, " Outbound path policy configured%s", VTY_NEWLINE);
paulfee0f4c2004-09-13 05:12:46 +00007505 if (filter->map[RMAP_IMPORT].name)
7506 vty_out (vty, " Import policy for this RS-client configured%s", VTY_NEWLINE);
7507 if (filter->map[RMAP_EXPORT].name)
7508 vty_out (vty, " Export policy for this RS-client configured%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007509
7510 /* prefix-list */
7511 if (filter->plist[FILTER_IN].name)
7512 vty_out (vty, " Incoming update prefix filter list is %s%s%s",
7513 filter->plist[FILTER_IN].plist ? "*" : "",
7514 filter->plist[FILTER_IN].name,
7515 VTY_NEWLINE);
7516 if (filter->plist[FILTER_OUT].name)
7517 vty_out (vty, " Outgoing update prefix filter list is %s%s%s",
7518 filter->plist[FILTER_OUT].plist ? "*" : "",
7519 filter->plist[FILTER_OUT].name,
7520 VTY_NEWLINE);
7521
7522 /* distribute-list */
7523 if (filter->dlist[FILTER_IN].name)
7524 vty_out (vty, " Incoming update network filter list is %s%s%s",
7525 filter->dlist[FILTER_IN].alist ? "*" : "",
7526 filter->dlist[FILTER_IN].name,
7527 VTY_NEWLINE);
7528 if (filter->dlist[FILTER_OUT].name)
7529 vty_out (vty, " Outgoing update network filter list is %s%s%s",
7530 filter->dlist[FILTER_OUT].alist ? "*" : "",
7531 filter->dlist[FILTER_OUT].name,
7532 VTY_NEWLINE);
7533
7534 /* filter-list. */
7535 if (filter->aslist[FILTER_IN].name)
7536 vty_out (vty, " Incoming update AS path filter list is %s%s%s",
7537 filter->aslist[FILTER_IN].aslist ? "*" : "",
7538 filter->aslist[FILTER_IN].name,
7539 VTY_NEWLINE);
7540 if (filter->aslist[FILTER_OUT].name)
7541 vty_out (vty, " Outgoing update AS path filter list is %s%s%s",
7542 filter->aslist[FILTER_OUT].aslist ? "*" : "",
7543 filter->aslist[FILTER_OUT].name,
7544 VTY_NEWLINE);
7545
7546 /* route-map. */
paulfee0f4c2004-09-13 05:12:46 +00007547 if (filter->map[RMAP_IN].name)
paul718e3742002-12-13 20:15:29 +00007548 vty_out (vty, " Route map for incoming advertisements is %s%s%s",
paulfee0f4c2004-09-13 05:12:46 +00007549 filter->map[RMAP_IN].map ? "*" : "",
7550 filter->map[RMAP_IN].name,
paul718e3742002-12-13 20:15:29 +00007551 VTY_NEWLINE);
paulfee0f4c2004-09-13 05:12:46 +00007552 if (filter->map[RMAP_OUT].name)
paul718e3742002-12-13 20:15:29 +00007553 vty_out (vty, " Route map for outgoing advertisements is %s%s%s",
paulfee0f4c2004-09-13 05:12:46 +00007554 filter->map[RMAP_OUT].map ? "*" : "",
7555 filter->map[RMAP_OUT].name,
7556 VTY_NEWLINE);
7557 if (filter->map[RMAP_IMPORT].name)
7558 vty_out (vty, " Route map for advertisements going into this RS-client's table is %s%s%s",
7559 filter->map[RMAP_IMPORT].map ? "*" : "",
7560 filter->map[RMAP_IMPORT].name,
7561 VTY_NEWLINE);
7562 if (filter->map[RMAP_EXPORT].name)
7563 vty_out (vty, " Route map for advertisements coming from this RS-client is %s%s%s",
7564 filter->map[RMAP_EXPORT].map ? "*" : "",
7565 filter->map[RMAP_EXPORT].name,
paul718e3742002-12-13 20:15:29 +00007566 VTY_NEWLINE);
7567
7568 /* unsuppress-map */
7569 if (filter->usmap.name)
7570 vty_out (vty, " Route map for selective unsuppress is %s%s%s",
7571 filter->usmap.map ? "*" : "",
7572 filter->usmap.name, VTY_NEWLINE);
7573
7574 /* Receive prefix count */
hassoe0701b72004-05-20 09:19:34 +00007575 vty_out (vty, " %ld accepted prefixes%s", p->pcount[afi][safi], VTY_NEWLINE);
7576
paul718e3742002-12-13 20:15:29 +00007577 /* Maximum prefix */
7578 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX))
7579 {
hasso0a486e52005-02-01 20:57:17 +00007580 vty_out (vty, " Maximum prefixes allowed %ld%s%s", p->pmax[afi][safi],
paul718e3742002-12-13 20:15:29 +00007581 CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING)
hasso0a486e52005-02-01 20:57:17 +00007582 ? " (warning-only)" : "", VTY_NEWLINE);
7583 vty_out (vty, " Threshold for warning message %d%%",
7584 p->pmax_threshold[afi][safi]);
7585 if (p->pmax_restart[afi][safi])
7586 vty_out (vty, ", restart interval %d min", p->pmax_restart[afi][safi]);
7587 vty_out (vty, "%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007588 }
paul718e3742002-12-13 20:15:29 +00007589
7590 vty_out (vty, "%s", VTY_NEWLINE);
7591}
7592
paul94f2b392005-06-28 12:44:16 +00007593static void
paul718e3742002-12-13 20:15:29 +00007594bgp_show_peer (struct vty *vty, struct peer *p)
7595{
7596 struct bgp *bgp;
7597 char buf1[BUFSIZ];
7598 char timebuf[BGP_UPTIME_LEN];
hasso538621f2004-05-21 09:31:30 +00007599 afi_t afi;
7600 safi_t safi;
paul718e3742002-12-13 20:15:29 +00007601
7602 bgp = p->bgp;
7603
7604 /* Configured IP address. */
7605 vty_out (vty, "BGP neighbor is %s, ", p->host);
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04007606 vty_out (vty, "remote AS %u, ", p->as);
Andrew Certain9d3f9702012-11-07 23:50:07 +00007607 vty_out (vty, "local AS %u%s%s, ",
paul718e3742002-12-13 20:15:29 +00007608 p->change_local_as ? p->change_local_as : p->local_as,
7609 CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND) ?
Andrew Certain9d3f9702012-11-07 23:50:07 +00007610 " no-prepend" : "",
7611 CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_REPLACE_AS) ?
7612 " replace-as" : "");
paul718e3742002-12-13 20:15:29 +00007613 vty_out (vty, "%s link%s",
7614 p->as == p->local_as ? "internal" : "external",
7615 VTY_NEWLINE);
7616
7617 /* Description. */
7618 if (p->desc)
7619 vty_out (vty, " Description: %s%s", p->desc, VTY_NEWLINE);
7620
7621 /* Peer-group */
7622 if (p->group)
7623 vty_out (vty, " Member of peer-group %s for session parameters%s",
7624 p->group->name, VTY_NEWLINE);
7625
7626 /* Administrative shutdown. */
7627 if (CHECK_FLAG (p->flags, PEER_FLAG_SHUTDOWN))
7628 vty_out (vty, " Administratively shut down%s", VTY_NEWLINE);
7629
7630 /* BGP Version. */
7631 vty_out (vty, " BGP version 4");
paul718e3742002-12-13 20:15:29 +00007632 vty_out (vty, ", remote router ID %s%s",
7633 inet_ntop (AF_INET, &p->remote_id, buf1, BUFSIZ),
7634 VTY_NEWLINE);
7635
7636 /* Confederation */
hassoe0701b72004-05-20 09:19:34 +00007637 if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION)
7638 && bgp_confederation_peers_check (bgp, p->as))
paul718e3742002-12-13 20:15:29 +00007639 vty_out (vty, " Neighbor under common administration%s", VTY_NEWLINE);
7640
7641 /* Status. */
7642 vty_out (vty, " BGP state = %s",
7643 LOOKUP (bgp_status_msg, p->status));
7644 if (p->status == Established)
7645 vty_out (vty, ", up for %8s",
7646 peer_uptime (p->uptime, timebuf, BGP_UPTIME_LEN));
hasso93406d82005-02-02 14:40:33 +00007647 else if (p->status == Active)
7648 {
7649 if (CHECK_FLAG (p->flags, PEER_FLAG_PASSIVE))
7650 vty_out (vty, " (passive)");
7651 else if (CHECK_FLAG (p->sflags, PEER_STATUS_NSF_WAIT))
7652 vty_out (vty, " (NSF passive)");
7653 }
paul718e3742002-12-13 20:15:29 +00007654 vty_out (vty, "%s", VTY_NEWLINE);
7655
7656 /* read timer */
7657 vty_out (vty, " Last read %s", peer_uptime (p->readtime, timebuf, BGP_UPTIME_LEN));
7658
7659 /* Configured timer values. */
7660 vty_out (vty, ", hold time is %d, keepalive interval is %d seconds%s",
7661 p->v_holdtime, p->v_keepalive, VTY_NEWLINE);
7662 if (CHECK_FLAG (p->config, PEER_CONFIG_TIMER))
7663 {
7664 vty_out (vty, " Configured hold time is %d", p->holdtime);
7665 vty_out (vty, ", keepalive interval is %d seconds%s",
7666 p->keepalive, VTY_NEWLINE);
7667 }
hasso93406d82005-02-02 14:40:33 +00007668
paul718e3742002-12-13 20:15:29 +00007669 /* Capability. */
7670 if (p->status == Established)
7671 {
hasso538621f2004-05-21 09:31:30 +00007672 if (p->cap
paul718e3742002-12-13 20:15:29 +00007673 || p->afc_adv[AFI_IP][SAFI_UNICAST]
7674 || p->afc_recv[AFI_IP][SAFI_UNICAST]
7675 || p->afc_adv[AFI_IP][SAFI_MULTICAST]
7676 || p->afc_recv[AFI_IP][SAFI_MULTICAST]
7677#ifdef HAVE_IPV6
7678 || p->afc_adv[AFI_IP6][SAFI_UNICAST]
7679 || p->afc_recv[AFI_IP6][SAFI_UNICAST]
7680 || p->afc_adv[AFI_IP6][SAFI_MULTICAST]
7681 || p->afc_recv[AFI_IP6][SAFI_MULTICAST]
Lou Berger9da04bc2016-01-12 13:41:55 -05007682 || p->afc_adv[AFI_IP6][SAFI_MPLS_VPN]
7683 || p->afc_recv[AFI_IP6][SAFI_MPLS_VPN]
paul718e3742002-12-13 20:15:29 +00007684#endif /* HAVE_IPV6 */
7685 || p->afc_adv[AFI_IP][SAFI_MPLS_VPN]
7686 || p->afc_recv[AFI_IP][SAFI_MPLS_VPN])
7687 {
7688 vty_out (vty, " Neighbor capabilities:%s", VTY_NEWLINE);
7689
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00007690 /* AS4 */
7691 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV)
7692 || CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV))
7693 {
7694 vty_out (vty, " 4 Byte AS:");
7695 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV))
7696 vty_out (vty, " advertised");
7697 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV))
7698 vty_out (vty, " %sreceived",
7699 CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV) ? "and " : "");
7700 vty_out (vty, "%s", VTY_NEWLINE);
7701 }
paul718e3742002-12-13 20:15:29 +00007702 /* Dynamic */
7703 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)
7704 || CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV))
7705 {
7706 vty_out (vty, " Dynamic:");
7707 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV))
7708 vty_out (vty, " advertised");
7709 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV))
hasso538621f2004-05-21 09:31:30 +00007710 vty_out (vty, " %sreceived",
7711 CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV) ? "and " : "");
paul718e3742002-12-13 20:15:29 +00007712 vty_out (vty, "%s", VTY_NEWLINE);
7713 }
7714
7715 /* Route Refresh */
7716 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV)
7717 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)
7718 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
7719 {
7720 vty_out (vty, " Route refresh:");
7721 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV))
7722 vty_out (vty, " advertised");
7723 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)
7724 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
hasso538621f2004-05-21 09:31:30 +00007725 vty_out (vty, " %sreceived(%s)",
7726 CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) ? "and " : "",
7727 (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)
7728 && CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)) ?
7729 "old & new" : CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) ? "old" : "new");
7730
paul718e3742002-12-13 20:15:29 +00007731 vty_out (vty, "%s", VTY_NEWLINE);
7732 }
7733
hasso538621f2004-05-21 09:31:30 +00007734 /* Multiprotocol Extensions */
7735 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
7736 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
7737 if (p->afc_adv[afi][safi] || p->afc_recv[afi][safi])
paul718e3742002-12-13 20:15:29 +00007738 {
hasso538621f2004-05-21 09:31:30 +00007739 vty_out (vty, " Address family %s:", afi_safi_print (afi, safi));
7740 if (p->afc_adv[afi][safi])
7741 vty_out (vty, " advertised");
7742 if (p->afc_recv[afi][safi])
7743 vty_out (vty, " %sreceived", p->afc_adv[afi][safi] ? "and " : "");
7744 vty_out (vty, "%s", VTY_NEWLINE);
7745 }
7746
7747 /* Gracefull Restart */
7748 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)
7749 || CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
paul718e3742002-12-13 20:15:29 +00007750 {
hasso538621f2004-05-21 09:31:30 +00007751 vty_out (vty, " Graceful Restart Capabilty:");
7752 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
paul718e3742002-12-13 20:15:29 +00007753 vty_out (vty, " advertised");
hasso538621f2004-05-21 09:31:30 +00007754 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
7755 vty_out (vty, " %sreceived",
7756 CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV) ? "and " : "");
paul718e3742002-12-13 20:15:29 +00007757 vty_out (vty, "%s", VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00007758
7759 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
paul718e3742002-12-13 20:15:29 +00007760 {
hasso538621f2004-05-21 09:31:30 +00007761 int restart_af_count = 0;
7762
7763 vty_out (vty, " Remote Restart timer is %d seconds%s",
hasso93406d82005-02-02 14:40:33 +00007764 p->v_gr_restart, VTY_NEWLINE);
7765 vty_out (vty, " Address families by peer:%s ", VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00007766
7767 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
7768 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
7769 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_RCV))
7770 {
hasso93406d82005-02-02 14:40:33 +00007771 vty_out (vty, "%s%s(%s)", restart_af_count ? ", " : "",
7772 afi_safi_print (afi, safi),
7773 CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_PRESERVE_RCV) ?
7774 "preserved" : "not preserved");
hasso538621f2004-05-21 09:31:30 +00007775 restart_af_count++;
hasso93406d82005-02-02 14:40:33 +00007776 }
hasso538621f2004-05-21 09:31:30 +00007777 if (! restart_af_count)
7778 vty_out (vty, "none");
7779 vty_out (vty, "%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007780 }
paul718e3742002-12-13 20:15:29 +00007781 }
paul718e3742002-12-13 20:15:29 +00007782 }
7783 }
7784
hasso93406d82005-02-02 14:40:33 +00007785 /* graceful restart information */
7786 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)
7787 || p->t_gr_restart
7788 || p->t_gr_stale)
7789 {
7790 int eor_send_af_count = 0;
7791 int eor_receive_af_count = 0;
7792
7793 vty_out (vty, " Graceful restart informations:%s", VTY_NEWLINE);
7794 if (p->status == Established)
7795 {
7796 vty_out (vty, " End-of-RIB send: ");
7797 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
7798 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
7799 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_SEND))
7800 {
7801 vty_out (vty, "%s%s", eor_send_af_count ? ", " : "",
7802 afi_safi_print (afi, safi));
7803 eor_send_af_count++;
7804 }
7805 vty_out (vty, "%s", VTY_NEWLINE);
7806
7807 vty_out (vty, " End-of-RIB received: ");
7808 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
7809 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
7810 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_RECEIVED))
7811 {
7812 vty_out (vty, "%s%s", eor_receive_af_count ? ", " : "",
7813 afi_safi_print (afi, safi));
7814 eor_receive_af_count++;
7815 }
7816 vty_out (vty, "%s", VTY_NEWLINE);
7817 }
7818
7819 if (p->t_gr_restart)
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00007820 vty_out (vty, " The remaining time of restart timer is %ld%s",
7821 thread_timer_remain_second (p->t_gr_restart), VTY_NEWLINE);
7822
hasso93406d82005-02-02 14:40:33 +00007823 if (p->t_gr_stale)
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00007824 vty_out (vty, " The remaining time of stalepath timer is %ld%s",
7825 thread_timer_remain_second (p->t_gr_stale), VTY_NEWLINE);
hasso93406d82005-02-02 14:40:33 +00007826 }
7827
paul718e3742002-12-13 20:15:29 +00007828 /* Packet counts. */
hasso93406d82005-02-02 14:40:33 +00007829 vty_out (vty, " Message statistics:%s", VTY_NEWLINE);
7830 vty_out (vty, " Inq depth is 0%s", VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00007831 vty_out (vty, " Outq depth is %lu%s", (unsigned long) p->obuf->count, VTY_NEWLINE);
hasso93406d82005-02-02 14:40:33 +00007832 vty_out (vty, " Sent Rcvd%s", VTY_NEWLINE);
7833 vty_out (vty, " Opens: %10d %10d%s", p->open_out, p->open_in, VTY_NEWLINE);
7834 vty_out (vty, " Notifications: %10d %10d%s", p->notify_out, p->notify_in, VTY_NEWLINE);
7835 vty_out (vty, " Updates: %10d %10d%s", p->update_out, p->update_in, VTY_NEWLINE);
7836 vty_out (vty, " Keepalives: %10d %10d%s", p->keepalive_out, p->keepalive_in, VTY_NEWLINE);
7837 vty_out (vty, " Route Refresh: %10d %10d%s", p->refresh_out, p->refresh_in, VTY_NEWLINE);
7838 vty_out (vty, " Capability: %10d %10d%s", p->dynamic_cap_out, p->dynamic_cap_in, VTY_NEWLINE);
7839 vty_out (vty, " Total: %10d %10d%s", p->open_out + p->notify_out +
7840 p->update_out + p->keepalive_out + p->refresh_out + p->dynamic_cap_out,
7841 p->open_in + p->notify_in + p->update_in + p->keepalive_in + p->refresh_in +
7842 p->dynamic_cap_in, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007843
7844 /* advertisement-interval */
7845 vty_out (vty, " Minimum time between advertisement runs is %d seconds%s",
7846 p->v_routeadv, VTY_NEWLINE);
7847
7848 /* Update-source. */
7849 if (p->update_if || p->update_source)
7850 {
7851 vty_out (vty, " Update source is ");
7852 if (p->update_if)
7853 vty_out (vty, "%s", p->update_if);
7854 else if (p->update_source)
7855 vty_out (vty, "%s",
7856 sockunion2str (p->update_source, buf1, SU_ADDRSTRLEN));
7857 vty_out (vty, "%s", VTY_NEWLINE);
7858 }
7859
7860 /* Default weight */
7861 if (CHECK_FLAG (p->config, PEER_CONFIG_WEIGHT))
7862 vty_out (vty, " Default weight %d%s", p->weight,
7863 VTY_NEWLINE);
7864
7865 vty_out (vty, "%s", VTY_NEWLINE);
7866
7867 /* Address Family Information */
hasso538621f2004-05-21 09:31:30 +00007868 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
7869 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
7870 if (p->afc[afi][safi])
7871 bgp_show_peer_afi (vty, p, afi, safi);
paul718e3742002-12-13 20:15:29 +00007872
7873 vty_out (vty, " Connections established %d; dropped %d%s",
7874 p->established, p->dropped,
7875 VTY_NEWLINE);
7876
hassoe0701b72004-05-20 09:19:34 +00007877 if (! p->dropped)
7878 vty_out (vty, " Last reset never%s", VTY_NEWLINE);
7879 else
7880 vty_out (vty, " Last reset %s, due to %s%s",
7881 peer_uptime (p->resettime, timebuf, BGP_UPTIME_LEN),
7882 peer_down_str[(int) p->last_reset], VTY_NEWLINE);
paul848973c2003-08-13 00:32:49 +00007883
paul718e3742002-12-13 20:15:29 +00007884 if (CHECK_FLAG (p->sflags, PEER_STATUS_PREFIX_OVERFLOW))
7885 {
7886 vty_out (vty, " Peer had exceeded the max. no. of prefixes configured.%s", VTY_NEWLINE);
hasso0a486e52005-02-01 20:57:17 +00007887
7888 if (p->t_pmax_restart)
7889 vty_out (vty, " Reduce the no. of prefix from %s, will restart in %ld seconds%s",
7890 p->host, thread_timer_remain_second (p->t_pmax_restart),
7891 VTY_NEWLINE);
7892 else
7893 vty_out (vty, " Reduce the no. of prefix and clear ip bgp %s to restore peering%s",
7894 p->host, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007895 }
7896
Stephen Hemmingerf5a48272011-03-24 17:30:21 +00007897 /* EBGP Multihop and GTSM */
Jorge Boncompte [DTI2]6d85b152012-05-07 16:52:54 +00007898 if (p->sort != BGP_PEER_IBGP)
Stephen Hemmingerf5a48272011-03-24 17:30:21 +00007899 {
7900 if (p->gtsm_hops > 0)
7901 vty_out (vty, " External BGP neighbor may be up to %d hops away.%s",
7902 p->gtsm_hops, VTY_NEWLINE);
7903 else if (p->ttl > 1)
7904 vty_out (vty, " External BGP neighbor may be up to %d hops away.%s",
7905 p->ttl, VTY_NEWLINE);
7906 }
Pradosh Mohapatra5d804b42013-09-12 03:37:07 +00007907 else
7908 {
7909 if (p->gtsm_hops > 0)
7910 vty_out (vty, " Internal BGP neighbor may be up to %d hops away.%s",
7911 p->gtsm_hops, VTY_NEWLINE);
7912 }
paul718e3742002-12-13 20:15:29 +00007913
7914 /* Local address. */
7915 if (p->su_local)
7916 {
hasso93406d82005-02-02 14:40:33 +00007917 vty_out (vty, "Local host: %s, Local port: %d%s",
paul718e3742002-12-13 20:15:29 +00007918 sockunion2str (p->su_local, buf1, SU_ADDRSTRLEN),
7919 ntohs (p->su_local->sin.sin_port),
paul718e3742002-12-13 20:15:29 +00007920 VTY_NEWLINE);
7921 }
7922
7923 /* Remote address. */
7924 if (p->su_remote)
7925 {
7926 vty_out (vty, "Foreign host: %s, Foreign port: %d%s",
7927 sockunion2str (p->su_remote, buf1, SU_ADDRSTRLEN),
7928 ntohs (p->su_remote->sin.sin_port),
7929 VTY_NEWLINE);
7930 }
7931
7932 /* Nexthop display. */
7933 if (p->su_local)
7934 {
7935 vty_out (vty, "Nexthop: %s%s",
7936 inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ),
7937 VTY_NEWLINE);
7938#ifdef HAVE_IPV6
7939 vty_out (vty, "Nexthop global: %s%s",
7940 inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ),
7941 VTY_NEWLINE);
7942 vty_out (vty, "Nexthop local: %s%s",
7943 inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ),
7944 VTY_NEWLINE);
7945 vty_out (vty, "BGP connection: %s%s",
7946 p->shared_network ? "shared network" : "non shared network",
7947 VTY_NEWLINE);
7948#endif /* HAVE_IPV6 */
7949 }
7950
Timo Teräsef757702015-04-29 09:43:04 +03007951 /* TCP metrics. */
7952 if (p->status == Established && p->rtt)
7953 vty_out (vty, "Estimated round trip time: %d ms%s",
7954 p->rtt, VTY_NEWLINE);
7955
paul718e3742002-12-13 20:15:29 +00007956 /* Timer information. */
7957 if (p->t_start)
7958 vty_out (vty, "Next start timer due in %ld seconds%s",
7959 thread_timer_remain_second (p->t_start), VTY_NEWLINE);
7960 if (p->t_connect)
7961 vty_out (vty, "Next connect timer due in %ld seconds%s",
7962 thread_timer_remain_second (p->t_connect), VTY_NEWLINE);
7963
7964 vty_out (vty, "Read thread: %s Write thread: %s%s",
7965 p->t_read ? "on" : "off",
7966 p->t_write ? "on" : "off",
7967 VTY_NEWLINE);
7968
7969 if (p->notify.code == BGP_NOTIFY_OPEN_ERR
7970 && p->notify.subcode == BGP_NOTIFY_OPEN_UNSUP_CAPBL)
7971 bgp_capability_vty_out (vty, p);
7972
7973 vty_out (vty, "%s", VTY_NEWLINE);
7974}
7975
paul94f2b392005-06-28 12:44:16 +00007976static int
paul718e3742002-12-13 20:15:29 +00007977bgp_show_neighbor (struct vty *vty, struct bgp *bgp,
7978 enum show_type type, union sockunion *su)
7979{
paul1eb8ef22005-04-07 07:30:20 +00007980 struct listnode *node, *nnode;
paul718e3742002-12-13 20:15:29 +00007981 struct peer *peer;
7982 int find = 0;
7983
paul1eb8ef22005-04-07 07:30:20 +00007984 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00007985 {
7986 switch (type)
7987 {
7988 case show_all:
7989 bgp_show_peer (vty, peer);
7990 break;
7991 case show_peer:
7992 if (sockunion_same (&peer->su, su))
7993 {
7994 find = 1;
7995 bgp_show_peer (vty, peer);
7996 }
7997 break;
7998 }
7999 }
8000
8001 if (type == show_peer && ! find)
8002 vty_out (vty, "%% No such neighbor%s", VTY_NEWLINE);
8003
8004 return CMD_SUCCESS;
8005}
8006
paul94f2b392005-06-28 12:44:16 +00008007static int
paulfd79ac92004-10-13 05:06:08 +00008008bgp_show_neighbor_vty (struct vty *vty, const char *name,
8009 enum show_type type, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00008010{
8011 int ret;
8012 struct bgp *bgp;
8013 union sockunion su;
8014
8015 if (ip_str)
8016 {
8017 ret = str2sockunion (ip_str, &su);
8018 if (ret < 0)
8019 {
8020 vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE);
8021 return CMD_WARNING;
8022 }
8023 }
8024
8025 if (name)
8026 {
8027 bgp = bgp_lookup_by_name (name);
8028
8029 if (! bgp)
8030 {
8031 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
8032 return CMD_WARNING;
8033 }
8034
8035 bgp_show_neighbor (vty, bgp, type, &su);
8036
8037 return CMD_SUCCESS;
8038 }
8039
8040 bgp = bgp_get_default ();
8041
8042 if (bgp)
8043 bgp_show_neighbor (vty, bgp, type, &su);
8044
8045 return CMD_SUCCESS;
8046}
8047
8048/* "show ip bgp neighbors" commands. */
8049DEFUN (show_ip_bgp_neighbors,
8050 show_ip_bgp_neighbors_cmd,
8051 "show ip bgp neighbors",
8052 SHOW_STR
8053 IP_STR
8054 BGP_STR
8055 "Detailed information on TCP and BGP neighbor connections\n")
8056{
8057 return bgp_show_neighbor_vty (vty, NULL, show_all, NULL);
8058}
8059
8060ALIAS (show_ip_bgp_neighbors,
8061 show_ip_bgp_ipv4_neighbors_cmd,
8062 "show ip bgp ipv4 (unicast|multicast) neighbors",
8063 SHOW_STR
8064 IP_STR
8065 BGP_STR
8066 "Address family\n"
8067 "Address Family modifier\n"
8068 "Address Family modifier\n"
8069 "Detailed information on TCP and BGP neighbor connections\n")
8070
8071ALIAS (show_ip_bgp_neighbors,
8072 show_ip_bgp_vpnv4_all_neighbors_cmd,
8073 "show ip bgp vpnv4 all neighbors",
8074 SHOW_STR
8075 IP_STR
8076 BGP_STR
8077 "Display VPNv4 NLRI specific information\n"
8078 "Display information about all VPNv4 NLRIs\n"
8079 "Detailed information on TCP and BGP neighbor connections\n")
8080
8081ALIAS (show_ip_bgp_neighbors,
8082 show_ip_bgp_vpnv4_rd_neighbors_cmd,
8083 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors",
8084 SHOW_STR
8085 IP_STR
8086 BGP_STR
8087 "Display VPNv4 NLRI specific information\n"
8088 "Display information for a route distinguisher\n"
8089 "VPN Route Distinguisher\n"
8090 "Detailed information on TCP and BGP neighbor connections\n")
8091
8092ALIAS (show_ip_bgp_neighbors,
8093 show_bgp_neighbors_cmd,
8094 "show bgp neighbors",
8095 SHOW_STR
8096 BGP_STR
8097 "Detailed information on TCP and BGP neighbor connections\n")
8098
8099ALIAS (show_ip_bgp_neighbors,
8100 show_bgp_ipv6_neighbors_cmd,
8101 "show bgp ipv6 neighbors",
8102 SHOW_STR
8103 BGP_STR
8104 "Address family\n"
8105 "Detailed information on TCP and BGP neighbor connections\n")
8106
8107DEFUN (show_ip_bgp_neighbors_peer,
8108 show_ip_bgp_neighbors_peer_cmd,
8109 "show ip bgp neighbors (A.B.C.D|X:X::X:X)",
8110 SHOW_STR
8111 IP_STR
8112 BGP_STR
8113 "Detailed information on TCP and BGP neighbor connections\n"
8114 "Neighbor to display information about\n"
8115 "Neighbor to display information about\n")
8116{
8117 return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 1]);
8118}
8119
8120ALIAS (show_ip_bgp_neighbors_peer,
8121 show_ip_bgp_ipv4_neighbors_peer_cmd,
8122 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X)",
8123 SHOW_STR
8124 IP_STR
8125 BGP_STR
8126 "Address family\n"
8127 "Address Family modifier\n"
8128 "Address Family modifier\n"
8129 "Detailed information on TCP and BGP neighbor connections\n"
8130 "Neighbor to display information about\n"
8131 "Neighbor to display information about\n")
8132
8133ALIAS (show_ip_bgp_neighbors_peer,
8134 show_ip_bgp_vpnv4_all_neighbors_peer_cmd,
8135 "show ip bgp vpnv4 all neighbors A.B.C.D",
8136 SHOW_STR
8137 IP_STR
8138 BGP_STR
8139 "Display VPNv4 NLRI specific information\n"
8140 "Display information about all VPNv4 NLRIs\n"
8141 "Detailed information on TCP and BGP neighbor connections\n"
8142 "Neighbor to display information about\n")
8143
8144ALIAS (show_ip_bgp_neighbors_peer,
8145 show_ip_bgp_vpnv4_rd_neighbors_peer_cmd,
8146 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D",
8147 SHOW_STR
8148 IP_STR
8149 BGP_STR
8150 "Display VPNv4 NLRI specific information\n"
8151 "Display information about all VPNv4 NLRIs\n"
8152 "Detailed information on TCP and BGP neighbor connections\n"
8153 "Neighbor to display information about\n")
8154
8155ALIAS (show_ip_bgp_neighbors_peer,
8156 show_bgp_neighbors_peer_cmd,
8157 "show bgp neighbors (A.B.C.D|X:X::X:X)",
8158 SHOW_STR
8159 BGP_STR
8160 "Detailed information on TCP and BGP neighbor connections\n"
8161 "Neighbor to display information about\n"
8162 "Neighbor to display information about\n")
8163
8164ALIAS (show_ip_bgp_neighbors_peer,
8165 show_bgp_ipv6_neighbors_peer_cmd,
8166 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X)",
8167 SHOW_STR
8168 BGP_STR
8169 "Address family\n"
8170 "Detailed information on TCP and BGP neighbor connections\n"
8171 "Neighbor to display information about\n"
8172 "Neighbor to display information about\n")
8173
8174DEFUN (show_ip_bgp_instance_neighbors,
8175 show_ip_bgp_instance_neighbors_cmd,
8176 "show ip bgp view WORD neighbors",
8177 SHOW_STR
8178 IP_STR
8179 BGP_STR
8180 "BGP view\n"
8181 "View name\n"
8182 "Detailed information on TCP and BGP neighbor connections\n")
8183{
8184 return bgp_show_neighbor_vty (vty, argv[0], show_all, NULL);
8185}
8186
paulbb46e942003-10-24 19:02:03 +00008187ALIAS (show_ip_bgp_instance_neighbors,
8188 show_bgp_instance_neighbors_cmd,
8189 "show bgp view WORD neighbors",
8190 SHOW_STR
8191 BGP_STR
8192 "BGP view\n"
8193 "View name\n"
8194 "Detailed information on TCP and BGP neighbor connections\n")
8195
8196ALIAS (show_ip_bgp_instance_neighbors,
8197 show_bgp_instance_ipv6_neighbors_cmd,
8198 "show bgp view WORD ipv6 neighbors",
8199 SHOW_STR
8200 BGP_STR
8201 "BGP view\n"
8202 "View name\n"
8203 "Address family\n"
8204 "Detailed information on TCP and BGP neighbor connections\n")
8205
paul718e3742002-12-13 20:15:29 +00008206DEFUN (show_ip_bgp_instance_neighbors_peer,
8207 show_ip_bgp_instance_neighbors_peer_cmd,
8208 "show ip bgp view WORD neighbors (A.B.C.D|X:X::X:X)",
8209 SHOW_STR
8210 IP_STR
8211 BGP_STR
8212 "BGP view\n"
8213 "View name\n"
8214 "Detailed information on TCP and BGP neighbor connections\n"
8215 "Neighbor to display information about\n"
8216 "Neighbor to display information about\n")
8217{
8218 return bgp_show_neighbor_vty (vty, argv[0], show_peer, argv[1]);
8219}
paulbb46e942003-10-24 19:02:03 +00008220
8221ALIAS (show_ip_bgp_instance_neighbors_peer,
8222 show_bgp_instance_neighbors_peer_cmd,
8223 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X)",
8224 SHOW_STR
8225 BGP_STR
8226 "BGP view\n"
8227 "View name\n"
8228 "Detailed information on TCP and BGP neighbor connections\n"
8229 "Neighbor to display information about\n"
8230 "Neighbor to display information about\n")
8231
8232ALIAS (show_ip_bgp_instance_neighbors_peer,
8233 show_bgp_instance_ipv6_neighbors_peer_cmd,
8234 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X)",
8235 SHOW_STR
8236 BGP_STR
8237 "BGP view\n"
8238 "View name\n"
8239 "Address family\n"
8240 "Detailed information on TCP and BGP neighbor connections\n"
8241 "Neighbor to display information about\n"
8242 "Neighbor to display information about\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02008243
paul718e3742002-12-13 20:15:29 +00008244/* Show BGP's AS paths internal data. There are both `show ip bgp
8245 paths' and `show ip mbgp paths'. Those functions results are the
8246 same.*/
8247DEFUN (show_ip_bgp_paths,
8248 show_ip_bgp_paths_cmd,
8249 "show ip bgp paths",
8250 SHOW_STR
8251 IP_STR
8252 BGP_STR
8253 "Path information\n")
8254{
8255 vty_out (vty, "Address Refcnt Path%s", VTY_NEWLINE);
8256 aspath_print_all_vty (vty);
8257 return CMD_SUCCESS;
8258}
8259
8260DEFUN (show_ip_bgp_ipv4_paths,
8261 show_ip_bgp_ipv4_paths_cmd,
8262 "show ip bgp ipv4 (unicast|multicast) paths",
8263 SHOW_STR
8264 IP_STR
8265 BGP_STR
8266 "Address family\n"
8267 "Address Family modifier\n"
8268 "Address Family modifier\n"
8269 "Path information\n")
8270{
8271 vty_out (vty, "Address Refcnt Path\r\n");
8272 aspath_print_all_vty (vty);
8273
8274 return CMD_SUCCESS;
8275}
David Lamparter6b0655a2014-06-04 06:53:35 +02008276
paul718e3742002-12-13 20:15:29 +00008277#include "hash.h"
8278
paul94f2b392005-06-28 12:44:16 +00008279static void
paul718e3742002-12-13 20:15:29 +00008280community_show_all_iterator (struct hash_backet *backet, struct vty *vty)
8281{
8282 struct community *com;
8283
8284 com = (struct community *) backet->data;
David Lampartereed3c482015-03-03 08:51:53 +01008285 vty_out (vty, "[%p] (%ld) %s%s", (void *)backet, com->refcnt,
paul718e3742002-12-13 20:15:29 +00008286 community_str (com), VTY_NEWLINE);
8287}
8288
8289/* Show BGP's community internal data. */
8290DEFUN (show_ip_bgp_community_info,
8291 show_ip_bgp_community_info_cmd,
8292 "show ip bgp community-info",
8293 SHOW_STR
8294 IP_STR
8295 BGP_STR
8296 "List all bgp community information\n")
8297{
8298 vty_out (vty, "Address Refcnt Community%s", VTY_NEWLINE);
8299
8300 hash_iterate (community_hash (),
8301 (void (*) (struct hash_backet *, void *))
8302 community_show_all_iterator,
8303 vty);
8304
8305 return CMD_SUCCESS;
8306}
8307
8308DEFUN (show_ip_bgp_attr_info,
8309 show_ip_bgp_attr_info_cmd,
8310 "show ip bgp attribute-info",
8311 SHOW_STR
8312 IP_STR
8313 BGP_STR
8314 "List all bgp attribute information\n")
8315{
8316 attr_show_all (vty);
8317 return CMD_SUCCESS;
8318}
David Lamparter6b0655a2014-06-04 06:53:35 +02008319
paul94f2b392005-06-28 12:44:16 +00008320static int
paulfee0f4c2004-09-13 05:12:46 +00008321bgp_write_rsclient_summary (struct vty *vty, struct peer *rsclient,
8322 afi_t afi, safi_t safi)
8323{
8324 char timebuf[BGP_UPTIME_LEN];
8325 char rmbuf[14];
paulfd79ac92004-10-13 05:06:08 +00008326 const char *rmname;
paulfee0f4c2004-09-13 05:12:46 +00008327 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00008328 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00008329 int len;
8330 int count = 0;
8331
8332 if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_GROUP))
8333 {
paul1eb8ef22005-04-07 07:30:20 +00008334 for (ALL_LIST_ELEMENTS (rsclient->group->peer, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00008335 {
8336 count++;
8337 bgp_write_rsclient_summary (vty, peer, afi, safi);
8338 }
8339 return count;
8340 }
8341
8342 len = vty_out (vty, "%s", rsclient->host);
8343 len = 16 - len;
8344
8345 if (len < 1)
8346 vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " ");
8347 else
8348 vty_out (vty, "%*s", len, " ");
8349
hasso3d515fd2005-02-01 21:30:04 +00008350 vty_out (vty, "4 ");
paulfee0f4c2004-09-13 05:12:46 +00008351
Milan Kociancb4fc592014-12-01 12:48:25 +00008352 vty_out (vty, "%10u ", rsclient->as);
paulfee0f4c2004-09-13 05:12:46 +00008353
8354 rmname = ROUTE_MAP_EXPORT_NAME(&rsclient->filter[afi][safi]);
8355 if ( rmname && strlen (rmname) > 13 )
8356 {
8357 sprintf (rmbuf, "%13s", "...");
8358 rmname = strncpy (rmbuf, rmname, 10);
8359 }
8360 else if (! rmname)
8361 rmname = "<none>";
8362 vty_out (vty, " %13s ", rmname);
8363
8364 rmname = ROUTE_MAP_IMPORT_NAME(&rsclient->filter[afi][safi]);
8365 if ( rmname && strlen (rmname) > 13 )
8366 {
8367 sprintf (rmbuf, "%13s", "...");
8368 rmname = strncpy (rmbuf, rmname, 10);
8369 }
8370 else if (! rmname)
8371 rmname = "<none>";
8372 vty_out (vty, " %13s ", rmname);
8373
8374 vty_out (vty, "%8s", peer_uptime (rsclient->uptime, timebuf, BGP_UPTIME_LEN));
8375
8376 if (CHECK_FLAG (rsclient->flags, PEER_FLAG_SHUTDOWN))
8377 vty_out (vty, " Idle (Admin)");
8378 else if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_PREFIX_OVERFLOW))
8379 vty_out (vty, " Idle (PfxCt)");
8380 else
8381 vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, rsclient->status));
8382
8383 vty_out (vty, "%s", VTY_NEWLINE);
8384
8385 return 1;
8386}
8387
paul94f2b392005-06-28 12:44:16 +00008388static int
paulfd79ac92004-10-13 05:06:08 +00008389bgp_show_rsclient_summary (struct vty *vty, struct bgp *bgp,
8390 afi_t afi, safi_t safi)
paulfee0f4c2004-09-13 05:12:46 +00008391{
8392 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00008393 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00008394 int count = 0;
8395
8396 /* Header string for each address family. */
Milan Kociancb4fc592014-12-01 12:48:25 +00008397 static char header[] = "Neighbor V AS Export-Policy Import-Policy Up/Down State";
paulfee0f4c2004-09-13 05:12:46 +00008398
paul1eb8ef22005-04-07 07:30:20 +00008399 for (ALL_LIST_ELEMENTS (bgp->rsclient, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00008400 {
8401 if (peer->afc[afi][safi] &&
8402 CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT))
8403 {
8404 if (! count)
8405 {
8406 vty_out (vty,
8407 "Route Server's BGP router identifier %s%s",
8408 inet_ntoa (bgp->router_id), VTY_NEWLINE);
8409 vty_out (vty,
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04008410 "Route Server's local AS number %u%s", bgp->as,
paulfee0f4c2004-09-13 05:12:46 +00008411 VTY_NEWLINE);
8412
8413 vty_out (vty, "%s", VTY_NEWLINE);
8414 vty_out (vty, "%s%s", header, VTY_NEWLINE);
8415 }
8416
8417 count += bgp_write_rsclient_summary (vty, peer, afi, safi);
8418 }
8419 }
8420
8421 if (count)
8422 vty_out (vty, "%sTotal number of Route Server Clients %d%s", VTY_NEWLINE,
8423 count, VTY_NEWLINE);
8424 else
8425 vty_out (vty, "No %s Route Server Client is configured%s",
8426 afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE);
8427
8428 return CMD_SUCCESS;
8429}
8430
paul94f2b392005-06-28 12:44:16 +00008431static int
paulfd79ac92004-10-13 05:06:08 +00008432bgp_show_rsclient_summary_vty (struct vty *vty, const char *name,
8433 afi_t afi, safi_t safi)
paulfee0f4c2004-09-13 05:12:46 +00008434{
8435 struct bgp *bgp;
8436
8437 if (name)
8438 {
8439 bgp = bgp_lookup_by_name (name);
8440
8441 if (! bgp)
8442 {
8443 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
8444 return CMD_WARNING;
8445 }
8446
8447 bgp_show_rsclient_summary (vty, bgp, afi, safi);
8448 return CMD_SUCCESS;
8449 }
8450
8451 bgp = bgp_get_default ();
8452
8453 if (bgp)
8454 bgp_show_rsclient_summary (vty, bgp, afi, safi);
8455
8456 return CMD_SUCCESS;
8457}
8458
8459/* 'show bgp rsclient' commands. */
8460DEFUN (show_ip_bgp_rsclient_summary,
8461 show_ip_bgp_rsclient_summary_cmd,
8462 "show ip bgp rsclient summary",
8463 SHOW_STR
8464 IP_STR
8465 BGP_STR
8466 "Information about Route Server Clients\n"
8467 "Summary of all Route Server Clients\n")
8468{
8469 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
8470}
8471
8472DEFUN (show_ip_bgp_instance_rsclient_summary,
8473 show_ip_bgp_instance_rsclient_summary_cmd,
8474 "show ip bgp view WORD rsclient summary",
8475 SHOW_STR
8476 IP_STR
8477 BGP_STR
8478 "BGP view\n"
8479 "View name\n"
8480 "Information about Route Server Clients\n"
8481 "Summary of all Route Server Clients\n")
8482{
8483 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
8484}
8485
8486DEFUN (show_ip_bgp_ipv4_rsclient_summary,
8487 show_ip_bgp_ipv4_rsclient_summary_cmd,
8488 "show ip bgp ipv4 (unicast|multicast) rsclient summary",
8489 SHOW_STR
8490 IP_STR
8491 BGP_STR
8492 "Address family\n"
8493 "Address Family modifier\n"
8494 "Address Family modifier\n"
8495 "Information about Route Server Clients\n"
8496 "Summary of all Route Server Clients\n")
8497{
8498 if (strncmp (argv[0], "m", 1) == 0)
8499 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
8500
8501 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
8502}
8503
8504DEFUN (show_ip_bgp_instance_ipv4_rsclient_summary,
8505 show_ip_bgp_instance_ipv4_rsclient_summary_cmd,
8506 "show ip bgp view WORD ipv4 (unicast|multicast) rsclient summary",
8507 SHOW_STR
8508 IP_STR
8509 BGP_STR
8510 "BGP view\n"
8511 "View name\n"
8512 "Address family\n"
8513 "Address Family modifier\n"
8514 "Address Family modifier\n"
8515 "Information about Route Server Clients\n"
8516 "Summary of all Route Server Clients\n")
8517{
8518 if (strncmp (argv[1], "m", 1) == 0)
8519 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
8520
8521 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
8522}
8523
Michael Lambert95cbbd22010-07-23 14:43:04 -04008524DEFUN (show_bgp_instance_ipv4_safi_rsclient_summary,
8525 show_bgp_instance_ipv4_safi_rsclient_summary_cmd,
8526 "show bgp view WORD ipv4 (unicast|multicast) rsclient summary",
8527 SHOW_STR
8528 BGP_STR
8529 "BGP view\n"
8530 "View name\n"
8531 "Address family\n"
8532 "Address Family modifier\n"
8533 "Address Family modifier\n"
8534 "Information about Route Server Clients\n"
8535 "Summary of all Route Server Clients\n")
8536{
8537 safi_t safi;
8538
8539 if (argc == 2) {
8540 safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
8541 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, safi);
8542 } else {
8543 safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
8544 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, safi);
8545 }
8546}
8547
8548ALIAS (show_bgp_instance_ipv4_safi_rsclient_summary,
8549 show_bgp_ipv4_safi_rsclient_summary_cmd,
8550 "show bgp ipv4 (unicast|multicast) rsclient summary",
8551 SHOW_STR
8552 BGP_STR
8553 "Address family\n"
8554 "Address Family modifier\n"
8555 "Address Family modifier\n"
8556 "Information about Route Server Clients\n"
8557 "Summary of all Route Server Clients\n")
8558
paulfee0f4c2004-09-13 05:12:46 +00008559#ifdef HAVE_IPV6
8560DEFUN (show_bgp_rsclient_summary,
8561 show_bgp_rsclient_summary_cmd,
8562 "show bgp rsclient summary",
8563 SHOW_STR
8564 BGP_STR
8565 "Information about Route Server Clients\n"
8566 "Summary of all Route Server Clients\n")
8567{
8568 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
8569}
8570
8571DEFUN (show_bgp_instance_rsclient_summary,
8572 show_bgp_instance_rsclient_summary_cmd,
8573 "show bgp view WORD rsclient summary",
8574 SHOW_STR
8575 BGP_STR
8576 "BGP view\n"
8577 "View name\n"
8578 "Information about Route Server Clients\n"
8579 "Summary of all Route Server Clients\n")
8580{
8581 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
8582}
8583
8584ALIAS (show_bgp_rsclient_summary,
8585 show_bgp_ipv6_rsclient_summary_cmd,
8586 "show bgp ipv6 rsclient summary",
8587 SHOW_STR
8588 BGP_STR
8589 "Address family\n"
8590 "Information about Route Server Clients\n"
8591 "Summary of all Route Server Clients\n")
8592
8593ALIAS (show_bgp_instance_rsclient_summary,
8594 show_bgp_instance_ipv6_rsclient_summary_cmd,
8595 "show bgp view WORD ipv6 rsclient summary",
8596 SHOW_STR
8597 BGP_STR
8598 "BGP view\n"
8599 "View name\n"
8600 "Address family\n"
8601 "Information about Route Server Clients\n"
8602 "Summary of all Route Server Clients\n")
Michael Lambert95cbbd22010-07-23 14:43:04 -04008603
8604DEFUN (show_bgp_instance_ipv6_safi_rsclient_summary,
8605 show_bgp_instance_ipv6_safi_rsclient_summary_cmd,
8606 "show bgp view WORD ipv6 (unicast|multicast) rsclient summary",
8607 SHOW_STR
8608 BGP_STR
8609 "BGP view\n"
8610 "View name\n"
8611 "Address family\n"
8612 "Address Family modifier\n"
8613 "Address Family modifier\n"
8614 "Information about Route Server Clients\n"
8615 "Summary of all Route Server Clients\n")
8616{
8617 safi_t safi;
8618
8619 if (argc == 2) {
8620 safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
8621 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, safi);
8622 } else {
8623 safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
8624 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, safi);
8625 }
8626}
8627
8628ALIAS (show_bgp_instance_ipv6_safi_rsclient_summary,
8629 show_bgp_ipv6_safi_rsclient_summary_cmd,
8630 "show bgp ipv6 (unicast|multicast) rsclient summary",
8631 SHOW_STR
8632 BGP_STR
8633 "Address family\n"
8634 "Address Family modifier\n"
8635 "Address Family modifier\n"
8636 "Information about Route Server Clients\n"
8637 "Summary of all Route Server Clients\n")
8638
paulfee0f4c2004-09-13 05:12:46 +00008639#endif /* HAVE IPV6 */
David Lamparter6b0655a2014-06-04 06:53:35 +02008640
paul718e3742002-12-13 20:15:29 +00008641/* Redistribute VTY commands. */
8642
paul718e3742002-12-13 20:15:29 +00008643DEFUN (bgp_redistribute_ipv4,
8644 bgp_redistribute_ipv4_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008645 "redistribute " QUAGGA_IP_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00008646 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008647 QUAGGA_IP_REDIST_HELP_STR_BGPD)
paul718e3742002-12-13 20:15:29 +00008648{
8649 int type;
8650
David Lampartere0ca5fd2009-09-16 01:52:42 +02008651 type = proto_redistnum (AFI_IP, argv[0]);
8652 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008653 {
8654 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8655 return CMD_WARNING;
8656 }
8657 return bgp_redistribute_set (vty->index, AFI_IP, type);
8658}
8659
8660DEFUN (bgp_redistribute_ipv4_rmap,
8661 bgp_redistribute_ipv4_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008662 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00008663 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008664 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008665 "Route map reference\n"
8666 "Pointer to route-map entries\n")
8667{
8668 int type;
8669
David Lampartere0ca5fd2009-09-16 01:52:42 +02008670 type = proto_redistnum (AFI_IP, argv[0]);
8671 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008672 {
8673 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8674 return CMD_WARNING;
8675 }
8676
8677 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]);
8678 return bgp_redistribute_set (vty->index, AFI_IP, type);
8679}
8680
8681DEFUN (bgp_redistribute_ipv4_metric,
8682 bgp_redistribute_ipv4_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008683 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00008684 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008685 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008686 "Metric for redistributed routes\n"
8687 "Default metric\n")
8688{
8689 int type;
8690 u_int32_t metric;
8691
David Lampartere0ca5fd2009-09-16 01:52:42 +02008692 type = proto_redistnum (AFI_IP, argv[0]);
8693 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008694 {
8695 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8696 return CMD_WARNING;
8697 }
8698 VTY_GET_INTEGER ("metric", metric, argv[1]);
8699
8700 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
8701 return bgp_redistribute_set (vty->index, AFI_IP, type);
8702}
8703
8704DEFUN (bgp_redistribute_ipv4_rmap_metric,
8705 bgp_redistribute_ipv4_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008706 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00008707 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008708 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008709 "Route map reference\n"
8710 "Pointer to route-map entries\n"
8711 "Metric for redistributed routes\n"
8712 "Default metric\n")
8713{
8714 int type;
8715 u_int32_t metric;
8716
David Lampartere0ca5fd2009-09-16 01:52:42 +02008717 type = proto_redistnum (AFI_IP, argv[0]);
8718 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008719 {
8720 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8721 return CMD_WARNING;
8722 }
8723 VTY_GET_INTEGER ("metric", metric, argv[2]);
8724
8725 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]);
8726 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
8727 return bgp_redistribute_set (vty->index, AFI_IP, type);
8728}
8729
8730DEFUN (bgp_redistribute_ipv4_metric_rmap,
8731 bgp_redistribute_ipv4_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008732 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00008733 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008734 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008735 "Metric for redistributed routes\n"
8736 "Default metric\n"
8737 "Route map reference\n"
8738 "Pointer to route-map entries\n")
8739{
8740 int type;
8741 u_int32_t metric;
8742
David Lampartere0ca5fd2009-09-16 01:52:42 +02008743 type = proto_redistnum (AFI_IP, argv[0]);
8744 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008745 {
8746 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8747 return CMD_WARNING;
8748 }
8749 VTY_GET_INTEGER ("metric", metric, argv[1]);
8750
8751 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
8752 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[2]);
8753 return bgp_redistribute_set (vty->index, AFI_IP, type);
8754}
8755
8756DEFUN (no_bgp_redistribute_ipv4,
8757 no_bgp_redistribute_ipv4_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008758 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00008759 NO_STR
8760 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008761 QUAGGA_IP_REDIST_HELP_STR_BGPD)
paul718e3742002-12-13 20:15:29 +00008762{
8763 int type;
8764
David Lampartere0ca5fd2009-09-16 01:52:42 +02008765 type = proto_redistnum (AFI_IP, argv[0]);
8766 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008767 {
8768 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8769 return CMD_WARNING;
8770 }
8771
8772 return bgp_redistribute_unset (vty->index, AFI_IP, type);
8773}
8774
8775DEFUN (no_bgp_redistribute_ipv4_rmap,
8776 no_bgp_redistribute_ipv4_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008777 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00008778 NO_STR
8779 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008780 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008781 "Route map reference\n"
8782 "Pointer to route-map entries\n")
8783{
8784 int type;
8785
David Lampartere0ca5fd2009-09-16 01:52:42 +02008786 type = proto_redistnum (AFI_IP, argv[0]);
8787 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008788 {
8789 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8790 return CMD_WARNING;
8791 }
8792
8793 bgp_redistribute_routemap_unset (vty->index, AFI_IP, type);
8794 return CMD_SUCCESS;
8795}
8796
8797DEFUN (no_bgp_redistribute_ipv4_metric,
8798 no_bgp_redistribute_ipv4_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008799 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00008800 NO_STR
8801 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008802 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008803 "Metric for redistributed routes\n"
8804 "Default metric\n")
8805{
8806 int type;
8807
David Lampartere0ca5fd2009-09-16 01:52:42 +02008808 type = proto_redistnum (AFI_IP, argv[0]);
8809 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008810 {
8811 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8812 return CMD_WARNING;
8813 }
8814
8815 bgp_redistribute_metric_unset (vty->index, AFI_IP, type);
8816 return CMD_SUCCESS;
8817}
8818
8819DEFUN (no_bgp_redistribute_ipv4_rmap_metric,
8820 no_bgp_redistribute_ipv4_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008821 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00008822 NO_STR
8823 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008824 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008825 "Route map reference\n"
8826 "Pointer to route-map entries\n"
8827 "Metric for redistributed routes\n"
8828 "Default metric\n")
8829{
8830 int type;
8831
David Lampartere0ca5fd2009-09-16 01:52:42 +02008832 type = proto_redistnum (AFI_IP, argv[0]);
8833 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008834 {
8835 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8836 return CMD_WARNING;
8837 }
8838
8839 bgp_redistribute_metric_unset (vty->index, AFI_IP, type);
8840 bgp_redistribute_routemap_unset (vty->index, AFI_IP, type);
8841 return CMD_SUCCESS;
8842}
8843
8844ALIAS (no_bgp_redistribute_ipv4_rmap_metric,
8845 no_bgp_redistribute_ipv4_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008846 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00008847 NO_STR
8848 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008849 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008850 "Metric for redistributed routes\n"
8851 "Default metric\n"
8852 "Route map reference\n"
8853 "Pointer to route-map entries\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02008854
paul718e3742002-12-13 20:15:29 +00008855#ifdef HAVE_IPV6
8856DEFUN (bgp_redistribute_ipv6,
8857 bgp_redistribute_ipv6_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008858 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00008859 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008860 QUAGGA_IP6_REDIST_HELP_STR_BGPD)
paul718e3742002-12-13 20:15:29 +00008861{
8862 int type;
8863
David Lampartere0ca5fd2009-09-16 01:52:42 +02008864 type = proto_redistnum (AFI_IP6, argv[0]);
8865 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008866 {
8867 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8868 return CMD_WARNING;
8869 }
8870
8871 return bgp_redistribute_set (vty->index, AFI_IP6, type);
8872}
8873
8874DEFUN (bgp_redistribute_ipv6_rmap,
8875 bgp_redistribute_ipv6_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008876 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00008877 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008878 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008879 "Route map reference\n"
8880 "Pointer to route-map entries\n")
8881{
8882 int type;
8883
David Lampartere0ca5fd2009-09-16 01:52:42 +02008884 type = proto_redistnum (AFI_IP6, argv[0]);
8885 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008886 {
8887 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8888 return CMD_WARNING;
8889 }
8890
8891 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]);
8892 return bgp_redistribute_set (vty->index, AFI_IP6, type);
8893}
8894
8895DEFUN (bgp_redistribute_ipv6_metric,
8896 bgp_redistribute_ipv6_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008897 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00008898 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008899 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008900 "Metric for redistributed routes\n"
8901 "Default metric\n")
8902{
8903 int type;
8904 u_int32_t metric;
8905
David Lampartere0ca5fd2009-09-16 01:52:42 +02008906 type = proto_redistnum (AFI_IP6, argv[0]);
8907 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008908 {
8909 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8910 return CMD_WARNING;
8911 }
8912 VTY_GET_INTEGER ("metric", metric, argv[1]);
8913
8914 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
8915 return bgp_redistribute_set (vty->index, AFI_IP6, type);
8916}
8917
8918DEFUN (bgp_redistribute_ipv6_rmap_metric,
8919 bgp_redistribute_ipv6_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008920 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00008921 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008922 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008923 "Route map reference\n"
8924 "Pointer to route-map entries\n"
8925 "Metric for redistributed routes\n"
8926 "Default metric\n")
8927{
8928 int type;
8929 u_int32_t metric;
8930
David Lampartere0ca5fd2009-09-16 01:52:42 +02008931 type = proto_redistnum (AFI_IP6, argv[0]);
8932 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008933 {
8934 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8935 return CMD_WARNING;
8936 }
8937 VTY_GET_INTEGER ("metric", metric, argv[2]);
8938
8939 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]);
8940 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
8941 return bgp_redistribute_set (vty->index, AFI_IP6, type);
8942}
8943
8944DEFUN (bgp_redistribute_ipv6_metric_rmap,
8945 bgp_redistribute_ipv6_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008946 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00008947 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008948 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008949 "Metric for redistributed routes\n"
8950 "Default metric\n"
8951 "Route map reference\n"
8952 "Pointer to route-map entries\n")
8953{
8954 int type;
8955 u_int32_t metric;
8956
David Lampartere0ca5fd2009-09-16 01:52:42 +02008957 type = proto_redistnum (AFI_IP6, argv[0]);
8958 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008959 {
8960 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8961 return CMD_WARNING;
8962 }
8963 VTY_GET_INTEGER ("metric", metric, argv[1]);
8964
8965 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
8966 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[2]);
8967 return bgp_redistribute_set (vty->index, AFI_IP6, type);
8968}
8969
8970DEFUN (no_bgp_redistribute_ipv6,
8971 no_bgp_redistribute_ipv6_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008972 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00008973 NO_STR
8974 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008975 QUAGGA_IP6_REDIST_HELP_STR_BGPD)
paul718e3742002-12-13 20:15:29 +00008976{
8977 int type;
8978
David Lampartere0ca5fd2009-09-16 01:52:42 +02008979 type = proto_redistnum (AFI_IP6, argv[0]);
8980 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008981 {
8982 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8983 return CMD_WARNING;
8984 }
8985
8986 return bgp_redistribute_unset (vty->index, AFI_IP6, type);
8987}
8988
8989DEFUN (no_bgp_redistribute_ipv6_rmap,
8990 no_bgp_redistribute_ipv6_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008991 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00008992 NO_STR
8993 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008994 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008995 "Route map reference\n"
8996 "Pointer to route-map entries\n")
8997{
8998 int type;
8999
David Lampartere0ca5fd2009-09-16 01:52:42 +02009000 type = proto_redistnum (AFI_IP6, argv[0]);
9001 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009002 {
9003 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9004 return CMD_WARNING;
9005 }
9006
9007 bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type);
9008 return CMD_SUCCESS;
9009}
9010
9011DEFUN (no_bgp_redistribute_ipv6_metric,
9012 no_bgp_redistribute_ipv6_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009013 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009014 NO_STR
9015 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009016 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009017 "Metric for redistributed routes\n"
9018 "Default metric\n")
9019{
9020 int type;
9021
David Lampartere0ca5fd2009-09-16 01:52:42 +02009022 type = proto_redistnum (AFI_IP6, argv[0]);
9023 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009024 {
9025 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9026 return CMD_WARNING;
9027 }
9028
9029 bgp_redistribute_metric_unset (vty->index, AFI_IP6, type);
9030 return CMD_SUCCESS;
9031}
9032
9033DEFUN (no_bgp_redistribute_ipv6_rmap_metric,
9034 no_bgp_redistribute_ipv6_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009035 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009036 NO_STR
9037 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009038 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009039 "Route map reference\n"
9040 "Pointer to route-map entries\n"
9041 "Metric for redistributed routes\n"
9042 "Default metric\n")
9043{
9044 int type;
9045
David Lampartere0ca5fd2009-09-16 01:52:42 +02009046 type = proto_redistnum (AFI_IP6, argv[0]);
9047 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009048 {
9049 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9050 return CMD_WARNING;
9051 }
9052
9053 bgp_redistribute_metric_unset (vty->index, AFI_IP6, type);
9054 bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type);
9055 return CMD_SUCCESS;
9056}
9057
9058ALIAS (no_bgp_redistribute_ipv6_rmap_metric,
9059 no_bgp_redistribute_ipv6_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009060 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00009061 NO_STR
9062 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009063 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009064 "Metric for redistributed routes\n"
9065 "Default metric\n"
9066 "Route map reference\n"
9067 "Pointer to route-map entries\n")
9068#endif /* HAVE_IPV6 */
David Lamparter6b0655a2014-06-04 06:53:35 +02009069
paul718e3742002-12-13 20:15:29 +00009070int
9071bgp_config_write_redistribute (struct vty *vty, struct bgp *bgp, afi_t afi,
9072 safi_t safi, int *write)
9073{
9074 int i;
paul718e3742002-12-13 20:15:29 +00009075
9076 /* Unicast redistribution only. */
9077 if (safi != SAFI_UNICAST)
9078 return 0;
9079
9080 for (i = 0; i < ZEBRA_ROUTE_MAX; i++)
9081 {
9082 /* Redistribute BGP does not make sense. */
9083 if (bgp->redist[afi][i] && i != ZEBRA_ROUTE_BGP)
9084 {
9085 /* Display "address-family" when it is not yet diplayed. */
9086 bgp_config_write_family_header (vty, afi, safi, write);
9087
9088 /* "redistribute" configuration. */
ajsf52d13c2005-10-01 17:38:06 +00009089 vty_out (vty, " redistribute %s", zebra_route_string(i));
paul718e3742002-12-13 20:15:29 +00009090
9091 if (bgp->redist_metric_flag[afi][i])
Jorge Boncompte [DTI2]ddc943d2012-04-13 13:46:07 +02009092 vty_out (vty, " metric %u", bgp->redist_metric[afi][i]);
paul718e3742002-12-13 20:15:29 +00009093
9094 if (bgp->rmap[afi][i].name)
9095 vty_out (vty, " route-map %s", bgp->rmap[afi][i].name);
9096
9097 vty_out (vty, "%s", VTY_NEWLINE);
9098 }
9099 }
9100 return *write;
9101}
David Lamparter6b0655a2014-06-04 06:53:35 +02009102
paul718e3742002-12-13 20:15:29 +00009103/* BGP node structure. */
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009104static struct cmd_node bgp_node =
paul718e3742002-12-13 20:15:29 +00009105{
9106 BGP_NODE,
9107 "%s(config-router)# ",
9108 1,
9109};
9110
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009111static struct cmd_node bgp_ipv4_unicast_node =
paul718e3742002-12-13 20:15:29 +00009112{
9113 BGP_IPV4_NODE,
9114 "%s(config-router-af)# ",
9115 1,
9116};
9117
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009118static struct cmd_node bgp_ipv4_multicast_node =
paul718e3742002-12-13 20:15:29 +00009119{
9120 BGP_IPV4M_NODE,
9121 "%s(config-router-af)# ",
9122 1,
9123};
9124
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009125static struct cmd_node bgp_ipv6_unicast_node =
paul718e3742002-12-13 20:15:29 +00009126{
9127 BGP_IPV6_NODE,
9128 "%s(config-router-af)# ",
9129 1,
9130};
9131
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009132static struct cmd_node bgp_ipv6_multicast_node =
paul25ffbdc2005-08-22 22:42:08 +00009133{
9134 BGP_IPV6M_NODE,
9135 "%s(config-router-af)# ",
9136 1,
9137};
9138
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009139static struct cmd_node bgp_vpnv4_node =
paul718e3742002-12-13 20:15:29 +00009140{
9141 BGP_VPNV4_NODE,
9142 "%s(config-router-af)# ",
9143 1
9144};
David Lamparter6b0655a2014-06-04 06:53:35 +02009145
Lou Berger13c378d2016-01-12 13:41:56 -05009146static struct cmd_node bgp_vpnv6_node =
9147{
9148 BGP_VPNV6_NODE,
9149 "%s(config-router-af-vpnv6)# ",
9150 1
9151};
9152
paul1f8ae702005-09-09 23:49:49 +00009153static void community_list_vty (void);
9154
paul718e3742002-12-13 20:15:29 +00009155void
paul94f2b392005-06-28 12:44:16 +00009156bgp_vty_init (void)
paul718e3742002-12-13 20:15:29 +00009157{
paul718e3742002-12-13 20:15:29 +00009158 /* Install bgp top node. */
9159 install_node (&bgp_node, bgp_config_write);
9160 install_node (&bgp_ipv4_unicast_node, NULL);
9161 install_node (&bgp_ipv4_multicast_node, NULL);
9162 install_node (&bgp_ipv6_unicast_node, NULL);
paul25ffbdc2005-08-22 22:42:08 +00009163 install_node (&bgp_ipv6_multicast_node, NULL);
paul718e3742002-12-13 20:15:29 +00009164 install_node (&bgp_vpnv4_node, NULL);
Lou Berger13c378d2016-01-12 13:41:56 -05009165 install_node (&bgp_vpnv6_node, NULL);
paul718e3742002-12-13 20:15:29 +00009166
9167 /* Install default VTY commands to new nodes. */
9168 install_default (BGP_NODE);
9169 install_default (BGP_IPV4_NODE);
9170 install_default (BGP_IPV4M_NODE);
9171 install_default (BGP_IPV6_NODE);
paul25ffbdc2005-08-22 22:42:08 +00009172 install_default (BGP_IPV6M_NODE);
paul718e3742002-12-13 20:15:29 +00009173 install_default (BGP_VPNV4_NODE);
Lou Berger13c378d2016-01-12 13:41:56 -05009174 install_default (BGP_VPNV6_NODE);
paul718e3742002-12-13 20:15:29 +00009175
9176 /* "bgp multiple-instance" commands. */
9177 install_element (CONFIG_NODE, &bgp_multiple_instance_cmd);
9178 install_element (CONFIG_NODE, &no_bgp_multiple_instance_cmd);
9179
9180 /* "bgp config-type" commands. */
9181 install_element (CONFIG_NODE, &bgp_config_type_cmd);
9182 install_element (CONFIG_NODE, &no_bgp_config_type_cmd);
9183
9184 /* Dummy commands (Currently not supported) */
9185 install_element (BGP_NODE, &no_synchronization_cmd);
9186 install_element (BGP_NODE, &no_auto_summary_cmd);
9187
9188 /* "router bgp" commands. */
9189 install_element (CONFIG_NODE, &router_bgp_cmd);
9190 install_element (CONFIG_NODE, &router_bgp_view_cmd);
9191
9192 /* "no router bgp" commands. */
9193 install_element (CONFIG_NODE, &no_router_bgp_cmd);
9194 install_element (CONFIG_NODE, &no_router_bgp_view_cmd);
9195
9196 /* "bgp router-id" commands. */
9197 install_element (BGP_NODE, &bgp_router_id_cmd);
9198 install_element (BGP_NODE, &no_bgp_router_id_cmd);
9199 install_element (BGP_NODE, &no_bgp_router_id_val_cmd);
9200
9201 /* "bgp cluster-id" commands. */
9202 install_element (BGP_NODE, &bgp_cluster_id_cmd);
9203 install_element (BGP_NODE, &bgp_cluster_id32_cmd);
9204 install_element (BGP_NODE, &no_bgp_cluster_id_cmd);
9205 install_element (BGP_NODE, &no_bgp_cluster_id_arg_cmd);
9206
9207 /* "bgp confederation" commands. */
9208 install_element (BGP_NODE, &bgp_confederation_identifier_cmd);
9209 install_element (BGP_NODE, &no_bgp_confederation_identifier_cmd);
9210 install_element (BGP_NODE, &no_bgp_confederation_identifier_arg_cmd);
9211
9212 /* "bgp confederation peers" commands. */
9213 install_element (BGP_NODE, &bgp_confederation_peers_cmd);
9214 install_element (BGP_NODE, &no_bgp_confederation_peers_cmd);
9215
Josh Bailey165b5ff2011-07-20 20:43:22 -07009216 /* "maximum-paths" commands. */
9217 install_element (BGP_NODE, &bgp_maxpaths_cmd);
9218 install_element (BGP_NODE, &no_bgp_maxpaths_cmd);
9219 install_element (BGP_NODE, &no_bgp_maxpaths_arg_cmd);
9220 install_element (BGP_IPV4_NODE, &bgp_maxpaths_cmd);
9221 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_cmd);
9222 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_arg_cmd);
9223 install_element (BGP_NODE, &bgp_maxpaths_ibgp_cmd);
9224 install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_cmd);
9225 install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_arg_cmd);
9226 install_element (BGP_IPV4_NODE, &bgp_maxpaths_ibgp_cmd);
9227 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_cmd);
9228 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_arg_cmd);
9229
paul718e3742002-12-13 20:15:29 +00009230 /* "timers bgp" commands. */
9231 install_element (BGP_NODE, &bgp_timers_cmd);
9232 install_element (BGP_NODE, &no_bgp_timers_cmd);
9233 install_element (BGP_NODE, &no_bgp_timers_arg_cmd);
9234
9235 /* "bgp client-to-client reflection" commands */
9236 install_element (BGP_NODE, &no_bgp_client_to_client_reflection_cmd);
9237 install_element (BGP_NODE, &bgp_client_to_client_reflection_cmd);
9238
9239 /* "bgp always-compare-med" commands */
9240 install_element (BGP_NODE, &bgp_always_compare_med_cmd);
9241 install_element (BGP_NODE, &no_bgp_always_compare_med_cmd);
9242
9243 /* "bgp deterministic-med" commands */
9244 install_element (BGP_NODE, &bgp_deterministic_med_cmd);
9245 install_element (BGP_NODE, &no_bgp_deterministic_med_cmd);
hasso538621f2004-05-21 09:31:30 +00009246
hasso538621f2004-05-21 09:31:30 +00009247 /* "bgp graceful-restart" commands */
9248 install_element (BGP_NODE, &bgp_graceful_restart_cmd);
9249 install_element (BGP_NODE, &no_bgp_graceful_restart_cmd);
hasso93406d82005-02-02 14:40:33 +00009250 install_element (BGP_NODE, &bgp_graceful_restart_stalepath_time_cmd);
9251 install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_cmd);
9252 install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_val_cmd);
paul718e3742002-12-13 20:15:29 +00009253
9254 /* "bgp fast-external-failover" commands */
9255 install_element (BGP_NODE, &bgp_fast_external_failover_cmd);
9256 install_element (BGP_NODE, &no_bgp_fast_external_failover_cmd);
9257
9258 /* "bgp enforce-first-as" commands */
9259 install_element (BGP_NODE, &bgp_enforce_first_as_cmd);
9260 install_element (BGP_NODE, &no_bgp_enforce_first_as_cmd);
9261
9262 /* "bgp bestpath compare-routerid" commands */
9263 install_element (BGP_NODE, &bgp_bestpath_compare_router_id_cmd);
9264 install_element (BGP_NODE, &no_bgp_bestpath_compare_router_id_cmd);
9265
9266 /* "bgp bestpath as-path ignore" commands */
9267 install_element (BGP_NODE, &bgp_bestpath_aspath_ignore_cmd);
9268 install_element (BGP_NODE, &no_bgp_bestpath_aspath_ignore_cmd);
9269
hasso68118452005-04-08 15:40:36 +00009270 /* "bgp bestpath as-path confed" commands */
9271 install_element (BGP_NODE, &bgp_bestpath_aspath_confed_cmd);
9272 install_element (BGP_NODE, &no_bgp_bestpath_aspath_confed_cmd);
9273
Pradosh Mohapatra2fdd4552013-09-07 07:02:36 +00009274 /* "bgp bestpath as-path multipath-relax" commands */
9275 install_element (BGP_NODE, &bgp_bestpath_aspath_multipath_relax_cmd);
9276 install_element (BGP_NODE, &no_bgp_bestpath_aspath_multipath_relax_cmd);
9277
paul848973c2003-08-13 00:32:49 +00009278 /* "bgp log-neighbor-changes" commands */
9279 install_element (BGP_NODE, &bgp_log_neighbor_changes_cmd);
9280 install_element (BGP_NODE, &no_bgp_log_neighbor_changes_cmd);
9281
paul718e3742002-12-13 20:15:29 +00009282 /* "bgp bestpath med" commands */
9283 install_element (BGP_NODE, &bgp_bestpath_med_cmd);
9284 install_element (BGP_NODE, &bgp_bestpath_med2_cmd);
9285 install_element (BGP_NODE, &bgp_bestpath_med3_cmd);
9286 install_element (BGP_NODE, &no_bgp_bestpath_med_cmd);
9287 install_element (BGP_NODE, &no_bgp_bestpath_med2_cmd);
9288 install_element (BGP_NODE, &no_bgp_bestpath_med3_cmd);
9289
9290 /* "no bgp default ipv4-unicast" commands. */
9291 install_element (BGP_NODE, &no_bgp_default_ipv4_unicast_cmd);
9292 install_element (BGP_NODE, &bgp_default_ipv4_unicast_cmd);
9293
9294 /* "bgp network import-check" commands. */
9295 install_element (BGP_NODE, &bgp_network_import_check_cmd);
9296 install_element (BGP_NODE, &no_bgp_network_import_check_cmd);
9297
9298 /* "bgp default local-preference" commands. */
9299 install_element (BGP_NODE, &bgp_default_local_preference_cmd);
9300 install_element (BGP_NODE, &no_bgp_default_local_preference_cmd);
9301 install_element (BGP_NODE, &no_bgp_default_local_preference_val_cmd);
9302
9303 /* "neighbor remote-as" commands. */
9304 install_element (BGP_NODE, &neighbor_remote_as_cmd);
9305 install_element (BGP_NODE, &no_neighbor_cmd);
9306 install_element (BGP_NODE, &no_neighbor_remote_as_cmd);
9307
9308 /* "neighbor peer-group" commands. */
9309 install_element (BGP_NODE, &neighbor_peer_group_cmd);
9310 install_element (BGP_NODE, &no_neighbor_peer_group_cmd);
9311 install_element (BGP_NODE, &no_neighbor_peer_group_remote_as_cmd);
9312
9313 /* "neighbor local-as" commands. */
9314 install_element (BGP_NODE, &neighbor_local_as_cmd);
9315 install_element (BGP_NODE, &neighbor_local_as_no_prepend_cmd);
Andrew Certain9d3f9702012-11-07 23:50:07 +00009316 install_element (BGP_NODE, &neighbor_local_as_no_prepend_replace_as_cmd);
paul718e3742002-12-13 20:15:29 +00009317 install_element (BGP_NODE, &no_neighbor_local_as_cmd);
9318 install_element (BGP_NODE, &no_neighbor_local_as_val_cmd);
9319 install_element (BGP_NODE, &no_neighbor_local_as_val2_cmd);
Andrew Certain9d3f9702012-11-07 23:50:07 +00009320 install_element (BGP_NODE, &no_neighbor_local_as_val3_cmd);
paul718e3742002-12-13 20:15:29 +00009321
Paul Jakma0df7c912008-07-21 21:02:49 +00009322 /* "neighbor password" commands. */
9323 install_element (BGP_NODE, &neighbor_password_cmd);
9324 install_element (BGP_NODE, &no_neighbor_password_cmd);
9325
paul718e3742002-12-13 20:15:29 +00009326 /* "neighbor activate" commands. */
9327 install_element (BGP_NODE, &neighbor_activate_cmd);
9328 install_element (BGP_IPV4_NODE, &neighbor_activate_cmd);
9329 install_element (BGP_IPV4M_NODE, &neighbor_activate_cmd);
9330 install_element (BGP_IPV6_NODE, &neighbor_activate_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009331 install_element (BGP_IPV6M_NODE, &neighbor_activate_cmd);
paul718e3742002-12-13 20:15:29 +00009332 install_element (BGP_VPNV4_NODE, &neighbor_activate_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -05009333 install_element (BGP_VPNV6_NODE, &neighbor_activate_cmd);
paul718e3742002-12-13 20:15:29 +00009334
9335 /* "no neighbor activate" commands. */
9336 install_element (BGP_NODE, &no_neighbor_activate_cmd);
9337 install_element (BGP_IPV4_NODE, &no_neighbor_activate_cmd);
9338 install_element (BGP_IPV4M_NODE, &no_neighbor_activate_cmd);
9339 install_element (BGP_IPV6_NODE, &no_neighbor_activate_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009340 install_element (BGP_IPV6M_NODE, &no_neighbor_activate_cmd);
paul718e3742002-12-13 20:15:29 +00009341 install_element (BGP_VPNV4_NODE, &no_neighbor_activate_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -05009342 install_element (BGP_VPNV6_NODE, &no_neighbor_activate_cmd);
paul718e3742002-12-13 20:15:29 +00009343
9344 /* "neighbor peer-group set" commands. */
9345 install_element (BGP_NODE, &neighbor_set_peer_group_cmd);
9346 install_element (BGP_IPV4_NODE, &neighbor_set_peer_group_cmd);
9347 install_element (BGP_IPV4M_NODE, &neighbor_set_peer_group_cmd);
9348 install_element (BGP_IPV6_NODE, &neighbor_set_peer_group_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009349 install_element (BGP_IPV6M_NODE, &neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +00009350 install_element (BGP_VPNV4_NODE, &neighbor_set_peer_group_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -05009351 install_element (BGP_VPNV6_NODE, &neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +00009352
paul718e3742002-12-13 20:15:29 +00009353 /* "no neighbor peer-group unset" commands. */
9354 install_element (BGP_NODE, &no_neighbor_set_peer_group_cmd);
9355 install_element (BGP_IPV4_NODE, &no_neighbor_set_peer_group_cmd);
9356 install_element (BGP_IPV4M_NODE, &no_neighbor_set_peer_group_cmd);
9357 install_element (BGP_IPV6_NODE, &no_neighbor_set_peer_group_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009358 install_element (BGP_IPV6M_NODE, &no_neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +00009359 install_element (BGP_VPNV4_NODE, &no_neighbor_set_peer_group_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -05009360 install_element (BGP_VPNV6_NODE, &no_neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +00009361
paul718e3742002-12-13 20:15:29 +00009362 /* "neighbor softreconfiguration inbound" commands.*/
9363 install_element (BGP_NODE, &neighbor_soft_reconfiguration_cmd);
9364 install_element (BGP_NODE, &no_neighbor_soft_reconfiguration_cmd);
9365 install_element (BGP_IPV4_NODE, &neighbor_soft_reconfiguration_cmd);
9366 install_element (BGP_IPV4_NODE, &no_neighbor_soft_reconfiguration_cmd);
9367 install_element (BGP_IPV4M_NODE, &neighbor_soft_reconfiguration_cmd);
9368 install_element (BGP_IPV4M_NODE, &no_neighbor_soft_reconfiguration_cmd);
9369 install_element (BGP_IPV6_NODE, &neighbor_soft_reconfiguration_cmd);
9370 install_element (BGP_IPV6_NODE, &no_neighbor_soft_reconfiguration_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009371 install_element (BGP_IPV6M_NODE, &neighbor_soft_reconfiguration_cmd);
9372 install_element (BGP_IPV6M_NODE, &no_neighbor_soft_reconfiguration_cmd);
paula58545b2003-07-12 21:43:01 +00009373 install_element (BGP_VPNV4_NODE, &neighbor_soft_reconfiguration_cmd);
9374 install_element (BGP_VPNV4_NODE, &no_neighbor_soft_reconfiguration_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -05009375 install_element (BGP_VPNV6_NODE, &neighbor_soft_reconfiguration_cmd);
9376 install_element (BGP_VPNV6_NODE, &no_neighbor_soft_reconfiguration_cmd);
paul718e3742002-12-13 20:15:29 +00009377
9378 /* "neighbor attribute-unchanged" commands. */
9379 install_element (BGP_NODE, &neighbor_attr_unchanged_cmd);
9380 install_element (BGP_NODE, &neighbor_attr_unchanged1_cmd);
9381 install_element (BGP_NODE, &neighbor_attr_unchanged2_cmd);
9382 install_element (BGP_NODE, &neighbor_attr_unchanged3_cmd);
9383 install_element (BGP_NODE, &neighbor_attr_unchanged4_cmd);
9384 install_element (BGP_NODE, &neighbor_attr_unchanged5_cmd);
9385 install_element (BGP_NODE, &neighbor_attr_unchanged6_cmd);
9386 install_element (BGP_NODE, &neighbor_attr_unchanged7_cmd);
9387 install_element (BGP_NODE, &neighbor_attr_unchanged8_cmd);
9388 install_element (BGP_NODE, &neighbor_attr_unchanged9_cmd);
9389 install_element (BGP_NODE, &neighbor_attr_unchanged10_cmd);
9390 install_element (BGP_NODE, &no_neighbor_attr_unchanged_cmd);
9391 install_element (BGP_NODE, &no_neighbor_attr_unchanged1_cmd);
9392 install_element (BGP_NODE, &no_neighbor_attr_unchanged2_cmd);
9393 install_element (BGP_NODE, &no_neighbor_attr_unchanged3_cmd);
9394 install_element (BGP_NODE, &no_neighbor_attr_unchanged4_cmd);
9395 install_element (BGP_NODE, &no_neighbor_attr_unchanged5_cmd);
9396 install_element (BGP_NODE, &no_neighbor_attr_unchanged6_cmd);
9397 install_element (BGP_NODE, &no_neighbor_attr_unchanged7_cmd);
9398 install_element (BGP_NODE, &no_neighbor_attr_unchanged8_cmd);
9399 install_element (BGP_NODE, &no_neighbor_attr_unchanged9_cmd);
9400 install_element (BGP_NODE, &no_neighbor_attr_unchanged10_cmd);
9401 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged_cmd);
9402 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged1_cmd);
9403 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged2_cmd);
9404 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged3_cmd);
9405 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged4_cmd);
9406 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged5_cmd);
9407 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged6_cmd);
9408 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged7_cmd);
9409 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged8_cmd);
9410 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged9_cmd);
9411 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged10_cmd);
9412 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged_cmd);
9413 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged1_cmd);
9414 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged2_cmd);
9415 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged3_cmd);
9416 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged4_cmd);
9417 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged5_cmd);
9418 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged6_cmd);
9419 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged7_cmd);
9420 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged8_cmd);
9421 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged9_cmd);
9422 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged10_cmd);
9423 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged_cmd);
9424 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged1_cmd);
9425 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged2_cmd);
9426 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged3_cmd);
9427 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged4_cmd);
9428 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged5_cmd);
9429 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged6_cmd);
9430 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged7_cmd);
9431 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged8_cmd);
9432 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged9_cmd);
9433 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged10_cmd);
9434 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged_cmd);
9435 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged1_cmd);
9436 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged2_cmd);
9437 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged3_cmd);
9438 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged4_cmd);
9439 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged5_cmd);
9440 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged6_cmd);
9441 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged7_cmd);
9442 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged8_cmd);
9443 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged9_cmd);
9444 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged10_cmd);
9445 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged_cmd);
9446 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged1_cmd);
9447 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged2_cmd);
9448 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged3_cmd);
9449 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged4_cmd);
9450 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged5_cmd);
9451 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged6_cmd);
9452 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged7_cmd);
9453 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged8_cmd);
9454 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged9_cmd);
9455 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged10_cmd);
9456 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged_cmd);
9457 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged1_cmd);
9458 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged2_cmd);
9459 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged3_cmd);
9460 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged4_cmd);
9461 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged5_cmd);
9462 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged6_cmd);
9463 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged7_cmd);
9464 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged8_cmd);
9465 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged9_cmd);
9466 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged10_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009467 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged_cmd);
9468 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged1_cmd);
9469 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged2_cmd);
9470 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged3_cmd);
9471 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged4_cmd);
9472 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged5_cmd);
9473 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged6_cmd);
9474 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged7_cmd);
9475 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged8_cmd);
9476 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged9_cmd);
9477 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged10_cmd);
9478 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged_cmd);
9479 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged1_cmd);
9480 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged2_cmd);
9481 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged3_cmd);
9482 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged4_cmd);
9483 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged5_cmd);
9484 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged6_cmd);
9485 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged7_cmd);
9486 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged8_cmd);
9487 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged9_cmd);
9488 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged10_cmd);
paul718e3742002-12-13 20:15:29 +00009489 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged_cmd);
9490 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged1_cmd);
9491 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged2_cmd);
9492 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged3_cmd);
9493 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged4_cmd);
9494 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged5_cmd);
9495 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged6_cmd);
9496 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged7_cmd);
9497 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged8_cmd);
9498 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged9_cmd);
9499 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged10_cmd);
9500 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged_cmd);
9501 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged1_cmd);
9502 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged2_cmd);
9503 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged3_cmd);
9504 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged4_cmd);
9505 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged5_cmd);
9506 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged6_cmd);
9507 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged7_cmd);
9508 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged8_cmd);
9509 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged9_cmd);
9510 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged10_cmd);
9511
Lou Berger13c378d2016-01-12 13:41:56 -05009512 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged_cmd);
9513 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged1_cmd);
9514 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged2_cmd);
9515 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged3_cmd);
9516 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged4_cmd);
9517 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged5_cmd);
9518 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged6_cmd);
9519 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged7_cmd);
9520 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged8_cmd);
9521 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged9_cmd);
9522 install_element (BGP_VPNV6_NODE, &neighbor_attr_unchanged10_cmd);
9523 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged_cmd);
9524 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged1_cmd);
9525 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged2_cmd);
9526 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged3_cmd);
9527 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged4_cmd);
9528 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged5_cmd);
9529 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged6_cmd);
9530 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged7_cmd);
9531 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged8_cmd);
9532 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged9_cmd);
9533 install_element (BGP_VPNV6_NODE, &no_neighbor_attr_unchanged10_cmd);
9534
paulfee0f4c2004-09-13 05:12:46 +00009535 /* "nexthop-local unchanged" commands */
9536 install_element (BGP_IPV6_NODE, &neighbor_nexthop_local_unchanged_cmd);
9537 install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_local_unchanged_cmd);
9538
paul718e3742002-12-13 20:15:29 +00009539 /* "transparent-as" and "transparent-nexthop" for old version
9540 compatibility. */
9541 install_element (BGP_NODE, &neighbor_transparent_as_cmd);
9542 install_element (BGP_NODE, &neighbor_transparent_nexthop_cmd);
9543
9544 /* "neighbor next-hop-self" commands. */
9545 install_element (BGP_NODE, &neighbor_nexthop_self_cmd);
9546 install_element (BGP_NODE, &no_neighbor_nexthop_self_cmd);
9547 install_element (BGP_IPV4_NODE, &neighbor_nexthop_self_cmd);
9548 install_element (BGP_IPV4_NODE, &no_neighbor_nexthop_self_cmd);
9549 install_element (BGP_IPV4M_NODE, &neighbor_nexthop_self_cmd);
9550 install_element (BGP_IPV4M_NODE, &no_neighbor_nexthop_self_cmd);
9551 install_element (BGP_IPV6_NODE, &neighbor_nexthop_self_cmd);
9552 install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_self_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009553 install_element (BGP_IPV6M_NODE, &neighbor_nexthop_self_cmd);
9554 install_element (BGP_IPV6M_NODE, &no_neighbor_nexthop_self_cmd);
paul718e3742002-12-13 20:15:29 +00009555 install_element (BGP_VPNV4_NODE, &neighbor_nexthop_self_cmd);
9556 install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -05009557 install_element (BGP_VPNV6_NODE, &neighbor_nexthop_self_cmd);
9558 install_element (BGP_VPNV6_NODE, &no_neighbor_nexthop_self_cmd);
paul718e3742002-12-13 20:15:29 +00009559
9560 /* "neighbor remove-private-AS" commands. */
9561 install_element (BGP_NODE, &neighbor_remove_private_as_cmd);
9562 install_element (BGP_NODE, &no_neighbor_remove_private_as_cmd);
9563 install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_cmd);
9564 install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_cmd);
9565 install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_cmd);
9566 install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_cmd);
9567 install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_cmd);
9568 install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009569 install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_cmd);
9570 install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_cmd);
paul718e3742002-12-13 20:15:29 +00009571 install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_cmd);
9572 install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -05009573 install_element (BGP_VPNV6_NODE, &neighbor_remove_private_as_cmd);
9574 install_element (BGP_VPNV6_NODE, &no_neighbor_remove_private_as_cmd);
paul718e3742002-12-13 20:15:29 +00009575
9576 /* "neighbor send-community" commands.*/
9577 install_element (BGP_NODE, &neighbor_send_community_cmd);
9578 install_element (BGP_NODE, &neighbor_send_community_type_cmd);
9579 install_element (BGP_NODE, &no_neighbor_send_community_cmd);
9580 install_element (BGP_NODE, &no_neighbor_send_community_type_cmd);
9581 install_element (BGP_IPV4_NODE, &neighbor_send_community_cmd);
9582 install_element (BGP_IPV4_NODE, &neighbor_send_community_type_cmd);
9583 install_element (BGP_IPV4_NODE, &no_neighbor_send_community_cmd);
9584 install_element (BGP_IPV4_NODE, &no_neighbor_send_community_type_cmd);
9585 install_element (BGP_IPV4M_NODE, &neighbor_send_community_cmd);
9586 install_element (BGP_IPV4M_NODE, &neighbor_send_community_type_cmd);
9587 install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_cmd);
9588 install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_type_cmd);
9589 install_element (BGP_IPV6_NODE, &neighbor_send_community_cmd);
9590 install_element (BGP_IPV6_NODE, &neighbor_send_community_type_cmd);
9591 install_element (BGP_IPV6_NODE, &no_neighbor_send_community_cmd);
9592 install_element (BGP_IPV6_NODE, &no_neighbor_send_community_type_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009593 install_element (BGP_IPV6M_NODE, &neighbor_send_community_cmd);
9594 install_element (BGP_IPV6M_NODE, &neighbor_send_community_type_cmd);
9595 install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_cmd);
9596 install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_type_cmd);
paul718e3742002-12-13 20:15:29 +00009597 install_element (BGP_VPNV4_NODE, &neighbor_send_community_cmd);
9598 install_element (BGP_VPNV4_NODE, &neighbor_send_community_type_cmd);
9599 install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_cmd);
9600 install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_type_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -05009601 install_element (BGP_VPNV6_NODE, &neighbor_send_community_cmd);
9602 install_element (BGP_VPNV6_NODE, &neighbor_send_community_type_cmd);
9603 install_element (BGP_VPNV6_NODE, &no_neighbor_send_community_cmd);
9604 install_element (BGP_VPNV6_NODE, &no_neighbor_send_community_type_cmd);
paul718e3742002-12-13 20:15:29 +00009605
9606 /* "neighbor route-reflector" commands.*/
9607 install_element (BGP_NODE, &neighbor_route_reflector_client_cmd);
9608 install_element (BGP_NODE, &no_neighbor_route_reflector_client_cmd);
9609 install_element (BGP_IPV4_NODE, &neighbor_route_reflector_client_cmd);
9610 install_element (BGP_IPV4_NODE, &no_neighbor_route_reflector_client_cmd);
9611 install_element (BGP_IPV4M_NODE, &neighbor_route_reflector_client_cmd);
9612 install_element (BGP_IPV4M_NODE, &no_neighbor_route_reflector_client_cmd);
9613 install_element (BGP_IPV6_NODE, &neighbor_route_reflector_client_cmd);
9614 install_element (BGP_IPV6_NODE, &no_neighbor_route_reflector_client_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009615 install_element (BGP_IPV6M_NODE, &neighbor_route_reflector_client_cmd);
9616 install_element (BGP_IPV6M_NODE, &no_neighbor_route_reflector_client_cmd);
paul718e3742002-12-13 20:15:29 +00009617 install_element (BGP_VPNV4_NODE, &neighbor_route_reflector_client_cmd);
9618 install_element (BGP_VPNV4_NODE, &no_neighbor_route_reflector_client_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -05009619 install_element (BGP_VPNV6_NODE, &neighbor_route_reflector_client_cmd);
9620 install_element (BGP_VPNV6_NODE, &no_neighbor_route_reflector_client_cmd);
paul718e3742002-12-13 20:15:29 +00009621
9622 /* "neighbor route-server" commands.*/
9623 install_element (BGP_NODE, &neighbor_route_server_client_cmd);
9624 install_element (BGP_NODE, &no_neighbor_route_server_client_cmd);
9625 install_element (BGP_IPV4_NODE, &neighbor_route_server_client_cmd);
9626 install_element (BGP_IPV4_NODE, &no_neighbor_route_server_client_cmd);
9627 install_element (BGP_IPV4M_NODE, &neighbor_route_server_client_cmd);
9628 install_element (BGP_IPV4M_NODE, &no_neighbor_route_server_client_cmd);
9629 install_element (BGP_IPV6_NODE, &neighbor_route_server_client_cmd);
9630 install_element (BGP_IPV6_NODE, &no_neighbor_route_server_client_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009631 install_element (BGP_IPV6M_NODE, &neighbor_route_server_client_cmd);
9632 install_element (BGP_IPV6M_NODE, &no_neighbor_route_server_client_cmd);
paul718e3742002-12-13 20:15:29 +00009633 install_element (BGP_VPNV4_NODE, &neighbor_route_server_client_cmd);
9634 install_element (BGP_VPNV4_NODE, &no_neighbor_route_server_client_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -05009635 install_element (BGP_VPNV6_NODE, &neighbor_route_server_client_cmd);
9636 install_element (BGP_VPNV6_NODE, &no_neighbor_route_server_client_cmd);
paul718e3742002-12-13 20:15:29 +00009637
9638 /* "neighbor passive" commands. */
9639 install_element (BGP_NODE, &neighbor_passive_cmd);
9640 install_element (BGP_NODE, &no_neighbor_passive_cmd);
9641
9642 /* "neighbor shutdown" commands. */
9643 install_element (BGP_NODE, &neighbor_shutdown_cmd);
9644 install_element (BGP_NODE, &no_neighbor_shutdown_cmd);
9645
hassoc9502432005-02-01 22:01:48 +00009646 /* Deprecated "neighbor capability route-refresh" commands.*/
paul718e3742002-12-13 20:15:29 +00009647 install_element (BGP_NODE, &neighbor_capability_route_refresh_cmd);
9648 install_element (BGP_NODE, &no_neighbor_capability_route_refresh_cmd);
9649
9650 /* "neighbor capability orf prefix-list" commands.*/
9651 install_element (BGP_NODE, &neighbor_capability_orf_prefix_cmd);
9652 install_element (BGP_NODE, &no_neighbor_capability_orf_prefix_cmd);
9653 install_element (BGP_IPV4_NODE, &neighbor_capability_orf_prefix_cmd);
9654 install_element (BGP_IPV4_NODE, &no_neighbor_capability_orf_prefix_cmd);
9655 install_element (BGP_IPV4M_NODE, &neighbor_capability_orf_prefix_cmd);
9656 install_element (BGP_IPV4M_NODE, &no_neighbor_capability_orf_prefix_cmd);
9657 install_element (BGP_IPV6_NODE, &neighbor_capability_orf_prefix_cmd);
9658 install_element (BGP_IPV6_NODE, &no_neighbor_capability_orf_prefix_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009659 install_element (BGP_IPV6M_NODE, &neighbor_capability_orf_prefix_cmd);
9660 install_element (BGP_IPV6M_NODE, &no_neighbor_capability_orf_prefix_cmd);
paul718e3742002-12-13 20:15:29 +00009661
9662 /* "neighbor capability dynamic" commands.*/
9663 install_element (BGP_NODE, &neighbor_capability_dynamic_cmd);
9664 install_element (BGP_NODE, &no_neighbor_capability_dynamic_cmd);
9665
9666 /* "neighbor dont-capability-negotiate" commands. */
9667 install_element (BGP_NODE, &neighbor_dont_capability_negotiate_cmd);
9668 install_element (BGP_NODE, &no_neighbor_dont_capability_negotiate_cmd);
9669
9670 /* "neighbor ebgp-multihop" commands. */
9671 install_element (BGP_NODE, &neighbor_ebgp_multihop_cmd);
9672 install_element (BGP_NODE, &neighbor_ebgp_multihop_ttl_cmd);
9673 install_element (BGP_NODE, &no_neighbor_ebgp_multihop_cmd);
9674 install_element (BGP_NODE, &no_neighbor_ebgp_multihop_ttl_cmd);
9675
hasso6ffd2072005-02-02 14:50:11 +00009676 /* "neighbor disable-connected-check" commands. */
9677 install_element (BGP_NODE, &neighbor_disable_connected_check_cmd);
9678 install_element (BGP_NODE, &no_neighbor_disable_connected_check_cmd);
paul718e3742002-12-13 20:15:29 +00009679 install_element (BGP_NODE, &neighbor_enforce_multihop_cmd);
9680 install_element (BGP_NODE, &no_neighbor_enforce_multihop_cmd);
9681
9682 /* "neighbor description" commands. */
9683 install_element (BGP_NODE, &neighbor_description_cmd);
9684 install_element (BGP_NODE, &no_neighbor_description_cmd);
9685 install_element (BGP_NODE, &no_neighbor_description_val_cmd);
9686
9687 /* "neighbor update-source" commands. "*/
9688 install_element (BGP_NODE, &neighbor_update_source_cmd);
9689 install_element (BGP_NODE, &no_neighbor_update_source_cmd);
9690
9691 /* "neighbor default-originate" commands. */
9692 install_element (BGP_NODE, &neighbor_default_originate_cmd);
9693 install_element (BGP_NODE, &neighbor_default_originate_rmap_cmd);
9694 install_element (BGP_NODE, &no_neighbor_default_originate_cmd);
9695 install_element (BGP_NODE, &no_neighbor_default_originate_rmap_cmd);
9696 install_element (BGP_IPV4_NODE, &neighbor_default_originate_cmd);
9697 install_element (BGP_IPV4_NODE, &neighbor_default_originate_rmap_cmd);
9698 install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_cmd);
9699 install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_rmap_cmd);
9700 install_element (BGP_IPV4M_NODE, &neighbor_default_originate_cmd);
9701 install_element (BGP_IPV4M_NODE, &neighbor_default_originate_rmap_cmd);
9702 install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_cmd);
9703 install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_rmap_cmd);
9704 install_element (BGP_IPV6_NODE, &neighbor_default_originate_cmd);
9705 install_element (BGP_IPV6_NODE, &neighbor_default_originate_rmap_cmd);
9706 install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_cmd);
9707 install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_rmap_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009708 install_element (BGP_IPV6M_NODE, &neighbor_default_originate_cmd);
9709 install_element (BGP_IPV6M_NODE, &neighbor_default_originate_rmap_cmd);
9710 install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_cmd);
9711 install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_rmap_cmd);
paul718e3742002-12-13 20:15:29 +00009712
9713 /* "neighbor port" commands. */
9714 install_element (BGP_NODE, &neighbor_port_cmd);
9715 install_element (BGP_NODE, &no_neighbor_port_cmd);
9716 install_element (BGP_NODE, &no_neighbor_port_val_cmd);
9717
9718 /* "neighbor weight" commands. */
9719 install_element (BGP_NODE, &neighbor_weight_cmd);
9720 install_element (BGP_NODE, &no_neighbor_weight_cmd);
9721 install_element (BGP_NODE, &no_neighbor_weight_val_cmd);
9722
9723 /* "neighbor override-capability" commands. */
9724 install_element (BGP_NODE, &neighbor_override_capability_cmd);
9725 install_element (BGP_NODE, &no_neighbor_override_capability_cmd);
9726
9727 /* "neighbor strict-capability-match" commands. */
9728 install_element (BGP_NODE, &neighbor_strict_capability_cmd);
9729 install_element (BGP_NODE, &no_neighbor_strict_capability_cmd);
9730
9731 /* "neighbor timers" commands. */
9732 install_element (BGP_NODE, &neighbor_timers_cmd);
9733 install_element (BGP_NODE, &no_neighbor_timers_cmd);
9734
9735 /* "neighbor timers connect" commands. */
9736 install_element (BGP_NODE, &neighbor_timers_connect_cmd);
9737 install_element (BGP_NODE, &no_neighbor_timers_connect_cmd);
9738 install_element (BGP_NODE, &no_neighbor_timers_connect_val_cmd);
9739
9740 /* "neighbor advertisement-interval" commands. */
9741 install_element (BGP_NODE, &neighbor_advertise_interval_cmd);
9742 install_element (BGP_NODE, &no_neighbor_advertise_interval_cmd);
9743 install_element (BGP_NODE, &no_neighbor_advertise_interval_val_cmd);
9744
9745 /* "neighbor version" commands. */
9746 install_element (BGP_NODE, &neighbor_version_cmd);
paul718e3742002-12-13 20:15:29 +00009747
9748 /* "neighbor interface" commands. */
9749 install_element (BGP_NODE, &neighbor_interface_cmd);
9750 install_element (BGP_NODE, &no_neighbor_interface_cmd);
9751
9752 /* "neighbor distribute" commands. */
9753 install_element (BGP_NODE, &neighbor_distribute_list_cmd);
9754 install_element (BGP_NODE, &no_neighbor_distribute_list_cmd);
9755 install_element (BGP_IPV4_NODE, &neighbor_distribute_list_cmd);
9756 install_element (BGP_IPV4_NODE, &no_neighbor_distribute_list_cmd);
9757 install_element (BGP_IPV4M_NODE, &neighbor_distribute_list_cmd);
9758 install_element (BGP_IPV4M_NODE, &no_neighbor_distribute_list_cmd);
9759 install_element (BGP_IPV6_NODE, &neighbor_distribute_list_cmd);
9760 install_element (BGP_IPV6_NODE, &no_neighbor_distribute_list_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009761 install_element (BGP_IPV6M_NODE, &neighbor_distribute_list_cmd);
9762 install_element (BGP_IPV6M_NODE, &no_neighbor_distribute_list_cmd);
paul718e3742002-12-13 20:15:29 +00009763 install_element (BGP_VPNV4_NODE, &neighbor_distribute_list_cmd);
9764 install_element (BGP_VPNV4_NODE, &no_neighbor_distribute_list_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -05009765 install_element (BGP_VPNV6_NODE, &neighbor_distribute_list_cmd);
9766 install_element (BGP_VPNV6_NODE, &no_neighbor_distribute_list_cmd);
paul718e3742002-12-13 20:15:29 +00009767
9768 /* "neighbor prefix-list" commands. */
9769 install_element (BGP_NODE, &neighbor_prefix_list_cmd);
9770 install_element (BGP_NODE, &no_neighbor_prefix_list_cmd);
9771 install_element (BGP_IPV4_NODE, &neighbor_prefix_list_cmd);
9772 install_element (BGP_IPV4_NODE, &no_neighbor_prefix_list_cmd);
9773 install_element (BGP_IPV4M_NODE, &neighbor_prefix_list_cmd);
9774 install_element (BGP_IPV4M_NODE, &no_neighbor_prefix_list_cmd);
9775 install_element (BGP_IPV6_NODE, &neighbor_prefix_list_cmd);
9776 install_element (BGP_IPV6_NODE, &no_neighbor_prefix_list_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009777 install_element (BGP_IPV6M_NODE, &neighbor_prefix_list_cmd);
9778 install_element (BGP_IPV6M_NODE, &no_neighbor_prefix_list_cmd);
paul718e3742002-12-13 20:15:29 +00009779 install_element (BGP_VPNV4_NODE, &neighbor_prefix_list_cmd);
9780 install_element (BGP_VPNV4_NODE, &no_neighbor_prefix_list_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -05009781 install_element (BGP_VPNV6_NODE, &neighbor_prefix_list_cmd);
9782 install_element (BGP_VPNV6_NODE, &no_neighbor_prefix_list_cmd);
paul718e3742002-12-13 20:15:29 +00009783
9784 /* "neighbor filter-list" commands. */
9785 install_element (BGP_NODE, &neighbor_filter_list_cmd);
9786 install_element (BGP_NODE, &no_neighbor_filter_list_cmd);
9787 install_element (BGP_IPV4_NODE, &neighbor_filter_list_cmd);
9788 install_element (BGP_IPV4_NODE, &no_neighbor_filter_list_cmd);
9789 install_element (BGP_IPV4M_NODE, &neighbor_filter_list_cmd);
9790 install_element (BGP_IPV4M_NODE, &no_neighbor_filter_list_cmd);
9791 install_element (BGP_IPV6_NODE, &neighbor_filter_list_cmd);
9792 install_element (BGP_IPV6_NODE, &no_neighbor_filter_list_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009793 install_element (BGP_IPV6M_NODE, &neighbor_filter_list_cmd);
9794 install_element (BGP_IPV6M_NODE, &no_neighbor_filter_list_cmd);
paul718e3742002-12-13 20:15:29 +00009795 install_element (BGP_VPNV4_NODE, &neighbor_filter_list_cmd);
9796 install_element (BGP_VPNV4_NODE, &no_neighbor_filter_list_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -05009797 install_element (BGP_VPNV6_NODE, &neighbor_filter_list_cmd);
9798 install_element (BGP_VPNV6_NODE, &no_neighbor_filter_list_cmd);
paul718e3742002-12-13 20:15:29 +00009799
9800 /* "neighbor route-map" commands. */
9801 install_element (BGP_NODE, &neighbor_route_map_cmd);
9802 install_element (BGP_NODE, &no_neighbor_route_map_cmd);
9803 install_element (BGP_IPV4_NODE, &neighbor_route_map_cmd);
9804 install_element (BGP_IPV4_NODE, &no_neighbor_route_map_cmd);
9805 install_element (BGP_IPV4M_NODE, &neighbor_route_map_cmd);
9806 install_element (BGP_IPV4M_NODE, &no_neighbor_route_map_cmd);
9807 install_element (BGP_IPV6_NODE, &neighbor_route_map_cmd);
9808 install_element (BGP_IPV6_NODE, &no_neighbor_route_map_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009809 install_element (BGP_IPV6M_NODE, &neighbor_route_map_cmd);
9810 install_element (BGP_IPV6M_NODE, &no_neighbor_route_map_cmd);
paul718e3742002-12-13 20:15:29 +00009811 install_element (BGP_VPNV4_NODE, &neighbor_route_map_cmd);
9812 install_element (BGP_VPNV4_NODE, &no_neighbor_route_map_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -05009813 install_element (BGP_VPNV6_NODE, &neighbor_route_map_cmd);
9814 install_element (BGP_VPNV6_NODE, &no_neighbor_route_map_cmd);
paul718e3742002-12-13 20:15:29 +00009815
9816 /* "neighbor unsuppress-map" commands. */
9817 install_element (BGP_NODE, &neighbor_unsuppress_map_cmd);
9818 install_element (BGP_NODE, &no_neighbor_unsuppress_map_cmd);
9819 install_element (BGP_IPV4_NODE, &neighbor_unsuppress_map_cmd);
9820 install_element (BGP_IPV4_NODE, &no_neighbor_unsuppress_map_cmd);
9821 install_element (BGP_IPV4M_NODE, &neighbor_unsuppress_map_cmd);
9822 install_element (BGP_IPV4M_NODE, &no_neighbor_unsuppress_map_cmd);
9823 install_element (BGP_IPV6_NODE, &neighbor_unsuppress_map_cmd);
9824 install_element (BGP_IPV6_NODE, &no_neighbor_unsuppress_map_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009825 install_element (BGP_IPV6M_NODE, &neighbor_unsuppress_map_cmd);
9826 install_element (BGP_IPV6M_NODE, &no_neighbor_unsuppress_map_cmd);
paula58545b2003-07-12 21:43:01 +00009827 install_element (BGP_VPNV4_NODE, &neighbor_unsuppress_map_cmd);
Lou Berger82dd7072016-01-12 13:41:57 -05009828 install_element (BGP_VPNV4_NODE, &no_neighbor_unsuppress_map_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -05009829 install_element (BGP_VPNV6_NODE, &neighbor_unsuppress_map_cmd);
Lou Berger82dd7072016-01-12 13:41:57 -05009830 install_element (BGP_VPNV6_NODE, &no_neighbor_unsuppress_map_cmd);
paul718e3742002-12-13 20:15:29 +00009831
9832 /* "neighbor maximum-prefix" commands. */
9833 install_element (BGP_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +00009834 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +00009835 install_element (BGP_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +00009836 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +00009837 install_element (BGP_NODE, &neighbor_maximum_prefix_restart_cmd);
9838 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009839 install_element (BGP_NODE, &no_neighbor_maximum_prefix_cmd);
9840 install_element (BGP_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +00009841 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9842 install_element (BGP_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9843 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9844 install_element (BGP_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9845 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009846 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +00009847 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +00009848 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +00009849 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +00009850 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_restart_cmd);
9851 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009852 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_cmd);
9853 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +00009854 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9855 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9856 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9857 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9858 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009859 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +00009860 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +00009861 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +00009862 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +00009863 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_restart_cmd);
9864 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009865 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_cmd);
9866 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +00009867 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9868 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9869 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9870 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9871 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009872 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +00009873 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +00009874 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +00009875 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +00009876 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_restart_cmd);
9877 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009878 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_cmd);
9879 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +00009880 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9881 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9882 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9883 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9884 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009885 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_cmd);
9886 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_cmd);
9887 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_warning_cmd);
9888 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
9889 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_restart_cmd);
9890 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
9891 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_cmd);
9892 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_val_cmd);
9893 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9894 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9895 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9896 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9897 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009898 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +00009899 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +00009900 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +00009901 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +00009902 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_restart_cmd);
9903 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009904 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_cmd);
9905 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +00009906 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9907 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9908 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9909 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9910 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009911
Lou Berger13c378d2016-01-12 13:41:56 -05009912 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_cmd);
9913 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_threshold_cmd);
9914 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_warning_cmd);
9915 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
9916 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_restart_cmd);
9917 install_element (BGP_VPNV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
9918 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_cmd);
9919 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_val_cmd);
9920 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9921 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9922 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9923 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9924 install_element (BGP_VPNV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
9925
paul718e3742002-12-13 20:15:29 +00009926 /* "neighbor allowas-in" */
9927 install_element (BGP_NODE, &neighbor_allowas_in_cmd);
9928 install_element (BGP_NODE, &neighbor_allowas_in_arg_cmd);
9929 install_element (BGP_NODE, &no_neighbor_allowas_in_cmd);
9930 install_element (BGP_IPV4_NODE, &neighbor_allowas_in_cmd);
9931 install_element (BGP_IPV4_NODE, &neighbor_allowas_in_arg_cmd);
9932 install_element (BGP_IPV4_NODE, &no_neighbor_allowas_in_cmd);
9933 install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_cmd);
9934 install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_arg_cmd);
9935 install_element (BGP_IPV4M_NODE, &no_neighbor_allowas_in_cmd);
9936 install_element (BGP_IPV6_NODE, &neighbor_allowas_in_cmd);
9937 install_element (BGP_IPV6_NODE, &neighbor_allowas_in_arg_cmd);
9938 install_element (BGP_IPV6_NODE, &no_neighbor_allowas_in_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009939 install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_cmd);
9940 install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_arg_cmd);
9941 install_element (BGP_IPV6M_NODE, &no_neighbor_allowas_in_cmd);
paul718e3742002-12-13 20:15:29 +00009942 install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_cmd);
9943 install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_arg_cmd);
9944 install_element (BGP_VPNV4_NODE, &no_neighbor_allowas_in_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -05009945 install_element (BGP_VPNV6_NODE, &neighbor_allowas_in_cmd);
9946 install_element (BGP_VPNV6_NODE, &neighbor_allowas_in_arg_cmd);
9947 install_element (BGP_VPNV6_NODE, &no_neighbor_allowas_in_cmd);
paul718e3742002-12-13 20:15:29 +00009948
9949 /* address-family commands. */
9950 install_element (BGP_NODE, &address_family_ipv4_cmd);
9951 install_element (BGP_NODE, &address_family_ipv4_safi_cmd);
9952#ifdef HAVE_IPV6
9953 install_element (BGP_NODE, &address_family_ipv6_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009954 install_element (BGP_NODE, &address_family_ipv6_safi_cmd);
paul718e3742002-12-13 20:15:29 +00009955#endif /* HAVE_IPV6 */
9956 install_element (BGP_NODE, &address_family_vpnv4_cmd);
9957 install_element (BGP_NODE, &address_family_vpnv4_unicast_cmd);
9958
Lou Berger13c378d2016-01-12 13:41:56 -05009959 install_element (BGP_NODE, &address_family_vpnv6_cmd);
9960 install_element (BGP_NODE, &address_family_vpnv6_unicast_cmd);
9961
paul718e3742002-12-13 20:15:29 +00009962 /* "exit-address-family" command. */
9963 install_element (BGP_IPV4_NODE, &exit_address_family_cmd);
9964 install_element (BGP_IPV4M_NODE, &exit_address_family_cmd);
9965 install_element (BGP_IPV6_NODE, &exit_address_family_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009966 install_element (BGP_IPV6M_NODE, &exit_address_family_cmd);
paul718e3742002-12-13 20:15:29 +00009967 install_element (BGP_VPNV4_NODE, &exit_address_family_cmd);
Lou Berger13c378d2016-01-12 13:41:56 -05009968 install_element (BGP_VPNV6_NODE, &exit_address_family_cmd);
paul718e3742002-12-13 20:15:29 +00009969
9970 /* "clear ip bgp commands" */
9971 install_element (ENABLE_NODE, &clear_ip_bgp_all_cmd);
9972 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_cmd);
9973 install_element (ENABLE_NODE, &clear_ip_bgp_as_cmd);
9974 install_element (ENABLE_NODE, &clear_ip_bgp_peer_cmd);
9975 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_cmd);
9976 install_element (ENABLE_NODE, &clear_ip_bgp_external_cmd);
9977#ifdef HAVE_IPV6
9978 install_element (ENABLE_NODE, &clear_bgp_all_cmd);
9979 install_element (ENABLE_NODE, &clear_bgp_instance_all_cmd);
9980 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_cmd);
9981 install_element (ENABLE_NODE, &clear_bgp_peer_cmd);
9982 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_cmd);
9983 install_element (ENABLE_NODE, &clear_bgp_peer_group_cmd);
9984 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_cmd);
9985 install_element (ENABLE_NODE, &clear_bgp_external_cmd);
9986 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_cmd);
9987 install_element (ENABLE_NODE, &clear_bgp_as_cmd);
9988 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_cmd);
9989#endif /* HAVE_IPV6 */
9990
9991 /* "clear ip bgp neighbor soft in" */
9992 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_in_cmd);
9993 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_in_cmd);
9994 install_element (ENABLE_NODE, &clear_ip_bgp_all_in_cmd);
9995 install_element (ENABLE_NODE, &clear_ip_bgp_all_in_prefix_filter_cmd);
9996 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_in_prefix_filter_cmd);
9997 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_in_cmd);
9998 install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_cmd);
9999 install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_prefix_filter_cmd);
10000 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_in_cmd);
10001 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_cmd);
10002 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_prefix_filter_cmd);
10003 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_in_cmd);
10004 install_element (ENABLE_NODE, &clear_ip_bgp_external_in_cmd);
10005 install_element (ENABLE_NODE, &clear_ip_bgp_external_in_prefix_filter_cmd);
10006 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_in_cmd);
10007 install_element (ENABLE_NODE, &clear_ip_bgp_as_in_cmd);
10008 install_element (ENABLE_NODE, &clear_ip_bgp_as_in_prefix_filter_cmd);
10009 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_in_cmd);
10010 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_in_cmd);
10011 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_cmd);
10012 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_prefix_filter_cmd);
10013 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd);
10014 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_in_cmd);
10015 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_cmd);
10016 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd);
10017 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_in_cmd);
10018 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_cmd);
10019 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd);
10020 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_in_cmd);
10021 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_cmd);
10022 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_prefix_filter_cmd);
10023 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_in_cmd);
10024 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_cmd);
10025 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_prefix_filter_cmd);
10026 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_in_cmd);
10027 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_in_cmd);
10028 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_in_cmd);
10029 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_in_cmd);
10030 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_in_cmd);
10031 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_in_cmd);
10032#ifdef HAVE_IPV6
10033 install_element (ENABLE_NODE, &clear_bgp_all_soft_in_cmd);
10034 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_in_cmd);
10035 install_element (ENABLE_NODE, &clear_bgp_all_in_cmd);
10036 install_element (ENABLE_NODE, &clear_bgp_all_in_prefix_filter_cmd);
10037 install_element (ENABLE_NODE, &clear_bgp_peer_soft_in_cmd);
10038 install_element (ENABLE_NODE, &clear_bgp_peer_in_cmd);
10039 install_element (ENABLE_NODE, &clear_bgp_peer_in_prefix_filter_cmd);
10040 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_in_cmd);
10041 install_element (ENABLE_NODE, &clear_bgp_peer_group_in_cmd);
10042 install_element (ENABLE_NODE, &clear_bgp_peer_group_in_prefix_filter_cmd);
10043 install_element (ENABLE_NODE, &clear_bgp_external_soft_in_cmd);
10044 install_element (ENABLE_NODE, &clear_bgp_external_in_cmd);
10045 install_element (ENABLE_NODE, &clear_bgp_external_in_prefix_filter_cmd);
10046 install_element (ENABLE_NODE, &clear_bgp_as_soft_in_cmd);
10047 install_element (ENABLE_NODE, &clear_bgp_as_in_cmd);
10048 install_element (ENABLE_NODE, &clear_bgp_as_in_prefix_filter_cmd);
10049 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_in_cmd);
10050 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_cmd);
10051 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_prefix_filter_cmd);
10052 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_in_cmd);
10053 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_cmd);
10054 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_prefix_filter_cmd);
10055 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_in_cmd);
10056 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_cmd);
10057 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_prefix_filter_cmd);
10058 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_in_cmd);
10059 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_cmd);
10060 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_prefix_filter_cmd);
10061 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_in_cmd);
10062 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_cmd);
10063 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_prefix_filter_cmd);
10064#endif /* HAVE_IPV6 */
10065
10066 /* "clear ip bgp neighbor soft out" */
10067 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_out_cmd);
10068 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_out_cmd);
10069 install_element (ENABLE_NODE, &clear_ip_bgp_all_out_cmd);
10070 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_out_cmd);
10071 install_element (ENABLE_NODE, &clear_ip_bgp_peer_out_cmd);
10072 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_out_cmd);
10073 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_out_cmd);
10074 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_out_cmd);
10075 install_element (ENABLE_NODE, &clear_ip_bgp_external_out_cmd);
10076 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_out_cmd);
10077 install_element (ENABLE_NODE, &clear_ip_bgp_as_out_cmd);
10078 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_out_cmd);
10079 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_out_cmd);
10080 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_out_cmd);
10081 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_out_cmd);
10082 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_out_cmd);
10083 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_out_cmd);
10084 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_out_cmd);
10085 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_out_cmd);
10086 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_out_cmd);
10087 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_out_cmd);
10088 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_out_cmd);
10089 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_out_cmd);
10090 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_out_cmd);
10091 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_out_cmd);
10092 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_out_cmd);
10093 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_out_cmd);
10094 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_out_cmd);
10095#ifdef HAVE_IPV6
10096 install_element (ENABLE_NODE, &clear_bgp_all_soft_out_cmd);
10097 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_out_cmd);
10098 install_element (ENABLE_NODE, &clear_bgp_all_out_cmd);
10099 install_element (ENABLE_NODE, &clear_bgp_peer_soft_out_cmd);
10100 install_element (ENABLE_NODE, &clear_bgp_peer_out_cmd);
10101 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_out_cmd);
10102 install_element (ENABLE_NODE, &clear_bgp_peer_group_out_cmd);
10103 install_element (ENABLE_NODE, &clear_bgp_external_soft_out_cmd);
10104 install_element (ENABLE_NODE, &clear_bgp_external_out_cmd);
10105 install_element (ENABLE_NODE, &clear_bgp_as_soft_out_cmd);
10106 install_element (ENABLE_NODE, &clear_bgp_as_out_cmd);
10107 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_out_cmd);
10108 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_out_cmd);
10109 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_out_cmd);
10110 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_out_cmd);
10111 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_out_cmd);
10112 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_out_cmd);
10113 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_out_cmd);
10114 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_out_cmd);
10115 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_out_cmd);
10116 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_out_cmd);
10117#endif /* HAVE_IPV6 */
10118
10119 /* "clear ip bgp neighbor soft" */
10120 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_cmd);
10121 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_cmd);
10122 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_cmd);
10123 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_cmd);
10124 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_cmd);
10125 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_cmd);
10126 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_cmd);
10127 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_cmd);
10128 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_cmd);
10129 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_cmd);
10130 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_cmd);
10131 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_cmd);
10132 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_cmd);
10133 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_cmd);
10134 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_cmd);
10135#ifdef HAVE_IPV6
10136 install_element (ENABLE_NODE, &clear_bgp_all_soft_cmd);
10137 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_cmd);
10138 install_element (ENABLE_NODE, &clear_bgp_peer_soft_cmd);
10139 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_cmd);
10140 install_element (ENABLE_NODE, &clear_bgp_external_soft_cmd);
10141 install_element (ENABLE_NODE, &clear_bgp_as_soft_cmd);
10142 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_cmd);
10143 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_cmd);
10144 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_cmd);
10145 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_cmd);
10146 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_cmd);
10147#endif /* HAVE_IPV6 */
10148
paulfee0f4c2004-09-13 05:12:46 +000010149 /* "clear ip bgp neighbor rsclient" */
10150 install_element (ENABLE_NODE, &clear_ip_bgp_all_rsclient_cmd);
10151 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_rsclient_cmd);
10152 install_element (ENABLE_NODE, &clear_ip_bgp_peer_rsclient_cmd);
10153 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_rsclient_cmd);
10154#ifdef HAVE_IPV6
10155 install_element (ENABLE_NODE, &clear_bgp_all_rsclient_cmd);
10156 install_element (ENABLE_NODE, &clear_bgp_instance_all_rsclient_cmd);
10157 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_rsclient_cmd);
10158 install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_all_rsclient_cmd);
10159 install_element (ENABLE_NODE, &clear_bgp_peer_rsclient_cmd);
10160 install_element (ENABLE_NODE, &clear_bgp_instance_peer_rsclient_cmd);
10161 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_rsclient_cmd);
10162 install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_peer_rsclient_cmd);
10163#endif /* HAVE_IPV6 */
10164
paul718e3742002-12-13 20:15:29 +000010165 /* "show ip bgp summary" commands. */
10166 install_element (VIEW_NODE, &show_ip_bgp_summary_cmd);
10167 install_element (VIEW_NODE, &show_ip_bgp_instance_summary_cmd);
10168 install_element (VIEW_NODE, &show_ip_bgp_ipv4_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010169 install_element (VIEW_NODE, &show_bgp_ipv4_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010170 install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010171 install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010172 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
10173 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
10174#ifdef HAVE_IPV6
10175 install_element (VIEW_NODE, &show_bgp_summary_cmd);
10176 install_element (VIEW_NODE, &show_bgp_instance_summary_cmd);
10177 install_element (VIEW_NODE, &show_bgp_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010178 install_element (VIEW_NODE, &show_bgp_ipv6_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010179 install_element (VIEW_NODE, &show_bgp_instance_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010180 install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010181#endif /* HAVE_IPV6 */
Paul Jakma62687ff2008-08-23 14:27:06 +010010182 install_element (RESTRICTED_NODE, &show_ip_bgp_summary_cmd);
10183 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_summary_cmd);
10184 install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010185 install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010186 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010187 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010188 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
10189 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
10190#ifdef HAVE_IPV6
10191 install_element (RESTRICTED_NODE, &show_bgp_summary_cmd);
10192 install_element (RESTRICTED_NODE, &show_bgp_instance_summary_cmd);
10193 install_element (RESTRICTED_NODE, &show_bgp_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010194 install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010195 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010196 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010197#endif /* HAVE_IPV6 */
paul718e3742002-12-13 20:15:29 +000010198 install_element (ENABLE_NODE, &show_ip_bgp_summary_cmd);
10199 install_element (ENABLE_NODE, &show_ip_bgp_instance_summary_cmd);
10200 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010201 install_element (ENABLE_NODE, &show_bgp_ipv4_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010202 install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010203 install_element (ENABLE_NODE, &show_bgp_instance_ipv4_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010204 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
10205 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
10206#ifdef HAVE_IPV6
10207 install_element (ENABLE_NODE, &show_bgp_summary_cmd);
10208 install_element (ENABLE_NODE, &show_bgp_instance_summary_cmd);
10209 install_element (ENABLE_NODE, &show_bgp_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010210 install_element (ENABLE_NODE, &show_bgp_ipv6_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010211 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010212 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010213#endif /* HAVE_IPV6 */
10214
10215 /* "show ip bgp neighbors" commands. */
10216 install_element (VIEW_NODE, &show_ip_bgp_neighbors_cmd);
10217 install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_cmd);
10218 install_element (VIEW_NODE, &show_ip_bgp_neighbors_peer_cmd);
10219 install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
10220 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd);
10221 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd);
10222 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
10223 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
10224 install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_cmd);
10225 install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010226 install_element (RESTRICTED_NODE, &show_ip_bgp_neighbors_peer_cmd);
10227 install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
10228 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
10229 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
10230 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
paul718e3742002-12-13 20:15:29 +000010231 install_element (ENABLE_NODE, &show_ip_bgp_neighbors_cmd);
10232 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_cmd);
10233 install_element (ENABLE_NODE, &show_ip_bgp_neighbors_peer_cmd);
10234 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
10235 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd);
10236 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd);
10237 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
10238 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
10239 install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_cmd);
10240 install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
10241
10242#ifdef HAVE_IPV6
10243 install_element (VIEW_NODE, &show_bgp_neighbors_cmd);
10244 install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_cmd);
10245 install_element (VIEW_NODE, &show_bgp_neighbors_peer_cmd);
10246 install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
paulbb46e942003-10-24 19:02:03 +000010247 install_element (VIEW_NODE, &show_bgp_instance_neighbors_cmd);
10248 install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_cmd);
10249 install_element (VIEW_NODE, &show_bgp_instance_neighbors_peer_cmd);
10250 install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010251 install_element (RESTRICTED_NODE, &show_bgp_neighbors_peer_cmd);
10252 install_element (RESTRICTED_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
10253 install_element (RESTRICTED_NODE, &show_bgp_instance_neighbors_peer_cmd);
10254 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
paul718e3742002-12-13 20:15:29 +000010255 install_element (ENABLE_NODE, &show_bgp_neighbors_cmd);
10256 install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_cmd);
10257 install_element (ENABLE_NODE, &show_bgp_neighbors_peer_cmd);
10258 install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
paulbb46e942003-10-24 19:02:03 +000010259 install_element (ENABLE_NODE, &show_bgp_instance_neighbors_cmd);
10260 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_cmd);
10261 install_element (ENABLE_NODE, &show_bgp_instance_neighbors_peer_cmd);
10262 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
paul718e3742002-12-13 20:15:29 +000010263
10264 /* Old commands. */
10265 install_element (VIEW_NODE, &show_ipv6_bgp_summary_cmd);
10266 install_element (VIEW_NODE, &show_ipv6_mbgp_summary_cmd);
10267 install_element (ENABLE_NODE, &show_ipv6_bgp_summary_cmd);
10268 install_element (ENABLE_NODE, &show_ipv6_mbgp_summary_cmd);
10269#endif /* HAVE_IPV6 */
10270
paulfee0f4c2004-09-13 05:12:46 +000010271 /* "show ip bgp rsclient" commands. */
10272 install_element (VIEW_NODE, &show_ip_bgp_rsclient_summary_cmd);
10273 install_element (VIEW_NODE, &show_ip_bgp_instance_rsclient_summary_cmd);
10274 install_element (VIEW_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd);
10275 install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010276 install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd);
10277 install_element (VIEW_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010278 install_element (RESTRICTED_NODE, &show_ip_bgp_rsclient_summary_cmd);
10279 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_rsclient_summary_cmd);
10280 install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd);
10281 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010282 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd);
10283 install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000010284 install_element (ENABLE_NODE, &show_ip_bgp_rsclient_summary_cmd);
10285 install_element (ENABLE_NODE, &show_ip_bgp_instance_rsclient_summary_cmd);
10286 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd);
10287 install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010288 install_element (ENABLE_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd);
10289 install_element (ENABLE_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000010290
10291#ifdef HAVE_IPV6
10292 install_element (VIEW_NODE, &show_bgp_rsclient_summary_cmd);
10293 install_element (VIEW_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
10294 install_element (VIEW_NODE, &show_bgp_instance_rsclient_summary_cmd);
10295 install_element (VIEW_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010296 install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd);
10297 install_element (VIEW_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010298 install_element (RESTRICTED_NODE, &show_bgp_rsclient_summary_cmd);
10299 install_element (RESTRICTED_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
10300 install_element (RESTRICTED_NODE, &show_bgp_instance_rsclient_summary_cmd);
10301 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010302 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd);
10303 install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000010304 install_element (ENABLE_NODE, &show_bgp_rsclient_summary_cmd);
10305 install_element (ENABLE_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
10306 install_element (ENABLE_NODE, &show_bgp_instance_rsclient_summary_cmd);
10307 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010308 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd);
10309 install_element (ENABLE_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000010310#endif /* HAVE_IPV6 */
10311
paul718e3742002-12-13 20:15:29 +000010312 /* "show ip bgp paths" commands. */
10313 install_element (VIEW_NODE, &show_ip_bgp_paths_cmd);
10314 install_element (VIEW_NODE, &show_ip_bgp_ipv4_paths_cmd);
10315 install_element (ENABLE_NODE, &show_ip_bgp_paths_cmd);
10316 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_paths_cmd);
10317
10318 /* "show ip bgp community" commands. */
10319 install_element (VIEW_NODE, &show_ip_bgp_community_info_cmd);
10320 install_element (ENABLE_NODE, &show_ip_bgp_community_info_cmd);
10321
10322 /* "show ip bgp attribute-info" commands. */
10323 install_element (VIEW_NODE, &show_ip_bgp_attr_info_cmd);
10324 install_element (ENABLE_NODE, &show_ip_bgp_attr_info_cmd);
10325
10326 /* "redistribute" commands. */
10327 install_element (BGP_NODE, &bgp_redistribute_ipv4_cmd);
10328 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_cmd);
10329 install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_cmd);
10330 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_cmd);
10331 install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_cmd);
10332 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_cmd);
10333 install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_metric_cmd);
10334 install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_rmap_cmd);
10335 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_metric_cmd);
10336 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_rmap_cmd);
10337#ifdef HAVE_IPV6
10338 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_cmd);
10339 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_cmd);
10340 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_cmd);
10341 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_cmd);
10342 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_cmd);
10343 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_cmd);
10344 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_metric_cmd);
10345 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_rmap_cmd);
10346 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_metric_cmd);
10347 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_rmap_cmd);
10348#endif /* HAVE_IPV6 */
10349
Nick Hilliardfa411a22011-03-23 15:33:17 +000010350 /* ttl_security commands */
10351 install_element (BGP_NODE, &neighbor_ttl_security_cmd);
10352 install_element (BGP_NODE, &no_neighbor_ttl_security_cmd);
10353
Paul Jakma4bf6a362006-03-30 14:05:23 +000010354 /* "show bgp memory" commands. */
10355 install_element (VIEW_NODE, &show_bgp_memory_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010356 install_element (RESTRICTED_NODE, &show_bgp_memory_cmd);
Paul Jakma4bf6a362006-03-30 14:05:23 +000010357 install_element (ENABLE_NODE, &show_bgp_memory_cmd);
10358
Michael Lamberte0081f72008-11-16 20:12:04 +000010359 /* "show bgp views" commands. */
10360 install_element (VIEW_NODE, &show_bgp_views_cmd);
10361 install_element (RESTRICTED_NODE, &show_bgp_views_cmd);
10362 install_element (ENABLE_NODE, &show_bgp_views_cmd);
10363
paul718e3742002-12-13 20:15:29 +000010364 /* Community-list. */
10365 community_list_vty ();
10366}
David Lamparter6b0655a2014-06-04 06:53:35 +020010367
paul718e3742002-12-13 20:15:29 +000010368#include "memory.h"
10369#include "bgp_regex.h"
10370#include "bgp_clist.h"
10371#include "bgp_ecommunity.h"
10372
10373/* VTY functions. */
10374
10375/* Direction value to string conversion. */
paul94f2b392005-06-28 12:44:16 +000010376static const char *
paul718e3742002-12-13 20:15:29 +000010377community_direct_str (int direct)
10378{
10379 switch (direct)
10380 {
10381 case COMMUNITY_DENY:
10382 return "deny";
paul718e3742002-12-13 20:15:29 +000010383 case COMMUNITY_PERMIT:
10384 return "permit";
paul718e3742002-12-13 20:15:29 +000010385 default:
10386 return "unknown";
paul718e3742002-12-13 20:15:29 +000010387 }
10388}
10389
10390/* Display error string. */
paul94f2b392005-06-28 12:44:16 +000010391static void
paul718e3742002-12-13 20:15:29 +000010392community_list_perror (struct vty *vty, int ret)
10393{
10394 switch (ret)
10395 {
10396 case COMMUNITY_LIST_ERR_CANT_FIND_LIST:
Denis Ovsienkob7292942010-12-08 18:51:37 +030010397 vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000010398 break;
10399 case COMMUNITY_LIST_ERR_MALFORMED_VAL:
10400 vty_out (vty, "%% Malformed community-list value%s", VTY_NEWLINE);
10401 break;
10402 case COMMUNITY_LIST_ERR_STANDARD_CONFLICT:
10403 vty_out (vty, "%% Community name conflict, previously defined as standard community%s", VTY_NEWLINE);
10404 break;
10405 case COMMUNITY_LIST_ERR_EXPANDED_CONFLICT:
10406 vty_out (vty, "%% Community name conflict, previously defined as expanded community%s", VTY_NEWLINE);
10407 break;
10408 }
10409}
10410
10411/* VTY interface for community_set() function. */
paul94f2b392005-06-28 12:44:16 +000010412static int
paulfd79ac92004-10-13 05:06:08 +000010413community_list_set_vty (struct vty *vty, int argc, const char **argv,
10414 int style, int reject_all_digit_name)
paul718e3742002-12-13 20:15:29 +000010415{
10416 int ret;
10417 int direct;
10418 char *str;
10419
10420 /* Check the list type. */
10421 if (strncmp (argv[1], "p", 1) == 0)
10422 direct = COMMUNITY_PERMIT;
10423 else if (strncmp (argv[1], "d", 1) == 0)
10424 direct = COMMUNITY_DENY;
10425 else
10426 {
10427 vty_out (vty, "%% Matching condition must be permit or deny%s",
10428 VTY_NEWLINE);
10429 return CMD_WARNING;
10430 }
10431
10432 /* All digit name check. */
10433 if (reject_all_digit_name && all_digit (argv[0]))
10434 {
10435 vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE);
10436 return CMD_WARNING;
10437 }
10438
10439 /* Concat community string argument. */
10440 if (argc > 1)
10441 str = argv_concat (argv, argc, 2);
10442 else
10443 str = NULL;
10444
10445 /* When community_list_set() return nevetive value, it means
10446 malformed community string. */
10447 ret = community_list_set (bgp_clist, argv[0], str, direct, style);
10448
10449 /* Free temporary community list string allocated by
10450 argv_concat(). */
10451 if (str)
10452 XFREE (MTYPE_TMP, str);
10453
10454 if (ret < 0)
10455 {
10456 /* Display error string. */
10457 community_list_perror (vty, ret);
10458 return CMD_WARNING;
10459 }
10460
10461 return CMD_SUCCESS;
10462}
10463
paul718e3742002-12-13 20:15:29 +000010464/* Communiyt-list entry delete. */
paul94f2b392005-06-28 12:44:16 +000010465static int
hassofee6e4e2005-02-02 16:29:31 +000010466community_list_unset_vty (struct vty *vty, int argc, const char **argv,
10467 int style)
paul718e3742002-12-13 20:15:29 +000010468{
10469 int ret;
hassofee6e4e2005-02-02 16:29:31 +000010470 int direct = 0;
10471 char *str = NULL;
paul718e3742002-12-13 20:15:29 +000010472
hassofee6e4e2005-02-02 16:29:31 +000010473 if (argc > 1)
paul718e3742002-12-13 20:15:29 +000010474 {
hassofee6e4e2005-02-02 16:29:31 +000010475 /* Check the list direct. */
10476 if (strncmp (argv[1], "p", 1) == 0)
10477 direct = COMMUNITY_PERMIT;
10478 else if (strncmp (argv[1], "d", 1) == 0)
10479 direct = COMMUNITY_DENY;
10480 else
10481 {
10482 vty_out (vty, "%% Matching condition must be permit or deny%s",
10483 VTY_NEWLINE);
10484 return CMD_WARNING;
10485 }
paul718e3742002-12-13 20:15:29 +000010486
hassofee6e4e2005-02-02 16:29:31 +000010487 /* Concat community string argument. */
10488 str = argv_concat (argv, argc, 2);
10489 }
paul718e3742002-12-13 20:15:29 +000010490
10491 /* Unset community list. */
10492 ret = community_list_unset (bgp_clist, argv[0], str, direct, style);
10493
10494 /* Free temporary community list string allocated by
10495 argv_concat(). */
hassofee6e4e2005-02-02 16:29:31 +000010496 if (str)
10497 XFREE (MTYPE_TMP, str);
paul718e3742002-12-13 20:15:29 +000010498
10499 if (ret < 0)
10500 {
10501 community_list_perror (vty, ret);
10502 return CMD_WARNING;
10503 }
10504
10505 return CMD_SUCCESS;
10506}
10507
10508/* "community-list" keyword help string. */
10509#define COMMUNITY_LIST_STR "Add a community list entry\n"
10510#define COMMUNITY_VAL_STR "Community number in aa:nn format or internet|local-AS|no-advertise|no-export\n"
10511
paul718e3742002-12-13 20:15:29 +000010512DEFUN (ip_community_list_standard,
10513 ip_community_list_standard_cmd,
10514 "ip community-list <1-99> (deny|permit) .AA:NN",
10515 IP_STR
10516 COMMUNITY_LIST_STR
10517 "Community list number (standard)\n"
10518 "Specify community to reject\n"
10519 "Specify community to accept\n"
10520 COMMUNITY_VAL_STR)
10521{
10522 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0);
10523}
10524
10525ALIAS (ip_community_list_standard,
10526 ip_community_list_standard2_cmd,
10527 "ip community-list <1-99> (deny|permit)",
10528 IP_STR
10529 COMMUNITY_LIST_STR
10530 "Community list number (standard)\n"
10531 "Specify community to reject\n"
10532 "Specify community to accept\n")
10533
10534DEFUN (ip_community_list_expanded,
10535 ip_community_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000010536 "ip community-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000010537 IP_STR
10538 COMMUNITY_LIST_STR
10539 "Community list number (expanded)\n"
10540 "Specify community to reject\n"
10541 "Specify community to accept\n"
10542 "An ordered list as a regular-expression\n")
10543{
10544 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0);
10545}
10546
10547DEFUN (ip_community_list_name_standard,
10548 ip_community_list_name_standard_cmd,
10549 "ip community-list standard WORD (deny|permit) .AA:NN",
10550 IP_STR
10551 COMMUNITY_LIST_STR
10552 "Add a standard community-list entry\n"
10553 "Community list name\n"
10554 "Specify community to reject\n"
10555 "Specify community to accept\n"
10556 COMMUNITY_VAL_STR)
10557{
10558 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1);
10559}
10560
10561ALIAS (ip_community_list_name_standard,
10562 ip_community_list_name_standard2_cmd,
10563 "ip community-list standard WORD (deny|permit)",
10564 IP_STR
10565 COMMUNITY_LIST_STR
10566 "Add a standard community-list entry\n"
10567 "Community list name\n"
10568 "Specify community to reject\n"
10569 "Specify community to accept\n")
10570
10571DEFUN (ip_community_list_name_expanded,
10572 ip_community_list_name_expanded_cmd,
10573 "ip community-list expanded WORD (deny|permit) .LINE",
10574 IP_STR
10575 COMMUNITY_LIST_STR
10576 "Add an expanded community-list entry\n"
10577 "Community list name\n"
10578 "Specify community to reject\n"
10579 "Specify community to accept\n"
10580 "An ordered list as a regular-expression\n")
10581{
10582 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1);
10583}
10584
hassofee6e4e2005-02-02 16:29:31 +000010585DEFUN (no_ip_community_list_standard_all,
10586 no_ip_community_list_standard_all_cmd,
10587 "no ip community-list <1-99>",
paul718e3742002-12-13 20:15:29 +000010588 NO_STR
10589 IP_STR
10590 COMMUNITY_LIST_STR
hassofee6e4e2005-02-02 16:29:31 +000010591 "Community list number (standard)\n")
paul718e3742002-12-13 20:15:29 +000010592{
hassofee6e4e2005-02-02 16:29:31 +000010593 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
paul718e3742002-12-13 20:15:29 +000010594}
10595
hassofee6e4e2005-02-02 16:29:31 +000010596DEFUN (no_ip_community_list_expanded_all,
10597 no_ip_community_list_expanded_all_cmd,
10598 "no ip community-list <100-500>",
10599 NO_STR
10600 IP_STR
10601 COMMUNITY_LIST_STR
10602 "Community list number (expanded)\n")
10603{
10604 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
10605}
10606
10607DEFUN (no_ip_community_list_name_standard_all,
10608 no_ip_community_list_name_standard_all_cmd,
10609 "no ip community-list standard WORD",
paul718e3742002-12-13 20:15:29 +000010610 NO_STR
10611 IP_STR
10612 COMMUNITY_LIST_STR
10613 "Add a standard community-list entry\n"
paul718e3742002-12-13 20:15:29 +000010614 "Community list name\n")
10615{
hassofee6e4e2005-02-02 16:29:31 +000010616 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
paul718e3742002-12-13 20:15:29 +000010617}
10618
hassofee6e4e2005-02-02 16:29:31 +000010619DEFUN (no_ip_community_list_name_expanded_all,
10620 no_ip_community_list_name_expanded_all_cmd,
10621 "no ip community-list expanded WORD",
paul718e3742002-12-13 20:15:29 +000010622 NO_STR
10623 IP_STR
10624 COMMUNITY_LIST_STR
hassofee6e4e2005-02-02 16:29:31 +000010625 "Add an expanded community-list entry\n"
10626 "Community list name\n")
paul718e3742002-12-13 20:15:29 +000010627{
hassofee6e4e2005-02-02 16:29:31 +000010628 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
paul718e3742002-12-13 20:15:29 +000010629}
10630
10631DEFUN (no_ip_community_list_standard,
10632 no_ip_community_list_standard_cmd,
10633 "no ip community-list <1-99> (deny|permit) .AA:NN",
10634 NO_STR
10635 IP_STR
10636 COMMUNITY_LIST_STR
10637 "Community list number (standard)\n"
10638 "Specify community to reject\n"
10639 "Specify community to accept\n"
10640 COMMUNITY_VAL_STR)
10641{
10642 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
10643}
10644
10645DEFUN (no_ip_community_list_expanded,
10646 no_ip_community_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000010647 "no ip community-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000010648 NO_STR
10649 IP_STR
10650 COMMUNITY_LIST_STR
10651 "Community list number (expanded)\n"
10652 "Specify community to reject\n"
10653 "Specify community to accept\n"
10654 "An ordered list as a regular-expression\n")
10655{
10656 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
10657}
10658
10659DEFUN (no_ip_community_list_name_standard,
10660 no_ip_community_list_name_standard_cmd,
10661 "no ip community-list standard WORD (deny|permit) .AA:NN",
10662 NO_STR
10663 IP_STR
10664 COMMUNITY_LIST_STR
10665 "Specify a standard community-list\n"
10666 "Community list name\n"
10667 "Specify community to reject\n"
10668 "Specify community to accept\n"
10669 COMMUNITY_VAL_STR)
10670{
10671 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
10672}
10673
10674DEFUN (no_ip_community_list_name_expanded,
10675 no_ip_community_list_name_expanded_cmd,
10676 "no ip community-list expanded WORD (deny|permit) .LINE",
10677 NO_STR
10678 IP_STR
10679 COMMUNITY_LIST_STR
10680 "Specify an expanded community-list\n"
10681 "Community list name\n"
10682 "Specify community to reject\n"
10683 "Specify community to accept\n"
10684 "An ordered list as a regular-expression\n")
10685{
10686 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
10687}
10688
paul94f2b392005-06-28 12:44:16 +000010689static void
paul718e3742002-12-13 20:15:29 +000010690community_list_show (struct vty *vty, struct community_list *list)
10691{
10692 struct community_entry *entry;
10693
10694 for (entry = list->head; entry; entry = entry->next)
10695 {
10696 if (entry == list->head)
10697 {
10698 if (all_digit (list->name))
10699 vty_out (vty, "Community %s list %s%s",
10700 entry->style == COMMUNITY_LIST_STANDARD ?
10701 "standard" : "(expanded) access",
10702 list->name, VTY_NEWLINE);
10703 else
10704 vty_out (vty, "Named Community %s list %s%s",
10705 entry->style == COMMUNITY_LIST_STANDARD ?
10706 "standard" : "expanded",
10707 list->name, VTY_NEWLINE);
10708 }
10709 if (entry->any)
10710 vty_out (vty, " %s%s",
10711 community_direct_str (entry->direct), VTY_NEWLINE);
10712 else
10713 vty_out (vty, " %s %s%s",
10714 community_direct_str (entry->direct),
10715 entry->style == COMMUNITY_LIST_STANDARD
10716 ? community_str (entry->u.com) : entry->config,
10717 VTY_NEWLINE);
10718 }
10719}
10720
10721DEFUN (show_ip_community_list,
10722 show_ip_community_list_cmd,
10723 "show ip community-list",
10724 SHOW_STR
10725 IP_STR
10726 "List community-list\n")
10727{
10728 struct community_list *list;
10729 struct community_list_master *cm;
10730
hassofee6e4e2005-02-02 16:29:31 +000010731 cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000010732 if (! cm)
10733 return CMD_SUCCESS;
10734
10735 for (list = cm->num.head; list; list = list->next)
10736 community_list_show (vty, list);
10737
10738 for (list = cm->str.head; list; list = list->next)
10739 community_list_show (vty, list);
10740
10741 return CMD_SUCCESS;
10742}
10743
10744DEFUN (show_ip_community_list_arg,
10745 show_ip_community_list_arg_cmd,
hassofee6e4e2005-02-02 16:29:31 +000010746 "show ip community-list (<1-500>|WORD)",
paul718e3742002-12-13 20:15:29 +000010747 SHOW_STR
10748 IP_STR
10749 "List community-list\n"
10750 "Community-list number\n"
10751 "Community-list name\n")
10752{
10753 struct community_list *list;
10754
hassofee6e4e2005-02-02 16:29:31 +000010755 list = community_list_lookup (bgp_clist, argv[0], COMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000010756 if (! list)
10757 {
Denis Ovsienkob7292942010-12-08 18:51:37 +030010758 vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000010759 return CMD_WARNING;
10760 }
10761
10762 community_list_show (vty, list);
10763
10764 return CMD_SUCCESS;
10765}
David Lamparter6b0655a2014-06-04 06:53:35 +020010766
paul94f2b392005-06-28 12:44:16 +000010767static int
paulfd79ac92004-10-13 05:06:08 +000010768extcommunity_list_set_vty (struct vty *vty, int argc, const char **argv,
10769 int style, int reject_all_digit_name)
paul718e3742002-12-13 20:15:29 +000010770{
10771 int ret;
10772 int direct;
10773 char *str;
10774
10775 /* Check the list type. */
10776 if (strncmp (argv[1], "p", 1) == 0)
10777 direct = COMMUNITY_PERMIT;
10778 else if (strncmp (argv[1], "d", 1) == 0)
10779 direct = COMMUNITY_DENY;
10780 else
10781 {
10782 vty_out (vty, "%% Matching condition must be permit or deny%s",
10783 VTY_NEWLINE);
10784 return CMD_WARNING;
10785 }
10786
10787 /* All digit name check. */
10788 if (reject_all_digit_name && all_digit (argv[0]))
10789 {
10790 vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE);
10791 return CMD_WARNING;
10792 }
10793
10794 /* Concat community string argument. */
10795 if (argc > 1)
10796 str = argv_concat (argv, argc, 2);
10797 else
10798 str = NULL;
10799
10800 ret = extcommunity_list_set (bgp_clist, argv[0], str, direct, style);
10801
10802 /* Free temporary community list string allocated by
10803 argv_concat(). */
10804 if (str)
10805 XFREE (MTYPE_TMP, str);
10806
10807 if (ret < 0)
10808 {
10809 community_list_perror (vty, ret);
10810 return CMD_WARNING;
10811 }
10812 return CMD_SUCCESS;
10813}
10814
paul94f2b392005-06-28 12:44:16 +000010815static int
hassofee6e4e2005-02-02 16:29:31 +000010816extcommunity_list_unset_vty (struct vty *vty, int argc, const char **argv,
10817 int style)
paul718e3742002-12-13 20:15:29 +000010818{
10819 int ret;
hassofee6e4e2005-02-02 16:29:31 +000010820 int direct = 0;
10821 char *str = NULL;
paul718e3742002-12-13 20:15:29 +000010822
hassofee6e4e2005-02-02 16:29:31 +000010823 if (argc > 1)
paul718e3742002-12-13 20:15:29 +000010824 {
hassofee6e4e2005-02-02 16:29:31 +000010825 /* Check the list direct. */
10826 if (strncmp (argv[1], "p", 1) == 0)
10827 direct = COMMUNITY_PERMIT;
10828 else if (strncmp (argv[1], "d", 1) == 0)
10829 direct = COMMUNITY_DENY;
10830 else
10831 {
10832 vty_out (vty, "%% Matching condition must be permit or deny%s",
10833 VTY_NEWLINE);
10834 return CMD_WARNING;
10835 }
10836
10837 /* Concat community string argument. */
10838 str = argv_concat (argv, argc, 2);
paul718e3742002-12-13 20:15:29 +000010839 }
paul718e3742002-12-13 20:15:29 +000010840
10841 /* Unset community list. */
10842 ret = extcommunity_list_unset (bgp_clist, argv[0], str, direct, style);
10843
10844 /* Free temporary community list string allocated by
10845 argv_concat(). */
hassofee6e4e2005-02-02 16:29:31 +000010846 if (str)
10847 XFREE (MTYPE_TMP, str);
paul718e3742002-12-13 20:15:29 +000010848
10849 if (ret < 0)
10850 {
10851 community_list_perror (vty, ret);
10852 return CMD_WARNING;
10853 }
10854
10855 return CMD_SUCCESS;
10856}
10857
10858/* "extcommunity-list" keyword help string. */
10859#define EXTCOMMUNITY_LIST_STR "Add a extended community list entry\n"
10860#define EXTCOMMUNITY_VAL_STR "Extended community attribute in 'rt aa:nn_or_IPaddr:nn' OR 'soo aa:nn_or_IPaddr:nn' format\n"
10861
10862DEFUN (ip_extcommunity_list_standard,
10863 ip_extcommunity_list_standard_cmd,
10864 "ip extcommunity-list <1-99> (deny|permit) .AA:NN",
10865 IP_STR
10866 EXTCOMMUNITY_LIST_STR
10867 "Extended Community list number (standard)\n"
10868 "Specify community to reject\n"
10869 "Specify community to accept\n"
10870 EXTCOMMUNITY_VAL_STR)
10871{
10872 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0);
10873}
10874
10875ALIAS (ip_extcommunity_list_standard,
10876 ip_extcommunity_list_standard2_cmd,
10877 "ip extcommunity-list <1-99> (deny|permit)",
10878 IP_STR
10879 EXTCOMMUNITY_LIST_STR
10880 "Extended Community list number (standard)\n"
10881 "Specify community to reject\n"
10882 "Specify community to accept\n")
10883
10884DEFUN (ip_extcommunity_list_expanded,
10885 ip_extcommunity_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000010886 "ip extcommunity-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000010887 IP_STR
10888 EXTCOMMUNITY_LIST_STR
10889 "Extended Community list number (expanded)\n"
10890 "Specify community to reject\n"
10891 "Specify community to accept\n"
10892 "An ordered list as a regular-expression\n")
10893{
10894 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0);
10895}
10896
10897DEFUN (ip_extcommunity_list_name_standard,
10898 ip_extcommunity_list_name_standard_cmd,
10899 "ip extcommunity-list standard WORD (deny|permit) .AA:NN",
10900 IP_STR
10901 EXTCOMMUNITY_LIST_STR
10902 "Specify standard extcommunity-list\n"
10903 "Extended Community list name\n"
10904 "Specify community to reject\n"
10905 "Specify community to accept\n"
10906 EXTCOMMUNITY_VAL_STR)
10907{
10908 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1);
10909}
10910
10911ALIAS (ip_extcommunity_list_name_standard,
10912 ip_extcommunity_list_name_standard2_cmd,
10913 "ip extcommunity-list standard WORD (deny|permit)",
10914 IP_STR
10915 EXTCOMMUNITY_LIST_STR
10916 "Specify standard extcommunity-list\n"
10917 "Extended Community list name\n"
10918 "Specify community to reject\n"
10919 "Specify community to accept\n")
10920
10921DEFUN (ip_extcommunity_list_name_expanded,
10922 ip_extcommunity_list_name_expanded_cmd,
10923 "ip extcommunity-list expanded WORD (deny|permit) .LINE",
10924 IP_STR
10925 EXTCOMMUNITY_LIST_STR
10926 "Specify expanded extcommunity-list\n"
10927 "Extended Community list name\n"
10928 "Specify community to reject\n"
10929 "Specify community to accept\n"
10930 "An ordered list as a regular-expression\n")
10931{
10932 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1);
10933}
10934
hassofee6e4e2005-02-02 16:29:31 +000010935DEFUN (no_ip_extcommunity_list_standard_all,
10936 no_ip_extcommunity_list_standard_all_cmd,
10937 "no ip extcommunity-list <1-99>",
paul718e3742002-12-13 20:15:29 +000010938 NO_STR
10939 IP_STR
10940 EXTCOMMUNITY_LIST_STR
hassofee6e4e2005-02-02 16:29:31 +000010941 "Extended Community list number (standard)\n")
paul718e3742002-12-13 20:15:29 +000010942{
hassofee6e4e2005-02-02 16:29:31 +000010943 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
paul718e3742002-12-13 20:15:29 +000010944}
10945
hassofee6e4e2005-02-02 16:29:31 +000010946DEFUN (no_ip_extcommunity_list_expanded_all,
10947 no_ip_extcommunity_list_expanded_all_cmd,
10948 "no ip extcommunity-list <100-500>",
10949 NO_STR
10950 IP_STR
10951 EXTCOMMUNITY_LIST_STR
10952 "Extended Community list number (expanded)\n")
10953{
10954 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
10955}
10956
10957DEFUN (no_ip_extcommunity_list_name_standard_all,
10958 no_ip_extcommunity_list_name_standard_all_cmd,
10959 "no ip extcommunity-list standard WORD",
paul718e3742002-12-13 20:15:29 +000010960 NO_STR
10961 IP_STR
10962 EXTCOMMUNITY_LIST_STR
10963 "Specify standard extcommunity-list\n"
hassofee6e4e2005-02-02 16:29:31 +000010964 "Extended Community list name\n")
10965{
10966 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
10967}
10968
10969DEFUN (no_ip_extcommunity_list_name_expanded_all,
10970 no_ip_extcommunity_list_name_expanded_all_cmd,
10971 "no ip extcommunity-list expanded WORD",
10972 NO_STR
10973 IP_STR
10974 EXTCOMMUNITY_LIST_STR
paul718e3742002-12-13 20:15:29 +000010975 "Specify expanded extcommunity-list\n"
10976 "Extended Community list name\n")
10977{
hassofee6e4e2005-02-02 16:29:31 +000010978 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
paul718e3742002-12-13 20:15:29 +000010979}
10980
10981DEFUN (no_ip_extcommunity_list_standard,
10982 no_ip_extcommunity_list_standard_cmd,
10983 "no ip extcommunity-list <1-99> (deny|permit) .AA:NN",
10984 NO_STR
10985 IP_STR
10986 EXTCOMMUNITY_LIST_STR
10987 "Extended Community list number (standard)\n"
10988 "Specify community to reject\n"
10989 "Specify community to accept\n"
10990 EXTCOMMUNITY_VAL_STR)
10991{
10992 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
10993}
10994
10995DEFUN (no_ip_extcommunity_list_expanded,
10996 no_ip_extcommunity_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000010997 "no ip extcommunity-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000010998 NO_STR
10999 IP_STR
11000 EXTCOMMUNITY_LIST_STR
11001 "Extended Community list number (expanded)\n"
11002 "Specify community to reject\n"
11003 "Specify community to accept\n"
11004 "An ordered list as a regular-expression\n")
11005{
11006 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
11007}
11008
11009DEFUN (no_ip_extcommunity_list_name_standard,
11010 no_ip_extcommunity_list_name_standard_cmd,
11011 "no ip extcommunity-list standard WORD (deny|permit) .AA:NN",
11012 NO_STR
11013 IP_STR
11014 EXTCOMMUNITY_LIST_STR
11015 "Specify standard extcommunity-list\n"
11016 "Extended Community list name\n"
11017 "Specify community to reject\n"
11018 "Specify community to accept\n"
11019 EXTCOMMUNITY_VAL_STR)
11020{
11021 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
11022}
11023
11024DEFUN (no_ip_extcommunity_list_name_expanded,
11025 no_ip_extcommunity_list_name_expanded_cmd,
11026 "no ip extcommunity-list expanded WORD (deny|permit) .LINE",
11027 NO_STR
11028 IP_STR
11029 EXTCOMMUNITY_LIST_STR
11030 "Specify expanded extcommunity-list\n"
11031 "Community list name\n"
11032 "Specify community to reject\n"
11033 "Specify community to accept\n"
11034 "An ordered list as a regular-expression\n")
11035{
11036 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
11037}
11038
paul94f2b392005-06-28 12:44:16 +000011039static void
paul718e3742002-12-13 20:15:29 +000011040extcommunity_list_show (struct vty *vty, struct community_list *list)
11041{
11042 struct community_entry *entry;
11043
11044 for (entry = list->head; entry; entry = entry->next)
11045 {
11046 if (entry == list->head)
11047 {
11048 if (all_digit (list->name))
11049 vty_out (vty, "Extended community %s list %s%s",
11050 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
11051 "standard" : "(expanded) access",
11052 list->name, VTY_NEWLINE);
11053 else
11054 vty_out (vty, "Named extended community %s list %s%s",
11055 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
11056 "standard" : "expanded",
11057 list->name, VTY_NEWLINE);
11058 }
11059 if (entry->any)
11060 vty_out (vty, " %s%s",
11061 community_direct_str (entry->direct), VTY_NEWLINE);
11062 else
11063 vty_out (vty, " %s %s%s",
11064 community_direct_str (entry->direct),
11065 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
11066 entry->u.ecom->str : entry->config,
11067 VTY_NEWLINE);
11068 }
11069}
11070
11071DEFUN (show_ip_extcommunity_list,
11072 show_ip_extcommunity_list_cmd,
11073 "show ip extcommunity-list",
11074 SHOW_STR
11075 IP_STR
11076 "List extended-community list\n")
11077{
11078 struct community_list *list;
11079 struct community_list_master *cm;
11080
hassofee6e4e2005-02-02 16:29:31 +000011081 cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011082 if (! cm)
11083 return CMD_SUCCESS;
11084
11085 for (list = cm->num.head; list; list = list->next)
11086 extcommunity_list_show (vty, list);
11087
11088 for (list = cm->str.head; list; list = list->next)
11089 extcommunity_list_show (vty, list);
11090
11091 return CMD_SUCCESS;
11092}
11093
11094DEFUN (show_ip_extcommunity_list_arg,
11095 show_ip_extcommunity_list_arg_cmd,
hassofee6e4e2005-02-02 16:29:31 +000011096 "show ip extcommunity-list (<1-500>|WORD)",
paul718e3742002-12-13 20:15:29 +000011097 SHOW_STR
11098 IP_STR
11099 "List extended-community list\n"
11100 "Extcommunity-list number\n"
11101 "Extcommunity-list name\n")
11102{
11103 struct community_list *list;
11104
hassofee6e4e2005-02-02 16:29:31 +000011105 list = community_list_lookup (bgp_clist, argv[0], EXTCOMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011106 if (! list)
11107 {
Denis Ovsienkob7292942010-12-08 18:51:37 +030011108 vty_out (vty, "%% Can't find extcommunity-list%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000011109 return CMD_WARNING;
11110 }
11111
11112 extcommunity_list_show (vty, list);
11113
11114 return CMD_SUCCESS;
11115}
David Lamparter6b0655a2014-06-04 06:53:35 +020011116
paul718e3742002-12-13 20:15:29 +000011117/* Return configuration string of community-list entry. */
paulfd79ac92004-10-13 05:06:08 +000011118static const char *
paul718e3742002-12-13 20:15:29 +000011119community_list_config_str (struct community_entry *entry)
11120{
paulfd79ac92004-10-13 05:06:08 +000011121 const char *str;
paul718e3742002-12-13 20:15:29 +000011122
11123 if (entry->any)
11124 str = "";
11125 else
11126 {
11127 if (entry->style == COMMUNITY_LIST_STANDARD)
11128 str = community_str (entry->u.com);
11129 else
11130 str = entry->config;
11131 }
11132 return str;
11133}
11134
11135/* Display community-list and extcommunity-list configuration. */
paul94f2b392005-06-28 12:44:16 +000011136static int
paul718e3742002-12-13 20:15:29 +000011137community_list_config_write (struct vty *vty)
11138{
11139 struct community_list *list;
11140 struct community_entry *entry;
11141 struct community_list_master *cm;
11142 int write = 0;
11143
11144 /* Community-list. */
hassofee6e4e2005-02-02 16:29:31 +000011145 cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011146
11147 for (list = cm->num.head; list; list = list->next)
11148 for (entry = list->head; entry; entry = entry->next)
11149 {
hassofee6e4e2005-02-02 16:29:31 +000011150 vty_out (vty, "ip community-list %s %s %s%s",
11151 list->name, community_direct_str (entry->direct),
11152 community_list_config_str (entry),
11153 VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000011154 write++;
11155 }
11156 for (list = cm->str.head; list; list = list->next)
11157 for (entry = list->head; entry; entry = entry->next)
11158 {
11159 vty_out (vty, "ip community-list %s %s %s %s%s",
11160 entry->style == COMMUNITY_LIST_STANDARD
11161 ? "standard" : "expanded",
11162 list->name, community_direct_str (entry->direct),
11163 community_list_config_str (entry),
11164 VTY_NEWLINE);
11165 write++;
11166 }
11167
11168 /* Extcommunity-list. */
hassofee6e4e2005-02-02 16:29:31 +000011169 cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011170
11171 for (list = cm->num.head; list; list = list->next)
11172 for (entry = list->head; entry; entry = entry->next)
11173 {
hassofee6e4e2005-02-02 16:29:31 +000011174 vty_out (vty, "ip extcommunity-list %s %s %s%s",
11175 list->name, community_direct_str (entry->direct),
11176 community_list_config_str (entry), VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000011177 write++;
11178 }
11179 for (list = cm->str.head; list; list = list->next)
11180 for (entry = list->head; entry; entry = entry->next)
11181 {
11182 vty_out (vty, "ip extcommunity-list %s %s %s %s%s",
11183 entry->style == EXTCOMMUNITY_LIST_STANDARD
11184 ? "standard" : "expanded",
11185 list->name, community_direct_str (entry->direct),
11186 community_list_config_str (entry), VTY_NEWLINE);
11187 write++;
11188 }
11189 return write;
11190}
11191
Stephen Hemminger7fc626d2008-12-01 11:10:34 -080011192static struct cmd_node community_list_node =
paul718e3742002-12-13 20:15:29 +000011193{
11194 COMMUNITY_LIST_NODE,
11195 "",
11196 1 /* Export to vtysh. */
11197};
11198
paul94f2b392005-06-28 12:44:16 +000011199static void
11200community_list_vty (void)
paul718e3742002-12-13 20:15:29 +000011201{
11202 install_node (&community_list_node, community_list_config_write);
11203
11204 /* Community-list. */
paul718e3742002-12-13 20:15:29 +000011205 install_element (CONFIG_NODE, &ip_community_list_standard_cmd);
11206 install_element (CONFIG_NODE, &ip_community_list_standard2_cmd);
11207 install_element (CONFIG_NODE, &ip_community_list_expanded_cmd);
11208 install_element (CONFIG_NODE, &ip_community_list_name_standard_cmd);
11209 install_element (CONFIG_NODE, &ip_community_list_name_standard2_cmd);
11210 install_element (CONFIG_NODE, &ip_community_list_name_expanded_cmd);
hassofee6e4e2005-02-02 16:29:31 +000011211 install_element (CONFIG_NODE, &no_ip_community_list_standard_all_cmd);
11212 install_element (CONFIG_NODE, &no_ip_community_list_expanded_all_cmd);
11213 install_element (CONFIG_NODE, &no_ip_community_list_name_standard_all_cmd);
11214 install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_all_cmd);
paul718e3742002-12-13 20:15:29 +000011215 install_element (CONFIG_NODE, &no_ip_community_list_standard_cmd);
11216 install_element (CONFIG_NODE, &no_ip_community_list_expanded_cmd);
11217 install_element (CONFIG_NODE, &no_ip_community_list_name_standard_cmd);
11218 install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_cmd);
11219 install_element (VIEW_NODE, &show_ip_community_list_cmd);
11220 install_element (VIEW_NODE, &show_ip_community_list_arg_cmd);
11221 install_element (ENABLE_NODE, &show_ip_community_list_cmd);
11222 install_element (ENABLE_NODE, &show_ip_community_list_arg_cmd);
11223
11224 /* Extcommunity-list. */
11225 install_element (CONFIG_NODE, &ip_extcommunity_list_standard_cmd);
11226 install_element (CONFIG_NODE, &ip_extcommunity_list_standard2_cmd);
11227 install_element (CONFIG_NODE, &ip_extcommunity_list_expanded_cmd);
11228 install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard_cmd);
11229 install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard2_cmd);
11230 install_element (CONFIG_NODE, &ip_extcommunity_list_name_expanded_cmd);
hassofee6e4e2005-02-02 16:29:31 +000011231 install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_all_cmd);
11232 install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_all_cmd);
11233 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_all_cmd);
11234 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_all_cmd);
paul718e3742002-12-13 20:15:29 +000011235 install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_cmd);
11236 install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_cmd);
11237 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_cmd);
11238 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_cmd);
11239 install_element (VIEW_NODE, &show_ip_extcommunity_list_cmd);
11240 install_element (VIEW_NODE, &show_ip_extcommunity_list_arg_cmd);
11241 install_element (ENABLE_NODE, &show_ip_extcommunity_list_cmd);
11242 install_element (ENABLE_NODE, &show_ip_extcommunity_list_arg_cmd);
11243}