blob: 6f3af9eae66f3d34c9161e11e80cfe9d02dff9cd [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{
paul25ffbdc2005-08-22 22:42:08 +000060 if (vty->node == BGP_IPV6_NODE || vty->node == BGP_IPV6M_NODE)
paul718e3742002-12-13 20:15:29 +000061 return AFI_IP6;
62 return AFI_IP;
63}
64
65/* Utility function to get subsequent address family from current
66 node. */
67safi_t
68bgp_node_safi (struct vty *vty)
69{
70 if (vty->node == BGP_VPNV4_NODE)
71 return SAFI_MPLS_VPN;
paul25ffbdc2005-08-22 22:42:08 +000072 if (vty->node == BGP_IPV4M_NODE || vty->node == BGP_IPV6M_NODE)
paul718e3742002-12-13 20:15:29 +000073 return SAFI_MULTICAST;
74 return SAFI_UNICAST;
75}
76
paul94f2b392005-06-28 12:44:16 +000077static int
paul718e3742002-12-13 20:15:29 +000078peer_address_self_check (union sockunion *su)
79{
80 struct interface *ifp = NULL;
81
82 if (su->sa.sa_family == AF_INET)
83 ifp = if_lookup_by_ipv4_exact (&su->sin.sin_addr);
84#ifdef HAVE_IPV6
85 else if (su->sa.sa_family == AF_INET6)
86 ifp = if_lookup_by_ipv6_exact (&su->sin6.sin6_addr);
87#endif /* HAVE IPV6 */
88
89 if (ifp)
90 return 1;
91
92 return 0;
93}
94
95/* Utility function for looking up peer from VTY. */
paul94f2b392005-06-28 12:44:16 +000096static struct peer *
paulfd79ac92004-10-13 05:06:08 +000097peer_lookup_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +000098{
99 int ret;
100 struct bgp *bgp;
101 union sockunion su;
102 struct peer *peer;
103
104 bgp = vty->index;
105
106 ret = str2sockunion (ip_str, &su);
107 if (ret < 0)
108 {
109 vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE);
110 return NULL;
111 }
112
113 peer = peer_lookup (bgp, &su);
114 if (! peer)
115 {
116 vty_out (vty, "%% Specify remote-as or peer-group commands first%s", VTY_NEWLINE);
117 return NULL;
118 }
119 return peer;
120}
121
122/* Utility function for looking up peer or peer group. */
paul94f2b392005-06-28 12:44:16 +0000123static struct peer *
paulfd79ac92004-10-13 05:06:08 +0000124peer_and_group_lookup_vty (struct vty *vty, const char *peer_str)
paul718e3742002-12-13 20:15:29 +0000125{
126 int ret;
127 struct bgp *bgp;
128 union sockunion su;
129 struct peer *peer;
130 struct peer_group *group;
131
132 bgp = vty->index;
133
134 ret = str2sockunion (peer_str, &su);
135 if (ret == 0)
136 {
137 peer = peer_lookup (bgp, &su);
138 if (peer)
139 return peer;
140 }
141 else
142 {
143 group = peer_group_lookup (bgp, peer_str);
144 if (group)
145 return group->conf;
146 }
147
148 vty_out (vty, "%% Specify remote-as or peer-group commands first%s",
149 VTY_NEWLINE);
150
151 return NULL;
152}
153
paul94f2b392005-06-28 12:44:16 +0000154static int
paul718e3742002-12-13 20:15:29 +0000155bgp_vty_return (struct vty *vty, int ret)
156{
paulfd79ac92004-10-13 05:06:08 +0000157 const char *str = NULL;
paul718e3742002-12-13 20:15:29 +0000158
159 switch (ret)
160 {
161 case BGP_ERR_INVALID_VALUE:
162 str = "Invalid value";
163 break;
164 case BGP_ERR_INVALID_FLAG:
165 str = "Invalid flag";
166 break;
167 case BGP_ERR_PEER_INACTIVE:
168 str = "Activate the neighbor for the address family first";
169 break;
170 case BGP_ERR_INVALID_FOR_PEER_GROUP_MEMBER:
171 str = "Invalid command for a peer-group member";
172 break;
173 case BGP_ERR_PEER_GROUP_SHUTDOWN:
174 str = "Peer-group has been shutdown. Activate the peer-group first";
175 break;
176 case BGP_ERR_PEER_GROUP_HAS_THE_FLAG:
177 str = "This peer is a peer-group member. Please change peer-group configuration";
178 break;
179 case BGP_ERR_PEER_FLAG_CONFLICT:
180 str = "Can't set override-capability and strict-capability-match at the same time";
181 break;
182 case BGP_ERR_PEER_GROUP_MEMBER_EXISTS:
183 str = "No activate for peergroup can be given only if peer-group has no members";
184 break;
185 case BGP_ERR_PEER_BELONGS_TO_GROUP:
186 str = "No activate for an individual peer-group member is invalid";
187 break;
188 case BGP_ERR_PEER_GROUP_AF_UNCONFIGURED:
189 str = "Activate the peer-group for the address family first";
190 break;
191 case BGP_ERR_PEER_GROUP_NO_REMOTE_AS:
192 str = "Specify remote-as or peer-group remote AS first";
193 break;
194 case BGP_ERR_PEER_GROUP_CANT_CHANGE:
195 str = "Cannot change the peer-group. Deconfigure first";
196 break;
197 case BGP_ERR_PEER_GROUP_MISMATCH:
198 str = "Cannot have different peer-group for the neighbor";
199 break;
200 case BGP_ERR_PEER_FILTER_CONFLICT:
201 str = "Prefix/distribute list can not co-exist";
202 break;
203 case BGP_ERR_NOT_INTERNAL_PEER:
204 str = "Invalid command. Not an internal neighbor";
205 break;
206 case BGP_ERR_REMOVE_PRIVATE_AS:
207 str = "Private AS cannot be removed for IBGP peers";
208 break;
209 case BGP_ERR_LOCAL_AS_ALLOWED_ONLY_FOR_EBGP:
210 str = "Local-AS allowed only for EBGP peers";
211 break;
212 case BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS:
213 str = "Cannot have local-as same as BGP AS number";
214 break;
Paul Jakma0df7c912008-07-21 21:02:49 +0000215 case BGP_ERR_TCPSIG_FAILED:
216 str = "Error while applying TCP-Sig to session(s)";
217 break;
Nick Hilliardfa411a22011-03-23 15:33:17 +0000218 case BGP_ERR_NO_EBGP_MULTIHOP_WITH_TTLHACK:
219 str = "ebgp-multihop and ttl-security cannot be configured together";
220 break;
Stephen Hemmingerf5a48272011-03-24 17:30:21 +0000221 case BGP_ERR_NO_IBGP_WITH_TTLHACK:
222 str = "ttl-security only allowed for EBGP peers";
223 break;
paul718e3742002-12-13 20:15:29 +0000224 }
225 if (str)
226 {
227 vty_out (vty, "%% %s%s", str, VTY_NEWLINE);
228 return CMD_WARNING;
229 }
230 return CMD_SUCCESS;
231}
232
233/* BGP global configuration. */
234
235DEFUN (bgp_multiple_instance_func,
236 bgp_multiple_instance_cmd,
237 "bgp multiple-instance",
238 BGP_STR
239 "Enable bgp multiple instance\n")
240{
241 bgp_option_set (BGP_OPT_MULTIPLE_INSTANCE);
242 return CMD_SUCCESS;
243}
244
245DEFUN (no_bgp_multiple_instance,
246 no_bgp_multiple_instance_cmd,
247 "no bgp multiple-instance",
248 NO_STR
249 BGP_STR
250 "BGP multiple instance\n")
251{
252 int ret;
253
254 ret = bgp_option_unset (BGP_OPT_MULTIPLE_INSTANCE);
255 if (ret < 0)
256 {
257 vty_out (vty, "%% There are more than two BGP instances%s", VTY_NEWLINE);
258 return CMD_WARNING;
259 }
260 return CMD_SUCCESS;
261}
262
263DEFUN (bgp_config_type,
264 bgp_config_type_cmd,
265 "bgp config-type (cisco|zebra)",
266 BGP_STR
267 "Configuration type\n"
268 "cisco\n"
269 "zebra\n")
270{
271 if (strncmp (argv[0], "c", 1) == 0)
272 bgp_option_set (BGP_OPT_CONFIG_CISCO);
273 else
274 bgp_option_unset (BGP_OPT_CONFIG_CISCO);
275
276 return CMD_SUCCESS;
277}
278
279DEFUN (no_bgp_config_type,
280 no_bgp_config_type_cmd,
281 "no bgp config-type",
282 NO_STR
283 BGP_STR
284 "Display configuration type\n")
285{
286 bgp_option_unset (BGP_OPT_CONFIG_CISCO);
287 return CMD_SUCCESS;
288}
289
290DEFUN (no_synchronization,
291 no_synchronization_cmd,
292 "no synchronization",
293 NO_STR
294 "Perform IGP synchronization\n")
295{
296 return CMD_SUCCESS;
297}
298
299DEFUN (no_auto_summary,
300 no_auto_summary_cmd,
301 "no auto-summary",
302 NO_STR
303 "Enable automatic network number summarization\n")
304{
305 return CMD_SUCCESS;
306}
hasso3d515fd2005-02-01 21:30:04 +0000307
308DEFUN_DEPRECATED (neighbor_version,
309 neighbor_version_cmd,
310 NEIGHBOR_CMD "version (4|4-)",
311 NEIGHBOR_STR
312 NEIGHBOR_ADDR_STR
313 "Set the BGP version to match a neighbor\n"
314 "Neighbor's BGP version\n")
315{
316 return CMD_SUCCESS;
317}
David Lamparter6b0655a2014-06-04 06:53:35 +0200318
paul718e3742002-12-13 20:15:29 +0000319/* "router bgp" commands. */
320DEFUN (router_bgp,
321 router_bgp_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000322 "router bgp " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000323 ROUTER_STR
324 BGP_STR
325 AS_STR)
326{
327 int ret;
328 as_t as;
329 struct bgp *bgp;
paulfd79ac92004-10-13 05:06:08 +0000330 const char *name = NULL;
paul718e3742002-12-13 20:15:29 +0000331
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000332 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +0000333
334 if (argc == 2)
335 name = argv[1];
336
337 ret = bgp_get (&bgp, &as, name);
338 switch (ret)
339 {
340 case BGP_ERR_MULTIPLE_INSTANCE_NOT_SET:
341 vty_out (vty, "Please specify 'bgp multiple-instance' first%s",
342 VTY_NEWLINE);
343 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +0000344 case BGP_ERR_AS_MISMATCH:
Denis Ovsienkoaea339f2009-04-30 17:16:22 +0400345 vty_out (vty, "BGP is already running; AS is %u%s", as, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +0000346 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +0000347 case BGP_ERR_INSTANCE_MISMATCH:
348 vty_out (vty, "BGP view name and AS number mismatch%s", VTY_NEWLINE);
Denis Ovsienkoaea339f2009-04-30 17:16:22 +0400349 vty_out (vty, "BGP instance is already running; AS is %u%s",
paul718e3742002-12-13 20:15:29 +0000350 as, VTY_NEWLINE);
351 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +0000352 }
353
354 vty->node = BGP_NODE;
355 vty->index = bgp;
356
357 return CMD_SUCCESS;
358}
359
360ALIAS (router_bgp,
361 router_bgp_view_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000362 "router bgp " CMD_AS_RANGE " view WORD",
paul718e3742002-12-13 20:15:29 +0000363 ROUTER_STR
364 BGP_STR
365 AS_STR
366 "BGP view\n"
367 "view name\n")
David Lamparter6b0655a2014-06-04 06:53:35 +0200368
paul718e3742002-12-13 20:15:29 +0000369/* "no router bgp" commands. */
370DEFUN (no_router_bgp,
371 no_router_bgp_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000372 "no router bgp " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000373 NO_STR
374 ROUTER_STR
375 BGP_STR
376 AS_STR)
377{
378 as_t as;
379 struct bgp *bgp;
paulfd79ac92004-10-13 05:06:08 +0000380 const char *name = NULL;
paul718e3742002-12-13 20:15:29 +0000381
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000382 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +0000383
384 if (argc == 2)
385 name = argv[1];
386
387 /* Lookup bgp structure. */
388 bgp = bgp_lookup (as, name);
389 if (! bgp)
390 {
391 vty_out (vty, "%% Can't find BGP instance%s", VTY_NEWLINE);
392 return CMD_WARNING;
393 }
394
395 bgp_delete (bgp);
396
397 return CMD_SUCCESS;
398}
399
400ALIAS (no_router_bgp,
401 no_router_bgp_view_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000402 "no router bgp " CMD_AS_RANGE " view WORD",
paul718e3742002-12-13 20:15:29 +0000403 NO_STR
404 ROUTER_STR
405 BGP_STR
406 AS_STR
407 "BGP view\n"
408 "view name\n")
David Lamparter6b0655a2014-06-04 06:53:35 +0200409
paul718e3742002-12-13 20:15:29 +0000410/* BGP router-id. */
411
412DEFUN (bgp_router_id,
413 bgp_router_id_cmd,
414 "bgp router-id A.B.C.D",
415 BGP_STR
416 "Override configured router identifier\n"
417 "Manually configured router identifier\n")
418{
419 int ret;
420 struct in_addr id;
421 struct bgp *bgp;
422
423 bgp = vty->index;
424
425 ret = inet_aton (argv[0], &id);
426 if (! ret)
427 {
428 vty_out (vty, "%% Malformed bgp router identifier%s", VTY_NEWLINE);
429 return CMD_WARNING;
430 }
431
hasso18a6dce2004-10-03 18:18:34 +0000432 bgp->router_id_static = id;
paul718e3742002-12-13 20:15:29 +0000433 bgp_router_id_set (bgp, &id);
434
435 return CMD_SUCCESS;
436}
437
438DEFUN (no_bgp_router_id,
439 no_bgp_router_id_cmd,
440 "no bgp router-id",
441 NO_STR
442 BGP_STR
443 "Override configured router identifier\n")
444{
445 int ret;
446 struct in_addr id;
447 struct bgp *bgp;
448
449 bgp = vty->index;
450
451 if (argc == 1)
452 {
453 ret = inet_aton (argv[0], &id);
454 if (! ret)
455 {
456 vty_out (vty, "%% Malformed BGP router identifier%s", VTY_NEWLINE);
457 return CMD_WARNING;
458 }
459
hasso18a6dce2004-10-03 18:18:34 +0000460 if (! IPV4_ADDR_SAME (&bgp->router_id_static, &id))
paul718e3742002-12-13 20:15:29 +0000461 {
462 vty_out (vty, "%% BGP router-id doesn't match%s", VTY_NEWLINE);
463 return CMD_WARNING;
464 }
465 }
466
hasso18a6dce2004-10-03 18:18:34 +0000467 bgp->router_id_static.s_addr = 0;
468 bgp_router_id_set (bgp, &router_id_zebra);
paul718e3742002-12-13 20:15:29 +0000469
470 return CMD_SUCCESS;
471}
472
473ALIAS (no_bgp_router_id,
474 no_bgp_router_id_val_cmd,
475 "no bgp router-id A.B.C.D",
476 NO_STR
477 BGP_STR
478 "Override configured router identifier\n"
479 "Manually configured router identifier\n")
David Lamparter6b0655a2014-06-04 06:53:35 +0200480
paul718e3742002-12-13 20:15:29 +0000481/* BGP Cluster ID. */
482
483DEFUN (bgp_cluster_id,
484 bgp_cluster_id_cmd,
485 "bgp cluster-id A.B.C.D",
486 BGP_STR
487 "Configure Route-Reflector Cluster-id\n"
488 "Route-Reflector Cluster-id in IP address format\n")
489{
490 int ret;
491 struct bgp *bgp;
492 struct in_addr cluster;
493
494 bgp = vty->index;
495
496 ret = inet_aton (argv[0], &cluster);
497 if (! ret)
498 {
499 vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE);
500 return CMD_WARNING;
501 }
502
503 bgp_cluster_id_set (bgp, &cluster);
504
505 return CMD_SUCCESS;
506}
507
508ALIAS (bgp_cluster_id,
509 bgp_cluster_id32_cmd,
510 "bgp cluster-id <1-4294967295>",
511 BGP_STR
512 "Configure Route-Reflector Cluster-id\n"
513 "Route-Reflector Cluster-id as 32 bit quantity\n")
514
515DEFUN (no_bgp_cluster_id,
516 no_bgp_cluster_id_cmd,
517 "no bgp cluster-id",
518 NO_STR
519 BGP_STR
520 "Configure Route-Reflector Cluster-id\n")
521{
522 int ret;
523 struct bgp *bgp;
524 struct in_addr cluster;
525
526 bgp = vty->index;
527
528 if (argc == 1)
529 {
530 ret = inet_aton (argv[0], &cluster);
531 if (! ret)
532 {
533 vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE);
534 return CMD_WARNING;
535 }
536 }
537
538 bgp_cluster_id_unset (bgp);
539
540 return CMD_SUCCESS;
541}
542
543ALIAS (no_bgp_cluster_id,
544 no_bgp_cluster_id_arg_cmd,
545 "no bgp cluster-id A.B.C.D",
546 NO_STR
547 BGP_STR
548 "Configure Route-Reflector Cluster-id\n"
549 "Route-Reflector Cluster-id in IP address format\n")
David Lamparter6b0655a2014-06-04 06:53:35 +0200550
paul718e3742002-12-13 20:15:29 +0000551DEFUN (bgp_confederation_identifier,
552 bgp_confederation_identifier_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000553 "bgp confederation identifier " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000554 "BGP specific commands\n"
555 "AS confederation parameters\n"
556 "AS number\n"
557 "Set routing domain confederation AS\n")
558{
559 struct bgp *bgp;
560 as_t as;
561
562 bgp = vty->index;
563
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000564 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +0000565
566 bgp_confederation_id_set (bgp, as);
567
568 return CMD_SUCCESS;
569}
570
571DEFUN (no_bgp_confederation_identifier,
572 no_bgp_confederation_identifier_cmd,
573 "no bgp confederation identifier",
574 NO_STR
575 "BGP specific commands\n"
576 "AS confederation parameters\n"
577 "AS number\n")
578{
579 struct bgp *bgp;
Paul Jakma7aa9dce2014-09-19 14:42:23 +0100580 as_t as __attribute__((unused)); /* Dummy for VTY_GET_INTEGER_RANGE */
paul718e3742002-12-13 20:15:29 +0000581
582 bgp = vty->index;
583
584 if (argc == 1)
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000585 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +0000586
587 bgp_confederation_id_unset (bgp);
588
589 return CMD_SUCCESS;
590}
591
592ALIAS (no_bgp_confederation_identifier,
593 no_bgp_confederation_identifier_arg_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000594 "no bgp confederation identifier " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000595 NO_STR
596 "BGP specific commands\n"
597 "AS confederation parameters\n"
598 "AS number\n"
599 "Set routing domain confederation AS\n")
David Lamparter6b0655a2014-06-04 06:53:35 +0200600
paul718e3742002-12-13 20:15:29 +0000601DEFUN (bgp_confederation_peers,
602 bgp_confederation_peers_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000603 "bgp confederation peers ." CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000604 "BGP specific commands\n"
605 "AS confederation parameters\n"
606 "Peer ASs in BGP confederation\n"
607 AS_STR)
608{
609 struct bgp *bgp;
610 as_t as;
611 int i;
612
613 bgp = vty->index;
614
615 for (i = 0; i < argc; i++)
616 {
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000617 VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +0000618
619 if (bgp->as == as)
620 {
621 vty_out (vty, "%% Local member-AS not allowed in confed peer list%s",
622 VTY_NEWLINE);
623 continue;
624 }
625
626 bgp_confederation_peers_add (bgp, as);
627 }
628 return CMD_SUCCESS;
629}
630
631DEFUN (no_bgp_confederation_peers,
632 no_bgp_confederation_peers_cmd,
Paul Jakma320da872008-07-02 13:40:33 +0000633 "no bgp confederation peers ." CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +0000634 NO_STR
635 "BGP specific commands\n"
636 "AS confederation parameters\n"
637 "Peer ASs in BGP confederation\n"
638 AS_STR)
639{
640 struct bgp *bgp;
641 as_t as;
642 int i;
643
644 bgp = vty->index;
645
646 for (i = 0; i < argc; i++)
647 {
Paul Jakma0b2aa3a2007-10-14 22:32:21 +0000648 VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX);
649
paul718e3742002-12-13 20:15:29 +0000650 bgp_confederation_peers_remove (bgp, as);
651 }
652 return CMD_SUCCESS;
653}
David Lamparter6b0655a2014-06-04 06:53:35 +0200654
Josh Bailey165b5ff2011-07-20 20:43:22 -0700655/* Maximum-paths configuration */
656DEFUN (bgp_maxpaths,
657 bgp_maxpaths_cmd,
658 "maximum-paths <1-255>",
659 "Forward packets over multiple paths\n"
660 "Number of paths\n")
661{
662 struct bgp *bgp;
663 u_int16_t maxpaths;
664 int ret;
665
666 bgp = vty->index;
667
668 VTY_GET_INTEGER_RANGE ("maximum-paths", maxpaths, argv[0], 1, 255);
669
670 ret = bgp_maximum_paths_set (bgp, bgp_node_afi (vty), bgp_node_safi(vty),
671 BGP_PEER_EBGP, maxpaths);
672 if (ret < 0)
673 {
674 vty_out (vty,
675 "%% Failed to set maximum-paths %u for afi %u, safi %u%s",
676 maxpaths, bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE);
677 return CMD_WARNING;
678 }
679
Donald Sharp58a83f22015-09-11 10:11:42 -0400680 if ((MULTIPATH_NUM != 0) && (maxpaths > MULTIPATH_NUM))
681 vty_out (vty,
682 "%% Warning: maximum-paths set to %d is greater than %d that zebra is compiled to support%s",
683 maxpaths, MULTIPATH_NUM, VTY_NEWLINE);
684
Josh Bailey165b5ff2011-07-20 20:43:22 -0700685 return CMD_SUCCESS;
686}
687
688DEFUN (bgp_maxpaths_ibgp,
689 bgp_maxpaths_ibgp_cmd,
690 "maximum-paths ibgp <1-255>",
691 "Forward packets over multiple paths\n"
692 "iBGP-multipath\n"
693 "Number of paths\n")
694{
695 struct bgp *bgp;
696 u_int16_t maxpaths;
697 int ret;
698
699 bgp = vty->index;
700
701 VTY_GET_INTEGER_RANGE ("maximum-paths", maxpaths, argv[0], 1, 255);
702
703 ret = bgp_maximum_paths_set (bgp, bgp_node_afi (vty), bgp_node_safi(vty),
704 BGP_PEER_IBGP, maxpaths);
705 if (ret < 0)
706 {
707 vty_out (vty,
708 "%% Failed to set maximum-paths ibgp %u for afi %u, safi %u%s",
709 maxpaths, bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE);
710 return CMD_WARNING;
711 }
712
Donald Sharp58a83f22015-09-11 10:11:42 -0400713 if ((MULTIPATH_NUM != 0) && (maxpaths > MULTIPATH_NUM))
714 vty_out (vty,
715 "%% Warning: maximum-paths set to %d is greater than %d that zebra is compiled to support%s",
716 maxpaths, MULTIPATH_NUM, VTY_NEWLINE);
717
Josh Bailey165b5ff2011-07-20 20:43:22 -0700718 return CMD_SUCCESS;
719}
720
721DEFUN (no_bgp_maxpaths,
722 no_bgp_maxpaths_cmd,
723 "no maximum-paths",
724 NO_STR
725 "Forward packets over multiple paths\n"
726 "Number of paths\n")
727{
728 struct bgp *bgp;
729 int ret;
730
731 bgp = vty->index;
732
733 ret = bgp_maximum_paths_unset (bgp, bgp_node_afi (vty), bgp_node_safi(vty),
734 BGP_PEER_EBGP);
735 if (ret < 0)
736 {
737 vty_out (vty,
738 "%% Failed to unset maximum-paths for afi %u, safi %u%s",
739 bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE);
740 return CMD_WARNING;
741 }
742
743 return CMD_SUCCESS;
744}
745
746ALIAS (no_bgp_maxpaths,
747 no_bgp_maxpaths_arg_cmd,
748 "no maximum-paths <1-255>",
749 NO_STR
750 "Forward packets over multiple paths\n"
751 "Number of paths\n")
752
753DEFUN (no_bgp_maxpaths_ibgp,
754 no_bgp_maxpaths_ibgp_cmd,
755 "no maximum-paths ibgp",
756 NO_STR
757 "Forward packets over multiple paths\n"
758 "iBGP-multipath\n"
759 "Number of paths\n")
760{
761 struct bgp *bgp;
762 int ret;
763
764 bgp = vty->index;
765
766 ret = bgp_maximum_paths_unset (bgp, bgp_node_afi (vty), bgp_node_safi(vty),
767 BGP_PEER_IBGP);
768 if (ret < 0)
769 {
770 vty_out (vty,
771 "%% Failed to unset maximum-paths ibgp for afi %u, safi %u%s",
772 bgp_node_afi (vty), bgp_node_safi(vty), VTY_NEWLINE);
773 return CMD_WARNING;
774 }
775
776 return CMD_SUCCESS;
777}
778
779ALIAS (no_bgp_maxpaths_ibgp,
780 no_bgp_maxpaths_ibgp_arg_cmd,
781 "no maximum-paths ibgp <1-255>",
782 NO_STR
783 "Forward packets over multiple paths\n"
784 "iBGP-multipath\n"
785 "Number of paths\n")
786
787int
788bgp_config_write_maxpaths (struct vty *vty, struct bgp *bgp, afi_t afi,
789 safi_t safi, int *write)
790{
791 if (bgp->maxpaths[afi][safi].maxpaths_ebgp != BGP_DEFAULT_MAXPATHS)
792 {
793 bgp_config_write_family_header (vty, afi, safi, write);
794 vty_out (vty, " maximum-paths %d%s",
795 bgp->maxpaths[afi][safi].maxpaths_ebgp, VTY_NEWLINE);
796 }
797
798 if (bgp->maxpaths[afi][safi].maxpaths_ibgp != BGP_DEFAULT_MAXPATHS)
799 {
800 bgp_config_write_family_header (vty, afi, safi, write);
801 vty_out (vty, " maximum-paths ibgp %d%s",
802 bgp->maxpaths[afi][safi].maxpaths_ibgp, VTY_NEWLINE);
803 }
804
805 return 0;
806}
David Lamparter6b0655a2014-06-04 06:53:35 +0200807
paul718e3742002-12-13 20:15:29 +0000808/* BGP timers. */
809
810DEFUN (bgp_timers,
811 bgp_timers_cmd,
812 "timers bgp <0-65535> <0-65535>",
813 "Adjust routing timers\n"
814 "BGP timers\n"
815 "Keepalive interval\n"
816 "Holdtime\n")
817{
818 struct bgp *bgp;
819 unsigned long keepalive = 0;
820 unsigned long holdtime = 0;
821
822 bgp = vty->index;
823
824 VTY_GET_INTEGER ("keepalive", keepalive, argv[0]);
825 VTY_GET_INTEGER ("holdtime", holdtime, argv[1]);
826
827 /* Holdtime value check. */
828 if (holdtime < 3 && holdtime != 0)
829 {
830 vty_out (vty, "%% hold time value must be either 0 or greater than 3%s",
831 VTY_NEWLINE);
832 return CMD_WARNING;
833 }
834
835 bgp_timers_set (bgp, keepalive, holdtime);
836
837 return CMD_SUCCESS;
838}
839
840DEFUN (no_bgp_timers,
841 no_bgp_timers_cmd,
842 "no timers bgp",
843 NO_STR
844 "Adjust routing timers\n"
845 "BGP timers\n")
846{
847 struct bgp *bgp;
848
849 bgp = vty->index;
850 bgp_timers_unset (bgp);
851
852 return CMD_SUCCESS;
853}
854
855ALIAS (no_bgp_timers,
856 no_bgp_timers_arg_cmd,
857 "no timers bgp <0-65535> <0-65535>",
858 NO_STR
859 "Adjust routing timers\n"
860 "BGP timers\n"
861 "Keepalive interval\n"
862 "Holdtime\n")
David Lamparter6b0655a2014-06-04 06:53:35 +0200863
paul718e3742002-12-13 20:15:29 +0000864DEFUN (bgp_client_to_client_reflection,
865 bgp_client_to_client_reflection_cmd,
866 "bgp client-to-client reflection",
867 "BGP specific commands\n"
868 "Configure client to client route reflection\n"
869 "reflection of routes allowed\n")
870{
871 struct bgp *bgp;
872
873 bgp = vty->index;
874 bgp_flag_unset (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT);
875 return CMD_SUCCESS;
876}
877
878DEFUN (no_bgp_client_to_client_reflection,
879 no_bgp_client_to_client_reflection_cmd,
880 "no bgp client-to-client reflection",
881 NO_STR
882 "BGP specific commands\n"
883 "Configure client to client route reflection\n"
884 "reflection of routes allowed\n")
885{
886 struct bgp *bgp;
887
888 bgp = vty->index;
889 bgp_flag_set (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT);
890 return CMD_SUCCESS;
891}
892
893/* "bgp always-compare-med" configuration. */
894DEFUN (bgp_always_compare_med,
895 bgp_always_compare_med_cmd,
896 "bgp always-compare-med",
897 "BGP specific commands\n"
898 "Allow comparing MED from different neighbors\n")
899{
900 struct bgp *bgp;
901
902 bgp = vty->index;
903 bgp_flag_set (bgp, BGP_FLAG_ALWAYS_COMPARE_MED);
904 return CMD_SUCCESS;
905}
906
907DEFUN (no_bgp_always_compare_med,
908 no_bgp_always_compare_med_cmd,
909 "no bgp always-compare-med",
910 NO_STR
911 "BGP specific commands\n"
912 "Allow comparing MED from different neighbors\n")
913{
914 struct bgp *bgp;
915
916 bgp = vty->index;
917 bgp_flag_unset (bgp, BGP_FLAG_ALWAYS_COMPARE_MED);
918 return CMD_SUCCESS;
919}
David Lamparter6b0655a2014-06-04 06:53:35 +0200920
paul718e3742002-12-13 20:15:29 +0000921/* "bgp deterministic-med" configuration. */
922DEFUN (bgp_deterministic_med,
923 bgp_deterministic_med_cmd,
924 "bgp deterministic-med",
925 "BGP specific commands\n"
926 "Pick the best-MED path among paths advertised from the neighboring AS\n")
927{
928 struct bgp *bgp;
929
930 bgp = vty->index;
931 bgp_flag_set (bgp, BGP_FLAG_DETERMINISTIC_MED);
932 return CMD_SUCCESS;
933}
934
935DEFUN (no_bgp_deterministic_med,
936 no_bgp_deterministic_med_cmd,
937 "no bgp deterministic-med",
938 NO_STR
939 "BGP specific commands\n"
940 "Pick the best-MED path among paths advertised from the neighboring AS\n")
941{
942 struct bgp *bgp;
943
944 bgp = vty->index;
945 bgp_flag_unset (bgp, BGP_FLAG_DETERMINISTIC_MED);
946 return CMD_SUCCESS;
947}
hasso538621f2004-05-21 09:31:30 +0000948
949/* "bgp graceful-restart" configuration. */
950DEFUN (bgp_graceful_restart,
951 bgp_graceful_restart_cmd,
952 "bgp graceful-restart",
953 "BGP specific commands\n"
954 "Graceful restart capability parameters\n")
955{
956 struct bgp *bgp;
957
958 bgp = vty->index;
959 bgp_flag_set (bgp, BGP_FLAG_GRACEFUL_RESTART);
960 return CMD_SUCCESS;
961}
962
963DEFUN (no_bgp_graceful_restart,
964 no_bgp_graceful_restart_cmd,
965 "no bgp graceful-restart",
966 NO_STR
967 "BGP specific commands\n"
968 "Graceful restart capability parameters\n")
969{
970 struct bgp *bgp;
971
972 bgp = vty->index;
973 bgp_flag_unset (bgp, BGP_FLAG_GRACEFUL_RESTART);
974 return CMD_SUCCESS;
975}
976
hasso93406d82005-02-02 14:40:33 +0000977DEFUN (bgp_graceful_restart_stalepath_time,
978 bgp_graceful_restart_stalepath_time_cmd,
979 "bgp graceful-restart stalepath-time <1-3600>",
980 "BGP specific commands\n"
981 "Graceful restart capability parameters\n"
982 "Set the max time to hold onto restarting peer's stale paths\n"
983 "Delay value (seconds)\n")
984{
985 struct bgp *bgp;
986 u_int32_t stalepath;
987
988 bgp = vty->index;
989 if (! bgp)
990 return CMD_WARNING;
991
992 VTY_GET_INTEGER_RANGE ("stalepath-time", stalepath, argv[0], 1, 3600);
993 bgp->stalepath_time = stalepath;
994 return CMD_SUCCESS;
995}
996
997DEFUN (no_bgp_graceful_restart_stalepath_time,
998 no_bgp_graceful_restart_stalepath_time_cmd,
999 "no bgp graceful-restart stalepath-time",
1000 NO_STR
1001 "BGP specific commands\n"
1002 "Graceful restart capability parameters\n"
1003 "Set the max time to hold onto restarting peer's stale paths\n")
1004{
1005 struct bgp *bgp;
1006
1007 bgp = vty->index;
1008 if (! bgp)
1009 return CMD_WARNING;
1010
1011 bgp->stalepath_time = BGP_DEFAULT_STALEPATH_TIME;
1012 return CMD_SUCCESS;
1013}
1014
1015ALIAS (no_bgp_graceful_restart_stalepath_time,
1016 no_bgp_graceful_restart_stalepath_time_val_cmd,
1017 "no bgp graceful-restart stalepath-time <1-3600>",
1018 NO_STR
1019 "BGP specific commands\n"
1020 "Graceful restart capability parameters\n"
1021 "Set the max time to hold onto restarting peer's stale paths\n"
1022 "Delay value (seconds)\n")
1023
paul718e3742002-12-13 20:15:29 +00001024/* "bgp fast-external-failover" configuration. */
1025DEFUN (bgp_fast_external_failover,
1026 bgp_fast_external_failover_cmd,
1027 "bgp fast-external-failover",
1028 BGP_STR
1029 "Immediately reset session if a link to a directly connected external peer goes down\n")
1030{
1031 struct bgp *bgp;
1032
1033 bgp = vty->index;
1034 bgp_flag_unset (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER);
1035 return CMD_SUCCESS;
1036}
1037
1038DEFUN (no_bgp_fast_external_failover,
1039 no_bgp_fast_external_failover_cmd,
1040 "no bgp fast-external-failover",
1041 NO_STR
1042 BGP_STR
1043 "Immediately reset session if a link to a directly connected external peer goes down\n")
1044{
1045 struct bgp *bgp;
1046
1047 bgp = vty->index;
1048 bgp_flag_set (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER);
1049 return CMD_SUCCESS;
1050}
David Lamparter6b0655a2014-06-04 06:53:35 +02001051
paul718e3742002-12-13 20:15:29 +00001052/* "bgp enforce-first-as" configuration. */
1053DEFUN (bgp_enforce_first_as,
1054 bgp_enforce_first_as_cmd,
1055 "bgp enforce-first-as",
1056 BGP_STR
1057 "Enforce the first AS for EBGP routes\n")
1058{
1059 struct bgp *bgp;
1060
1061 bgp = vty->index;
1062 bgp_flag_set (bgp, BGP_FLAG_ENFORCE_FIRST_AS);
1063 return CMD_SUCCESS;
1064}
1065
1066DEFUN (no_bgp_enforce_first_as,
1067 no_bgp_enforce_first_as_cmd,
1068 "no bgp enforce-first-as",
1069 NO_STR
1070 BGP_STR
1071 "Enforce the first AS for EBGP routes\n")
1072{
1073 struct bgp *bgp;
1074
1075 bgp = vty->index;
1076 bgp_flag_unset (bgp, BGP_FLAG_ENFORCE_FIRST_AS);
1077 return CMD_SUCCESS;
1078}
David Lamparter6b0655a2014-06-04 06:53:35 +02001079
paul718e3742002-12-13 20:15:29 +00001080/* "bgp bestpath compare-routerid" configuration. */
1081DEFUN (bgp_bestpath_compare_router_id,
1082 bgp_bestpath_compare_router_id_cmd,
1083 "bgp bestpath compare-routerid",
1084 "BGP specific commands\n"
1085 "Change the default bestpath selection\n"
1086 "Compare router-id for identical EBGP paths\n")
1087{
1088 struct bgp *bgp;
1089
1090 bgp = vty->index;
1091 bgp_flag_set (bgp, BGP_FLAG_COMPARE_ROUTER_ID);
1092 return CMD_SUCCESS;
1093}
1094
1095DEFUN (no_bgp_bestpath_compare_router_id,
1096 no_bgp_bestpath_compare_router_id_cmd,
1097 "no bgp bestpath compare-routerid",
1098 NO_STR
1099 "BGP specific commands\n"
1100 "Change the default bestpath selection\n"
1101 "Compare router-id for identical EBGP paths\n")
1102{
1103 struct bgp *bgp;
1104
1105 bgp = vty->index;
1106 bgp_flag_unset (bgp, BGP_FLAG_COMPARE_ROUTER_ID);
1107 return CMD_SUCCESS;
1108}
David Lamparter6b0655a2014-06-04 06:53:35 +02001109
paul718e3742002-12-13 20:15:29 +00001110/* "bgp bestpath as-path ignore" configuration. */
1111DEFUN (bgp_bestpath_aspath_ignore,
1112 bgp_bestpath_aspath_ignore_cmd,
1113 "bgp bestpath as-path ignore",
1114 "BGP specific commands\n"
1115 "Change the default bestpath selection\n"
1116 "AS-path attribute\n"
1117 "Ignore as-path length in selecting a route\n")
1118{
1119 struct bgp *bgp;
1120
1121 bgp = vty->index;
1122 bgp_flag_set (bgp, BGP_FLAG_ASPATH_IGNORE);
1123 return CMD_SUCCESS;
1124}
1125
1126DEFUN (no_bgp_bestpath_aspath_ignore,
1127 no_bgp_bestpath_aspath_ignore_cmd,
1128 "no bgp bestpath as-path ignore",
1129 NO_STR
1130 "BGP specific commands\n"
1131 "Change the default bestpath selection\n"
1132 "AS-path attribute\n"
1133 "Ignore as-path length in selecting a route\n")
1134{
1135 struct bgp *bgp;
1136
1137 bgp = vty->index;
1138 bgp_flag_unset (bgp, BGP_FLAG_ASPATH_IGNORE);
1139 return CMD_SUCCESS;
1140}
David Lamparter6b0655a2014-06-04 06:53:35 +02001141
hasso68118452005-04-08 15:40:36 +00001142/* "bgp bestpath as-path confed" configuration. */
1143DEFUN (bgp_bestpath_aspath_confed,
1144 bgp_bestpath_aspath_confed_cmd,
1145 "bgp bestpath as-path confed",
1146 "BGP specific commands\n"
1147 "Change the default bestpath selection\n"
1148 "AS-path attribute\n"
1149 "Compare path lengths including confederation sets & sequences in selecting a route\n")
1150{
1151 struct bgp *bgp;
1152
1153 bgp = vty->index;
1154 bgp_flag_set (bgp, BGP_FLAG_ASPATH_CONFED);
1155 return CMD_SUCCESS;
1156}
1157
1158DEFUN (no_bgp_bestpath_aspath_confed,
1159 no_bgp_bestpath_aspath_confed_cmd,
1160 "no bgp bestpath as-path confed",
1161 NO_STR
1162 "BGP specific commands\n"
1163 "Change the default bestpath selection\n"
1164 "AS-path attribute\n"
1165 "Compare path lengths including confederation sets & sequences in selecting a route\n")
1166{
1167 struct bgp *bgp;
1168
1169 bgp = vty->index;
1170 bgp_flag_unset (bgp, BGP_FLAG_ASPATH_CONFED);
1171 return CMD_SUCCESS;
1172}
David Lamparter6b0655a2014-06-04 06:53:35 +02001173
Pradosh Mohapatra2fdd4552013-09-07 07:02:36 +00001174/* "bgp bestpath as-path multipath-relax" configuration. */
1175DEFUN (bgp_bestpath_aspath_multipath_relax,
1176 bgp_bestpath_aspath_multipath_relax_cmd,
1177 "bgp bestpath as-path multipath-relax",
1178 "BGP specific commands\n"
1179 "Change the default bestpath selection\n"
1180 "AS-path attribute\n"
1181 "Allow load sharing across routes that have different AS paths (but same length)\n")
1182{
1183 struct bgp *bgp;
1184
1185 bgp = vty->index;
1186 bgp_flag_set (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX);
1187 return CMD_SUCCESS;
1188}
1189
1190DEFUN (no_bgp_bestpath_aspath_multipath_relax,
1191 no_bgp_bestpath_aspath_multipath_relax_cmd,
1192 "no bgp bestpath as-path multipath-relax",
1193 NO_STR
1194 "BGP specific commands\n"
1195 "Change the default bestpath selection\n"
1196 "AS-path attribute\n"
1197 "Allow load sharing across routes that have different AS paths (but same length)\n")
1198{
1199 struct bgp *bgp;
1200
1201 bgp = vty->index;
1202 bgp_flag_unset (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX);
1203 return CMD_SUCCESS;
1204}
David Lamparter6b0655a2014-06-04 06:53:35 +02001205
paul848973c2003-08-13 00:32:49 +00001206/* "bgp log-neighbor-changes" configuration. */
1207DEFUN (bgp_log_neighbor_changes,
1208 bgp_log_neighbor_changes_cmd,
1209 "bgp log-neighbor-changes",
1210 "BGP specific commands\n"
1211 "Log neighbor up/down and reset reason\n")
1212{
1213 struct bgp *bgp;
1214
1215 bgp = vty->index;
1216 bgp_flag_set (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES);
1217 return CMD_SUCCESS;
1218}
1219
1220DEFUN (no_bgp_log_neighbor_changes,
1221 no_bgp_log_neighbor_changes_cmd,
1222 "no bgp log-neighbor-changes",
1223 NO_STR
1224 "BGP specific commands\n"
1225 "Log neighbor up/down and reset reason\n")
1226{
1227 struct bgp *bgp;
1228
1229 bgp = vty->index;
1230 bgp_flag_unset (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES);
1231 return CMD_SUCCESS;
1232}
David Lamparter6b0655a2014-06-04 06:53:35 +02001233
paul718e3742002-12-13 20:15:29 +00001234/* "bgp bestpath med" configuration. */
1235DEFUN (bgp_bestpath_med,
1236 bgp_bestpath_med_cmd,
1237 "bgp bestpath med (confed|missing-as-worst)",
1238 "BGP specific commands\n"
1239 "Change the default bestpath selection\n"
1240 "MED attribute\n"
1241 "Compare MED among confederation paths\n"
1242 "Treat missing MED as the least preferred one\n")
1243{
1244 struct bgp *bgp;
1245
1246 bgp = vty->index;
1247
1248 if (strncmp (argv[0], "confed", 1) == 0)
1249 bgp_flag_set (bgp, BGP_FLAG_MED_CONFED);
1250 else
1251 bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1252
1253 return CMD_SUCCESS;
1254}
1255
1256DEFUN (bgp_bestpath_med2,
1257 bgp_bestpath_med2_cmd,
1258 "bgp bestpath med confed missing-as-worst",
1259 "BGP specific commands\n"
1260 "Change the default bestpath selection\n"
1261 "MED attribute\n"
1262 "Compare MED among confederation paths\n"
1263 "Treat missing MED as the least preferred one\n")
1264{
1265 struct bgp *bgp;
1266
1267 bgp = vty->index;
1268 bgp_flag_set (bgp, BGP_FLAG_MED_CONFED);
1269 bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1270 return CMD_SUCCESS;
1271}
1272
1273ALIAS (bgp_bestpath_med2,
1274 bgp_bestpath_med3_cmd,
1275 "bgp bestpath med missing-as-worst confed",
1276 "BGP specific commands\n"
1277 "Change the default bestpath selection\n"
1278 "MED attribute\n"
1279 "Treat missing MED as the least preferred one\n"
1280 "Compare MED among confederation paths\n")
1281
1282DEFUN (no_bgp_bestpath_med,
1283 no_bgp_bestpath_med_cmd,
1284 "no bgp bestpath med (confed|missing-as-worst)",
1285 NO_STR
1286 "BGP specific commands\n"
1287 "Change the default bestpath selection\n"
1288 "MED attribute\n"
1289 "Compare MED among confederation paths\n"
1290 "Treat missing MED as the least preferred one\n")
1291{
1292 struct bgp *bgp;
1293
1294 bgp = vty->index;
1295
1296 if (strncmp (argv[0], "confed", 1) == 0)
1297 bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED);
1298 else
1299 bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1300
1301 return CMD_SUCCESS;
1302}
1303
1304DEFUN (no_bgp_bestpath_med2,
1305 no_bgp_bestpath_med2_cmd,
1306 "no bgp bestpath med confed missing-as-worst",
1307 NO_STR
1308 "BGP specific commands\n"
1309 "Change the default bestpath selection\n"
1310 "MED attribute\n"
1311 "Compare MED among confederation paths\n"
1312 "Treat missing MED as the least preferred one\n")
1313{
1314 struct bgp *bgp;
1315
1316 bgp = vty->index;
1317 bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED);
1318 bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1319 return CMD_SUCCESS;
1320}
1321
1322ALIAS (no_bgp_bestpath_med2,
1323 no_bgp_bestpath_med3_cmd,
1324 "no bgp bestpath med missing-as-worst confed",
1325 NO_STR
1326 "BGP specific commands\n"
1327 "Change the default bestpath selection\n"
1328 "MED attribute\n"
1329 "Treat missing MED as the least preferred one\n"
1330 "Compare MED among confederation paths\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02001331
paul718e3742002-12-13 20:15:29 +00001332/* "no bgp default ipv4-unicast". */
1333DEFUN (no_bgp_default_ipv4_unicast,
1334 no_bgp_default_ipv4_unicast_cmd,
1335 "no bgp default ipv4-unicast",
1336 NO_STR
1337 "BGP specific commands\n"
1338 "Configure BGP defaults\n"
1339 "Activate ipv4-unicast for a peer by default\n")
1340{
1341 struct bgp *bgp;
1342
1343 bgp = vty->index;
1344 bgp_flag_set (bgp, BGP_FLAG_NO_DEFAULT_IPV4);
1345 return CMD_SUCCESS;
1346}
1347
1348DEFUN (bgp_default_ipv4_unicast,
1349 bgp_default_ipv4_unicast_cmd,
1350 "bgp default ipv4-unicast",
1351 "BGP specific commands\n"
1352 "Configure BGP defaults\n"
1353 "Activate ipv4-unicast for a peer by default\n")
1354{
1355 struct bgp *bgp;
1356
1357 bgp = vty->index;
1358 bgp_flag_unset (bgp, BGP_FLAG_NO_DEFAULT_IPV4);
1359 return CMD_SUCCESS;
1360}
David Lamparter6b0655a2014-06-04 06:53:35 +02001361
paul718e3742002-12-13 20:15:29 +00001362/* "bgp import-check" configuration. */
1363DEFUN (bgp_network_import_check,
1364 bgp_network_import_check_cmd,
1365 "bgp network import-check",
1366 "BGP specific commands\n"
1367 "BGP network command\n"
1368 "Check BGP network route exists in IGP\n")
1369{
1370 struct bgp *bgp;
1371
1372 bgp = vty->index;
1373 bgp_flag_set (bgp, BGP_FLAG_IMPORT_CHECK);
1374 return CMD_SUCCESS;
1375}
1376
1377DEFUN (no_bgp_network_import_check,
1378 no_bgp_network_import_check_cmd,
1379 "no bgp network import-check",
1380 NO_STR
1381 "BGP specific commands\n"
1382 "BGP network command\n"
1383 "Check BGP network route exists in IGP\n")
1384{
1385 struct bgp *bgp;
1386
1387 bgp = vty->index;
1388 bgp_flag_unset (bgp, BGP_FLAG_IMPORT_CHECK);
1389 return CMD_SUCCESS;
1390}
David Lamparter6b0655a2014-06-04 06:53:35 +02001391
paul718e3742002-12-13 20:15:29 +00001392DEFUN (bgp_default_local_preference,
1393 bgp_default_local_preference_cmd,
1394 "bgp default local-preference <0-4294967295>",
1395 "BGP specific commands\n"
1396 "Configure BGP defaults\n"
1397 "local preference (higher=more preferred)\n"
1398 "Configure default local preference value\n")
1399{
1400 struct bgp *bgp;
1401 u_int32_t local_pref;
1402
1403 bgp = vty->index;
1404
1405 VTY_GET_INTEGER ("local preference", local_pref, argv[0]);
1406
1407 bgp_default_local_preference_set (bgp, local_pref);
1408
1409 return CMD_SUCCESS;
1410}
1411
1412DEFUN (no_bgp_default_local_preference,
1413 no_bgp_default_local_preference_cmd,
1414 "no bgp default local-preference",
1415 NO_STR
1416 "BGP specific commands\n"
1417 "Configure BGP defaults\n"
1418 "local preference (higher=more preferred)\n")
1419{
1420 struct bgp *bgp;
1421
1422 bgp = vty->index;
1423 bgp_default_local_preference_unset (bgp);
1424 return CMD_SUCCESS;
1425}
1426
1427ALIAS (no_bgp_default_local_preference,
1428 no_bgp_default_local_preference_val_cmd,
1429 "no bgp default local-preference <0-4294967295>",
1430 NO_STR
1431 "BGP specific commands\n"
1432 "Configure BGP defaults\n"
1433 "local preference (higher=more preferred)\n"
1434 "Configure default local preference value\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02001435
paul718e3742002-12-13 20:15:29 +00001436static int
paulfd79ac92004-10-13 05:06:08 +00001437peer_remote_as_vty (struct vty *vty, const char *peer_str,
1438 const char *as_str, afi_t afi, safi_t safi)
paul718e3742002-12-13 20:15:29 +00001439{
1440 int ret;
1441 struct bgp *bgp;
1442 as_t as;
1443 union sockunion su;
1444
1445 bgp = vty->index;
1446
1447 /* Get AS number. */
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00001448 VTY_GET_INTEGER_RANGE ("AS", as, as_str, 1, BGP_AS4_MAX);
paul718e3742002-12-13 20:15:29 +00001449
1450 /* If peer is peer group, call proper function. */
1451 ret = str2sockunion (peer_str, &su);
1452 if (ret < 0)
1453 {
1454 ret = peer_group_remote_as (bgp, peer_str, &as);
1455 if (ret < 0)
1456 {
1457 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1458 return CMD_WARNING;
1459 }
1460 return CMD_SUCCESS;
1461 }
1462
1463 if (peer_address_self_check (&su))
1464 {
1465 vty_out (vty, "%% Can not configure the local system as neighbor%s",
1466 VTY_NEWLINE);
1467 return CMD_WARNING;
1468 }
1469
1470 ret = peer_remote_as (bgp, &su, &as, afi, safi);
1471
1472 /* This peer belongs to peer group. */
1473 switch (ret)
1474 {
1475 case BGP_ERR_PEER_GROUP_MEMBER:
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04001476 vty_out (vty, "%% Peer-group AS %u. Cannot configure remote-as for member%s", as, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00001477 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00001478 case BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT:
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04001479 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 +00001480 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00001481 }
1482 return bgp_vty_return (vty, ret);
1483}
1484
1485DEFUN (neighbor_remote_as,
1486 neighbor_remote_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001487 NEIGHBOR_CMD2 "remote-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001488 NEIGHBOR_STR
1489 NEIGHBOR_ADDR_STR2
1490 "Specify a BGP neighbor\n"
1491 AS_STR)
1492{
1493 return peer_remote_as_vty (vty, argv[0], argv[1], AFI_IP, SAFI_UNICAST);
1494}
David Lamparter6b0655a2014-06-04 06:53:35 +02001495
paul718e3742002-12-13 20:15:29 +00001496DEFUN (neighbor_peer_group,
1497 neighbor_peer_group_cmd,
1498 "neighbor WORD peer-group",
1499 NEIGHBOR_STR
1500 "Neighbor tag\n"
1501 "Configure peer-group\n")
1502{
1503 struct bgp *bgp;
1504 struct peer_group *group;
1505
1506 bgp = vty->index;
1507
1508 group = peer_group_get (bgp, argv[0]);
1509 if (! group)
1510 return CMD_WARNING;
1511
1512 return CMD_SUCCESS;
1513}
1514
1515DEFUN (no_neighbor,
1516 no_neighbor_cmd,
1517 NO_NEIGHBOR_CMD2,
1518 NO_STR
1519 NEIGHBOR_STR
1520 NEIGHBOR_ADDR_STR2)
1521{
1522 int ret;
1523 union sockunion su;
1524 struct peer_group *group;
1525 struct peer *peer;
1526
1527 ret = str2sockunion (argv[0], &su);
1528 if (ret < 0)
1529 {
1530 group = peer_group_lookup (vty->index, argv[0]);
1531 if (group)
1532 peer_group_delete (group);
1533 else
1534 {
1535 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1536 return CMD_WARNING;
1537 }
1538 }
1539 else
1540 {
1541 peer = peer_lookup (vty->index, &su);
1542 if (peer)
paul200df112005-06-01 11:17:05 +00001543 peer_delete (peer);
paul718e3742002-12-13 20:15:29 +00001544 }
1545
1546 return CMD_SUCCESS;
1547}
1548
1549ALIAS (no_neighbor,
1550 no_neighbor_remote_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001551 NO_NEIGHBOR_CMD "remote-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001552 NO_STR
1553 NEIGHBOR_STR
1554 NEIGHBOR_ADDR_STR
1555 "Specify a BGP neighbor\n"
1556 AS_STR)
1557
1558DEFUN (no_neighbor_peer_group,
1559 no_neighbor_peer_group_cmd,
1560 "no neighbor WORD peer-group",
1561 NO_STR
1562 NEIGHBOR_STR
1563 "Neighbor tag\n"
1564 "Configure peer-group\n")
1565{
1566 struct peer_group *group;
1567
1568 group = peer_group_lookup (vty->index, argv[0]);
1569 if (group)
1570 peer_group_delete (group);
1571 else
1572 {
1573 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1574 return CMD_WARNING;
1575 }
1576 return CMD_SUCCESS;
1577}
1578
1579DEFUN (no_neighbor_peer_group_remote_as,
1580 no_neighbor_peer_group_remote_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001581 "no neighbor WORD remote-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001582 NO_STR
1583 NEIGHBOR_STR
1584 "Neighbor tag\n"
1585 "Specify a BGP neighbor\n"
1586 AS_STR)
1587{
1588 struct peer_group *group;
1589
1590 group = peer_group_lookup (vty->index, argv[0]);
1591 if (group)
1592 peer_group_remote_as_delete (group);
1593 else
1594 {
1595 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1596 return CMD_WARNING;
1597 }
1598 return CMD_SUCCESS;
1599}
David Lamparter6b0655a2014-06-04 06:53:35 +02001600
paul718e3742002-12-13 20:15:29 +00001601DEFUN (neighbor_local_as,
1602 neighbor_local_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001603 NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001604 NEIGHBOR_STR
1605 NEIGHBOR_ADDR_STR2
1606 "Specify a local-as number\n"
1607 "AS number used as local AS\n")
1608{
1609 struct peer *peer;
1610 int ret;
1611
1612 peer = peer_and_group_lookup_vty (vty, argv[0]);
1613 if (! peer)
1614 return CMD_WARNING;
1615
Andrew Certain9d3f9702012-11-07 23:50:07 +00001616 ret = peer_local_as_set (peer, atoi (argv[1]), 0, 0);
paul718e3742002-12-13 20:15:29 +00001617 return bgp_vty_return (vty, ret);
1618}
1619
1620DEFUN (neighbor_local_as_no_prepend,
1621 neighbor_local_as_no_prepend_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001622 NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend",
paul718e3742002-12-13 20:15:29 +00001623 NEIGHBOR_STR
1624 NEIGHBOR_ADDR_STR2
1625 "Specify a local-as number\n"
1626 "AS number used as local AS\n"
1627 "Do not prepend local-as to updates from ebgp peers\n")
1628{
1629 struct peer *peer;
1630 int ret;
1631
1632 peer = peer_and_group_lookup_vty (vty, argv[0]);
1633 if (! peer)
1634 return CMD_WARNING;
1635
Andrew Certain9d3f9702012-11-07 23:50:07 +00001636 ret = peer_local_as_set (peer, atoi (argv[1]), 1, 0);
paul718e3742002-12-13 20:15:29 +00001637 return bgp_vty_return (vty, ret);
1638}
1639
Andrew Certain9d3f9702012-11-07 23:50:07 +00001640DEFUN (neighbor_local_as_no_prepend_replace_as,
1641 neighbor_local_as_no_prepend_replace_as_cmd,
1642 NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as",
1643 NEIGHBOR_STR
1644 NEIGHBOR_ADDR_STR2
1645 "Specify a local-as number\n"
1646 "AS number used as local AS\n"
1647 "Do not prepend local-as to updates from ebgp peers\n"
1648 "Do not prepend local-as to updates from ibgp peers\n")
1649{
1650 struct peer *peer;
1651 int ret;
1652
1653 peer = peer_and_group_lookup_vty (vty, argv[0]);
1654 if (! peer)
1655 return CMD_WARNING;
1656
1657 ret = peer_local_as_set (peer, atoi (argv[1]), 1, 1);
1658 return bgp_vty_return (vty, ret);
1659}
1660
1661
paul718e3742002-12-13 20:15:29 +00001662DEFUN (no_neighbor_local_as,
1663 no_neighbor_local_as_cmd,
1664 NO_NEIGHBOR_CMD2 "local-as",
1665 NO_STR
1666 NEIGHBOR_STR
1667 NEIGHBOR_ADDR_STR2
1668 "Specify a local-as number\n")
1669{
1670 struct peer *peer;
1671 int ret;
1672
1673 peer = peer_and_group_lookup_vty (vty, argv[0]);
1674 if (! peer)
1675 return CMD_WARNING;
1676
1677 ret = peer_local_as_unset (peer);
1678 return bgp_vty_return (vty, ret);
1679}
1680
1681ALIAS (no_neighbor_local_as,
1682 no_neighbor_local_as_val_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001683 NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00001684 NO_STR
1685 NEIGHBOR_STR
1686 NEIGHBOR_ADDR_STR2
1687 "Specify a local-as number\n"
1688 "AS number used as local AS\n")
1689
1690ALIAS (no_neighbor_local_as,
1691 no_neighbor_local_as_val2_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00001692 NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend",
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 "Do not prepend local-as to updates from ebgp peers\n")
Andrew Certain9d3f9702012-11-07 23:50:07 +00001699
1700ALIAS (no_neighbor_local_as,
1701 no_neighbor_local_as_val3_cmd,
1702 NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as",
1703 NO_STR
1704 NEIGHBOR_STR
1705 NEIGHBOR_ADDR_STR2
1706 "Specify a local-as number\n"
1707 "AS number used as local AS\n"
1708 "Do not prepend local-as to updates from ebgp peers\n"
1709 "Do not prepend local-as to updates from ibgp peers\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02001710
Paul Jakma0df7c912008-07-21 21:02:49 +00001711DEFUN (neighbor_password,
1712 neighbor_password_cmd,
1713 NEIGHBOR_CMD2 "password LINE",
1714 NEIGHBOR_STR
1715 NEIGHBOR_ADDR_STR2
1716 "Set a password\n"
1717 "The password\n")
1718{
1719 struct peer *peer;
1720 int ret;
1721
1722 peer = peer_and_group_lookup_vty (vty, argv[0]);
1723 if (! peer)
1724 return CMD_WARNING;
1725
1726 ret = peer_password_set (peer, argv[1]);
1727 return bgp_vty_return (vty, ret);
1728}
1729
1730DEFUN (no_neighbor_password,
1731 no_neighbor_password_cmd,
1732 NO_NEIGHBOR_CMD2 "password",
1733 NO_STR
1734 NEIGHBOR_STR
1735 NEIGHBOR_ADDR_STR2
1736 "Set a password\n")
1737{
1738 struct peer *peer;
1739 int ret;
1740
1741 peer = peer_and_group_lookup_vty (vty, argv[0]);
1742 if (! peer)
1743 return CMD_WARNING;
1744
1745 ret = peer_password_unset (peer);
1746 return bgp_vty_return (vty, ret);
1747}
David Lamparter6b0655a2014-06-04 06:53:35 +02001748
paul718e3742002-12-13 20:15:29 +00001749DEFUN (neighbor_activate,
1750 neighbor_activate_cmd,
1751 NEIGHBOR_CMD2 "activate",
1752 NEIGHBOR_STR
1753 NEIGHBOR_ADDR_STR2
1754 "Enable the Address Family for this Neighbor\n")
1755{
1756 struct peer *peer;
1757
1758 peer = peer_and_group_lookup_vty (vty, argv[0]);
1759 if (! peer)
1760 return CMD_WARNING;
1761
1762 peer_activate (peer, bgp_node_afi (vty), bgp_node_safi (vty));
1763
1764 return CMD_SUCCESS;
1765}
1766
1767DEFUN (no_neighbor_activate,
1768 no_neighbor_activate_cmd,
1769 NO_NEIGHBOR_CMD2 "activate",
1770 NO_STR
1771 NEIGHBOR_STR
1772 NEIGHBOR_ADDR_STR2
1773 "Enable the Address Family for this Neighbor\n")
1774{
1775 int ret;
1776 struct peer *peer;
1777
1778 /* Lookup peer. */
1779 peer = peer_and_group_lookup_vty (vty, argv[0]);
1780 if (! peer)
1781 return CMD_WARNING;
1782
1783 ret = peer_deactivate (peer, bgp_node_afi (vty), bgp_node_safi (vty));
1784
1785 return bgp_vty_return (vty, ret);
1786}
David Lamparter6b0655a2014-06-04 06:53:35 +02001787
paul718e3742002-12-13 20:15:29 +00001788DEFUN (neighbor_set_peer_group,
1789 neighbor_set_peer_group_cmd,
1790 NEIGHBOR_CMD "peer-group WORD",
1791 NEIGHBOR_STR
1792 NEIGHBOR_ADDR_STR
1793 "Member of the peer-group\n"
1794 "peer-group name\n")
1795{
1796 int ret;
1797 as_t as;
1798 union sockunion su;
1799 struct bgp *bgp;
1800 struct peer_group *group;
1801
1802 bgp = vty->index;
1803
1804 ret = str2sockunion (argv[0], &su);
1805 if (ret < 0)
1806 {
1807 vty_out (vty, "%% Malformed address: %s%s", argv[0], VTY_NEWLINE);
1808 return CMD_WARNING;
1809 }
1810
1811 group = peer_group_lookup (bgp, argv[1]);
1812 if (! group)
1813 {
1814 vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE);
1815 return CMD_WARNING;
1816 }
1817
1818 if (peer_address_self_check (&su))
1819 {
1820 vty_out (vty, "%% Can not configure the local system as neighbor%s",
1821 VTY_NEWLINE);
1822 return CMD_WARNING;
1823 }
1824
1825 ret = peer_group_bind (bgp, &su, group, bgp_node_afi (vty),
1826 bgp_node_safi (vty), &as);
1827
1828 if (ret == BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT)
1829 {
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04001830 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 +00001831 return CMD_WARNING;
1832 }
1833
1834 return bgp_vty_return (vty, ret);
1835}
1836
1837DEFUN (no_neighbor_set_peer_group,
1838 no_neighbor_set_peer_group_cmd,
1839 NO_NEIGHBOR_CMD "peer-group WORD",
1840 NO_STR
1841 NEIGHBOR_STR
1842 NEIGHBOR_ADDR_STR
1843 "Member of the peer-group\n"
1844 "peer-group name\n")
1845{
1846 int ret;
1847 struct bgp *bgp;
1848 struct peer *peer;
1849 struct peer_group *group;
1850
1851 bgp = vty->index;
1852
1853 peer = peer_lookup_vty (vty, argv[0]);
1854 if (! peer)
1855 return CMD_WARNING;
1856
1857 group = peer_group_lookup (bgp, argv[1]);
1858 if (! group)
1859 {
1860 vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE);
1861 return CMD_WARNING;
1862 }
1863
1864 ret = peer_group_unbind (bgp, peer, group, bgp_node_afi (vty),
1865 bgp_node_safi (vty));
1866
1867 return bgp_vty_return (vty, ret);
1868}
David Lamparter6b0655a2014-06-04 06:53:35 +02001869
paul94f2b392005-06-28 12:44:16 +00001870static int
paulfd79ac92004-10-13 05:06:08 +00001871peer_flag_modify_vty (struct vty *vty, const char *ip_str,
1872 u_int16_t flag, int set)
paul718e3742002-12-13 20:15:29 +00001873{
1874 int ret;
1875 struct peer *peer;
1876
1877 peer = peer_and_group_lookup_vty (vty, ip_str);
1878 if (! peer)
1879 return CMD_WARNING;
1880
1881 if (set)
1882 ret = peer_flag_set (peer, flag);
1883 else
1884 ret = peer_flag_unset (peer, flag);
1885
1886 return bgp_vty_return (vty, ret);
1887}
1888
paul94f2b392005-06-28 12:44:16 +00001889static int
paulfd79ac92004-10-13 05:06:08 +00001890peer_flag_set_vty (struct vty *vty, const char *ip_str, u_int16_t flag)
paul718e3742002-12-13 20:15:29 +00001891{
1892 return peer_flag_modify_vty (vty, ip_str, flag, 1);
1893}
1894
paul94f2b392005-06-28 12:44:16 +00001895static int
paulfd79ac92004-10-13 05:06:08 +00001896peer_flag_unset_vty (struct vty *vty, const char *ip_str, u_int16_t flag)
paul718e3742002-12-13 20:15:29 +00001897{
1898 return peer_flag_modify_vty (vty, ip_str, flag, 0);
1899}
1900
1901/* neighbor passive. */
1902DEFUN (neighbor_passive,
1903 neighbor_passive_cmd,
1904 NEIGHBOR_CMD2 "passive",
1905 NEIGHBOR_STR
1906 NEIGHBOR_ADDR_STR2
1907 "Don't send open messages to this neighbor\n")
1908{
1909 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_PASSIVE);
1910}
1911
1912DEFUN (no_neighbor_passive,
1913 no_neighbor_passive_cmd,
1914 NO_NEIGHBOR_CMD2 "passive",
1915 NO_STR
1916 NEIGHBOR_STR
1917 NEIGHBOR_ADDR_STR2
1918 "Don't send open messages to this neighbor\n")
1919{
1920 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_PASSIVE);
1921}
David Lamparter6b0655a2014-06-04 06:53:35 +02001922
paul718e3742002-12-13 20:15:29 +00001923/* neighbor shutdown. */
1924DEFUN (neighbor_shutdown,
1925 neighbor_shutdown_cmd,
1926 NEIGHBOR_CMD2 "shutdown",
1927 NEIGHBOR_STR
1928 NEIGHBOR_ADDR_STR2
1929 "Administratively shut down this neighbor\n")
1930{
1931 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_SHUTDOWN);
1932}
1933
1934DEFUN (no_neighbor_shutdown,
1935 no_neighbor_shutdown_cmd,
1936 NO_NEIGHBOR_CMD2 "shutdown",
1937 NO_STR
1938 NEIGHBOR_STR
1939 NEIGHBOR_ADDR_STR2
1940 "Administratively shut down this neighbor\n")
1941{
1942 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_SHUTDOWN);
1943}
David Lamparter6b0655a2014-06-04 06:53:35 +02001944
hassoc9502432005-02-01 22:01:48 +00001945/* Deprecated neighbor capability route-refresh. */
1946DEFUN_DEPRECATED (neighbor_capability_route_refresh,
1947 neighbor_capability_route_refresh_cmd,
1948 NEIGHBOR_CMD2 "capability route-refresh",
1949 NEIGHBOR_STR
1950 NEIGHBOR_ADDR_STR2
1951 "Advertise capability to the peer\n"
1952 "Advertise route-refresh capability to this neighbor\n")
paul718e3742002-12-13 20:15:29 +00001953{
hassoc9502432005-02-01 22:01:48 +00001954 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00001955}
1956
hassoc9502432005-02-01 22:01:48 +00001957DEFUN_DEPRECATED (no_neighbor_capability_route_refresh,
1958 no_neighbor_capability_route_refresh_cmd,
1959 NO_NEIGHBOR_CMD2 "capability route-refresh",
1960 NO_STR
1961 NEIGHBOR_STR
1962 NEIGHBOR_ADDR_STR2
1963 "Advertise capability to the peer\n"
1964 "Advertise route-refresh capability to this neighbor\n")
paul718e3742002-12-13 20:15:29 +00001965{
hassoc9502432005-02-01 22:01:48 +00001966 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00001967}
David Lamparter6b0655a2014-06-04 06:53:35 +02001968
paul718e3742002-12-13 20:15:29 +00001969/* neighbor capability dynamic. */
1970DEFUN (neighbor_capability_dynamic,
1971 neighbor_capability_dynamic_cmd,
1972 NEIGHBOR_CMD2 "capability dynamic",
1973 NEIGHBOR_STR
1974 NEIGHBOR_ADDR_STR2
1975 "Advertise capability to the peer\n"
1976 "Advertise dynamic capability to this neighbor\n")
1977{
1978 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY);
1979}
1980
1981DEFUN (no_neighbor_capability_dynamic,
1982 no_neighbor_capability_dynamic_cmd,
1983 NO_NEIGHBOR_CMD2 "capability dynamic",
1984 NO_STR
1985 NEIGHBOR_STR
1986 NEIGHBOR_ADDR_STR2
1987 "Advertise capability to the peer\n"
1988 "Advertise dynamic capability to this neighbor\n")
1989{
1990 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY);
1991}
David Lamparter6b0655a2014-06-04 06:53:35 +02001992
paul718e3742002-12-13 20:15:29 +00001993/* neighbor dont-capability-negotiate */
1994DEFUN (neighbor_dont_capability_negotiate,
1995 neighbor_dont_capability_negotiate_cmd,
1996 NEIGHBOR_CMD2 "dont-capability-negotiate",
1997 NEIGHBOR_STR
1998 NEIGHBOR_ADDR_STR2
1999 "Do not perform capability negotiation\n")
2000{
2001 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY);
2002}
2003
2004DEFUN (no_neighbor_dont_capability_negotiate,
2005 no_neighbor_dont_capability_negotiate_cmd,
2006 NO_NEIGHBOR_CMD2 "dont-capability-negotiate",
2007 NO_STR
2008 NEIGHBOR_STR
2009 NEIGHBOR_ADDR_STR2
2010 "Do not perform capability negotiation\n")
2011{
2012 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY);
2013}
David Lamparter6b0655a2014-06-04 06:53:35 +02002014
paul94f2b392005-06-28 12:44:16 +00002015static int
paulfd79ac92004-10-13 05:06:08 +00002016peer_af_flag_modify_vty (struct vty *vty, const char *peer_str, afi_t afi,
paulfee0f4c2004-09-13 05:12:46 +00002017 safi_t safi, u_int32_t flag, int set)
paul718e3742002-12-13 20:15:29 +00002018{
2019 int ret;
2020 struct peer *peer;
2021
2022 peer = peer_and_group_lookup_vty (vty, peer_str);
2023 if (! peer)
2024 return CMD_WARNING;
2025
2026 if (set)
2027 ret = peer_af_flag_set (peer, afi, safi, flag);
2028 else
2029 ret = peer_af_flag_unset (peer, afi, safi, flag);
2030
2031 return bgp_vty_return (vty, ret);
2032}
2033
paul94f2b392005-06-28 12:44:16 +00002034static int
paulfd79ac92004-10-13 05:06:08 +00002035peer_af_flag_set_vty (struct vty *vty, const char *peer_str, afi_t afi,
paulfee0f4c2004-09-13 05:12:46 +00002036 safi_t safi, u_int32_t flag)
paul718e3742002-12-13 20:15:29 +00002037{
2038 return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 1);
2039}
2040
paul94f2b392005-06-28 12:44:16 +00002041static int
paulfd79ac92004-10-13 05:06:08 +00002042peer_af_flag_unset_vty (struct vty *vty, const char *peer_str, afi_t afi,
paulfee0f4c2004-09-13 05:12:46 +00002043 safi_t safi, u_int32_t flag)
paul718e3742002-12-13 20:15:29 +00002044{
2045 return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 0);
2046}
David Lamparter6b0655a2014-06-04 06:53:35 +02002047
paul718e3742002-12-13 20:15:29 +00002048/* neighbor capability orf prefix-list. */
2049DEFUN (neighbor_capability_orf_prefix,
2050 neighbor_capability_orf_prefix_cmd,
2051 NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)",
2052 NEIGHBOR_STR
2053 NEIGHBOR_ADDR_STR2
2054 "Advertise capability to the peer\n"
2055 "Advertise ORF capability to the peer\n"
2056 "Advertise prefixlist ORF capability to this neighbor\n"
2057 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
2058 "Capability to RECEIVE the ORF from this neighbor\n"
2059 "Capability to SEND the ORF to this neighbor\n")
2060{
2061 u_int16_t flag = 0;
2062
2063 if (strncmp (argv[1], "s", 1) == 0)
2064 flag = PEER_FLAG_ORF_PREFIX_SM;
2065 else if (strncmp (argv[1], "r", 1) == 0)
2066 flag = PEER_FLAG_ORF_PREFIX_RM;
2067 else if (strncmp (argv[1], "b", 1) == 0)
2068 flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM;
2069 else
2070 return CMD_WARNING;
2071
2072 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2073 bgp_node_safi (vty), flag);
2074}
2075
2076DEFUN (no_neighbor_capability_orf_prefix,
2077 no_neighbor_capability_orf_prefix_cmd,
2078 NO_NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)",
2079 NO_STR
2080 NEIGHBOR_STR
2081 NEIGHBOR_ADDR_STR2
2082 "Advertise capability to the peer\n"
2083 "Advertise ORF capability to the peer\n"
2084 "Advertise prefixlist ORF capability to this neighbor\n"
2085 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
2086 "Capability to RECEIVE the ORF from this neighbor\n"
2087 "Capability to SEND the ORF to this neighbor\n")
2088{
2089 u_int16_t flag = 0;
2090
2091 if (strncmp (argv[1], "s", 1) == 0)
2092 flag = PEER_FLAG_ORF_PREFIX_SM;
2093 else if (strncmp (argv[1], "r", 1) == 0)
2094 flag = PEER_FLAG_ORF_PREFIX_RM;
2095 else if (strncmp (argv[1], "b", 1) == 0)
2096 flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM;
2097 else
2098 return CMD_WARNING;
2099
2100 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2101 bgp_node_safi (vty), flag);
2102}
David Lamparter6b0655a2014-06-04 06:53:35 +02002103
paul718e3742002-12-13 20:15:29 +00002104/* neighbor next-hop-self. */
2105DEFUN (neighbor_nexthop_self,
2106 neighbor_nexthop_self_cmd,
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002107 NEIGHBOR_CMD2 "next-hop-self {all}",
paul718e3742002-12-13 20:15:29 +00002108 NEIGHBOR_STR
2109 NEIGHBOR_ADDR_STR2
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002110 "Disable the next hop calculation for this neighbor\n"
2111 "Apply also to ibgp-learned routes when acting as a route reflector\n")
paul718e3742002-12-13 20:15:29 +00002112{
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002113 u_int32_t flags = PEER_FLAG_NEXTHOP_SELF, unset = 0;
2114 int rc;
2115
2116 /* Check if "all" is specified */
2117 if (argv[1] != NULL)
2118 flags |= PEER_FLAG_NEXTHOP_SELF_ALL;
2119 else
2120 unset |= PEER_FLAG_NEXTHOP_SELF_ALL;
2121
2122 rc = peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2123 bgp_node_safi (vty), flags);
2124 if ( rc == CMD_SUCCESS && unset )
2125 rc = peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2126 bgp_node_safi (vty), unset);
2127 return rc;
paul718e3742002-12-13 20:15:29 +00002128}
2129
2130DEFUN (no_neighbor_nexthop_self,
2131 no_neighbor_nexthop_self_cmd,
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002132 NO_NEIGHBOR_CMD2 "next-hop-self {all}",
paul718e3742002-12-13 20:15:29 +00002133 NO_STR
2134 NEIGHBOR_STR
2135 NEIGHBOR_ADDR_STR2
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002136 "Disable the next hop calculation for this neighbor\n"
2137 "Apply also to ibgp-learned routes when acting as a route reflector\n")
paul718e3742002-12-13 20:15:29 +00002138{
2139 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
Timo Teräs9e7a53c2014-04-24 10:22:37 +03002140 bgp_node_safi (vty),
2141 PEER_FLAG_NEXTHOP_SELF|PEER_FLAG_NEXTHOP_SELF_ALL);
paul718e3742002-12-13 20:15:29 +00002142}
David Lamparter6b0655a2014-06-04 06:53:35 +02002143
paul718e3742002-12-13 20:15:29 +00002144/* neighbor remove-private-AS. */
2145DEFUN (neighbor_remove_private_as,
2146 neighbor_remove_private_as_cmd,
2147 NEIGHBOR_CMD2 "remove-private-AS",
2148 NEIGHBOR_STR
2149 NEIGHBOR_ADDR_STR2
2150 "Remove private AS number from outbound updates\n")
2151{
2152 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2153 bgp_node_safi (vty),
2154 PEER_FLAG_REMOVE_PRIVATE_AS);
2155}
2156
2157DEFUN (no_neighbor_remove_private_as,
2158 no_neighbor_remove_private_as_cmd,
2159 NO_NEIGHBOR_CMD2 "remove-private-AS",
2160 NO_STR
2161 NEIGHBOR_STR
2162 NEIGHBOR_ADDR_STR2
2163 "Remove private AS number from outbound updates\n")
2164{
2165 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2166 bgp_node_safi (vty),
2167 PEER_FLAG_REMOVE_PRIVATE_AS);
2168}
David Lamparter6b0655a2014-06-04 06:53:35 +02002169
paul718e3742002-12-13 20:15:29 +00002170/* neighbor send-community. */
2171DEFUN (neighbor_send_community,
2172 neighbor_send_community_cmd,
2173 NEIGHBOR_CMD2 "send-community",
2174 NEIGHBOR_STR
2175 NEIGHBOR_ADDR_STR2
2176 "Send Community attribute to this neighbor\n")
2177{
2178 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2179 bgp_node_safi (vty),
2180 PEER_FLAG_SEND_COMMUNITY);
2181}
2182
2183DEFUN (no_neighbor_send_community,
2184 no_neighbor_send_community_cmd,
2185 NO_NEIGHBOR_CMD2 "send-community",
2186 NO_STR
2187 NEIGHBOR_STR
2188 NEIGHBOR_ADDR_STR2
2189 "Send Community attribute to this neighbor\n")
2190{
2191 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2192 bgp_node_safi (vty),
2193 PEER_FLAG_SEND_COMMUNITY);
2194}
David Lamparter6b0655a2014-06-04 06:53:35 +02002195
paul718e3742002-12-13 20:15:29 +00002196/* neighbor send-community extended. */
2197DEFUN (neighbor_send_community_type,
2198 neighbor_send_community_type_cmd,
2199 NEIGHBOR_CMD2 "send-community (both|extended|standard)",
2200 NEIGHBOR_STR
2201 NEIGHBOR_ADDR_STR2
2202 "Send Community attribute to this neighbor\n"
2203 "Send Standard and Extended Community attributes\n"
2204 "Send Extended Community attributes\n"
2205 "Send Standard Community attributes\n")
2206{
2207 if (strncmp (argv[1], "s", 1) == 0)
2208 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2209 bgp_node_safi (vty),
2210 PEER_FLAG_SEND_COMMUNITY);
2211 if (strncmp (argv[1], "e", 1) == 0)
2212 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2213 bgp_node_safi (vty),
2214 PEER_FLAG_SEND_EXT_COMMUNITY);
2215
2216 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2217 bgp_node_safi (vty),
2218 (PEER_FLAG_SEND_COMMUNITY|
2219 PEER_FLAG_SEND_EXT_COMMUNITY));
2220}
2221
2222DEFUN (no_neighbor_send_community_type,
2223 no_neighbor_send_community_type_cmd,
2224 NO_NEIGHBOR_CMD2 "send-community (both|extended|standard)",
2225 NO_STR
2226 NEIGHBOR_STR
2227 NEIGHBOR_ADDR_STR2
2228 "Send Community attribute to this neighbor\n"
2229 "Send Standard and Extended Community attributes\n"
2230 "Send Extended Community attributes\n"
2231 "Send Standard Community attributes\n")
2232{
2233 if (strncmp (argv[1], "s", 1) == 0)
2234 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2235 bgp_node_safi (vty),
2236 PEER_FLAG_SEND_COMMUNITY);
2237 if (strncmp (argv[1], "e", 1) == 0)
2238 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2239 bgp_node_safi (vty),
2240 PEER_FLAG_SEND_EXT_COMMUNITY);
2241
2242 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2243 bgp_node_safi (vty),
2244 (PEER_FLAG_SEND_COMMUNITY |
2245 PEER_FLAG_SEND_EXT_COMMUNITY));
2246}
David Lamparter6b0655a2014-06-04 06:53:35 +02002247
paul718e3742002-12-13 20:15:29 +00002248/* neighbor soft-reconfig. */
2249DEFUN (neighbor_soft_reconfiguration,
2250 neighbor_soft_reconfiguration_cmd,
2251 NEIGHBOR_CMD2 "soft-reconfiguration inbound",
2252 NEIGHBOR_STR
2253 NEIGHBOR_ADDR_STR2
2254 "Per neighbor soft reconfiguration\n"
2255 "Allow inbound soft reconfiguration for this neighbor\n")
2256{
2257 return peer_af_flag_set_vty (vty, argv[0],
2258 bgp_node_afi (vty), bgp_node_safi (vty),
2259 PEER_FLAG_SOFT_RECONFIG);
2260}
2261
2262DEFUN (no_neighbor_soft_reconfiguration,
2263 no_neighbor_soft_reconfiguration_cmd,
2264 NO_NEIGHBOR_CMD2 "soft-reconfiguration inbound",
2265 NO_STR
2266 NEIGHBOR_STR
2267 NEIGHBOR_ADDR_STR2
2268 "Per neighbor soft reconfiguration\n"
2269 "Allow inbound soft reconfiguration for this neighbor\n")
2270{
2271 return peer_af_flag_unset_vty (vty, argv[0],
2272 bgp_node_afi (vty), bgp_node_safi (vty),
2273 PEER_FLAG_SOFT_RECONFIG);
2274}
David Lamparter6b0655a2014-06-04 06:53:35 +02002275
paul718e3742002-12-13 20:15:29 +00002276DEFUN (neighbor_route_reflector_client,
2277 neighbor_route_reflector_client_cmd,
2278 NEIGHBOR_CMD2 "route-reflector-client",
2279 NEIGHBOR_STR
2280 NEIGHBOR_ADDR_STR2
2281 "Configure a neighbor as Route Reflector client\n")
2282{
2283 struct peer *peer;
2284
2285
2286 peer = peer_and_group_lookup_vty (vty, argv[0]);
2287 if (! peer)
2288 return CMD_WARNING;
2289
2290 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2291 bgp_node_safi (vty),
2292 PEER_FLAG_REFLECTOR_CLIENT);
2293}
2294
2295DEFUN (no_neighbor_route_reflector_client,
2296 no_neighbor_route_reflector_client_cmd,
2297 NO_NEIGHBOR_CMD2 "route-reflector-client",
2298 NO_STR
2299 NEIGHBOR_STR
2300 NEIGHBOR_ADDR_STR2
2301 "Configure a neighbor as Route Reflector client\n")
2302{
2303 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2304 bgp_node_safi (vty),
2305 PEER_FLAG_REFLECTOR_CLIENT);
2306}
David Lamparter6b0655a2014-06-04 06:53:35 +02002307
paul94f2b392005-06-28 12:44:16 +00002308static int
paulfd79ac92004-10-13 05:06:08 +00002309peer_rsclient_set_vty (struct vty *vty, const char *peer_str,
2310 int afi, int safi)
paulfee0f4c2004-09-13 05:12:46 +00002311{
2312 int ret;
2313 struct bgp *bgp;
2314 struct peer *peer;
2315 struct peer_group *group;
paul1eb8ef22005-04-07 07:30:20 +00002316 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00002317 struct bgp_filter *pfilter;
2318 struct bgp_filter *gfilter;
Chris Caputo228da422009-07-18 05:44:03 +00002319 int locked_and_added = 0;
paulfee0f4c2004-09-13 05:12:46 +00002320
2321 bgp = vty->index;
2322
2323 peer = peer_and_group_lookup_vty (vty, peer_str);
2324 if ( ! peer )
2325 return CMD_WARNING;
2326
2327 /* If it is already a RS-Client, don't do anything. */
2328 if ( CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) )
2329 return CMD_SUCCESS;
2330
2331 if ( ! peer_rsclient_active (peer) )
paul200df112005-06-01 11:17:05 +00002332 {
2333 peer = peer_lock (peer); /* rsclient peer list reference */
2334 listnode_add_sort (bgp->rsclient, peer);
Chris Caputo228da422009-07-18 05:44:03 +00002335 locked_and_added = 1;
paul200df112005-06-01 11:17:05 +00002336 }
paulfee0f4c2004-09-13 05:12:46 +00002337
2338 ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2339 if (ret < 0)
Chris Caputo228da422009-07-18 05:44:03 +00002340 {
2341 if (locked_and_added)
2342 {
2343 listnode_delete (bgp->rsclient, peer);
2344 peer_unlock (peer); /* rsclient peer list reference */
2345 }
2346
2347 return bgp_vty_return (vty, ret);
2348 }
paulfee0f4c2004-09-13 05:12:46 +00002349
Paul Jakma64e580a2006-02-21 01:09:01 +00002350 peer->rib[afi][safi] = bgp_table_init (afi, safi);
paulfee0f4c2004-09-13 05:12:46 +00002351 peer->rib[afi][safi]->type = BGP_TABLE_RSCLIENT;
Chris Caputo228da422009-07-18 05:44:03 +00002352 /* RIB peer reference. Released when table is free'd in bgp_table_free. */
2353 peer->rib[afi][safi]->owner = peer_lock (peer);
paulfee0f4c2004-09-13 05:12:46 +00002354
2355 /* Check for existing 'network' and 'redistribute' routes. */
2356 bgp_check_local_routes_rsclient (peer, afi, safi);
2357
2358 /* Check for routes for peers configured with 'soft-reconfiguration'. */
2359 bgp_soft_reconfig_rsclient (peer, afi, safi);
2360
2361 if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP))
2362 {
2363 group = peer->group;
2364 gfilter = &peer->filter[afi][safi];
2365
paul1eb8ef22005-04-07 07:30:20 +00002366 for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00002367 {
2368 pfilter = &peer->filter[afi][safi];
2369
2370 /* Members of a non-RS-Client group should not be RS-Clients, as that
2371 is checked when the become part of the peer-group */
2372 ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2373 if (ret < 0)
2374 return bgp_vty_return (vty, ret);
2375
2376 /* Make peer's RIB point to group's RIB. */
2377 peer->rib[afi][safi] = group->conf->rib[afi][safi];
2378
2379 /* Import policy. */
2380 if (pfilter->map[RMAP_IMPORT].name)
2381 free (pfilter->map[RMAP_IMPORT].name);
2382 if (gfilter->map[RMAP_IMPORT].name)
2383 {
2384 pfilter->map[RMAP_IMPORT].name = strdup (gfilter->map[RMAP_IMPORT].name);
2385 pfilter->map[RMAP_IMPORT].map = gfilter->map[RMAP_IMPORT].map;
2386 }
2387 else
2388 {
2389 pfilter->map[RMAP_IMPORT].name = NULL;
2390 pfilter->map[RMAP_IMPORT].map =NULL;
2391 }
2392
2393 /* Export policy. */
2394 if (gfilter->map[RMAP_EXPORT].name && ! pfilter->map[RMAP_EXPORT].name)
2395 {
2396 pfilter->map[RMAP_EXPORT].name = strdup (gfilter->map[RMAP_EXPORT].name);
2397 pfilter->map[RMAP_EXPORT].map = gfilter->map[RMAP_EXPORT].map;
2398 }
2399 }
2400 }
2401 return CMD_SUCCESS;
2402}
2403
paul94f2b392005-06-28 12:44:16 +00002404static int
paulfd79ac92004-10-13 05:06:08 +00002405peer_rsclient_unset_vty (struct vty *vty, const char *peer_str,
2406 int afi, int safi)
paulfee0f4c2004-09-13 05:12:46 +00002407{
2408 int ret;
2409 struct bgp *bgp;
2410 struct peer *peer;
2411 struct peer_group *group;
paul1eb8ef22005-04-07 07:30:20 +00002412 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00002413
2414 bgp = vty->index;
2415
2416 peer = peer_and_group_lookup_vty (vty, peer_str);
2417 if ( ! peer )
2418 return CMD_WARNING;
2419
2420 /* If it is not a RS-Client, don't do anything. */
2421 if ( ! CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) )
2422 return CMD_SUCCESS;
2423
2424 if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP))
2425 {
2426 group = peer->group;
2427
paul1eb8ef22005-04-07 07:30:20 +00002428 for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00002429 {
2430 ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2431 if (ret < 0)
2432 return bgp_vty_return (vty, ret);
2433
2434 peer->rib[afi][safi] = NULL;
2435 }
2436
2437 peer = group->conf;
2438 }
2439
2440 ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2441 if (ret < 0)
2442 return bgp_vty_return (vty, ret);
2443
2444 if ( ! peer_rsclient_active (peer) )
paul200df112005-06-01 11:17:05 +00002445 {
Chris Caputo228da422009-07-18 05:44:03 +00002446 bgp_clear_route (peer, afi, safi, BGP_CLEAR_ROUTE_MY_RSCLIENT);
paul200df112005-06-01 11:17:05 +00002447 listnode_delete (bgp->rsclient, peer);
Chris Caputo228da422009-07-18 05:44:03 +00002448 peer_unlock (peer); /* peer bgp rsclient reference */
paul200df112005-06-01 11:17:05 +00002449 }
paulfee0f4c2004-09-13 05:12:46 +00002450
Paul Jakmab608d5b2008-07-02 02:12:07 +00002451 bgp_table_finish (&peer->rib[bgp_node_afi(vty)][bgp_node_safi(vty)]);
paulfee0f4c2004-09-13 05:12:46 +00002452
2453 return CMD_SUCCESS;
2454}
David Lamparter6b0655a2014-06-04 06:53:35 +02002455
paul718e3742002-12-13 20:15:29 +00002456/* neighbor route-server-client. */
2457DEFUN (neighbor_route_server_client,
2458 neighbor_route_server_client_cmd,
2459 NEIGHBOR_CMD2 "route-server-client",
2460 NEIGHBOR_STR
2461 NEIGHBOR_ADDR_STR2
2462 "Configure a neighbor as Route Server client\n")
2463{
paulfee0f4c2004-09-13 05:12:46 +00002464 return peer_rsclient_set_vty (vty, argv[0], bgp_node_afi(vty),
2465 bgp_node_safi(vty));
paul718e3742002-12-13 20:15:29 +00002466}
2467
2468DEFUN (no_neighbor_route_server_client,
2469 no_neighbor_route_server_client_cmd,
2470 NO_NEIGHBOR_CMD2 "route-server-client",
2471 NO_STR
2472 NEIGHBOR_STR
2473 NEIGHBOR_ADDR_STR2
2474 "Configure a neighbor as Route Server client\n")
2475{
paulfee0f4c2004-09-13 05:12:46 +00002476 return peer_rsclient_unset_vty (vty, argv[0], bgp_node_afi(vty),
2477 bgp_node_safi(vty));
2478}
David Lamparter6b0655a2014-06-04 06:53:35 +02002479
paulfee0f4c2004-09-13 05:12:46 +00002480DEFUN (neighbor_nexthop_local_unchanged,
2481 neighbor_nexthop_local_unchanged_cmd,
2482 NEIGHBOR_CMD2 "nexthop-local unchanged",
2483 NEIGHBOR_STR
2484 NEIGHBOR_ADDR_STR2
2485 "Configure treatment of outgoing link-local nexthop attribute\n"
2486 "Leave link-local nexthop unchanged for this peer\n")
2487{
2488 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2489 bgp_node_safi (vty),
2490 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED );
2491}
David Lamparter6b0655a2014-06-04 06:53:35 +02002492
paulfee0f4c2004-09-13 05:12:46 +00002493DEFUN (no_neighbor_nexthop_local_unchanged,
2494 no_neighbor_nexthop_local_unchanged_cmd,
2495 NO_NEIGHBOR_CMD2 "nexthop-local unchanged",
2496 NO_STR
2497 NEIGHBOR_STR
2498 NEIGHBOR_ADDR_STR2
2499 "Configure treatment of outgoing link-local-nexthop attribute\n"
2500 "Leave link-local nexthop unchanged for this peer\n")
2501{
paul718e3742002-12-13 20:15:29 +00002502 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2503 bgp_node_safi (vty),
paulfee0f4c2004-09-13 05:12:46 +00002504 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED );
paul718e3742002-12-13 20:15:29 +00002505}
David Lamparter6b0655a2014-06-04 06:53:35 +02002506
paul718e3742002-12-13 20:15:29 +00002507DEFUN (neighbor_attr_unchanged,
2508 neighbor_attr_unchanged_cmd,
2509 NEIGHBOR_CMD2 "attribute-unchanged",
2510 NEIGHBOR_STR
2511 NEIGHBOR_ADDR_STR2
2512 "BGP attribute is propagated unchanged to this neighbor\n")
2513{
2514 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2515 bgp_node_safi (vty),
2516 (PEER_FLAG_AS_PATH_UNCHANGED |
2517 PEER_FLAG_NEXTHOP_UNCHANGED |
2518 PEER_FLAG_MED_UNCHANGED));
2519}
2520
2521DEFUN (neighbor_attr_unchanged1,
2522 neighbor_attr_unchanged1_cmd,
2523 NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)",
2524 NEIGHBOR_STR
2525 NEIGHBOR_ADDR_STR2
2526 "BGP attribute is propagated unchanged to this neighbor\n"
2527 "As-path attribute\n"
2528 "Nexthop attribute\n"
2529 "Med attribute\n")
2530{
2531 u_int16_t flags = 0;
2532
2533 if (strncmp (argv[1], "as-path", 1) == 0)
2534 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2535 else if (strncmp (argv[1], "next-hop", 1) == 0)
2536 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2537 else if (strncmp (argv[1], "med", 1) == 0)
2538 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2539
2540 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2541 bgp_node_safi (vty), flags);
2542}
2543
2544DEFUN (neighbor_attr_unchanged2,
2545 neighbor_attr_unchanged2_cmd,
2546 NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)",
2547 NEIGHBOR_STR
2548 NEIGHBOR_ADDR_STR2
2549 "BGP attribute is propagated unchanged to this neighbor\n"
2550 "As-path attribute\n"
2551 "Nexthop attribute\n"
2552 "Med attribute\n")
2553{
2554 u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED;
2555
2556 if (strncmp (argv[1], "next-hop", 1) == 0)
2557 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2558 else if (strncmp (argv[1], "med", 1) == 0)
2559 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2560
2561 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2562 bgp_node_safi (vty), flags);
2563
2564}
2565
2566DEFUN (neighbor_attr_unchanged3,
2567 neighbor_attr_unchanged3_cmd,
2568 NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)",
2569 NEIGHBOR_STR
2570 NEIGHBOR_ADDR_STR2
2571 "BGP attribute is propagated unchanged to this neighbor\n"
2572 "Nexthop attribute\n"
2573 "As-path attribute\n"
2574 "Med attribute\n")
2575{
2576 u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED;
2577
2578 if (strncmp (argv[1], "as-path", 1) == 0)
2579 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2580 else if (strncmp (argv[1], "med", 1) == 0)
2581 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2582
2583 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2584 bgp_node_safi (vty), flags);
2585}
2586
2587DEFUN (neighbor_attr_unchanged4,
2588 neighbor_attr_unchanged4_cmd,
2589 NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)",
2590 NEIGHBOR_STR
2591 NEIGHBOR_ADDR_STR2
2592 "BGP attribute is propagated unchanged to this neighbor\n"
2593 "Med attribute\n"
2594 "As-path attribute\n"
2595 "Nexthop attribute\n")
2596{
2597 u_int16_t flags = PEER_FLAG_MED_UNCHANGED;
2598
2599 if (strncmp (argv[1], "as-path", 1) == 0)
2600 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2601 else if (strncmp (argv[1], "next-hop", 1) == 0)
2602 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2603
2604 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2605 bgp_node_safi (vty), flags);
2606}
2607
2608ALIAS (neighbor_attr_unchanged,
2609 neighbor_attr_unchanged5_cmd,
2610 NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med",
2611 NEIGHBOR_STR
2612 NEIGHBOR_ADDR_STR2
2613 "BGP attribute is propagated unchanged to this neighbor\n"
2614 "As-path attribute\n"
2615 "Nexthop attribute\n"
2616 "Med attribute\n")
2617
2618ALIAS (neighbor_attr_unchanged,
2619 neighbor_attr_unchanged6_cmd,
2620 NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop",
2621 NEIGHBOR_STR
2622 NEIGHBOR_ADDR_STR2
2623 "BGP attribute is propagated unchanged to this neighbor\n"
2624 "As-path attribute\n"
2625 "Med attribute\n"
2626 "Nexthop attribute\n")
2627
2628ALIAS (neighbor_attr_unchanged,
2629 neighbor_attr_unchanged7_cmd,
2630 NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path",
2631 NEIGHBOR_STR
2632 NEIGHBOR_ADDR_STR2
2633 "BGP attribute is propagated unchanged to this neighbor\n"
2634 "Nexthop attribute\n"
2635 "Med attribute\n"
2636 "As-path attribute\n")
2637
2638ALIAS (neighbor_attr_unchanged,
2639 neighbor_attr_unchanged8_cmd,
2640 NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med",
2641 NEIGHBOR_STR
2642 NEIGHBOR_ADDR_STR2
2643 "BGP attribute is propagated unchanged to this neighbor\n"
2644 "Nexthop attribute\n"
2645 "As-path attribute\n"
2646 "Med attribute\n")
2647
2648ALIAS (neighbor_attr_unchanged,
2649 neighbor_attr_unchanged9_cmd,
2650 NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path",
2651 NEIGHBOR_STR
2652 NEIGHBOR_ADDR_STR2
2653 "BGP attribute is propagated unchanged to this neighbor\n"
2654 "Med attribute\n"
2655 "Nexthop attribute\n"
2656 "As-path attribute\n")
2657
2658ALIAS (neighbor_attr_unchanged,
2659 neighbor_attr_unchanged10_cmd,
2660 NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop",
2661 NEIGHBOR_STR
2662 NEIGHBOR_ADDR_STR2
2663 "BGP attribute is propagated unchanged to this neighbor\n"
2664 "Med attribute\n"
2665 "As-path attribute\n"
2666 "Nexthop attribute\n")
2667
2668DEFUN (no_neighbor_attr_unchanged,
2669 no_neighbor_attr_unchanged_cmd,
2670 NO_NEIGHBOR_CMD2 "attribute-unchanged",
2671 NO_STR
2672 NEIGHBOR_STR
2673 NEIGHBOR_ADDR_STR2
2674 "BGP attribute is propagated unchanged to this neighbor\n")
2675{
2676 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2677 bgp_node_safi (vty),
2678 (PEER_FLAG_AS_PATH_UNCHANGED |
2679 PEER_FLAG_NEXTHOP_UNCHANGED |
2680 PEER_FLAG_MED_UNCHANGED));
2681}
2682
2683DEFUN (no_neighbor_attr_unchanged1,
2684 no_neighbor_attr_unchanged1_cmd,
2685 NO_NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)",
2686 NO_STR
2687 NEIGHBOR_STR
2688 NEIGHBOR_ADDR_STR2
2689 "BGP attribute is propagated unchanged to this neighbor\n"
2690 "As-path attribute\n"
2691 "Nexthop attribute\n"
2692 "Med attribute\n")
2693{
2694 u_int16_t flags = 0;
2695
2696 if (strncmp (argv[1], "as-path", 1) == 0)
2697 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2698 else if (strncmp (argv[1], "next-hop", 1) == 0)
2699 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2700 else if (strncmp (argv[1], "med", 1) == 0)
2701 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2702
2703 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2704 bgp_node_safi (vty), flags);
2705}
2706
2707DEFUN (no_neighbor_attr_unchanged2,
2708 no_neighbor_attr_unchanged2_cmd,
2709 NO_NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)",
2710 NO_STR
2711 NEIGHBOR_STR
2712 NEIGHBOR_ADDR_STR2
2713 "BGP attribute is propagated unchanged to this neighbor\n"
2714 "As-path attribute\n"
2715 "Nexthop attribute\n"
2716 "Med attribute\n")
2717{
2718 u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED;
2719
2720 if (strncmp (argv[1], "next-hop", 1) == 0)
2721 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2722 else if (strncmp (argv[1], "med", 1) == 0)
2723 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2724
2725 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2726 bgp_node_safi (vty), flags);
2727}
2728
2729DEFUN (no_neighbor_attr_unchanged3,
2730 no_neighbor_attr_unchanged3_cmd,
2731 NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)",
2732 NO_STR
2733 NEIGHBOR_STR
2734 NEIGHBOR_ADDR_STR2
2735 "BGP attribute is propagated unchanged to this neighbor\n"
2736 "Nexthop attribute\n"
2737 "As-path attribute\n"
2738 "Med attribute\n")
2739{
2740 u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED;
2741
2742 if (strncmp (argv[1], "as-path", 1) == 0)
2743 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2744 else if (strncmp (argv[1], "med", 1) == 0)
2745 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2746
2747 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2748 bgp_node_safi (vty), flags);
2749}
2750
2751DEFUN (no_neighbor_attr_unchanged4,
2752 no_neighbor_attr_unchanged4_cmd,
2753 NO_NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)",
2754 NO_STR
2755 NEIGHBOR_STR
2756 NEIGHBOR_ADDR_STR2
2757 "BGP attribute is propagated unchanged to this neighbor\n"
2758 "Med attribute\n"
2759 "As-path attribute\n"
2760 "Nexthop attribute\n")
2761{
2762 u_int16_t flags = PEER_FLAG_MED_UNCHANGED;
2763
2764 if (strncmp (argv[1], "as-path", 1) == 0)
2765 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2766 else if (strncmp (argv[1], "next-hop", 1) == 0)
2767 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2768
2769 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2770 bgp_node_safi (vty), flags);
2771}
2772
2773ALIAS (no_neighbor_attr_unchanged,
2774 no_neighbor_attr_unchanged5_cmd,
2775 NO_NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med",
2776 NO_STR
2777 NEIGHBOR_STR
2778 NEIGHBOR_ADDR_STR2
2779 "BGP attribute is propagated unchanged to this neighbor\n"
2780 "As-path attribute\n"
2781 "Nexthop attribute\n"
2782 "Med attribute\n")
2783
2784ALIAS (no_neighbor_attr_unchanged,
2785 no_neighbor_attr_unchanged6_cmd,
2786 NO_NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop",
2787 NO_STR
2788 NEIGHBOR_STR
2789 NEIGHBOR_ADDR_STR2
2790 "BGP attribute is propagated unchanged to this neighbor\n"
2791 "As-path attribute\n"
2792 "Med attribute\n"
2793 "Nexthop attribute\n")
2794
2795ALIAS (no_neighbor_attr_unchanged,
2796 no_neighbor_attr_unchanged7_cmd,
2797 NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path",
2798 NO_STR
2799 NEIGHBOR_STR
2800 NEIGHBOR_ADDR_STR2
2801 "BGP attribute is propagated unchanged to this neighbor\n"
2802 "Nexthop attribute\n"
2803 "Med attribute\n"
2804 "As-path attribute\n")
2805
2806ALIAS (no_neighbor_attr_unchanged,
2807 no_neighbor_attr_unchanged8_cmd,
2808 NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med",
2809 NO_STR
2810 NEIGHBOR_STR
2811 NEIGHBOR_ADDR_STR2
2812 "BGP attribute is propagated unchanged to this neighbor\n"
2813 "Nexthop attribute\n"
2814 "As-path attribute\n"
2815 "Med attribute\n")
2816
2817ALIAS (no_neighbor_attr_unchanged,
2818 no_neighbor_attr_unchanged9_cmd,
2819 NO_NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path",
2820 NO_STR
2821 NEIGHBOR_STR
2822 NEIGHBOR_ADDR_STR2
2823 "BGP attribute is propagated unchanged to this neighbor\n"
2824 "Med attribute\n"
2825 "Nexthop attribute\n"
2826 "As-path attribute\n")
2827
2828ALIAS (no_neighbor_attr_unchanged,
2829 no_neighbor_attr_unchanged10_cmd,
2830 NO_NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop",
2831 NO_STR
2832 NEIGHBOR_STR
2833 NEIGHBOR_ADDR_STR2
2834 "BGP attribute is propagated unchanged to this neighbor\n"
2835 "Med attribute\n"
2836 "As-path attribute\n"
2837 "Nexthop attribute\n")
2838
2839/* For old version Zebra compatibility. */
hassodd4c5932005-02-02 17:15:34 +00002840DEFUN_DEPRECATED (neighbor_transparent_as,
2841 neighbor_transparent_as_cmd,
2842 NEIGHBOR_CMD "transparent-as",
2843 NEIGHBOR_STR
2844 NEIGHBOR_ADDR_STR
2845 "Do not append my AS number even peer is EBGP peer\n")
paul718e3742002-12-13 20:15:29 +00002846{
2847 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2848 bgp_node_safi (vty),
2849 PEER_FLAG_AS_PATH_UNCHANGED);
2850}
2851
hassodd4c5932005-02-02 17:15:34 +00002852DEFUN_DEPRECATED (neighbor_transparent_nexthop,
2853 neighbor_transparent_nexthop_cmd,
2854 NEIGHBOR_CMD "transparent-nexthop",
2855 NEIGHBOR_STR
2856 NEIGHBOR_ADDR_STR
2857 "Do not change nexthop even peer is EBGP peer\n")
paul718e3742002-12-13 20:15:29 +00002858{
2859 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2860 bgp_node_safi (vty),
2861 PEER_FLAG_NEXTHOP_UNCHANGED);
2862}
David Lamparter6b0655a2014-06-04 06:53:35 +02002863
paul718e3742002-12-13 20:15:29 +00002864/* EBGP multihop configuration. */
paul94f2b392005-06-28 12:44:16 +00002865static int
paulfd79ac92004-10-13 05:06:08 +00002866peer_ebgp_multihop_set_vty (struct vty *vty, const char *ip_str,
2867 const char *ttl_str)
paul718e3742002-12-13 20:15:29 +00002868{
2869 struct peer *peer;
paulfd79ac92004-10-13 05:06:08 +00002870 unsigned int ttl;
paul718e3742002-12-13 20:15:29 +00002871
2872 peer = peer_and_group_lookup_vty (vty, ip_str);
2873 if (! peer)
2874 return CMD_WARNING;
2875
2876 if (! ttl_str)
2877 ttl = TTL_MAX;
2878 else
2879 VTY_GET_INTEGER_RANGE ("TTL", ttl, ttl_str, 1, 255);
2880
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00002881 return bgp_vty_return (vty, peer_ebgp_multihop_set (peer, ttl));
paul718e3742002-12-13 20:15:29 +00002882}
2883
paul94f2b392005-06-28 12:44:16 +00002884static int
paulfd79ac92004-10-13 05:06:08 +00002885peer_ebgp_multihop_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00002886{
2887 struct peer *peer;
2888
2889 peer = peer_and_group_lookup_vty (vty, ip_str);
2890 if (! peer)
2891 return CMD_WARNING;
2892
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00002893 return bgp_vty_return (vty, peer_ebgp_multihop_unset (peer));
paul718e3742002-12-13 20:15:29 +00002894}
2895
2896/* neighbor ebgp-multihop. */
2897DEFUN (neighbor_ebgp_multihop,
2898 neighbor_ebgp_multihop_cmd,
2899 NEIGHBOR_CMD2 "ebgp-multihop",
2900 NEIGHBOR_STR
2901 NEIGHBOR_ADDR_STR2
2902 "Allow EBGP neighbors not on directly connected networks\n")
2903{
2904 return peer_ebgp_multihop_set_vty (vty, argv[0], NULL);
2905}
2906
2907DEFUN (neighbor_ebgp_multihop_ttl,
2908 neighbor_ebgp_multihop_ttl_cmd,
2909 NEIGHBOR_CMD2 "ebgp-multihop <1-255>",
2910 NEIGHBOR_STR
2911 NEIGHBOR_ADDR_STR2
2912 "Allow EBGP neighbors not on directly connected networks\n"
2913 "maximum hop count\n")
2914{
2915 return peer_ebgp_multihop_set_vty (vty, argv[0], argv[1]);
2916}
2917
2918DEFUN (no_neighbor_ebgp_multihop,
2919 no_neighbor_ebgp_multihop_cmd,
2920 NO_NEIGHBOR_CMD2 "ebgp-multihop",
2921 NO_STR
2922 NEIGHBOR_STR
2923 NEIGHBOR_ADDR_STR2
2924 "Allow EBGP neighbors not on directly connected networks\n")
2925{
2926 return peer_ebgp_multihop_unset_vty (vty, argv[0]);
2927}
2928
2929ALIAS (no_neighbor_ebgp_multihop,
2930 no_neighbor_ebgp_multihop_ttl_cmd,
2931 NO_NEIGHBOR_CMD2 "ebgp-multihop <1-255>",
2932 NO_STR
2933 NEIGHBOR_STR
2934 NEIGHBOR_ADDR_STR2
2935 "Allow EBGP neighbors not on directly connected networks\n"
2936 "maximum hop count\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02002937
hasso6ffd2072005-02-02 14:50:11 +00002938/* disable-connected-check */
2939DEFUN (neighbor_disable_connected_check,
2940 neighbor_disable_connected_check_cmd,
2941 NEIGHBOR_CMD2 "disable-connected-check",
2942 NEIGHBOR_STR
2943 NEIGHBOR_ADDR_STR2
2944 "one-hop away EBGP peer using loopback address\n")
2945{
2946 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK);
2947}
2948
2949DEFUN (no_neighbor_disable_connected_check,
2950 no_neighbor_disable_connected_check_cmd,
2951 NO_NEIGHBOR_CMD2 "disable-connected-check",
2952 NO_STR
2953 NEIGHBOR_STR
2954 NEIGHBOR_ADDR_STR2
2955 "one-hop away EBGP peer using loopback address\n")
2956{
2957 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK);
2958}
2959
paul718e3742002-12-13 20:15:29 +00002960/* Enforce multihop. */
hasso6ffd2072005-02-02 14:50:11 +00002961ALIAS (neighbor_disable_connected_check,
paul718e3742002-12-13 20:15:29 +00002962 neighbor_enforce_multihop_cmd,
2963 NEIGHBOR_CMD2 "enforce-multihop",
2964 NEIGHBOR_STR
2965 NEIGHBOR_ADDR_STR2
paule8e19462006-01-19 20:16:55 +00002966 "Enforce EBGP neighbors perform multihop\n")
paul718e3742002-12-13 20:15:29 +00002967
hasso6ffd2072005-02-02 14:50:11 +00002968/* Enforce multihop. */
2969ALIAS (no_neighbor_disable_connected_check,
paul718e3742002-12-13 20:15:29 +00002970 no_neighbor_enforce_multihop_cmd,
2971 NO_NEIGHBOR_CMD2 "enforce-multihop",
2972 NO_STR
2973 NEIGHBOR_STR
2974 NEIGHBOR_ADDR_STR2
paule8e19462006-01-19 20:16:55 +00002975 "Enforce EBGP neighbors perform multihop\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02002976
paul718e3742002-12-13 20:15:29 +00002977DEFUN (neighbor_description,
2978 neighbor_description_cmd,
2979 NEIGHBOR_CMD2 "description .LINE",
2980 NEIGHBOR_STR
2981 NEIGHBOR_ADDR_STR2
2982 "Neighbor specific description\n"
2983 "Up to 80 characters describing this neighbor\n")
2984{
2985 struct peer *peer;
paul718e3742002-12-13 20:15:29 +00002986 char *str;
paul718e3742002-12-13 20:15:29 +00002987
2988 peer = peer_and_group_lookup_vty (vty, argv[0]);
2989 if (! peer)
2990 return CMD_WARNING;
2991
2992 if (argc == 1)
2993 return CMD_SUCCESS;
2994
ajs3b8b1852005-01-29 18:19:13 +00002995 str = argv_concat(argv, argc, 1);
paul718e3742002-12-13 20:15:29 +00002996
2997 peer_description_set (peer, str);
2998
ajs3b8b1852005-01-29 18:19:13 +00002999 XFREE (MTYPE_TMP, str);
paul718e3742002-12-13 20:15:29 +00003000
3001 return CMD_SUCCESS;
3002}
3003
3004DEFUN (no_neighbor_description,
3005 no_neighbor_description_cmd,
3006 NO_NEIGHBOR_CMD2 "description",
3007 NO_STR
3008 NEIGHBOR_STR
3009 NEIGHBOR_ADDR_STR2
3010 "Neighbor specific description\n")
3011{
3012 struct peer *peer;
3013
3014 peer = peer_and_group_lookup_vty (vty, argv[0]);
3015 if (! peer)
3016 return CMD_WARNING;
3017
3018 peer_description_unset (peer);
3019
3020 return CMD_SUCCESS;
3021}
3022
3023ALIAS (no_neighbor_description,
3024 no_neighbor_description_val_cmd,
3025 NO_NEIGHBOR_CMD2 "description .LINE",
3026 NO_STR
3027 NEIGHBOR_STR
3028 NEIGHBOR_ADDR_STR2
3029 "Neighbor specific description\n"
3030 "Up to 80 characters describing this neighbor\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003031
paul718e3742002-12-13 20:15:29 +00003032/* Neighbor update-source. */
paul94f2b392005-06-28 12:44:16 +00003033static int
paulfd79ac92004-10-13 05:06:08 +00003034peer_update_source_vty (struct vty *vty, const char *peer_str,
3035 const char *source_str)
paul718e3742002-12-13 20:15:29 +00003036{
3037 struct peer *peer;
paul718e3742002-12-13 20:15:29 +00003038
3039 peer = peer_and_group_lookup_vty (vty, peer_str);
3040 if (! peer)
3041 return CMD_WARNING;
3042
3043 if (source_str)
3044 {
Jorge Boncompte [DTI2]c63b83f2012-04-10 16:57:24 +02003045 union sockunion su;
3046 int ret = str2sockunion (source_str, &su);
3047
3048 if (ret == 0)
3049 peer_update_source_addr_set (peer, &su);
paul718e3742002-12-13 20:15:29 +00003050 else
3051 peer_update_source_if_set (peer, source_str);
3052 }
3053 else
3054 peer_update_source_unset (peer);
3055
3056 return CMD_SUCCESS;
3057}
3058
Paul Jakma9a1a3312009-07-27 12:27:55 +01003059#define BGP_UPDATE_SOURCE_STR "(A.B.C.D|X:X::X:X|WORD)"
Paul Jakma369688c2006-05-23 22:27:55 +00003060#define BGP_UPDATE_SOURCE_HELP_STR \
3061 "IPv4 address\n" \
Paul Jakma9a1a3312009-07-27 12:27:55 +01003062 "IPv6 address\n" \
3063 "Interface name (requires zebra to be running)\n"
Paul Jakma369688c2006-05-23 22:27:55 +00003064
paul718e3742002-12-13 20:15:29 +00003065DEFUN (neighbor_update_source,
3066 neighbor_update_source_cmd,
Paul Jakma369688c2006-05-23 22:27:55 +00003067 NEIGHBOR_CMD2 "update-source " BGP_UPDATE_SOURCE_STR,
paul718e3742002-12-13 20:15:29 +00003068 NEIGHBOR_STR
3069 NEIGHBOR_ADDR_STR2
3070 "Source of routing updates\n"
Paul Jakma369688c2006-05-23 22:27:55 +00003071 BGP_UPDATE_SOURCE_HELP_STR)
paul718e3742002-12-13 20:15:29 +00003072{
3073 return peer_update_source_vty (vty, argv[0], argv[1]);
3074}
3075
3076DEFUN (no_neighbor_update_source,
3077 no_neighbor_update_source_cmd,
3078 NO_NEIGHBOR_CMD2 "update-source",
3079 NO_STR
3080 NEIGHBOR_STR
3081 NEIGHBOR_ADDR_STR2
Paul Jakma369688c2006-05-23 22:27:55 +00003082 "Source of routing updates\n")
paul718e3742002-12-13 20:15:29 +00003083{
3084 return peer_update_source_vty (vty, argv[0], NULL);
3085}
David Lamparter6b0655a2014-06-04 06:53:35 +02003086
paul94f2b392005-06-28 12:44:16 +00003087static int
paulfd79ac92004-10-13 05:06:08 +00003088peer_default_originate_set_vty (struct vty *vty, const char *peer_str,
3089 afi_t afi, safi_t safi,
3090 const char *rmap, int set)
paul718e3742002-12-13 20:15:29 +00003091{
3092 int ret;
3093 struct peer *peer;
3094
3095 peer = peer_and_group_lookup_vty (vty, peer_str);
3096 if (! peer)
3097 return CMD_WARNING;
3098
3099 if (set)
3100 ret = peer_default_originate_set (peer, afi, safi, rmap);
3101 else
3102 ret = peer_default_originate_unset (peer, afi, safi);
3103
3104 return bgp_vty_return (vty, ret);
3105}
3106
3107/* neighbor default-originate. */
3108DEFUN (neighbor_default_originate,
3109 neighbor_default_originate_cmd,
3110 NEIGHBOR_CMD2 "default-originate",
3111 NEIGHBOR_STR
3112 NEIGHBOR_ADDR_STR2
3113 "Originate default route to this neighbor\n")
3114{
3115 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
3116 bgp_node_safi (vty), NULL, 1);
3117}
3118
3119DEFUN (neighbor_default_originate_rmap,
3120 neighbor_default_originate_rmap_cmd,
3121 NEIGHBOR_CMD2 "default-originate route-map WORD",
3122 NEIGHBOR_STR
3123 NEIGHBOR_ADDR_STR2
3124 "Originate default route to this neighbor\n"
3125 "Route-map to specify criteria to originate default\n"
3126 "route-map name\n")
3127{
3128 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
3129 bgp_node_safi (vty), argv[1], 1);
3130}
3131
3132DEFUN (no_neighbor_default_originate,
3133 no_neighbor_default_originate_cmd,
3134 NO_NEIGHBOR_CMD2 "default-originate",
3135 NO_STR
3136 NEIGHBOR_STR
3137 NEIGHBOR_ADDR_STR2
3138 "Originate default route to this neighbor\n")
3139{
3140 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
3141 bgp_node_safi (vty), NULL, 0);
3142}
3143
3144ALIAS (no_neighbor_default_originate,
3145 no_neighbor_default_originate_rmap_cmd,
3146 NO_NEIGHBOR_CMD2 "default-originate route-map WORD",
3147 NO_STR
3148 NEIGHBOR_STR
3149 NEIGHBOR_ADDR_STR2
3150 "Originate default route to this neighbor\n"
3151 "Route-map to specify criteria to originate default\n"
3152 "route-map name\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003153
paul718e3742002-12-13 20:15:29 +00003154/* Set neighbor's BGP port. */
paul94f2b392005-06-28 12:44:16 +00003155static int
paulfd79ac92004-10-13 05:06:08 +00003156peer_port_vty (struct vty *vty, const char *ip_str, int afi,
3157 const char *port_str)
paul718e3742002-12-13 20:15:29 +00003158{
3159 struct peer *peer;
3160 u_int16_t port;
3161 struct servent *sp;
3162
3163 peer = peer_lookup_vty (vty, ip_str);
3164 if (! peer)
3165 return CMD_WARNING;
3166
3167 if (! port_str)
3168 {
3169 sp = getservbyname ("bgp", "tcp");
3170 port = (sp == NULL) ? BGP_PORT_DEFAULT : ntohs (sp->s_port);
3171 }
3172 else
3173 {
3174 VTY_GET_INTEGER("port", port, port_str);
3175 }
3176
3177 peer_port_set (peer, port);
3178
3179 return CMD_SUCCESS;
3180}
3181
hassof4184462005-02-01 20:13:16 +00003182/* Set specified peer's BGP port. */
paul718e3742002-12-13 20:15:29 +00003183DEFUN (neighbor_port,
3184 neighbor_port_cmd,
3185 NEIGHBOR_CMD "port <0-65535>",
3186 NEIGHBOR_STR
3187 NEIGHBOR_ADDR_STR
3188 "Neighbor's BGP port\n"
3189 "TCP port number\n")
3190{
3191 return peer_port_vty (vty, argv[0], AFI_IP, argv[1]);
3192}
3193
3194DEFUN (no_neighbor_port,
3195 no_neighbor_port_cmd,
3196 NO_NEIGHBOR_CMD "port",
3197 NO_STR
3198 NEIGHBOR_STR
3199 NEIGHBOR_ADDR_STR
3200 "Neighbor's BGP port\n")
3201{
3202 return peer_port_vty (vty, argv[0], AFI_IP, NULL);
3203}
3204
3205ALIAS (no_neighbor_port,
3206 no_neighbor_port_val_cmd,
3207 NO_NEIGHBOR_CMD "port <0-65535>",
3208 NO_STR
3209 NEIGHBOR_STR
3210 NEIGHBOR_ADDR_STR
3211 "Neighbor's BGP port\n"
3212 "TCP port number\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003213
paul718e3742002-12-13 20:15:29 +00003214/* neighbor weight. */
paul94f2b392005-06-28 12:44:16 +00003215static int
paulfd79ac92004-10-13 05:06:08 +00003216peer_weight_set_vty (struct vty *vty, const char *ip_str,
3217 const char *weight_str)
paul718e3742002-12-13 20:15:29 +00003218{
paul718e3742002-12-13 20:15:29 +00003219 struct peer *peer;
3220 unsigned long weight;
3221
3222 peer = peer_and_group_lookup_vty (vty, ip_str);
3223 if (! peer)
3224 return CMD_WARNING;
3225
3226 VTY_GET_INTEGER_RANGE("weight", weight, weight_str, 0, 65535);
3227
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003228 return bgp_vty_return (vty, peer_weight_set (peer, weight));
paul718e3742002-12-13 20:15:29 +00003229}
3230
paul94f2b392005-06-28 12:44:16 +00003231static int
paulfd79ac92004-10-13 05:06:08 +00003232peer_weight_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00003233{
3234 struct peer *peer;
3235
3236 peer = peer_and_group_lookup_vty (vty, ip_str);
3237 if (! peer)
3238 return CMD_WARNING;
3239
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003240 return bgp_vty_return (vty, peer_weight_unset (peer));
paul718e3742002-12-13 20:15:29 +00003241}
3242
3243DEFUN (neighbor_weight,
3244 neighbor_weight_cmd,
3245 NEIGHBOR_CMD2 "weight <0-65535>",
3246 NEIGHBOR_STR
3247 NEIGHBOR_ADDR_STR2
3248 "Set default weight for routes from this neighbor\n"
3249 "default weight\n")
3250{
3251 return peer_weight_set_vty (vty, argv[0], argv[1]);
3252}
3253
3254DEFUN (no_neighbor_weight,
3255 no_neighbor_weight_cmd,
3256 NO_NEIGHBOR_CMD2 "weight",
3257 NO_STR
3258 NEIGHBOR_STR
3259 NEIGHBOR_ADDR_STR2
3260 "Set default weight for routes from this neighbor\n")
3261{
3262 return peer_weight_unset_vty (vty, argv[0]);
3263}
3264
3265ALIAS (no_neighbor_weight,
3266 no_neighbor_weight_val_cmd,
3267 NO_NEIGHBOR_CMD2 "weight <0-65535>",
3268 NO_STR
3269 NEIGHBOR_STR
3270 NEIGHBOR_ADDR_STR2
3271 "Set default weight for routes from this neighbor\n"
3272 "default weight\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003273
paul718e3742002-12-13 20:15:29 +00003274/* Override capability negotiation. */
3275DEFUN (neighbor_override_capability,
3276 neighbor_override_capability_cmd,
3277 NEIGHBOR_CMD2 "override-capability",
3278 NEIGHBOR_STR
3279 NEIGHBOR_ADDR_STR2
3280 "Override capability negotiation result\n")
3281{
3282 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY);
3283}
3284
3285DEFUN (no_neighbor_override_capability,
3286 no_neighbor_override_capability_cmd,
3287 NO_NEIGHBOR_CMD2 "override-capability",
3288 NO_STR
3289 NEIGHBOR_STR
3290 NEIGHBOR_ADDR_STR2
3291 "Override capability negotiation result\n")
3292{
3293 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY);
3294}
David Lamparter6b0655a2014-06-04 06:53:35 +02003295
paul718e3742002-12-13 20:15:29 +00003296DEFUN (neighbor_strict_capability,
3297 neighbor_strict_capability_cmd,
3298 NEIGHBOR_CMD "strict-capability-match",
3299 NEIGHBOR_STR
3300 NEIGHBOR_ADDR_STR
3301 "Strict capability negotiation match\n")
3302{
3303 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH);
3304}
3305
3306DEFUN (no_neighbor_strict_capability,
3307 no_neighbor_strict_capability_cmd,
3308 NO_NEIGHBOR_CMD "strict-capability-match",
3309 NO_STR
3310 NEIGHBOR_STR
3311 NEIGHBOR_ADDR_STR
3312 "Strict capability negotiation match\n")
3313{
3314 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH);
3315}
David Lamparter6b0655a2014-06-04 06:53:35 +02003316
paul94f2b392005-06-28 12:44:16 +00003317static int
paulfd79ac92004-10-13 05:06:08 +00003318peer_timers_set_vty (struct vty *vty, const char *ip_str,
3319 const char *keep_str, const char *hold_str)
paul718e3742002-12-13 20:15:29 +00003320{
3321 int ret;
3322 struct peer *peer;
3323 u_int32_t keepalive;
3324 u_int32_t holdtime;
3325
3326 peer = peer_and_group_lookup_vty (vty, ip_str);
3327 if (! peer)
3328 return CMD_WARNING;
3329
3330 VTY_GET_INTEGER_RANGE ("Keepalive", keepalive, keep_str, 0, 65535);
3331 VTY_GET_INTEGER_RANGE ("Holdtime", holdtime, hold_str, 0, 65535);
3332
3333 ret = peer_timers_set (peer, keepalive, holdtime);
3334
3335 return bgp_vty_return (vty, ret);
3336}
David Lamparter6b0655a2014-06-04 06:53:35 +02003337
paul94f2b392005-06-28 12:44:16 +00003338static int
paulfd79ac92004-10-13 05:06:08 +00003339peer_timers_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00003340{
3341 int ret;
3342 struct peer *peer;
3343
3344 peer = peer_lookup_vty (vty, ip_str);
3345 if (! peer)
3346 return CMD_WARNING;
3347
3348 ret = peer_timers_unset (peer);
3349
3350 return bgp_vty_return (vty, ret);
3351}
3352
3353DEFUN (neighbor_timers,
3354 neighbor_timers_cmd,
3355 NEIGHBOR_CMD2 "timers <0-65535> <0-65535>",
3356 NEIGHBOR_STR
3357 NEIGHBOR_ADDR_STR2
3358 "BGP per neighbor timers\n"
3359 "Keepalive interval\n"
3360 "Holdtime\n")
3361{
3362 return peer_timers_set_vty (vty, argv[0], argv[1], argv[2]);
3363}
3364
3365DEFUN (no_neighbor_timers,
3366 no_neighbor_timers_cmd,
3367 NO_NEIGHBOR_CMD2 "timers",
3368 NO_STR
3369 NEIGHBOR_STR
3370 NEIGHBOR_ADDR_STR2
3371 "BGP per neighbor timers\n")
3372{
3373 return peer_timers_unset_vty (vty, argv[0]);
3374}
David Lamparter6b0655a2014-06-04 06:53:35 +02003375
paul94f2b392005-06-28 12:44:16 +00003376static int
paulfd79ac92004-10-13 05:06:08 +00003377peer_timers_connect_set_vty (struct vty *vty, const char *ip_str,
3378 const char *time_str)
paul718e3742002-12-13 20:15:29 +00003379{
paul718e3742002-12-13 20:15:29 +00003380 struct peer *peer;
3381 u_int32_t connect;
3382
Daniel Walton0d7435f2015-10-22 11:35:20 +03003383 peer = peer_and_group_lookup_vty (vty, ip_str);
paul718e3742002-12-13 20:15:29 +00003384 if (! peer)
3385 return CMD_WARNING;
3386
3387 VTY_GET_INTEGER_RANGE ("Connect time", connect, time_str, 0, 65535);
3388
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003389 return bgp_vty_return (vty, peer_timers_connect_set (peer, connect));
paul718e3742002-12-13 20:15:29 +00003390}
3391
paul94f2b392005-06-28 12:44:16 +00003392static int
paulfd79ac92004-10-13 05:06:08 +00003393peer_timers_connect_unset_vty (struct vty *vty, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00003394{
paul718e3742002-12-13 20:15:29 +00003395 struct peer *peer;
3396
3397 peer = peer_and_group_lookup_vty (vty, ip_str);
3398 if (! peer)
3399 return CMD_WARNING;
3400
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003401 return bgp_vty_return (vty, peer_timers_connect_unset (peer));
paul718e3742002-12-13 20:15:29 +00003402}
3403
3404DEFUN (neighbor_timers_connect,
3405 neighbor_timers_connect_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003406 NEIGHBOR_CMD2 "timers connect <1-65535>",
paul718e3742002-12-13 20:15:29 +00003407 NEIGHBOR_STR
Daniel Walton0d7435f2015-10-22 11:35:20 +03003408 NEIGHBOR_ADDR_STR2
paul718e3742002-12-13 20:15:29 +00003409 "BGP per neighbor timers\n"
3410 "BGP connect timer\n"
3411 "Connect timer\n")
3412{
3413 return peer_timers_connect_set_vty (vty, argv[0], argv[1]);
3414}
3415
3416DEFUN (no_neighbor_timers_connect,
3417 no_neighbor_timers_connect_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003418 NO_NEIGHBOR_CMD2 "timers connect",
paul718e3742002-12-13 20:15:29 +00003419 NO_STR
3420 NEIGHBOR_STR
Daniel Walton0d7435f2015-10-22 11:35:20 +03003421 NEIGHBOR_ADDR_STR2
paul718e3742002-12-13 20:15:29 +00003422 "BGP per neighbor timers\n"
3423 "BGP connect timer\n")
3424{
3425 return peer_timers_connect_unset_vty (vty, argv[0]);
3426}
3427
3428ALIAS (no_neighbor_timers_connect,
3429 no_neighbor_timers_connect_val_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003430 NO_NEIGHBOR_CMD2 "timers connect <1-65535>",
paul718e3742002-12-13 20:15:29 +00003431 NO_STR
3432 NEIGHBOR_STR
Daniel Walton0d7435f2015-10-22 11:35:20 +03003433 NEIGHBOR_ADDR_STR2
paul718e3742002-12-13 20:15:29 +00003434 "BGP per neighbor timers\n"
3435 "BGP connect timer\n"
3436 "Connect timer\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003437
paul94f2b392005-06-28 12:44:16 +00003438static int
paulfd79ac92004-10-13 05:06:08 +00003439peer_advertise_interval_vty (struct vty *vty, const char *ip_str,
3440 const char *time_str, int set)
paul718e3742002-12-13 20:15:29 +00003441{
3442 int ret;
3443 struct peer *peer;
3444 u_int32_t routeadv = 0;
3445
Daniel Walton0d7435f2015-10-22 11:35:20 +03003446 peer = peer_and_group_lookup_vty (vty, ip_str);
paul718e3742002-12-13 20:15:29 +00003447 if (! peer)
3448 return CMD_WARNING;
3449
3450 if (time_str)
3451 VTY_GET_INTEGER_RANGE ("advertise interval", routeadv, time_str, 0, 600);
3452
3453 if (set)
3454 ret = peer_advertise_interval_set (peer, routeadv);
3455 else
3456 ret = peer_advertise_interval_unset (peer);
3457
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003458 return bgp_vty_return (vty, ret);
paul718e3742002-12-13 20:15:29 +00003459}
3460
3461DEFUN (neighbor_advertise_interval,
3462 neighbor_advertise_interval_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003463 NEIGHBOR_CMD2 "advertisement-interval <0-600>",
paul718e3742002-12-13 20:15:29 +00003464 NEIGHBOR_STR
Daniel Walton0d7435f2015-10-22 11:35:20 +03003465 NEIGHBOR_ADDR_STR2
paul718e3742002-12-13 20:15:29 +00003466 "Minimum interval between sending BGP routing updates\n"
3467 "time in seconds\n")
3468{
3469 return peer_advertise_interval_vty (vty, argv[0], argv[1], 1);
3470}
3471
3472DEFUN (no_neighbor_advertise_interval,
3473 no_neighbor_advertise_interval_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003474 NO_NEIGHBOR_CMD2 "advertisement-interval",
paul718e3742002-12-13 20:15:29 +00003475 NO_STR
3476 NEIGHBOR_STR
Daniel Walton0d7435f2015-10-22 11:35:20 +03003477 NEIGHBOR_ADDR_STR2
paul718e3742002-12-13 20:15:29 +00003478 "Minimum interval between sending BGP routing updates\n")
3479{
3480 return peer_advertise_interval_vty (vty, argv[0], NULL, 0);
3481}
3482
3483ALIAS (no_neighbor_advertise_interval,
3484 no_neighbor_advertise_interval_val_cmd,
Daniel Walton0d7435f2015-10-22 11:35:20 +03003485 NO_NEIGHBOR_CMD2 "advertisement-interval <0-600>",
paul718e3742002-12-13 20:15:29 +00003486 NO_STR
3487 NEIGHBOR_STR
Daniel Walton0d7435f2015-10-22 11:35:20 +03003488 NEIGHBOR_ADDR_STR2
paul718e3742002-12-13 20:15:29 +00003489 "Minimum interval between sending BGP routing updates\n"
3490 "time in seconds\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02003491
paul718e3742002-12-13 20:15:29 +00003492/* neighbor interface */
paul94f2b392005-06-28 12:44:16 +00003493static int
paulfd79ac92004-10-13 05:06:08 +00003494peer_interface_vty (struct vty *vty, const char *ip_str, const char *str)
paul718e3742002-12-13 20:15:29 +00003495{
3496 int ret;
3497 struct peer *peer;
3498
3499 peer = peer_lookup_vty (vty, ip_str);
3500 if (! peer)
3501 return CMD_WARNING;
3502
3503 if (str)
3504 ret = peer_interface_set (peer, str);
3505 else
3506 ret = peer_interface_unset (peer);
3507
Paul Jakma7aa9dce2014-09-19 14:42:23 +01003508 return bgp_vty_return (vty, ret);
paul718e3742002-12-13 20:15:29 +00003509}
3510
3511DEFUN (neighbor_interface,
3512 neighbor_interface_cmd,
3513 NEIGHBOR_CMD "interface WORD",
3514 NEIGHBOR_STR
3515 NEIGHBOR_ADDR_STR
3516 "Interface\n"
3517 "Interface name\n")
3518{
3519 return peer_interface_vty (vty, argv[0], argv[1]);
3520}
3521
3522DEFUN (no_neighbor_interface,
3523 no_neighbor_interface_cmd,
3524 NO_NEIGHBOR_CMD "interface WORD",
3525 NO_STR
3526 NEIGHBOR_STR
3527 NEIGHBOR_ADDR_STR
3528 "Interface\n"
3529 "Interface name\n")
3530{
3531 return peer_interface_vty (vty, argv[0], NULL);
3532}
David Lamparter6b0655a2014-06-04 06:53:35 +02003533
paul718e3742002-12-13 20:15:29 +00003534/* Set distribute list to the peer. */
paul94f2b392005-06-28 12:44:16 +00003535static int
paulfd79ac92004-10-13 05:06:08 +00003536peer_distribute_set_vty (struct vty *vty, const char *ip_str,
3537 afi_t afi, safi_t safi,
3538 const char *name_str, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003539{
3540 int ret;
3541 struct peer *peer;
3542 int direct = FILTER_IN;
3543
3544 peer = peer_and_group_lookup_vty (vty, ip_str);
3545 if (! peer)
3546 return CMD_WARNING;
3547
3548 /* Check filter direction. */
3549 if (strncmp (direct_str, "i", 1) == 0)
3550 direct = FILTER_IN;
3551 else if (strncmp (direct_str, "o", 1) == 0)
3552 direct = FILTER_OUT;
3553
3554 ret = peer_distribute_set (peer, afi, safi, direct, name_str);
3555
3556 return bgp_vty_return (vty, ret);
3557}
3558
paul94f2b392005-06-28 12:44:16 +00003559static int
paulfd79ac92004-10-13 05:06:08 +00003560peer_distribute_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
3561 safi_t safi, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003562{
3563 int ret;
3564 struct peer *peer;
3565 int direct = FILTER_IN;
3566
3567 peer = peer_and_group_lookup_vty (vty, ip_str);
3568 if (! peer)
3569 return CMD_WARNING;
3570
3571 /* Check filter direction. */
3572 if (strncmp (direct_str, "i", 1) == 0)
3573 direct = FILTER_IN;
3574 else if (strncmp (direct_str, "o", 1) == 0)
3575 direct = FILTER_OUT;
3576
3577 ret = peer_distribute_unset (peer, afi, safi, direct);
3578
3579 return bgp_vty_return (vty, ret);
3580}
3581
3582DEFUN (neighbor_distribute_list,
3583 neighbor_distribute_list_cmd,
3584 NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)",
3585 NEIGHBOR_STR
3586 NEIGHBOR_ADDR_STR2
3587 "Filter updates to/from this neighbor\n"
3588 "IP access-list number\n"
3589 "IP access-list number (expanded range)\n"
3590 "IP Access-list name\n"
3591 "Filter incoming updates\n"
3592 "Filter outgoing updates\n")
3593{
3594 return peer_distribute_set_vty (vty, argv[0], bgp_node_afi (vty),
3595 bgp_node_safi (vty), argv[1], argv[2]);
3596}
3597
3598DEFUN (no_neighbor_distribute_list,
3599 no_neighbor_distribute_list_cmd,
3600 NO_NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)",
3601 NO_STR
3602 NEIGHBOR_STR
3603 NEIGHBOR_ADDR_STR2
3604 "Filter updates to/from this neighbor\n"
3605 "IP access-list number\n"
3606 "IP access-list number (expanded range)\n"
3607 "IP Access-list name\n"
3608 "Filter incoming updates\n"
3609 "Filter outgoing updates\n")
3610{
3611 return peer_distribute_unset_vty (vty, argv[0], bgp_node_afi (vty),
3612 bgp_node_safi (vty), argv[2]);
3613}
David Lamparter6b0655a2014-06-04 06:53:35 +02003614
paul718e3742002-12-13 20:15:29 +00003615/* Set prefix list to the peer. */
paul94f2b392005-06-28 12:44:16 +00003616static int
paulfd79ac92004-10-13 05:06:08 +00003617peer_prefix_list_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
3618 safi_t safi, const char *name_str,
3619 const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003620{
3621 int ret;
3622 struct peer *peer;
3623 int direct = FILTER_IN;
3624
3625 peer = peer_and_group_lookup_vty (vty, ip_str);
3626 if (! peer)
3627 return CMD_WARNING;
3628
3629 /* Check filter direction. */
3630 if (strncmp (direct_str, "i", 1) == 0)
3631 direct = FILTER_IN;
3632 else if (strncmp (direct_str, "o", 1) == 0)
3633 direct = FILTER_OUT;
3634
3635 ret = peer_prefix_list_set (peer, afi, safi, direct, name_str);
3636
3637 return bgp_vty_return (vty, ret);
3638}
3639
paul94f2b392005-06-28 12:44:16 +00003640static int
paulfd79ac92004-10-13 05:06:08 +00003641peer_prefix_list_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
3642 safi_t safi, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003643{
3644 int ret;
3645 struct peer *peer;
3646 int direct = FILTER_IN;
3647
3648 peer = peer_and_group_lookup_vty (vty, ip_str);
3649 if (! peer)
3650 return CMD_WARNING;
3651
3652 /* Check filter direction. */
3653 if (strncmp (direct_str, "i", 1) == 0)
3654 direct = FILTER_IN;
3655 else if (strncmp (direct_str, "o", 1) == 0)
3656 direct = FILTER_OUT;
3657
3658 ret = peer_prefix_list_unset (peer, afi, safi, direct);
3659
3660 return bgp_vty_return (vty, ret);
3661}
3662
3663DEFUN (neighbor_prefix_list,
3664 neighbor_prefix_list_cmd,
3665 NEIGHBOR_CMD2 "prefix-list WORD (in|out)",
3666 NEIGHBOR_STR
3667 NEIGHBOR_ADDR_STR2
3668 "Filter updates to/from this neighbor\n"
3669 "Name of a prefix list\n"
3670 "Filter incoming updates\n"
3671 "Filter outgoing updates\n")
3672{
3673 return peer_prefix_list_set_vty (vty, argv[0], bgp_node_afi (vty),
3674 bgp_node_safi (vty), argv[1], argv[2]);
3675}
3676
3677DEFUN (no_neighbor_prefix_list,
3678 no_neighbor_prefix_list_cmd,
3679 NO_NEIGHBOR_CMD2 "prefix-list WORD (in|out)",
3680 NO_STR
3681 NEIGHBOR_STR
3682 NEIGHBOR_ADDR_STR2
3683 "Filter updates to/from this neighbor\n"
3684 "Name of a prefix list\n"
3685 "Filter incoming updates\n"
3686 "Filter outgoing updates\n")
3687{
3688 return peer_prefix_list_unset_vty (vty, argv[0], bgp_node_afi (vty),
3689 bgp_node_safi (vty), argv[2]);
3690}
David Lamparter6b0655a2014-06-04 06:53:35 +02003691
paul94f2b392005-06-28 12:44:16 +00003692static int
paulfd79ac92004-10-13 05:06:08 +00003693peer_aslist_set_vty (struct vty *vty, const char *ip_str,
3694 afi_t afi, safi_t safi,
3695 const char *name_str, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003696{
3697 int ret;
3698 struct peer *peer;
3699 int direct = FILTER_IN;
3700
3701 peer = peer_and_group_lookup_vty (vty, ip_str);
3702 if (! peer)
3703 return CMD_WARNING;
3704
3705 /* Check filter direction. */
3706 if (strncmp (direct_str, "i", 1) == 0)
3707 direct = FILTER_IN;
3708 else if (strncmp (direct_str, "o", 1) == 0)
3709 direct = FILTER_OUT;
3710
3711 ret = peer_aslist_set (peer, afi, safi, direct, name_str);
3712
3713 return bgp_vty_return (vty, ret);
3714}
3715
paul94f2b392005-06-28 12:44:16 +00003716static int
paulfd79ac92004-10-13 05:06:08 +00003717peer_aslist_unset_vty (struct vty *vty, const char *ip_str,
3718 afi_t afi, safi_t safi,
3719 const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003720{
3721 int ret;
3722 struct peer *peer;
3723 int direct = FILTER_IN;
3724
3725 peer = peer_and_group_lookup_vty (vty, ip_str);
3726 if (! peer)
3727 return CMD_WARNING;
3728
3729 /* Check filter direction. */
3730 if (strncmp (direct_str, "i", 1) == 0)
3731 direct = FILTER_IN;
3732 else if (strncmp (direct_str, "o", 1) == 0)
3733 direct = FILTER_OUT;
3734
3735 ret = peer_aslist_unset (peer, afi, safi, direct);
3736
3737 return bgp_vty_return (vty, ret);
3738}
3739
3740DEFUN (neighbor_filter_list,
3741 neighbor_filter_list_cmd,
3742 NEIGHBOR_CMD2 "filter-list WORD (in|out)",
3743 NEIGHBOR_STR
3744 NEIGHBOR_ADDR_STR2
3745 "Establish BGP filters\n"
3746 "AS path access-list name\n"
3747 "Filter incoming routes\n"
3748 "Filter outgoing routes\n")
3749{
3750 return peer_aslist_set_vty (vty, argv[0], bgp_node_afi (vty),
3751 bgp_node_safi (vty), argv[1], argv[2]);
3752}
3753
3754DEFUN (no_neighbor_filter_list,
3755 no_neighbor_filter_list_cmd,
3756 NO_NEIGHBOR_CMD2 "filter-list WORD (in|out)",
3757 NO_STR
3758 NEIGHBOR_STR
3759 NEIGHBOR_ADDR_STR2
3760 "Establish BGP filters\n"
3761 "AS path access-list name\n"
3762 "Filter incoming routes\n"
3763 "Filter outgoing routes\n")
3764{
3765 return peer_aslist_unset_vty (vty, argv[0], bgp_node_afi (vty),
3766 bgp_node_safi (vty), argv[2]);
3767}
David Lamparter6b0655a2014-06-04 06:53:35 +02003768
paul718e3742002-12-13 20:15:29 +00003769/* Set route-map to the peer. */
paul94f2b392005-06-28 12:44:16 +00003770static int
paulfd79ac92004-10-13 05:06:08 +00003771peer_route_map_set_vty (struct vty *vty, const char *ip_str,
3772 afi_t afi, safi_t safi,
3773 const char *name_str, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003774{
3775 int ret;
3776 struct peer *peer;
paulfee0f4c2004-09-13 05:12:46 +00003777 int direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003778
3779 peer = peer_and_group_lookup_vty (vty, ip_str);
3780 if (! peer)
3781 return CMD_WARNING;
3782
3783 /* Check filter direction. */
paulfee0f4c2004-09-13 05:12:46 +00003784 if (strncmp (direct_str, "in", 2) == 0)
3785 direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003786 else if (strncmp (direct_str, "o", 1) == 0)
paulfee0f4c2004-09-13 05:12:46 +00003787 direct = RMAP_OUT;
3788 else if (strncmp (direct_str, "im", 2) == 0)
3789 direct = RMAP_IMPORT;
3790 else if (strncmp (direct_str, "e", 1) == 0)
3791 direct = RMAP_EXPORT;
paul718e3742002-12-13 20:15:29 +00003792
3793 ret = peer_route_map_set (peer, afi, safi, direct, name_str);
3794
3795 return bgp_vty_return (vty, ret);
3796}
3797
paul94f2b392005-06-28 12:44:16 +00003798static int
paulfd79ac92004-10-13 05:06:08 +00003799peer_route_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
3800 safi_t safi, const char *direct_str)
paul718e3742002-12-13 20:15:29 +00003801{
3802 int ret;
3803 struct peer *peer;
paulfee0f4c2004-09-13 05:12:46 +00003804 int direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003805
3806 peer = peer_and_group_lookup_vty (vty, ip_str);
3807 if (! peer)
3808 return CMD_WARNING;
3809
3810 /* Check filter direction. */
paulfee0f4c2004-09-13 05:12:46 +00003811 if (strncmp (direct_str, "in", 2) == 0)
3812 direct = RMAP_IN;
paul718e3742002-12-13 20:15:29 +00003813 else if (strncmp (direct_str, "o", 1) == 0)
paulfee0f4c2004-09-13 05:12:46 +00003814 direct = RMAP_OUT;
3815 else if (strncmp (direct_str, "im", 2) == 0)
3816 direct = RMAP_IMPORT;
3817 else if (strncmp (direct_str, "e", 1) == 0)
3818 direct = RMAP_EXPORT;
paul718e3742002-12-13 20:15:29 +00003819
3820 ret = peer_route_map_unset (peer, afi, safi, direct);
3821
3822 return bgp_vty_return (vty, ret);
3823}
3824
3825DEFUN (neighbor_route_map,
3826 neighbor_route_map_cmd,
paulfee0f4c2004-09-13 05:12:46 +00003827 NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)",
paul718e3742002-12-13 20:15:29 +00003828 NEIGHBOR_STR
3829 NEIGHBOR_ADDR_STR2
3830 "Apply route map to neighbor\n"
3831 "Name of route map\n"
3832 "Apply map to incoming routes\n"
paulfee0f4c2004-09-13 05:12:46 +00003833 "Apply map to outbound routes\n"
3834 "Apply map to routes going into a Route-Server client's table\n"
3835 "Apply map to routes coming from a Route-Server client")
paul718e3742002-12-13 20:15:29 +00003836{
3837 return peer_route_map_set_vty (vty, argv[0], bgp_node_afi (vty),
3838 bgp_node_safi (vty), argv[1], argv[2]);
3839}
3840
3841DEFUN (no_neighbor_route_map,
3842 no_neighbor_route_map_cmd,
paulfee0f4c2004-09-13 05:12:46 +00003843 NO_NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)",
paul718e3742002-12-13 20:15:29 +00003844 NO_STR
3845 NEIGHBOR_STR
3846 NEIGHBOR_ADDR_STR2
3847 "Apply route map to neighbor\n"
3848 "Name of route map\n"
3849 "Apply map to incoming routes\n"
paulfee0f4c2004-09-13 05:12:46 +00003850 "Apply map to outbound routes\n"
3851 "Apply map to routes going into a Route-Server client's table\n"
3852 "Apply map to routes coming from a Route-Server client")
paul718e3742002-12-13 20:15:29 +00003853{
3854 return peer_route_map_unset_vty (vty, argv[0], bgp_node_afi (vty),
3855 bgp_node_safi (vty), argv[2]);
3856}
David Lamparter6b0655a2014-06-04 06:53:35 +02003857
paul718e3742002-12-13 20:15:29 +00003858/* Set unsuppress-map to the peer. */
paul94f2b392005-06-28 12:44:16 +00003859static int
paulfd79ac92004-10-13 05:06:08 +00003860peer_unsuppress_map_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
3861 safi_t safi, const char *name_str)
paul718e3742002-12-13 20:15:29 +00003862{
3863 int ret;
3864 struct peer *peer;
3865
3866 peer = peer_and_group_lookup_vty (vty, ip_str);
3867 if (! peer)
3868 return CMD_WARNING;
3869
3870 ret = peer_unsuppress_map_set (peer, afi, safi, name_str);
3871
3872 return bgp_vty_return (vty, ret);
3873}
3874
3875/* Unset route-map from the peer. */
paul94f2b392005-06-28 12:44:16 +00003876static int
paulfd79ac92004-10-13 05:06:08 +00003877peer_unsuppress_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
paul718e3742002-12-13 20:15:29 +00003878 safi_t safi)
3879{
3880 int ret;
3881 struct peer *peer;
3882
3883 peer = peer_and_group_lookup_vty (vty, ip_str);
3884 if (! peer)
3885 return CMD_WARNING;
3886
3887 ret = peer_unsuppress_map_unset (peer, afi, safi);
3888
3889 return bgp_vty_return (vty, ret);
3890}
3891
3892DEFUN (neighbor_unsuppress_map,
3893 neighbor_unsuppress_map_cmd,
3894 NEIGHBOR_CMD2 "unsuppress-map WORD",
3895 NEIGHBOR_STR
3896 NEIGHBOR_ADDR_STR2
3897 "Route-map to selectively unsuppress suppressed routes\n"
3898 "Name of route map\n")
3899{
3900 return peer_unsuppress_map_set_vty (vty, argv[0], bgp_node_afi (vty),
3901 bgp_node_safi (vty), argv[1]);
3902}
3903
3904DEFUN (no_neighbor_unsuppress_map,
3905 no_neighbor_unsuppress_map_cmd,
3906 NO_NEIGHBOR_CMD2 "unsuppress-map WORD",
3907 NO_STR
3908 NEIGHBOR_STR
3909 NEIGHBOR_ADDR_STR2
3910 "Route-map to selectively unsuppress suppressed routes\n"
3911 "Name of route map\n")
3912{
3913 return peer_unsuppress_map_unset_vty (vty, argv[0], bgp_node_afi (vty),
3914 bgp_node_safi (vty));
3915}
David Lamparter6b0655a2014-06-04 06:53:35 +02003916
paul94f2b392005-06-28 12:44:16 +00003917static int
paulfd79ac92004-10-13 05:06:08 +00003918peer_maximum_prefix_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
3919 safi_t safi, const char *num_str,
hasso0a486e52005-02-01 20:57:17 +00003920 const char *threshold_str, int warning,
3921 const char *restart_str)
paul718e3742002-12-13 20:15:29 +00003922{
3923 int ret;
3924 struct peer *peer;
3925 u_int32_t max;
hassoe0701b72004-05-20 09:19:34 +00003926 u_char threshold;
hasso0a486e52005-02-01 20:57:17 +00003927 u_int16_t restart;
paul718e3742002-12-13 20:15:29 +00003928
3929 peer = peer_and_group_lookup_vty (vty, ip_str);
3930 if (! peer)
3931 return CMD_WARNING;
3932
Denis Ovsienkoe6ec1c32011-09-10 21:50:53 +04003933 VTY_GET_INTEGER ("maximum number", max, num_str);
hassoe0701b72004-05-20 09:19:34 +00003934 if (threshold_str)
3935 threshold = atoi (threshold_str);
3936 else
3937 threshold = MAXIMUM_PREFIX_THRESHOLD_DEFAULT;
paul718e3742002-12-13 20:15:29 +00003938
hasso0a486e52005-02-01 20:57:17 +00003939 if (restart_str)
3940 restart = atoi (restart_str);
3941 else
3942 restart = 0;
3943
3944 ret = peer_maximum_prefix_set (peer, afi, safi, max, threshold, warning, restart);
paul718e3742002-12-13 20:15:29 +00003945
3946 return bgp_vty_return (vty, ret);
3947}
3948
paul94f2b392005-06-28 12:44:16 +00003949static int
paulfd79ac92004-10-13 05:06:08 +00003950peer_maximum_prefix_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
paul718e3742002-12-13 20:15:29 +00003951 safi_t safi)
3952{
3953 int ret;
3954 struct peer *peer;
3955
3956 peer = peer_and_group_lookup_vty (vty, ip_str);
3957 if (! peer)
3958 return CMD_WARNING;
3959
3960 ret = peer_maximum_prefix_unset (peer, afi, safi);
3961
3962 return bgp_vty_return (vty, ret);
3963}
3964
3965/* Maximum number of prefix configuration. prefix count is different
3966 for each peer configuration. So this configuration can be set for
3967 each peer configuration. */
3968DEFUN (neighbor_maximum_prefix,
3969 neighbor_maximum_prefix_cmd,
3970 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>",
3971 NEIGHBOR_STR
3972 NEIGHBOR_ADDR_STR2
3973 "Maximum number of prefix accept from this peer\n"
3974 "maximum no. of prefix limit\n")
3975{
3976 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00003977 bgp_node_safi (vty), argv[1], NULL, 0,
3978 NULL);
paul718e3742002-12-13 20:15:29 +00003979}
3980
hassoe0701b72004-05-20 09:19:34 +00003981DEFUN (neighbor_maximum_prefix_threshold,
3982 neighbor_maximum_prefix_threshold_cmd,
3983 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100>",
3984 NEIGHBOR_STR
3985 NEIGHBOR_ADDR_STR2
3986 "Maximum number of prefix accept from this peer\n"
3987 "maximum no. of prefix limit\n"
3988 "Threshold value (%) at which to generate a warning msg\n")
3989{
3990 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00003991 bgp_node_safi (vty), argv[1], argv[2], 0,
3992 NULL);
3993}
hassoe0701b72004-05-20 09:19:34 +00003994
paul718e3742002-12-13 20:15:29 +00003995DEFUN (neighbor_maximum_prefix_warning,
3996 neighbor_maximum_prefix_warning_cmd,
3997 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
3998 NEIGHBOR_STR
3999 NEIGHBOR_ADDR_STR2
4000 "Maximum number of prefix accept from this peer\n"
4001 "maximum no. of prefix limit\n"
4002 "Only give warning message when limit is exceeded\n")
4003{
4004 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00004005 bgp_node_safi (vty), argv[1], NULL, 1,
4006 NULL);
paul718e3742002-12-13 20:15:29 +00004007}
4008
hassoe0701b72004-05-20 09:19:34 +00004009DEFUN (neighbor_maximum_prefix_threshold_warning,
4010 neighbor_maximum_prefix_threshold_warning_cmd,
4011 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only",
4012 NEIGHBOR_STR
4013 NEIGHBOR_ADDR_STR2
4014 "Maximum number of prefix accept from this peer\n"
4015 "maximum no. of prefix limit\n"
4016 "Threshold value (%) at which to generate a warning msg\n"
4017 "Only give warning message when limit is exceeded\n")
4018{
4019 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
hasso0a486e52005-02-01 20:57:17 +00004020 bgp_node_safi (vty), argv[1], argv[2], 1, NULL);
4021}
4022
4023DEFUN (neighbor_maximum_prefix_restart,
4024 neighbor_maximum_prefix_restart_cmd,
4025 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>",
4026 NEIGHBOR_STR
4027 NEIGHBOR_ADDR_STR2
4028 "Maximum number of prefix accept from this peer\n"
4029 "maximum no. of prefix limit\n"
4030 "Restart bgp connection after limit is exceeded\n"
4031 "Restart interval in minutes")
4032{
4033 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
4034 bgp_node_safi (vty), argv[1], NULL, 0, argv[2]);
4035}
4036
4037DEFUN (neighbor_maximum_prefix_threshold_restart,
4038 neighbor_maximum_prefix_threshold_restart_cmd,
4039 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>",
4040 NEIGHBOR_STR
4041 NEIGHBOR_ADDR_STR2
4042 "Maximum number of prefix accept from this peer\n"
4043 "maximum no. of prefix limit\n"
4044 "Threshold value (%) at which to generate a warning msg\n"
4045 "Restart bgp connection after limit is exceeded\n"
4046 "Restart interval in minutes")
4047{
4048 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
4049 bgp_node_safi (vty), argv[1], argv[2], 0, argv[3]);
4050}
hassoe0701b72004-05-20 09:19:34 +00004051
paul718e3742002-12-13 20:15:29 +00004052DEFUN (no_neighbor_maximum_prefix,
4053 no_neighbor_maximum_prefix_cmd,
4054 NO_NEIGHBOR_CMD2 "maximum-prefix",
4055 NO_STR
4056 NEIGHBOR_STR
4057 NEIGHBOR_ADDR_STR2
4058 "Maximum number of prefix accept from this peer\n")
4059{
4060 return peer_maximum_prefix_unset_vty (vty, argv[0], bgp_node_afi (vty),
4061 bgp_node_safi (vty));
4062}
4063
4064ALIAS (no_neighbor_maximum_prefix,
4065 no_neighbor_maximum_prefix_val_cmd,
4066 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>",
4067 NO_STR
4068 NEIGHBOR_STR
4069 NEIGHBOR_ADDR_STR2
4070 "Maximum number of prefix accept from this peer\n"
4071 "maximum no. of prefix limit\n")
4072
4073ALIAS (no_neighbor_maximum_prefix,
hasso0a486e52005-02-01 20:57:17 +00004074 no_neighbor_maximum_prefix_threshold_cmd,
4075 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
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 "Threshold value (%) at which to generate a warning msg\n")
4082
4083ALIAS (no_neighbor_maximum_prefix,
4084 no_neighbor_maximum_prefix_warning_cmd,
4085 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
4086 NO_STR
4087 NEIGHBOR_STR
4088 NEIGHBOR_ADDR_STR2
4089 "Maximum number of prefix accept from this peer\n"
4090 "maximum no. of prefix limit\n"
paule8e19462006-01-19 20:16:55 +00004091 "Only give warning message when limit is exceeded\n")
hasso0a486e52005-02-01 20:57:17 +00004092
4093ALIAS (no_neighbor_maximum_prefix,
4094 no_neighbor_maximum_prefix_threshold_warning_cmd,
hassoe0701b72004-05-20 09:19:34 +00004095 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only",
4096 NO_STR
4097 NEIGHBOR_STR
4098 NEIGHBOR_ADDR_STR2
4099 "Maximum number of prefix accept from this peer\n"
4100 "maximum no. of prefix limit\n"
4101 "Threshold value (%) at which to generate a warning msg\n"
paule8e19462006-01-19 20:16:55 +00004102 "Only give warning message when limit is exceeded\n")
hassoe0701b72004-05-20 09:19:34 +00004103
4104ALIAS (no_neighbor_maximum_prefix,
hasso0a486e52005-02-01 20:57:17 +00004105 no_neighbor_maximum_prefix_restart_cmd,
4106 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>",
paul718e3742002-12-13 20:15:29 +00004107 NO_STR
4108 NEIGHBOR_STR
4109 NEIGHBOR_ADDR_STR2
4110 "Maximum number of prefix accept from this peer\n"
4111 "maximum no. of prefix limit\n"
hasso0a486e52005-02-01 20:57:17 +00004112 "Restart bgp connection after limit is exceeded\n"
4113 "Restart interval in minutes")
4114
4115ALIAS (no_neighbor_maximum_prefix,
4116 no_neighbor_maximum_prefix_threshold_restart_cmd,
4117 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>",
4118 NO_STR
4119 NEIGHBOR_STR
4120 NEIGHBOR_ADDR_STR2
4121 "Maximum number of prefix accept from this peer\n"
4122 "maximum no. of prefix limit\n"
4123 "Threshold value (%) at which to generate a warning msg\n"
4124 "Restart bgp connection after limit is exceeded\n"
4125 "Restart interval in minutes")
David Lamparter6b0655a2014-06-04 06:53:35 +02004126
paul718e3742002-12-13 20:15:29 +00004127/* "neighbor allowas-in" */
4128DEFUN (neighbor_allowas_in,
4129 neighbor_allowas_in_cmd,
4130 NEIGHBOR_CMD2 "allowas-in",
4131 NEIGHBOR_STR
4132 NEIGHBOR_ADDR_STR2
4133 "Accept as-path with my AS present in it\n")
4134{
4135 int ret;
4136 struct peer *peer;
paulfd79ac92004-10-13 05:06:08 +00004137 unsigned int allow_num;
paul718e3742002-12-13 20:15:29 +00004138
4139 peer = peer_and_group_lookup_vty (vty, argv[0]);
4140 if (! peer)
4141 return CMD_WARNING;
4142
4143 if (argc == 1)
4144 allow_num = 3;
4145 else
4146 VTY_GET_INTEGER_RANGE ("AS number", allow_num, argv[1], 1, 10);
4147
4148 ret = peer_allowas_in_set (peer, bgp_node_afi (vty), bgp_node_safi (vty),
4149 allow_num);
4150
4151 return bgp_vty_return (vty, ret);
4152}
4153
4154ALIAS (neighbor_allowas_in,
4155 neighbor_allowas_in_arg_cmd,
4156 NEIGHBOR_CMD2 "allowas-in <1-10>",
4157 NEIGHBOR_STR
4158 NEIGHBOR_ADDR_STR2
4159 "Accept as-path with my AS present in it\n"
4160 "Number of occurances of AS number\n")
4161
4162DEFUN (no_neighbor_allowas_in,
4163 no_neighbor_allowas_in_cmd,
4164 NO_NEIGHBOR_CMD2 "allowas-in",
4165 NO_STR
4166 NEIGHBOR_STR
4167 NEIGHBOR_ADDR_STR2
4168 "allow local ASN appears in aspath attribute\n")
4169{
4170 int ret;
4171 struct peer *peer;
4172
4173 peer = peer_and_group_lookup_vty (vty, argv[0]);
4174 if (! peer)
4175 return CMD_WARNING;
4176
4177 ret = peer_allowas_in_unset (peer, bgp_node_afi (vty), bgp_node_safi (vty));
4178
4179 return bgp_vty_return (vty, ret);
4180}
David Lamparter6b0655a2014-06-04 06:53:35 +02004181
Nick Hilliardfa411a22011-03-23 15:33:17 +00004182DEFUN (neighbor_ttl_security,
4183 neighbor_ttl_security_cmd,
4184 NEIGHBOR_CMD2 "ttl-security hops <1-254>",
4185 NEIGHBOR_STR
4186 NEIGHBOR_ADDR_STR2
4187 "Specify the maximum number of hops to the BGP peer\n")
4188{
4189 struct peer *peer;
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00004190 int gtsm_hops;
Nick Hilliardfa411a22011-03-23 15:33:17 +00004191
4192 peer = peer_and_group_lookup_vty (vty, argv[0]);
4193 if (! peer)
4194 return CMD_WARNING;
4195
4196 VTY_GET_INTEGER_RANGE ("", gtsm_hops, argv[1], 1, 254);
4197
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00004198 return bgp_vty_return (vty, peer_ttl_security_hops_set (peer, gtsm_hops));
Nick Hilliardfa411a22011-03-23 15:33:17 +00004199}
4200
4201DEFUN (no_neighbor_ttl_security,
4202 no_neighbor_ttl_security_cmd,
4203 NO_NEIGHBOR_CMD2 "ttl-security hops <1-254>",
4204 NO_STR
4205 NEIGHBOR_STR
4206 NEIGHBOR_ADDR_STR2
4207 "Specify the maximum number of hops to the BGP peer\n")
4208{
4209 struct peer *peer;
Nick Hilliardfa411a22011-03-23 15:33:17 +00004210
4211 peer = peer_and_group_lookup_vty (vty, argv[0]);
4212 if (! peer)
4213 return CMD_WARNING;
4214
Stephen Hemminger89b6d1f2011-03-24 10:51:59 +00004215 return bgp_vty_return (vty, peer_ttl_security_hops_unset (peer));
Nick Hilliardfa411a22011-03-23 15:33:17 +00004216}
David Lamparter6b0655a2014-06-04 06:53:35 +02004217
paul718e3742002-12-13 20:15:29 +00004218/* Address family configuration. */
4219DEFUN (address_family_ipv4,
4220 address_family_ipv4_cmd,
4221 "address-family ipv4",
4222 "Enter Address Family command mode\n"
4223 "Address family\n")
4224{
4225 vty->node = BGP_IPV4_NODE;
4226 return CMD_SUCCESS;
4227}
4228
4229DEFUN (address_family_ipv4_safi,
4230 address_family_ipv4_safi_cmd,
4231 "address-family ipv4 (unicast|multicast)",
4232 "Enter Address Family command mode\n"
4233 "Address family\n"
4234 "Address Family modifier\n"
4235 "Address Family modifier\n")
4236{
4237 if (strncmp (argv[0], "m", 1) == 0)
4238 vty->node = BGP_IPV4M_NODE;
4239 else
4240 vty->node = BGP_IPV4_NODE;
4241
4242 return CMD_SUCCESS;
4243}
4244
paul25ffbdc2005-08-22 22:42:08 +00004245DEFUN (address_family_ipv6,
4246 address_family_ipv6_cmd,
4247 "address-family ipv6",
paul718e3742002-12-13 20:15:29 +00004248 "Enter Address Family command mode\n"
paul25ffbdc2005-08-22 22:42:08 +00004249 "Address family\n")
paul718e3742002-12-13 20:15:29 +00004250{
4251 vty->node = BGP_IPV6_NODE;
4252 return CMD_SUCCESS;
4253}
4254
paul25ffbdc2005-08-22 22:42:08 +00004255DEFUN (address_family_ipv6_safi,
4256 address_family_ipv6_safi_cmd,
4257 "address-family ipv6 (unicast|multicast)",
paul718e3742002-12-13 20:15:29 +00004258 "Enter Address Family command mode\n"
paul25ffbdc2005-08-22 22:42:08 +00004259 "Address family\n"
4260 "Address Family modifier\n"
4261 "Address Family modifier\n")
4262{
4263 if (strncmp (argv[0], "m", 1) == 0)
4264 vty->node = BGP_IPV6M_NODE;
4265 else
4266 vty->node = BGP_IPV6_NODE;
4267
4268 return CMD_SUCCESS;
4269}
paul718e3742002-12-13 20:15:29 +00004270
4271DEFUN (address_family_vpnv4,
4272 address_family_vpnv4_cmd,
4273 "address-family vpnv4",
4274 "Enter Address Family command mode\n"
4275 "Address family\n")
4276{
4277 vty->node = BGP_VPNV4_NODE;
4278 return CMD_SUCCESS;
4279}
4280
4281ALIAS (address_family_vpnv4,
4282 address_family_vpnv4_unicast_cmd,
4283 "address-family vpnv4 unicast",
4284 "Enter Address Family command mode\n"
4285 "Address family\n"
4286 "Address Family Modifier\n")
4287
4288DEFUN (exit_address_family,
4289 exit_address_family_cmd,
4290 "exit-address-family",
4291 "Exit from Address Family configuration mode\n")
4292{
hassoa8a80d52005-04-09 13:07:47 +00004293 if (vty->node == BGP_IPV4_NODE
4294 || vty->node == BGP_IPV4M_NODE
paul718e3742002-12-13 20:15:29 +00004295 || vty->node == BGP_VPNV4_NODE
paul25ffbdc2005-08-22 22:42:08 +00004296 || vty->node == BGP_IPV6_NODE
4297 || vty->node == BGP_IPV6M_NODE)
paul718e3742002-12-13 20:15:29 +00004298 vty->node = BGP_NODE;
4299 return CMD_SUCCESS;
4300}
David Lamparter6b0655a2014-06-04 06:53:35 +02004301
paul718e3742002-12-13 20:15:29 +00004302/* BGP clear sort. */
4303enum clear_sort
4304{
4305 clear_all,
4306 clear_peer,
4307 clear_group,
4308 clear_external,
4309 clear_as
4310};
4311
paul94f2b392005-06-28 12:44:16 +00004312static void
paul718e3742002-12-13 20:15:29 +00004313bgp_clear_vty_error (struct vty *vty, struct peer *peer, afi_t afi,
4314 safi_t safi, int error)
4315{
4316 switch (error)
4317 {
4318 case BGP_ERR_AF_UNCONFIGURED:
4319 vty_out (vty,
4320 "%%BGP: Enable %s %s address family for the neighbor %s%s",
4321 afi == AFI_IP6 ? "IPv6" : safi == SAFI_MPLS_VPN ? "VPNv4" : "IPv4",
4322 safi == SAFI_MULTICAST ? "Multicast" : "Unicast",
4323 peer->host, VTY_NEWLINE);
4324 break;
4325 case BGP_ERR_SOFT_RECONFIG_UNCONFIGURED:
4326 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);
4327 break;
4328 default:
4329 break;
4330 }
4331}
4332
4333/* `clear ip bgp' functions. */
paul94f2b392005-06-28 12:44:16 +00004334static int
paul718e3742002-12-13 20:15:29 +00004335bgp_clear (struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi,
paulfd79ac92004-10-13 05:06:08 +00004336 enum clear_sort sort,enum bgp_clear_type stype, const char *arg)
paul718e3742002-12-13 20:15:29 +00004337{
4338 int ret;
4339 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00004340 struct listnode *node, *nnode;
paul718e3742002-12-13 20:15:29 +00004341
4342 /* Clear all neighbors. */
4343 if (sort == clear_all)
4344 {
paul1eb8ef22005-04-07 07:30:20 +00004345 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004346 {
4347 if (stype == BGP_CLEAR_SOFT_NONE)
4348 ret = peer_clear (peer);
4349 else
4350 ret = peer_clear_soft (peer, afi, safi, stype);
4351
4352 if (ret < 0)
4353 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4354 }
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004355 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004356 }
4357
4358 /* Clear specified neighbors. */
4359 if (sort == clear_peer)
4360 {
4361 union sockunion su;
4362 int ret;
4363
4364 /* Make sockunion for lookup. */
4365 ret = str2sockunion (arg, &su);
4366 if (ret < 0)
4367 {
4368 vty_out (vty, "Malformed address: %s%s", arg, VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004369 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00004370 }
4371 peer = peer_lookup (bgp, &su);
4372 if (! peer)
4373 {
4374 vty_out (vty, "%%BGP: Unknown neighbor - \"%s\"%s", arg, VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004375 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00004376 }
4377
4378 if (stype == BGP_CLEAR_SOFT_NONE)
4379 ret = peer_clear (peer);
4380 else
4381 ret = peer_clear_soft (peer, afi, safi, stype);
4382
4383 if (ret < 0)
4384 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4385
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004386 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004387 }
4388
4389 /* Clear all peer-group members. */
4390 if (sort == clear_group)
4391 {
4392 struct peer_group *group;
4393
4394 group = peer_group_lookup (bgp, arg);
4395 if (! group)
4396 {
4397 vty_out (vty, "%%BGP: No such peer-group %s%s", arg, VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004398 return CMD_WARNING;
paul718e3742002-12-13 20:15:29 +00004399 }
4400
paul1eb8ef22005-04-07 07:30:20 +00004401 for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004402 {
4403 if (stype == BGP_CLEAR_SOFT_NONE)
4404 {
4405 ret = peer_clear (peer);
4406 continue;
4407 }
4408
4409 if (! peer->af_group[afi][safi])
4410 continue;
4411
4412 ret = peer_clear_soft (peer, afi, safi, stype);
4413
4414 if (ret < 0)
4415 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4416 }
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004417 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004418 }
4419
4420 if (sort == clear_external)
4421 {
paul1eb8ef22005-04-07 07:30:20 +00004422 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004423 {
Jorge Boncompte [DTI2]6d85b152012-05-07 16:52:54 +00004424 if (peer->sort == BGP_PEER_IBGP)
paul718e3742002-12-13 20:15:29 +00004425 continue;
4426
4427 if (stype == BGP_CLEAR_SOFT_NONE)
4428 ret = peer_clear (peer);
4429 else
4430 ret = peer_clear_soft (peer, afi, safi, stype);
4431
4432 if (ret < 0)
4433 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4434 }
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004435 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004436 }
4437
4438 if (sort == clear_as)
4439 {
4440 as_t as;
paul718e3742002-12-13 20:15:29 +00004441 int find = 0;
4442
Ulrich Weberbde12e32011-11-16 19:32:12 +04004443 VTY_GET_INTEGER_RANGE ("AS", as, arg, 1, BGP_AS4_MAX);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004444
paul1eb8ef22005-04-07 07:30:20 +00004445 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00004446 {
4447 if (peer->as != as)
4448 continue;
4449
4450 find = 1;
4451 if (stype == BGP_CLEAR_SOFT_NONE)
4452 ret = peer_clear (peer);
4453 else
4454 ret = peer_clear_soft (peer, afi, safi, stype);
4455
4456 if (ret < 0)
4457 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4458 }
4459 if (! find)
4460 vty_out (vty, "%%BGP: No peer is configured with AS %s%s", arg,
4461 VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004462 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004463 }
4464
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004465 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +00004466}
4467
paul94f2b392005-06-28 12:44:16 +00004468static int
paulfd79ac92004-10-13 05:06:08 +00004469bgp_clear_vty (struct vty *vty, const char *name, afi_t afi, safi_t safi,
4470 enum clear_sort sort, enum bgp_clear_type stype,
4471 const char *arg)
paul718e3742002-12-13 20:15:29 +00004472{
paul718e3742002-12-13 20:15:29 +00004473 struct bgp *bgp;
4474
4475 /* BGP structure lookup. */
4476 if (name)
4477 {
4478 bgp = bgp_lookup_by_name (name);
4479 if (bgp == NULL)
4480 {
4481 vty_out (vty, "Can't find BGP view %s%s", name, VTY_NEWLINE);
4482 return CMD_WARNING;
4483 }
4484 }
4485 else
4486 {
4487 bgp = bgp_get_default ();
4488 if (bgp == NULL)
4489 {
4490 vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE);
4491 return CMD_WARNING;
4492 }
4493 }
4494
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00004495 return bgp_clear (vty, bgp, afi, safi, sort, stype, arg);
paul718e3742002-12-13 20:15:29 +00004496}
4497
4498DEFUN (clear_ip_bgp_all,
4499 clear_ip_bgp_all_cmd,
4500 "clear ip bgp *",
4501 CLEAR_STR
4502 IP_STR
4503 BGP_STR
4504 "Clear all peers\n")
4505{
4506 if (argc == 1)
4507 return bgp_clear_vty (vty, argv[0], 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL);
4508
4509 return bgp_clear_vty (vty, NULL, 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL);
4510}
4511
4512ALIAS (clear_ip_bgp_all,
4513 clear_bgp_all_cmd,
4514 "clear bgp *",
4515 CLEAR_STR
4516 BGP_STR
4517 "Clear all peers\n")
4518
4519ALIAS (clear_ip_bgp_all,
4520 clear_bgp_ipv6_all_cmd,
4521 "clear bgp ipv6 *",
4522 CLEAR_STR
4523 BGP_STR
4524 "Address family\n"
4525 "Clear all peers\n")
4526
4527ALIAS (clear_ip_bgp_all,
4528 clear_ip_bgp_instance_all_cmd,
4529 "clear ip bgp view WORD *",
4530 CLEAR_STR
4531 IP_STR
4532 BGP_STR
4533 "BGP view\n"
4534 "view name\n"
4535 "Clear all peers\n")
4536
4537ALIAS (clear_ip_bgp_all,
4538 clear_bgp_instance_all_cmd,
4539 "clear bgp view WORD *",
4540 CLEAR_STR
4541 BGP_STR
4542 "BGP view\n"
4543 "view name\n"
4544 "Clear all peers\n")
4545
4546DEFUN (clear_ip_bgp_peer,
4547 clear_ip_bgp_peer_cmd,
4548 "clear ip bgp (A.B.C.D|X:X::X:X)",
4549 CLEAR_STR
4550 IP_STR
4551 BGP_STR
4552 "BGP neighbor IP address to clear\n"
4553 "BGP IPv6 neighbor to clear\n")
4554{
4555 return bgp_clear_vty (vty, NULL, 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[0]);
4556}
4557
4558ALIAS (clear_ip_bgp_peer,
4559 clear_bgp_peer_cmd,
4560 "clear bgp (A.B.C.D|X:X::X:X)",
4561 CLEAR_STR
4562 BGP_STR
4563 "BGP neighbor address to clear\n"
4564 "BGP IPv6 neighbor to clear\n")
4565
4566ALIAS (clear_ip_bgp_peer,
4567 clear_bgp_ipv6_peer_cmd,
4568 "clear bgp ipv6 (A.B.C.D|X:X::X:X)",
4569 CLEAR_STR
4570 BGP_STR
4571 "Address family\n"
4572 "BGP neighbor address to clear\n"
4573 "BGP IPv6 neighbor to clear\n")
4574
4575DEFUN (clear_ip_bgp_peer_group,
4576 clear_ip_bgp_peer_group_cmd,
4577 "clear ip bgp peer-group WORD",
4578 CLEAR_STR
4579 IP_STR
4580 BGP_STR
4581 "Clear all members of peer-group\n"
4582 "BGP peer-group name\n")
4583{
4584 return bgp_clear_vty (vty, NULL, 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[0]);
4585}
4586
4587ALIAS (clear_ip_bgp_peer_group,
4588 clear_bgp_peer_group_cmd,
4589 "clear bgp peer-group WORD",
4590 CLEAR_STR
4591 BGP_STR
4592 "Clear all members of peer-group\n"
4593 "BGP peer-group name\n")
4594
4595ALIAS (clear_ip_bgp_peer_group,
4596 clear_bgp_ipv6_peer_group_cmd,
4597 "clear bgp ipv6 peer-group WORD",
4598 CLEAR_STR
4599 BGP_STR
4600 "Address family\n"
4601 "Clear all members of peer-group\n"
4602 "BGP peer-group name\n")
4603
4604DEFUN (clear_ip_bgp_external,
4605 clear_ip_bgp_external_cmd,
4606 "clear ip bgp external",
4607 CLEAR_STR
4608 IP_STR
4609 BGP_STR
4610 "Clear all external peers\n")
4611{
4612 return bgp_clear_vty (vty, NULL, 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL);
4613}
4614
4615ALIAS (clear_ip_bgp_external,
4616 clear_bgp_external_cmd,
4617 "clear bgp external",
4618 CLEAR_STR
4619 BGP_STR
4620 "Clear all external peers\n")
4621
4622ALIAS (clear_ip_bgp_external,
4623 clear_bgp_ipv6_external_cmd,
4624 "clear bgp ipv6 external",
4625 CLEAR_STR
4626 BGP_STR
4627 "Address family\n"
4628 "Clear all external peers\n")
4629
4630DEFUN (clear_ip_bgp_as,
4631 clear_ip_bgp_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00004632 "clear ip bgp " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00004633 CLEAR_STR
4634 IP_STR
4635 BGP_STR
4636 "Clear peers with the AS number\n")
4637{
4638 return bgp_clear_vty (vty, NULL, 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[0]);
4639}
4640
4641ALIAS (clear_ip_bgp_as,
4642 clear_bgp_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00004643 "clear bgp " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00004644 CLEAR_STR
4645 BGP_STR
4646 "Clear peers with the AS number\n")
4647
4648ALIAS (clear_ip_bgp_as,
4649 clear_bgp_ipv6_as_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00004650 "clear bgp ipv6 " CMD_AS_RANGE,
paul718e3742002-12-13 20:15:29 +00004651 CLEAR_STR
4652 BGP_STR
4653 "Address family\n"
4654 "Clear peers with the AS number\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02004655
paul718e3742002-12-13 20:15:29 +00004656/* Outbound soft-reconfiguration */
4657DEFUN (clear_ip_bgp_all_soft_out,
4658 clear_ip_bgp_all_soft_out_cmd,
4659 "clear ip bgp * soft out",
4660 CLEAR_STR
4661 IP_STR
4662 BGP_STR
4663 "Clear all peers\n"
4664 "Soft reconfig\n"
4665 "Soft reconfig outbound update\n")
4666{
4667 if (argc == 1)
4668 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
4669 BGP_CLEAR_SOFT_OUT, NULL);
4670
4671 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
4672 BGP_CLEAR_SOFT_OUT, NULL);
4673}
4674
4675ALIAS (clear_ip_bgp_all_soft_out,
4676 clear_ip_bgp_all_out_cmd,
4677 "clear ip bgp * out",
4678 CLEAR_STR
4679 IP_STR
4680 BGP_STR
4681 "Clear all peers\n"
4682 "Soft reconfig outbound update\n")
4683
4684ALIAS (clear_ip_bgp_all_soft_out,
4685 clear_ip_bgp_instance_all_soft_out_cmd,
4686 "clear ip bgp view WORD * soft out",
4687 CLEAR_STR
4688 IP_STR
4689 BGP_STR
4690 "BGP view\n"
4691 "view name\n"
4692 "Clear all peers\n"
4693 "Soft reconfig\n"
4694 "Soft reconfig outbound update\n")
4695
4696DEFUN (clear_ip_bgp_all_ipv4_soft_out,
4697 clear_ip_bgp_all_ipv4_soft_out_cmd,
4698 "clear ip bgp * ipv4 (unicast|multicast) soft out",
4699 CLEAR_STR
4700 IP_STR
4701 BGP_STR
4702 "Clear all peers\n"
4703 "Address family\n"
4704 "Address Family modifier\n"
4705 "Address Family modifier\n"
4706 "Soft reconfig\n"
4707 "Soft reconfig outbound update\n")
4708{
4709 if (strncmp (argv[0], "m", 1) == 0)
4710 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
4711 BGP_CLEAR_SOFT_OUT, NULL);
4712
4713 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
4714 BGP_CLEAR_SOFT_OUT, NULL);
4715}
4716
4717ALIAS (clear_ip_bgp_all_ipv4_soft_out,
4718 clear_ip_bgp_all_ipv4_out_cmd,
4719 "clear ip bgp * ipv4 (unicast|multicast) out",
4720 CLEAR_STR
4721 IP_STR
4722 BGP_STR
4723 "Clear all peers\n"
4724 "Address family\n"
4725 "Address Family modifier\n"
4726 "Address Family modifier\n"
4727 "Soft reconfig outbound update\n")
4728
4729DEFUN (clear_ip_bgp_instance_all_ipv4_soft_out,
4730 clear_ip_bgp_instance_all_ipv4_soft_out_cmd,
4731 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft out",
4732 CLEAR_STR
4733 IP_STR
4734 BGP_STR
4735 "BGP view\n"
4736 "view name\n"
4737 "Clear all peers\n"
4738 "Address family\n"
4739 "Address Family modifier\n"
4740 "Address Family modifier\n"
4741 "Soft reconfig outbound update\n")
4742{
4743 if (strncmp (argv[1], "m", 1) == 0)
4744 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
4745 BGP_CLEAR_SOFT_OUT, NULL);
4746
4747 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
4748 BGP_CLEAR_SOFT_OUT, NULL);
4749}
4750
4751DEFUN (clear_ip_bgp_all_vpnv4_soft_out,
4752 clear_ip_bgp_all_vpnv4_soft_out_cmd,
4753 "clear ip bgp * vpnv4 unicast soft out",
4754 CLEAR_STR
4755 IP_STR
4756 BGP_STR
4757 "Clear all peers\n"
4758 "Address family\n"
4759 "Address Family Modifier\n"
4760 "Soft reconfig\n"
4761 "Soft reconfig outbound update\n")
4762{
4763 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
4764 BGP_CLEAR_SOFT_OUT, NULL);
4765}
4766
4767ALIAS (clear_ip_bgp_all_vpnv4_soft_out,
4768 clear_ip_bgp_all_vpnv4_out_cmd,
4769 "clear ip bgp * vpnv4 unicast out",
4770 CLEAR_STR
4771 IP_STR
4772 BGP_STR
4773 "Clear all peers\n"
4774 "Address family\n"
4775 "Address Family Modifier\n"
4776 "Soft reconfig outbound update\n")
4777
4778DEFUN (clear_bgp_all_soft_out,
4779 clear_bgp_all_soft_out_cmd,
4780 "clear bgp * soft out",
4781 CLEAR_STR
4782 BGP_STR
4783 "Clear all peers\n"
4784 "Soft reconfig\n"
4785 "Soft reconfig outbound update\n")
4786{
4787 if (argc == 1)
4788 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
4789 BGP_CLEAR_SOFT_OUT, NULL);
4790
4791 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
4792 BGP_CLEAR_SOFT_OUT, NULL);
4793}
4794
4795ALIAS (clear_bgp_all_soft_out,
4796 clear_bgp_instance_all_soft_out_cmd,
4797 "clear bgp view WORD * soft out",
4798 CLEAR_STR
4799 BGP_STR
4800 "BGP view\n"
4801 "view name\n"
4802 "Clear all peers\n"
4803 "Soft reconfig\n"
4804 "Soft reconfig outbound update\n")
4805
4806ALIAS (clear_bgp_all_soft_out,
4807 clear_bgp_all_out_cmd,
4808 "clear bgp * out",
4809 CLEAR_STR
4810 BGP_STR
4811 "Clear all peers\n"
4812 "Soft reconfig outbound update\n")
4813
4814ALIAS (clear_bgp_all_soft_out,
4815 clear_bgp_ipv6_all_soft_out_cmd,
4816 "clear bgp ipv6 * soft out",
4817 CLEAR_STR
4818 BGP_STR
4819 "Address family\n"
4820 "Clear all peers\n"
4821 "Soft reconfig\n"
4822 "Soft reconfig outbound update\n")
4823
4824ALIAS (clear_bgp_all_soft_out,
4825 clear_bgp_ipv6_all_out_cmd,
4826 "clear bgp ipv6 * out",
4827 CLEAR_STR
4828 BGP_STR
4829 "Address family\n"
4830 "Clear all peers\n"
4831 "Soft reconfig outbound update\n")
4832
4833DEFUN (clear_ip_bgp_peer_soft_out,
4834 clear_ip_bgp_peer_soft_out_cmd,
4835 "clear ip bgp A.B.C.D soft out",
4836 CLEAR_STR
4837 IP_STR
4838 BGP_STR
4839 "BGP neighbor address to clear\n"
4840 "Soft reconfig\n"
4841 "Soft reconfig outbound update\n")
4842{
4843 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
4844 BGP_CLEAR_SOFT_OUT, argv[0]);
4845}
4846
4847ALIAS (clear_ip_bgp_peer_soft_out,
4848 clear_ip_bgp_peer_out_cmd,
4849 "clear ip bgp A.B.C.D out",
4850 CLEAR_STR
4851 IP_STR
4852 BGP_STR
4853 "BGP neighbor address to clear\n"
4854 "Soft reconfig outbound update\n")
4855
4856DEFUN (clear_ip_bgp_peer_ipv4_soft_out,
4857 clear_ip_bgp_peer_ipv4_soft_out_cmd,
4858 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft out",
4859 CLEAR_STR
4860 IP_STR
4861 BGP_STR
4862 "BGP neighbor address to clear\n"
4863 "Address family\n"
4864 "Address Family modifier\n"
4865 "Address Family modifier\n"
4866 "Soft reconfig\n"
4867 "Soft reconfig outbound update\n")
4868{
4869 if (strncmp (argv[1], "m", 1) == 0)
4870 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
4871 BGP_CLEAR_SOFT_OUT, argv[0]);
4872
4873 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
4874 BGP_CLEAR_SOFT_OUT, argv[0]);
4875}
4876
4877ALIAS (clear_ip_bgp_peer_ipv4_soft_out,
4878 clear_ip_bgp_peer_ipv4_out_cmd,
4879 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) out",
4880 CLEAR_STR
4881 IP_STR
4882 BGP_STR
4883 "BGP neighbor address to clear\n"
4884 "Address family\n"
4885 "Address Family modifier\n"
4886 "Address Family modifier\n"
4887 "Soft reconfig outbound update\n")
4888
4889DEFUN (clear_ip_bgp_peer_vpnv4_soft_out,
4890 clear_ip_bgp_peer_vpnv4_soft_out_cmd,
4891 "clear ip bgp A.B.C.D vpnv4 unicast soft out",
4892 CLEAR_STR
4893 IP_STR
4894 BGP_STR
4895 "BGP neighbor address to clear\n"
4896 "Address family\n"
4897 "Address Family Modifier\n"
4898 "Soft reconfig\n"
4899 "Soft reconfig outbound update\n")
4900{
4901 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
4902 BGP_CLEAR_SOFT_OUT, argv[0]);
4903}
4904
4905ALIAS (clear_ip_bgp_peer_vpnv4_soft_out,
4906 clear_ip_bgp_peer_vpnv4_out_cmd,
4907 "clear ip bgp A.B.C.D vpnv4 unicast out",
4908 CLEAR_STR
4909 IP_STR
4910 BGP_STR
4911 "BGP neighbor address to clear\n"
4912 "Address family\n"
4913 "Address Family Modifier\n"
4914 "Soft reconfig outbound update\n")
4915
4916DEFUN (clear_bgp_peer_soft_out,
4917 clear_bgp_peer_soft_out_cmd,
4918 "clear bgp (A.B.C.D|X:X::X:X) soft out",
4919 CLEAR_STR
4920 BGP_STR
4921 "BGP neighbor address to clear\n"
4922 "BGP IPv6 neighbor to clear\n"
4923 "Soft reconfig\n"
4924 "Soft reconfig outbound update\n")
4925{
4926 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
4927 BGP_CLEAR_SOFT_OUT, argv[0]);
4928}
4929
4930ALIAS (clear_bgp_peer_soft_out,
4931 clear_bgp_ipv6_peer_soft_out_cmd,
4932 "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft out",
4933 CLEAR_STR
4934 BGP_STR
4935 "Address family\n"
4936 "BGP neighbor address to clear\n"
4937 "BGP IPv6 neighbor to clear\n"
4938 "Soft reconfig\n"
4939 "Soft reconfig outbound update\n")
4940
4941ALIAS (clear_bgp_peer_soft_out,
4942 clear_bgp_peer_out_cmd,
4943 "clear bgp (A.B.C.D|X:X::X:X) out",
4944 CLEAR_STR
4945 BGP_STR
4946 "BGP neighbor address to clear\n"
4947 "BGP IPv6 neighbor to clear\n"
4948 "Soft reconfig outbound update\n")
4949
4950ALIAS (clear_bgp_peer_soft_out,
4951 clear_bgp_ipv6_peer_out_cmd,
4952 "clear bgp ipv6 (A.B.C.D|X:X::X:X) out",
4953 CLEAR_STR
4954 BGP_STR
4955 "Address family\n"
4956 "BGP neighbor address to clear\n"
4957 "BGP IPv6 neighbor to clear\n"
4958 "Soft reconfig outbound update\n")
4959
4960DEFUN (clear_ip_bgp_peer_group_soft_out,
4961 clear_ip_bgp_peer_group_soft_out_cmd,
4962 "clear ip bgp peer-group WORD soft out",
4963 CLEAR_STR
4964 IP_STR
4965 BGP_STR
4966 "Clear all members of peer-group\n"
4967 "BGP peer-group name\n"
4968 "Soft reconfig\n"
4969 "Soft reconfig outbound update\n")
4970{
4971 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
4972 BGP_CLEAR_SOFT_OUT, argv[0]);
4973}
4974
4975ALIAS (clear_ip_bgp_peer_group_soft_out,
4976 clear_ip_bgp_peer_group_out_cmd,
4977 "clear ip bgp peer-group WORD out",
4978 CLEAR_STR
4979 IP_STR
4980 BGP_STR
4981 "Clear all members of peer-group\n"
4982 "BGP peer-group name\n"
4983 "Soft reconfig outbound update\n")
4984
4985DEFUN (clear_ip_bgp_peer_group_ipv4_soft_out,
4986 clear_ip_bgp_peer_group_ipv4_soft_out_cmd,
4987 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft out",
4988 CLEAR_STR
4989 IP_STR
4990 BGP_STR
4991 "Clear all members of peer-group\n"
4992 "BGP peer-group name\n"
4993 "Address family\n"
4994 "Address Family modifier\n"
4995 "Address Family modifier\n"
4996 "Soft reconfig\n"
4997 "Soft reconfig outbound update\n")
4998{
4999 if (strncmp (argv[1], "m", 1) == 0)
5000 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
5001 BGP_CLEAR_SOFT_OUT, argv[0]);
5002
5003 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5004 BGP_CLEAR_SOFT_OUT, argv[0]);
5005}
5006
5007ALIAS (clear_ip_bgp_peer_group_ipv4_soft_out,
5008 clear_ip_bgp_peer_group_ipv4_out_cmd,
5009 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) out",
5010 CLEAR_STR
5011 IP_STR
5012 BGP_STR
5013 "Clear all members of peer-group\n"
5014 "BGP peer-group name\n"
5015 "Address family\n"
5016 "Address Family modifier\n"
5017 "Address Family modifier\n"
5018 "Soft reconfig outbound update\n")
5019
5020DEFUN (clear_bgp_peer_group_soft_out,
5021 clear_bgp_peer_group_soft_out_cmd,
5022 "clear bgp peer-group WORD soft out",
5023 CLEAR_STR
5024 BGP_STR
5025 "Clear all members of peer-group\n"
5026 "BGP peer-group name\n"
5027 "Soft reconfig\n"
5028 "Soft reconfig outbound update\n")
5029{
5030 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
5031 BGP_CLEAR_SOFT_OUT, argv[0]);
5032}
5033
5034ALIAS (clear_bgp_peer_group_soft_out,
5035 clear_bgp_ipv6_peer_group_soft_out_cmd,
5036 "clear bgp ipv6 peer-group WORD soft out",
5037 CLEAR_STR
5038 BGP_STR
5039 "Address family\n"
5040 "Clear all members of peer-group\n"
5041 "BGP peer-group name\n"
5042 "Soft reconfig\n"
5043 "Soft reconfig outbound update\n")
5044
5045ALIAS (clear_bgp_peer_group_soft_out,
5046 clear_bgp_peer_group_out_cmd,
5047 "clear bgp peer-group WORD out",
5048 CLEAR_STR
5049 BGP_STR
5050 "Clear all members of peer-group\n"
5051 "BGP peer-group name\n"
5052 "Soft reconfig outbound update\n")
5053
5054ALIAS (clear_bgp_peer_group_soft_out,
5055 clear_bgp_ipv6_peer_group_out_cmd,
5056 "clear bgp ipv6 peer-group WORD out",
5057 CLEAR_STR
5058 BGP_STR
5059 "Address family\n"
5060 "Clear all members of peer-group\n"
5061 "BGP peer-group name\n"
5062 "Soft reconfig outbound update\n")
5063
5064DEFUN (clear_ip_bgp_external_soft_out,
5065 clear_ip_bgp_external_soft_out_cmd,
5066 "clear ip bgp external soft out",
5067 CLEAR_STR
5068 IP_STR
5069 BGP_STR
5070 "Clear all external peers\n"
5071 "Soft reconfig\n"
5072 "Soft reconfig outbound update\n")
5073{
5074 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5075 BGP_CLEAR_SOFT_OUT, NULL);
5076}
5077
5078ALIAS (clear_ip_bgp_external_soft_out,
5079 clear_ip_bgp_external_out_cmd,
5080 "clear ip bgp external out",
5081 CLEAR_STR
5082 IP_STR
5083 BGP_STR
5084 "Clear all external peers\n"
5085 "Soft reconfig outbound update\n")
5086
5087DEFUN (clear_ip_bgp_external_ipv4_soft_out,
5088 clear_ip_bgp_external_ipv4_soft_out_cmd,
5089 "clear ip bgp external ipv4 (unicast|multicast) soft out",
5090 CLEAR_STR
5091 IP_STR
5092 BGP_STR
5093 "Clear all external peers\n"
5094 "Address family\n"
5095 "Address Family modifier\n"
5096 "Address Family modifier\n"
5097 "Soft reconfig\n"
5098 "Soft reconfig outbound update\n")
5099{
5100 if (strncmp (argv[0], "m", 1) == 0)
5101 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
5102 BGP_CLEAR_SOFT_OUT, NULL);
5103
5104 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5105 BGP_CLEAR_SOFT_OUT, NULL);
5106}
5107
5108ALIAS (clear_ip_bgp_external_ipv4_soft_out,
5109 clear_ip_bgp_external_ipv4_out_cmd,
5110 "clear ip bgp external ipv4 (unicast|multicast) out",
5111 CLEAR_STR
5112 IP_STR
5113 BGP_STR
5114 "Clear all external peers\n"
5115 "Address family\n"
5116 "Address Family modifier\n"
5117 "Address Family modifier\n"
5118 "Soft reconfig outbound update\n")
5119
5120DEFUN (clear_bgp_external_soft_out,
5121 clear_bgp_external_soft_out_cmd,
5122 "clear bgp external soft out",
5123 CLEAR_STR
5124 BGP_STR
5125 "Clear all external peers\n"
5126 "Soft reconfig\n"
5127 "Soft reconfig outbound update\n")
5128{
5129 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
5130 BGP_CLEAR_SOFT_OUT, NULL);
5131}
5132
5133ALIAS (clear_bgp_external_soft_out,
5134 clear_bgp_ipv6_external_soft_out_cmd,
5135 "clear bgp ipv6 external soft out",
5136 CLEAR_STR
5137 BGP_STR
5138 "Address family\n"
5139 "Clear all external peers\n"
5140 "Soft reconfig\n"
5141 "Soft reconfig outbound update\n")
5142
5143ALIAS (clear_bgp_external_soft_out,
5144 clear_bgp_external_out_cmd,
5145 "clear bgp external out",
5146 CLEAR_STR
5147 BGP_STR
5148 "Clear all external peers\n"
5149 "Soft reconfig outbound update\n")
5150
5151ALIAS (clear_bgp_external_soft_out,
5152 clear_bgp_ipv6_external_out_cmd,
5153 "clear bgp ipv6 external WORD out",
5154 CLEAR_STR
5155 BGP_STR
5156 "Address family\n"
5157 "Clear all external peers\n"
5158 "Soft reconfig outbound update\n")
5159
5160DEFUN (clear_ip_bgp_as_soft_out,
5161 clear_ip_bgp_as_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005162 "clear ip bgp " CMD_AS_RANGE " soft out",
paul718e3742002-12-13 20:15:29 +00005163 CLEAR_STR
5164 IP_STR
5165 BGP_STR
5166 "Clear peers with the AS number\n"
5167 "Soft reconfig\n"
5168 "Soft reconfig outbound update\n")
5169{
5170 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
5171 BGP_CLEAR_SOFT_OUT, argv[0]);
5172}
5173
5174ALIAS (clear_ip_bgp_as_soft_out,
5175 clear_ip_bgp_as_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005176 "clear ip bgp " CMD_AS_RANGE " out",
paul718e3742002-12-13 20:15:29 +00005177 CLEAR_STR
5178 IP_STR
5179 BGP_STR
5180 "Clear peers with the AS number\n"
5181 "Soft reconfig outbound update\n")
5182
5183DEFUN (clear_ip_bgp_as_ipv4_soft_out,
5184 clear_ip_bgp_as_ipv4_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005185 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft out",
paul718e3742002-12-13 20:15:29 +00005186 CLEAR_STR
5187 IP_STR
5188 BGP_STR
5189 "Clear peers with the AS number\n"
5190 "Address family\n"
5191 "Address Family modifier\n"
5192 "Address Family modifier\n"
5193 "Soft reconfig\n"
5194 "Soft reconfig outbound update\n")
5195{
5196 if (strncmp (argv[1], "m", 1) == 0)
5197 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
5198 BGP_CLEAR_SOFT_OUT, argv[0]);
5199
5200 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
5201 BGP_CLEAR_SOFT_OUT, argv[0]);
5202}
5203
5204ALIAS (clear_ip_bgp_as_ipv4_soft_out,
5205 clear_ip_bgp_as_ipv4_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005206 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) out",
paul718e3742002-12-13 20:15:29 +00005207 CLEAR_STR
5208 IP_STR
5209 BGP_STR
5210 "Clear peers with the AS number\n"
5211 "Address family\n"
5212 "Address Family modifier\n"
5213 "Address Family modifier\n"
5214 "Soft reconfig outbound update\n")
5215
5216DEFUN (clear_ip_bgp_as_vpnv4_soft_out,
5217 clear_ip_bgp_as_vpnv4_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005218 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft out",
paul718e3742002-12-13 20:15:29 +00005219 CLEAR_STR
5220 IP_STR
5221 BGP_STR
5222 "Clear peers with the AS number\n"
5223 "Address family\n"
5224 "Address Family modifier\n"
5225 "Soft reconfig\n"
5226 "Soft reconfig outbound update\n")
5227{
5228 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
5229 BGP_CLEAR_SOFT_OUT, argv[0]);
5230}
5231
5232ALIAS (clear_ip_bgp_as_vpnv4_soft_out,
5233 clear_ip_bgp_as_vpnv4_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005234 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast out",
paul718e3742002-12-13 20:15:29 +00005235 CLEAR_STR
5236 IP_STR
5237 BGP_STR
5238 "Clear peers with the AS number\n"
5239 "Address family\n"
5240 "Address Family modifier\n"
5241 "Soft reconfig outbound update\n")
5242
5243DEFUN (clear_bgp_as_soft_out,
5244 clear_bgp_as_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005245 "clear bgp " CMD_AS_RANGE " soft out",
paul718e3742002-12-13 20:15:29 +00005246 CLEAR_STR
5247 BGP_STR
5248 "Clear peers with the AS number\n"
5249 "Soft reconfig\n"
5250 "Soft reconfig outbound update\n")
5251{
5252 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
5253 BGP_CLEAR_SOFT_OUT, argv[0]);
5254}
5255
5256ALIAS (clear_bgp_as_soft_out,
5257 clear_bgp_ipv6_as_soft_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005258 "clear bgp ipv6 " CMD_AS_RANGE " soft out",
paul718e3742002-12-13 20:15:29 +00005259 CLEAR_STR
5260 BGP_STR
5261 "Address family\n"
5262 "Clear peers with the AS number\n"
5263 "Soft reconfig\n"
5264 "Soft reconfig outbound update\n")
5265
5266ALIAS (clear_bgp_as_soft_out,
5267 clear_bgp_as_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005268 "clear bgp " CMD_AS_RANGE " out",
paul718e3742002-12-13 20:15:29 +00005269 CLEAR_STR
5270 BGP_STR
5271 "Clear peers with the AS number\n"
5272 "Soft reconfig outbound update\n")
5273
5274ALIAS (clear_bgp_as_soft_out,
5275 clear_bgp_ipv6_as_out_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00005276 "clear bgp ipv6 " CMD_AS_RANGE " out",
paul718e3742002-12-13 20:15:29 +00005277 CLEAR_STR
5278 BGP_STR
5279 "Address family\n"
5280 "Clear peers with the AS number\n"
5281 "Soft reconfig outbound update\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02005282
paul718e3742002-12-13 20:15:29 +00005283/* Inbound soft-reconfiguration */
5284DEFUN (clear_ip_bgp_all_soft_in,
5285 clear_ip_bgp_all_soft_in_cmd,
5286 "clear ip bgp * soft in",
5287 CLEAR_STR
5288 IP_STR
5289 BGP_STR
5290 "Clear all peers\n"
5291 "Soft reconfig\n"
5292 "Soft reconfig inbound update\n")
5293{
5294 if (argc == 1)
5295 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5296 BGP_CLEAR_SOFT_IN, NULL);
5297
5298 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5299 BGP_CLEAR_SOFT_IN, NULL);
5300}
5301
5302ALIAS (clear_ip_bgp_all_soft_in,
5303 clear_ip_bgp_instance_all_soft_in_cmd,
5304 "clear ip bgp view WORD * soft in",
5305 CLEAR_STR
5306 IP_STR
5307 BGP_STR
5308 "BGP view\n"
5309 "view name\n"
5310 "Clear all peers\n"
5311 "Soft reconfig\n"
5312 "Soft reconfig inbound update\n")
5313
5314ALIAS (clear_ip_bgp_all_soft_in,
5315 clear_ip_bgp_all_in_cmd,
5316 "clear ip bgp * in",
5317 CLEAR_STR
5318 IP_STR
5319 BGP_STR
5320 "Clear all peers\n"
5321 "Soft reconfig inbound update\n")
5322
5323DEFUN (clear_ip_bgp_all_in_prefix_filter,
5324 clear_ip_bgp_all_in_prefix_filter_cmd,
5325 "clear ip bgp * in prefix-filter",
5326 CLEAR_STR
5327 IP_STR
5328 BGP_STR
5329 "Clear all peers\n"
5330 "Soft reconfig inbound update\n"
5331 "Push out prefix-list ORF and do inbound soft reconfig\n")
5332{
5333 if (argc== 1)
5334 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5335 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5336
5337 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5338 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5339}
5340
5341ALIAS (clear_ip_bgp_all_in_prefix_filter,
5342 clear_ip_bgp_instance_all_in_prefix_filter_cmd,
5343 "clear ip bgp view WORD * in prefix-filter",
5344 CLEAR_STR
5345 IP_STR
5346 BGP_STR
5347 "BGP view\n"
5348 "view name\n"
5349 "Clear all peers\n"
5350 "Soft reconfig inbound update\n"
5351 "Push out prefix-list ORF and do inbound soft reconfig\n")
5352
5353
5354DEFUN (clear_ip_bgp_all_ipv4_soft_in,
5355 clear_ip_bgp_all_ipv4_soft_in_cmd,
5356 "clear ip bgp * ipv4 (unicast|multicast) soft in",
5357 CLEAR_STR
5358 IP_STR
5359 BGP_STR
5360 "Clear all peers\n"
5361 "Address family\n"
5362 "Address Family modifier\n"
5363 "Address Family modifier\n"
5364 "Soft reconfig\n"
5365 "Soft reconfig inbound update\n")
5366{
5367 if (strncmp (argv[0], "m", 1) == 0)
5368 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
5369 BGP_CLEAR_SOFT_IN, NULL);
5370
5371 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5372 BGP_CLEAR_SOFT_IN, NULL);
5373}
5374
5375ALIAS (clear_ip_bgp_all_ipv4_soft_in,
5376 clear_ip_bgp_all_ipv4_in_cmd,
5377 "clear ip bgp * ipv4 (unicast|multicast) in",
5378 CLEAR_STR
5379 IP_STR
5380 BGP_STR
5381 "Clear all peers\n"
5382 "Address family\n"
5383 "Address Family modifier\n"
5384 "Address Family modifier\n"
5385 "Soft reconfig inbound update\n")
5386
5387DEFUN (clear_ip_bgp_instance_all_ipv4_soft_in,
5388 clear_ip_bgp_instance_all_ipv4_soft_in_cmd,
5389 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft in",
5390 CLEAR_STR
5391 IP_STR
5392 BGP_STR
5393 "BGP view\n"
5394 "view name\n"
5395 "Clear all peers\n"
5396 "Address family\n"
5397 "Address Family modifier\n"
5398 "Address Family modifier\n"
5399 "Soft reconfig\n"
5400 "Soft reconfig inbound update\n")
5401{
5402 if (strncmp (argv[1], "m", 1) == 0)
5403 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
5404 BGP_CLEAR_SOFT_IN, NULL);
5405
5406 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5407 BGP_CLEAR_SOFT_IN, NULL);
5408}
5409
5410DEFUN (clear_ip_bgp_all_ipv4_in_prefix_filter,
5411 clear_ip_bgp_all_ipv4_in_prefix_filter_cmd,
5412 "clear ip bgp * ipv4 (unicast|multicast) in prefix-filter",
5413 CLEAR_STR
5414 IP_STR
5415 BGP_STR
5416 "Clear all peers\n"
5417 "Address family\n"
5418 "Address Family modifier\n"
5419 "Address Family modifier\n"
5420 "Soft reconfig inbound update\n"
5421 "Push out prefix-list ORF and do inbound soft reconfig\n")
5422{
5423 if (strncmp (argv[0], "m", 1) == 0)
5424 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
5425 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5426
5427 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5428 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5429}
5430
5431DEFUN (clear_ip_bgp_instance_all_ipv4_in_prefix_filter,
5432 clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd,
5433 "clear ip bgp view WORD * ipv4 (unicast|multicast) in prefix-filter",
5434 CLEAR_STR
5435 IP_STR
5436 BGP_STR
5437 "Clear all peers\n"
5438 "Address family\n"
5439 "Address Family modifier\n"
5440 "Address Family modifier\n"
5441 "Soft reconfig inbound update\n"
5442 "Push out prefix-list ORF and do inbound soft reconfig\n")
5443{
5444 if (strncmp (argv[1], "m", 1) == 0)
5445 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
5446 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5447
5448 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5449 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5450}
5451
5452DEFUN (clear_ip_bgp_all_vpnv4_soft_in,
5453 clear_ip_bgp_all_vpnv4_soft_in_cmd,
5454 "clear ip bgp * vpnv4 unicast soft in",
5455 CLEAR_STR
5456 IP_STR
5457 BGP_STR
5458 "Clear all peers\n"
5459 "Address family\n"
5460 "Address Family Modifier\n"
5461 "Soft reconfig\n"
5462 "Soft reconfig inbound update\n")
5463{
5464 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
5465 BGP_CLEAR_SOFT_IN, NULL);
5466}
5467
5468ALIAS (clear_ip_bgp_all_vpnv4_soft_in,
5469 clear_ip_bgp_all_vpnv4_in_cmd,
5470 "clear ip bgp * vpnv4 unicast in",
5471 CLEAR_STR
5472 IP_STR
5473 BGP_STR
5474 "Clear all peers\n"
5475 "Address family\n"
5476 "Address Family Modifier\n"
5477 "Soft reconfig inbound update\n")
5478
5479DEFUN (clear_bgp_all_soft_in,
5480 clear_bgp_all_soft_in_cmd,
5481 "clear bgp * soft in",
5482 CLEAR_STR
5483 BGP_STR
5484 "Clear all peers\n"
5485 "Soft reconfig\n"
5486 "Soft reconfig inbound update\n")
5487{
5488 if (argc == 1)
5489 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
5490 BGP_CLEAR_SOFT_IN, NULL);
5491
5492 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
5493 BGP_CLEAR_SOFT_IN, NULL);
5494}
5495
5496ALIAS (clear_bgp_all_soft_in,
5497 clear_bgp_instance_all_soft_in_cmd,
5498 "clear bgp view WORD * soft in",
5499 CLEAR_STR
5500 BGP_STR
5501 "BGP view\n"
5502 "view name\n"
5503 "Clear all peers\n"
5504 "Soft reconfig\n"
5505 "Soft reconfig inbound update\n")
5506
5507ALIAS (clear_bgp_all_soft_in,
5508 clear_bgp_ipv6_all_soft_in_cmd,
5509 "clear bgp ipv6 * soft in",
5510 CLEAR_STR
5511 BGP_STR
5512 "Address family\n"
5513 "Clear all peers\n"
5514 "Soft reconfig\n"
5515 "Soft reconfig inbound update\n")
5516
5517ALIAS (clear_bgp_all_soft_in,
5518 clear_bgp_all_in_cmd,
5519 "clear bgp * in",
5520 CLEAR_STR
5521 BGP_STR
5522 "Clear all peers\n"
5523 "Soft reconfig inbound update\n")
5524
5525ALIAS (clear_bgp_all_soft_in,
5526 clear_bgp_ipv6_all_in_cmd,
5527 "clear bgp ipv6 * in",
5528 CLEAR_STR
5529 BGP_STR
5530 "Address family\n"
5531 "Clear all peers\n"
5532 "Soft reconfig inbound update\n")
5533
5534DEFUN (clear_bgp_all_in_prefix_filter,
5535 clear_bgp_all_in_prefix_filter_cmd,
5536 "clear bgp * in prefix-filter",
5537 CLEAR_STR
5538 BGP_STR
5539 "Clear all peers\n"
5540 "Soft reconfig inbound update\n"
5541 "Push out prefix-list ORF and do inbound soft reconfig\n")
5542{
5543 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
5544 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5545}
5546
5547ALIAS (clear_bgp_all_in_prefix_filter,
5548 clear_bgp_ipv6_all_in_prefix_filter_cmd,
5549 "clear bgp ipv6 * in prefix-filter",
5550 CLEAR_STR
5551 BGP_STR
5552 "Address family\n"
5553 "Clear all peers\n"
5554 "Soft reconfig inbound update\n"
5555 "Push out prefix-list ORF and do inbound soft reconfig\n")
5556
5557DEFUN (clear_ip_bgp_peer_soft_in,
5558 clear_ip_bgp_peer_soft_in_cmd,
5559 "clear ip bgp A.B.C.D soft in",
5560 CLEAR_STR
5561 IP_STR
5562 BGP_STR
5563 "BGP neighbor address to clear\n"
5564 "Soft reconfig\n"
5565 "Soft reconfig inbound update\n")
5566{
5567 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5568 BGP_CLEAR_SOFT_IN, argv[0]);
5569}
5570
5571ALIAS (clear_ip_bgp_peer_soft_in,
5572 clear_ip_bgp_peer_in_cmd,
5573 "clear ip bgp A.B.C.D in",
5574 CLEAR_STR
5575 IP_STR
5576 BGP_STR
5577 "BGP neighbor address to clear\n"
5578 "Soft reconfig inbound update\n")
5579
5580DEFUN (clear_ip_bgp_peer_in_prefix_filter,
5581 clear_ip_bgp_peer_in_prefix_filter_cmd,
5582 "clear ip bgp A.B.C.D in prefix-filter",
5583 CLEAR_STR
5584 IP_STR
5585 BGP_STR
5586 "BGP neighbor address to clear\n"
5587 "Soft reconfig inbound update\n"
5588 "Push out the existing ORF prefix-list\n")
5589{
5590 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5591 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5592}
5593
5594DEFUN (clear_ip_bgp_peer_ipv4_soft_in,
5595 clear_ip_bgp_peer_ipv4_soft_in_cmd,
5596 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft in",
5597 CLEAR_STR
5598 IP_STR
5599 BGP_STR
5600 "BGP neighbor address to clear\n"
5601 "Address family\n"
5602 "Address Family modifier\n"
5603 "Address Family modifier\n"
5604 "Soft reconfig\n"
5605 "Soft reconfig inbound update\n")
5606{
5607 if (strncmp (argv[1], "m", 1) == 0)
5608 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
5609 BGP_CLEAR_SOFT_IN, argv[0]);
5610
5611 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5612 BGP_CLEAR_SOFT_IN, argv[0]);
5613}
5614
5615ALIAS (clear_ip_bgp_peer_ipv4_soft_in,
5616 clear_ip_bgp_peer_ipv4_in_cmd,
5617 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in",
5618 CLEAR_STR
5619 IP_STR
5620 BGP_STR
5621 "BGP neighbor address to clear\n"
5622 "Address family\n"
5623 "Address Family modifier\n"
5624 "Address Family modifier\n"
5625 "Soft reconfig inbound update\n")
5626
5627DEFUN (clear_ip_bgp_peer_ipv4_in_prefix_filter,
5628 clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd,
5629 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in prefix-filter",
5630 CLEAR_STR
5631 IP_STR
5632 BGP_STR
5633 "BGP neighbor address to clear\n"
5634 "Address family\n"
5635 "Address Family modifier\n"
5636 "Address Family modifier\n"
5637 "Soft reconfig inbound update\n"
5638 "Push out the existing ORF prefix-list\n")
5639{
5640 if (strncmp (argv[1], "m", 1) == 0)
5641 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
5642 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5643
5644 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5645 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5646}
5647
5648DEFUN (clear_ip_bgp_peer_vpnv4_soft_in,
5649 clear_ip_bgp_peer_vpnv4_soft_in_cmd,
5650 "clear ip bgp A.B.C.D vpnv4 unicast soft in",
5651 CLEAR_STR
5652 IP_STR
5653 BGP_STR
5654 "BGP neighbor address to clear\n"
5655 "Address family\n"
5656 "Address Family Modifier\n"
5657 "Soft reconfig\n"
5658 "Soft reconfig inbound update\n")
5659{
5660 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
5661 BGP_CLEAR_SOFT_IN, argv[0]);
5662}
5663
5664ALIAS (clear_ip_bgp_peer_vpnv4_soft_in,
5665 clear_ip_bgp_peer_vpnv4_in_cmd,
5666 "clear ip bgp A.B.C.D vpnv4 unicast in",
5667 CLEAR_STR
5668 IP_STR
5669 BGP_STR
5670 "BGP neighbor address to clear\n"
5671 "Address family\n"
5672 "Address Family Modifier\n"
5673 "Soft reconfig inbound update\n")
5674
5675DEFUN (clear_bgp_peer_soft_in,
5676 clear_bgp_peer_soft_in_cmd,
5677 "clear bgp (A.B.C.D|X:X::X:X) soft in",
5678 CLEAR_STR
5679 BGP_STR
5680 "BGP neighbor address to clear\n"
5681 "BGP IPv6 neighbor to clear\n"
5682 "Soft reconfig\n"
5683 "Soft reconfig inbound update\n")
5684{
5685 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
5686 BGP_CLEAR_SOFT_IN, argv[0]);
5687}
5688
5689ALIAS (clear_bgp_peer_soft_in,
5690 clear_bgp_ipv6_peer_soft_in_cmd,
5691 "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft in",
5692 CLEAR_STR
5693 BGP_STR
5694 "Address family\n"
5695 "BGP neighbor address to clear\n"
5696 "BGP IPv6 neighbor to clear\n"
5697 "Soft reconfig\n"
5698 "Soft reconfig inbound update\n")
5699
5700ALIAS (clear_bgp_peer_soft_in,
5701 clear_bgp_peer_in_cmd,
5702 "clear bgp (A.B.C.D|X:X::X:X) in",
5703 CLEAR_STR
5704 BGP_STR
5705 "BGP neighbor address to clear\n"
5706 "BGP IPv6 neighbor to clear\n"
5707 "Soft reconfig inbound update\n")
5708
5709ALIAS (clear_bgp_peer_soft_in,
5710 clear_bgp_ipv6_peer_in_cmd,
5711 "clear bgp ipv6 (A.B.C.D|X:X::X:X) in",
5712 CLEAR_STR
5713 BGP_STR
5714 "Address family\n"
5715 "BGP neighbor address to clear\n"
5716 "BGP IPv6 neighbor to clear\n"
5717 "Soft reconfig inbound update\n")
5718
5719DEFUN (clear_bgp_peer_in_prefix_filter,
5720 clear_bgp_peer_in_prefix_filter_cmd,
5721 "clear bgp (A.B.C.D|X:X::X:X) in prefix-filter",
5722 CLEAR_STR
5723 BGP_STR
5724 "BGP neighbor address to clear\n"
5725 "BGP IPv6 neighbor to clear\n"
5726 "Soft reconfig inbound update\n"
5727 "Push out the existing ORF prefix-list\n")
5728{
5729 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
5730 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5731}
5732
5733ALIAS (clear_bgp_peer_in_prefix_filter,
5734 clear_bgp_ipv6_peer_in_prefix_filter_cmd,
5735 "clear bgp ipv6 (A.B.C.D|X:X::X:X) in prefix-filter",
5736 CLEAR_STR
5737 BGP_STR
5738 "Address family\n"
5739 "BGP neighbor address to clear\n"
5740 "BGP IPv6 neighbor to clear\n"
5741 "Soft reconfig inbound update\n"
5742 "Push out the existing ORF prefix-list\n")
5743
5744DEFUN (clear_ip_bgp_peer_group_soft_in,
5745 clear_ip_bgp_peer_group_soft_in_cmd,
5746 "clear ip bgp peer-group WORD soft in",
5747 CLEAR_STR
5748 IP_STR
5749 BGP_STR
5750 "Clear all members of peer-group\n"
5751 "BGP peer-group name\n"
5752 "Soft reconfig\n"
5753 "Soft reconfig inbound update\n")
5754{
5755 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5756 BGP_CLEAR_SOFT_IN, argv[0]);
5757}
5758
5759ALIAS (clear_ip_bgp_peer_group_soft_in,
5760 clear_ip_bgp_peer_group_in_cmd,
5761 "clear ip bgp peer-group WORD in",
5762 CLEAR_STR
5763 IP_STR
5764 BGP_STR
5765 "Clear all members of peer-group\n"
5766 "BGP peer-group name\n"
5767 "Soft reconfig inbound update\n")
5768
5769DEFUN (clear_ip_bgp_peer_group_in_prefix_filter,
5770 clear_ip_bgp_peer_group_in_prefix_filter_cmd,
5771 "clear ip bgp peer-group WORD in prefix-filter",
5772 CLEAR_STR
5773 IP_STR
5774 BGP_STR
5775 "Clear all members of peer-group\n"
5776 "BGP peer-group name\n"
5777 "Soft reconfig inbound update\n"
5778 "Push out prefix-list ORF and do inbound soft reconfig\n")
5779{
5780 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5781 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5782}
5783
5784DEFUN (clear_ip_bgp_peer_group_ipv4_soft_in,
5785 clear_ip_bgp_peer_group_ipv4_soft_in_cmd,
5786 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft in",
5787 CLEAR_STR
5788 IP_STR
5789 BGP_STR
5790 "Clear all members of peer-group\n"
5791 "BGP peer-group name\n"
5792 "Address family\n"
5793 "Address Family modifier\n"
5794 "Address Family modifier\n"
5795 "Soft reconfig\n"
5796 "Soft reconfig inbound update\n")
5797{
5798 if (strncmp (argv[1], "m", 1) == 0)
5799 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
5800 BGP_CLEAR_SOFT_IN, argv[0]);
5801
5802 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5803 BGP_CLEAR_SOFT_IN, argv[0]);
5804}
5805
5806ALIAS (clear_ip_bgp_peer_group_ipv4_soft_in,
5807 clear_ip_bgp_peer_group_ipv4_in_cmd,
5808 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in",
5809 CLEAR_STR
5810 IP_STR
5811 BGP_STR
5812 "Clear all members of peer-group\n"
5813 "BGP peer-group name\n"
5814 "Address family\n"
5815 "Address Family modifier\n"
5816 "Address Family modifier\n"
5817 "Soft reconfig inbound update\n")
5818
5819DEFUN (clear_ip_bgp_peer_group_ipv4_in_prefix_filter,
5820 clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd,
5821 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in prefix-filter",
5822 CLEAR_STR
5823 IP_STR
5824 BGP_STR
5825 "Clear all members of peer-group\n"
5826 "BGP peer-group name\n"
5827 "Address family\n"
5828 "Address Family modifier\n"
5829 "Address Family modifier\n"
5830 "Soft reconfig inbound update\n"
5831 "Push out prefix-list ORF and do inbound soft reconfig\n")
5832{
5833 if (strncmp (argv[1], "m", 1) == 0)
5834 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
5835 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5836
5837 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5838 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5839}
5840
5841DEFUN (clear_bgp_peer_group_soft_in,
5842 clear_bgp_peer_group_soft_in_cmd,
5843 "clear bgp peer-group WORD soft in",
5844 CLEAR_STR
5845 BGP_STR
5846 "Clear all members of peer-group\n"
5847 "BGP peer-group name\n"
5848 "Soft reconfig\n"
5849 "Soft reconfig inbound update\n")
5850{
5851 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
5852 BGP_CLEAR_SOFT_IN, argv[0]);
5853}
5854
5855ALIAS (clear_bgp_peer_group_soft_in,
5856 clear_bgp_ipv6_peer_group_soft_in_cmd,
5857 "clear bgp ipv6 peer-group WORD soft in",
5858 CLEAR_STR
5859 BGP_STR
5860 "Address family\n"
5861 "Clear all members of peer-group\n"
5862 "BGP peer-group name\n"
5863 "Soft reconfig\n"
5864 "Soft reconfig inbound update\n")
5865
5866ALIAS (clear_bgp_peer_group_soft_in,
5867 clear_bgp_peer_group_in_cmd,
5868 "clear bgp peer-group WORD in",
5869 CLEAR_STR
5870 BGP_STR
5871 "Clear all members of peer-group\n"
5872 "BGP peer-group name\n"
5873 "Soft reconfig inbound update\n")
5874
5875ALIAS (clear_bgp_peer_group_soft_in,
5876 clear_bgp_ipv6_peer_group_in_cmd,
5877 "clear bgp ipv6 peer-group WORD in",
5878 CLEAR_STR
5879 BGP_STR
5880 "Address family\n"
5881 "Clear all members of peer-group\n"
5882 "BGP peer-group name\n"
5883 "Soft reconfig inbound update\n")
5884
5885DEFUN (clear_bgp_peer_group_in_prefix_filter,
5886 clear_bgp_peer_group_in_prefix_filter_cmd,
5887 "clear bgp peer-group WORD in prefix-filter",
5888 CLEAR_STR
5889 BGP_STR
5890 "Clear all members of peer-group\n"
5891 "BGP peer-group name\n"
5892 "Soft reconfig inbound update\n"
5893 "Push out prefix-list ORF and do inbound soft reconfig\n")
5894{
5895 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
5896 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5897}
5898
5899ALIAS (clear_bgp_peer_group_in_prefix_filter,
5900 clear_bgp_ipv6_peer_group_in_prefix_filter_cmd,
5901 "clear bgp ipv6 peer-group WORD in prefix-filter",
5902 CLEAR_STR
5903 BGP_STR
5904 "Address family\n"
5905 "Clear all members of peer-group\n"
5906 "BGP peer-group name\n"
5907 "Soft reconfig inbound update\n"
5908 "Push out prefix-list ORF and do inbound soft reconfig\n")
5909
5910DEFUN (clear_ip_bgp_external_soft_in,
5911 clear_ip_bgp_external_soft_in_cmd,
5912 "clear ip bgp external soft in",
5913 CLEAR_STR
5914 IP_STR
5915 BGP_STR
5916 "Clear all external peers\n"
5917 "Soft reconfig\n"
5918 "Soft reconfig inbound update\n")
5919{
5920 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5921 BGP_CLEAR_SOFT_IN, NULL);
5922}
5923
5924ALIAS (clear_ip_bgp_external_soft_in,
5925 clear_ip_bgp_external_in_cmd,
5926 "clear ip bgp external in",
5927 CLEAR_STR
5928 IP_STR
5929 BGP_STR
5930 "Clear all external peers\n"
5931 "Soft reconfig inbound update\n")
5932
5933DEFUN (clear_ip_bgp_external_in_prefix_filter,
5934 clear_ip_bgp_external_in_prefix_filter_cmd,
5935 "clear ip bgp external in prefix-filter",
5936 CLEAR_STR
5937 IP_STR
5938 BGP_STR
5939 "Clear all external peers\n"
5940 "Soft reconfig inbound update\n"
5941 "Push out prefix-list ORF and do inbound soft reconfig\n")
5942{
5943 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5944 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5945}
5946
5947DEFUN (clear_ip_bgp_external_ipv4_soft_in,
5948 clear_ip_bgp_external_ipv4_soft_in_cmd,
5949 "clear ip bgp external ipv4 (unicast|multicast) soft in",
5950 CLEAR_STR
5951 IP_STR
5952 BGP_STR
5953 "Clear all external peers\n"
5954 "Address family\n"
5955 "Address Family modifier\n"
5956 "Address Family modifier\n"
5957 "Soft reconfig\n"
5958 "Soft reconfig inbound update\n")
5959{
5960 if (strncmp (argv[0], "m", 1) == 0)
5961 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
5962 BGP_CLEAR_SOFT_IN, NULL);
5963
5964 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5965 BGP_CLEAR_SOFT_IN, NULL);
5966}
5967
5968ALIAS (clear_ip_bgp_external_ipv4_soft_in,
5969 clear_ip_bgp_external_ipv4_in_cmd,
5970 "clear ip bgp external ipv4 (unicast|multicast) in",
5971 CLEAR_STR
5972 IP_STR
5973 BGP_STR
5974 "Clear all external peers\n"
5975 "Address family\n"
5976 "Address Family modifier\n"
5977 "Address Family modifier\n"
5978 "Soft reconfig inbound update\n")
5979
5980DEFUN (clear_ip_bgp_external_ipv4_in_prefix_filter,
5981 clear_ip_bgp_external_ipv4_in_prefix_filter_cmd,
5982 "clear ip bgp external ipv4 (unicast|multicast) in prefix-filter",
5983 CLEAR_STR
5984 IP_STR
5985 BGP_STR
5986 "Clear all external peers\n"
5987 "Address family\n"
5988 "Address Family modifier\n"
5989 "Address Family modifier\n"
5990 "Soft reconfig inbound update\n"
5991 "Push out prefix-list ORF and do inbound soft reconfig\n")
5992{
5993 if (strncmp (argv[0], "m", 1) == 0)
5994 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
5995 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5996
5997 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5998 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5999}
6000
6001DEFUN (clear_bgp_external_soft_in,
6002 clear_bgp_external_soft_in_cmd,
6003 "clear bgp external soft in",
6004 CLEAR_STR
6005 BGP_STR
6006 "Clear all external peers\n"
6007 "Soft reconfig\n"
6008 "Soft reconfig inbound update\n")
6009{
6010 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
6011 BGP_CLEAR_SOFT_IN, NULL);
6012}
6013
6014ALIAS (clear_bgp_external_soft_in,
6015 clear_bgp_ipv6_external_soft_in_cmd,
6016 "clear bgp ipv6 external soft in",
6017 CLEAR_STR
6018 BGP_STR
6019 "Address family\n"
6020 "Clear all external peers\n"
6021 "Soft reconfig\n"
6022 "Soft reconfig inbound update\n")
6023
6024ALIAS (clear_bgp_external_soft_in,
6025 clear_bgp_external_in_cmd,
6026 "clear bgp external in",
6027 CLEAR_STR
6028 BGP_STR
6029 "Clear all external peers\n"
6030 "Soft reconfig inbound update\n")
6031
6032ALIAS (clear_bgp_external_soft_in,
6033 clear_bgp_ipv6_external_in_cmd,
6034 "clear bgp ipv6 external WORD in",
6035 CLEAR_STR
6036 BGP_STR
6037 "Address family\n"
6038 "Clear all external peers\n"
6039 "Soft reconfig inbound update\n")
6040
6041DEFUN (clear_bgp_external_in_prefix_filter,
6042 clear_bgp_external_in_prefix_filter_cmd,
6043 "clear bgp external in prefix-filter",
6044 CLEAR_STR
6045 BGP_STR
6046 "Clear all external peers\n"
6047 "Soft reconfig inbound update\n"
6048 "Push out prefix-list ORF and do inbound soft reconfig\n")
6049{
6050 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
6051 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
6052}
6053
6054ALIAS (clear_bgp_external_in_prefix_filter,
6055 clear_bgp_ipv6_external_in_prefix_filter_cmd,
6056 "clear bgp ipv6 external in prefix-filter",
6057 CLEAR_STR
6058 BGP_STR
6059 "Address family\n"
6060 "Clear all external peers\n"
6061 "Soft reconfig inbound update\n"
6062 "Push out prefix-list ORF and do inbound soft reconfig\n")
6063
6064DEFUN (clear_ip_bgp_as_soft_in,
6065 clear_ip_bgp_as_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006066 "clear ip bgp " CMD_AS_RANGE " soft in",
paul718e3742002-12-13 20:15:29 +00006067 CLEAR_STR
6068 IP_STR
6069 BGP_STR
6070 "Clear peers with the AS number\n"
6071 "Soft reconfig\n"
6072 "Soft reconfig inbound update\n")
6073{
6074 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6075 BGP_CLEAR_SOFT_IN, argv[0]);
6076}
6077
6078ALIAS (clear_ip_bgp_as_soft_in,
6079 clear_ip_bgp_as_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006080 "clear ip bgp " CMD_AS_RANGE " in",
paul718e3742002-12-13 20:15:29 +00006081 CLEAR_STR
6082 IP_STR
6083 BGP_STR
6084 "Clear peers with the AS number\n"
6085 "Soft reconfig inbound update\n")
6086
6087DEFUN (clear_ip_bgp_as_in_prefix_filter,
6088 clear_ip_bgp_as_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006089 "clear ip bgp " CMD_AS_RANGE " in prefix-filter",
paul718e3742002-12-13 20:15:29 +00006090 CLEAR_STR
6091 IP_STR
6092 BGP_STR
6093 "Clear peers with the AS number\n"
6094 "Soft reconfig inbound update\n"
6095 "Push out prefix-list ORF and do inbound soft reconfig\n")
6096{
6097 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6098 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6099}
6100
6101DEFUN (clear_ip_bgp_as_ipv4_soft_in,
6102 clear_ip_bgp_as_ipv4_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006103 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft in",
paul718e3742002-12-13 20:15:29 +00006104 CLEAR_STR
6105 IP_STR
6106 BGP_STR
6107 "Clear peers with the AS number\n"
6108 "Address family\n"
6109 "Address Family modifier\n"
6110 "Address Family modifier\n"
6111 "Soft reconfig\n"
6112 "Soft reconfig inbound update\n")
6113{
6114 if (strncmp (argv[1], "m", 1) == 0)
6115 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
6116 BGP_CLEAR_SOFT_IN, argv[0]);
6117
6118 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6119 BGP_CLEAR_SOFT_IN, argv[0]);
6120}
6121
6122ALIAS (clear_ip_bgp_as_ipv4_soft_in,
6123 clear_ip_bgp_as_ipv4_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006124 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in",
paul718e3742002-12-13 20:15:29 +00006125 CLEAR_STR
6126 IP_STR
6127 BGP_STR
6128 "Clear peers with the AS number\n"
6129 "Address family\n"
6130 "Address Family modifier\n"
6131 "Address Family modifier\n"
6132 "Soft reconfig inbound update\n")
6133
6134DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter,
6135 clear_ip_bgp_as_ipv4_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006136 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in prefix-filter",
paul718e3742002-12-13 20:15:29 +00006137 CLEAR_STR
6138 IP_STR
6139 BGP_STR
6140 "Clear peers with the AS number\n"
6141 "Address family\n"
6142 "Address Family modifier\n"
6143 "Address Family modifier\n"
6144 "Soft reconfig inbound update\n"
6145 "Push out prefix-list ORF and do inbound soft reconfig\n")
6146{
6147 if (strncmp (argv[1], "m", 1) == 0)
6148 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
6149 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6150
6151 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6152 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6153}
6154
6155DEFUN (clear_ip_bgp_as_vpnv4_soft_in,
6156 clear_ip_bgp_as_vpnv4_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006157 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft in",
paul718e3742002-12-13 20:15:29 +00006158 CLEAR_STR
6159 IP_STR
6160 BGP_STR
6161 "Clear peers with the AS number\n"
6162 "Address family\n"
6163 "Address Family modifier\n"
6164 "Soft reconfig\n"
6165 "Soft reconfig inbound update\n")
6166{
6167 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
6168 BGP_CLEAR_SOFT_IN, argv[0]);
6169}
6170
6171ALIAS (clear_ip_bgp_as_vpnv4_soft_in,
6172 clear_ip_bgp_as_vpnv4_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006173 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast in",
paul718e3742002-12-13 20:15:29 +00006174 CLEAR_STR
6175 IP_STR
6176 BGP_STR
6177 "Clear peers with the AS number\n"
6178 "Address family\n"
6179 "Address Family modifier\n"
6180 "Soft reconfig inbound update\n")
6181
6182DEFUN (clear_bgp_as_soft_in,
6183 clear_bgp_as_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006184 "clear bgp " CMD_AS_RANGE " soft in",
paul718e3742002-12-13 20:15:29 +00006185 CLEAR_STR
6186 BGP_STR
6187 "Clear peers with the AS number\n"
6188 "Soft reconfig\n"
6189 "Soft reconfig inbound update\n")
6190{
6191 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
6192 BGP_CLEAR_SOFT_IN, argv[0]);
6193}
6194
6195ALIAS (clear_bgp_as_soft_in,
6196 clear_bgp_ipv6_as_soft_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006197 "clear bgp ipv6 " CMD_AS_RANGE " soft in",
paul718e3742002-12-13 20:15:29 +00006198 CLEAR_STR
6199 BGP_STR
6200 "Address family\n"
6201 "Clear peers with the AS number\n"
6202 "Soft reconfig\n"
6203 "Soft reconfig inbound update\n")
6204
6205ALIAS (clear_bgp_as_soft_in,
6206 clear_bgp_as_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006207 "clear bgp " CMD_AS_RANGE " in",
paul718e3742002-12-13 20:15:29 +00006208 CLEAR_STR
6209 BGP_STR
6210 "Clear peers with the AS number\n"
6211 "Soft reconfig inbound update\n")
6212
6213ALIAS (clear_bgp_as_soft_in,
6214 clear_bgp_ipv6_as_in_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006215 "clear bgp ipv6 " CMD_AS_RANGE " in",
paul718e3742002-12-13 20:15:29 +00006216 CLEAR_STR
6217 BGP_STR
6218 "Address family\n"
6219 "Clear peers with the AS number\n"
6220 "Soft reconfig inbound update\n")
6221
6222DEFUN (clear_bgp_as_in_prefix_filter,
6223 clear_bgp_as_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006224 "clear bgp " CMD_AS_RANGE " in prefix-filter",
paul718e3742002-12-13 20:15:29 +00006225 CLEAR_STR
6226 BGP_STR
6227 "Clear peers with the AS number\n"
6228 "Soft reconfig inbound update\n"
6229 "Push out prefix-list ORF and do inbound soft reconfig\n")
6230{
6231 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
6232 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6233}
6234
6235ALIAS (clear_bgp_as_in_prefix_filter,
6236 clear_bgp_ipv6_as_in_prefix_filter_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006237 "clear bgp ipv6 " CMD_AS_RANGE " in prefix-filter",
paul718e3742002-12-13 20:15:29 +00006238 CLEAR_STR
6239 BGP_STR
6240 "Address family\n"
6241 "Clear peers with the AS number\n"
6242 "Soft reconfig inbound update\n"
6243 "Push out prefix-list ORF and do inbound soft reconfig\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02006244
paul718e3742002-12-13 20:15:29 +00006245/* Both soft-reconfiguration */
6246DEFUN (clear_ip_bgp_all_soft,
6247 clear_ip_bgp_all_soft_cmd,
6248 "clear ip bgp * soft",
6249 CLEAR_STR
6250 IP_STR
6251 BGP_STR
6252 "Clear all peers\n"
6253 "Soft reconfig\n")
6254{
6255 if (argc == 1)
6256 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
6257 BGP_CLEAR_SOFT_BOTH, NULL);
6258
6259 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6260 BGP_CLEAR_SOFT_BOTH, NULL);
6261}
6262
6263ALIAS (clear_ip_bgp_all_soft,
6264 clear_ip_bgp_instance_all_soft_cmd,
6265 "clear ip bgp view WORD * soft",
6266 CLEAR_STR
6267 IP_STR
6268 BGP_STR
6269 "BGP view\n"
6270 "view name\n"
6271 "Clear all peers\n"
6272 "Soft reconfig\n")
6273
6274
6275DEFUN (clear_ip_bgp_all_ipv4_soft,
6276 clear_ip_bgp_all_ipv4_soft_cmd,
6277 "clear ip bgp * ipv4 (unicast|multicast) soft",
6278 CLEAR_STR
6279 IP_STR
6280 BGP_STR
6281 "Clear all peers\n"
6282 "Address family\n"
6283 "Address Family Modifier\n"
6284 "Address Family Modifier\n"
6285 "Soft reconfig\n")
6286{
6287 if (strncmp (argv[0], "m", 1) == 0)
6288 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
6289 BGP_CLEAR_SOFT_BOTH, NULL);
6290
6291 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6292 BGP_CLEAR_SOFT_BOTH, NULL);
6293}
6294
6295DEFUN (clear_ip_bgp_instance_all_ipv4_soft,
6296 clear_ip_bgp_instance_all_ipv4_soft_cmd,
6297 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft",
6298 CLEAR_STR
6299 IP_STR
6300 BGP_STR
6301 "BGP view\n"
6302 "view name\n"
6303 "Clear all peers\n"
6304 "Address family\n"
6305 "Address Family Modifier\n"
6306 "Address Family Modifier\n"
6307 "Soft reconfig\n")
6308{
6309 if (strncmp (argv[1], "m", 1) == 0)
6310 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
6311 BGP_CLEAR_SOFT_BOTH, NULL);
6312
6313 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6314 BGP_CLEAR_SOFT_BOTH, NULL);
6315}
6316
6317DEFUN (clear_ip_bgp_all_vpnv4_soft,
6318 clear_ip_bgp_all_vpnv4_soft_cmd,
6319 "clear ip bgp * vpnv4 unicast soft",
6320 CLEAR_STR
6321 IP_STR
6322 BGP_STR
6323 "Clear all peers\n"
6324 "Address family\n"
6325 "Address Family Modifier\n"
6326 "Soft reconfig\n")
6327{
6328 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
6329 BGP_CLEAR_SOFT_BOTH, argv[0]);
6330}
6331
6332DEFUN (clear_bgp_all_soft,
6333 clear_bgp_all_soft_cmd,
6334 "clear bgp * soft",
6335 CLEAR_STR
6336 BGP_STR
6337 "Clear all peers\n"
6338 "Soft reconfig\n")
6339{
6340 if (argc == 1)
6341 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
6342 BGP_CLEAR_SOFT_BOTH, argv[0]);
6343
6344 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
6345 BGP_CLEAR_SOFT_BOTH, argv[0]);
6346}
6347
6348ALIAS (clear_bgp_all_soft,
6349 clear_bgp_instance_all_soft_cmd,
6350 "clear bgp view WORD * soft",
6351 CLEAR_STR
6352 BGP_STR
6353 "BGP view\n"
6354 "view name\n"
6355 "Clear all peers\n"
6356 "Soft reconfig\n")
6357
6358ALIAS (clear_bgp_all_soft,
6359 clear_bgp_ipv6_all_soft_cmd,
6360 "clear bgp ipv6 * soft",
6361 CLEAR_STR
6362 BGP_STR
6363 "Address family\n"
6364 "Clear all peers\n"
6365 "Soft reconfig\n")
6366
6367DEFUN (clear_ip_bgp_peer_soft,
6368 clear_ip_bgp_peer_soft_cmd,
6369 "clear ip bgp A.B.C.D soft",
6370 CLEAR_STR
6371 IP_STR
6372 BGP_STR
6373 "BGP neighbor address to clear\n"
6374 "Soft reconfig\n")
6375{
6376 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6377 BGP_CLEAR_SOFT_BOTH, argv[0]);
6378}
6379
6380DEFUN (clear_ip_bgp_peer_ipv4_soft,
6381 clear_ip_bgp_peer_ipv4_soft_cmd,
6382 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft",
6383 CLEAR_STR
6384 IP_STR
6385 BGP_STR
6386 "BGP neighbor address to clear\n"
6387 "Address family\n"
6388 "Address Family Modifier\n"
6389 "Address Family Modifier\n"
6390 "Soft reconfig\n")
6391{
6392 if (strncmp (argv[1], "m", 1) == 0)
6393 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
6394 BGP_CLEAR_SOFT_BOTH, argv[0]);
6395
6396 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6397 BGP_CLEAR_SOFT_BOTH, argv[0]);
6398}
6399
6400DEFUN (clear_ip_bgp_peer_vpnv4_soft,
6401 clear_ip_bgp_peer_vpnv4_soft_cmd,
6402 "clear ip bgp A.B.C.D vpnv4 unicast soft",
6403 CLEAR_STR
6404 IP_STR
6405 BGP_STR
6406 "BGP neighbor address to clear\n"
6407 "Address family\n"
6408 "Address Family Modifier\n"
6409 "Soft reconfig\n")
6410{
6411 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
6412 BGP_CLEAR_SOFT_BOTH, argv[0]);
6413}
6414
6415DEFUN (clear_bgp_peer_soft,
6416 clear_bgp_peer_soft_cmd,
6417 "clear bgp (A.B.C.D|X:X::X:X) soft",
6418 CLEAR_STR
6419 BGP_STR
6420 "BGP neighbor address to clear\n"
6421 "BGP IPv6 neighbor to clear\n"
6422 "Soft reconfig\n")
6423{
6424 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
6425 BGP_CLEAR_SOFT_BOTH, argv[0]);
6426}
6427
6428ALIAS (clear_bgp_peer_soft,
6429 clear_bgp_ipv6_peer_soft_cmd,
6430 "clear bgp ipv6 (A.B.C.D|X:X::X:X) soft",
6431 CLEAR_STR
6432 BGP_STR
6433 "Address family\n"
6434 "BGP neighbor address to clear\n"
6435 "BGP IPv6 neighbor to clear\n"
6436 "Soft reconfig\n")
6437
6438DEFUN (clear_ip_bgp_peer_group_soft,
6439 clear_ip_bgp_peer_group_soft_cmd,
6440 "clear ip bgp peer-group WORD soft",
6441 CLEAR_STR
6442 IP_STR
6443 BGP_STR
6444 "Clear all members of peer-group\n"
6445 "BGP peer-group name\n"
6446 "Soft reconfig\n")
6447{
6448 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6449 BGP_CLEAR_SOFT_BOTH, argv[0]);
6450}
6451
6452DEFUN (clear_ip_bgp_peer_group_ipv4_soft,
6453 clear_ip_bgp_peer_group_ipv4_soft_cmd,
6454 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft",
6455 CLEAR_STR
6456 IP_STR
6457 BGP_STR
6458 "Clear all members of peer-group\n"
6459 "BGP peer-group name\n"
6460 "Address family\n"
6461 "Address Family modifier\n"
6462 "Address Family modifier\n"
6463 "Soft reconfig\n")
6464{
6465 if (strncmp (argv[1], "m", 1) == 0)
6466 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
6467 BGP_CLEAR_SOFT_BOTH, argv[0]);
6468
6469 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6470 BGP_CLEAR_SOFT_BOTH, argv[0]);
6471}
6472
6473DEFUN (clear_bgp_peer_group_soft,
6474 clear_bgp_peer_group_soft_cmd,
6475 "clear bgp peer-group WORD soft",
6476 CLEAR_STR
6477 BGP_STR
6478 "Clear all members of peer-group\n"
6479 "BGP peer-group name\n"
6480 "Soft reconfig\n")
6481{
6482 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
6483 BGP_CLEAR_SOFT_BOTH, argv[0]);
6484}
6485
6486ALIAS (clear_bgp_peer_group_soft,
6487 clear_bgp_ipv6_peer_group_soft_cmd,
6488 "clear bgp ipv6 peer-group WORD soft",
6489 CLEAR_STR
6490 BGP_STR
6491 "Address family\n"
6492 "Clear all members of peer-group\n"
6493 "BGP peer-group name\n"
6494 "Soft reconfig\n")
6495
6496DEFUN (clear_ip_bgp_external_soft,
6497 clear_ip_bgp_external_soft_cmd,
6498 "clear ip bgp external soft",
6499 CLEAR_STR
6500 IP_STR
6501 BGP_STR
6502 "Clear all external peers\n"
6503 "Soft reconfig\n")
6504{
6505 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6506 BGP_CLEAR_SOFT_BOTH, NULL);
6507}
6508
6509DEFUN (clear_ip_bgp_external_ipv4_soft,
6510 clear_ip_bgp_external_ipv4_soft_cmd,
6511 "clear ip bgp external ipv4 (unicast|multicast) soft",
6512 CLEAR_STR
6513 IP_STR
6514 BGP_STR
6515 "Clear all external peers\n"
6516 "Address family\n"
6517 "Address Family modifier\n"
6518 "Address Family modifier\n"
6519 "Soft reconfig\n")
6520{
6521 if (strncmp (argv[0], "m", 1) == 0)
6522 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
6523 BGP_CLEAR_SOFT_BOTH, NULL);
6524
6525 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6526 BGP_CLEAR_SOFT_BOTH, NULL);
6527}
6528
6529DEFUN (clear_bgp_external_soft,
6530 clear_bgp_external_soft_cmd,
6531 "clear bgp external soft",
6532 CLEAR_STR
6533 BGP_STR
6534 "Clear all external peers\n"
6535 "Soft reconfig\n")
6536{
6537 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
6538 BGP_CLEAR_SOFT_BOTH, NULL);
6539}
6540
6541ALIAS (clear_bgp_external_soft,
6542 clear_bgp_ipv6_external_soft_cmd,
6543 "clear bgp ipv6 external soft",
6544 CLEAR_STR
6545 BGP_STR
6546 "Address family\n"
6547 "Clear all external peers\n"
6548 "Soft reconfig\n")
6549
6550DEFUN (clear_ip_bgp_as_soft,
6551 clear_ip_bgp_as_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006552 "clear ip bgp " CMD_AS_RANGE " soft",
paul718e3742002-12-13 20:15:29 +00006553 CLEAR_STR
6554 IP_STR
6555 BGP_STR
6556 "Clear peers with the AS number\n"
6557 "Soft reconfig\n")
6558{
6559 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6560 BGP_CLEAR_SOFT_BOTH, argv[0]);
6561}
6562
6563DEFUN (clear_ip_bgp_as_ipv4_soft,
6564 clear_ip_bgp_as_ipv4_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006565 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft",
paul718e3742002-12-13 20:15:29 +00006566 CLEAR_STR
6567 IP_STR
6568 BGP_STR
6569 "Clear peers with the AS number\n"
6570 "Address family\n"
6571 "Address Family Modifier\n"
6572 "Address Family Modifier\n"
6573 "Soft reconfig\n")
6574{
6575 if (strncmp (argv[1], "m", 1) == 0)
6576 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
6577 BGP_CLEAR_SOFT_BOTH, argv[0]);
6578
6579 return bgp_clear_vty (vty, NULL,AFI_IP, SAFI_UNICAST, clear_as,
6580 BGP_CLEAR_SOFT_BOTH, argv[0]);
6581}
6582
6583DEFUN (clear_ip_bgp_as_vpnv4_soft,
6584 clear_ip_bgp_as_vpnv4_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006585 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft",
paul718e3742002-12-13 20:15:29 +00006586 CLEAR_STR
6587 IP_STR
6588 BGP_STR
6589 "Clear peers with the AS number\n"
6590 "Address family\n"
6591 "Address Family Modifier\n"
6592 "Soft reconfig\n")
6593{
6594 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
6595 BGP_CLEAR_SOFT_BOTH, argv[0]);
6596}
6597
6598DEFUN (clear_bgp_as_soft,
6599 clear_bgp_as_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006600 "clear bgp " CMD_AS_RANGE " soft",
paul718e3742002-12-13 20:15:29 +00006601 CLEAR_STR
6602 BGP_STR
6603 "Clear peers with the AS number\n"
6604 "Soft reconfig\n")
6605{
6606 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
6607 BGP_CLEAR_SOFT_BOTH, argv[0]);
6608}
6609
6610ALIAS (clear_bgp_as_soft,
6611 clear_bgp_ipv6_as_soft_cmd,
Paul Jakma320da872008-07-02 13:40:33 +00006612 "clear bgp ipv6 " CMD_AS_RANGE " soft",
paul718e3742002-12-13 20:15:29 +00006613 CLEAR_STR
6614 BGP_STR
6615 "Address family\n"
6616 "Clear peers with the AS number\n"
6617 "Soft reconfig\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02006618
paulfee0f4c2004-09-13 05:12:46 +00006619/* RS-client soft reconfiguration. */
6620#ifdef HAVE_IPV6
6621DEFUN (clear_bgp_all_rsclient,
6622 clear_bgp_all_rsclient_cmd,
6623 "clear bgp * rsclient",
6624 CLEAR_STR
6625 BGP_STR
6626 "Clear all peers\n"
6627 "Soft reconfig for rsclient RIB\n")
6628{
6629 if (argc == 1)
6630 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
6631 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6632
6633 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
6634 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6635}
6636
6637ALIAS (clear_bgp_all_rsclient,
6638 clear_bgp_ipv6_all_rsclient_cmd,
6639 "clear bgp ipv6 * rsclient",
6640 CLEAR_STR
6641 BGP_STR
6642 "Address family\n"
6643 "Clear all peers\n"
6644 "Soft reconfig for rsclient RIB\n")
6645
6646ALIAS (clear_bgp_all_rsclient,
6647 clear_bgp_instance_all_rsclient_cmd,
6648 "clear bgp view WORD * rsclient",
6649 CLEAR_STR
6650 BGP_STR
6651 "BGP view\n"
6652 "view name\n"
6653 "Clear all peers\n"
6654 "Soft reconfig for rsclient RIB\n")
6655
6656ALIAS (clear_bgp_all_rsclient,
6657 clear_bgp_ipv6_instance_all_rsclient_cmd,
6658 "clear bgp ipv6 view WORD * rsclient",
6659 CLEAR_STR
6660 BGP_STR
6661 "Address family\n"
6662 "BGP view\n"
6663 "view name\n"
6664 "Clear all peers\n"
6665 "Soft reconfig for rsclient RIB\n")
6666#endif /* HAVE_IPV6 */
6667
6668DEFUN (clear_ip_bgp_all_rsclient,
6669 clear_ip_bgp_all_rsclient_cmd,
6670 "clear ip bgp * rsclient",
6671 CLEAR_STR
6672 IP_STR
6673 BGP_STR
6674 "Clear all peers\n"
6675 "Soft reconfig for rsclient RIB\n")
6676{
6677 if (argc == 1)
6678 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
6679 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6680
6681 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6682 BGP_CLEAR_SOFT_RSCLIENT, NULL);
6683}
6684
6685ALIAS (clear_ip_bgp_all_rsclient,
6686 clear_ip_bgp_instance_all_rsclient_cmd,
6687 "clear ip bgp view WORD * rsclient",
6688 CLEAR_STR
6689 IP_STR
6690 BGP_STR
6691 "BGP view\n"
6692 "view name\n"
6693 "Clear all peers\n"
6694 "Soft reconfig for rsclient RIB\n")
6695
6696#ifdef HAVE_IPV6
6697DEFUN (clear_bgp_peer_rsclient,
6698 clear_bgp_peer_rsclient_cmd,
6699 "clear bgp (A.B.C.D|X:X::X:X) rsclient",
6700 CLEAR_STR
6701 BGP_STR
6702 "BGP neighbor IP address to clear\n"
6703 "BGP IPv6 neighbor to clear\n"
6704 "Soft reconfig for rsclient RIB\n")
6705{
6706 if (argc == 2)
6707 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_peer,
6708 BGP_CLEAR_SOFT_RSCLIENT, argv[1]);
6709
6710 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
6711 BGP_CLEAR_SOFT_RSCLIENT, argv[0]);
6712}
6713
6714ALIAS (clear_bgp_peer_rsclient,
6715 clear_bgp_ipv6_peer_rsclient_cmd,
6716 "clear bgp ipv6 (A.B.C.D|X:X::X:X) rsclient",
6717 CLEAR_STR
6718 BGP_STR
6719 "Address family\n"
6720 "BGP neighbor IP address to clear\n"
6721 "BGP IPv6 neighbor to clear\n"
6722 "Soft reconfig for rsclient RIB\n")
6723
6724ALIAS (clear_bgp_peer_rsclient,
6725 clear_bgp_instance_peer_rsclient_cmd,
6726 "clear bgp view WORD (A.B.C.D|X:X::X:X) rsclient",
6727 CLEAR_STR
6728 BGP_STR
6729 "BGP view\n"
6730 "view name\n"
6731 "BGP neighbor IP address to clear\n"
6732 "BGP IPv6 neighbor to clear\n"
6733 "Soft reconfig for rsclient RIB\n")
6734
6735ALIAS (clear_bgp_peer_rsclient,
6736 clear_bgp_ipv6_instance_peer_rsclient_cmd,
6737 "clear bgp ipv6 view WORD (A.B.C.D|X:X::X:X) rsclient",
6738 CLEAR_STR
6739 BGP_STR
6740 "Address family\n"
6741 "BGP view\n"
6742 "view name\n"
6743 "BGP neighbor IP address to clear\n"
6744 "BGP IPv6 neighbor to clear\n"
6745 "Soft reconfig for rsclient RIB\n")
6746#endif /* HAVE_IPV6 */
6747
6748DEFUN (clear_ip_bgp_peer_rsclient,
6749 clear_ip_bgp_peer_rsclient_cmd,
6750 "clear ip bgp (A.B.C.D|X:X::X:X) rsclient",
6751 CLEAR_STR
6752 IP_STR
6753 BGP_STR
6754 "BGP neighbor IP address to clear\n"
6755 "BGP IPv6 neighbor to clear\n"
6756 "Soft reconfig for rsclient RIB\n")
6757{
6758 if (argc == 2)
6759 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_peer,
6760 BGP_CLEAR_SOFT_RSCLIENT, argv[1]);
6761
6762 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6763 BGP_CLEAR_SOFT_RSCLIENT, argv[0]);
6764}
6765
6766ALIAS (clear_ip_bgp_peer_rsclient,
6767 clear_ip_bgp_instance_peer_rsclient_cmd,
6768 "clear ip bgp view WORD (A.B.C.D|X:X::X:X) rsclient",
6769 CLEAR_STR
6770 IP_STR
6771 BGP_STR
6772 "BGP view\n"
6773 "view name\n"
6774 "BGP neighbor IP address to clear\n"
6775 "BGP IPv6 neighbor to clear\n"
6776 "Soft reconfig for rsclient RIB\n")
6777
Michael Lamberte0081f72008-11-16 20:12:04 +00006778DEFUN (show_bgp_views,
6779 show_bgp_views_cmd,
6780 "show bgp views",
6781 SHOW_STR
6782 BGP_STR
6783 "Show the defined BGP views\n")
6784{
6785 struct list *inst = bm->bgp;
6786 struct listnode *node;
6787 struct bgp *bgp;
6788
6789 if (!bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE))
6790 {
6791 vty_out (vty, "Multiple BGP views are not defined%s", VTY_NEWLINE);
6792 return CMD_WARNING;
6793 }
6794
6795 vty_out (vty, "Defined BGP views:%s", VTY_NEWLINE);
6796 for (ALL_LIST_ELEMENTS_RO(inst, node, bgp))
6797 vty_out (vty, "\t%s (AS%u)%s",
6798 bgp->name ? bgp->name : "(null)",
6799 bgp->as, VTY_NEWLINE);
6800
6801 return CMD_SUCCESS;
6802}
6803
Paul Jakma4bf6a362006-03-30 14:05:23 +00006804DEFUN (show_bgp_memory,
6805 show_bgp_memory_cmd,
6806 "show bgp memory",
6807 SHOW_STR
6808 BGP_STR
6809 "Global BGP memory statistics\n")
6810{
6811 char memstrbuf[MTYPE_MEMSTR_LEN];
6812 unsigned long count;
6813
6814 /* RIB related usage stats */
6815 count = mtype_stats_alloc (MTYPE_BGP_NODE);
6816 vty_out (vty, "%ld RIB nodes, using %s of memory%s", count,
6817 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6818 count * sizeof (struct bgp_node)),
6819 VTY_NEWLINE);
6820
6821 count = mtype_stats_alloc (MTYPE_BGP_ROUTE);
6822 vty_out (vty, "%ld BGP routes, using %s of memory%s", count,
6823 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6824 count * sizeof (struct bgp_info)),
6825 VTY_NEWLINE);
Paul Jakmafb982c22007-05-04 20:15:47 +00006826 if ((count = mtype_stats_alloc (MTYPE_BGP_ROUTE_EXTRA)))
6827 vty_out (vty, "%ld BGP route ancillaries, using %s of memory%s", count,
6828 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6829 count * sizeof (struct bgp_info_extra)),
6830 VTY_NEWLINE);
Paul Jakma4bf6a362006-03-30 14:05:23 +00006831
6832 if ((count = mtype_stats_alloc (MTYPE_BGP_STATIC)))
6833 vty_out (vty, "%ld Static routes, using %s of memory%s", count,
6834 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6835 count * sizeof (struct bgp_static)),
6836 VTY_NEWLINE);
6837
6838 /* Adj-In/Out */
6839 if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_IN)))
6840 vty_out (vty, "%ld Adj-In entries, using %s of memory%s", count,
6841 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6842 count * sizeof (struct bgp_adj_in)),
6843 VTY_NEWLINE);
6844 if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_OUT)))
6845 vty_out (vty, "%ld Adj-Out entries, using %s of memory%s", count,
6846 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6847 count * sizeof (struct bgp_adj_out)),
6848 VTY_NEWLINE);
6849
6850 if ((count = mtype_stats_alloc (MTYPE_BGP_NEXTHOP_CACHE)))
6851 vty_out (vty, "%ld Nexthop cache entries, using %s of memory%s", count,
6852 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6853 count * sizeof (struct bgp_nexthop_cache)),
6854 VTY_NEWLINE);
6855
6856 if ((count = mtype_stats_alloc (MTYPE_BGP_DAMP_INFO)))
6857 vty_out (vty, "%ld Dampening entries, using %s of memory%s", count,
6858 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6859 count * sizeof (struct bgp_damp_info)),
6860 VTY_NEWLINE);
6861
6862 /* Attributes */
6863 count = attr_count();
6864 vty_out (vty, "%ld BGP attributes, using %s of memory%s", count,
6865 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6866 count * sizeof(struct attr)),
6867 VTY_NEWLINE);
Paul Jakmafb982c22007-05-04 20:15:47 +00006868 if ((count = mtype_stats_alloc (MTYPE_ATTR_EXTRA)))
6869 vty_out (vty, "%ld BGP extra attributes, using %s of memory%s", count,
6870 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6871 count * sizeof(struct attr_extra)),
6872 VTY_NEWLINE);
Paul Jakma4bf6a362006-03-30 14:05:23 +00006873
6874 if ((count = attr_unknown_count()))
6875 vty_out (vty, "%ld unknown attributes%s", count, VTY_NEWLINE);
6876
6877 /* AS_PATH attributes */
6878 count = aspath_count ();
6879 vty_out (vty, "%ld BGP AS-PATH entries, using %s of memory%s", count,
6880 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6881 count * sizeof (struct aspath)),
6882 VTY_NEWLINE);
6883
6884 count = mtype_stats_alloc (MTYPE_AS_SEG);
6885 vty_out (vty, "%ld BGP AS-PATH segments, using %s of memory%s", count,
6886 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6887 count * sizeof (struct assegment)),
6888 VTY_NEWLINE);
6889
6890 /* Other attributes */
6891 if ((count = community_count ()))
6892 vty_out (vty, "%ld BGP community entries, using %s of memory%s", count,
6893 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6894 count * sizeof (struct community)),
6895 VTY_NEWLINE);
6896 if ((count = mtype_stats_alloc (MTYPE_ECOMMUNITY)))
6897 vty_out (vty, "%ld BGP community entries, using %s of memory%s", count,
6898 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6899 count * sizeof (struct ecommunity)),
6900 VTY_NEWLINE);
6901
6902 if ((count = mtype_stats_alloc (MTYPE_CLUSTER)))
6903 vty_out (vty, "%ld Cluster lists, using %s of memory%s", count,
6904 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6905 count * sizeof (struct cluster_list)),
6906 VTY_NEWLINE);
6907
6908 /* Peer related usage */
6909 count = mtype_stats_alloc (MTYPE_BGP_PEER);
6910 vty_out (vty, "%ld peers, using %s of memory%s", count,
6911 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6912 count * sizeof (struct peer)),
6913 VTY_NEWLINE);
6914
6915 if ((count = mtype_stats_alloc (MTYPE_PEER_GROUP)))
6916 vty_out (vty, "%ld peer groups, using %s of memory%s", count,
6917 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6918 count * sizeof (struct peer_group)),
6919 VTY_NEWLINE);
6920
6921 /* Other */
6922 if ((count = mtype_stats_alloc (MTYPE_HASH)))
6923 vty_out (vty, "%ld hash tables, using %s of memory%s", count,
6924 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6925 count * sizeof (struct hash)),
6926 VTY_NEWLINE);
6927 if ((count = mtype_stats_alloc (MTYPE_HASH_BACKET)))
6928 vty_out (vty, "%ld hash buckets, using %s of memory%s", count,
6929 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6930 count * sizeof (struct hash_backet)),
6931 VTY_NEWLINE);
6932 if ((count = mtype_stats_alloc (MTYPE_BGP_REGEXP)))
6933 vty_out (vty, "%ld compiled regexes, using %s of memory%s", count,
6934 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6935 count * sizeof (regex_t)),
6936 VTY_NEWLINE);
6937 return CMD_SUCCESS;
6938}
paulfee0f4c2004-09-13 05:12:46 +00006939
paul718e3742002-12-13 20:15:29 +00006940/* Show BGP peer's summary information. */
paul94f2b392005-06-28 12:44:16 +00006941static int
paul718e3742002-12-13 20:15:29 +00006942bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi)
6943{
6944 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00006945 struct listnode *node, *nnode;
Paul Jakma4bf6a362006-03-30 14:05:23 +00006946 unsigned int count = 0;
paul718e3742002-12-13 20:15:29 +00006947 char timebuf[BGP_UPTIME_LEN];
6948 int len;
6949
6950 /* Header string for each address family. */
Milan Kociancb4fc592014-12-01 12:48:25 +00006951 static char header[] = "Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd";
Paul Jakma4bf6a362006-03-30 14:05:23 +00006952
paul1eb8ef22005-04-07 07:30:20 +00006953 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00006954 {
6955 if (peer->afc[afi][safi])
6956 {
Paul Jakma4bf6a362006-03-30 14:05:23 +00006957 if (!count)
6958 {
6959 unsigned long ents;
6960 char memstrbuf[MTYPE_MEMSTR_LEN];
6961
6962 /* Usage summary and header */
6963 vty_out (vty,
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04006964 "BGP router identifier %s, local AS number %u%s",
Paul Jakma4bf6a362006-03-30 14:05:23 +00006965 inet_ntoa (bgp->router_id), bgp->as, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00006966
Paul Jakma4bf6a362006-03-30 14:05:23 +00006967 ents = bgp_table_count (bgp->rib[afi][safi]);
6968 vty_out (vty, "RIB entries %ld, using %s of memory%s", ents,
6969 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6970 ents * sizeof (struct bgp_node)),
6971 VTY_NEWLINE);
6972
6973 /* Peer related usage */
6974 ents = listcount (bgp->peer);
6975 vty_out (vty, "Peers %ld, using %s of memory%s",
6976 ents,
6977 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6978 ents * sizeof (struct peer)),
6979 VTY_NEWLINE);
6980
6981 if ((ents = listcount (bgp->rsclient)))
6982 vty_out (vty, "RS-Client peers %ld, using %s of memory%s",
6983 ents,
6984 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6985 ents * sizeof (struct peer)),
6986 VTY_NEWLINE);
6987
6988 if ((ents = listcount (bgp->group)))
6989 vty_out (vty, "Peer groups %ld, using %s of memory%s", ents,
6990 mtype_memstr (memstrbuf, sizeof (memstrbuf),
6991 ents * sizeof (struct peer_group)),
6992 VTY_NEWLINE);
6993
6994 if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING))
6995 vty_out (vty, "Dampening enabled.%s", VTY_NEWLINE);
6996 vty_out (vty, "%s", VTY_NEWLINE);
6997 vty_out (vty, "%s%s", header, VTY_NEWLINE);
6998 }
6999
paul718e3742002-12-13 20:15:29 +00007000 count++;
7001
7002 len = vty_out (vty, "%s", peer->host);
7003 len = 16 - len;
7004 if (len < 1)
7005 vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " ");
7006 else
7007 vty_out (vty, "%*s", len, " ");
7008
hasso3d515fd2005-02-01 21:30:04 +00007009 vty_out (vty, "4 ");
paul718e3742002-12-13 20:15:29 +00007010
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04007011 vty_out (vty, "%5u %7d %7d %8d %4d %4lu ",
paul718e3742002-12-13 20:15:29 +00007012 peer->as,
7013 peer->open_in + peer->update_in + peer->keepalive_in
7014 + peer->notify_in + peer->refresh_in + peer->dynamic_cap_in,
7015 peer->open_out + peer->update_out + peer->keepalive_out
7016 + peer->notify_out + peer->refresh_out
7017 + peer->dynamic_cap_out,
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00007018 0, 0, (unsigned long) peer->obuf->count);
paul718e3742002-12-13 20:15:29 +00007019
7020 vty_out (vty, "%8s",
7021 peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN));
7022
7023 if (peer->status == Established)
7024 {
7025 vty_out (vty, " %8ld", peer->pcount[afi][safi]);
7026 }
7027 else
7028 {
7029 if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN))
7030 vty_out (vty, " Idle (Admin)");
7031 else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW))
7032 vty_out (vty, " Idle (PfxCt)");
7033 else
7034 vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, peer->status));
7035 }
7036
7037 vty_out (vty, "%s", VTY_NEWLINE);
7038 }
7039 }
7040
7041 if (count)
7042 vty_out (vty, "%sTotal number of neighbors %d%s", VTY_NEWLINE,
7043 count, VTY_NEWLINE);
7044 else
7045 vty_out (vty, "No %s neighbor is configured%s",
7046 afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE);
7047 return CMD_SUCCESS;
7048}
7049
paul94f2b392005-06-28 12:44:16 +00007050static int
paulfd79ac92004-10-13 05:06:08 +00007051bgp_show_summary_vty (struct vty *vty, const char *name,
7052 afi_t afi, safi_t safi)
paul718e3742002-12-13 20:15:29 +00007053{
7054 struct bgp *bgp;
7055
7056 if (name)
7057 {
7058 bgp = bgp_lookup_by_name (name);
7059
7060 if (! bgp)
7061 {
7062 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
7063 return CMD_WARNING;
7064 }
7065
7066 bgp_show_summary (vty, bgp, afi, safi);
7067 return CMD_SUCCESS;
7068 }
7069
7070 bgp = bgp_get_default ();
7071
7072 if (bgp)
7073 bgp_show_summary (vty, bgp, afi, safi);
7074
7075 return CMD_SUCCESS;
7076}
7077
7078/* `show ip bgp summary' commands. */
7079DEFUN (show_ip_bgp_summary,
7080 show_ip_bgp_summary_cmd,
7081 "show ip bgp summary",
7082 SHOW_STR
7083 IP_STR
7084 BGP_STR
7085 "Summary of BGP neighbor status\n")
7086{
7087 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
7088}
7089
7090DEFUN (show_ip_bgp_instance_summary,
7091 show_ip_bgp_instance_summary_cmd,
7092 "show ip bgp view WORD summary",
7093 SHOW_STR
7094 IP_STR
7095 BGP_STR
7096 "BGP view\n"
7097 "View name\n"
7098 "Summary of BGP neighbor status\n")
7099{
7100 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
7101}
7102
7103DEFUN (show_ip_bgp_ipv4_summary,
7104 show_ip_bgp_ipv4_summary_cmd,
7105 "show ip bgp ipv4 (unicast|multicast) summary",
7106 SHOW_STR
7107 IP_STR
7108 BGP_STR
7109 "Address family\n"
7110 "Address Family modifier\n"
7111 "Address Family modifier\n"
7112 "Summary of BGP neighbor status\n")
7113{
7114 if (strncmp (argv[0], "m", 1) == 0)
7115 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
7116
7117 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
7118}
7119
Michael Lambert95cbbd22010-07-23 14:43:04 -04007120ALIAS (show_ip_bgp_ipv4_summary,
7121 show_bgp_ipv4_safi_summary_cmd,
7122 "show bgp ipv4 (unicast|multicast) summary",
7123 SHOW_STR
7124 BGP_STR
7125 "Address family\n"
7126 "Address Family modifier\n"
7127 "Address Family modifier\n"
7128 "Summary of BGP neighbor status\n")
7129
paul718e3742002-12-13 20:15:29 +00007130DEFUN (show_ip_bgp_instance_ipv4_summary,
7131 show_ip_bgp_instance_ipv4_summary_cmd,
7132 "show ip bgp view WORD ipv4 (unicast|multicast) summary",
7133 SHOW_STR
7134 IP_STR
7135 BGP_STR
7136 "BGP view\n"
7137 "View name\n"
7138 "Address family\n"
7139 "Address Family modifier\n"
7140 "Address Family modifier\n"
7141 "Summary of BGP neighbor status\n")
7142{
7143 if (strncmp (argv[1], "m", 1) == 0)
7144 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
7145 else
7146 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
7147}
7148
Michael Lambert95cbbd22010-07-23 14:43:04 -04007149ALIAS (show_ip_bgp_instance_ipv4_summary,
7150 show_bgp_instance_ipv4_safi_summary_cmd,
7151 "show bgp view WORD ipv4 (unicast|multicast) summary",
7152 SHOW_STR
7153 BGP_STR
7154 "BGP view\n"
7155 "View name\n"
7156 "Address family\n"
7157 "Address Family modifier\n"
7158 "Address Family modifier\n"
7159 "Summary of BGP neighbor status\n")
7160
paul718e3742002-12-13 20:15:29 +00007161DEFUN (show_ip_bgp_vpnv4_all_summary,
7162 show_ip_bgp_vpnv4_all_summary_cmd,
7163 "show ip bgp vpnv4 all summary",
7164 SHOW_STR
7165 IP_STR
7166 BGP_STR
7167 "Display VPNv4 NLRI specific information\n"
7168 "Display information about all VPNv4 NLRIs\n"
7169 "Summary of BGP neighbor status\n")
7170{
7171 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
7172}
7173
7174DEFUN (show_ip_bgp_vpnv4_rd_summary,
7175 show_ip_bgp_vpnv4_rd_summary_cmd,
7176 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn summary",
7177 SHOW_STR
7178 IP_STR
7179 BGP_STR
7180 "Display VPNv4 NLRI specific information\n"
7181 "Display information for a route distinguisher\n"
7182 "VPN Route Distinguisher\n"
7183 "Summary of BGP neighbor status\n")
7184{
7185 int ret;
7186 struct prefix_rd prd;
7187
7188 ret = str2prefix_rd (argv[0], &prd);
7189 if (! ret)
7190 {
7191 vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
7192 return CMD_WARNING;
7193 }
7194
7195 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN);
7196}
7197
7198#ifdef HAVE_IPV6
7199DEFUN (show_bgp_summary,
7200 show_bgp_summary_cmd,
7201 "show bgp summary",
7202 SHOW_STR
7203 BGP_STR
7204 "Summary of BGP neighbor status\n")
7205{
7206 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
7207}
7208
7209DEFUN (show_bgp_instance_summary,
7210 show_bgp_instance_summary_cmd,
7211 "show bgp view WORD summary",
7212 SHOW_STR
7213 BGP_STR
7214 "BGP view\n"
7215 "View name\n"
7216 "Summary of BGP neighbor status\n")
7217{
7218 return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
7219}
7220
7221ALIAS (show_bgp_summary,
7222 show_bgp_ipv6_summary_cmd,
7223 "show bgp ipv6 summary",
7224 SHOW_STR
7225 BGP_STR
7226 "Address family\n"
7227 "Summary of BGP neighbor status\n")
7228
7229ALIAS (show_bgp_instance_summary,
7230 show_bgp_instance_ipv6_summary_cmd,
7231 "show bgp view WORD ipv6 summary",
7232 SHOW_STR
7233 BGP_STR
7234 "BGP view\n"
7235 "View name\n"
7236 "Address family\n"
7237 "Summary of BGP neighbor status\n")
7238
Michael Lambert95cbbd22010-07-23 14:43:04 -04007239DEFUN (show_bgp_ipv6_safi_summary,
7240 show_bgp_ipv6_safi_summary_cmd,
7241 "show bgp ipv6 (unicast|multicast) summary",
7242 SHOW_STR
7243 BGP_STR
7244 "Address family\n"
7245 "Address Family modifier\n"
7246 "Address Family modifier\n"
7247 "Summary of BGP neighbor status\n")
7248{
7249 if (strncmp (argv[0], "m", 1) == 0)
7250 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
7251
7252 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
7253}
7254
7255DEFUN (show_bgp_instance_ipv6_safi_summary,
7256 show_bgp_instance_ipv6_safi_summary_cmd,
7257 "show bgp view WORD ipv6 (unicast|multicast) summary",
7258 SHOW_STR
7259 BGP_STR
7260 "BGP view\n"
7261 "View name\n"
7262 "Address family\n"
7263 "Address Family modifier\n"
7264 "Address Family modifier\n"
7265 "Summary of BGP neighbor status\n")
7266{
7267 if (strncmp (argv[1], "m", 1) == 0)
7268 return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST);
7269
7270 return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
7271}
7272
paul718e3742002-12-13 20:15:29 +00007273/* old command */
7274DEFUN (show_ipv6_bgp_summary,
7275 show_ipv6_bgp_summary_cmd,
7276 "show ipv6 bgp summary",
7277 SHOW_STR
7278 IPV6_STR
7279 BGP_STR
7280 "Summary of BGP neighbor status\n")
7281{
7282 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
7283}
7284
7285/* old command */
7286DEFUN (show_ipv6_mbgp_summary,
7287 show_ipv6_mbgp_summary_cmd,
7288 "show ipv6 mbgp summary",
7289 SHOW_STR
7290 IPV6_STR
7291 MBGP_STR
7292 "Summary of BGP neighbor status\n")
7293{
7294 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST);
7295}
7296#endif /* HAVE_IPV6 */
David Lamparter6b0655a2014-06-04 06:53:35 +02007297
paulfd79ac92004-10-13 05:06:08 +00007298const char *
hasso538621f2004-05-21 09:31:30 +00007299afi_safi_print (afi_t afi, safi_t safi)
7300{
7301 if (afi == AFI_IP && safi == SAFI_UNICAST)
7302 return "IPv4 Unicast";
7303 else if (afi == AFI_IP && safi == SAFI_MULTICAST)
7304 return "IPv4 Multicast";
7305 else if (afi == AFI_IP && safi == SAFI_MPLS_VPN)
Lou Berger9da04bc2016-01-12 13:41:55 -05007306 return "VPN-IPv4 Unicast";
hasso538621f2004-05-21 09:31:30 +00007307 else if (afi == AFI_IP6 && safi == SAFI_UNICAST)
7308 return "IPv6 Unicast";
7309 else if (afi == AFI_IP6 && safi == SAFI_MULTICAST)
7310 return "IPv6 Multicast";
Lou Berger9da04bc2016-01-12 13:41:55 -05007311 else if (afi == AFI_IP6 && safi == SAFI_MPLS_VPN)
7312 return "VPN-IPv6 Unicast";
hasso538621f2004-05-21 09:31:30 +00007313 else
7314 return "Unknown";
7315}
7316
paul718e3742002-12-13 20:15:29 +00007317/* Show BGP peer's information. */
7318enum show_type
7319{
7320 show_all,
7321 show_peer
7322};
7323
paul94f2b392005-06-28 12:44:16 +00007324static void
paul718e3742002-12-13 20:15:29 +00007325bgp_show_peer_afi_orf_cap (struct vty *vty, struct peer *p,
7326 afi_t afi, safi_t safi,
7327 u_int16_t adv_smcap, u_int16_t adv_rmcap,
7328 u_int16_t rcv_smcap, u_int16_t rcv_rmcap)
7329{
7330 /* Send-Mode */
7331 if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap)
7332 || CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap))
7333 {
7334 vty_out (vty, " Send-mode: ");
7335 if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap))
7336 vty_out (vty, "advertised");
7337 if (CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap))
7338 vty_out (vty, "%sreceived",
7339 CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) ?
7340 ", " : "");
7341 vty_out (vty, "%s", VTY_NEWLINE);
7342 }
7343
7344 /* Receive-Mode */
7345 if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap)
7346 || CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap))
7347 {
7348 vty_out (vty, " Receive-mode: ");
7349 if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap))
7350 vty_out (vty, "advertised");
7351 if (CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap))
7352 vty_out (vty, "%sreceived",
7353 CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) ?
7354 ", " : "");
7355 vty_out (vty, "%s", VTY_NEWLINE);
7356 }
7357}
7358
paul94f2b392005-06-28 12:44:16 +00007359static void
paul718e3742002-12-13 20:15:29 +00007360bgp_show_peer_afi (struct vty *vty, struct peer *p, afi_t afi, safi_t safi)
7361{
7362 struct bgp_filter *filter;
7363 char orf_pfx_name[BUFSIZ];
7364 int orf_pfx_count;
7365
7366 filter = &p->filter[afi][safi];
7367
hasso538621f2004-05-21 09:31:30 +00007368 vty_out (vty, " For address family: %s%s", afi_safi_print (afi, safi),
paul718e3742002-12-13 20:15:29 +00007369 VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00007370
paul718e3742002-12-13 20:15:29 +00007371 if (p->af_group[afi][safi])
7372 vty_out (vty, " %s peer-group member%s", p->group->name, VTY_NEWLINE);
7373
7374 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
7375 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
7376 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)
7377 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
7378 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV)
7379 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
7380 vty_out (vty, " AF-dependant capabilities:%s", VTY_NEWLINE);
7381
7382 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
7383 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
7384 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
7385 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV))
7386 {
7387 vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
7388 ORF_TYPE_PREFIX, VTY_NEWLINE);
7389 bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
7390 PEER_CAP_ORF_PREFIX_SM_ADV,
7391 PEER_CAP_ORF_PREFIX_RM_ADV,
7392 PEER_CAP_ORF_PREFIX_SM_RCV,
7393 PEER_CAP_ORF_PREFIX_RM_RCV);
7394 }
7395 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
7396 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)
7397 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
7398 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
7399 {
7400 vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
7401 ORF_TYPE_PREFIX_OLD, VTY_NEWLINE);
7402 bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
7403 PEER_CAP_ORF_PREFIX_SM_ADV,
7404 PEER_CAP_ORF_PREFIX_RM_ADV,
7405 PEER_CAP_ORF_PREFIX_SM_OLD_RCV,
7406 PEER_CAP_ORF_PREFIX_RM_OLD_RCV);
7407 }
7408
7409 sprintf (orf_pfx_name, "%s.%d.%d", p->host, afi, safi);
7410 orf_pfx_count = prefix_bgp_show_prefix_list (NULL, afi, orf_pfx_name);
7411
7412 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND)
7413 || orf_pfx_count)
7414 {
7415 vty_out (vty, " Outbound Route Filter (ORF):");
7416 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND))
7417 vty_out (vty, " sent;");
7418 if (orf_pfx_count)
7419 vty_out (vty, " received (%d entries)", orf_pfx_count);
7420 vty_out (vty, "%s", VTY_NEWLINE);
7421 }
7422 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH))
7423 vty_out (vty, " First update is deferred until ORF or ROUTE-REFRESH is received%s", VTY_NEWLINE);
7424
7425 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT))
7426 vty_out (vty, " Route-Reflector Client%s", VTY_NEWLINE);
7427 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT))
7428 vty_out (vty, " Route-Server Client%s", VTY_NEWLINE);
7429 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG))
7430 vty_out (vty, " Inbound soft reconfiguration allowed%s", VTY_NEWLINE);
7431 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS))
7432 vty_out (vty, " Private AS number removed from updates to this neighbor%s", VTY_NEWLINE);
7433 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF))
7434 vty_out (vty, " NEXT_HOP is always this router%s", VTY_NEWLINE);
7435 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED))
7436 vty_out (vty, " AS_PATH is propagated unchanged to this neighbor%s", VTY_NEWLINE);
7437 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED))
7438 vty_out (vty, " NEXT_HOP is propagated unchanged to this neighbor%s", VTY_NEWLINE);
7439 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED))
7440 vty_out (vty, " MED is propagated unchanged to this neighbor%s", VTY_NEWLINE);
7441 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
7442 || CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
7443 {
7444 vty_out (vty, " Community attribute sent to this neighbor");
7445 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
7446 && CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
hasso538621f2004-05-21 09:31:30 +00007447 vty_out (vty, "(both)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007448 else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
hasso538621f2004-05-21 09:31:30 +00007449 vty_out (vty, "(extended)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007450 else
hasso538621f2004-05-21 09:31:30 +00007451 vty_out (vty, "(standard)%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007452 }
7453 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE))
7454 {
7455 vty_out (vty, " Default information originate,");
7456
7457 if (p->default_rmap[afi][safi].name)
7458 vty_out (vty, " default route-map %s%s,",
7459 p->default_rmap[afi][safi].map ? "*" : "",
7460 p->default_rmap[afi][safi].name);
7461 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_DEFAULT_ORIGINATE))
7462 vty_out (vty, " default sent%s", VTY_NEWLINE);
7463 else
7464 vty_out (vty, " default not sent%s", VTY_NEWLINE);
7465 }
7466
7467 if (filter->plist[FILTER_IN].name
7468 || filter->dlist[FILTER_IN].name
7469 || filter->aslist[FILTER_IN].name
paulfee0f4c2004-09-13 05:12:46 +00007470 || filter->map[RMAP_IN].name)
paul718e3742002-12-13 20:15:29 +00007471 vty_out (vty, " Inbound path policy configured%s", VTY_NEWLINE);
7472 if (filter->plist[FILTER_OUT].name
7473 || filter->dlist[FILTER_OUT].name
7474 || filter->aslist[FILTER_OUT].name
paulfee0f4c2004-09-13 05:12:46 +00007475 || filter->map[RMAP_OUT].name
paul718e3742002-12-13 20:15:29 +00007476 || filter->usmap.name)
7477 vty_out (vty, " Outbound path policy configured%s", VTY_NEWLINE);
paulfee0f4c2004-09-13 05:12:46 +00007478 if (filter->map[RMAP_IMPORT].name)
7479 vty_out (vty, " Import policy for this RS-client configured%s", VTY_NEWLINE);
7480 if (filter->map[RMAP_EXPORT].name)
7481 vty_out (vty, " Export policy for this RS-client configured%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007482
7483 /* prefix-list */
7484 if (filter->plist[FILTER_IN].name)
7485 vty_out (vty, " Incoming update prefix filter list is %s%s%s",
7486 filter->plist[FILTER_IN].plist ? "*" : "",
7487 filter->plist[FILTER_IN].name,
7488 VTY_NEWLINE);
7489 if (filter->plist[FILTER_OUT].name)
7490 vty_out (vty, " Outgoing update prefix filter list is %s%s%s",
7491 filter->plist[FILTER_OUT].plist ? "*" : "",
7492 filter->plist[FILTER_OUT].name,
7493 VTY_NEWLINE);
7494
7495 /* distribute-list */
7496 if (filter->dlist[FILTER_IN].name)
7497 vty_out (vty, " Incoming update network filter list is %s%s%s",
7498 filter->dlist[FILTER_IN].alist ? "*" : "",
7499 filter->dlist[FILTER_IN].name,
7500 VTY_NEWLINE);
7501 if (filter->dlist[FILTER_OUT].name)
7502 vty_out (vty, " Outgoing update network filter list is %s%s%s",
7503 filter->dlist[FILTER_OUT].alist ? "*" : "",
7504 filter->dlist[FILTER_OUT].name,
7505 VTY_NEWLINE);
7506
7507 /* filter-list. */
7508 if (filter->aslist[FILTER_IN].name)
7509 vty_out (vty, " Incoming update AS path filter list is %s%s%s",
7510 filter->aslist[FILTER_IN].aslist ? "*" : "",
7511 filter->aslist[FILTER_IN].name,
7512 VTY_NEWLINE);
7513 if (filter->aslist[FILTER_OUT].name)
7514 vty_out (vty, " Outgoing update AS path filter list is %s%s%s",
7515 filter->aslist[FILTER_OUT].aslist ? "*" : "",
7516 filter->aslist[FILTER_OUT].name,
7517 VTY_NEWLINE);
7518
7519 /* route-map. */
paulfee0f4c2004-09-13 05:12:46 +00007520 if (filter->map[RMAP_IN].name)
paul718e3742002-12-13 20:15:29 +00007521 vty_out (vty, " Route map for incoming advertisements is %s%s%s",
paulfee0f4c2004-09-13 05:12:46 +00007522 filter->map[RMAP_IN].map ? "*" : "",
7523 filter->map[RMAP_IN].name,
paul718e3742002-12-13 20:15:29 +00007524 VTY_NEWLINE);
paulfee0f4c2004-09-13 05:12:46 +00007525 if (filter->map[RMAP_OUT].name)
paul718e3742002-12-13 20:15:29 +00007526 vty_out (vty, " Route map for outgoing advertisements is %s%s%s",
paulfee0f4c2004-09-13 05:12:46 +00007527 filter->map[RMAP_OUT].map ? "*" : "",
7528 filter->map[RMAP_OUT].name,
7529 VTY_NEWLINE);
7530 if (filter->map[RMAP_IMPORT].name)
7531 vty_out (vty, " Route map for advertisements going into this RS-client's table is %s%s%s",
7532 filter->map[RMAP_IMPORT].map ? "*" : "",
7533 filter->map[RMAP_IMPORT].name,
7534 VTY_NEWLINE);
7535 if (filter->map[RMAP_EXPORT].name)
7536 vty_out (vty, " Route map for advertisements coming from this RS-client is %s%s%s",
7537 filter->map[RMAP_EXPORT].map ? "*" : "",
7538 filter->map[RMAP_EXPORT].name,
paul718e3742002-12-13 20:15:29 +00007539 VTY_NEWLINE);
7540
7541 /* unsuppress-map */
7542 if (filter->usmap.name)
7543 vty_out (vty, " Route map for selective unsuppress is %s%s%s",
7544 filter->usmap.map ? "*" : "",
7545 filter->usmap.name, VTY_NEWLINE);
7546
7547 /* Receive prefix count */
hassoe0701b72004-05-20 09:19:34 +00007548 vty_out (vty, " %ld accepted prefixes%s", p->pcount[afi][safi], VTY_NEWLINE);
7549
paul718e3742002-12-13 20:15:29 +00007550 /* Maximum prefix */
7551 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX))
7552 {
hasso0a486e52005-02-01 20:57:17 +00007553 vty_out (vty, " Maximum prefixes allowed %ld%s%s", p->pmax[afi][safi],
paul718e3742002-12-13 20:15:29 +00007554 CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING)
hasso0a486e52005-02-01 20:57:17 +00007555 ? " (warning-only)" : "", VTY_NEWLINE);
7556 vty_out (vty, " Threshold for warning message %d%%",
7557 p->pmax_threshold[afi][safi]);
7558 if (p->pmax_restart[afi][safi])
7559 vty_out (vty, ", restart interval %d min", p->pmax_restart[afi][safi]);
7560 vty_out (vty, "%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007561 }
paul718e3742002-12-13 20:15:29 +00007562
7563 vty_out (vty, "%s", VTY_NEWLINE);
7564}
7565
paul94f2b392005-06-28 12:44:16 +00007566static void
paul718e3742002-12-13 20:15:29 +00007567bgp_show_peer (struct vty *vty, struct peer *p)
7568{
7569 struct bgp *bgp;
7570 char buf1[BUFSIZ];
7571 char timebuf[BGP_UPTIME_LEN];
hasso538621f2004-05-21 09:31:30 +00007572 afi_t afi;
7573 safi_t safi;
paul718e3742002-12-13 20:15:29 +00007574
7575 bgp = p->bgp;
7576
7577 /* Configured IP address. */
7578 vty_out (vty, "BGP neighbor is %s, ", p->host);
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04007579 vty_out (vty, "remote AS %u, ", p->as);
Andrew Certain9d3f9702012-11-07 23:50:07 +00007580 vty_out (vty, "local AS %u%s%s, ",
paul718e3742002-12-13 20:15:29 +00007581 p->change_local_as ? p->change_local_as : p->local_as,
7582 CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND) ?
Andrew Certain9d3f9702012-11-07 23:50:07 +00007583 " no-prepend" : "",
7584 CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_REPLACE_AS) ?
7585 " replace-as" : "");
paul718e3742002-12-13 20:15:29 +00007586 vty_out (vty, "%s link%s",
7587 p->as == p->local_as ? "internal" : "external",
7588 VTY_NEWLINE);
7589
7590 /* Description. */
7591 if (p->desc)
7592 vty_out (vty, " Description: %s%s", p->desc, VTY_NEWLINE);
7593
7594 /* Peer-group */
7595 if (p->group)
7596 vty_out (vty, " Member of peer-group %s for session parameters%s",
7597 p->group->name, VTY_NEWLINE);
7598
7599 /* Administrative shutdown. */
7600 if (CHECK_FLAG (p->flags, PEER_FLAG_SHUTDOWN))
7601 vty_out (vty, " Administratively shut down%s", VTY_NEWLINE);
7602
7603 /* BGP Version. */
7604 vty_out (vty, " BGP version 4");
paul718e3742002-12-13 20:15:29 +00007605 vty_out (vty, ", remote router ID %s%s",
7606 inet_ntop (AF_INET, &p->remote_id, buf1, BUFSIZ),
7607 VTY_NEWLINE);
7608
7609 /* Confederation */
hassoe0701b72004-05-20 09:19:34 +00007610 if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION)
7611 && bgp_confederation_peers_check (bgp, p->as))
paul718e3742002-12-13 20:15:29 +00007612 vty_out (vty, " Neighbor under common administration%s", VTY_NEWLINE);
7613
7614 /* Status. */
7615 vty_out (vty, " BGP state = %s",
7616 LOOKUP (bgp_status_msg, p->status));
7617 if (p->status == Established)
7618 vty_out (vty, ", up for %8s",
7619 peer_uptime (p->uptime, timebuf, BGP_UPTIME_LEN));
hasso93406d82005-02-02 14:40:33 +00007620 else if (p->status == Active)
7621 {
7622 if (CHECK_FLAG (p->flags, PEER_FLAG_PASSIVE))
7623 vty_out (vty, " (passive)");
7624 else if (CHECK_FLAG (p->sflags, PEER_STATUS_NSF_WAIT))
7625 vty_out (vty, " (NSF passive)");
7626 }
paul718e3742002-12-13 20:15:29 +00007627 vty_out (vty, "%s", VTY_NEWLINE);
7628
7629 /* read timer */
7630 vty_out (vty, " Last read %s", peer_uptime (p->readtime, timebuf, BGP_UPTIME_LEN));
7631
7632 /* Configured timer values. */
7633 vty_out (vty, ", hold time is %d, keepalive interval is %d seconds%s",
7634 p->v_holdtime, p->v_keepalive, VTY_NEWLINE);
7635 if (CHECK_FLAG (p->config, PEER_CONFIG_TIMER))
7636 {
7637 vty_out (vty, " Configured hold time is %d", p->holdtime);
7638 vty_out (vty, ", keepalive interval is %d seconds%s",
7639 p->keepalive, VTY_NEWLINE);
7640 }
hasso93406d82005-02-02 14:40:33 +00007641
paul718e3742002-12-13 20:15:29 +00007642 /* Capability. */
7643 if (p->status == Established)
7644 {
hasso538621f2004-05-21 09:31:30 +00007645 if (p->cap
paul718e3742002-12-13 20:15:29 +00007646 || p->afc_adv[AFI_IP][SAFI_UNICAST]
7647 || p->afc_recv[AFI_IP][SAFI_UNICAST]
7648 || p->afc_adv[AFI_IP][SAFI_MULTICAST]
7649 || p->afc_recv[AFI_IP][SAFI_MULTICAST]
7650#ifdef HAVE_IPV6
7651 || p->afc_adv[AFI_IP6][SAFI_UNICAST]
7652 || p->afc_recv[AFI_IP6][SAFI_UNICAST]
7653 || p->afc_adv[AFI_IP6][SAFI_MULTICAST]
7654 || p->afc_recv[AFI_IP6][SAFI_MULTICAST]
Lou Berger9da04bc2016-01-12 13:41:55 -05007655 || p->afc_adv[AFI_IP6][SAFI_MPLS_VPN]
7656 || p->afc_recv[AFI_IP6][SAFI_MPLS_VPN]
paul718e3742002-12-13 20:15:29 +00007657#endif /* HAVE_IPV6 */
7658 || p->afc_adv[AFI_IP][SAFI_MPLS_VPN]
7659 || p->afc_recv[AFI_IP][SAFI_MPLS_VPN])
7660 {
7661 vty_out (vty, " Neighbor capabilities:%s", VTY_NEWLINE);
7662
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00007663 /* AS4 */
7664 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV)
7665 || CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV))
7666 {
7667 vty_out (vty, " 4 Byte AS:");
7668 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV))
7669 vty_out (vty, " advertised");
7670 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV))
7671 vty_out (vty, " %sreceived",
7672 CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV) ? "and " : "");
7673 vty_out (vty, "%s", VTY_NEWLINE);
7674 }
paul718e3742002-12-13 20:15:29 +00007675 /* Dynamic */
7676 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)
7677 || CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV))
7678 {
7679 vty_out (vty, " Dynamic:");
7680 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV))
7681 vty_out (vty, " advertised");
7682 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV))
hasso538621f2004-05-21 09:31:30 +00007683 vty_out (vty, " %sreceived",
7684 CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV) ? "and " : "");
paul718e3742002-12-13 20:15:29 +00007685 vty_out (vty, "%s", VTY_NEWLINE);
7686 }
7687
7688 /* Route Refresh */
7689 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV)
7690 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)
7691 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
7692 {
7693 vty_out (vty, " Route refresh:");
7694 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV))
7695 vty_out (vty, " advertised");
7696 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)
7697 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
hasso538621f2004-05-21 09:31:30 +00007698 vty_out (vty, " %sreceived(%s)",
7699 CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) ? "and " : "",
7700 (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)
7701 && CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)) ?
7702 "old & new" : CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) ? "old" : "new");
7703
paul718e3742002-12-13 20:15:29 +00007704 vty_out (vty, "%s", VTY_NEWLINE);
7705 }
7706
hasso538621f2004-05-21 09:31:30 +00007707 /* Multiprotocol Extensions */
7708 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
7709 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
7710 if (p->afc_adv[afi][safi] || p->afc_recv[afi][safi])
paul718e3742002-12-13 20:15:29 +00007711 {
hasso538621f2004-05-21 09:31:30 +00007712 vty_out (vty, " Address family %s:", afi_safi_print (afi, safi));
7713 if (p->afc_adv[afi][safi])
7714 vty_out (vty, " advertised");
7715 if (p->afc_recv[afi][safi])
7716 vty_out (vty, " %sreceived", p->afc_adv[afi][safi] ? "and " : "");
7717 vty_out (vty, "%s", VTY_NEWLINE);
7718 }
7719
7720 /* Gracefull Restart */
7721 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)
7722 || CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
paul718e3742002-12-13 20:15:29 +00007723 {
hasso538621f2004-05-21 09:31:30 +00007724 vty_out (vty, " Graceful Restart Capabilty:");
7725 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
paul718e3742002-12-13 20:15:29 +00007726 vty_out (vty, " advertised");
hasso538621f2004-05-21 09:31:30 +00007727 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
7728 vty_out (vty, " %sreceived",
7729 CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV) ? "and " : "");
paul718e3742002-12-13 20:15:29 +00007730 vty_out (vty, "%s", VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00007731
7732 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
paul718e3742002-12-13 20:15:29 +00007733 {
hasso538621f2004-05-21 09:31:30 +00007734 int restart_af_count = 0;
7735
7736 vty_out (vty, " Remote Restart timer is %d seconds%s",
hasso93406d82005-02-02 14:40:33 +00007737 p->v_gr_restart, VTY_NEWLINE);
7738 vty_out (vty, " Address families by peer:%s ", VTY_NEWLINE);
hasso538621f2004-05-21 09:31:30 +00007739
7740 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
7741 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
7742 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_RCV))
7743 {
hasso93406d82005-02-02 14:40:33 +00007744 vty_out (vty, "%s%s(%s)", restart_af_count ? ", " : "",
7745 afi_safi_print (afi, safi),
7746 CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_PRESERVE_RCV) ?
7747 "preserved" : "not preserved");
hasso538621f2004-05-21 09:31:30 +00007748 restart_af_count++;
hasso93406d82005-02-02 14:40:33 +00007749 }
hasso538621f2004-05-21 09:31:30 +00007750 if (! restart_af_count)
7751 vty_out (vty, "none");
7752 vty_out (vty, "%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007753 }
paul718e3742002-12-13 20:15:29 +00007754 }
paul718e3742002-12-13 20:15:29 +00007755 }
7756 }
7757
hasso93406d82005-02-02 14:40:33 +00007758 /* graceful restart information */
7759 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)
7760 || p->t_gr_restart
7761 || p->t_gr_stale)
7762 {
7763 int eor_send_af_count = 0;
7764 int eor_receive_af_count = 0;
7765
7766 vty_out (vty, " Graceful restart informations:%s", VTY_NEWLINE);
7767 if (p->status == Established)
7768 {
7769 vty_out (vty, " End-of-RIB send: ");
7770 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
7771 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
7772 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_SEND))
7773 {
7774 vty_out (vty, "%s%s", eor_send_af_count ? ", " : "",
7775 afi_safi_print (afi, safi));
7776 eor_send_af_count++;
7777 }
7778 vty_out (vty, "%s", VTY_NEWLINE);
7779
7780 vty_out (vty, " End-of-RIB received: ");
7781 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
7782 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
7783 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_RECEIVED))
7784 {
7785 vty_out (vty, "%s%s", eor_receive_af_count ? ", " : "",
7786 afi_safi_print (afi, safi));
7787 eor_receive_af_count++;
7788 }
7789 vty_out (vty, "%s", VTY_NEWLINE);
7790 }
7791
7792 if (p->t_gr_restart)
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00007793 vty_out (vty, " The remaining time of restart timer is %ld%s",
7794 thread_timer_remain_second (p->t_gr_restart), VTY_NEWLINE);
7795
hasso93406d82005-02-02 14:40:33 +00007796 if (p->t_gr_stale)
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00007797 vty_out (vty, " The remaining time of stalepath timer is %ld%s",
7798 thread_timer_remain_second (p->t_gr_stale), VTY_NEWLINE);
hasso93406d82005-02-02 14:40:33 +00007799 }
7800
paul718e3742002-12-13 20:15:29 +00007801 /* Packet counts. */
hasso93406d82005-02-02 14:40:33 +00007802 vty_out (vty, " Message statistics:%s", VTY_NEWLINE);
7803 vty_out (vty, " Inq depth is 0%s", VTY_NEWLINE);
Paul Jakma0b2aa3a2007-10-14 22:32:21 +00007804 vty_out (vty, " Outq depth is %lu%s", (unsigned long) p->obuf->count, VTY_NEWLINE);
hasso93406d82005-02-02 14:40:33 +00007805 vty_out (vty, " Sent Rcvd%s", VTY_NEWLINE);
7806 vty_out (vty, " Opens: %10d %10d%s", p->open_out, p->open_in, VTY_NEWLINE);
7807 vty_out (vty, " Notifications: %10d %10d%s", p->notify_out, p->notify_in, VTY_NEWLINE);
7808 vty_out (vty, " Updates: %10d %10d%s", p->update_out, p->update_in, VTY_NEWLINE);
7809 vty_out (vty, " Keepalives: %10d %10d%s", p->keepalive_out, p->keepalive_in, VTY_NEWLINE);
7810 vty_out (vty, " Route Refresh: %10d %10d%s", p->refresh_out, p->refresh_in, VTY_NEWLINE);
7811 vty_out (vty, " Capability: %10d %10d%s", p->dynamic_cap_out, p->dynamic_cap_in, VTY_NEWLINE);
7812 vty_out (vty, " Total: %10d %10d%s", p->open_out + p->notify_out +
7813 p->update_out + p->keepalive_out + p->refresh_out + p->dynamic_cap_out,
7814 p->open_in + p->notify_in + p->update_in + p->keepalive_in + p->refresh_in +
7815 p->dynamic_cap_in, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007816
7817 /* advertisement-interval */
7818 vty_out (vty, " Minimum time between advertisement runs is %d seconds%s",
7819 p->v_routeadv, VTY_NEWLINE);
7820
7821 /* Update-source. */
7822 if (p->update_if || p->update_source)
7823 {
7824 vty_out (vty, " Update source is ");
7825 if (p->update_if)
7826 vty_out (vty, "%s", p->update_if);
7827 else if (p->update_source)
7828 vty_out (vty, "%s",
7829 sockunion2str (p->update_source, buf1, SU_ADDRSTRLEN));
7830 vty_out (vty, "%s", VTY_NEWLINE);
7831 }
7832
7833 /* Default weight */
7834 if (CHECK_FLAG (p->config, PEER_CONFIG_WEIGHT))
7835 vty_out (vty, " Default weight %d%s", p->weight,
7836 VTY_NEWLINE);
7837
7838 vty_out (vty, "%s", VTY_NEWLINE);
7839
7840 /* Address Family Information */
hasso538621f2004-05-21 09:31:30 +00007841 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
7842 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
7843 if (p->afc[afi][safi])
7844 bgp_show_peer_afi (vty, p, afi, safi);
paul718e3742002-12-13 20:15:29 +00007845
7846 vty_out (vty, " Connections established %d; dropped %d%s",
7847 p->established, p->dropped,
7848 VTY_NEWLINE);
7849
hassoe0701b72004-05-20 09:19:34 +00007850 if (! p->dropped)
7851 vty_out (vty, " Last reset never%s", VTY_NEWLINE);
7852 else
7853 vty_out (vty, " Last reset %s, due to %s%s",
7854 peer_uptime (p->resettime, timebuf, BGP_UPTIME_LEN),
7855 peer_down_str[(int) p->last_reset], VTY_NEWLINE);
paul848973c2003-08-13 00:32:49 +00007856
paul718e3742002-12-13 20:15:29 +00007857 if (CHECK_FLAG (p->sflags, PEER_STATUS_PREFIX_OVERFLOW))
7858 {
7859 vty_out (vty, " Peer had exceeded the max. no. of prefixes configured.%s", VTY_NEWLINE);
hasso0a486e52005-02-01 20:57:17 +00007860
7861 if (p->t_pmax_restart)
7862 vty_out (vty, " Reduce the no. of prefix from %s, will restart in %ld seconds%s",
7863 p->host, thread_timer_remain_second (p->t_pmax_restart),
7864 VTY_NEWLINE);
7865 else
7866 vty_out (vty, " Reduce the no. of prefix and clear ip bgp %s to restore peering%s",
7867 p->host, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007868 }
7869
Stephen Hemmingerf5a48272011-03-24 17:30:21 +00007870 /* EBGP Multihop and GTSM */
Jorge Boncompte [DTI2]6d85b152012-05-07 16:52:54 +00007871 if (p->sort != BGP_PEER_IBGP)
Stephen Hemmingerf5a48272011-03-24 17:30:21 +00007872 {
7873 if (p->gtsm_hops > 0)
7874 vty_out (vty, " External BGP neighbor may be up to %d hops away.%s",
7875 p->gtsm_hops, VTY_NEWLINE);
7876 else if (p->ttl > 1)
7877 vty_out (vty, " External BGP neighbor may be up to %d hops away.%s",
7878 p->ttl, VTY_NEWLINE);
7879 }
Pradosh Mohapatra5d804b42013-09-12 03:37:07 +00007880 else
7881 {
7882 if (p->gtsm_hops > 0)
7883 vty_out (vty, " Internal BGP neighbor may be up to %d hops away.%s",
7884 p->gtsm_hops, VTY_NEWLINE);
7885 }
paul718e3742002-12-13 20:15:29 +00007886
7887 /* Local address. */
7888 if (p->su_local)
7889 {
hasso93406d82005-02-02 14:40:33 +00007890 vty_out (vty, "Local host: %s, Local port: %d%s",
paul718e3742002-12-13 20:15:29 +00007891 sockunion2str (p->su_local, buf1, SU_ADDRSTRLEN),
7892 ntohs (p->su_local->sin.sin_port),
paul718e3742002-12-13 20:15:29 +00007893 VTY_NEWLINE);
7894 }
7895
7896 /* Remote address. */
7897 if (p->su_remote)
7898 {
7899 vty_out (vty, "Foreign host: %s, Foreign port: %d%s",
7900 sockunion2str (p->su_remote, buf1, SU_ADDRSTRLEN),
7901 ntohs (p->su_remote->sin.sin_port),
7902 VTY_NEWLINE);
7903 }
7904
7905 /* Nexthop display. */
7906 if (p->su_local)
7907 {
7908 vty_out (vty, "Nexthop: %s%s",
7909 inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ),
7910 VTY_NEWLINE);
7911#ifdef HAVE_IPV6
7912 vty_out (vty, "Nexthop global: %s%s",
7913 inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ),
7914 VTY_NEWLINE);
7915 vty_out (vty, "Nexthop local: %s%s",
7916 inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ),
7917 VTY_NEWLINE);
7918 vty_out (vty, "BGP connection: %s%s",
7919 p->shared_network ? "shared network" : "non shared network",
7920 VTY_NEWLINE);
7921#endif /* HAVE_IPV6 */
7922 }
7923
Timo Teräsef757702015-04-29 09:43:04 +03007924 /* TCP metrics. */
7925 if (p->status == Established && p->rtt)
7926 vty_out (vty, "Estimated round trip time: %d ms%s",
7927 p->rtt, VTY_NEWLINE);
7928
paul718e3742002-12-13 20:15:29 +00007929 /* Timer information. */
7930 if (p->t_start)
7931 vty_out (vty, "Next start timer due in %ld seconds%s",
7932 thread_timer_remain_second (p->t_start), VTY_NEWLINE);
7933 if (p->t_connect)
7934 vty_out (vty, "Next connect timer due in %ld seconds%s",
7935 thread_timer_remain_second (p->t_connect), VTY_NEWLINE);
7936
7937 vty_out (vty, "Read thread: %s Write thread: %s%s",
7938 p->t_read ? "on" : "off",
7939 p->t_write ? "on" : "off",
7940 VTY_NEWLINE);
7941
7942 if (p->notify.code == BGP_NOTIFY_OPEN_ERR
7943 && p->notify.subcode == BGP_NOTIFY_OPEN_UNSUP_CAPBL)
7944 bgp_capability_vty_out (vty, p);
7945
7946 vty_out (vty, "%s", VTY_NEWLINE);
7947}
7948
paul94f2b392005-06-28 12:44:16 +00007949static int
paul718e3742002-12-13 20:15:29 +00007950bgp_show_neighbor (struct vty *vty, struct bgp *bgp,
7951 enum show_type type, union sockunion *su)
7952{
paul1eb8ef22005-04-07 07:30:20 +00007953 struct listnode *node, *nnode;
paul718e3742002-12-13 20:15:29 +00007954 struct peer *peer;
7955 int find = 0;
7956
paul1eb8ef22005-04-07 07:30:20 +00007957 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
paul718e3742002-12-13 20:15:29 +00007958 {
7959 switch (type)
7960 {
7961 case show_all:
7962 bgp_show_peer (vty, peer);
7963 break;
7964 case show_peer:
7965 if (sockunion_same (&peer->su, su))
7966 {
7967 find = 1;
7968 bgp_show_peer (vty, peer);
7969 }
7970 break;
7971 }
7972 }
7973
7974 if (type == show_peer && ! find)
7975 vty_out (vty, "%% No such neighbor%s", VTY_NEWLINE);
7976
7977 return CMD_SUCCESS;
7978}
7979
paul94f2b392005-06-28 12:44:16 +00007980static int
paulfd79ac92004-10-13 05:06:08 +00007981bgp_show_neighbor_vty (struct vty *vty, const char *name,
7982 enum show_type type, const char *ip_str)
paul718e3742002-12-13 20:15:29 +00007983{
7984 int ret;
7985 struct bgp *bgp;
7986 union sockunion su;
7987
7988 if (ip_str)
7989 {
7990 ret = str2sockunion (ip_str, &su);
7991 if (ret < 0)
7992 {
7993 vty_out (vty, "%% Malformed address: %s%s", ip_str, VTY_NEWLINE);
7994 return CMD_WARNING;
7995 }
7996 }
7997
7998 if (name)
7999 {
8000 bgp = bgp_lookup_by_name (name);
8001
8002 if (! bgp)
8003 {
8004 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
8005 return CMD_WARNING;
8006 }
8007
8008 bgp_show_neighbor (vty, bgp, type, &su);
8009
8010 return CMD_SUCCESS;
8011 }
8012
8013 bgp = bgp_get_default ();
8014
8015 if (bgp)
8016 bgp_show_neighbor (vty, bgp, type, &su);
8017
8018 return CMD_SUCCESS;
8019}
8020
8021/* "show ip bgp neighbors" commands. */
8022DEFUN (show_ip_bgp_neighbors,
8023 show_ip_bgp_neighbors_cmd,
8024 "show ip bgp neighbors",
8025 SHOW_STR
8026 IP_STR
8027 BGP_STR
8028 "Detailed information on TCP and BGP neighbor connections\n")
8029{
8030 return bgp_show_neighbor_vty (vty, NULL, show_all, NULL);
8031}
8032
8033ALIAS (show_ip_bgp_neighbors,
8034 show_ip_bgp_ipv4_neighbors_cmd,
8035 "show ip bgp ipv4 (unicast|multicast) neighbors",
8036 SHOW_STR
8037 IP_STR
8038 BGP_STR
8039 "Address family\n"
8040 "Address Family modifier\n"
8041 "Address Family modifier\n"
8042 "Detailed information on TCP and BGP neighbor connections\n")
8043
8044ALIAS (show_ip_bgp_neighbors,
8045 show_ip_bgp_vpnv4_all_neighbors_cmd,
8046 "show ip bgp vpnv4 all neighbors",
8047 SHOW_STR
8048 IP_STR
8049 BGP_STR
8050 "Display VPNv4 NLRI specific information\n"
8051 "Display information about all VPNv4 NLRIs\n"
8052 "Detailed information on TCP and BGP neighbor connections\n")
8053
8054ALIAS (show_ip_bgp_neighbors,
8055 show_ip_bgp_vpnv4_rd_neighbors_cmd,
8056 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors",
8057 SHOW_STR
8058 IP_STR
8059 BGP_STR
8060 "Display VPNv4 NLRI specific information\n"
8061 "Display information for a route distinguisher\n"
8062 "VPN Route Distinguisher\n"
8063 "Detailed information on TCP and BGP neighbor connections\n")
8064
8065ALIAS (show_ip_bgp_neighbors,
8066 show_bgp_neighbors_cmd,
8067 "show bgp neighbors",
8068 SHOW_STR
8069 BGP_STR
8070 "Detailed information on TCP and BGP neighbor connections\n")
8071
8072ALIAS (show_ip_bgp_neighbors,
8073 show_bgp_ipv6_neighbors_cmd,
8074 "show bgp ipv6 neighbors",
8075 SHOW_STR
8076 BGP_STR
8077 "Address family\n"
8078 "Detailed information on TCP and BGP neighbor connections\n")
8079
8080DEFUN (show_ip_bgp_neighbors_peer,
8081 show_ip_bgp_neighbors_peer_cmd,
8082 "show ip bgp neighbors (A.B.C.D|X:X::X:X)",
8083 SHOW_STR
8084 IP_STR
8085 BGP_STR
8086 "Detailed information on TCP and BGP neighbor connections\n"
8087 "Neighbor to display information about\n"
8088 "Neighbor to display information about\n")
8089{
8090 return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 1]);
8091}
8092
8093ALIAS (show_ip_bgp_neighbors_peer,
8094 show_ip_bgp_ipv4_neighbors_peer_cmd,
8095 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X)",
8096 SHOW_STR
8097 IP_STR
8098 BGP_STR
8099 "Address family\n"
8100 "Address Family modifier\n"
8101 "Address Family modifier\n"
8102 "Detailed information on TCP and BGP neighbor connections\n"
8103 "Neighbor to display information about\n"
8104 "Neighbor to display information about\n")
8105
8106ALIAS (show_ip_bgp_neighbors_peer,
8107 show_ip_bgp_vpnv4_all_neighbors_peer_cmd,
8108 "show ip bgp vpnv4 all neighbors A.B.C.D",
8109 SHOW_STR
8110 IP_STR
8111 BGP_STR
8112 "Display VPNv4 NLRI specific information\n"
8113 "Display information about all VPNv4 NLRIs\n"
8114 "Detailed information on TCP and BGP neighbor connections\n"
8115 "Neighbor to display information about\n")
8116
8117ALIAS (show_ip_bgp_neighbors_peer,
8118 show_ip_bgp_vpnv4_rd_neighbors_peer_cmd,
8119 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D",
8120 SHOW_STR
8121 IP_STR
8122 BGP_STR
8123 "Display VPNv4 NLRI specific information\n"
8124 "Display information about all VPNv4 NLRIs\n"
8125 "Detailed information on TCP and BGP neighbor connections\n"
8126 "Neighbor to display information about\n")
8127
8128ALIAS (show_ip_bgp_neighbors_peer,
8129 show_bgp_neighbors_peer_cmd,
8130 "show bgp neighbors (A.B.C.D|X:X::X:X)",
8131 SHOW_STR
8132 BGP_STR
8133 "Detailed information on TCP and BGP neighbor connections\n"
8134 "Neighbor to display information about\n"
8135 "Neighbor to display information about\n")
8136
8137ALIAS (show_ip_bgp_neighbors_peer,
8138 show_bgp_ipv6_neighbors_peer_cmd,
8139 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X)",
8140 SHOW_STR
8141 BGP_STR
8142 "Address family\n"
8143 "Detailed information on TCP and BGP neighbor connections\n"
8144 "Neighbor to display information about\n"
8145 "Neighbor to display information about\n")
8146
8147DEFUN (show_ip_bgp_instance_neighbors,
8148 show_ip_bgp_instance_neighbors_cmd,
8149 "show ip bgp view WORD neighbors",
8150 SHOW_STR
8151 IP_STR
8152 BGP_STR
8153 "BGP view\n"
8154 "View name\n"
8155 "Detailed information on TCP and BGP neighbor connections\n")
8156{
8157 return bgp_show_neighbor_vty (vty, argv[0], show_all, NULL);
8158}
8159
paulbb46e942003-10-24 19:02:03 +00008160ALIAS (show_ip_bgp_instance_neighbors,
8161 show_bgp_instance_neighbors_cmd,
8162 "show bgp view WORD neighbors",
8163 SHOW_STR
8164 BGP_STR
8165 "BGP view\n"
8166 "View name\n"
8167 "Detailed information on TCP and BGP neighbor connections\n")
8168
8169ALIAS (show_ip_bgp_instance_neighbors,
8170 show_bgp_instance_ipv6_neighbors_cmd,
8171 "show bgp view WORD ipv6 neighbors",
8172 SHOW_STR
8173 BGP_STR
8174 "BGP view\n"
8175 "View name\n"
8176 "Address family\n"
8177 "Detailed information on TCP and BGP neighbor connections\n")
8178
paul718e3742002-12-13 20:15:29 +00008179DEFUN (show_ip_bgp_instance_neighbors_peer,
8180 show_ip_bgp_instance_neighbors_peer_cmd,
8181 "show ip bgp view WORD neighbors (A.B.C.D|X:X::X:X)",
8182 SHOW_STR
8183 IP_STR
8184 BGP_STR
8185 "BGP view\n"
8186 "View name\n"
8187 "Detailed information on TCP and BGP neighbor connections\n"
8188 "Neighbor to display information about\n"
8189 "Neighbor to display information about\n")
8190{
8191 return bgp_show_neighbor_vty (vty, argv[0], show_peer, argv[1]);
8192}
paulbb46e942003-10-24 19:02:03 +00008193
8194ALIAS (show_ip_bgp_instance_neighbors_peer,
8195 show_bgp_instance_neighbors_peer_cmd,
8196 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X)",
8197 SHOW_STR
8198 BGP_STR
8199 "BGP view\n"
8200 "View name\n"
8201 "Detailed information on TCP and BGP neighbor connections\n"
8202 "Neighbor to display information about\n"
8203 "Neighbor to display information about\n")
8204
8205ALIAS (show_ip_bgp_instance_neighbors_peer,
8206 show_bgp_instance_ipv6_neighbors_peer_cmd,
8207 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X)",
8208 SHOW_STR
8209 BGP_STR
8210 "BGP view\n"
8211 "View name\n"
8212 "Address family\n"
8213 "Detailed information on TCP and BGP neighbor connections\n"
8214 "Neighbor to display information about\n"
8215 "Neighbor to display information about\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02008216
paul718e3742002-12-13 20:15:29 +00008217/* Show BGP's AS paths internal data. There are both `show ip bgp
8218 paths' and `show ip mbgp paths'. Those functions results are the
8219 same.*/
8220DEFUN (show_ip_bgp_paths,
8221 show_ip_bgp_paths_cmd,
8222 "show ip bgp paths",
8223 SHOW_STR
8224 IP_STR
8225 BGP_STR
8226 "Path information\n")
8227{
8228 vty_out (vty, "Address Refcnt Path%s", VTY_NEWLINE);
8229 aspath_print_all_vty (vty);
8230 return CMD_SUCCESS;
8231}
8232
8233DEFUN (show_ip_bgp_ipv4_paths,
8234 show_ip_bgp_ipv4_paths_cmd,
8235 "show ip bgp ipv4 (unicast|multicast) paths",
8236 SHOW_STR
8237 IP_STR
8238 BGP_STR
8239 "Address family\n"
8240 "Address Family modifier\n"
8241 "Address Family modifier\n"
8242 "Path information\n")
8243{
8244 vty_out (vty, "Address Refcnt Path\r\n");
8245 aspath_print_all_vty (vty);
8246
8247 return CMD_SUCCESS;
8248}
David Lamparter6b0655a2014-06-04 06:53:35 +02008249
paul718e3742002-12-13 20:15:29 +00008250#include "hash.h"
8251
paul94f2b392005-06-28 12:44:16 +00008252static void
paul718e3742002-12-13 20:15:29 +00008253community_show_all_iterator (struct hash_backet *backet, struct vty *vty)
8254{
8255 struct community *com;
8256
8257 com = (struct community *) backet->data;
David Lampartereed3c482015-03-03 08:51:53 +01008258 vty_out (vty, "[%p] (%ld) %s%s", (void *)backet, com->refcnt,
paul718e3742002-12-13 20:15:29 +00008259 community_str (com), VTY_NEWLINE);
8260}
8261
8262/* Show BGP's community internal data. */
8263DEFUN (show_ip_bgp_community_info,
8264 show_ip_bgp_community_info_cmd,
8265 "show ip bgp community-info",
8266 SHOW_STR
8267 IP_STR
8268 BGP_STR
8269 "List all bgp community information\n")
8270{
8271 vty_out (vty, "Address Refcnt Community%s", VTY_NEWLINE);
8272
8273 hash_iterate (community_hash (),
8274 (void (*) (struct hash_backet *, void *))
8275 community_show_all_iterator,
8276 vty);
8277
8278 return CMD_SUCCESS;
8279}
8280
8281DEFUN (show_ip_bgp_attr_info,
8282 show_ip_bgp_attr_info_cmd,
8283 "show ip bgp attribute-info",
8284 SHOW_STR
8285 IP_STR
8286 BGP_STR
8287 "List all bgp attribute information\n")
8288{
8289 attr_show_all (vty);
8290 return CMD_SUCCESS;
8291}
David Lamparter6b0655a2014-06-04 06:53:35 +02008292
paul94f2b392005-06-28 12:44:16 +00008293static int
paulfee0f4c2004-09-13 05:12:46 +00008294bgp_write_rsclient_summary (struct vty *vty, struct peer *rsclient,
8295 afi_t afi, safi_t safi)
8296{
8297 char timebuf[BGP_UPTIME_LEN];
8298 char rmbuf[14];
paulfd79ac92004-10-13 05:06:08 +00008299 const char *rmname;
paulfee0f4c2004-09-13 05:12:46 +00008300 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00008301 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00008302 int len;
8303 int count = 0;
8304
8305 if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_GROUP))
8306 {
paul1eb8ef22005-04-07 07:30:20 +00008307 for (ALL_LIST_ELEMENTS (rsclient->group->peer, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00008308 {
8309 count++;
8310 bgp_write_rsclient_summary (vty, peer, afi, safi);
8311 }
8312 return count;
8313 }
8314
8315 len = vty_out (vty, "%s", rsclient->host);
8316 len = 16 - len;
8317
8318 if (len < 1)
8319 vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " ");
8320 else
8321 vty_out (vty, "%*s", len, " ");
8322
hasso3d515fd2005-02-01 21:30:04 +00008323 vty_out (vty, "4 ");
paulfee0f4c2004-09-13 05:12:46 +00008324
Milan Kociancb4fc592014-12-01 12:48:25 +00008325 vty_out (vty, "%10u ", rsclient->as);
paulfee0f4c2004-09-13 05:12:46 +00008326
8327 rmname = ROUTE_MAP_EXPORT_NAME(&rsclient->filter[afi][safi]);
8328 if ( rmname && strlen (rmname) > 13 )
8329 {
8330 sprintf (rmbuf, "%13s", "...");
8331 rmname = strncpy (rmbuf, rmname, 10);
8332 }
8333 else if (! rmname)
8334 rmname = "<none>";
8335 vty_out (vty, " %13s ", rmname);
8336
8337 rmname = ROUTE_MAP_IMPORT_NAME(&rsclient->filter[afi][safi]);
8338 if ( rmname && strlen (rmname) > 13 )
8339 {
8340 sprintf (rmbuf, "%13s", "...");
8341 rmname = strncpy (rmbuf, rmname, 10);
8342 }
8343 else if (! rmname)
8344 rmname = "<none>";
8345 vty_out (vty, " %13s ", rmname);
8346
8347 vty_out (vty, "%8s", peer_uptime (rsclient->uptime, timebuf, BGP_UPTIME_LEN));
8348
8349 if (CHECK_FLAG (rsclient->flags, PEER_FLAG_SHUTDOWN))
8350 vty_out (vty, " Idle (Admin)");
8351 else if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_PREFIX_OVERFLOW))
8352 vty_out (vty, " Idle (PfxCt)");
8353 else
8354 vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, rsclient->status));
8355
8356 vty_out (vty, "%s", VTY_NEWLINE);
8357
8358 return 1;
8359}
8360
paul94f2b392005-06-28 12:44:16 +00008361static int
paulfd79ac92004-10-13 05:06:08 +00008362bgp_show_rsclient_summary (struct vty *vty, struct bgp *bgp,
8363 afi_t afi, safi_t safi)
paulfee0f4c2004-09-13 05:12:46 +00008364{
8365 struct peer *peer;
paul1eb8ef22005-04-07 07:30:20 +00008366 struct listnode *node, *nnode;
paulfee0f4c2004-09-13 05:12:46 +00008367 int count = 0;
8368
8369 /* Header string for each address family. */
Milan Kociancb4fc592014-12-01 12:48:25 +00008370 static char header[] = "Neighbor V AS Export-Policy Import-Policy Up/Down State";
paulfee0f4c2004-09-13 05:12:46 +00008371
paul1eb8ef22005-04-07 07:30:20 +00008372 for (ALL_LIST_ELEMENTS (bgp->rsclient, node, nnode, peer))
paulfee0f4c2004-09-13 05:12:46 +00008373 {
8374 if (peer->afc[afi][safi] &&
8375 CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT))
8376 {
8377 if (! count)
8378 {
8379 vty_out (vty,
8380 "Route Server's BGP router identifier %s%s",
8381 inet_ntoa (bgp->router_id), VTY_NEWLINE);
8382 vty_out (vty,
Denis Ovsienkoaea339f2009-04-30 17:16:22 +04008383 "Route Server's local AS number %u%s", bgp->as,
paulfee0f4c2004-09-13 05:12:46 +00008384 VTY_NEWLINE);
8385
8386 vty_out (vty, "%s", VTY_NEWLINE);
8387 vty_out (vty, "%s%s", header, VTY_NEWLINE);
8388 }
8389
8390 count += bgp_write_rsclient_summary (vty, peer, afi, safi);
8391 }
8392 }
8393
8394 if (count)
8395 vty_out (vty, "%sTotal number of Route Server Clients %d%s", VTY_NEWLINE,
8396 count, VTY_NEWLINE);
8397 else
8398 vty_out (vty, "No %s Route Server Client is configured%s",
8399 afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE);
8400
8401 return CMD_SUCCESS;
8402}
8403
paul94f2b392005-06-28 12:44:16 +00008404static int
paulfd79ac92004-10-13 05:06:08 +00008405bgp_show_rsclient_summary_vty (struct vty *vty, const char *name,
8406 afi_t afi, safi_t safi)
paulfee0f4c2004-09-13 05:12:46 +00008407{
8408 struct bgp *bgp;
8409
8410 if (name)
8411 {
8412 bgp = bgp_lookup_by_name (name);
8413
8414 if (! bgp)
8415 {
8416 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
8417 return CMD_WARNING;
8418 }
8419
8420 bgp_show_rsclient_summary (vty, bgp, afi, safi);
8421 return CMD_SUCCESS;
8422 }
8423
8424 bgp = bgp_get_default ();
8425
8426 if (bgp)
8427 bgp_show_rsclient_summary (vty, bgp, afi, safi);
8428
8429 return CMD_SUCCESS;
8430}
8431
8432/* 'show bgp rsclient' commands. */
8433DEFUN (show_ip_bgp_rsclient_summary,
8434 show_ip_bgp_rsclient_summary_cmd,
8435 "show ip bgp rsclient summary",
8436 SHOW_STR
8437 IP_STR
8438 BGP_STR
8439 "Information about Route Server Clients\n"
8440 "Summary of all Route Server Clients\n")
8441{
8442 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
8443}
8444
8445DEFUN (show_ip_bgp_instance_rsclient_summary,
8446 show_ip_bgp_instance_rsclient_summary_cmd,
8447 "show ip bgp view WORD rsclient summary",
8448 SHOW_STR
8449 IP_STR
8450 BGP_STR
8451 "BGP view\n"
8452 "View name\n"
8453 "Information about Route Server Clients\n"
8454 "Summary of all Route Server Clients\n")
8455{
8456 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
8457}
8458
8459DEFUN (show_ip_bgp_ipv4_rsclient_summary,
8460 show_ip_bgp_ipv4_rsclient_summary_cmd,
8461 "show ip bgp ipv4 (unicast|multicast) rsclient summary",
8462 SHOW_STR
8463 IP_STR
8464 BGP_STR
8465 "Address family\n"
8466 "Address Family modifier\n"
8467 "Address Family modifier\n"
8468 "Information about Route Server Clients\n"
8469 "Summary of all Route Server Clients\n")
8470{
8471 if (strncmp (argv[0], "m", 1) == 0)
8472 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
8473
8474 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
8475}
8476
8477DEFUN (show_ip_bgp_instance_ipv4_rsclient_summary,
8478 show_ip_bgp_instance_ipv4_rsclient_summary_cmd,
8479 "show ip bgp view WORD ipv4 (unicast|multicast) rsclient summary",
8480 SHOW_STR
8481 IP_STR
8482 BGP_STR
8483 "BGP view\n"
8484 "View name\n"
8485 "Address family\n"
8486 "Address Family modifier\n"
8487 "Address Family modifier\n"
8488 "Information about Route Server Clients\n"
8489 "Summary of all Route Server Clients\n")
8490{
8491 if (strncmp (argv[1], "m", 1) == 0)
8492 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
8493
8494 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
8495}
8496
Michael Lambert95cbbd22010-07-23 14:43:04 -04008497DEFUN (show_bgp_instance_ipv4_safi_rsclient_summary,
8498 show_bgp_instance_ipv4_safi_rsclient_summary_cmd,
8499 "show bgp view WORD ipv4 (unicast|multicast) rsclient summary",
8500 SHOW_STR
8501 BGP_STR
8502 "BGP view\n"
8503 "View name\n"
8504 "Address family\n"
8505 "Address Family modifier\n"
8506 "Address Family modifier\n"
8507 "Information about Route Server Clients\n"
8508 "Summary of all Route Server Clients\n")
8509{
8510 safi_t safi;
8511
8512 if (argc == 2) {
8513 safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
8514 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, safi);
8515 } else {
8516 safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
8517 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, safi);
8518 }
8519}
8520
8521ALIAS (show_bgp_instance_ipv4_safi_rsclient_summary,
8522 show_bgp_ipv4_safi_rsclient_summary_cmd,
8523 "show bgp ipv4 (unicast|multicast) rsclient summary",
8524 SHOW_STR
8525 BGP_STR
8526 "Address family\n"
8527 "Address Family modifier\n"
8528 "Address Family modifier\n"
8529 "Information about Route Server Clients\n"
8530 "Summary of all Route Server Clients\n")
8531
paulfee0f4c2004-09-13 05:12:46 +00008532#ifdef HAVE_IPV6
8533DEFUN (show_bgp_rsclient_summary,
8534 show_bgp_rsclient_summary_cmd,
8535 "show bgp rsclient summary",
8536 SHOW_STR
8537 BGP_STR
8538 "Information about Route Server Clients\n"
8539 "Summary of all Route Server Clients\n")
8540{
8541 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
8542}
8543
8544DEFUN (show_bgp_instance_rsclient_summary,
8545 show_bgp_instance_rsclient_summary_cmd,
8546 "show bgp view WORD rsclient summary",
8547 SHOW_STR
8548 BGP_STR
8549 "BGP view\n"
8550 "View name\n"
8551 "Information about Route Server Clients\n"
8552 "Summary of all Route Server Clients\n")
8553{
8554 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
8555}
8556
8557ALIAS (show_bgp_rsclient_summary,
8558 show_bgp_ipv6_rsclient_summary_cmd,
8559 "show bgp ipv6 rsclient summary",
8560 SHOW_STR
8561 BGP_STR
8562 "Address family\n"
8563 "Information about Route Server Clients\n"
8564 "Summary of all Route Server Clients\n")
8565
8566ALIAS (show_bgp_instance_rsclient_summary,
8567 show_bgp_instance_ipv6_rsclient_summary_cmd,
8568 "show bgp view WORD ipv6 rsclient summary",
8569 SHOW_STR
8570 BGP_STR
8571 "BGP view\n"
8572 "View name\n"
8573 "Address family\n"
8574 "Information about Route Server Clients\n"
8575 "Summary of all Route Server Clients\n")
Michael Lambert95cbbd22010-07-23 14:43:04 -04008576
8577DEFUN (show_bgp_instance_ipv6_safi_rsclient_summary,
8578 show_bgp_instance_ipv6_safi_rsclient_summary_cmd,
8579 "show bgp view WORD ipv6 (unicast|multicast) rsclient summary",
8580 SHOW_STR
8581 BGP_STR
8582 "BGP view\n"
8583 "View name\n"
8584 "Address family\n"
8585 "Address Family modifier\n"
8586 "Address Family modifier\n"
8587 "Information about Route Server Clients\n"
8588 "Summary of all Route Server Clients\n")
8589{
8590 safi_t safi;
8591
8592 if (argc == 2) {
8593 safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
8594 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, safi);
8595 } else {
8596 safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
8597 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, safi);
8598 }
8599}
8600
8601ALIAS (show_bgp_instance_ipv6_safi_rsclient_summary,
8602 show_bgp_ipv6_safi_rsclient_summary_cmd,
8603 "show bgp ipv6 (unicast|multicast) rsclient summary",
8604 SHOW_STR
8605 BGP_STR
8606 "Address family\n"
8607 "Address Family modifier\n"
8608 "Address Family modifier\n"
8609 "Information about Route Server Clients\n"
8610 "Summary of all Route Server Clients\n")
8611
paulfee0f4c2004-09-13 05:12:46 +00008612#endif /* HAVE IPV6 */
David Lamparter6b0655a2014-06-04 06:53:35 +02008613
paul718e3742002-12-13 20:15:29 +00008614/* Redistribute VTY commands. */
8615
paul718e3742002-12-13 20:15:29 +00008616DEFUN (bgp_redistribute_ipv4,
8617 bgp_redistribute_ipv4_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008618 "redistribute " QUAGGA_IP_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00008619 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008620 QUAGGA_IP_REDIST_HELP_STR_BGPD)
paul718e3742002-12-13 20:15:29 +00008621{
8622 int type;
8623
David Lampartere0ca5fd2009-09-16 01:52:42 +02008624 type = proto_redistnum (AFI_IP, argv[0]);
8625 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008626 {
8627 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8628 return CMD_WARNING;
8629 }
8630 return bgp_redistribute_set (vty->index, AFI_IP, type);
8631}
8632
8633DEFUN (bgp_redistribute_ipv4_rmap,
8634 bgp_redistribute_ipv4_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008635 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00008636 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008637 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008638 "Route map reference\n"
8639 "Pointer to route-map entries\n")
8640{
8641 int type;
8642
David Lampartere0ca5fd2009-09-16 01:52:42 +02008643 type = proto_redistnum (AFI_IP, argv[0]);
8644 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008645 {
8646 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8647 return CMD_WARNING;
8648 }
8649
8650 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]);
8651 return bgp_redistribute_set (vty->index, AFI_IP, type);
8652}
8653
8654DEFUN (bgp_redistribute_ipv4_metric,
8655 bgp_redistribute_ipv4_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008656 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00008657 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008658 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008659 "Metric for redistributed routes\n"
8660 "Default metric\n")
8661{
8662 int type;
8663 u_int32_t metric;
8664
David Lampartere0ca5fd2009-09-16 01:52:42 +02008665 type = proto_redistnum (AFI_IP, argv[0]);
8666 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008667 {
8668 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8669 return CMD_WARNING;
8670 }
8671 VTY_GET_INTEGER ("metric", metric, argv[1]);
8672
8673 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
8674 return bgp_redistribute_set (vty->index, AFI_IP, type);
8675}
8676
8677DEFUN (bgp_redistribute_ipv4_rmap_metric,
8678 bgp_redistribute_ipv4_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008679 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00008680 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008681 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008682 "Route map reference\n"
8683 "Pointer to route-map entries\n"
8684 "Metric for redistributed routes\n"
8685 "Default metric\n")
8686{
8687 int type;
8688 u_int32_t metric;
8689
David Lampartere0ca5fd2009-09-16 01:52:42 +02008690 type = proto_redistnum (AFI_IP, argv[0]);
8691 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008692 {
8693 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8694 return CMD_WARNING;
8695 }
8696 VTY_GET_INTEGER ("metric", metric, argv[2]);
8697
8698 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]);
8699 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
8700 return bgp_redistribute_set (vty->index, AFI_IP, type);
8701}
8702
8703DEFUN (bgp_redistribute_ipv4_metric_rmap,
8704 bgp_redistribute_ipv4_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008705 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00008706 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008707 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008708 "Metric for redistributed routes\n"
8709 "Default metric\n"
8710 "Route map reference\n"
8711 "Pointer to route-map entries\n")
8712{
8713 int type;
8714 u_int32_t metric;
8715
David Lampartere0ca5fd2009-09-16 01:52:42 +02008716 type = proto_redistnum (AFI_IP, argv[0]);
8717 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008718 {
8719 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8720 return CMD_WARNING;
8721 }
8722 VTY_GET_INTEGER ("metric", metric, argv[1]);
8723
8724 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
8725 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[2]);
8726 return bgp_redistribute_set (vty->index, AFI_IP, type);
8727}
8728
8729DEFUN (no_bgp_redistribute_ipv4,
8730 no_bgp_redistribute_ipv4_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008731 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00008732 NO_STR
8733 "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{
8736 int type;
8737
David Lampartere0ca5fd2009-09-16 01:52:42 +02008738 type = proto_redistnum (AFI_IP, argv[0]);
8739 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008740 {
8741 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8742 return CMD_WARNING;
8743 }
8744
8745 return bgp_redistribute_unset (vty->index, AFI_IP, type);
8746}
8747
8748DEFUN (no_bgp_redistribute_ipv4_rmap,
8749 no_bgp_redistribute_ipv4_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008750 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00008751 NO_STR
8752 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008753 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008754 "Route map reference\n"
8755 "Pointer to route-map entries\n")
8756{
8757 int type;
8758
David Lampartere0ca5fd2009-09-16 01:52:42 +02008759 type = proto_redistnum (AFI_IP, argv[0]);
8760 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008761 {
8762 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8763 return CMD_WARNING;
8764 }
8765
8766 bgp_redistribute_routemap_unset (vty->index, AFI_IP, type);
8767 return CMD_SUCCESS;
8768}
8769
8770DEFUN (no_bgp_redistribute_ipv4_metric,
8771 no_bgp_redistribute_ipv4_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008772 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00008773 NO_STR
8774 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008775 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008776 "Metric for redistributed routes\n"
8777 "Default metric\n")
8778{
8779 int type;
8780
David Lampartere0ca5fd2009-09-16 01:52:42 +02008781 type = proto_redistnum (AFI_IP, argv[0]);
8782 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008783 {
8784 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8785 return CMD_WARNING;
8786 }
8787
8788 bgp_redistribute_metric_unset (vty->index, AFI_IP, type);
8789 return CMD_SUCCESS;
8790}
8791
8792DEFUN (no_bgp_redistribute_ipv4_rmap_metric,
8793 no_bgp_redistribute_ipv4_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008794 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00008795 NO_STR
8796 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008797 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008798 "Route map reference\n"
8799 "Pointer to route-map entries\n"
8800 "Metric for redistributed routes\n"
8801 "Default metric\n")
8802{
8803 int type;
8804
David Lampartere0ca5fd2009-09-16 01:52:42 +02008805 type = proto_redistnum (AFI_IP, argv[0]);
8806 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008807 {
8808 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8809 return CMD_WARNING;
8810 }
8811
8812 bgp_redistribute_metric_unset (vty->index, AFI_IP, type);
8813 bgp_redistribute_routemap_unset (vty->index, AFI_IP, type);
8814 return CMD_SUCCESS;
8815}
8816
8817ALIAS (no_bgp_redistribute_ipv4_rmap_metric,
8818 no_bgp_redistribute_ipv4_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008819 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00008820 NO_STR
8821 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008822 QUAGGA_IP_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008823 "Metric for redistributed routes\n"
8824 "Default metric\n"
8825 "Route map reference\n"
8826 "Pointer to route-map entries\n")
David Lamparter6b0655a2014-06-04 06:53:35 +02008827
paul718e3742002-12-13 20:15:29 +00008828#ifdef HAVE_IPV6
8829DEFUN (bgp_redistribute_ipv6,
8830 bgp_redistribute_ipv6_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008831 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00008832 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008833 QUAGGA_IP6_REDIST_HELP_STR_BGPD)
paul718e3742002-12-13 20:15:29 +00008834{
8835 int type;
8836
David Lampartere0ca5fd2009-09-16 01:52:42 +02008837 type = proto_redistnum (AFI_IP6, argv[0]);
8838 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008839 {
8840 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8841 return CMD_WARNING;
8842 }
8843
8844 return bgp_redistribute_set (vty->index, AFI_IP6, type);
8845}
8846
8847DEFUN (bgp_redistribute_ipv6_rmap,
8848 bgp_redistribute_ipv6_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008849 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00008850 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008851 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008852 "Route map reference\n"
8853 "Pointer to route-map entries\n")
8854{
8855 int type;
8856
David Lampartere0ca5fd2009-09-16 01:52:42 +02008857 type = proto_redistnum (AFI_IP6, argv[0]);
8858 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008859 {
8860 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8861 return CMD_WARNING;
8862 }
8863
8864 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]);
8865 return bgp_redistribute_set (vty->index, AFI_IP6, type);
8866}
8867
8868DEFUN (bgp_redistribute_ipv6_metric,
8869 bgp_redistribute_ipv6_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008870 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00008871 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008872 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008873 "Metric for redistributed routes\n"
8874 "Default metric\n")
8875{
8876 int type;
8877 u_int32_t metric;
8878
David Lampartere0ca5fd2009-09-16 01:52:42 +02008879 type = proto_redistnum (AFI_IP6, argv[0]);
8880 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008881 {
8882 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8883 return CMD_WARNING;
8884 }
8885 VTY_GET_INTEGER ("metric", metric, argv[1]);
8886
8887 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
8888 return bgp_redistribute_set (vty->index, AFI_IP6, type);
8889}
8890
8891DEFUN (bgp_redistribute_ipv6_rmap_metric,
8892 bgp_redistribute_ipv6_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008893 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00008894 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008895 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008896 "Route map reference\n"
8897 "Pointer to route-map entries\n"
8898 "Metric for redistributed routes\n"
8899 "Default metric\n")
8900{
8901 int type;
8902 u_int32_t metric;
8903
David Lampartere0ca5fd2009-09-16 01:52:42 +02008904 type = proto_redistnum (AFI_IP6, argv[0]);
8905 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008906 {
8907 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8908 return CMD_WARNING;
8909 }
8910 VTY_GET_INTEGER ("metric", metric, argv[2]);
8911
8912 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]);
8913 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
8914 return bgp_redistribute_set (vty->index, AFI_IP6, type);
8915}
8916
8917DEFUN (bgp_redistribute_ipv6_metric_rmap,
8918 bgp_redistribute_ipv6_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008919 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00008920 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008921 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008922 "Metric for redistributed routes\n"
8923 "Default metric\n"
8924 "Route map reference\n"
8925 "Pointer to route-map entries\n")
8926{
8927 int type;
8928 u_int32_t metric;
8929
David Lampartere0ca5fd2009-09-16 01:52:42 +02008930 type = proto_redistnum (AFI_IP6, argv[0]);
8931 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008932 {
8933 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8934 return CMD_WARNING;
8935 }
8936 VTY_GET_INTEGER ("metric", metric, argv[1]);
8937
8938 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
8939 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[2]);
8940 return bgp_redistribute_set (vty->index, AFI_IP6, type);
8941}
8942
8943DEFUN (no_bgp_redistribute_ipv6,
8944 no_bgp_redistribute_ipv6_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008945 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD,
paul718e3742002-12-13 20:15:29 +00008946 NO_STR
8947 "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{
8950 int type;
8951
David Lampartere0ca5fd2009-09-16 01:52:42 +02008952 type = proto_redistnum (AFI_IP6, argv[0]);
8953 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008954 {
8955 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8956 return CMD_WARNING;
8957 }
8958
8959 return bgp_redistribute_unset (vty->index, AFI_IP6, type);
8960}
8961
8962DEFUN (no_bgp_redistribute_ipv6_rmap,
8963 no_bgp_redistribute_ipv6_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008964 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD",
paul718e3742002-12-13 20:15:29 +00008965 NO_STR
8966 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008967 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008968 "Route map reference\n"
8969 "Pointer to route-map entries\n")
8970{
8971 int type;
8972
David Lampartere0ca5fd2009-09-16 01:52:42 +02008973 type = proto_redistnum (AFI_IP6, argv[0]);
8974 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008975 {
8976 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8977 return CMD_WARNING;
8978 }
8979
8980 bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type);
8981 return CMD_SUCCESS;
8982}
8983
8984DEFUN (no_bgp_redistribute_ipv6_metric,
8985 no_bgp_redistribute_ipv6_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02008986 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00008987 NO_STR
8988 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02008989 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00008990 "Metric for redistributed routes\n"
8991 "Default metric\n")
8992{
8993 int type;
8994
David Lampartere0ca5fd2009-09-16 01:52:42 +02008995 type = proto_redistnum (AFI_IP6, argv[0]);
8996 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00008997 {
8998 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
8999 return CMD_WARNING;
9000 }
9001
9002 bgp_redistribute_metric_unset (vty->index, AFI_IP6, type);
9003 return CMD_SUCCESS;
9004}
9005
9006DEFUN (no_bgp_redistribute_ipv6_rmap_metric,
9007 no_bgp_redistribute_ipv6_rmap_metric_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009008 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
paul718e3742002-12-13 20:15:29 +00009009 NO_STR
9010 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009011 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009012 "Route map reference\n"
9013 "Pointer to route-map entries\n"
9014 "Metric for redistributed routes\n"
9015 "Default metric\n")
9016{
9017 int type;
9018
David Lampartere0ca5fd2009-09-16 01:52:42 +02009019 type = proto_redistnum (AFI_IP6, argv[0]);
9020 if (type < 0 || type == ZEBRA_ROUTE_BGP)
paul718e3742002-12-13 20:15:29 +00009021 {
9022 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9023 return CMD_WARNING;
9024 }
9025
9026 bgp_redistribute_metric_unset (vty->index, AFI_IP6, type);
9027 bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type);
9028 return CMD_SUCCESS;
9029}
9030
9031ALIAS (no_bgp_redistribute_ipv6_rmap_metric,
9032 no_bgp_redistribute_ipv6_metric_rmap_cmd,
David Lampartere0ca5fd2009-09-16 01:52:42 +02009033 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
paul718e3742002-12-13 20:15:29 +00009034 NO_STR
9035 "Redistribute information from another routing protocol\n"
David Lampartere0ca5fd2009-09-16 01:52:42 +02009036 QUAGGA_IP6_REDIST_HELP_STR_BGPD
paul718e3742002-12-13 20:15:29 +00009037 "Metric for redistributed routes\n"
9038 "Default metric\n"
9039 "Route map reference\n"
9040 "Pointer to route-map entries\n")
9041#endif /* HAVE_IPV6 */
David Lamparter6b0655a2014-06-04 06:53:35 +02009042
paul718e3742002-12-13 20:15:29 +00009043int
9044bgp_config_write_redistribute (struct vty *vty, struct bgp *bgp, afi_t afi,
9045 safi_t safi, int *write)
9046{
9047 int i;
paul718e3742002-12-13 20:15:29 +00009048
9049 /* Unicast redistribution only. */
9050 if (safi != SAFI_UNICAST)
9051 return 0;
9052
9053 for (i = 0; i < ZEBRA_ROUTE_MAX; i++)
9054 {
9055 /* Redistribute BGP does not make sense. */
9056 if (bgp->redist[afi][i] && i != ZEBRA_ROUTE_BGP)
9057 {
9058 /* Display "address-family" when it is not yet diplayed. */
9059 bgp_config_write_family_header (vty, afi, safi, write);
9060
9061 /* "redistribute" configuration. */
ajsf52d13c2005-10-01 17:38:06 +00009062 vty_out (vty, " redistribute %s", zebra_route_string(i));
paul718e3742002-12-13 20:15:29 +00009063
9064 if (bgp->redist_metric_flag[afi][i])
Jorge Boncompte [DTI2]ddc943d2012-04-13 13:46:07 +02009065 vty_out (vty, " metric %u", bgp->redist_metric[afi][i]);
paul718e3742002-12-13 20:15:29 +00009066
9067 if (bgp->rmap[afi][i].name)
9068 vty_out (vty, " route-map %s", bgp->rmap[afi][i].name);
9069
9070 vty_out (vty, "%s", VTY_NEWLINE);
9071 }
9072 }
9073 return *write;
9074}
David Lamparter6b0655a2014-06-04 06:53:35 +02009075
paul718e3742002-12-13 20:15:29 +00009076/* BGP node structure. */
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009077static struct cmd_node bgp_node =
paul718e3742002-12-13 20:15:29 +00009078{
9079 BGP_NODE,
9080 "%s(config-router)# ",
9081 1,
9082};
9083
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009084static struct cmd_node bgp_ipv4_unicast_node =
paul718e3742002-12-13 20:15:29 +00009085{
9086 BGP_IPV4_NODE,
9087 "%s(config-router-af)# ",
9088 1,
9089};
9090
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009091static struct cmd_node bgp_ipv4_multicast_node =
paul718e3742002-12-13 20:15:29 +00009092{
9093 BGP_IPV4M_NODE,
9094 "%s(config-router-af)# ",
9095 1,
9096};
9097
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009098static struct cmd_node bgp_ipv6_unicast_node =
paul718e3742002-12-13 20:15:29 +00009099{
9100 BGP_IPV6_NODE,
9101 "%s(config-router-af)# ",
9102 1,
9103};
9104
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009105static struct cmd_node bgp_ipv6_multicast_node =
paul25ffbdc2005-08-22 22:42:08 +00009106{
9107 BGP_IPV6M_NODE,
9108 "%s(config-router-af)# ",
9109 1,
9110};
9111
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08009112static struct cmd_node bgp_vpnv4_node =
paul718e3742002-12-13 20:15:29 +00009113{
9114 BGP_VPNV4_NODE,
9115 "%s(config-router-af)# ",
9116 1
9117};
David Lamparter6b0655a2014-06-04 06:53:35 +02009118
paul1f8ae702005-09-09 23:49:49 +00009119static void community_list_vty (void);
9120
paul718e3742002-12-13 20:15:29 +00009121void
paul94f2b392005-06-28 12:44:16 +00009122bgp_vty_init (void)
paul718e3742002-12-13 20:15:29 +00009123{
paul718e3742002-12-13 20:15:29 +00009124 /* Install bgp top node. */
9125 install_node (&bgp_node, bgp_config_write);
9126 install_node (&bgp_ipv4_unicast_node, NULL);
9127 install_node (&bgp_ipv4_multicast_node, NULL);
9128 install_node (&bgp_ipv6_unicast_node, NULL);
paul25ffbdc2005-08-22 22:42:08 +00009129 install_node (&bgp_ipv6_multicast_node, NULL);
paul718e3742002-12-13 20:15:29 +00009130 install_node (&bgp_vpnv4_node, NULL);
9131
9132 /* Install default VTY commands to new nodes. */
9133 install_default (BGP_NODE);
9134 install_default (BGP_IPV4_NODE);
9135 install_default (BGP_IPV4M_NODE);
9136 install_default (BGP_IPV6_NODE);
paul25ffbdc2005-08-22 22:42:08 +00009137 install_default (BGP_IPV6M_NODE);
paul718e3742002-12-13 20:15:29 +00009138 install_default (BGP_VPNV4_NODE);
9139
9140 /* "bgp multiple-instance" commands. */
9141 install_element (CONFIG_NODE, &bgp_multiple_instance_cmd);
9142 install_element (CONFIG_NODE, &no_bgp_multiple_instance_cmd);
9143
9144 /* "bgp config-type" commands. */
9145 install_element (CONFIG_NODE, &bgp_config_type_cmd);
9146 install_element (CONFIG_NODE, &no_bgp_config_type_cmd);
9147
9148 /* Dummy commands (Currently not supported) */
9149 install_element (BGP_NODE, &no_synchronization_cmd);
9150 install_element (BGP_NODE, &no_auto_summary_cmd);
9151
9152 /* "router bgp" commands. */
9153 install_element (CONFIG_NODE, &router_bgp_cmd);
9154 install_element (CONFIG_NODE, &router_bgp_view_cmd);
9155
9156 /* "no router bgp" commands. */
9157 install_element (CONFIG_NODE, &no_router_bgp_cmd);
9158 install_element (CONFIG_NODE, &no_router_bgp_view_cmd);
9159
9160 /* "bgp router-id" commands. */
9161 install_element (BGP_NODE, &bgp_router_id_cmd);
9162 install_element (BGP_NODE, &no_bgp_router_id_cmd);
9163 install_element (BGP_NODE, &no_bgp_router_id_val_cmd);
9164
9165 /* "bgp cluster-id" commands. */
9166 install_element (BGP_NODE, &bgp_cluster_id_cmd);
9167 install_element (BGP_NODE, &bgp_cluster_id32_cmd);
9168 install_element (BGP_NODE, &no_bgp_cluster_id_cmd);
9169 install_element (BGP_NODE, &no_bgp_cluster_id_arg_cmd);
9170
9171 /* "bgp confederation" commands. */
9172 install_element (BGP_NODE, &bgp_confederation_identifier_cmd);
9173 install_element (BGP_NODE, &no_bgp_confederation_identifier_cmd);
9174 install_element (BGP_NODE, &no_bgp_confederation_identifier_arg_cmd);
9175
9176 /* "bgp confederation peers" commands. */
9177 install_element (BGP_NODE, &bgp_confederation_peers_cmd);
9178 install_element (BGP_NODE, &no_bgp_confederation_peers_cmd);
9179
Josh Bailey165b5ff2011-07-20 20:43:22 -07009180 /* "maximum-paths" commands. */
9181 install_element (BGP_NODE, &bgp_maxpaths_cmd);
9182 install_element (BGP_NODE, &no_bgp_maxpaths_cmd);
9183 install_element (BGP_NODE, &no_bgp_maxpaths_arg_cmd);
9184 install_element (BGP_IPV4_NODE, &bgp_maxpaths_cmd);
9185 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_cmd);
9186 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_arg_cmd);
9187 install_element (BGP_NODE, &bgp_maxpaths_ibgp_cmd);
9188 install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_cmd);
9189 install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_arg_cmd);
9190 install_element (BGP_IPV4_NODE, &bgp_maxpaths_ibgp_cmd);
9191 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_cmd);
9192 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_arg_cmd);
9193
paul718e3742002-12-13 20:15:29 +00009194 /* "timers bgp" commands. */
9195 install_element (BGP_NODE, &bgp_timers_cmd);
9196 install_element (BGP_NODE, &no_bgp_timers_cmd);
9197 install_element (BGP_NODE, &no_bgp_timers_arg_cmd);
9198
9199 /* "bgp client-to-client reflection" commands */
9200 install_element (BGP_NODE, &no_bgp_client_to_client_reflection_cmd);
9201 install_element (BGP_NODE, &bgp_client_to_client_reflection_cmd);
9202
9203 /* "bgp always-compare-med" commands */
9204 install_element (BGP_NODE, &bgp_always_compare_med_cmd);
9205 install_element (BGP_NODE, &no_bgp_always_compare_med_cmd);
9206
9207 /* "bgp deterministic-med" commands */
9208 install_element (BGP_NODE, &bgp_deterministic_med_cmd);
9209 install_element (BGP_NODE, &no_bgp_deterministic_med_cmd);
hasso538621f2004-05-21 09:31:30 +00009210
hasso538621f2004-05-21 09:31:30 +00009211 /* "bgp graceful-restart" commands */
9212 install_element (BGP_NODE, &bgp_graceful_restart_cmd);
9213 install_element (BGP_NODE, &no_bgp_graceful_restart_cmd);
hasso93406d82005-02-02 14:40:33 +00009214 install_element (BGP_NODE, &bgp_graceful_restart_stalepath_time_cmd);
9215 install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_cmd);
9216 install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_val_cmd);
paul718e3742002-12-13 20:15:29 +00009217
9218 /* "bgp fast-external-failover" commands */
9219 install_element (BGP_NODE, &bgp_fast_external_failover_cmd);
9220 install_element (BGP_NODE, &no_bgp_fast_external_failover_cmd);
9221
9222 /* "bgp enforce-first-as" commands */
9223 install_element (BGP_NODE, &bgp_enforce_first_as_cmd);
9224 install_element (BGP_NODE, &no_bgp_enforce_first_as_cmd);
9225
9226 /* "bgp bestpath compare-routerid" commands */
9227 install_element (BGP_NODE, &bgp_bestpath_compare_router_id_cmd);
9228 install_element (BGP_NODE, &no_bgp_bestpath_compare_router_id_cmd);
9229
9230 /* "bgp bestpath as-path ignore" commands */
9231 install_element (BGP_NODE, &bgp_bestpath_aspath_ignore_cmd);
9232 install_element (BGP_NODE, &no_bgp_bestpath_aspath_ignore_cmd);
9233
hasso68118452005-04-08 15:40:36 +00009234 /* "bgp bestpath as-path confed" commands */
9235 install_element (BGP_NODE, &bgp_bestpath_aspath_confed_cmd);
9236 install_element (BGP_NODE, &no_bgp_bestpath_aspath_confed_cmd);
9237
Pradosh Mohapatra2fdd4552013-09-07 07:02:36 +00009238 /* "bgp bestpath as-path multipath-relax" commands */
9239 install_element (BGP_NODE, &bgp_bestpath_aspath_multipath_relax_cmd);
9240 install_element (BGP_NODE, &no_bgp_bestpath_aspath_multipath_relax_cmd);
9241
paul848973c2003-08-13 00:32:49 +00009242 /* "bgp log-neighbor-changes" commands */
9243 install_element (BGP_NODE, &bgp_log_neighbor_changes_cmd);
9244 install_element (BGP_NODE, &no_bgp_log_neighbor_changes_cmd);
9245
paul718e3742002-12-13 20:15:29 +00009246 /* "bgp bestpath med" commands */
9247 install_element (BGP_NODE, &bgp_bestpath_med_cmd);
9248 install_element (BGP_NODE, &bgp_bestpath_med2_cmd);
9249 install_element (BGP_NODE, &bgp_bestpath_med3_cmd);
9250 install_element (BGP_NODE, &no_bgp_bestpath_med_cmd);
9251 install_element (BGP_NODE, &no_bgp_bestpath_med2_cmd);
9252 install_element (BGP_NODE, &no_bgp_bestpath_med3_cmd);
9253
9254 /* "no bgp default ipv4-unicast" commands. */
9255 install_element (BGP_NODE, &no_bgp_default_ipv4_unicast_cmd);
9256 install_element (BGP_NODE, &bgp_default_ipv4_unicast_cmd);
9257
9258 /* "bgp network import-check" commands. */
9259 install_element (BGP_NODE, &bgp_network_import_check_cmd);
9260 install_element (BGP_NODE, &no_bgp_network_import_check_cmd);
9261
9262 /* "bgp default local-preference" commands. */
9263 install_element (BGP_NODE, &bgp_default_local_preference_cmd);
9264 install_element (BGP_NODE, &no_bgp_default_local_preference_cmd);
9265 install_element (BGP_NODE, &no_bgp_default_local_preference_val_cmd);
9266
9267 /* "neighbor remote-as" commands. */
9268 install_element (BGP_NODE, &neighbor_remote_as_cmd);
9269 install_element (BGP_NODE, &no_neighbor_cmd);
9270 install_element (BGP_NODE, &no_neighbor_remote_as_cmd);
9271
9272 /* "neighbor peer-group" commands. */
9273 install_element (BGP_NODE, &neighbor_peer_group_cmd);
9274 install_element (BGP_NODE, &no_neighbor_peer_group_cmd);
9275 install_element (BGP_NODE, &no_neighbor_peer_group_remote_as_cmd);
9276
9277 /* "neighbor local-as" commands. */
9278 install_element (BGP_NODE, &neighbor_local_as_cmd);
9279 install_element (BGP_NODE, &neighbor_local_as_no_prepend_cmd);
Andrew Certain9d3f9702012-11-07 23:50:07 +00009280 install_element (BGP_NODE, &neighbor_local_as_no_prepend_replace_as_cmd);
paul718e3742002-12-13 20:15:29 +00009281 install_element (BGP_NODE, &no_neighbor_local_as_cmd);
9282 install_element (BGP_NODE, &no_neighbor_local_as_val_cmd);
9283 install_element (BGP_NODE, &no_neighbor_local_as_val2_cmd);
Andrew Certain9d3f9702012-11-07 23:50:07 +00009284 install_element (BGP_NODE, &no_neighbor_local_as_val3_cmd);
paul718e3742002-12-13 20:15:29 +00009285
Paul Jakma0df7c912008-07-21 21:02:49 +00009286 /* "neighbor password" commands. */
9287 install_element (BGP_NODE, &neighbor_password_cmd);
9288 install_element (BGP_NODE, &no_neighbor_password_cmd);
9289
paul718e3742002-12-13 20:15:29 +00009290 /* "neighbor activate" commands. */
9291 install_element (BGP_NODE, &neighbor_activate_cmd);
9292 install_element (BGP_IPV4_NODE, &neighbor_activate_cmd);
9293 install_element (BGP_IPV4M_NODE, &neighbor_activate_cmd);
9294 install_element (BGP_IPV6_NODE, &neighbor_activate_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009295 install_element (BGP_IPV6M_NODE, &neighbor_activate_cmd);
paul718e3742002-12-13 20:15:29 +00009296 install_element (BGP_VPNV4_NODE, &neighbor_activate_cmd);
9297
9298 /* "no neighbor activate" commands. */
9299 install_element (BGP_NODE, &no_neighbor_activate_cmd);
9300 install_element (BGP_IPV4_NODE, &no_neighbor_activate_cmd);
9301 install_element (BGP_IPV4M_NODE, &no_neighbor_activate_cmd);
9302 install_element (BGP_IPV6_NODE, &no_neighbor_activate_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009303 install_element (BGP_IPV6M_NODE, &no_neighbor_activate_cmd);
paul718e3742002-12-13 20:15:29 +00009304 install_element (BGP_VPNV4_NODE, &no_neighbor_activate_cmd);
9305
9306 /* "neighbor peer-group set" commands. */
9307 install_element (BGP_NODE, &neighbor_set_peer_group_cmd);
9308 install_element (BGP_IPV4_NODE, &neighbor_set_peer_group_cmd);
9309 install_element (BGP_IPV4M_NODE, &neighbor_set_peer_group_cmd);
9310 install_element (BGP_IPV6_NODE, &neighbor_set_peer_group_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009311 install_element (BGP_IPV6M_NODE, &neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +00009312 install_element (BGP_VPNV4_NODE, &neighbor_set_peer_group_cmd);
9313
paul718e3742002-12-13 20:15:29 +00009314 /* "no neighbor peer-group unset" commands. */
9315 install_element (BGP_NODE, &no_neighbor_set_peer_group_cmd);
9316 install_element (BGP_IPV4_NODE, &no_neighbor_set_peer_group_cmd);
9317 install_element (BGP_IPV4M_NODE, &no_neighbor_set_peer_group_cmd);
9318 install_element (BGP_IPV6_NODE, &no_neighbor_set_peer_group_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009319 install_element (BGP_IPV6M_NODE, &no_neighbor_set_peer_group_cmd);
paula58545b2003-07-12 21:43:01 +00009320 install_element (BGP_VPNV4_NODE, &no_neighbor_set_peer_group_cmd);
9321
paul718e3742002-12-13 20:15:29 +00009322 /* "neighbor softreconfiguration inbound" commands.*/
9323 install_element (BGP_NODE, &neighbor_soft_reconfiguration_cmd);
9324 install_element (BGP_NODE, &no_neighbor_soft_reconfiguration_cmd);
9325 install_element (BGP_IPV4_NODE, &neighbor_soft_reconfiguration_cmd);
9326 install_element (BGP_IPV4_NODE, &no_neighbor_soft_reconfiguration_cmd);
9327 install_element (BGP_IPV4M_NODE, &neighbor_soft_reconfiguration_cmd);
9328 install_element (BGP_IPV4M_NODE, &no_neighbor_soft_reconfiguration_cmd);
9329 install_element (BGP_IPV6_NODE, &neighbor_soft_reconfiguration_cmd);
9330 install_element (BGP_IPV6_NODE, &no_neighbor_soft_reconfiguration_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009331 install_element (BGP_IPV6M_NODE, &neighbor_soft_reconfiguration_cmd);
9332 install_element (BGP_IPV6M_NODE, &no_neighbor_soft_reconfiguration_cmd);
paula58545b2003-07-12 21:43:01 +00009333 install_element (BGP_VPNV4_NODE, &neighbor_soft_reconfiguration_cmd);
9334 install_element (BGP_VPNV4_NODE, &no_neighbor_soft_reconfiguration_cmd);
paul718e3742002-12-13 20:15:29 +00009335
9336 /* "neighbor attribute-unchanged" commands. */
9337 install_element (BGP_NODE, &neighbor_attr_unchanged_cmd);
9338 install_element (BGP_NODE, &neighbor_attr_unchanged1_cmd);
9339 install_element (BGP_NODE, &neighbor_attr_unchanged2_cmd);
9340 install_element (BGP_NODE, &neighbor_attr_unchanged3_cmd);
9341 install_element (BGP_NODE, &neighbor_attr_unchanged4_cmd);
9342 install_element (BGP_NODE, &neighbor_attr_unchanged5_cmd);
9343 install_element (BGP_NODE, &neighbor_attr_unchanged6_cmd);
9344 install_element (BGP_NODE, &neighbor_attr_unchanged7_cmd);
9345 install_element (BGP_NODE, &neighbor_attr_unchanged8_cmd);
9346 install_element (BGP_NODE, &neighbor_attr_unchanged9_cmd);
9347 install_element (BGP_NODE, &neighbor_attr_unchanged10_cmd);
9348 install_element (BGP_NODE, &no_neighbor_attr_unchanged_cmd);
9349 install_element (BGP_NODE, &no_neighbor_attr_unchanged1_cmd);
9350 install_element (BGP_NODE, &no_neighbor_attr_unchanged2_cmd);
9351 install_element (BGP_NODE, &no_neighbor_attr_unchanged3_cmd);
9352 install_element (BGP_NODE, &no_neighbor_attr_unchanged4_cmd);
9353 install_element (BGP_NODE, &no_neighbor_attr_unchanged5_cmd);
9354 install_element (BGP_NODE, &no_neighbor_attr_unchanged6_cmd);
9355 install_element (BGP_NODE, &no_neighbor_attr_unchanged7_cmd);
9356 install_element (BGP_NODE, &no_neighbor_attr_unchanged8_cmd);
9357 install_element (BGP_NODE, &no_neighbor_attr_unchanged9_cmd);
9358 install_element (BGP_NODE, &no_neighbor_attr_unchanged10_cmd);
9359 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged_cmd);
9360 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged1_cmd);
9361 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged2_cmd);
9362 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged3_cmd);
9363 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged4_cmd);
9364 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged5_cmd);
9365 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged6_cmd);
9366 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged7_cmd);
9367 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged8_cmd);
9368 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged9_cmd);
9369 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged10_cmd);
9370 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged_cmd);
9371 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged1_cmd);
9372 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged2_cmd);
9373 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged3_cmd);
9374 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged4_cmd);
9375 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged5_cmd);
9376 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged6_cmd);
9377 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged7_cmd);
9378 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged8_cmd);
9379 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged9_cmd);
9380 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged10_cmd);
9381 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged_cmd);
9382 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged1_cmd);
9383 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged2_cmd);
9384 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged3_cmd);
9385 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged4_cmd);
9386 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged5_cmd);
9387 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged6_cmd);
9388 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged7_cmd);
9389 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged8_cmd);
9390 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged9_cmd);
9391 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged10_cmd);
9392 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged_cmd);
9393 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged1_cmd);
9394 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged2_cmd);
9395 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged3_cmd);
9396 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged4_cmd);
9397 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged5_cmd);
9398 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged6_cmd);
9399 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged7_cmd);
9400 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged8_cmd);
9401 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged9_cmd);
9402 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged10_cmd);
9403 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged_cmd);
9404 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged1_cmd);
9405 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged2_cmd);
9406 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged3_cmd);
9407 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged4_cmd);
9408 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged5_cmd);
9409 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged6_cmd);
9410 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged7_cmd);
9411 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged8_cmd);
9412 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged9_cmd);
9413 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged10_cmd);
9414 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged_cmd);
9415 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged1_cmd);
9416 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged2_cmd);
9417 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged3_cmd);
9418 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged4_cmd);
9419 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged5_cmd);
9420 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged6_cmd);
9421 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged7_cmd);
9422 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged8_cmd);
9423 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged9_cmd);
9424 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged10_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009425 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged_cmd);
9426 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged1_cmd);
9427 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged2_cmd);
9428 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged3_cmd);
9429 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged4_cmd);
9430 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged5_cmd);
9431 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged6_cmd);
9432 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged7_cmd);
9433 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged8_cmd);
9434 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged9_cmd);
9435 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged10_cmd);
9436 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged_cmd);
9437 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged1_cmd);
9438 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged2_cmd);
9439 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged3_cmd);
9440 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged4_cmd);
9441 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged5_cmd);
9442 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged6_cmd);
9443 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged7_cmd);
9444 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged8_cmd);
9445 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged9_cmd);
9446 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged10_cmd);
paul718e3742002-12-13 20:15:29 +00009447 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged_cmd);
9448 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged1_cmd);
9449 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged2_cmd);
9450 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged3_cmd);
9451 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged4_cmd);
9452 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged5_cmd);
9453 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged6_cmd);
9454 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged7_cmd);
9455 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged8_cmd);
9456 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged9_cmd);
9457 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged10_cmd);
9458 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged_cmd);
9459 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged1_cmd);
9460 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged2_cmd);
9461 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged3_cmd);
9462 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged4_cmd);
9463 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged5_cmd);
9464 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged6_cmd);
9465 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged7_cmd);
9466 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged8_cmd);
9467 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged9_cmd);
9468 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged10_cmd);
9469
paulfee0f4c2004-09-13 05:12:46 +00009470 /* "nexthop-local unchanged" commands */
9471 install_element (BGP_IPV6_NODE, &neighbor_nexthop_local_unchanged_cmd);
9472 install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_local_unchanged_cmd);
9473
paul718e3742002-12-13 20:15:29 +00009474 /* "transparent-as" and "transparent-nexthop" for old version
9475 compatibility. */
9476 install_element (BGP_NODE, &neighbor_transparent_as_cmd);
9477 install_element (BGP_NODE, &neighbor_transparent_nexthop_cmd);
9478
9479 /* "neighbor next-hop-self" commands. */
9480 install_element (BGP_NODE, &neighbor_nexthop_self_cmd);
9481 install_element (BGP_NODE, &no_neighbor_nexthop_self_cmd);
9482 install_element (BGP_IPV4_NODE, &neighbor_nexthop_self_cmd);
9483 install_element (BGP_IPV4_NODE, &no_neighbor_nexthop_self_cmd);
9484 install_element (BGP_IPV4M_NODE, &neighbor_nexthop_self_cmd);
9485 install_element (BGP_IPV4M_NODE, &no_neighbor_nexthop_self_cmd);
9486 install_element (BGP_IPV6_NODE, &neighbor_nexthop_self_cmd);
9487 install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_self_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009488 install_element (BGP_IPV6M_NODE, &neighbor_nexthop_self_cmd);
9489 install_element (BGP_IPV6M_NODE, &no_neighbor_nexthop_self_cmd);
paul718e3742002-12-13 20:15:29 +00009490 install_element (BGP_VPNV4_NODE, &neighbor_nexthop_self_cmd);
9491 install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_cmd);
9492
9493 /* "neighbor remove-private-AS" commands. */
9494 install_element (BGP_NODE, &neighbor_remove_private_as_cmd);
9495 install_element (BGP_NODE, &no_neighbor_remove_private_as_cmd);
9496 install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_cmd);
9497 install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_cmd);
9498 install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_cmd);
9499 install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_cmd);
9500 install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_cmd);
9501 install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009502 install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_cmd);
9503 install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_cmd);
paul718e3742002-12-13 20:15:29 +00009504 install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_cmd);
9505 install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_cmd);
9506
9507 /* "neighbor send-community" commands.*/
9508 install_element (BGP_NODE, &neighbor_send_community_cmd);
9509 install_element (BGP_NODE, &neighbor_send_community_type_cmd);
9510 install_element (BGP_NODE, &no_neighbor_send_community_cmd);
9511 install_element (BGP_NODE, &no_neighbor_send_community_type_cmd);
9512 install_element (BGP_IPV4_NODE, &neighbor_send_community_cmd);
9513 install_element (BGP_IPV4_NODE, &neighbor_send_community_type_cmd);
9514 install_element (BGP_IPV4_NODE, &no_neighbor_send_community_cmd);
9515 install_element (BGP_IPV4_NODE, &no_neighbor_send_community_type_cmd);
9516 install_element (BGP_IPV4M_NODE, &neighbor_send_community_cmd);
9517 install_element (BGP_IPV4M_NODE, &neighbor_send_community_type_cmd);
9518 install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_cmd);
9519 install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_type_cmd);
9520 install_element (BGP_IPV6_NODE, &neighbor_send_community_cmd);
9521 install_element (BGP_IPV6_NODE, &neighbor_send_community_type_cmd);
9522 install_element (BGP_IPV6_NODE, &no_neighbor_send_community_cmd);
9523 install_element (BGP_IPV6_NODE, &no_neighbor_send_community_type_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009524 install_element (BGP_IPV6M_NODE, &neighbor_send_community_cmd);
9525 install_element (BGP_IPV6M_NODE, &neighbor_send_community_type_cmd);
9526 install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_cmd);
9527 install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_type_cmd);
paul718e3742002-12-13 20:15:29 +00009528 install_element (BGP_VPNV4_NODE, &neighbor_send_community_cmd);
9529 install_element (BGP_VPNV4_NODE, &neighbor_send_community_type_cmd);
9530 install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_cmd);
9531 install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_type_cmd);
9532
9533 /* "neighbor route-reflector" commands.*/
9534 install_element (BGP_NODE, &neighbor_route_reflector_client_cmd);
9535 install_element (BGP_NODE, &no_neighbor_route_reflector_client_cmd);
9536 install_element (BGP_IPV4_NODE, &neighbor_route_reflector_client_cmd);
9537 install_element (BGP_IPV4_NODE, &no_neighbor_route_reflector_client_cmd);
9538 install_element (BGP_IPV4M_NODE, &neighbor_route_reflector_client_cmd);
9539 install_element (BGP_IPV4M_NODE, &no_neighbor_route_reflector_client_cmd);
9540 install_element (BGP_IPV6_NODE, &neighbor_route_reflector_client_cmd);
9541 install_element (BGP_IPV6_NODE, &no_neighbor_route_reflector_client_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009542 install_element (BGP_IPV6M_NODE, &neighbor_route_reflector_client_cmd);
9543 install_element (BGP_IPV6M_NODE, &no_neighbor_route_reflector_client_cmd);
paul718e3742002-12-13 20:15:29 +00009544 install_element (BGP_VPNV4_NODE, &neighbor_route_reflector_client_cmd);
9545 install_element (BGP_VPNV4_NODE, &no_neighbor_route_reflector_client_cmd);
9546
9547 /* "neighbor route-server" commands.*/
9548 install_element (BGP_NODE, &neighbor_route_server_client_cmd);
9549 install_element (BGP_NODE, &no_neighbor_route_server_client_cmd);
9550 install_element (BGP_IPV4_NODE, &neighbor_route_server_client_cmd);
9551 install_element (BGP_IPV4_NODE, &no_neighbor_route_server_client_cmd);
9552 install_element (BGP_IPV4M_NODE, &neighbor_route_server_client_cmd);
9553 install_element (BGP_IPV4M_NODE, &no_neighbor_route_server_client_cmd);
9554 install_element (BGP_IPV6_NODE, &neighbor_route_server_client_cmd);
9555 install_element (BGP_IPV6_NODE, &no_neighbor_route_server_client_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009556 install_element (BGP_IPV6M_NODE, &neighbor_route_server_client_cmd);
9557 install_element (BGP_IPV6M_NODE, &no_neighbor_route_server_client_cmd);
paul718e3742002-12-13 20:15:29 +00009558 install_element (BGP_VPNV4_NODE, &neighbor_route_server_client_cmd);
9559 install_element (BGP_VPNV4_NODE, &no_neighbor_route_server_client_cmd);
9560
9561 /* "neighbor passive" commands. */
9562 install_element (BGP_NODE, &neighbor_passive_cmd);
9563 install_element (BGP_NODE, &no_neighbor_passive_cmd);
9564
9565 /* "neighbor shutdown" commands. */
9566 install_element (BGP_NODE, &neighbor_shutdown_cmd);
9567 install_element (BGP_NODE, &no_neighbor_shutdown_cmd);
9568
hassoc9502432005-02-01 22:01:48 +00009569 /* Deprecated "neighbor capability route-refresh" commands.*/
paul718e3742002-12-13 20:15:29 +00009570 install_element (BGP_NODE, &neighbor_capability_route_refresh_cmd);
9571 install_element (BGP_NODE, &no_neighbor_capability_route_refresh_cmd);
9572
9573 /* "neighbor capability orf prefix-list" commands.*/
9574 install_element (BGP_NODE, &neighbor_capability_orf_prefix_cmd);
9575 install_element (BGP_NODE, &no_neighbor_capability_orf_prefix_cmd);
9576 install_element (BGP_IPV4_NODE, &neighbor_capability_orf_prefix_cmd);
9577 install_element (BGP_IPV4_NODE, &no_neighbor_capability_orf_prefix_cmd);
9578 install_element (BGP_IPV4M_NODE, &neighbor_capability_orf_prefix_cmd);
9579 install_element (BGP_IPV4M_NODE, &no_neighbor_capability_orf_prefix_cmd);
9580 install_element (BGP_IPV6_NODE, &neighbor_capability_orf_prefix_cmd);
9581 install_element (BGP_IPV6_NODE, &no_neighbor_capability_orf_prefix_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009582 install_element (BGP_IPV6M_NODE, &neighbor_capability_orf_prefix_cmd);
9583 install_element (BGP_IPV6M_NODE, &no_neighbor_capability_orf_prefix_cmd);
paul718e3742002-12-13 20:15:29 +00009584
9585 /* "neighbor capability dynamic" commands.*/
9586 install_element (BGP_NODE, &neighbor_capability_dynamic_cmd);
9587 install_element (BGP_NODE, &no_neighbor_capability_dynamic_cmd);
9588
9589 /* "neighbor dont-capability-negotiate" commands. */
9590 install_element (BGP_NODE, &neighbor_dont_capability_negotiate_cmd);
9591 install_element (BGP_NODE, &no_neighbor_dont_capability_negotiate_cmd);
9592
9593 /* "neighbor ebgp-multihop" commands. */
9594 install_element (BGP_NODE, &neighbor_ebgp_multihop_cmd);
9595 install_element (BGP_NODE, &neighbor_ebgp_multihop_ttl_cmd);
9596 install_element (BGP_NODE, &no_neighbor_ebgp_multihop_cmd);
9597 install_element (BGP_NODE, &no_neighbor_ebgp_multihop_ttl_cmd);
9598
hasso6ffd2072005-02-02 14:50:11 +00009599 /* "neighbor disable-connected-check" commands. */
9600 install_element (BGP_NODE, &neighbor_disable_connected_check_cmd);
9601 install_element (BGP_NODE, &no_neighbor_disable_connected_check_cmd);
paul718e3742002-12-13 20:15:29 +00009602 install_element (BGP_NODE, &neighbor_enforce_multihop_cmd);
9603 install_element (BGP_NODE, &no_neighbor_enforce_multihop_cmd);
9604
9605 /* "neighbor description" commands. */
9606 install_element (BGP_NODE, &neighbor_description_cmd);
9607 install_element (BGP_NODE, &no_neighbor_description_cmd);
9608 install_element (BGP_NODE, &no_neighbor_description_val_cmd);
9609
9610 /* "neighbor update-source" commands. "*/
9611 install_element (BGP_NODE, &neighbor_update_source_cmd);
9612 install_element (BGP_NODE, &no_neighbor_update_source_cmd);
9613
9614 /* "neighbor default-originate" commands. */
9615 install_element (BGP_NODE, &neighbor_default_originate_cmd);
9616 install_element (BGP_NODE, &neighbor_default_originate_rmap_cmd);
9617 install_element (BGP_NODE, &no_neighbor_default_originate_cmd);
9618 install_element (BGP_NODE, &no_neighbor_default_originate_rmap_cmd);
9619 install_element (BGP_IPV4_NODE, &neighbor_default_originate_cmd);
9620 install_element (BGP_IPV4_NODE, &neighbor_default_originate_rmap_cmd);
9621 install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_cmd);
9622 install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_rmap_cmd);
9623 install_element (BGP_IPV4M_NODE, &neighbor_default_originate_cmd);
9624 install_element (BGP_IPV4M_NODE, &neighbor_default_originate_rmap_cmd);
9625 install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_cmd);
9626 install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_rmap_cmd);
9627 install_element (BGP_IPV6_NODE, &neighbor_default_originate_cmd);
9628 install_element (BGP_IPV6_NODE, &neighbor_default_originate_rmap_cmd);
9629 install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_cmd);
9630 install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_rmap_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009631 install_element (BGP_IPV6M_NODE, &neighbor_default_originate_cmd);
9632 install_element (BGP_IPV6M_NODE, &neighbor_default_originate_rmap_cmd);
9633 install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_cmd);
9634 install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_rmap_cmd);
paul718e3742002-12-13 20:15:29 +00009635
9636 /* "neighbor port" commands. */
9637 install_element (BGP_NODE, &neighbor_port_cmd);
9638 install_element (BGP_NODE, &no_neighbor_port_cmd);
9639 install_element (BGP_NODE, &no_neighbor_port_val_cmd);
9640
9641 /* "neighbor weight" commands. */
9642 install_element (BGP_NODE, &neighbor_weight_cmd);
9643 install_element (BGP_NODE, &no_neighbor_weight_cmd);
9644 install_element (BGP_NODE, &no_neighbor_weight_val_cmd);
9645
9646 /* "neighbor override-capability" commands. */
9647 install_element (BGP_NODE, &neighbor_override_capability_cmd);
9648 install_element (BGP_NODE, &no_neighbor_override_capability_cmd);
9649
9650 /* "neighbor strict-capability-match" commands. */
9651 install_element (BGP_NODE, &neighbor_strict_capability_cmd);
9652 install_element (BGP_NODE, &no_neighbor_strict_capability_cmd);
9653
9654 /* "neighbor timers" commands. */
9655 install_element (BGP_NODE, &neighbor_timers_cmd);
9656 install_element (BGP_NODE, &no_neighbor_timers_cmd);
9657
9658 /* "neighbor timers connect" commands. */
9659 install_element (BGP_NODE, &neighbor_timers_connect_cmd);
9660 install_element (BGP_NODE, &no_neighbor_timers_connect_cmd);
9661 install_element (BGP_NODE, &no_neighbor_timers_connect_val_cmd);
9662
9663 /* "neighbor advertisement-interval" commands. */
9664 install_element (BGP_NODE, &neighbor_advertise_interval_cmd);
9665 install_element (BGP_NODE, &no_neighbor_advertise_interval_cmd);
9666 install_element (BGP_NODE, &no_neighbor_advertise_interval_val_cmd);
9667
9668 /* "neighbor version" commands. */
9669 install_element (BGP_NODE, &neighbor_version_cmd);
paul718e3742002-12-13 20:15:29 +00009670
9671 /* "neighbor interface" commands. */
9672 install_element (BGP_NODE, &neighbor_interface_cmd);
9673 install_element (BGP_NODE, &no_neighbor_interface_cmd);
9674
9675 /* "neighbor distribute" commands. */
9676 install_element (BGP_NODE, &neighbor_distribute_list_cmd);
9677 install_element (BGP_NODE, &no_neighbor_distribute_list_cmd);
9678 install_element (BGP_IPV4_NODE, &neighbor_distribute_list_cmd);
9679 install_element (BGP_IPV4_NODE, &no_neighbor_distribute_list_cmd);
9680 install_element (BGP_IPV4M_NODE, &neighbor_distribute_list_cmd);
9681 install_element (BGP_IPV4M_NODE, &no_neighbor_distribute_list_cmd);
9682 install_element (BGP_IPV6_NODE, &neighbor_distribute_list_cmd);
9683 install_element (BGP_IPV6_NODE, &no_neighbor_distribute_list_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009684 install_element (BGP_IPV6M_NODE, &neighbor_distribute_list_cmd);
9685 install_element (BGP_IPV6M_NODE, &no_neighbor_distribute_list_cmd);
paul718e3742002-12-13 20:15:29 +00009686 install_element (BGP_VPNV4_NODE, &neighbor_distribute_list_cmd);
9687 install_element (BGP_VPNV4_NODE, &no_neighbor_distribute_list_cmd);
9688
9689 /* "neighbor prefix-list" commands. */
9690 install_element (BGP_NODE, &neighbor_prefix_list_cmd);
9691 install_element (BGP_NODE, &no_neighbor_prefix_list_cmd);
9692 install_element (BGP_IPV4_NODE, &neighbor_prefix_list_cmd);
9693 install_element (BGP_IPV4_NODE, &no_neighbor_prefix_list_cmd);
9694 install_element (BGP_IPV4M_NODE, &neighbor_prefix_list_cmd);
9695 install_element (BGP_IPV4M_NODE, &no_neighbor_prefix_list_cmd);
9696 install_element (BGP_IPV6_NODE, &neighbor_prefix_list_cmd);
9697 install_element (BGP_IPV6_NODE, &no_neighbor_prefix_list_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009698 install_element (BGP_IPV6M_NODE, &neighbor_prefix_list_cmd);
9699 install_element (BGP_IPV6M_NODE, &no_neighbor_prefix_list_cmd);
paul718e3742002-12-13 20:15:29 +00009700 install_element (BGP_VPNV4_NODE, &neighbor_prefix_list_cmd);
9701 install_element (BGP_VPNV4_NODE, &no_neighbor_prefix_list_cmd);
9702
9703 /* "neighbor filter-list" commands. */
9704 install_element (BGP_NODE, &neighbor_filter_list_cmd);
9705 install_element (BGP_NODE, &no_neighbor_filter_list_cmd);
9706 install_element (BGP_IPV4_NODE, &neighbor_filter_list_cmd);
9707 install_element (BGP_IPV4_NODE, &no_neighbor_filter_list_cmd);
9708 install_element (BGP_IPV4M_NODE, &neighbor_filter_list_cmd);
9709 install_element (BGP_IPV4M_NODE, &no_neighbor_filter_list_cmd);
9710 install_element (BGP_IPV6_NODE, &neighbor_filter_list_cmd);
9711 install_element (BGP_IPV6_NODE, &no_neighbor_filter_list_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009712 install_element (BGP_IPV6M_NODE, &neighbor_filter_list_cmd);
9713 install_element (BGP_IPV6M_NODE, &no_neighbor_filter_list_cmd);
paul718e3742002-12-13 20:15:29 +00009714 install_element (BGP_VPNV4_NODE, &neighbor_filter_list_cmd);
9715 install_element (BGP_VPNV4_NODE, &no_neighbor_filter_list_cmd);
9716
9717 /* "neighbor route-map" commands. */
9718 install_element (BGP_NODE, &neighbor_route_map_cmd);
9719 install_element (BGP_NODE, &no_neighbor_route_map_cmd);
9720 install_element (BGP_IPV4_NODE, &neighbor_route_map_cmd);
9721 install_element (BGP_IPV4_NODE, &no_neighbor_route_map_cmd);
9722 install_element (BGP_IPV4M_NODE, &neighbor_route_map_cmd);
9723 install_element (BGP_IPV4M_NODE, &no_neighbor_route_map_cmd);
9724 install_element (BGP_IPV6_NODE, &neighbor_route_map_cmd);
9725 install_element (BGP_IPV6_NODE, &no_neighbor_route_map_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009726 install_element (BGP_IPV6M_NODE, &neighbor_route_map_cmd);
9727 install_element (BGP_IPV6M_NODE, &no_neighbor_route_map_cmd);
paul718e3742002-12-13 20:15:29 +00009728 install_element (BGP_VPNV4_NODE, &neighbor_route_map_cmd);
9729 install_element (BGP_VPNV4_NODE, &no_neighbor_route_map_cmd);
9730
9731 /* "neighbor unsuppress-map" commands. */
9732 install_element (BGP_NODE, &neighbor_unsuppress_map_cmd);
9733 install_element (BGP_NODE, &no_neighbor_unsuppress_map_cmd);
9734 install_element (BGP_IPV4_NODE, &neighbor_unsuppress_map_cmd);
9735 install_element (BGP_IPV4_NODE, &no_neighbor_unsuppress_map_cmd);
9736 install_element (BGP_IPV4M_NODE, &neighbor_unsuppress_map_cmd);
9737 install_element (BGP_IPV4M_NODE, &no_neighbor_unsuppress_map_cmd);
9738 install_element (BGP_IPV6_NODE, &neighbor_unsuppress_map_cmd);
9739 install_element (BGP_IPV6_NODE, &no_neighbor_unsuppress_map_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009740 install_element (BGP_IPV6M_NODE, &neighbor_unsuppress_map_cmd);
9741 install_element (BGP_IPV6M_NODE, &no_neighbor_unsuppress_map_cmd);
paula58545b2003-07-12 21:43:01 +00009742 install_element (BGP_VPNV4_NODE, &neighbor_unsuppress_map_cmd);
9743 install_element (BGP_VPNV4_NODE, &no_neighbor_unsuppress_map_cmd);
paul718e3742002-12-13 20:15:29 +00009744
9745 /* "neighbor maximum-prefix" commands. */
9746 install_element (BGP_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +00009747 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +00009748 install_element (BGP_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +00009749 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +00009750 install_element (BGP_NODE, &neighbor_maximum_prefix_restart_cmd);
9751 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009752 install_element (BGP_NODE, &no_neighbor_maximum_prefix_cmd);
9753 install_element (BGP_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +00009754 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9755 install_element (BGP_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9756 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9757 install_element (BGP_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9758 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009759 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +00009760 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +00009761 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +00009762 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +00009763 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_restart_cmd);
9764 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009765 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_cmd);
9766 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +00009767 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9768 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9769 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9770 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9771 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009772 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +00009773 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +00009774 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +00009775 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +00009776 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_restart_cmd);
9777 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009778 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_cmd);
9779 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +00009780 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9781 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9782 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9783 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9784 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009785 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +00009786 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +00009787 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +00009788 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +00009789 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_restart_cmd);
9790 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009791 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_cmd);
9792 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +00009793 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9794 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9795 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9796 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9797 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009798 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_cmd);
9799 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_cmd);
9800 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_warning_cmd);
9801 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
9802 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_restart_cmd);
9803 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
9804 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_cmd);
9805 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_val_cmd);
9806 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9807 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9808 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9809 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9810 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009811 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_cmd);
hassoe0701b72004-05-20 09:19:34 +00009812 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_cmd);
paul718e3742002-12-13 20:15:29 +00009813 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_warning_cmd);
hassoe0701b72004-05-20 09:19:34 +00009814 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
hasso0a486e52005-02-01 20:57:17 +00009815 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_restart_cmd);
9816 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009817 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_cmd);
9818 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_val_cmd);
hasso0a486e52005-02-01 20:57:17 +00009819 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
9820 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_warning_cmd);
9821 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
9822 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_restart_cmd);
9823 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
paul718e3742002-12-13 20:15:29 +00009824
9825 /* "neighbor allowas-in" */
9826 install_element (BGP_NODE, &neighbor_allowas_in_cmd);
9827 install_element (BGP_NODE, &neighbor_allowas_in_arg_cmd);
9828 install_element (BGP_NODE, &no_neighbor_allowas_in_cmd);
9829 install_element (BGP_IPV4_NODE, &neighbor_allowas_in_cmd);
9830 install_element (BGP_IPV4_NODE, &neighbor_allowas_in_arg_cmd);
9831 install_element (BGP_IPV4_NODE, &no_neighbor_allowas_in_cmd);
9832 install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_cmd);
9833 install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_arg_cmd);
9834 install_element (BGP_IPV4M_NODE, &no_neighbor_allowas_in_cmd);
9835 install_element (BGP_IPV6_NODE, &neighbor_allowas_in_cmd);
9836 install_element (BGP_IPV6_NODE, &neighbor_allowas_in_arg_cmd);
9837 install_element (BGP_IPV6_NODE, &no_neighbor_allowas_in_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009838 install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_cmd);
9839 install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_arg_cmd);
9840 install_element (BGP_IPV6M_NODE, &no_neighbor_allowas_in_cmd);
paul718e3742002-12-13 20:15:29 +00009841 install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_cmd);
9842 install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_arg_cmd);
9843 install_element (BGP_VPNV4_NODE, &no_neighbor_allowas_in_cmd);
9844
9845 /* address-family commands. */
9846 install_element (BGP_NODE, &address_family_ipv4_cmd);
9847 install_element (BGP_NODE, &address_family_ipv4_safi_cmd);
9848#ifdef HAVE_IPV6
9849 install_element (BGP_NODE, &address_family_ipv6_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009850 install_element (BGP_NODE, &address_family_ipv6_safi_cmd);
paul718e3742002-12-13 20:15:29 +00009851#endif /* HAVE_IPV6 */
9852 install_element (BGP_NODE, &address_family_vpnv4_cmd);
9853 install_element (BGP_NODE, &address_family_vpnv4_unicast_cmd);
9854
9855 /* "exit-address-family" command. */
9856 install_element (BGP_IPV4_NODE, &exit_address_family_cmd);
9857 install_element (BGP_IPV4M_NODE, &exit_address_family_cmd);
9858 install_element (BGP_IPV6_NODE, &exit_address_family_cmd);
paul25ffbdc2005-08-22 22:42:08 +00009859 install_element (BGP_IPV6M_NODE, &exit_address_family_cmd);
paul718e3742002-12-13 20:15:29 +00009860 install_element (BGP_VPNV4_NODE, &exit_address_family_cmd);
9861
9862 /* "clear ip bgp commands" */
9863 install_element (ENABLE_NODE, &clear_ip_bgp_all_cmd);
9864 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_cmd);
9865 install_element (ENABLE_NODE, &clear_ip_bgp_as_cmd);
9866 install_element (ENABLE_NODE, &clear_ip_bgp_peer_cmd);
9867 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_cmd);
9868 install_element (ENABLE_NODE, &clear_ip_bgp_external_cmd);
9869#ifdef HAVE_IPV6
9870 install_element (ENABLE_NODE, &clear_bgp_all_cmd);
9871 install_element (ENABLE_NODE, &clear_bgp_instance_all_cmd);
9872 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_cmd);
9873 install_element (ENABLE_NODE, &clear_bgp_peer_cmd);
9874 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_cmd);
9875 install_element (ENABLE_NODE, &clear_bgp_peer_group_cmd);
9876 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_cmd);
9877 install_element (ENABLE_NODE, &clear_bgp_external_cmd);
9878 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_cmd);
9879 install_element (ENABLE_NODE, &clear_bgp_as_cmd);
9880 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_cmd);
9881#endif /* HAVE_IPV6 */
9882
9883 /* "clear ip bgp neighbor soft in" */
9884 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_in_cmd);
9885 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_in_cmd);
9886 install_element (ENABLE_NODE, &clear_ip_bgp_all_in_cmd);
9887 install_element (ENABLE_NODE, &clear_ip_bgp_all_in_prefix_filter_cmd);
9888 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_in_prefix_filter_cmd);
9889 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_in_cmd);
9890 install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_cmd);
9891 install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_prefix_filter_cmd);
9892 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_in_cmd);
9893 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_cmd);
9894 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_prefix_filter_cmd);
9895 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_in_cmd);
9896 install_element (ENABLE_NODE, &clear_ip_bgp_external_in_cmd);
9897 install_element (ENABLE_NODE, &clear_ip_bgp_external_in_prefix_filter_cmd);
9898 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_in_cmd);
9899 install_element (ENABLE_NODE, &clear_ip_bgp_as_in_cmd);
9900 install_element (ENABLE_NODE, &clear_ip_bgp_as_in_prefix_filter_cmd);
9901 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_in_cmd);
9902 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_in_cmd);
9903 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_cmd);
9904 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_prefix_filter_cmd);
9905 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd);
9906 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_in_cmd);
9907 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_cmd);
9908 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd);
9909 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_in_cmd);
9910 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_cmd);
9911 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd);
9912 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_in_cmd);
9913 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_cmd);
9914 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_prefix_filter_cmd);
9915 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_in_cmd);
9916 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_cmd);
9917 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_prefix_filter_cmd);
9918 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_in_cmd);
9919 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_in_cmd);
9920 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_in_cmd);
9921 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_in_cmd);
9922 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_in_cmd);
9923 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_in_cmd);
9924#ifdef HAVE_IPV6
9925 install_element (ENABLE_NODE, &clear_bgp_all_soft_in_cmd);
9926 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_in_cmd);
9927 install_element (ENABLE_NODE, &clear_bgp_all_in_cmd);
9928 install_element (ENABLE_NODE, &clear_bgp_all_in_prefix_filter_cmd);
9929 install_element (ENABLE_NODE, &clear_bgp_peer_soft_in_cmd);
9930 install_element (ENABLE_NODE, &clear_bgp_peer_in_cmd);
9931 install_element (ENABLE_NODE, &clear_bgp_peer_in_prefix_filter_cmd);
9932 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_in_cmd);
9933 install_element (ENABLE_NODE, &clear_bgp_peer_group_in_cmd);
9934 install_element (ENABLE_NODE, &clear_bgp_peer_group_in_prefix_filter_cmd);
9935 install_element (ENABLE_NODE, &clear_bgp_external_soft_in_cmd);
9936 install_element (ENABLE_NODE, &clear_bgp_external_in_cmd);
9937 install_element (ENABLE_NODE, &clear_bgp_external_in_prefix_filter_cmd);
9938 install_element (ENABLE_NODE, &clear_bgp_as_soft_in_cmd);
9939 install_element (ENABLE_NODE, &clear_bgp_as_in_cmd);
9940 install_element (ENABLE_NODE, &clear_bgp_as_in_prefix_filter_cmd);
9941 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_in_cmd);
9942 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_cmd);
9943 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_prefix_filter_cmd);
9944 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_in_cmd);
9945 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_cmd);
9946 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_prefix_filter_cmd);
9947 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_in_cmd);
9948 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_cmd);
9949 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_prefix_filter_cmd);
9950 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_in_cmd);
9951 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_cmd);
9952 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_prefix_filter_cmd);
9953 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_in_cmd);
9954 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_cmd);
9955 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_prefix_filter_cmd);
9956#endif /* HAVE_IPV6 */
9957
9958 /* "clear ip bgp neighbor soft out" */
9959 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_out_cmd);
9960 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_out_cmd);
9961 install_element (ENABLE_NODE, &clear_ip_bgp_all_out_cmd);
9962 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_out_cmd);
9963 install_element (ENABLE_NODE, &clear_ip_bgp_peer_out_cmd);
9964 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_out_cmd);
9965 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_out_cmd);
9966 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_out_cmd);
9967 install_element (ENABLE_NODE, &clear_ip_bgp_external_out_cmd);
9968 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_out_cmd);
9969 install_element (ENABLE_NODE, &clear_ip_bgp_as_out_cmd);
9970 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_out_cmd);
9971 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_out_cmd);
9972 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_out_cmd);
9973 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_out_cmd);
9974 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_out_cmd);
9975 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_out_cmd);
9976 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_out_cmd);
9977 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_out_cmd);
9978 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_out_cmd);
9979 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_out_cmd);
9980 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_out_cmd);
9981 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_out_cmd);
9982 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_out_cmd);
9983 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_out_cmd);
9984 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_out_cmd);
9985 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_out_cmd);
9986 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_out_cmd);
9987#ifdef HAVE_IPV6
9988 install_element (ENABLE_NODE, &clear_bgp_all_soft_out_cmd);
9989 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_out_cmd);
9990 install_element (ENABLE_NODE, &clear_bgp_all_out_cmd);
9991 install_element (ENABLE_NODE, &clear_bgp_peer_soft_out_cmd);
9992 install_element (ENABLE_NODE, &clear_bgp_peer_out_cmd);
9993 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_out_cmd);
9994 install_element (ENABLE_NODE, &clear_bgp_peer_group_out_cmd);
9995 install_element (ENABLE_NODE, &clear_bgp_external_soft_out_cmd);
9996 install_element (ENABLE_NODE, &clear_bgp_external_out_cmd);
9997 install_element (ENABLE_NODE, &clear_bgp_as_soft_out_cmd);
9998 install_element (ENABLE_NODE, &clear_bgp_as_out_cmd);
9999 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_out_cmd);
10000 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_out_cmd);
10001 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_out_cmd);
10002 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_out_cmd);
10003 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_out_cmd);
10004 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_out_cmd);
10005 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_out_cmd);
10006 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_out_cmd);
10007 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_out_cmd);
10008 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_out_cmd);
10009#endif /* HAVE_IPV6 */
10010
10011 /* "clear ip bgp neighbor soft" */
10012 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_cmd);
10013 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_cmd);
10014 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_cmd);
10015 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_cmd);
10016 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_cmd);
10017 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_cmd);
10018 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_cmd);
10019 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_cmd);
10020 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_cmd);
10021 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_cmd);
10022 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_cmd);
10023 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_cmd);
10024 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_cmd);
10025 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_cmd);
10026 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_cmd);
10027#ifdef HAVE_IPV6
10028 install_element (ENABLE_NODE, &clear_bgp_all_soft_cmd);
10029 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_cmd);
10030 install_element (ENABLE_NODE, &clear_bgp_peer_soft_cmd);
10031 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_cmd);
10032 install_element (ENABLE_NODE, &clear_bgp_external_soft_cmd);
10033 install_element (ENABLE_NODE, &clear_bgp_as_soft_cmd);
10034 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_cmd);
10035 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_cmd);
10036 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_cmd);
10037 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_cmd);
10038 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_cmd);
10039#endif /* HAVE_IPV6 */
10040
paulfee0f4c2004-09-13 05:12:46 +000010041 /* "clear ip bgp neighbor rsclient" */
10042 install_element (ENABLE_NODE, &clear_ip_bgp_all_rsclient_cmd);
10043 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_rsclient_cmd);
10044 install_element (ENABLE_NODE, &clear_ip_bgp_peer_rsclient_cmd);
10045 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_rsclient_cmd);
10046#ifdef HAVE_IPV6
10047 install_element (ENABLE_NODE, &clear_bgp_all_rsclient_cmd);
10048 install_element (ENABLE_NODE, &clear_bgp_instance_all_rsclient_cmd);
10049 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_rsclient_cmd);
10050 install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_all_rsclient_cmd);
10051 install_element (ENABLE_NODE, &clear_bgp_peer_rsclient_cmd);
10052 install_element (ENABLE_NODE, &clear_bgp_instance_peer_rsclient_cmd);
10053 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_rsclient_cmd);
10054 install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_peer_rsclient_cmd);
10055#endif /* HAVE_IPV6 */
10056
paul718e3742002-12-13 20:15:29 +000010057 /* "show ip bgp summary" commands. */
10058 install_element (VIEW_NODE, &show_ip_bgp_summary_cmd);
10059 install_element (VIEW_NODE, &show_ip_bgp_instance_summary_cmd);
10060 install_element (VIEW_NODE, &show_ip_bgp_ipv4_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010061 install_element (VIEW_NODE, &show_bgp_ipv4_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010062 install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010063 install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010064 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
10065 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
10066#ifdef HAVE_IPV6
10067 install_element (VIEW_NODE, &show_bgp_summary_cmd);
10068 install_element (VIEW_NODE, &show_bgp_instance_summary_cmd);
10069 install_element (VIEW_NODE, &show_bgp_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010070 install_element (VIEW_NODE, &show_bgp_ipv6_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010071 install_element (VIEW_NODE, &show_bgp_instance_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010072 install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010073#endif /* HAVE_IPV6 */
Paul Jakma62687ff2008-08-23 14:27:06 +010010074 install_element (RESTRICTED_NODE, &show_ip_bgp_summary_cmd);
10075 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_summary_cmd);
10076 install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010077 install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010078 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010079 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010080 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
10081 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
10082#ifdef HAVE_IPV6
10083 install_element (RESTRICTED_NODE, &show_bgp_summary_cmd);
10084 install_element (RESTRICTED_NODE, &show_bgp_instance_summary_cmd);
10085 install_element (RESTRICTED_NODE, &show_bgp_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010086 install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010087 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010088 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010089#endif /* HAVE_IPV6 */
paul718e3742002-12-13 20:15:29 +000010090 install_element (ENABLE_NODE, &show_ip_bgp_summary_cmd);
10091 install_element (ENABLE_NODE, &show_ip_bgp_instance_summary_cmd);
10092 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010093 install_element (ENABLE_NODE, &show_bgp_ipv4_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010094 install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010095 install_element (ENABLE_NODE, &show_bgp_instance_ipv4_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010096 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
10097 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
10098#ifdef HAVE_IPV6
10099 install_element (ENABLE_NODE, &show_bgp_summary_cmd);
10100 install_element (ENABLE_NODE, &show_bgp_instance_summary_cmd);
10101 install_element (ENABLE_NODE, &show_bgp_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010102 install_element (ENABLE_NODE, &show_bgp_ipv6_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010103 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010104 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_summary_cmd);
paul718e3742002-12-13 20:15:29 +000010105#endif /* HAVE_IPV6 */
10106
10107 /* "show ip bgp neighbors" commands. */
10108 install_element (VIEW_NODE, &show_ip_bgp_neighbors_cmd);
10109 install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_cmd);
10110 install_element (VIEW_NODE, &show_ip_bgp_neighbors_peer_cmd);
10111 install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
10112 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd);
10113 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd);
10114 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
10115 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
10116 install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_cmd);
10117 install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010118 install_element (RESTRICTED_NODE, &show_ip_bgp_neighbors_peer_cmd);
10119 install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
10120 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
10121 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
10122 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
paul718e3742002-12-13 20:15:29 +000010123 install_element (ENABLE_NODE, &show_ip_bgp_neighbors_cmd);
10124 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_cmd);
10125 install_element (ENABLE_NODE, &show_ip_bgp_neighbors_peer_cmd);
10126 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
10127 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd);
10128 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd);
10129 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
10130 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
10131 install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_cmd);
10132 install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
10133
10134#ifdef HAVE_IPV6
10135 install_element (VIEW_NODE, &show_bgp_neighbors_cmd);
10136 install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_cmd);
10137 install_element (VIEW_NODE, &show_bgp_neighbors_peer_cmd);
10138 install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
paulbb46e942003-10-24 19:02:03 +000010139 install_element (VIEW_NODE, &show_bgp_instance_neighbors_cmd);
10140 install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_cmd);
10141 install_element (VIEW_NODE, &show_bgp_instance_neighbors_peer_cmd);
10142 install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010143 install_element (RESTRICTED_NODE, &show_bgp_neighbors_peer_cmd);
10144 install_element (RESTRICTED_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
10145 install_element (RESTRICTED_NODE, &show_bgp_instance_neighbors_peer_cmd);
10146 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
paul718e3742002-12-13 20:15:29 +000010147 install_element (ENABLE_NODE, &show_bgp_neighbors_cmd);
10148 install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_cmd);
10149 install_element (ENABLE_NODE, &show_bgp_neighbors_peer_cmd);
10150 install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
paulbb46e942003-10-24 19:02:03 +000010151 install_element (ENABLE_NODE, &show_bgp_instance_neighbors_cmd);
10152 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_cmd);
10153 install_element (ENABLE_NODE, &show_bgp_instance_neighbors_peer_cmd);
10154 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
paul718e3742002-12-13 20:15:29 +000010155
10156 /* Old commands. */
10157 install_element (VIEW_NODE, &show_ipv6_bgp_summary_cmd);
10158 install_element (VIEW_NODE, &show_ipv6_mbgp_summary_cmd);
10159 install_element (ENABLE_NODE, &show_ipv6_bgp_summary_cmd);
10160 install_element (ENABLE_NODE, &show_ipv6_mbgp_summary_cmd);
10161#endif /* HAVE_IPV6 */
10162
paulfee0f4c2004-09-13 05:12:46 +000010163 /* "show ip bgp rsclient" commands. */
10164 install_element (VIEW_NODE, &show_ip_bgp_rsclient_summary_cmd);
10165 install_element (VIEW_NODE, &show_ip_bgp_instance_rsclient_summary_cmd);
10166 install_element (VIEW_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd);
10167 install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010168 install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd);
10169 install_element (VIEW_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010170 install_element (RESTRICTED_NODE, &show_ip_bgp_rsclient_summary_cmd);
10171 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_rsclient_summary_cmd);
10172 install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd);
10173 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010174 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd);
10175 install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000010176 install_element (ENABLE_NODE, &show_ip_bgp_rsclient_summary_cmd);
10177 install_element (ENABLE_NODE, &show_ip_bgp_instance_rsclient_summary_cmd);
10178 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd);
10179 install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010180 install_element (ENABLE_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd);
10181 install_element (ENABLE_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000010182
10183#ifdef HAVE_IPV6
10184 install_element (VIEW_NODE, &show_bgp_rsclient_summary_cmd);
10185 install_element (VIEW_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
10186 install_element (VIEW_NODE, &show_bgp_instance_rsclient_summary_cmd);
10187 install_element (VIEW_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010188 install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd);
10189 install_element (VIEW_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010190 install_element (RESTRICTED_NODE, &show_bgp_rsclient_summary_cmd);
10191 install_element (RESTRICTED_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
10192 install_element (RESTRICTED_NODE, &show_bgp_instance_rsclient_summary_cmd);
10193 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010194 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd);
10195 install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000010196 install_element (ENABLE_NODE, &show_bgp_rsclient_summary_cmd);
10197 install_element (ENABLE_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
10198 install_element (ENABLE_NODE, &show_bgp_instance_rsclient_summary_cmd);
10199 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
Michael Lambert95cbbd22010-07-23 14:43:04 -040010200 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd);
10201 install_element (ENABLE_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd);
paulfee0f4c2004-09-13 05:12:46 +000010202#endif /* HAVE_IPV6 */
10203
paul718e3742002-12-13 20:15:29 +000010204 /* "show ip bgp paths" commands. */
10205 install_element (VIEW_NODE, &show_ip_bgp_paths_cmd);
10206 install_element (VIEW_NODE, &show_ip_bgp_ipv4_paths_cmd);
10207 install_element (ENABLE_NODE, &show_ip_bgp_paths_cmd);
10208 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_paths_cmd);
10209
10210 /* "show ip bgp community" commands. */
10211 install_element (VIEW_NODE, &show_ip_bgp_community_info_cmd);
10212 install_element (ENABLE_NODE, &show_ip_bgp_community_info_cmd);
10213
10214 /* "show ip bgp attribute-info" commands. */
10215 install_element (VIEW_NODE, &show_ip_bgp_attr_info_cmd);
10216 install_element (ENABLE_NODE, &show_ip_bgp_attr_info_cmd);
10217
10218 /* "redistribute" commands. */
10219 install_element (BGP_NODE, &bgp_redistribute_ipv4_cmd);
10220 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_cmd);
10221 install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_cmd);
10222 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_cmd);
10223 install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_cmd);
10224 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_cmd);
10225 install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_metric_cmd);
10226 install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_rmap_cmd);
10227 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_metric_cmd);
10228 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_rmap_cmd);
10229#ifdef HAVE_IPV6
10230 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_cmd);
10231 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_cmd);
10232 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_cmd);
10233 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_cmd);
10234 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_cmd);
10235 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_cmd);
10236 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_metric_cmd);
10237 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_rmap_cmd);
10238 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_metric_cmd);
10239 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_rmap_cmd);
10240#endif /* HAVE_IPV6 */
10241
Nick Hilliardfa411a22011-03-23 15:33:17 +000010242 /* ttl_security commands */
10243 install_element (BGP_NODE, &neighbor_ttl_security_cmd);
10244 install_element (BGP_NODE, &no_neighbor_ttl_security_cmd);
10245
Paul Jakma4bf6a362006-03-30 14:05:23 +000010246 /* "show bgp memory" commands. */
10247 install_element (VIEW_NODE, &show_bgp_memory_cmd);
Paul Jakma62687ff2008-08-23 14:27:06 +010010248 install_element (RESTRICTED_NODE, &show_bgp_memory_cmd);
Paul Jakma4bf6a362006-03-30 14:05:23 +000010249 install_element (ENABLE_NODE, &show_bgp_memory_cmd);
10250
Michael Lamberte0081f72008-11-16 20:12:04 +000010251 /* "show bgp views" commands. */
10252 install_element (VIEW_NODE, &show_bgp_views_cmd);
10253 install_element (RESTRICTED_NODE, &show_bgp_views_cmd);
10254 install_element (ENABLE_NODE, &show_bgp_views_cmd);
10255
paul718e3742002-12-13 20:15:29 +000010256 /* Community-list. */
10257 community_list_vty ();
10258}
David Lamparter6b0655a2014-06-04 06:53:35 +020010259
paul718e3742002-12-13 20:15:29 +000010260#include "memory.h"
10261#include "bgp_regex.h"
10262#include "bgp_clist.h"
10263#include "bgp_ecommunity.h"
10264
10265/* VTY functions. */
10266
10267/* Direction value to string conversion. */
paul94f2b392005-06-28 12:44:16 +000010268static const char *
paul718e3742002-12-13 20:15:29 +000010269community_direct_str (int direct)
10270{
10271 switch (direct)
10272 {
10273 case COMMUNITY_DENY:
10274 return "deny";
paul718e3742002-12-13 20:15:29 +000010275 case COMMUNITY_PERMIT:
10276 return "permit";
paul718e3742002-12-13 20:15:29 +000010277 default:
10278 return "unknown";
paul718e3742002-12-13 20:15:29 +000010279 }
10280}
10281
10282/* Display error string. */
paul94f2b392005-06-28 12:44:16 +000010283static void
paul718e3742002-12-13 20:15:29 +000010284community_list_perror (struct vty *vty, int ret)
10285{
10286 switch (ret)
10287 {
10288 case COMMUNITY_LIST_ERR_CANT_FIND_LIST:
Denis Ovsienkob7292942010-12-08 18:51:37 +030010289 vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000010290 break;
10291 case COMMUNITY_LIST_ERR_MALFORMED_VAL:
10292 vty_out (vty, "%% Malformed community-list value%s", VTY_NEWLINE);
10293 break;
10294 case COMMUNITY_LIST_ERR_STANDARD_CONFLICT:
10295 vty_out (vty, "%% Community name conflict, previously defined as standard community%s", VTY_NEWLINE);
10296 break;
10297 case COMMUNITY_LIST_ERR_EXPANDED_CONFLICT:
10298 vty_out (vty, "%% Community name conflict, previously defined as expanded community%s", VTY_NEWLINE);
10299 break;
10300 }
10301}
10302
10303/* VTY interface for community_set() function. */
paul94f2b392005-06-28 12:44:16 +000010304static int
paulfd79ac92004-10-13 05:06:08 +000010305community_list_set_vty (struct vty *vty, int argc, const char **argv,
10306 int style, int reject_all_digit_name)
paul718e3742002-12-13 20:15:29 +000010307{
10308 int ret;
10309 int direct;
10310 char *str;
10311
10312 /* Check the list type. */
10313 if (strncmp (argv[1], "p", 1) == 0)
10314 direct = COMMUNITY_PERMIT;
10315 else if (strncmp (argv[1], "d", 1) == 0)
10316 direct = COMMUNITY_DENY;
10317 else
10318 {
10319 vty_out (vty, "%% Matching condition must be permit or deny%s",
10320 VTY_NEWLINE);
10321 return CMD_WARNING;
10322 }
10323
10324 /* All digit name check. */
10325 if (reject_all_digit_name && all_digit (argv[0]))
10326 {
10327 vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE);
10328 return CMD_WARNING;
10329 }
10330
10331 /* Concat community string argument. */
10332 if (argc > 1)
10333 str = argv_concat (argv, argc, 2);
10334 else
10335 str = NULL;
10336
10337 /* When community_list_set() return nevetive value, it means
10338 malformed community string. */
10339 ret = community_list_set (bgp_clist, argv[0], str, direct, style);
10340
10341 /* Free temporary community list string allocated by
10342 argv_concat(). */
10343 if (str)
10344 XFREE (MTYPE_TMP, str);
10345
10346 if (ret < 0)
10347 {
10348 /* Display error string. */
10349 community_list_perror (vty, ret);
10350 return CMD_WARNING;
10351 }
10352
10353 return CMD_SUCCESS;
10354}
10355
paul718e3742002-12-13 20:15:29 +000010356/* Communiyt-list entry delete. */
paul94f2b392005-06-28 12:44:16 +000010357static int
hassofee6e4e2005-02-02 16:29:31 +000010358community_list_unset_vty (struct vty *vty, int argc, const char **argv,
10359 int style)
paul718e3742002-12-13 20:15:29 +000010360{
10361 int ret;
hassofee6e4e2005-02-02 16:29:31 +000010362 int direct = 0;
10363 char *str = NULL;
paul718e3742002-12-13 20:15:29 +000010364
hassofee6e4e2005-02-02 16:29:31 +000010365 if (argc > 1)
paul718e3742002-12-13 20:15:29 +000010366 {
hassofee6e4e2005-02-02 16:29:31 +000010367 /* Check the list direct. */
10368 if (strncmp (argv[1], "p", 1) == 0)
10369 direct = COMMUNITY_PERMIT;
10370 else if (strncmp (argv[1], "d", 1) == 0)
10371 direct = COMMUNITY_DENY;
10372 else
10373 {
10374 vty_out (vty, "%% Matching condition must be permit or deny%s",
10375 VTY_NEWLINE);
10376 return CMD_WARNING;
10377 }
paul718e3742002-12-13 20:15:29 +000010378
hassofee6e4e2005-02-02 16:29:31 +000010379 /* Concat community string argument. */
10380 str = argv_concat (argv, argc, 2);
10381 }
paul718e3742002-12-13 20:15:29 +000010382
10383 /* Unset community list. */
10384 ret = community_list_unset (bgp_clist, argv[0], str, direct, style);
10385
10386 /* Free temporary community list string allocated by
10387 argv_concat(). */
hassofee6e4e2005-02-02 16:29:31 +000010388 if (str)
10389 XFREE (MTYPE_TMP, str);
paul718e3742002-12-13 20:15:29 +000010390
10391 if (ret < 0)
10392 {
10393 community_list_perror (vty, ret);
10394 return CMD_WARNING;
10395 }
10396
10397 return CMD_SUCCESS;
10398}
10399
10400/* "community-list" keyword help string. */
10401#define COMMUNITY_LIST_STR "Add a community list entry\n"
10402#define COMMUNITY_VAL_STR "Community number in aa:nn format or internet|local-AS|no-advertise|no-export\n"
10403
paul718e3742002-12-13 20:15:29 +000010404DEFUN (ip_community_list_standard,
10405 ip_community_list_standard_cmd,
10406 "ip community-list <1-99> (deny|permit) .AA:NN",
10407 IP_STR
10408 COMMUNITY_LIST_STR
10409 "Community list number (standard)\n"
10410 "Specify community to reject\n"
10411 "Specify community to accept\n"
10412 COMMUNITY_VAL_STR)
10413{
10414 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0);
10415}
10416
10417ALIAS (ip_community_list_standard,
10418 ip_community_list_standard2_cmd,
10419 "ip community-list <1-99> (deny|permit)",
10420 IP_STR
10421 COMMUNITY_LIST_STR
10422 "Community list number (standard)\n"
10423 "Specify community to reject\n"
10424 "Specify community to accept\n")
10425
10426DEFUN (ip_community_list_expanded,
10427 ip_community_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000010428 "ip community-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000010429 IP_STR
10430 COMMUNITY_LIST_STR
10431 "Community list number (expanded)\n"
10432 "Specify community to reject\n"
10433 "Specify community to accept\n"
10434 "An ordered list as a regular-expression\n")
10435{
10436 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0);
10437}
10438
10439DEFUN (ip_community_list_name_standard,
10440 ip_community_list_name_standard_cmd,
10441 "ip community-list standard WORD (deny|permit) .AA:NN",
10442 IP_STR
10443 COMMUNITY_LIST_STR
10444 "Add a standard community-list entry\n"
10445 "Community list name\n"
10446 "Specify community to reject\n"
10447 "Specify community to accept\n"
10448 COMMUNITY_VAL_STR)
10449{
10450 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1);
10451}
10452
10453ALIAS (ip_community_list_name_standard,
10454 ip_community_list_name_standard2_cmd,
10455 "ip community-list standard WORD (deny|permit)",
10456 IP_STR
10457 COMMUNITY_LIST_STR
10458 "Add a standard community-list entry\n"
10459 "Community list name\n"
10460 "Specify community to reject\n"
10461 "Specify community to accept\n")
10462
10463DEFUN (ip_community_list_name_expanded,
10464 ip_community_list_name_expanded_cmd,
10465 "ip community-list expanded WORD (deny|permit) .LINE",
10466 IP_STR
10467 COMMUNITY_LIST_STR
10468 "Add an expanded community-list entry\n"
10469 "Community list name\n"
10470 "Specify community to reject\n"
10471 "Specify community to accept\n"
10472 "An ordered list as a regular-expression\n")
10473{
10474 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1);
10475}
10476
hassofee6e4e2005-02-02 16:29:31 +000010477DEFUN (no_ip_community_list_standard_all,
10478 no_ip_community_list_standard_all_cmd,
10479 "no ip community-list <1-99>",
paul718e3742002-12-13 20:15:29 +000010480 NO_STR
10481 IP_STR
10482 COMMUNITY_LIST_STR
hassofee6e4e2005-02-02 16:29:31 +000010483 "Community list number (standard)\n")
paul718e3742002-12-13 20:15:29 +000010484{
hassofee6e4e2005-02-02 16:29:31 +000010485 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
paul718e3742002-12-13 20:15:29 +000010486}
10487
hassofee6e4e2005-02-02 16:29:31 +000010488DEFUN (no_ip_community_list_expanded_all,
10489 no_ip_community_list_expanded_all_cmd,
10490 "no ip community-list <100-500>",
10491 NO_STR
10492 IP_STR
10493 COMMUNITY_LIST_STR
10494 "Community list number (expanded)\n")
10495{
10496 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
10497}
10498
10499DEFUN (no_ip_community_list_name_standard_all,
10500 no_ip_community_list_name_standard_all_cmd,
10501 "no ip community-list standard WORD",
paul718e3742002-12-13 20:15:29 +000010502 NO_STR
10503 IP_STR
10504 COMMUNITY_LIST_STR
10505 "Add a standard community-list entry\n"
paul718e3742002-12-13 20:15:29 +000010506 "Community list name\n")
10507{
hassofee6e4e2005-02-02 16:29:31 +000010508 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
paul718e3742002-12-13 20:15:29 +000010509}
10510
hassofee6e4e2005-02-02 16:29:31 +000010511DEFUN (no_ip_community_list_name_expanded_all,
10512 no_ip_community_list_name_expanded_all_cmd,
10513 "no ip community-list expanded WORD",
paul718e3742002-12-13 20:15:29 +000010514 NO_STR
10515 IP_STR
10516 COMMUNITY_LIST_STR
hassofee6e4e2005-02-02 16:29:31 +000010517 "Add an expanded community-list entry\n"
10518 "Community list name\n")
paul718e3742002-12-13 20:15:29 +000010519{
hassofee6e4e2005-02-02 16:29:31 +000010520 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
paul718e3742002-12-13 20:15:29 +000010521}
10522
10523DEFUN (no_ip_community_list_standard,
10524 no_ip_community_list_standard_cmd,
10525 "no ip community-list <1-99> (deny|permit) .AA:NN",
10526 NO_STR
10527 IP_STR
10528 COMMUNITY_LIST_STR
10529 "Community list number (standard)\n"
10530 "Specify community to reject\n"
10531 "Specify community to accept\n"
10532 COMMUNITY_VAL_STR)
10533{
10534 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
10535}
10536
10537DEFUN (no_ip_community_list_expanded,
10538 no_ip_community_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000010539 "no ip community-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000010540 NO_STR
10541 IP_STR
10542 COMMUNITY_LIST_STR
10543 "Community list number (expanded)\n"
10544 "Specify community to reject\n"
10545 "Specify community to accept\n"
10546 "An ordered list as a regular-expression\n")
10547{
10548 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
10549}
10550
10551DEFUN (no_ip_community_list_name_standard,
10552 no_ip_community_list_name_standard_cmd,
10553 "no ip community-list standard WORD (deny|permit) .AA:NN",
10554 NO_STR
10555 IP_STR
10556 COMMUNITY_LIST_STR
10557 "Specify a standard community-list\n"
10558 "Community list name\n"
10559 "Specify community to reject\n"
10560 "Specify community to accept\n"
10561 COMMUNITY_VAL_STR)
10562{
10563 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
10564}
10565
10566DEFUN (no_ip_community_list_name_expanded,
10567 no_ip_community_list_name_expanded_cmd,
10568 "no ip community-list expanded WORD (deny|permit) .LINE",
10569 NO_STR
10570 IP_STR
10571 COMMUNITY_LIST_STR
10572 "Specify an expanded community-list\n"
10573 "Community list name\n"
10574 "Specify community to reject\n"
10575 "Specify community to accept\n"
10576 "An ordered list as a regular-expression\n")
10577{
10578 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
10579}
10580
paul94f2b392005-06-28 12:44:16 +000010581static void
paul718e3742002-12-13 20:15:29 +000010582community_list_show (struct vty *vty, struct community_list *list)
10583{
10584 struct community_entry *entry;
10585
10586 for (entry = list->head; entry; entry = entry->next)
10587 {
10588 if (entry == list->head)
10589 {
10590 if (all_digit (list->name))
10591 vty_out (vty, "Community %s list %s%s",
10592 entry->style == COMMUNITY_LIST_STANDARD ?
10593 "standard" : "(expanded) access",
10594 list->name, VTY_NEWLINE);
10595 else
10596 vty_out (vty, "Named Community %s list %s%s",
10597 entry->style == COMMUNITY_LIST_STANDARD ?
10598 "standard" : "expanded",
10599 list->name, VTY_NEWLINE);
10600 }
10601 if (entry->any)
10602 vty_out (vty, " %s%s",
10603 community_direct_str (entry->direct), VTY_NEWLINE);
10604 else
10605 vty_out (vty, " %s %s%s",
10606 community_direct_str (entry->direct),
10607 entry->style == COMMUNITY_LIST_STANDARD
10608 ? community_str (entry->u.com) : entry->config,
10609 VTY_NEWLINE);
10610 }
10611}
10612
10613DEFUN (show_ip_community_list,
10614 show_ip_community_list_cmd,
10615 "show ip community-list",
10616 SHOW_STR
10617 IP_STR
10618 "List community-list\n")
10619{
10620 struct community_list *list;
10621 struct community_list_master *cm;
10622
hassofee6e4e2005-02-02 16:29:31 +000010623 cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000010624 if (! cm)
10625 return CMD_SUCCESS;
10626
10627 for (list = cm->num.head; list; list = list->next)
10628 community_list_show (vty, list);
10629
10630 for (list = cm->str.head; list; list = list->next)
10631 community_list_show (vty, list);
10632
10633 return CMD_SUCCESS;
10634}
10635
10636DEFUN (show_ip_community_list_arg,
10637 show_ip_community_list_arg_cmd,
hassofee6e4e2005-02-02 16:29:31 +000010638 "show ip community-list (<1-500>|WORD)",
paul718e3742002-12-13 20:15:29 +000010639 SHOW_STR
10640 IP_STR
10641 "List community-list\n"
10642 "Community-list number\n"
10643 "Community-list name\n")
10644{
10645 struct community_list *list;
10646
hassofee6e4e2005-02-02 16:29:31 +000010647 list = community_list_lookup (bgp_clist, argv[0], COMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000010648 if (! list)
10649 {
Denis Ovsienkob7292942010-12-08 18:51:37 +030010650 vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000010651 return CMD_WARNING;
10652 }
10653
10654 community_list_show (vty, list);
10655
10656 return CMD_SUCCESS;
10657}
David Lamparter6b0655a2014-06-04 06:53:35 +020010658
paul94f2b392005-06-28 12:44:16 +000010659static int
paulfd79ac92004-10-13 05:06:08 +000010660extcommunity_list_set_vty (struct vty *vty, int argc, const char **argv,
10661 int style, int reject_all_digit_name)
paul718e3742002-12-13 20:15:29 +000010662{
10663 int ret;
10664 int direct;
10665 char *str;
10666
10667 /* Check the list type. */
10668 if (strncmp (argv[1], "p", 1) == 0)
10669 direct = COMMUNITY_PERMIT;
10670 else if (strncmp (argv[1], "d", 1) == 0)
10671 direct = COMMUNITY_DENY;
10672 else
10673 {
10674 vty_out (vty, "%% Matching condition must be permit or deny%s",
10675 VTY_NEWLINE);
10676 return CMD_WARNING;
10677 }
10678
10679 /* All digit name check. */
10680 if (reject_all_digit_name && all_digit (argv[0]))
10681 {
10682 vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE);
10683 return CMD_WARNING;
10684 }
10685
10686 /* Concat community string argument. */
10687 if (argc > 1)
10688 str = argv_concat (argv, argc, 2);
10689 else
10690 str = NULL;
10691
10692 ret = extcommunity_list_set (bgp_clist, argv[0], str, direct, style);
10693
10694 /* Free temporary community list string allocated by
10695 argv_concat(). */
10696 if (str)
10697 XFREE (MTYPE_TMP, str);
10698
10699 if (ret < 0)
10700 {
10701 community_list_perror (vty, ret);
10702 return CMD_WARNING;
10703 }
10704 return CMD_SUCCESS;
10705}
10706
paul94f2b392005-06-28 12:44:16 +000010707static int
hassofee6e4e2005-02-02 16:29:31 +000010708extcommunity_list_unset_vty (struct vty *vty, int argc, const char **argv,
10709 int style)
paul718e3742002-12-13 20:15:29 +000010710{
10711 int ret;
hassofee6e4e2005-02-02 16:29:31 +000010712 int direct = 0;
10713 char *str = NULL;
paul718e3742002-12-13 20:15:29 +000010714
hassofee6e4e2005-02-02 16:29:31 +000010715 if (argc > 1)
paul718e3742002-12-13 20:15:29 +000010716 {
hassofee6e4e2005-02-02 16:29:31 +000010717 /* Check the list direct. */
10718 if (strncmp (argv[1], "p", 1) == 0)
10719 direct = COMMUNITY_PERMIT;
10720 else if (strncmp (argv[1], "d", 1) == 0)
10721 direct = COMMUNITY_DENY;
10722 else
10723 {
10724 vty_out (vty, "%% Matching condition must be permit or deny%s",
10725 VTY_NEWLINE);
10726 return CMD_WARNING;
10727 }
10728
10729 /* Concat community string argument. */
10730 str = argv_concat (argv, argc, 2);
paul718e3742002-12-13 20:15:29 +000010731 }
paul718e3742002-12-13 20:15:29 +000010732
10733 /* Unset community list. */
10734 ret = extcommunity_list_unset (bgp_clist, argv[0], str, direct, style);
10735
10736 /* Free temporary community list string allocated by
10737 argv_concat(). */
hassofee6e4e2005-02-02 16:29:31 +000010738 if (str)
10739 XFREE (MTYPE_TMP, str);
paul718e3742002-12-13 20:15:29 +000010740
10741 if (ret < 0)
10742 {
10743 community_list_perror (vty, ret);
10744 return CMD_WARNING;
10745 }
10746
10747 return CMD_SUCCESS;
10748}
10749
10750/* "extcommunity-list" keyword help string. */
10751#define EXTCOMMUNITY_LIST_STR "Add a extended community list entry\n"
10752#define EXTCOMMUNITY_VAL_STR "Extended community attribute in 'rt aa:nn_or_IPaddr:nn' OR 'soo aa:nn_or_IPaddr:nn' format\n"
10753
10754DEFUN (ip_extcommunity_list_standard,
10755 ip_extcommunity_list_standard_cmd,
10756 "ip extcommunity-list <1-99> (deny|permit) .AA:NN",
10757 IP_STR
10758 EXTCOMMUNITY_LIST_STR
10759 "Extended Community list number (standard)\n"
10760 "Specify community to reject\n"
10761 "Specify community to accept\n"
10762 EXTCOMMUNITY_VAL_STR)
10763{
10764 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0);
10765}
10766
10767ALIAS (ip_extcommunity_list_standard,
10768 ip_extcommunity_list_standard2_cmd,
10769 "ip extcommunity-list <1-99> (deny|permit)",
10770 IP_STR
10771 EXTCOMMUNITY_LIST_STR
10772 "Extended Community list number (standard)\n"
10773 "Specify community to reject\n"
10774 "Specify community to accept\n")
10775
10776DEFUN (ip_extcommunity_list_expanded,
10777 ip_extcommunity_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000010778 "ip extcommunity-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000010779 IP_STR
10780 EXTCOMMUNITY_LIST_STR
10781 "Extended Community list number (expanded)\n"
10782 "Specify community to reject\n"
10783 "Specify community to accept\n"
10784 "An ordered list as a regular-expression\n")
10785{
10786 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0);
10787}
10788
10789DEFUN (ip_extcommunity_list_name_standard,
10790 ip_extcommunity_list_name_standard_cmd,
10791 "ip extcommunity-list standard WORD (deny|permit) .AA:NN",
10792 IP_STR
10793 EXTCOMMUNITY_LIST_STR
10794 "Specify standard extcommunity-list\n"
10795 "Extended Community list name\n"
10796 "Specify community to reject\n"
10797 "Specify community to accept\n"
10798 EXTCOMMUNITY_VAL_STR)
10799{
10800 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1);
10801}
10802
10803ALIAS (ip_extcommunity_list_name_standard,
10804 ip_extcommunity_list_name_standard2_cmd,
10805 "ip extcommunity-list standard WORD (deny|permit)",
10806 IP_STR
10807 EXTCOMMUNITY_LIST_STR
10808 "Specify standard extcommunity-list\n"
10809 "Extended Community list name\n"
10810 "Specify community to reject\n"
10811 "Specify community to accept\n")
10812
10813DEFUN (ip_extcommunity_list_name_expanded,
10814 ip_extcommunity_list_name_expanded_cmd,
10815 "ip extcommunity-list expanded WORD (deny|permit) .LINE",
10816 IP_STR
10817 EXTCOMMUNITY_LIST_STR
10818 "Specify expanded extcommunity-list\n"
10819 "Extended Community list name\n"
10820 "Specify community to reject\n"
10821 "Specify community to accept\n"
10822 "An ordered list as a regular-expression\n")
10823{
10824 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1);
10825}
10826
hassofee6e4e2005-02-02 16:29:31 +000010827DEFUN (no_ip_extcommunity_list_standard_all,
10828 no_ip_extcommunity_list_standard_all_cmd,
10829 "no ip extcommunity-list <1-99>",
paul718e3742002-12-13 20:15:29 +000010830 NO_STR
10831 IP_STR
10832 EXTCOMMUNITY_LIST_STR
hassofee6e4e2005-02-02 16:29:31 +000010833 "Extended Community list number (standard)\n")
paul718e3742002-12-13 20:15:29 +000010834{
hassofee6e4e2005-02-02 16:29:31 +000010835 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
paul718e3742002-12-13 20:15:29 +000010836}
10837
hassofee6e4e2005-02-02 16:29:31 +000010838DEFUN (no_ip_extcommunity_list_expanded_all,
10839 no_ip_extcommunity_list_expanded_all_cmd,
10840 "no ip extcommunity-list <100-500>",
10841 NO_STR
10842 IP_STR
10843 EXTCOMMUNITY_LIST_STR
10844 "Extended Community list number (expanded)\n")
10845{
10846 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
10847}
10848
10849DEFUN (no_ip_extcommunity_list_name_standard_all,
10850 no_ip_extcommunity_list_name_standard_all_cmd,
10851 "no ip extcommunity-list standard WORD",
paul718e3742002-12-13 20:15:29 +000010852 NO_STR
10853 IP_STR
10854 EXTCOMMUNITY_LIST_STR
10855 "Specify standard extcommunity-list\n"
hassofee6e4e2005-02-02 16:29:31 +000010856 "Extended Community list name\n")
10857{
10858 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
10859}
10860
10861DEFUN (no_ip_extcommunity_list_name_expanded_all,
10862 no_ip_extcommunity_list_name_expanded_all_cmd,
10863 "no ip extcommunity-list expanded WORD",
10864 NO_STR
10865 IP_STR
10866 EXTCOMMUNITY_LIST_STR
paul718e3742002-12-13 20:15:29 +000010867 "Specify expanded extcommunity-list\n"
10868 "Extended Community list name\n")
10869{
hassofee6e4e2005-02-02 16:29:31 +000010870 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
paul718e3742002-12-13 20:15:29 +000010871}
10872
10873DEFUN (no_ip_extcommunity_list_standard,
10874 no_ip_extcommunity_list_standard_cmd,
10875 "no ip extcommunity-list <1-99> (deny|permit) .AA:NN",
10876 NO_STR
10877 IP_STR
10878 EXTCOMMUNITY_LIST_STR
10879 "Extended Community list number (standard)\n"
10880 "Specify community to reject\n"
10881 "Specify community to accept\n"
10882 EXTCOMMUNITY_VAL_STR)
10883{
10884 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
10885}
10886
10887DEFUN (no_ip_extcommunity_list_expanded,
10888 no_ip_extcommunity_list_expanded_cmd,
hassofee6e4e2005-02-02 16:29:31 +000010889 "no ip extcommunity-list <100-500> (deny|permit) .LINE",
paul718e3742002-12-13 20:15:29 +000010890 NO_STR
10891 IP_STR
10892 EXTCOMMUNITY_LIST_STR
10893 "Extended Community list number (expanded)\n"
10894 "Specify community to reject\n"
10895 "Specify community to accept\n"
10896 "An ordered list as a regular-expression\n")
10897{
10898 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
10899}
10900
10901DEFUN (no_ip_extcommunity_list_name_standard,
10902 no_ip_extcommunity_list_name_standard_cmd,
10903 "no ip extcommunity-list standard WORD (deny|permit) .AA:NN",
10904 NO_STR
10905 IP_STR
10906 EXTCOMMUNITY_LIST_STR
10907 "Specify standard extcommunity-list\n"
10908 "Extended Community list name\n"
10909 "Specify community to reject\n"
10910 "Specify community to accept\n"
10911 EXTCOMMUNITY_VAL_STR)
10912{
10913 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
10914}
10915
10916DEFUN (no_ip_extcommunity_list_name_expanded,
10917 no_ip_extcommunity_list_name_expanded_cmd,
10918 "no ip extcommunity-list expanded WORD (deny|permit) .LINE",
10919 NO_STR
10920 IP_STR
10921 EXTCOMMUNITY_LIST_STR
10922 "Specify expanded extcommunity-list\n"
10923 "Community list name\n"
10924 "Specify community to reject\n"
10925 "Specify community to accept\n"
10926 "An ordered list as a regular-expression\n")
10927{
10928 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
10929}
10930
paul94f2b392005-06-28 12:44:16 +000010931static void
paul718e3742002-12-13 20:15:29 +000010932extcommunity_list_show (struct vty *vty, struct community_list *list)
10933{
10934 struct community_entry *entry;
10935
10936 for (entry = list->head; entry; entry = entry->next)
10937 {
10938 if (entry == list->head)
10939 {
10940 if (all_digit (list->name))
10941 vty_out (vty, "Extended community %s list %s%s",
10942 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
10943 "standard" : "(expanded) access",
10944 list->name, VTY_NEWLINE);
10945 else
10946 vty_out (vty, "Named extended community %s list %s%s",
10947 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
10948 "standard" : "expanded",
10949 list->name, VTY_NEWLINE);
10950 }
10951 if (entry->any)
10952 vty_out (vty, " %s%s",
10953 community_direct_str (entry->direct), VTY_NEWLINE);
10954 else
10955 vty_out (vty, " %s %s%s",
10956 community_direct_str (entry->direct),
10957 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
10958 entry->u.ecom->str : entry->config,
10959 VTY_NEWLINE);
10960 }
10961}
10962
10963DEFUN (show_ip_extcommunity_list,
10964 show_ip_extcommunity_list_cmd,
10965 "show ip extcommunity-list",
10966 SHOW_STR
10967 IP_STR
10968 "List extended-community list\n")
10969{
10970 struct community_list *list;
10971 struct community_list_master *cm;
10972
hassofee6e4e2005-02-02 16:29:31 +000010973 cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000010974 if (! cm)
10975 return CMD_SUCCESS;
10976
10977 for (list = cm->num.head; list; list = list->next)
10978 extcommunity_list_show (vty, list);
10979
10980 for (list = cm->str.head; list; list = list->next)
10981 extcommunity_list_show (vty, list);
10982
10983 return CMD_SUCCESS;
10984}
10985
10986DEFUN (show_ip_extcommunity_list_arg,
10987 show_ip_extcommunity_list_arg_cmd,
hassofee6e4e2005-02-02 16:29:31 +000010988 "show ip extcommunity-list (<1-500>|WORD)",
paul718e3742002-12-13 20:15:29 +000010989 SHOW_STR
10990 IP_STR
10991 "List extended-community list\n"
10992 "Extcommunity-list number\n"
10993 "Extcommunity-list name\n")
10994{
10995 struct community_list *list;
10996
hassofee6e4e2005-02-02 16:29:31 +000010997 list = community_list_lookup (bgp_clist, argv[0], EXTCOMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000010998 if (! list)
10999 {
Denis Ovsienkob7292942010-12-08 18:51:37 +030011000 vty_out (vty, "%% Can't find extcommunity-list%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000011001 return CMD_WARNING;
11002 }
11003
11004 extcommunity_list_show (vty, list);
11005
11006 return CMD_SUCCESS;
11007}
David Lamparter6b0655a2014-06-04 06:53:35 +020011008
paul718e3742002-12-13 20:15:29 +000011009/* Return configuration string of community-list entry. */
paulfd79ac92004-10-13 05:06:08 +000011010static const char *
paul718e3742002-12-13 20:15:29 +000011011community_list_config_str (struct community_entry *entry)
11012{
paulfd79ac92004-10-13 05:06:08 +000011013 const char *str;
paul718e3742002-12-13 20:15:29 +000011014
11015 if (entry->any)
11016 str = "";
11017 else
11018 {
11019 if (entry->style == COMMUNITY_LIST_STANDARD)
11020 str = community_str (entry->u.com);
11021 else
11022 str = entry->config;
11023 }
11024 return str;
11025}
11026
11027/* Display community-list and extcommunity-list configuration. */
paul94f2b392005-06-28 12:44:16 +000011028static int
paul718e3742002-12-13 20:15:29 +000011029community_list_config_write (struct vty *vty)
11030{
11031 struct community_list *list;
11032 struct community_entry *entry;
11033 struct community_list_master *cm;
11034 int write = 0;
11035
11036 /* Community-list. */
hassofee6e4e2005-02-02 16:29:31 +000011037 cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011038
11039 for (list = cm->num.head; list; list = list->next)
11040 for (entry = list->head; entry; entry = entry->next)
11041 {
hassofee6e4e2005-02-02 16:29:31 +000011042 vty_out (vty, "ip community-list %s %s %s%s",
11043 list->name, community_direct_str (entry->direct),
11044 community_list_config_str (entry),
11045 VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000011046 write++;
11047 }
11048 for (list = cm->str.head; list; list = list->next)
11049 for (entry = list->head; entry; entry = entry->next)
11050 {
11051 vty_out (vty, "ip community-list %s %s %s %s%s",
11052 entry->style == COMMUNITY_LIST_STANDARD
11053 ? "standard" : "expanded",
11054 list->name, community_direct_str (entry->direct),
11055 community_list_config_str (entry),
11056 VTY_NEWLINE);
11057 write++;
11058 }
11059
11060 /* Extcommunity-list. */
hassofee6e4e2005-02-02 16:29:31 +000011061 cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER);
paul718e3742002-12-13 20:15:29 +000011062
11063 for (list = cm->num.head; list; list = list->next)
11064 for (entry = list->head; entry; entry = entry->next)
11065 {
hassofee6e4e2005-02-02 16:29:31 +000011066 vty_out (vty, "ip extcommunity-list %s %s %s%s",
11067 list->name, community_direct_str (entry->direct),
11068 community_list_config_str (entry), VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +000011069 write++;
11070 }
11071 for (list = cm->str.head; list; list = list->next)
11072 for (entry = list->head; entry; entry = entry->next)
11073 {
11074 vty_out (vty, "ip extcommunity-list %s %s %s %s%s",
11075 entry->style == EXTCOMMUNITY_LIST_STANDARD
11076 ? "standard" : "expanded",
11077 list->name, community_direct_str (entry->direct),
11078 community_list_config_str (entry), VTY_NEWLINE);
11079 write++;
11080 }
11081 return write;
11082}
11083
Stephen Hemminger7fc626d2008-12-01 11:10:34 -080011084static struct cmd_node community_list_node =
paul718e3742002-12-13 20:15:29 +000011085{
11086 COMMUNITY_LIST_NODE,
11087 "",
11088 1 /* Export to vtysh. */
11089};
11090
paul94f2b392005-06-28 12:44:16 +000011091static void
11092community_list_vty (void)
paul718e3742002-12-13 20:15:29 +000011093{
11094 install_node (&community_list_node, community_list_config_write);
11095
11096 /* Community-list. */
paul718e3742002-12-13 20:15:29 +000011097 install_element (CONFIG_NODE, &ip_community_list_standard_cmd);
11098 install_element (CONFIG_NODE, &ip_community_list_standard2_cmd);
11099 install_element (CONFIG_NODE, &ip_community_list_expanded_cmd);
11100 install_element (CONFIG_NODE, &ip_community_list_name_standard_cmd);
11101 install_element (CONFIG_NODE, &ip_community_list_name_standard2_cmd);
11102 install_element (CONFIG_NODE, &ip_community_list_name_expanded_cmd);
hassofee6e4e2005-02-02 16:29:31 +000011103 install_element (CONFIG_NODE, &no_ip_community_list_standard_all_cmd);
11104 install_element (CONFIG_NODE, &no_ip_community_list_expanded_all_cmd);
11105 install_element (CONFIG_NODE, &no_ip_community_list_name_standard_all_cmd);
11106 install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_all_cmd);
paul718e3742002-12-13 20:15:29 +000011107 install_element (CONFIG_NODE, &no_ip_community_list_standard_cmd);
11108 install_element (CONFIG_NODE, &no_ip_community_list_expanded_cmd);
11109 install_element (CONFIG_NODE, &no_ip_community_list_name_standard_cmd);
11110 install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_cmd);
11111 install_element (VIEW_NODE, &show_ip_community_list_cmd);
11112 install_element (VIEW_NODE, &show_ip_community_list_arg_cmd);
11113 install_element (ENABLE_NODE, &show_ip_community_list_cmd);
11114 install_element (ENABLE_NODE, &show_ip_community_list_arg_cmd);
11115
11116 /* Extcommunity-list. */
11117 install_element (CONFIG_NODE, &ip_extcommunity_list_standard_cmd);
11118 install_element (CONFIG_NODE, &ip_extcommunity_list_standard2_cmd);
11119 install_element (CONFIG_NODE, &ip_extcommunity_list_expanded_cmd);
11120 install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard_cmd);
11121 install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard2_cmd);
11122 install_element (CONFIG_NODE, &ip_extcommunity_list_name_expanded_cmd);
hassofee6e4e2005-02-02 16:29:31 +000011123 install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_all_cmd);
11124 install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_all_cmd);
11125 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_all_cmd);
11126 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_all_cmd);
paul718e3742002-12-13 20:15:29 +000011127 install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_cmd);
11128 install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_cmd);
11129 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_cmd);
11130 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_cmd);
11131 install_element (VIEW_NODE, &show_ip_extcommunity_list_cmd);
11132 install_element (VIEW_NODE, &show_ip_extcommunity_list_arg_cmd);
11133 install_element (ENABLE_NODE, &show_ip_extcommunity_list_cmd);
11134 install_element (ENABLE_NODE, &show_ip_extcommunity_list_arg_cmd);
11135}