]> git.proxmox.com Git - mirror_frr.git/blame - bgpd/bgp_vty.c
Reduce the amount of time it takes to bring up a large number of peers
[mirror_frr.git] / bgpd / bgp_vty.c
CommitLineData
718e3744 1/* 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"
3b8b1855 31#include "memory.h"
4bf6a362 32#include "hash.h"
718e3744 33
34#include "bgpd/bgpd.h"
4bf6a362 35#include "bgpd/bgp_advertise.h"
718e3744 36#include "bgpd/bgp_attr.h"
37#include "bgpd/bgp_aspath.h"
38#include "bgpd/bgp_community.h"
4bf6a362
PJ
39#include "bgpd/bgp_ecommunity.h"
40#include "bgpd/bgp_damp.h"
718e3744 41#include "bgpd/bgp_debug.h"
e0701b79 42#include "bgpd/bgp_fsm.h"
718e3744 43#include "bgpd/bgp_mplsvpn.h"
4bf6a362 44#include "bgpd/bgp_nexthop.h"
718e3744 45#include "bgpd/bgp_open.h"
4bf6a362 46#include "bgpd/bgp_regex.h"
718e3744 47#include "bgpd/bgp_route.h"
48#include "bgpd/bgp_zebra.h"
fee0f4c6 49#include "bgpd/bgp_table.h"
94f2b392 50#include "bgpd/bgp_vty.h"
165b5fff 51#include "bgpd/bgp_mpath.h"
cb1faec9 52#include "bgpd/bgp_packet.h"
718e3744 53
18a6dce6 54extern struct in_addr router_id_zebra;
55
718e3744 56/* Utility function to get address family from current node. */
57afi_t
58bgp_node_afi (struct vty *vty)
59{
25ffbdc1 60 if (vty->node == BGP_IPV6_NODE || vty->node == BGP_IPV6M_NODE)
718e3744 61 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;
25ffbdc1 72 if (vty->node == BGP_IPV4M_NODE || vty->node == BGP_IPV6M_NODE)
718e3744 73 return SAFI_MULTICAST;
74 return SAFI_UNICAST;
75}
76
94f2b392 77static int
718e3744 78peer_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. */
94f2b392 96static struct peer *
fd79ac91 97peer_lookup_vty (struct vty *vty, const char *ip_str)
718e3744 98{
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 {
a80beece
DS
109 peer = peer_lookup_by_conf_if (bgp, ip_str);
110 if (!peer)
111 {
112 vty_out (vty, "%% Malformed address or name: %s%s", ip_str, VTY_NEWLINE);
113 return NULL;
114 }
718e3744 115 }
a80beece 116 else
718e3744 117 {
a80beece
DS
118 peer = peer_lookup (bgp, &su);
119 if (! peer)
120 {
121 vty_out (vty, "%% Specify remote-as or peer-group commands first%s",
122 VTY_NEWLINE);
123 return NULL;
124 }
718e3744 125 }
126 return peer;
127}
128
129/* Utility function for looking up peer or peer group. */
94f2b392 130static struct peer *
fd79ac91 131peer_and_group_lookup_vty (struct vty *vty, const char *peer_str)
718e3744 132{
133 int ret;
134 struct bgp *bgp;
135 union sockunion su;
136 struct peer *peer;
137 struct peer_group *group;
138
139 bgp = vty->index;
140
141 ret = str2sockunion (peer_str, &su);
142 if (ret == 0)
143 {
144 peer = peer_lookup (bgp, &su);
145 if (peer)
146 return peer;
147 }
148 else
149 {
a80beece
DS
150 peer = peer_lookup_by_conf_if (bgp, peer_str);
151 if (peer)
152 return peer;
153
718e3744 154 group = peer_group_lookup (bgp, peer_str);
155 if (group)
156 return group->conf;
157 }
158
159 vty_out (vty, "%% Specify remote-as or peer-group commands first%s",
160 VTY_NEWLINE);
161
162 return NULL;
163}
164
94f2b392 165static int
718e3744 166bgp_vty_return (struct vty *vty, int ret)
167{
fd79ac91 168 const char *str = NULL;
718e3744 169
170 switch (ret)
171 {
172 case BGP_ERR_INVALID_VALUE:
173 str = "Invalid value";
174 break;
175 case BGP_ERR_INVALID_FLAG:
176 str = "Invalid flag";
177 break;
178 case BGP_ERR_PEER_INACTIVE:
179 str = "Activate the neighbor for the address family first";
180 break;
181 case BGP_ERR_INVALID_FOR_PEER_GROUP_MEMBER:
182 str = "Invalid command for a peer-group member";
183 break;
184 case BGP_ERR_PEER_GROUP_SHUTDOWN:
185 str = "Peer-group has been shutdown. Activate the peer-group first";
186 break;
187 case BGP_ERR_PEER_GROUP_HAS_THE_FLAG:
188 str = "This peer is a peer-group member. Please change peer-group configuration";
189 break;
190 case BGP_ERR_PEER_FLAG_CONFLICT:
191 str = "Can't set override-capability and strict-capability-match at the same time";
192 break;
193 case BGP_ERR_PEER_GROUP_MEMBER_EXISTS:
194 str = "No activate for peergroup can be given only if peer-group has no members";
195 break;
196 case BGP_ERR_PEER_BELONGS_TO_GROUP:
197 str = "No activate for an individual peer-group member is invalid";
198 break;
199 case BGP_ERR_PEER_GROUP_AF_UNCONFIGURED:
200 str = "Activate the peer-group for the address family first";
201 break;
202 case BGP_ERR_PEER_GROUP_NO_REMOTE_AS:
203 str = "Specify remote-as or peer-group remote AS first";
204 break;
205 case BGP_ERR_PEER_GROUP_CANT_CHANGE:
206 str = "Cannot change the peer-group. Deconfigure first";
207 break;
208 case BGP_ERR_PEER_GROUP_MISMATCH:
209 str = "Cannot have different peer-group for the neighbor";
210 break;
211 case BGP_ERR_PEER_FILTER_CONFLICT:
212 str = "Prefix/distribute list can not co-exist";
213 break;
214 case BGP_ERR_NOT_INTERNAL_PEER:
215 str = "Invalid command. Not an internal neighbor";
216 break;
217 case BGP_ERR_REMOVE_PRIVATE_AS:
218 str = "Private AS cannot be removed for IBGP peers";
219 break;
220 case BGP_ERR_LOCAL_AS_ALLOWED_ONLY_FOR_EBGP:
221 str = "Local-AS allowed only for EBGP peers";
222 break;
223 case BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS:
224 str = "Cannot have local-as same as BGP AS number";
225 break;
0df7c91f
PJ
226 case BGP_ERR_TCPSIG_FAILED:
227 str = "Error while applying TCP-Sig to session(s)";
228 break;
fa411a21
NH
229 case BGP_ERR_NO_EBGP_MULTIHOP_WITH_TTLHACK:
230 str = "ebgp-multihop and ttl-security cannot be configured together";
231 break;
f5a4827d
SH
232 case BGP_ERR_NO_IBGP_WITH_TTLHACK:
233 str = "ttl-security only allowed for EBGP peers";
234 break;
718e3744 235 }
236 if (str)
237 {
238 vty_out (vty, "%% %s%s", str, VTY_NEWLINE);
239 return CMD_WARNING;
240 }
241 return CMD_SUCCESS;
242}
243
244/* BGP global configuration. */
245
246DEFUN (bgp_multiple_instance_func,
247 bgp_multiple_instance_cmd,
248 "bgp multiple-instance",
249 BGP_STR
250 "Enable bgp multiple instance\n")
251{
252 bgp_option_set (BGP_OPT_MULTIPLE_INSTANCE);
253 return CMD_SUCCESS;
254}
255
256DEFUN (no_bgp_multiple_instance,
257 no_bgp_multiple_instance_cmd,
258 "no bgp multiple-instance",
259 NO_STR
260 BGP_STR
261 "BGP multiple instance\n")
262{
263 int ret;
264
265 ret = bgp_option_unset (BGP_OPT_MULTIPLE_INSTANCE);
266 if (ret < 0)
267 {
268 vty_out (vty, "%% There are more than two BGP instances%s", VTY_NEWLINE);
269 return CMD_WARNING;
270 }
271 return CMD_SUCCESS;
272}
273
274DEFUN (bgp_config_type,
275 bgp_config_type_cmd,
276 "bgp config-type (cisco|zebra)",
277 BGP_STR
278 "Configuration type\n"
279 "cisco\n"
280 "zebra\n")
281{
282 if (strncmp (argv[0], "c", 1) == 0)
283 bgp_option_set (BGP_OPT_CONFIG_CISCO);
284 else
285 bgp_option_unset (BGP_OPT_CONFIG_CISCO);
286
287 return CMD_SUCCESS;
288}
289
290DEFUN (no_bgp_config_type,
291 no_bgp_config_type_cmd,
292 "no bgp config-type",
293 NO_STR
294 BGP_STR
295 "Display configuration type\n")
296{
297 bgp_option_unset (BGP_OPT_CONFIG_CISCO);
298 return CMD_SUCCESS;
299}
300
301DEFUN (no_synchronization,
302 no_synchronization_cmd,
303 "no synchronization",
304 NO_STR
305 "Perform IGP synchronization\n")
306{
307 return CMD_SUCCESS;
308}
309
310DEFUN (no_auto_summary,
311 no_auto_summary_cmd,
312 "no auto-summary",
313 NO_STR
314 "Enable automatic network number summarization\n")
315{
316 return CMD_SUCCESS;
317}
3d515fd9 318
319DEFUN_DEPRECATED (neighbor_version,
320 neighbor_version_cmd,
321 NEIGHBOR_CMD "version (4|4-)",
322 NEIGHBOR_STR
323 NEIGHBOR_ADDR_STR
324 "Set the BGP version to match a neighbor\n"
325 "Neighbor's BGP version\n")
326{
327 return CMD_SUCCESS;
328}
6b0655a2 329
718e3744 330/* "router bgp" commands. */
331DEFUN (router_bgp,
332 router_bgp_cmd,
320da874 333 "router bgp " CMD_AS_RANGE,
718e3744 334 ROUTER_STR
335 BGP_STR
336 AS_STR)
337{
338 int ret;
339 as_t as;
340 struct bgp *bgp;
fd79ac91 341 const char *name = NULL;
718e3744 342
0b2aa3a0 343 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
718e3744 344
345 if (argc == 2)
346 name = argv[1];
347
348 ret = bgp_get (&bgp, &as, name);
349 switch (ret)
350 {
351 case BGP_ERR_MULTIPLE_INSTANCE_NOT_SET:
352 vty_out (vty, "Please specify 'bgp multiple-instance' first%s",
353 VTY_NEWLINE);
354 return CMD_WARNING;
718e3744 355 case BGP_ERR_AS_MISMATCH:
aea339f7 356 vty_out (vty, "BGP is already running; AS is %u%s", as, VTY_NEWLINE);
718e3744 357 return CMD_WARNING;
718e3744 358 case BGP_ERR_INSTANCE_MISMATCH:
359 vty_out (vty, "BGP view name and AS number mismatch%s", VTY_NEWLINE);
aea339f7 360 vty_out (vty, "BGP instance is already running; AS is %u%s",
718e3744 361 as, VTY_NEWLINE);
362 return CMD_WARNING;
718e3744 363 }
364
365 vty->node = BGP_NODE;
366 vty->index = bgp;
367
368 return CMD_SUCCESS;
369}
370
371ALIAS (router_bgp,
372 router_bgp_view_cmd,
320da874 373 "router bgp " CMD_AS_RANGE " view WORD",
718e3744 374 ROUTER_STR
375 BGP_STR
376 AS_STR
377 "BGP view\n"
378 "view name\n")
6b0655a2 379
718e3744 380/* "no router bgp" commands. */
381DEFUN (no_router_bgp,
382 no_router_bgp_cmd,
320da874 383 "no router bgp " CMD_AS_RANGE,
718e3744 384 NO_STR
385 ROUTER_STR
386 BGP_STR
387 AS_STR)
388{
389 as_t as;
390 struct bgp *bgp;
fd79ac91 391 const char *name = NULL;
718e3744 392
0b2aa3a0 393 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
718e3744 394
395 if (argc == 2)
396 name = argv[1];
397
398 /* Lookup bgp structure. */
399 bgp = bgp_lookup (as, name);
400 if (! bgp)
401 {
402 vty_out (vty, "%% Can't find BGP instance%s", VTY_NEWLINE);
403 return CMD_WARNING;
404 }
405
406 bgp_delete (bgp);
407
408 return CMD_SUCCESS;
409}
410
411ALIAS (no_router_bgp,
412 no_router_bgp_view_cmd,
320da874 413 "no router bgp " CMD_AS_RANGE " view WORD",
718e3744 414 NO_STR
415 ROUTER_STR
416 BGP_STR
417 AS_STR
418 "BGP view\n"
419 "view name\n")
6b0655a2 420
718e3744 421/* BGP router-id. */
422
423DEFUN (bgp_router_id,
424 bgp_router_id_cmd,
425 "bgp router-id A.B.C.D",
426 BGP_STR
427 "Override configured router identifier\n"
428 "Manually configured router identifier\n")
429{
430 int ret;
431 struct in_addr id;
432 struct bgp *bgp;
433
434 bgp = vty->index;
435
436 ret = inet_aton (argv[0], &id);
437 if (! ret)
438 {
439 vty_out (vty, "%% Malformed bgp router identifier%s", VTY_NEWLINE);
440 return CMD_WARNING;
441 }
442
18a6dce6 443 bgp->router_id_static = id;
718e3744 444 bgp_router_id_set (bgp, &id);
445
446 return CMD_SUCCESS;
447}
448
449DEFUN (no_bgp_router_id,
450 no_bgp_router_id_cmd,
451 "no bgp router-id",
452 NO_STR
453 BGP_STR
454 "Override configured router identifier\n")
455{
456 int ret;
457 struct in_addr id;
458 struct bgp *bgp;
459
460 bgp = vty->index;
461
462 if (argc == 1)
463 {
464 ret = inet_aton (argv[0], &id);
465 if (! ret)
466 {
467 vty_out (vty, "%% Malformed BGP router identifier%s", VTY_NEWLINE);
468 return CMD_WARNING;
469 }
470
18a6dce6 471 if (! IPV4_ADDR_SAME (&bgp->router_id_static, &id))
718e3744 472 {
473 vty_out (vty, "%% BGP router-id doesn't match%s", VTY_NEWLINE);
474 return CMD_WARNING;
475 }
476 }
477
18a6dce6 478 bgp->router_id_static.s_addr = 0;
479 bgp_router_id_set (bgp, &router_id_zebra);
718e3744 480
481 return CMD_SUCCESS;
482}
483
484ALIAS (no_bgp_router_id,
485 no_bgp_router_id_val_cmd,
486 "no bgp router-id A.B.C.D",
487 NO_STR
488 BGP_STR
489 "Override configured router identifier\n"
490 "Manually configured router identifier\n")
6b0655a2 491
718e3744 492/* BGP Cluster ID. */
493
494DEFUN (bgp_cluster_id,
495 bgp_cluster_id_cmd,
496 "bgp cluster-id A.B.C.D",
497 BGP_STR
498 "Configure Route-Reflector Cluster-id\n"
499 "Route-Reflector Cluster-id in IP address format\n")
500{
501 int ret;
502 struct bgp *bgp;
503 struct in_addr cluster;
504
505 bgp = vty->index;
506
507 ret = inet_aton (argv[0], &cluster);
508 if (! ret)
509 {
510 vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE);
511 return CMD_WARNING;
512 }
513
514 bgp_cluster_id_set (bgp, &cluster);
515
516 return CMD_SUCCESS;
517}
518
519ALIAS (bgp_cluster_id,
520 bgp_cluster_id32_cmd,
521 "bgp cluster-id <1-4294967295>",
522 BGP_STR
523 "Configure Route-Reflector Cluster-id\n"
524 "Route-Reflector Cluster-id as 32 bit quantity\n")
525
526DEFUN (no_bgp_cluster_id,
527 no_bgp_cluster_id_cmd,
528 "no bgp cluster-id",
529 NO_STR
530 BGP_STR
531 "Configure Route-Reflector Cluster-id\n")
532{
533 int ret;
534 struct bgp *bgp;
535 struct in_addr cluster;
536
537 bgp = vty->index;
538
539 if (argc == 1)
540 {
541 ret = inet_aton (argv[0], &cluster);
542 if (! ret)
543 {
544 vty_out (vty, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE);
545 return CMD_WARNING;
546 }
547 }
548
549 bgp_cluster_id_unset (bgp);
550
551 return CMD_SUCCESS;
552}
553
554ALIAS (no_bgp_cluster_id,
555 no_bgp_cluster_id_arg_cmd,
556 "no bgp cluster-id A.B.C.D",
557 NO_STR
558 BGP_STR
559 "Configure Route-Reflector Cluster-id\n"
560 "Route-Reflector Cluster-id in IP address format\n")
6b0655a2 561
718e3744 562DEFUN (bgp_confederation_identifier,
563 bgp_confederation_identifier_cmd,
320da874 564 "bgp confederation identifier " CMD_AS_RANGE,
718e3744 565 "BGP specific commands\n"
566 "AS confederation parameters\n"
567 "AS number\n"
568 "Set routing domain confederation AS\n")
569{
570 struct bgp *bgp;
571 as_t as;
572
573 bgp = vty->index;
574
0b2aa3a0 575 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
718e3744 576
577 bgp_confederation_id_set (bgp, as);
578
579 return CMD_SUCCESS;
580}
581
582DEFUN (no_bgp_confederation_identifier,
583 no_bgp_confederation_identifier_cmd,
584 "no bgp confederation identifier",
585 NO_STR
586 "BGP specific commands\n"
587 "AS confederation parameters\n"
588 "AS number\n")
589{
590 struct bgp *bgp;
591 as_t as;
592
593 bgp = vty->index;
594
595 if (argc == 1)
0b2aa3a0 596 VTY_GET_INTEGER_RANGE ("AS", as, argv[0], 1, BGP_AS4_MAX);
718e3744 597
598 bgp_confederation_id_unset (bgp);
599
600 return CMD_SUCCESS;
601}
602
603ALIAS (no_bgp_confederation_identifier,
604 no_bgp_confederation_identifier_arg_cmd,
320da874 605 "no bgp confederation identifier " CMD_AS_RANGE,
718e3744 606 NO_STR
607 "BGP specific commands\n"
608 "AS confederation parameters\n"
609 "AS number\n"
610 "Set routing domain confederation AS\n")
6b0655a2 611
718e3744 612DEFUN (bgp_confederation_peers,
613 bgp_confederation_peers_cmd,
320da874 614 "bgp confederation peers ." CMD_AS_RANGE,
718e3744 615 "BGP specific commands\n"
616 "AS confederation parameters\n"
617 "Peer ASs in BGP confederation\n"
618 AS_STR)
619{
620 struct bgp *bgp;
621 as_t as;
622 int i;
623
624 bgp = vty->index;
625
626 for (i = 0; i < argc; i++)
627 {
0b2aa3a0 628 VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX);
718e3744 629
630 if (bgp->as == as)
631 {
632 vty_out (vty, "%% Local member-AS not allowed in confed peer list%s",
633 VTY_NEWLINE);
634 continue;
635 }
636
637 bgp_confederation_peers_add (bgp, as);
638 }
639 return CMD_SUCCESS;
640}
641
642DEFUN (no_bgp_confederation_peers,
643 no_bgp_confederation_peers_cmd,
320da874 644 "no bgp confederation peers ." CMD_AS_RANGE,
718e3744 645 NO_STR
646 "BGP specific commands\n"
647 "AS confederation parameters\n"
648 "Peer ASs in BGP confederation\n"
649 AS_STR)
650{
651 struct bgp *bgp;
652 as_t as;
653 int i;
654
655 bgp = vty->index;
656
657 for (i = 0; i < argc; i++)
658 {
0b2aa3a0
PJ
659 VTY_GET_INTEGER_RANGE ("AS", as, argv[i], 1, BGP_AS4_MAX);
660
718e3744 661 bgp_confederation_peers_remove (bgp, as);
662 }
663 return CMD_SUCCESS;
664}
6b0655a2 665
5e242b0d
DS
666/**
667 * Central routine for maximum-paths configuration.
668 * @peer_type: BGP_PEER_EBGP or BGP_PEER_IBGP
669 * @set: 1 for setting values, 0 for removing the max-paths config.
670 */
671int
672bgp_maxpaths_config_vty (struct vty *vty, int peer_type, char *mpaths,
673 u_int16_t options, int set)
165b5fff
JB
674{
675 struct bgp *bgp;
676 u_int16_t maxpaths;
677 int ret;
5e242b0d
DS
678 afi_t afi;
679 safi_t safi;
165b5fff
JB
680
681 bgp = vty->index;
5e242b0d
DS
682 afi = bgp_node_afi (vty);
683 safi = bgp_node_safi (vty);
165b5fff 684
5e242b0d
DS
685 if (set)
686 {
73ac8160
DS
687 VTY_GET_INTEGER_RANGE ("maximum-paths", maxpaths, mpaths, 1,
688 BGP_MAXIMUM_MAXPATHS);
5e242b0d
DS
689 ret = bgp_maximum_paths_set (bgp, afi, safi, peer_type, maxpaths,
690 options);
691 }
692 else
693 ret = bgp_maximum_paths_unset (bgp, afi, safi, peer_type);
165b5fff 694
165b5fff
JB
695 if (ret < 0)
696 {
697 vty_out (vty,
5e242b0d
DS
698 "%% Failed to %sset maximum-paths %s %u for afi %u, safi %u%s",
699 (set == 1) ? "" : "un",
700 (peer_type == BGP_PEER_EBGP) ? "ebgp" : "ibgp",
701 maxpaths, afi, safi, VTY_NEWLINE);
165b5fff
JB
702 return CMD_WARNING;
703 }
704
705 return CMD_SUCCESS;
706}
707
f188f2c4
DS
708static int
709bgp_update_delay_config_vty (struct vty *vty, const char *delay,
710 const char *wait)
711{
712 struct bgp *bgp;
713 u_int16_t update_delay;
714 u_int16_t establish_wait;
715
716
717 bgp = vty->index;
718
719 VTY_GET_INTEGER_RANGE ("update-delay", update_delay, delay,
720 BGP_UPDATE_DELAY_MIN, BGP_UPDATE_DELAY_MAX);
721
722 if (!wait) /* update-delay <delay> */
723 {
724 bgp->v_update_delay = update_delay;
725 bgp->v_establish_wait = bgp->v_update_delay;
726 return CMD_SUCCESS;
727 }
728
729 /* update-delay <delay> <establish-wait> */
730 establish_wait = atoi (wait);
731 if (update_delay < establish_wait)
732 {
733 vty_out (vty, "%%Failed: update-delay less than the establish-wait!%s",
734 VTY_NEWLINE);
735 return CMD_WARNING;
736 }
737
738 bgp->v_update_delay = update_delay;
739 bgp->v_establish_wait = establish_wait;
740
741 return CMD_SUCCESS;
742}
743
744static int
745bgp_update_delay_deconfig_vty (struct vty *vty)
746{
747 struct bgp *bgp;
748
749 bgp = vty->index;
750
751 bgp->v_update_delay = BGP_UPDATE_DELAY_DEF;
752 bgp->v_establish_wait = bgp->v_update_delay;
753
754 return CMD_SUCCESS;
755}
756
757int
758bgp_config_write_update_delay (struct vty *vty, struct bgp *bgp)
759{
760 if (bgp->v_update_delay != BGP_UPDATE_DELAY_DEF)
761 {
762 vty_out (vty, " update-delay %d", bgp->v_update_delay);
763 if (bgp->v_update_delay != bgp->v_establish_wait)
764 vty_out (vty, " %d", bgp->v_establish_wait);
765 vty_out (vty, "%s", VTY_NEWLINE);
766 }
767
768 return 0;
769}
770
771
772/* Update-delay configuration */
773DEFUN (bgp_update_delay,
774 bgp_update_delay_cmd,
775 "update-delay <0-3600>",
776 "Force initial delay for best-path and updates\n"
777 "Seconds\n")
778{
779 return bgp_update_delay_config_vty(vty, argv[0], NULL);
780}
781
782DEFUN (bgp_update_delay_establish_wait,
783 bgp_update_delay_establish_wait_cmd,
784 "update-delay <0-3600> <1-3600>",
785 "Force initial delay for best-path and updates\n"
786 "Seconds\n"
787 "Wait for peers to be established\n"
788 "Seconds\n")
789{
790 return bgp_update_delay_config_vty(vty, argv[0], argv[1]);
791}
792
793/* Update-delay deconfiguration */
794DEFUN (no_bgp_update_delay,
795 no_bgp_update_delay_cmd,
796 "no update-delay <0-3600>",
797 "Force initial delay for best-path and updates\n"
798 "Seconds\n")
799{
800 return bgp_update_delay_deconfig_vty(vty);
801}
802
803ALIAS (no_bgp_update_delay,
804 no_bgp_update_delay_establish_wait_cmd,
805 "no update-delay <0-3600> <1-3600>",
806 "Force initial delay for best-path and updates\n"
807 "Seconds\n"
808 "Wait for peers to be established\n"
809 "Seconds\n")
5e242b0d 810
cb1faec9
DS
811int
812bgp_wpkt_quanta_config_vty (struct vty *vty, char *num, char set)
813{
814 struct bgp *bgp;
815 u_int16_t update_delay;
816
817 bgp = vty->index;
818
819 if (set)
820 VTY_GET_INTEGER_RANGE ("write-quanta", bgp->wpkt_quanta, num,
821 1, 4294967295);
822 else
823 bgp->wpkt_quanta = BGP_WRITE_PACKET_MAX;
824
825 return CMD_SUCCESS;
826}
827
828int
829bgp_config_write_wpkt_quanta (struct vty *vty, struct bgp *bgp)
830{
831 if (bgp->wpkt_quanta != BGP_WRITE_PACKET_MAX)
832 vty_out (vty, " write-quanta %d%s",
833 bgp->wpkt_quanta, VTY_NEWLINE);
834
835 return 0;
836}
837
838
839/* Update-delay configuration */
840DEFUN (bgp_wpkt_quanta,
841 bgp_wpkt_quanta_cmd,
842 "write-quanta <1-4294967295>",
843 "How many packets to write to peer socket per run\n"
844 "Number of packets\n")
845{
846 return bgp_wpkt_quanta_config_vty(vty, argv[0], 1);
847}
848
849/* Update-delay deconfiguration */
850DEFUN (no_bgp_wpkt_quanta,
851 no_bgp_wpkt_quanta_cmd,
852 "no write-quanta <1-4294967295>",
853 "How many packets to write to peer socket per run\n"
854 "Number of packets\n")
855{
856 return bgp_wpkt_quanta_config_vty(vty, argv[0], 0);
857}
858
5e242b0d
DS
859/* Maximum-paths configuration */
860DEFUN (bgp_maxpaths,
861 bgp_maxpaths_cmd,
862 "maximum-paths <1-255>",
863 "Forward packets over multiple paths\n"
864 "Number of paths\n")
865{
866 return bgp_maxpaths_config_vty(vty, BGP_PEER_EBGP, argv[0], 0, 1);
867}
868
165b5fff
JB
869DEFUN (bgp_maxpaths_ibgp,
870 bgp_maxpaths_ibgp_cmd,
871 "maximum-paths ibgp <1-255>",
872 "Forward packets over multiple paths\n"
873 "iBGP-multipath\n"
874 "Number of paths\n")
875{
5e242b0d
DS
876 return bgp_maxpaths_config_vty(vty, BGP_PEER_IBGP, argv[0], 0, 1);
877}
165b5fff 878
5e242b0d
DS
879DEFUN (bgp_maxpaths_ibgp_cluster,
880 bgp_maxpaths_ibgp_cluster_cmd,
881 "maximum-paths ibgp <1-255> equal-cluster-length",
882 "Forward packets over multiple paths\n"
883 "iBGP-multipath\n"
884 "Number of paths\n"
885 "Match the cluster length\n")
886{
887 return bgp_maxpaths_config_vty(vty, BGP_PEER_IBGP, argv[0],
888 BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN, 1);
165b5fff
JB
889}
890
891DEFUN (no_bgp_maxpaths,
892 no_bgp_maxpaths_cmd,
893 "no maximum-paths",
894 NO_STR
895 "Forward packets over multiple paths\n"
896 "Number of paths\n")
897{
5e242b0d 898 return bgp_maxpaths_config_vty(vty, BGP_PEER_EBGP, NULL, 0, 0);
165b5fff
JB
899}
900
901ALIAS (no_bgp_maxpaths,
902 no_bgp_maxpaths_arg_cmd,
903 "no maximum-paths <1-255>",
904 NO_STR
905 "Forward packets over multiple paths\n"
906 "Number of paths\n")
907
908DEFUN (no_bgp_maxpaths_ibgp,
909 no_bgp_maxpaths_ibgp_cmd,
910 "no maximum-paths ibgp",
911 NO_STR
912 "Forward packets over multiple paths\n"
913 "iBGP-multipath\n"
914 "Number of paths\n")
915{
5e242b0d 916 return bgp_maxpaths_config_vty(vty, BGP_PEER_IBGP, NULL, 0, 0);
165b5fff
JB
917}
918
919ALIAS (no_bgp_maxpaths_ibgp,
920 no_bgp_maxpaths_ibgp_arg_cmd,
921 "no maximum-paths ibgp <1-255>",
922 NO_STR
923 "Forward packets over multiple paths\n"
924 "iBGP-multipath\n"
925 "Number of paths\n")
926
5e242b0d
DS
927ALIAS (no_bgp_maxpaths_ibgp,
928 no_bgp_maxpaths_ibgp_cluster_cmd,
929 "no maximum-paths ibgp <1-255> equal-cluster-length",
930 NO_STR
931 "Forward packets over multiple paths\n"
932 "iBGP-multipath\n"
933 "Number of paths\n"
934 "Match the cluster length\n")
935
165b5fff
JB
936int
937bgp_config_write_maxpaths (struct vty *vty, struct bgp *bgp, afi_t afi,
938 safi_t safi, int *write)
939{
940 if (bgp->maxpaths[afi][safi].maxpaths_ebgp != BGP_DEFAULT_MAXPATHS)
941 {
942 bgp_config_write_family_header (vty, afi, safi, write);
943 vty_out (vty, " maximum-paths %d%s",
944 bgp->maxpaths[afi][safi].maxpaths_ebgp, VTY_NEWLINE);
945 }
946
947 if (bgp->maxpaths[afi][safi].maxpaths_ibgp != BGP_DEFAULT_MAXPATHS)
948 {
949 bgp_config_write_family_header (vty, afi, safi, write);
5e242b0d
DS
950 vty_out (vty, " maximum-paths ibgp %d",
951 bgp->maxpaths[afi][safi].maxpaths_ibgp);
952 if (CHECK_FLAG (bgp->maxpaths[afi][safi].ibgp_flags,
953 BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN))
954 vty_out (vty, " equal-cluster-length");
955 vty_out (vty, "%s", VTY_NEWLINE);
165b5fff
JB
956 }
957
958 return 0;
959}
6b0655a2 960
718e3744 961/* BGP timers. */
962
963DEFUN (bgp_timers,
964 bgp_timers_cmd,
965 "timers bgp <0-65535> <0-65535>",
966 "Adjust routing timers\n"
967 "BGP timers\n"
968 "Keepalive interval\n"
969 "Holdtime\n")
970{
971 struct bgp *bgp;
972 unsigned long keepalive = 0;
973 unsigned long holdtime = 0;
974
975 bgp = vty->index;
976
977 VTY_GET_INTEGER ("keepalive", keepalive, argv[0]);
978 VTY_GET_INTEGER ("holdtime", holdtime, argv[1]);
979
980 /* Holdtime value check. */
981 if (holdtime < 3 && holdtime != 0)
982 {
983 vty_out (vty, "%% hold time value must be either 0 or greater than 3%s",
984 VTY_NEWLINE);
985 return CMD_WARNING;
986 }
987
988 bgp_timers_set (bgp, keepalive, holdtime);
989
990 return CMD_SUCCESS;
991}
992
993DEFUN (no_bgp_timers,
994 no_bgp_timers_cmd,
995 "no timers bgp",
996 NO_STR
997 "Adjust routing timers\n"
998 "BGP timers\n")
999{
1000 struct bgp *bgp;
1001
1002 bgp = vty->index;
1003 bgp_timers_unset (bgp);
1004
1005 return CMD_SUCCESS;
1006}
1007
1008ALIAS (no_bgp_timers,
1009 no_bgp_timers_arg_cmd,
1010 "no timers bgp <0-65535> <0-65535>",
1011 NO_STR
1012 "Adjust routing timers\n"
1013 "BGP timers\n"
1014 "Keepalive interval\n"
1015 "Holdtime\n")
6b0655a2 1016
718e3744 1017DEFUN (bgp_client_to_client_reflection,
1018 bgp_client_to_client_reflection_cmd,
1019 "bgp client-to-client reflection",
1020 "BGP specific commands\n"
1021 "Configure client to client route reflection\n"
1022 "reflection of routes allowed\n")
1023{
1024 struct bgp *bgp;
1025
1026 bgp = vty->index;
1027 bgp_flag_unset (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT);
1028 return CMD_SUCCESS;
1029}
1030
1031DEFUN (no_bgp_client_to_client_reflection,
1032 no_bgp_client_to_client_reflection_cmd,
1033 "no bgp client-to-client reflection",
1034 NO_STR
1035 "BGP specific commands\n"
1036 "Configure client to client route reflection\n"
1037 "reflection of routes allowed\n")
1038{
1039 struct bgp *bgp;
1040
1041 bgp = vty->index;
1042 bgp_flag_set (bgp, BGP_FLAG_NO_CLIENT_TO_CLIENT);
1043 return CMD_SUCCESS;
1044}
1045
1046/* "bgp always-compare-med" configuration. */
1047DEFUN (bgp_always_compare_med,
1048 bgp_always_compare_med_cmd,
1049 "bgp always-compare-med",
1050 "BGP specific commands\n"
1051 "Allow comparing MED from different neighbors\n")
1052{
1053 struct bgp *bgp;
1054
1055 bgp = vty->index;
1056 bgp_flag_set (bgp, BGP_FLAG_ALWAYS_COMPARE_MED);
1057 return CMD_SUCCESS;
1058}
1059
1060DEFUN (no_bgp_always_compare_med,
1061 no_bgp_always_compare_med_cmd,
1062 "no bgp always-compare-med",
1063 NO_STR
1064 "BGP specific commands\n"
1065 "Allow comparing MED from different neighbors\n")
1066{
1067 struct bgp *bgp;
1068
1069 bgp = vty->index;
1070 bgp_flag_unset (bgp, BGP_FLAG_ALWAYS_COMPARE_MED);
1071 return CMD_SUCCESS;
1072}
6b0655a2 1073
718e3744 1074/* "bgp deterministic-med" configuration. */
1075DEFUN (bgp_deterministic_med,
1076 bgp_deterministic_med_cmd,
1077 "bgp deterministic-med",
1078 "BGP specific commands\n"
1079 "Pick the best-MED path among paths advertised from the neighboring AS\n")
1080{
1081 struct bgp *bgp;
1082
1083 bgp = vty->index;
1084 bgp_flag_set (bgp, BGP_FLAG_DETERMINISTIC_MED);
1085 return CMD_SUCCESS;
1086}
1087
1088DEFUN (no_bgp_deterministic_med,
1089 no_bgp_deterministic_med_cmd,
1090 "no bgp deterministic-med",
1091 NO_STR
1092 "BGP specific commands\n"
1093 "Pick the best-MED path among paths advertised from the neighboring AS\n")
1094{
1095 struct bgp *bgp;
1096
1097 bgp = vty->index;
1098 bgp_flag_unset (bgp, BGP_FLAG_DETERMINISTIC_MED);
1099 return CMD_SUCCESS;
1100}
538621f2 1101
1102/* "bgp graceful-restart" configuration. */
1103DEFUN (bgp_graceful_restart,
1104 bgp_graceful_restart_cmd,
1105 "bgp graceful-restart",
1106 "BGP specific commands\n"
1107 "Graceful restart capability parameters\n")
1108{
1109 struct bgp *bgp;
1110
1111 bgp = vty->index;
1112 bgp_flag_set (bgp, BGP_FLAG_GRACEFUL_RESTART);
1113 return CMD_SUCCESS;
1114}
1115
1116DEFUN (no_bgp_graceful_restart,
1117 no_bgp_graceful_restart_cmd,
1118 "no bgp graceful-restart",
1119 NO_STR
1120 "BGP specific commands\n"
1121 "Graceful restart capability parameters\n")
1122{
1123 struct bgp *bgp;
1124
1125 bgp = vty->index;
1126 bgp_flag_unset (bgp, BGP_FLAG_GRACEFUL_RESTART);
1127 return CMD_SUCCESS;
1128}
1129
93406d87 1130DEFUN (bgp_graceful_restart_stalepath_time,
1131 bgp_graceful_restart_stalepath_time_cmd,
1132 "bgp graceful-restart stalepath-time <1-3600>",
1133 "BGP specific commands\n"
1134 "Graceful restart capability parameters\n"
1135 "Set the max time to hold onto restarting peer's stale paths\n"
1136 "Delay value (seconds)\n")
1137{
1138 struct bgp *bgp;
1139 u_int32_t stalepath;
1140
1141 bgp = vty->index;
1142 if (! bgp)
1143 return CMD_WARNING;
1144
1145 VTY_GET_INTEGER_RANGE ("stalepath-time", stalepath, argv[0], 1, 3600);
1146 bgp->stalepath_time = stalepath;
1147 return CMD_SUCCESS;
1148}
1149
1150DEFUN (no_bgp_graceful_restart_stalepath_time,
1151 no_bgp_graceful_restart_stalepath_time_cmd,
1152 "no bgp graceful-restart stalepath-time",
1153 NO_STR
1154 "BGP specific commands\n"
1155 "Graceful restart capability parameters\n"
1156 "Set the max time to hold onto restarting peer's stale paths\n")
1157{
1158 struct bgp *bgp;
1159
1160 bgp = vty->index;
1161 if (! bgp)
1162 return CMD_WARNING;
1163
1164 bgp->stalepath_time = BGP_DEFAULT_STALEPATH_TIME;
1165 return CMD_SUCCESS;
1166}
1167
1168ALIAS (no_bgp_graceful_restart_stalepath_time,
1169 no_bgp_graceful_restart_stalepath_time_val_cmd,
1170 "no bgp graceful-restart stalepath-time <1-3600>",
1171 NO_STR
1172 "BGP specific commands\n"
1173 "Graceful restart capability parameters\n"
1174 "Set the max time to hold onto restarting peer's stale paths\n"
1175 "Delay value (seconds)\n")
1176
718e3744 1177/* "bgp fast-external-failover" configuration. */
1178DEFUN (bgp_fast_external_failover,
1179 bgp_fast_external_failover_cmd,
1180 "bgp fast-external-failover",
1181 BGP_STR
1182 "Immediately reset session if a link to a directly connected external peer goes down\n")
1183{
1184 struct bgp *bgp;
1185
1186 bgp = vty->index;
1187 bgp_flag_unset (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER);
1188 return CMD_SUCCESS;
1189}
1190
1191DEFUN (no_bgp_fast_external_failover,
1192 no_bgp_fast_external_failover_cmd,
1193 "no bgp fast-external-failover",
1194 NO_STR
1195 BGP_STR
1196 "Immediately reset session if a link to a directly connected external peer goes down\n")
1197{
1198 struct bgp *bgp;
1199
1200 bgp = vty->index;
1201 bgp_flag_set (bgp, BGP_FLAG_NO_FAST_EXT_FAILOVER);
1202 return CMD_SUCCESS;
1203}
6b0655a2 1204
718e3744 1205/* "bgp enforce-first-as" configuration. */
1206DEFUN (bgp_enforce_first_as,
1207 bgp_enforce_first_as_cmd,
1208 "bgp enforce-first-as",
1209 BGP_STR
1210 "Enforce the first AS for EBGP routes\n")
1211{
1212 struct bgp *bgp;
1213
1214 bgp = vty->index;
1215 bgp_flag_set (bgp, BGP_FLAG_ENFORCE_FIRST_AS);
1216 return CMD_SUCCESS;
1217}
1218
1219DEFUN (no_bgp_enforce_first_as,
1220 no_bgp_enforce_first_as_cmd,
1221 "no bgp enforce-first-as",
1222 NO_STR
1223 BGP_STR
1224 "Enforce the first AS for EBGP routes\n")
1225{
1226 struct bgp *bgp;
1227
1228 bgp = vty->index;
1229 bgp_flag_unset (bgp, BGP_FLAG_ENFORCE_FIRST_AS);
1230 return CMD_SUCCESS;
1231}
6b0655a2 1232
718e3744 1233/* "bgp bestpath compare-routerid" configuration. */
1234DEFUN (bgp_bestpath_compare_router_id,
1235 bgp_bestpath_compare_router_id_cmd,
1236 "bgp bestpath compare-routerid",
1237 "BGP specific commands\n"
1238 "Change the default bestpath selection\n"
1239 "Compare router-id for identical EBGP paths\n")
1240{
1241 struct bgp *bgp;
1242
1243 bgp = vty->index;
1244 bgp_flag_set (bgp, BGP_FLAG_COMPARE_ROUTER_ID);
1245 return CMD_SUCCESS;
1246}
1247
1248DEFUN (no_bgp_bestpath_compare_router_id,
1249 no_bgp_bestpath_compare_router_id_cmd,
1250 "no bgp bestpath compare-routerid",
1251 NO_STR
1252 "BGP specific commands\n"
1253 "Change the default bestpath selection\n"
1254 "Compare router-id for identical EBGP paths\n")
1255{
1256 struct bgp *bgp;
1257
1258 bgp = vty->index;
1259 bgp_flag_unset (bgp, BGP_FLAG_COMPARE_ROUTER_ID);
1260 return CMD_SUCCESS;
1261}
6b0655a2 1262
718e3744 1263/* "bgp bestpath as-path ignore" configuration. */
1264DEFUN (bgp_bestpath_aspath_ignore,
1265 bgp_bestpath_aspath_ignore_cmd,
1266 "bgp bestpath as-path ignore",
1267 "BGP specific commands\n"
1268 "Change the default bestpath selection\n"
1269 "AS-path attribute\n"
1270 "Ignore as-path length in selecting a route\n")
1271{
1272 struct bgp *bgp;
1273
1274 bgp = vty->index;
1275 bgp_flag_set (bgp, BGP_FLAG_ASPATH_IGNORE);
1276 return CMD_SUCCESS;
1277}
1278
1279DEFUN (no_bgp_bestpath_aspath_ignore,
1280 no_bgp_bestpath_aspath_ignore_cmd,
1281 "no bgp bestpath as-path ignore",
1282 NO_STR
1283 "BGP specific commands\n"
1284 "Change the default bestpath selection\n"
1285 "AS-path attribute\n"
1286 "Ignore as-path length in selecting a route\n")
1287{
1288 struct bgp *bgp;
1289
1290 bgp = vty->index;
1291 bgp_flag_unset (bgp, BGP_FLAG_ASPATH_IGNORE);
1292 return CMD_SUCCESS;
1293}
6b0655a2 1294
6811845b 1295/* "bgp bestpath as-path confed" configuration. */
1296DEFUN (bgp_bestpath_aspath_confed,
1297 bgp_bestpath_aspath_confed_cmd,
1298 "bgp bestpath as-path confed",
1299 "BGP specific commands\n"
1300 "Change the default bestpath selection\n"
1301 "AS-path attribute\n"
1302 "Compare path lengths including confederation sets & sequences in selecting a route\n")
1303{
1304 struct bgp *bgp;
1305
1306 bgp = vty->index;
1307 bgp_flag_set (bgp, BGP_FLAG_ASPATH_CONFED);
1308 return CMD_SUCCESS;
1309}
1310
1311DEFUN (no_bgp_bestpath_aspath_confed,
1312 no_bgp_bestpath_aspath_confed_cmd,
1313 "no bgp bestpath as-path confed",
1314 NO_STR
1315 "BGP specific commands\n"
1316 "Change the default bestpath selection\n"
1317 "AS-path attribute\n"
1318 "Compare path lengths including confederation sets & sequences in selecting a route\n")
1319{
1320 struct bgp *bgp;
1321
1322 bgp = vty->index;
1323 bgp_flag_unset (bgp, BGP_FLAG_ASPATH_CONFED);
1324 return CMD_SUCCESS;
1325}
6b0655a2 1326
2fdd455c
PM
1327/* "bgp bestpath as-path multipath-relax" configuration. */
1328DEFUN (bgp_bestpath_aspath_multipath_relax,
1329 bgp_bestpath_aspath_multipath_relax_cmd,
1330 "bgp bestpath as-path multipath-relax",
1331 "BGP specific commands\n"
1332 "Change the default bestpath selection\n"
1333 "AS-path attribute\n"
1334 "Allow load sharing across routes that have different AS paths (but same length)\n")
1335{
1336 struct bgp *bgp;
1337
1338 bgp = vty->index;
1339 bgp_flag_set (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX);
1340 return CMD_SUCCESS;
1341}
1342
1343DEFUN (no_bgp_bestpath_aspath_multipath_relax,
1344 no_bgp_bestpath_aspath_multipath_relax_cmd,
1345 "no bgp bestpath as-path multipath-relax",
1346 NO_STR
1347 "BGP specific commands\n"
1348 "Change the default bestpath selection\n"
1349 "AS-path attribute\n"
1350 "Allow load sharing across routes that have different AS paths (but same length)\n")
1351{
1352 struct bgp *bgp;
1353
1354 bgp = vty->index;
1355 bgp_flag_unset (bgp, BGP_FLAG_ASPATH_MULTIPATH_RELAX);
1356 return CMD_SUCCESS;
1357}
6b0655a2 1358
848973c7 1359/* "bgp log-neighbor-changes" configuration. */
1360DEFUN (bgp_log_neighbor_changes,
1361 bgp_log_neighbor_changes_cmd,
1362 "bgp log-neighbor-changes",
1363 "BGP specific commands\n"
1364 "Log neighbor up/down and reset reason\n")
1365{
1366 struct bgp *bgp;
1367
1368 bgp = vty->index;
1369 bgp_flag_set (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES);
1370 return CMD_SUCCESS;
1371}
1372
1373DEFUN (no_bgp_log_neighbor_changes,
1374 no_bgp_log_neighbor_changes_cmd,
1375 "no bgp log-neighbor-changes",
1376 NO_STR
1377 "BGP specific commands\n"
1378 "Log neighbor up/down and reset reason\n")
1379{
1380 struct bgp *bgp;
1381
1382 bgp = vty->index;
1383 bgp_flag_unset (bgp, BGP_FLAG_LOG_NEIGHBOR_CHANGES);
1384 return CMD_SUCCESS;
1385}
6b0655a2 1386
718e3744 1387/* "bgp bestpath med" configuration. */
1388DEFUN (bgp_bestpath_med,
1389 bgp_bestpath_med_cmd,
1390 "bgp bestpath med (confed|missing-as-worst)",
1391 "BGP specific commands\n"
1392 "Change the default bestpath selection\n"
1393 "MED attribute\n"
1394 "Compare MED among confederation paths\n"
1395 "Treat missing MED as the least preferred one\n")
1396{
1397 struct bgp *bgp;
1398
1399 bgp = vty->index;
1400
1401 if (strncmp (argv[0], "confed", 1) == 0)
1402 bgp_flag_set (bgp, BGP_FLAG_MED_CONFED);
1403 else
1404 bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1405
1406 return CMD_SUCCESS;
1407}
1408
1409DEFUN (bgp_bestpath_med2,
1410 bgp_bestpath_med2_cmd,
1411 "bgp bestpath med confed missing-as-worst",
1412 "BGP specific commands\n"
1413 "Change the default bestpath selection\n"
1414 "MED attribute\n"
1415 "Compare MED among confederation paths\n"
1416 "Treat missing MED as the least preferred one\n")
1417{
1418 struct bgp *bgp;
1419
1420 bgp = vty->index;
1421 bgp_flag_set (bgp, BGP_FLAG_MED_CONFED);
1422 bgp_flag_set (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1423 return CMD_SUCCESS;
1424}
1425
1426ALIAS (bgp_bestpath_med2,
1427 bgp_bestpath_med3_cmd,
1428 "bgp bestpath med missing-as-worst confed",
1429 "BGP specific commands\n"
1430 "Change the default bestpath selection\n"
1431 "MED attribute\n"
1432 "Treat missing MED as the least preferred one\n"
1433 "Compare MED among confederation paths\n")
1434
1435DEFUN (no_bgp_bestpath_med,
1436 no_bgp_bestpath_med_cmd,
1437 "no bgp bestpath med (confed|missing-as-worst)",
1438 NO_STR
1439 "BGP specific commands\n"
1440 "Change the default bestpath selection\n"
1441 "MED attribute\n"
1442 "Compare MED among confederation paths\n"
1443 "Treat missing MED as the least preferred one\n")
1444{
1445 struct bgp *bgp;
1446
1447 bgp = vty->index;
1448
1449 if (strncmp (argv[0], "confed", 1) == 0)
1450 bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED);
1451 else
1452 bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1453
1454 return CMD_SUCCESS;
1455}
1456
1457DEFUN (no_bgp_bestpath_med2,
1458 no_bgp_bestpath_med2_cmd,
1459 "no bgp bestpath med confed missing-as-worst",
1460 NO_STR
1461 "BGP specific commands\n"
1462 "Change the default bestpath selection\n"
1463 "MED attribute\n"
1464 "Compare MED among confederation paths\n"
1465 "Treat missing MED as the least preferred one\n")
1466{
1467 struct bgp *bgp;
1468
1469 bgp = vty->index;
1470 bgp_flag_unset (bgp, BGP_FLAG_MED_CONFED);
1471 bgp_flag_unset (bgp, BGP_FLAG_MED_MISSING_AS_WORST);
1472 return CMD_SUCCESS;
1473}
1474
1475ALIAS (no_bgp_bestpath_med2,
1476 no_bgp_bestpath_med3_cmd,
1477 "no bgp bestpath med missing-as-worst confed",
1478 NO_STR
1479 "BGP specific commands\n"
1480 "Change the default bestpath selection\n"
1481 "MED attribute\n"
1482 "Treat missing MED as the least preferred one\n"
1483 "Compare MED among confederation paths\n")
6b0655a2 1484
718e3744 1485/* "no bgp default ipv4-unicast". */
1486DEFUN (no_bgp_default_ipv4_unicast,
1487 no_bgp_default_ipv4_unicast_cmd,
1488 "no bgp default ipv4-unicast",
1489 NO_STR
1490 "BGP specific commands\n"
1491 "Configure BGP defaults\n"
1492 "Activate ipv4-unicast for a peer by default\n")
1493{
1494 struct bgp *bgp;
1495
1496 bgp = vty->index;
1497 bgp_flag_set (bgp, BGP_FLAG_NO_DEFAULT_IPV4);
1498 return CMD_SUCCESS;
1499}
1500
1501DEFUN (bgp_default_ipv4_unicast,
1502 bgp_default_ipv4_unicast_cmd,
1503 "bgp default ipv4-unicast",
1504 "BGP specific commands\n"
1505 "Configure BGP defaults\n"
1506 "Activate ipv4-unicast for a peer by default\n")
1507{
1508 struct bgp *bgp;
1509
1510 bgp = vty->index;
1511 bgp_flag_unset (bgp, BGP_FLAG_NO_DEFAULT_IPV4);
1512 return CMD_SUCCESS;
1513}
6b0655a2 1514
718e3744 1515/* "bgp import-check" configuration. */
1516DEFUN (bgp_network_import_check,
1517 bgp_network_import_check_cmd,
1518 "bgp network import-check",
1519 "BGP specific commands\n"
1520 "BGP network command\n"
1521 "Check BGP network route exists in IGP\n")
1522{
1523 struct bgp *bgp;
1524
1525 bgp = vty->index;
1526 bgp_flag_set (bgp, BGP_FLAG_IMPORT_CHECK);
1527 return CMD_SUCCESS;
1528}
1529
1530DEFUN (no_bgp_network_import_check,
1531 no_bgp_network_import_check_cmd,
1532 "no bgp network import-check",
1533 NO_STR
1534 "BGP specific commands\n"
1535 "BGP network command\n"
1536 "Check BGP network route exists in IGP\n")
1537{
1538 struct bgp *bgp;
1539
1540 bgp = vty->index;
1541 bgp_flag_unset (bgp, BGP_FLAG_IMPORT_CHECK);
1542 return CMD_SUCCESS;
1543}
6b0655a2 1544
718e3744 1545DEFUN (bgp_default_local_preference,
1546 bgp_default_local_preference_cmd,
1547 "bgp default local-preference <0-4294967295>",
1548 "BGP specific commands\n"
1549 "Configure BGP defaults\n"
1550 "local preference (higher=more preferred)\n"
1551 "Configure default local preference value\n")
1552{
1553 struct bgp *bgp;
1554 u_int32_t local_pref;
1555
1556 bgp = vty->index;
1557
1558 VTY_GET_INTEGER ("local preference", local_pref, argv[0]);
1559
1560 bgp_default_local_preference_set (bgp, local_pref);
1561
1562 return CMD_SUCCESS;
1563}
1564
1565DEFUN (no_bgp_default_local_preference,
1566 no_bgp_default_local_preference_cmd,
1567 "no bgp default local-preference",
1568 NO_STR
1569 "BGP specific commands\n"
1570 "Configure BGP defaults\n"
1571 "local preference (higher=more preferred)\n")
1572{
1573 struct bgp *bgp;
1574
1575 bgp = vty->index;
1576 bgp_default_local_preference_unset (bgp);
1577 return CMD_SUCCESS;
1578}
1579
1580ALIAS (no_bgp_default_local_preference,
1581 no_bgp_default_local_preference_val_cmd,
1582 "no bgp default local-preference <0-4294967295>",
1583 NO_STR
1584 "BGP specific commands\n"
1585 "Configure BGP defaults\n"
1586 "local preference (higher=more preferred)\n"
1587 "Configure default local preference value\n")
6b0655a2 1588
8bd9d948
DS
1589static void
1590peer_announce_routes_if_rmap_out (struct bgp *bgp)
1591{
1592 struct peer *peer;
1593 struct listnode *node, *nnode;
1594 struct bgp_filter *filter;
1595 afi_t afi;
1596 safi_t safi;
1597
1598 /* Reannounce all routes to appropriate neighbors */
1599 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
1600 {
1601 for (afi = AFI_IP; afi < AFI_MAX; afi++)
1602 for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++)
1603 {
1604 if (CHECK_FLAG(peer->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT))
1605 {
1606 /* check if there's an out route-map on this client */
1607 filter = &peer->filter[afi][safi];
1608 if (ROUTE_MAP_OUT_NAME(filter))
1609 {
1610 if (BGP_DEBUG(update, UPDATE_OUT))
1611 zlog_debug("%s: Announcing routes again for peer %s"
1612 "(afi=%d, safi=%d", __func__, peer->host, afi,
1613 safi);
1614
1615 bgp_announce_route_all(peer);
1616 }
1617 }
1618 }
1619 }
1620}
1621
1622DEFUN (bgp_rr_allow_outbound_policy,
1623 bgp_rr_allow_outbound_policy_cmd,
1624 "bgp route-reflector allow-outbound-policy",
1625 "BGP specific commands\n"
1626 "Allow modifications made by out route-map\n"
1627 "on ibgp neighbors\n")
1628{
1629 struct bgp *bgp;
1630 u_int32_t local_pref;
1631 int ret;
1632
1633 bgp = vty->index;
1634
1635 if (!bgp_flag_check(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY))
1636 {
1637 bgp_flag_set(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY);
1638 peer_announce_routes_if_rmap_out(bgp);
1639 }
1640
1641 return CMD_SUCCESS;
1642}
1643
1644DEFUN (no_bgp_rr_allow_outbound_policy,
1645 no_bgp_rr_allow_outbound_policy_cmd,
1646 "no bgp route-reflector allow-outbound-policy",
1647 NO_STR
1648 "BGP specific commands\n"
1649 "Allow modifications made by out route-map\n"
1650 "on ibgp neighbors\n")
1651{
1652 struct bgp *bgp;
1653 u_int32_t local_pref;
1654
1655 bgp = vty->index;
1656
1657 if (bgp_flag_check(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY))
1658 {
1659 bgp_flag_unset(bgp, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY);
1660 peer_announce_routes_if_rmap_out(bgp);
1661 }
1662
1663 return CMD_SUCCESS;
1664}
1665
718e3744 1666static int
fd79ac91 1667peer_remote_as_vty (struct vty *vty, const char *peer_str,
1668 const char *as_str, afi_t afi, safi_t safi)
718e3744 1669{
1670 int ret;
1671 struct bgp *bgp;
1672 as_t as;
1673 union sockunion su;
1674
1675 bgp = vty->index;
1676
1677 /* Get AS number. */
0b2aa3a0 1678 VTY_GET_INTEGER_RANGE ("AS", as, as_str, 1, BGP_AS4_MAX);
718e3744 1679
1680 /* If peer is peer group, call proper function. */
1681 ret = str2sockunion (peer_str, &su);
1682 if (ret < 0)
1683 {
a80beece
DS
1684 /* Check for peer by interface */
1685 ret = peer_remote_as (bgp, NULL, peer_str, &as, afi, safi);
718e3744 1686 if (ret < 0)
a80beece
DS
1687 {
1688 ret = peer_group_remote_as (bgp, peer_str, &as);
1689 if (ret < 0)
1690 {
1691 vty_out (vty, "%% Create the peer-group or interface first%s",
1692 VTY_NEWLINE);
1693 return CMD_WARNING;
1694 }
1695 return CMD_SUCCESS;
1696 }
718e3744 1697 }
a80beece 1698 else
718e3744 1699 {
a80beece
DS
1700 if (peer_address_self_check (&su))
1701 {
1702 vty_out (vty, "%% Can not configure the local system as neighbor%s",
1703 VTY_NEWLINE);
1704 return CMD_WARNING;
1705 }
1706 ret = peer_remote_as (bgp, &su, NULL, &as, afi, safi);
718e3744 1707 }
1708
718e3744 1709 /* This peer belongs to peer group. */
1710 switch (ret)
1711 {
1712 case BGP_ERR_PEER_GROUP_MEMBER:
aea339f7 1713 vty_out (vty, "%% Peer-group AS %u. Cannot configure remote-as for member%s", as, VTY_NEWLINE);
718e3744 1714 return CMD_WARNING;
718e3744 1715 case BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT:
aea339f7 1716 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);
718e3744 1717 return CMD_WARNING;
718e3744 1718 }
1719 return bgp_vty_return (vty, ret);
1720}
1721
1722DEFUN (neighbor_remote_as,
1723 neighbor_remote_as_cmd,
320da874 1724 NEIGHBOR_CMD2 "remote-as " CMD_AS_RANGE,
718e3744 1725 NEIGHBOR_STR
1726 NEIGHBOR_ADDR_STR2
1727 "Specify a BGP neighbor\n"
1728 AS_STR)
1729{
1730 return peer_remote_as_vty (vty, argv[0], argv[1], AFI_IP, SAFI_UNICAST);
1731}
6b0655a2 1732
a80beece
DS
1733DEFUN (neighbor_interface_config,
1734 neighbor_interface_config_cmd,
1735 "neighbor WORD interface",
1736 NEIGHBOR_STR
1737 "Interface name or neighbor tag\n"
1738 "Enable BGP on interface\n")
1739{
1740 struct bgp *bgp;
1741 struct peer *peer;
1742 struct peer_group *group;
1743
1744 bgp = vty->index;
1745 group = peer_group_lookup (bgp, argv[0]);
1746 if (group)
1747 {
1748 vty_out (vty, "%% Name conflict with peer-group %s", VTY_NEWLINE);
1749 return CMD_WARNING;
1750 }
1751
1752 peer = peer_conf_interface_get (bgp, argv[0], AFI_IP, SAFI_UNICAST);
1753 if (!peer)
1754 return CMD_WARNING;
1755
1756 return CMD_SUCCESS;
1757}
1758
1759
718e3744 1760DEFUN (neighbor_peer_group,
1761 neighbor_peer_group_cmd,
1762 "neighbor WORD peer-group",
1763 NEIGHBOR_STR
a80beece 1764 "Interface name or neighbor tag\n"
718e3744 1765 "Configure peer-group\n")
1766{
1767 struct bgp *bgp;
a80beece 1768 struct peer *peer;
718e3744 1769 struct peer_group *group;
1770
1771 bgp = vty->index;
a80beece
DS
1772 peer = peer_lookup_by_conf_if (bgp, argv[0]);
1773 if (peer)
1774 {
1775 vty_out (vty, "%% Name conflict with interface: %s", VTY_NEWLINE);
1776 return CMD_WARNING;
1777 }
718e3744 1778
1779 group = peer_group_get (bgp, argv[0]);
1780 if (! group)
1781 return CMD_WARNING;
1782
1783 return CMD_SUCCESS;
1784}
1785
1786DEFUN (no_neighbor,
1787 no_neighbor_cmd,
1788 NO_NEIGHBOR_CMD2,
1789 NO_STR
1790 NEIGHBOR_STR
1791 NEIGHBOR_ADDR_STR2)
1792{
1793 int ret;
1794 union sockunion su;
1795 struct peer_group *group;
1796 struct peer *peer;
1ff9a340 1797 struct peer *other;
718e3744 1798
1799 ret = str2sockunion (argv[0], &su);
1800 if (ret < 0)
1801 {
a80beece
DS
1802 /* look up for neighbor by interface name config. */
1803 peer = peer_lookup_by_conf_if (vty->index, argv[0]);
1804 if (peer)
1805 {
1806 peer_delete (peer);
1807 return CMD_SUCCESS;
1808 }
1809
718e3744 1810 group = peer_group_lookup (vty->index, argv[0]);
1811 if (group)
1812 peer_group_delete (group);
1813 else
1814 {
1815 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1816 return CMD_WARNING;
1817 }
1818 }
1819 else
1820 {
1821 peer = peer_lookup (vty->index, &su);
1822 if (peer)
1ff9a340
DS
1823 {
1824 other = peer->doppelganger;
1825 peer_delete (peer);
1826 if (other && other->status != Deleted)
1827 peer_delete(other);
1828 }
718e3744 1829 }
1830
1831 return CMD_SUCCESS;
1832}
1833
1834ALIAS (no_neighbor,
1835 no_neighbor_remote_as_cmd,
320da874 1836 NO_NEIGHBOR_CMD "remote-as " CMD_AS_RANGE,
718e3744 1837 NO_STR
1838 NEIGHBOR_STR
1839 NEIGHBOR_ADDR_STR
1840 "Specify a BGP neighbor\n"
1841 AS_STR)
1842
a80beece
DS
1843DEFUN (no_neighbor_interface_config,
1844 no_neighbor_interface_config_cmd,
1845 "no neighbor WORD interface",
1846 NO_STR
1847 NEIGHBOR_STR
1848 "Interface name\n"
1849 "Configure BGP on interface\n")
1850{
1851 struct peer *peer;
1852
1853 /* look up for neighbor by interface name config. */
1854 peer = peer_lookup_by_conf_if (vty->index, argv[0]);
1855 if (peer)
1856 {
1857 peer_delete (peer);
1858 }
1859 else
1860 {
1861 vty_out (vty, "%% Create the bgp interface first%s", VTY_NEWLINE);
1862 return CMD_WARNING;
1863 }
1864 return CMD_SUCCESS;
1865}
1866
718e3744 1867DEFUN (no_neighbor_peer_group,
1868 no_neighbor_peer_group_cmd,
1869 "no neighbor WORD peer-group",
1870 NO_STR
1871 NEIGHBOR_STR
1872 "Neighbor tag\n"
1873 "Configure peer-group\n")
1874{
1875 struct peer_group *group;
1876
1877 group = peer_group_lookup (vty->index, argv[0]);
1878 if (group)
1879 peer_group_delete (group);
1880 else
1881 {
1882 vty_out (vty, "%% Create the peer-group first%s", VTY_NEWLINE);
1883 return CMD_WARNING;
1884 }
1885 return CMD_SUCCESS;
1886}
1887
a80beece
DS
1888DEFUN (no_neighbor_interface_peer_group_remote_as,
1889 no_neighbor_interface_peer_group_remote_as_cmd,
320da874 1890 "no neighbor WORD remote-as " CMD_AS_RANGE,
718e3744 1891 NO_STR
1892 NEIGHBOR_STR
a80beece 1893 "Interface name or neighbor tag\n"
718e3744 1894 "Specify a BGP neighbor\n"
1895 AS_STR)
1896{
1897 struct peer_group *group;
a80beece
DS
1898 struct peer *peer;
1899
1900 /* look up for neighbor by interface name config. */
1901 peer = peer_lookup_by_conf_if (vty->index, argv[0]);
1902 if (peer)
1903 {
1904 peer_as_change (peer, 0);
1905 return CMD_SUCCESS;
1906 }
718e3744 1907
1908 group = peer_group_lookup (vty->index, argv[0]);
1909 if (group)
1910 peer_group_remote_as_delete (group);
1911 else
1912 {
a80beece 1913 vty_out (vty, "%% Create the peer-group or interface first%s", VTY_NEWLINE);
718e3744 1914 return CMD_WARNING;
1915 }
1916 return CMD_SUCCESS;
1917}
6b0655a2 1918
718e3744 1919DEFUN (neighbor_local_as,
1920 neighbor_local_as_cmd,
320da874 1921 NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE,
718e3744 1922 NEIGHBOR_STR
1923 NEIGHBOR_ADDR_STR2
1924 "Specify a local-as number\n"
1925 "AS number used as local AS\n")
1926{
1927 struct peer *peer;
1928 int ret;
1929
1930 peer = peer_and_group_lookup_vty (vty, argv[0]);
1931 if (! peer)
1932 return CMD_WARNING;
1933
9d3f9705 1934 ret = peer_local_as_set (peer, atoi (argv[1]), 0, 0);
718e3744 1935 return bgp_vty_return (vty, ret);
1936}
1937
1938DEFUN (neighbor_local_as_no_prepend,
1939 neighbor_local_as_no_prepend_cmd,
320da874 1940 NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend",
718e3744 1941 NEIGHBOR_STR
1942 NEIGHBOR_ADDR_STR2
1943 "Specify a local-as number\n"
1944 "AS number used as local AS\n"
1945 "Do not prepend local-as to updates from ebgp peers\n")
1946{
1947 struct peer *peer;
1948 int ret;
1949
1950 peer = peer_and_group_lookup_vty (vty, argv[0]);
1951 if (! peer)
1952 return CMD_WARNING;
1953
9d3f9705 1954 ret = peer_local_as_set (peer, atoi (argv[1]), 1, 0);
718e3744 1955 return bgp_vty_return (vty, ret);
1956}
1957
9d3f9705
AC
1958DEFUN (neighbor_local_as_no_prepend_replace_as,
1959 neighbor_local_as_no_prepend_replace_as_cmd,
1960 NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as",
1961 NEIGHBOR_STR
1962 NEIGHBOR_ADDR_STR2
1963 "Specify a local-as number\n"
1964 "AS number used as local AS\n"
1965 "Do not prepend local-as to updates from ebgp peers\n"
1966 "Do not prepend local-as to updates from ibgp peers\n")
1967{
1968 struct peer *peer;
1969 int ret;
1970
1971 peer = peer_and_group_lookup_vty (vty, argv[0]);
1972 if (! peer)
1973 return CMD_WARNING;
1974
1975 ret = peer_local_as_set (peer, atoi (argv[1]), 1, 1);
1976 return bgp_vty_return (vty, ret);
1977}
1978
1979
718e3744 1980DEFUN (no_neighbor_local_as,
1981 no_neighbor_local_as_cmd,
1982 NO_NEIGHBOR_CMD2 "local-as",
1983 NO_STR
1984 NEIGHBOR_STR
1985 NEIGHBOR_ADDR_STR2
1986 "Specify a local-as number\n")
1987{
1988 struct peer *peer;
1989 int ret;
1990
1991 peer = peer_and_group_lookup_vty (vty, argv[0]);
1992 if (! peer)
1993 return CMD_WARNING;
1994
1995 ret = peer_local_as_unset (peer);
1996 return bgp_vty_return (vty, ret);
1997}
1998
1999ALIAS (no_neighbor_local_as,
2000 no_neighbor_local_as_val_cmd,
320da874 2001 NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE,
718e3744 2002 NO_STR
2003 NEIGHBOR_STR
2004 NEIGHBOR_ADDR_STR2
2005 "Specify a local-as number\n"
2006 "AS number used as local AS\n")
2007
2008ALIAS (no_neighbor_local_as,
2009 no_neighbor_local_as_val2_cmd,
320da874 2010 NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend",
718e3744 2011 NO_STR
2012 NEIGHBOR_STR
2013 NEIGHBOR_ADDR_STR2
2014 "Specify a local-as number\n"
2015 "AS number used as local AS\n"
2016 "Do not prepend local-as to updates from ebgp peers\n")
9d3f9705
AC
2017
2018ALIAS (no_neighbor_local_as,
2019 no_neighbor_local_as_val3_cmd,
2020 NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend replace-as",
2021 NO_STR
2022 NEIGHBOR_STR
2023 NEIGHBOR_ADDR_STR2
2024 "Specify a local-as number\n"
2025 "AS number used as local AS\n"
2026 "Do not prepend local-as to updates from ebgp peers\n"
2027 "Do not prepend local-as to updates from ibgp peers\n")
6b0655a2 2028
0df7c91f
PJ
2029DEFUN (neighbor_password,
2030 neighbor_password_cmd,
2031 NEIGHBOR_CMD2 "password LINE",
2032 NEIGHBOR_STR
2033 NEIGHBOR_ADDR_STR2
2034 "Set a password\n"
2035 "The password\n")
2036{
2037 struct peer *peer;
2038 int ret;
2039
2040 peer = peer_and_group_lookup_vty (vty, argv[0]);
2041 if (! peer)
2042 return CMD_WARNING;
2043
2044 ret = peer_password_set (peer, argv[1]);
2045 return bgp_vty_return (vty, ret);
2046}
2047
2048DEFUN (no_neighbor_password,
2049 no_neighbor_password_cmd,
2050 NO_NEIGHBOR_CMD2 "password",
2051 NO_STR
2052 NEIGHBOR_STR
2053 NEIGHBOR_ADDR_STR2
2054 "Set a password\n")
2055{
2056 struct peer *peer;
2057 int ret;
2058
2059 peer = peer_and_group_lookup_vty (vty, argv[0]);
2060 if (! peer)
2061 return CMD_WARNING;
2062
2063 ret = peer_password_unset (peer);
2064 return bgp_vty_return (vty, ret);
2065}
6b0655a2 2066
718e3744 2067DEFUN (neighbor_activate,
2068 neighbor_activate_cmd,
2069 NEIGHBOR_CMD2 "activate",
2070 NEIGHBOR_STR
2071 NEIGHBOR_ADDR_STR2
2072 "Enable the Address Family for this Neighbor\n")
2073{
2074 struct peer *peer;
2075
2076 peer = peer_and_group_lookup_vty (vty, argv[0]);
2077 if (! peer)
2078 return CMD_WARNING;
2079
2080 peer_activate (peer, bgp_node_afi (vty), bgp_node_safi (vty));
2081
2082 return CMD_SUCCESS;
2083}
2084
2085DEFUN (no_neighbor_activate,
2086 no_neighbor_activate_cmd,
2087 NO_NEIGHBOR_CMD2 "activate",
2088 NO_STR
2089 NEIGHBOR_STR
2090 NEIGHBOR_ADDR_STR2
2091 "Enable the Address Family for this Neighbor\n")
2092{
2093 int ret;
2094 struct peer *peer;
2095
2096 /* Lookup peer. */
2097 peer = peer_and_group_lookup_vty (vty, argv[0]);
2098 if (! peer)
2099 return CMD_WARNING;
2100
2101 ret = peer_deactivate (peer, bgp_node_afi (vty), bgp_node_safi (vty));
2102
2103 return bgp_vty_return (vty, ret);
2104}
6b0655a2 2105
718e3744 2106DEFUN (neighbor_set_peer_group,
2107 neighbor_set_peer_group_cmd,
a80beece 2108 NEIGHBOR_CMD2 "peer-group WORD",
718e3744 2109 NEIGHBOR_STR
a80beece 2110 NEIGHBOR_ADDR_STR2
718e3744 2111 "Member of the peer-group\n"
2112 "peer-group name\n")
2113{
2114 int ret;
2115 as_t as;
2116 union sockunion su;
2117 struct bgp *bgp;
a80beece 2118 struct peer *peer;
718e3744 2119 struct peer_group *group;
2120
2121 bgp = vty->index;
a80beece 2122 peer = NULL;
718e3744 2123
2124 ret = str2sockunion (argv[0], &su);
2125 if (ret < 0)
2126 {
a80beece
DS
2127 peer = peer_lookup_by_conf_if (bgp, argv[0]);
2128 if (!peer)
2129 {
2130 vty_out (vty, "%% Malformed address or name: %s%s", argv[0], VTY_NEWLINE);
2131 return CMD_WARNING;
2132 }
2133 }
2134 else
2135 {
2136 if (peer_address_self_check (&su))
2137 {
2138 vty_out (vty, "%% Can not configure the local system as neighbor%s",
2139 VTY_NEWLINE);
2140 return CMD_WARNING;
2141 }
718e3744 2142 }
2143
2144 group = peer_group_lookup (bgp, argv[1]);
2145 if (! group)
2146 {
2147 vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE);
2148 return CMD_WARNING;
2149 }
2150
a80beece 2151 ret = peer_group_bind (bgp, &su, peer, group, bgp_node_afi (vty),
718e3744 2152 bgp_node_safi (vty), &as);
2153
2154 if (ret == BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT)
2155 {
aea339f7 2156 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);
718e3744 2157 return CMD_WARNING;
2158 }
2159
2160 return bgp_vty_return (vty, ret);
2161}
2162
2163DEFUN (no_neighbor_set_peer_group,
2164 no_neighbor_set_peer_group_cmd,
a80beece 2165 NO_NEIGHBOR_CMD2 "peer-group WORD",
718e3744 2166 NO_STR
2167 NEIGHBOR_STR
a80beece 2168 NEIGHBOR_ADDR_STR2
718e3744 2169 "Member of the peer-group\n"
2170 "peer-group name\n")
2171{
2172 int ret;
2173 struct bgp *bgp;
2174 struct peer *peer;
2175 struct peer_group *group;
2176
2177 bgp = vty->index;
2178
2179 peer = peer_lookup_vty (vty, argv[0]);
2180 if (! peer)
2181 return CMD_WARNING;
2182
2183 group = peer_group_lookup (bgp, argv[1]);
2184 if (! group)
2185 {
2186 vty_out (vty, "%% Configure the peer-group first%s", VTY_NEWLINE);
2187 return CMD_WARNING;
2188 }
2189
2190 ret = peer_group_unbind (bgp, peer, group, bgp_node_afi (vty),
2191 bgp_node_safi (vty));
2192
2193 return bgp_vty_return (vty, ret);
2194}
6b0655a2 2195
94f2b392 2196static int
fd79ac91 2197peer_flag_modify_vty (struct vty *vty, const char *ip_str,
2198 u_int16_t flag, int set)
718e3744 2199{
2200 int ret;
2201 struct peer *peer;
2202
2203 peer = peer_and_group_lookup_vty (vty, ip_str);
2204 if (! peer)
2205 return CMD_WARNING;
2206
2207 if (set)
2208 ret = peer_flag_set (peer, flag);
2209 else
2210 ret = peer_flag_unset (peer, flag);
2211
2212 return bgp_vty_return (vty, ret);
2213}
2214
94f2b392 2215static int
fd79ac91 2216peer_flag_set_vty (struct vty *vty, const char *ip_str, u_int16_t flag)
718e3744 2217{
2218 return peer_flag_modify_vty (vty, ip_str, flag, 1);
2219}
2220
94f2b392 2221static int
fd79ac91 2222peer_flag_unset_vty (struct vty *vty, const char *ip_str, u_int16_t flag)
718e3744 2223{
2224 return peer_flag_modify_vty (vty, ip_str, flag, 0);
2225}
2226
2227/* neighbor passive. */
2228DEFUN (neighbor_passive,
2229 neighbor_passive_cmd,
2230 NEIGHBOR_CMD2 "passive",
2231 NEIGHBOR_STR
2232 NEIGHBOR_ADDR_STR2
2233 "Don't send open messages to this neighbor\n")
2234{
2235 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_PASSIVE);
2236}
2237
2238DEFUN (no_neighbor_passive,
2239 no_neighbor_passive_cmd,
2240 NO_NEIGHBOR_CMD2 "passive",
2241 NO_STR
2242 NEIGHBOR_STR
2243 NEIGHBOR_ADDR_STR2
2244 "Don't send open messages to this neighbor\n")
2245{
2246 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_PASSIVE);
2247}
6b0655a2 2248
718e3744 2249/* neighbor shutdown. */
2250DEFUN (neighbor_shutdown,
2251 neighbor_shutdown_cmd,
2252 NEIGHBOR_CMD2 "shutdown",
2253 NEIGHBOR_STR
2254 NEIGHBOR_ADDR_STR2
2255 "Administratively shut down this neighbor\n")
2256{
2257 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_SHUTDOWN);
2258}
2259
2260DEFUN (no_neighbor_shutdown,
2261 no_neighbor_shutdown_cmd,
2262 NO_NEIGHBOR_CMD2 "shutdown",
2263 NO_STR
2264 NEIGHBOR_STR
2265 NEIGHBOR_ADDR_STR2
2266 "Administratively shut down this neighbor\n")
2267{
2268 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_SHUTDOWN);
2269}
6b0655a2 2270
c9502438 2271/* Deprecated neighbor capability route-refresh. */
2272DEFUN_DEPRECATED (neighbor_capability_route_refresh,
2273 neighbor_capability_route_refresh_cmd,
2274 NEIGHBOR_CMD2 "capability route-refresh",
2275 NEIGHBOR_STR
2276 NEIGHBOR_ADDR_STR2
2277 "Advertise capability to the peer\n"
2278 "Advertise route-refresh capability to this neighbor\n")
718e3744 2279{
c9502438 2280 return CMD_SUCCESS;
718e3744 2281}
2282
c9502438 2283DEFUN_DEPRECATED (no_neighbor_capability_route_refresh,
2284 no_neighbor_capability_route_refresh_cmd,
2285 NO_NEIGHBOR_CMD2 "capability route-refresh",
2286 NO_STR
2287 NEIGHBOR_STR
2288 NEIGHBOR_ADDR_STR2
2289 "Advertise capability to the peer\n"
2290 "Advertise route-refresh capability to this neighbor\n")
718e3744 2291{
c9502438 2292 return CMD_SUCCESS;
718e3744 2293}
6b0655a2 2294
718e3744 2295/* neighbor capability dynamic. */
2296DEFUN (neighbor_capability_dynamic,
2297 neighbor_capability_dynamic_cmd,
2298 NEIGHBOR_CMD2 "capability dynamic",
2299 NEIGHBOR_STR
2300 NEIGHBOR_ADDR_STR2
2301 "Advertise capability to the peer\n"
2302 "Advertise dynamic capability to this neighbor\n")
2303{
2304 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY);
2305}
2306
2307DEFUN (no_neighbor_capability_dynamic,
2308 no_neighbor_capability_dynamic_cmd,
2309 NO_NEIGHBOR_CMD2 "capability dynamic",
2310 NO_STR
2311 NEIGHBOR_STR
2312 NEIGHBOR_ADDR_STR2
2313 "Advertise capability to the peer\n"
2314 "Advertise dynamic capability to this neighbor\n")
2315{
2316 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DYNAMIC_CAPABILITY);
2317}
6b0655a2 2318
718e3744 2319/* neighbor dont-capability-negotiate */
2320DEFUN (neighbor_dont_capability_negotiate,
2321 neighbor_dont_capability_negotiate_cmd,
2322 NEIGHBOR_CMD2 "dont-capability-negotiate",
2323 NEIGHBOR_STR
2324 NEIGHBOR_ADDR_STR2
2325 "Do not perform capability negotiation\n")
2326{
2327 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY);
2328}
2329
2330DEFUN (no_neighbor_dont_capability_negotiate,
2331 no_neighbor_dont_capability_negotiate_cmd,
2332 NO_NEIGHBOR_CMD2 "dont-capability-negotiate",
2333 NO_STR
2334 NEIGHBOR_STR
2335 NEIGHBOR_ADDR_STR2
2336 "Do not perform capability negotiation\n")
2337{
2338 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DONT_CAPABILITY);
2339}
6b0655a2 2340
94f2b392 2341static int
fd79ac91 2342peer_af_flag_modify_vty (struct vty *vty, const char *peer_str, afi_t afi,
fee0f4c6 2343 safi_t safi, u_int32_t flag, int set)
718e3744 2344{
2345 int ret;
2346 struct peer *peer;
2347
2348 peer = peer_and_group_lookup_vty (vty, peer_str);
2349 if (! peer)
2350 return CMD_WARNING;
2351
2352 if (set)
2353 ret = peer_af_flag_set (peer, afi, safi, flag);
2354 else
2355 ret = peer_af_flag_unset (peer, afi, safi, flag);
2356
2357 return bgp_vty_return (vty, ret);
2358}
2359
94f2b392 2360static int
fd79ac91 2361peer_af_flag_set_vty (struct vty *vty, const char *peer_str, afi_t afi,
fee0f4c6 2362 safi_t safi, u_int32_t flag)
718e3744 2363{
2364 return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 1);
2365}
2366
94f2b392 2367static int
fd79ac91 2368peer_af_flag_unset_vty (struct vty *vty, const char *peer_str, afi_t afi,
fee0f4c6 2369 safi_t safi, u_int32_t flag)
718e3744 2370{
2371 return peer_af_flag_modify_vty (vty, peer_str, afi, safi, flag, 0);
2372}
6b0655a2 2373
718e3744 2374/* neighbor capability orf prefix-list. */
2375DEFUN (neighbor_capability_orf_prefix,
2376 neighbor_capability_orf_prefix_cmd,
2377 NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)",
2378 NEIGHBOR_STR
2379 NEIGHBOR_ADDR_STR2
2380 "Advertise capability to the peer\n"
2381 "Advertise ORF capability to the peer\n"
2382 "Advertise prefixlist ORF capability to this neighbor\n"
2383 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
2384 "Capability to RECEIVE the ORF from this neighbor\n"
2385 "Capability to SEND the ORF to this neighbor\n")
2386{
2387 u_int16_t flag = 0;
2388
2389 if (strncmp (argv[1], "s", 1) == 0)
2390 flag = PEER_FLAG_ORF_PREFIX_SM;
2391 else if (strncmp (argv[1], "r", 1) == 0)
2392 flag = PEER_FLAG_ORF_PREFIX_RM;
2393 else if (strncmp (argv[1], "b", 1) == 0)
2394 flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM;
2395 else
2396 return CMD_WARNING;
2397
2398 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2399 bgp_node_safi (vty), flag);
2400}
2401
2402DEFUN (no_neighbor_capability_orf_prefix,
2403 no_neighbor_capability_orf_prefix_cmd,
2404 NO_NEIGHBOR_CMD2 "capability orf prefix-list (both|send|receive)",
2405 NO_STR
2406 NEIGHBOR_STR
2407 NEIGHBOR_ADDR_STR2
2408 "Advertise capability to the peer\n"
2409 "Advertise ORF capability to the peer\n"
2410 "Advertise prefixlist ORF capability to this neighbor\n"
2411 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
2412 "Capability to RECEIVE the ORF from this neighbor\n"
2413 "Capability to SEND the ORF to this neighbor\n")
2414{
2415 u_int16_t flag = 0;
2416
2417 if (strncmp (argv[1], "s", 1) == 0)
2418 flag = PEER_FLAG_ORF_PREFIX_SM;
2419 else if (strncmp (argv[1], "r", 1) == 0)
2420 flag = PEER_FLAG_ORF_PREFIX_RM;
2421 else if (strncmp (argv[1], "b", 1) == 0)
2422 flag = PEER_FLAG_ORF_PREFIX_SM|PEER_FLAG_ORF_PREFIX_RM;
2423 else
2424 return CMD_WARNING;
2425
2426 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2427 bgp_node_safi (vty), flag);
2428}
6b0655a2 2429
718e3744 2430/* neighbor next-hop-self. */
2431DEFUN (neighbor_nexthop_self,
2432 neighbor_nexthop_self_cmd,
9e7a53c1 2433 NEIGHBOR_CMD2 "next-hop-self {all}",
718e3744 2434 NEIGHBOR_STR
2435 NEIGHBOR_ADDR_STR2
9e7a53c1
TT
2436 "Disable the next hop calculation for this neighbor\n"
2437 "Apply also to ibgp-learned routes when acting as a route reflector\n")
718e3744 2438{
9e7a53c1
TT
2439 u_int32_t flags = PEER_FLAG_NEXTHOP_SELF, unset = 0;
2440 int rc;
2441
2442 /* Check if "all" is specified */
2443 if (argv[1] != NULL)
2444 flags |= PEER_FLAG_NEXTHOP_SELF_ALL;
2445 else
2446 unset |= PEER_FLAG_NEXTHOP_SELF_ALL;
2447
2448 rc = peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2449 bgp_node_safi (vty), flags);
2450 if ( rc == CMD_SUCCESS && unset )
2451 rc = peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2452 bgp_node_safi (vty), unset);
2453 return rc;
718e3744 2454}
2455
2456DEFUN (no_neighbor_nexthop_self,
2457 no_neighbor_nexthop_self_cmd,
9e7a53c1 2458 NO_NEIGHBOR_CMD2 "next-hop-self {all}",
718e3744 2459 NO_STR
2460 NEIGHBOR_STR
2461 NEIGHBOR_ADDR_STR2
9e7a53c1
TT
2462 "Disable the next hop calculation for this neighbor\n"
2463 "Apply also to ibgp-learned routes when acting as a route reflector\n")
718e3744 2464{
2465 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
9e7a53c1
TT
2466 bgp_node_safi (vty),
2467 PEER_FLAG_NEXTHOP_SELF|PEER_FLAG_NEXTHOP_SELF_ALL);
718e3744 2468}
6b0655a2 2469
718e3744 2470/* neighbor remove-private-AS. */
2471DEFUN (neighbor_remove_private_as,
2472 neighbor_remove_private_as_cmd,
2473 NEIGHBOR_CMD2 "remove-private-AS",
2474 NEIGHBOR_STR
2475 NEIGHBOR_ADDR_STR2
2476 "Remove private AS number from outbound updates\n")
2477{
2478 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2479 bgp_node_safi (vty),
2480 PEER_FLAG_REMOVE_PRIVATE_AS);
2481}
2482
2483DEFUN (no_neighbor_remove_private_as,
2484 no_neighbor_remove_private_as_cmd,
2485 NO_NEIGHBOR_CMD2 "remove-private-AS",
2486 NO_STR
2487 NEIGHBOR_STR
2488 NEIGHBOR_ADDR_STR2
2489 "Remove private AS number from outbound updates\n")
2490{
2491 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2492 bgp_node_safi (vty),
2493 PEER_FLAG_REMOVE_PRIVATE_AS);
2494}
6b0655a2 2495
718e3744 2496/* neighbor send-community. */
2497DEFUN (neighbor_send_community,
2498 neighbor_send_community_cmd,
2499 NEIGHBOR_CMD2 "send-community",
2500 NEIGHBOR_STR
2501 NEIGHBOR_ADDR_STR2
2502 "Send Community attribute to this neighbor\n")
2503{
2504 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2505 bgp_node_safi (vty),
2506 PEER_FLAG_SEND_COMMUNITY);
2507}
2508
2509DEFUN (no_neighbor_send_community,
2510 no_neighbor_send_community_cmd,
2511 NO_NEIGHBOR_CMD2 "send-community",
2512 NO_STR
2513 NEIGHBOR_STR
2514 NEIGHBOR_ADDR_STR2
2515 "Send Community attribute to this neighbor\n")
2516{
2517 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2518 bgp_node_safi (vty),
2519 PEER_FLAG_SEND_COMMUNITY);
2520}
6b0655a2 2521
718e3744 2522/* neighbor send-community extended. */
2523DEFUN (neighbor_send_community_type,
2524 neighbor_send_community_type_cmd,
2525 NEIGHBOR_CMD2 "send-community (both|extended|standard)",
2526 NEIGHBOR_STR
2527 NEIGHBOR_ADDR_STR2
2528 "Send Community attribute to this neighbor\n"
2529 "Send Standard and Extended Community attributes\n"
2530 "Send Extended Community attributes\n"
2531 "Send Standard Community attributes\n")
2532{
2533 if (strncmp (argv[1], "s", 1) == 0)
2534 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2535 bgp_node_safi (vty),
2536 PEER_FLAG_SEND_COMMUNITY);
2537 if (strncmp (argv[1], "e", 1) == 0)
2538 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2539 bgp_node_safi (vty),
2540 PEER_FLAG_SEND_EXT_COMMUNITY);
2541
2542 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2543 bgp_node_safi (vty),
2544 (PEER_FLAG_SEND_COMMUNITY|
2545 PEER_FLAG_SEND_EXT_COMMUNITY));
2546}
2547
2548DEFUN (no_neighbor_send_community_type,
2549 no_neighbor_send_community_type_cmd,
2550 NO_NEIGHBOR_CMD2 "send-community (both|extended|standard)",
2551 NO_STR
2552 NEIGHBOR_STR
2553 NEIGHBOR_ADDR_STR2
2554 "Send Community attribute to this neighbor\n"
2555 "Send Standard and Extended Community attributes\n"
2556 "Send Extended Community attributes\n"
2557 "Send Standard Community attributes\n")
2558{
2559 if (strncmp (argv[1], "s", 1) == 0)
2560 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2561 bgp_node_safi (vty),
2562 PEER_FLAG_SEND_COMMUNITY);
2563 if (strncmp (argv[1], "e", 1) == 0)
2564 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2565 bgp_node_safi (vty),
2566 PEER_FLAG_SEND_EXT_COMMUNITY);
2567
2568 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2569 bgp_node_safi (vty),
2570 (PEER_FLAG_SEND_COMMUNITY |
2571 PEER_FLAG_SEND_EXT_COMMUNITY));
2572}
6b0655a2 2573
718e3744 2574/* neighbor soft-reconfig. */
2575DEFUN (neighbor_soft_reconfiguration,
2576 neighbor_soft_reconfiguration_cmd,
2577 NEIGHBOR_CMD2 "soft-reconfiguration inbound",
2578 NEIGHBOR_STR
2579 NEIGHBOR_ADDR_STR2
2580 "Per neighbor soft reconfiguration\n"
2581 "Allow inbound soft reconfiguration for this neighbor\n")
2582{
2583 return peer_af_flag_set_vty (vty, argv[0],
2584 bgp_node_afi (vty), bgp_node_safi (vty),
2585 PEER_FLAG_SOFT_RECONFIG);
2586}
2587
2588DEFUN (no_neighbor_soft_reconfiguration,
2589 no_neighbor_soft_reconfiguration_cmd,
2590 NO_NEIGHBOR_CMD2 "soft-reconfiguration inbound",
2591 NO_STR
2592 NEIGHBOR_STR
2593 NEIGHBOR_ADDR_STR2
2594 "Per neighbor soft reconfiguration\n"
2595 "Allow inbound soft reconfiguration for this neighbor\n")
2596{
2597 return peer_af_flag_unset_vty (vty, argv[0],
2598 bgp_node_afi (vty), bgp_node_safi (vty),
2599 PEER_FLAG_SOFT_RECONFIG);
2600}
6b0655a2 2601
718e3744 2602DEFUN (neighbor_route_reflector_client,
2603 neighbor_route_reflector_client_cmd,
2604 NEIGHBOR_CMD2 "route-reflector-client",
2605 NEIGHBOR_STR
2606 NEIGHBOR_ADDR_STR2
2607 "Configure a neighbor as Route Reflector client\n")
2608{
2609 struct peer *peer;
2610
2611
2612 peer = peer_and_group_lookup_vty (vty, argv[0]);
2613 if (! peer)
2614 return CMD_WARNING;
2615
2616 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2617 bgp_node_safi (vty),
2618 PEER_FLAG_REFLECTOR_CLIENT);
2619}
2620
2621DEFUN (no_neighbor_route_reflector_client,
2622 no_neighbor_route_reflector_client_cmd,
2623 NO_NEIGHBOR_CMD2 "route-reflector-client",
2624 NO_STR
2625 NEIGHBOR_STR
2626 NEIGHBOR_ADDR_STR2
2627 "Configure a neighbor as Route Reflector client\n")
2628{
2629 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2630 bgp_node_safi (vty),
2631 PEER_FLAG_REFLECTOR_CLIENT);
2632}
6b0655a2 2633
94f2b392 2634static int
fd79ac91 2635peer_rsclient_set_vty (struct vty *vty, const char *peer_str,
2636 int afi, int safi)
fee0f4c6 2637{
2638 int ret;
2639 struct bgp *bgp;
2640 struct peer *peer;
2641 struct peer_group *group;
1eb8ef25 2642 struct listnode *node, *nnode;
fee0f4c6 2643 struct bgp_filter *pfilter;
2644 struct bgp_filter *gfilter;
228da428 2645 int locked_and_added = 0;
fee0f4c6 2646
2647 bgp = vty->index;
2648
2649 peer = peer_and_group_lookup_vty (vty, peer_str);
2650 if ( ! peer )
2651 return CMD_WARNING;
2652
2653 /* If it is already a RS-Client, don't do anything. */
2654 if ( CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) )
2655 return CMD_SUCCESS;
2656
2657 if ( ! peer_rsclient_active (peer) )
200df115 2658 {
2659 peer = peer_lock (peer); /* rsclient peer list reference */
2660 listnode_add_sort (bgp->rsclient, peer);
228da428 2661 locked_and_added = 1;
200df115 2662 }
fee0f4c6 2663
2664 ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2665 if (ret < 0)
228da428
CC
2666 {
2667 if (locked_and_added)
2668 {
2669 listnode_delete (bgp->rsclient, peer);
2670 peer_unlock (peer); /* rsclient peer list reference */
2671 }
2672
2673 return bgp_vty_return (vty, ret);
2674 }
fee0f4c6 2675
64e580a7 2676 peer->rib[afi][safi] = bgp_table_init (afi, safi);
fee0f4c6 2677 peer->rib[afi][safi]->type = BGP_TABLE_RSCLIENT;
228da428
CC
2678 /* RIB peer reference. Released when table is free'd in bgp_table_free. */
2679 peer->rib[afi][safi]->owner = peer_lock (peer);
fee0f4c6 2680
2681 /* Check for existing 'network' and 'redistribute' routes. */
2682 bgp_check_local_routes_rsclient (peer, afi, safi);
2683
2684 /* Check for routes for peers configured with 'soft-reconfiguration'. */
2685 bgp_soft_reconfig_rsclient (peer, afi, safi);
2686
2687 if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP))
2688 {
2689 group = peer->group;
2690 gfilter = &peer->filter[afi][safi];
2691
1eb8ef25 2692 for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
fee0f4c6 2693 {
2694 pfilter = &peer->filter[afi][safi];
2695
2696 /* Members of a non-RS-Client group should not be RS-Clients, as that
2697 is checked when the become part of the peer-group */
2698 ret = peer_af_flag_set (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2699 if (ret < 0)
2700 return bgp_vty_return (vty, ret);
2701
2702 /* Make peer's RIB point to group's RIB. */
2703 peer->rib[afi][safi] = group->conf->rib[afi][safi];
2704
2705 /* Import policy. */
2706 if (pfilter->map[RMAP_IMPORT].name)
2707 free (pfilter->map[RMAP_IMPORT].name);
2708 if (gfilter->map[RMAP_IMPORT].name)
2709 {
2710 pfilter->map[RMAP_IMPORT].name = strdup (gfilter->map[RMAP_IMPORT].name);
2711 pfilter->map[RMAP_IMPORT].map = gfilter->map[RMAP_IMPORT].map;
2712 }
2713 else
2714 {
2715 pfilter->map[RMAP_IMPORT].name = NULL;
2716 pfilter->map[RMAP_IMPORT].map =NULL;
2717 }
2718
2719 /* Export policy. */
2720 if (gfilter->map[RMAP_EXPORT].name && ! pfilter->map[RMAP_EXPORT].name)
2721 {
2722 pfilter->map[RMAP_EXPORT].name = strdup (gfilter->map[RMAP_EXPORT].name);
2723 pfilter->map[RMAP_EXPORT].map = gfilter->map[RMAP_EXPORT].map;
2724 }
2725 }
2726 }
2727 return CMD_SUCCESS;
2728}
2729
94f2b392 2730static int
fd79ac91 2731peer_rsclient_unset_vty (struct vty *vty, const char *peer_str,
2732 int afi, int safi)
fee0f4c6 2733{
2734 int ret;
2735 struct bgp *bgp;
2736 struct peer *peer;
2737 struct peer_group *group;
1eb8ef25 2738 struct listnode *node, *nnode;
fee0f4c6 2739
2740 bgp = vty->index;
2741
2742 peer = peer_and_group_lookup_vty (vty, peer_str);
2743 if ( ! peer )
2744 return CMD_WARNING;
2745
2746 /* If it is not a RS-Client, don't do anything. */
2747 if ( ! CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT) )
2748 return CMD_SUCCESS;
2749
2750 if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP))
2751 {
2752 group = peer->group;
2753
1eb8ef25 2754 for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
fee0f4c6 2755 {
2756 ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2757 if (ret < 0)
2758 return bgp_vty_return (vty, ret);
2759
2760 peer->rib[afi][safi] = NULL;
2761 }
2762
2763 peer = group->conf;
2764 }
2765
2766 ret = peer_af_flag_unset (peer, afi, safi, PEER_FLAG_RSERVER_CLIENT);
2767 if (ret < 0)
2768 return bgp_vty_return (vty, ret);
2769
2770 if ( ! peer_rsclient_active (peer) )
200df115 2771 {
228da428 2772 bgp_clear_route (peer, afi, safi, BGP_CLEAR_ROUTE_MY_RSCLIENT);
200df115 2773 listnode_delete (bgp->rsclient, peer);
228da428 2774 peer_unlock (peer); /* peer bgp rsclient reference */
200df115 2775 }
fee0f4c6 2776
b608d5b5 2777 bgp_table_finish (&peer->rib[bgp_node_afi(vty)][bgp_node_safi(vty)]);
fee0f4c6 2778
2779 return CMD_SUCCESS;
2780}
6b0655a2 2781
718e3744 2782/* neighbor route-server-client. */
2783DEFUN (neighbor_route_server_client,
2784 neighbor_route_server_client_cmd,
2785 NEIGHBOR_CMD2 "route-server-client",
2786 NEIGHBOR_STR
2787 NEIGHBOR_ADDR_STR2
2788 "Configure a neighbor as Route Server client\n")
2789{
fee0f4c6 2790 return peer_rsclient_set_vty (vty, argv[0], bgp_node_afi(vty),
2791 bgp_node_safi(vty));
718e3744 2792}
2793
2794DEFUN (no_neighbor_route_server_client,
2795 no_neighbor_route_server_client_cmd,
2796 NO_NEIGHBOR_CMD2 "route-server-client",
2797 NO_STR
2798 NEIGHBOR_STR
2799 NEIGHBOR_ADDR_STR2
2800 "Configure a neighbor as Route Server client\n")
fee0f4c6 2801{
2802 return peer_rsclient_unset_vty (vty, argv[0], bgp_node_afi(vty),
2803 bgp_node_safi(vty));
2804}
6b0655a2 2805
fee0f4c6 2806DEFUN (neighbor_nexthop_local_unchanged,
2807 neighbor_nexthop_local_unchanged_cmd,
2808 NEIGHBOR_CMD2 "nexthop-local unchanged",
2809 NEIGHBOR_STR
2810 NEIGHBOR_ADDR_STR2
2811 "Configure treatment of outgoing link-local nexthop attribute\n"
2812 "Leave link-local nexthop unchanged for this peer\n")
2813{
2814 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2815 bgp_node_safi (vty),
2816 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED );
2817}
6b0655a2 2818
fee0f4c6 2819DEFUN (no_neighbor_nexthop_local_unchanged,
2820 no_neighbor_nexthop_local_unchanged_cmd,
2821 NO_NEIGHBOR_CMD2 "nexthop-local unchanged",
2822 NO_STR
2823 NEIGHBOR_STR
2824 NEIGHBOR_ADDR_STR2
2825 "Configure treatment of outgoing link-local-nexthop attribute\n"
2826 "Leave link-local nexthop unchanged for this peer\n")
718e3744 2827{
2828 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
2829 bgp_node_safi (vty),
fee0f4c6 2830 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED );
718e3744 2831}
6b0655a2 2832
718e3744 2833DEFUN (neighbor_attr_unchanged,
2834 neighbor_attr_unchanged_cmd,
2835 NEIGHBOR_CMD2 "attribute-unchanged",
2836 NEIGHBOR_STR
2837 NEIGHBOR_ADDR_STR2
2838 "BGP attribute is propagated unchanged to this neighbor\n")
2839{
2840 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2841 bgp_node_safi (vty),
2842 (PEER_FLAG_AS_PATH_UNCHANGED |
2843 PEER_FLAG_NEXTHOP_UNCHANGED |
2844 PEER_FLAG_MED_UNCHANGED));
2845}
2846
2847DEFUN (neighbor_attr_unchanged1,
2848 neighbor_attr_unchanged1_cmd,
2849 NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)",
2850 NEIGHBOR_STR
2851 NEIGHBOR_ADDR_STR2
2852 "BGP attribute is propagated unchanged to this neighbor\n"
2853 "As-path attribute\n"
2854 "Nexthop attribute\n"
2855 "Med attribute\n")
2856{
2857 u_int16_t flags = 0;
2858
2859 if (strncmp (argv[1], "as-path", 1) == 0)
2860 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2861 else if (strncmp (argv[1], "next-hop", 1) == 0)
2862 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2863 else if (strncmp (argv[1], "med", 1) == 0)
2864 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2865
2866 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2867 bgp_node_safi (vty), flags);
2868}
2869
2870DEFUN (neighbor_attr_unchanged2,
2871 neighbor_attr_unchanged2_cmd,
2872 NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)",
2873 NEIGHBOR_STR
2874 NEIGHBOR_ADDR_STR2
2875 "BGP attribute is propagated unchanged to this neighbor\n"
2876 "As-path attribute\n"
2877 "Nexthop attribute\n"
2878 "Med attribute\n")
2879{
2880 u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED;
2881
2882 if (strncmp (argv[1], "next-hop", 1) == 0)
2883 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2884 else if (strncmp (argv[1], "med", 1) == 0)
2885 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2886
2887 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2888 bgp_node_safi (vty), flags);
2889
2890}
2891
2892DEFUN (neighbor_attr_unchanged3,
2893 neighbor_attr_unchanged3_cmd,
2894 NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)",
2895 NEIGHBOR_STR
2896 NEIGHBOR_ADDR_STR2
2897 "BGP attribute is propagated unchanged to this neighbor\n"
2898 "Nexthop attribute\n"
2899 "As-path attribute\n"
2900 "Med attribute\n")
2901{
2902 u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED;
2903
2904 if (strncmp (argv[1], "as-path", 1) == 0)
2905 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2906 else if (strncmp (argv[1], "med", 1) == 0)
2907 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
2908
2909 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2910 bgp_node_safi (vty), flags);
2911}
2912
2913DEFUN (neighbor_attr_unchanged4,
2914 neighbor_attr_unchanged4_cmd,
2915 NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)",
2916 NEIGHBOR_STR
2917 NEIGHBOR_ADDR_STR2
2918 "BGP attribute is propagated unchanged to this neighbor\n"
2919 "Med attribute\n"
2920 "As-path attribute\n"
2921 "Nexthop attribute\n")
2922{
2923 u_int16_t flags = PEER_FLAG_MED_UNCHANGED;
2924
2925 if (strncmp (argv[1], "as-path", 1) == 0)
2926 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
2927 else if (strncmp (argv[1], "next-hop", 1) == 0)
2928 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
2929
2930 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
2931 bgp_node_safi (vty), flags);
2932}
2933
2934ALIAS (neighbor_attr_unchanged,
2935 neighbor_attr_unchanged5_cmd,
2936 NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med",
2937 NEIGHBOR_STR
2938 NEIGHBOR_ADDR_STR2
2939 "BGP attribute is propagated unchanged to this neighbor\n"
2940 "As-path attribute\n"
2941 "Nexthop attribute\n"
2942 "Med attribute\n")
2943
2944ALIAS (neighbor_attr_unchanged,
2945 neighbor_attr_unchanged6_cmd,
2946 NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop",
2947 NEIGHBOR_STR
2948 NEIGHBOR_ADDR_STR2
2949 "BGP attribute is propagated unchanged to this neighbor\n"
2950 "As-path attribute\n"
2951 "Med attribute\n"
2952 "Nexthop attribute\n")
2953
2954ALIAS (neighbor_attr_unchanged,
2955 neighbor_attr_unchanged7_cmd,
2956 NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path",
2957 NEIGHBOR_STR
2958 NEIGHBOR_ADDR_STR2
2959 "BGP attribute is propagated unchanged to this neighbor\n"
2960 "Nexthop attribute\n"
2961 "Med attribute\n"
2962 "As-path attribute\n")
2963
2964ALIAS (neighbor_attr_unchanged,
2965 neighbor_attr_unchanged8_cmd,
2966 NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med",
2967 NEIGHBOR_STR
2968 NEIGHBOR_ADDR_STR2
2969 "BGP attribute is propagated unchanged to this neighbor\n"
2970 "Nexthop attribute\n"
2971 "As-path attribute\n"
2972 "Med attribute\n")
2973
2974ALIAS (neighbor_attr_unchanged,
2975 neighbor_attr_unchanged9_cmd,
2976 NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path",
2977 NEIGHBOR_STR
2978 NEIGHBOR_ADDR_STR2
2979 "BGP attribute is propagated unchanged to this neighbor\n"
2980 "Med attribute\n"
2981 "Nexthop attribute\n"
2982 "As-path attribute\n")
2983
2984ALIAS (neighbor_attr_unchanged,
2985 neighbor_attr_unchanged10_cmd,
2986 NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop",
2987 NEIGHBOR_STR
2988 NEIGHBOR_ADDR_STR2
2989 "BGP attribute is propagated unchanged to this neighbor\n"
2990 "Med attribute\n"
2991 "As-path attribute\n"
2992 "Nexthop attribute\n")
2993
2994DEFUN (no_neighbor_attr_unchanged,
2995 no_neighbor_attr_unchanged_cmd,
2996 NO_NEIGHBOR_CMD2 "attribute-unchanged",
2997 NO_STR
2998 NEIGHBOR_STR
2999 NEIGHBOR_ADDR_STR2
3000 "BGP attribute is propagated unchanged to this neighbor\n")
3001{
3002 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
3003 bgp_node_safi (vty),
3004 (PEER_FLAG_AS_PATH_UNCHANGED |
3005 PEER_FLAG_NEXTHOP_UNCHANGED |
3006 PEER_FLAG_MED_UNCHANGED));
3007}
3008
3009DEFUN (no_neighbor_attr_unchanged1,
3010 no_neighbor_attr_unchanged1_cmd,
3011 NO_NEIGHBOR_CMD2 "attribute-unchanged (as-path|next-hop|med)",
3012 NO_STR
3013 NEIGHBOR_STR
3014 NEIGHBOR_ADDR_STR2
3015 "BGP attribute is propagated unchanged to this neighbor\n"
3016 "As-path attribute\n"
3017 "Nexthop attribute\n"
3018 "Med attribute\n")
3019{
3020 u_int16_t flags = 0;
3021
3022 if (strncmp (argv[1], "as-path", 1) == 0)
3023 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
3024 else if (strncmp (argv[1], "next-hop", 1) == 0)
3025 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
3026 else if (strncmp (argv[1], "med", 1) == 0)
3027 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
3028
3029 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
3030 bgp_node_safi (vty), flags);
3031}
3032
3033DEFUN (no_neighbor_attr_unchanged2,
3034 no_neighbor_attr_unchanged2_cmd,
3035 NO_NEIGHBOR_CMD2 "attribute-unchanged as-path (next-hop|med)",
3036 NO_STR
3037 NEIGHBOR_STR
3038 NEIGHBOR_ADDR_STR2
3039 "BGP attribute is propagated unchanged to this neighbor\n"
3040 "As-path attribute\n"
3041 "Nexthop attribute\n"
3042 "Med attribute\n")
3043{
3044 u_int16_t flags = PEER_FLAG_AS_PATH_UNCHANGED;
3045
3046 if (strncmp (argv[1], "next-hop", 1) == 0)
3047 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
3048 else if (strncmp (argv[1], "med", 1) == 0)
3049 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
3050
3051 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
3052 bgp_node_safi (vty), flags);
3053}
3054
3055DEFUN (no_neighbor_attr_unchanged3,
3056 no_neighbor_attr_unchanged3_cmd,
3057 NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop (as-path|med)",
3058 NO_STR
3059 NEIGHBOR_STR
3060 NEIGHBOR_ADDR_STR2
3061 "BGP attribute is propagated unchanged to this neighbor\n"
3062 "Nexthop attribute\n"
3063 "As-path attribute\n"
3064 "Med attribute\n")
3065{
3066 u_int16_t flags = PEER_FLAG_NEXTHOP_UNCHANGED;
3067
3068 if (strncmp (argv[1], "as-path", 1) == 0)
3069 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
3070 else if (strncmp (argv[1], "med", 1) == 0)
3071 SET_FLAG (flags, PEER_FLAG_MED_UNCHANGED);
3072
3073 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
3074 bgp_node_safi (vty), flags);
3075}
3076
3077DEFUN (no_neighbor_attr_unchanged4,
3078 no_neighbor_attr_unchanged4_cmd,
3079 NO_NEIGHBOR_CMD2 "attribute-unchanged med (as-path|next-hop)",
3080 NO_STR
3081 NEIGHBOR_STR
3082 NEIGHBOR_ADDR_STR2
3083 "BGP attribute is propagated unchanged to this neighbor\n"
3084 "Med attribute\n"
3085 "As-path attribute\n"
3086 "Nexthop attribute\n")
3087{
3088 u_int16_t flags = PEER_FLAG_MED_UNCHANGED;
3089
3090 if (strncmp (argv[1], "as-path", 1) == 0)
3091 SET_FLAG (flags, PEER_FLAG_AS_PATH_UNCHANGED);
3092 else if (strncmp (argv[1], "next-hop", 1) == 0)
3093 SET_FLAG (flags, PEER_FLAG_NEXTHOP_UNCHANGED);
3094
3095 return peer_af_flag_unset_vty (vty, argv[0], bgp_node_afi (vty),
3096 bgp_node_safi (vty), flags);
3097}
3098
3099ALIAS (no_neighbor_attr_unchanged,
3100 no_neighbor_attr_unchanged5_cmd,
3101 NO_NEIGHBOR_CMD2 "attribute-unchanged as-path next-hop med",
3102 NO_STR
3103 NEIGHBOR_STR
3104 NEIGHBOR_ADDR_STR2
3105 "BGP attribute is propagated unchanged to this neighbor\n"
3106 "As-path attribute\n"
3107 "Nexthop attribute\n"
3108 "Med attribute\n")
3109
3110ALIAS (no_neighbor_attr_unchanged,
3111 no_neighbor_attr_unchanged6_cmd,
3112 NO_NEIGHBOR_CMD2 "attribute-unchanged as-path med next-hop",
3113 NO_STR
3114 NEIGHBOR_STR
3115 NEIGHBOR_ADDR_STR2
3116 "BGP attribute is propagated unchanged to this neighbor\n"
3117 "As-path attribute\n"
3118 "Med attribute\n"
3119 "Nexthop attribute\n")
3120
3121ALIAS (no_neighbor_attr_unchanged,
3122 no_neighbor_attr_unchanged7_cmd,
3123 NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop med as-path",
3124 NO_STR
3125 NEIGHBOR_STR
3126 NEIGHBOR_ADDR_STR2
3127 "BGP attribute is propagated unchanged to this neighbor\n"
3128 "Nexthop attribute\n"
3129 "Med attribute\n"
3130 "As-path attribute\n")
3131
3132ALIAS (no_neighbor_attr_unchanged,
3133 no_neighbor_attr_unchanged8_cmd,
3134 NO_NEIGHBOR_CMD2 "attribute-unchanged next-hop as-path med",
3135 NO_STR
3136 NEIGHBOR_STR
3137 NEIGHBOR_ADDR_STR2
3138 "BGP attribute is propagated unchanged to this neighbor\n"
3139 "Nexthop attribute\n"
3140 "As-path attribute\n"
3141 "Med attribute\n")
3142
3143ALIAS (no_neighbor_attr_unchanged,
3144 no_neighbor_attr_unchanged9_cmd,
3145 NO_NEIGHBOR_CMD2 "attribute-unchanged med next-hop as-path",
3146 NO_STR
3147 NEIGHBOR_STR
3148 NEIGHBOR_ADDR_STR2
3149 "BGP attribute is propagated unchanged to this neighbor\n"
3150 "Med attribute\n"
3151 "Nexthop attribute\n"
3152 "As-path attribute\n")
3153
3154ALIAS (no_neighbor_attr_unchanged,
3155 no_neighbor_attr_unchanged10_cmd,
3156 NO_NEIGHBOR_CMD2 "attribute-unchanged med as-path next-hop",
3157 NO_STR
3158 NEIGHBOR_STR
3159 NEIGHBOR_ADDR_STR2
3160 "BGP attribute is propagated unchanged to this neighbor\n"
3161 "Med attribute\n"
3162 "As-path attribute\n"
3163 "Nexthop attribute\n")
3164
3165/* For old version Zebra compatibility. */
dd4c593f 3166DEFUN_DEPRECATED (neighbor_transparent_as,
3167 neighbor_transparent_as_cmd,
3168 NEIGHBOR_CMD "transparent-as",
3169 NEIGHBOR_STR
3170 NEIGHBOR_ADDR_STR
3171 "Do not append my AS number even peer is EBGP peer\n")
718e3744 3172{
3173 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
3174 bgp_node_safi (vty),
3175 PEER_FLAG_AS_PATH_UNCHANGED);
3176}
3177
dd4c593f 3178DEFUN_DEPRECATED (neighbor_transparent_nexthop,
3179 neighbor_transparent_nexthop_cmd,
3180 NEIGHBOR_CMD "transparent-nexthop",
3181 NEIGHBOR_STR
3182 NEIGHBOR_ADDR_STR
3183 "Do not change nexthop even peer is EBGP peer\n")
718e3744 3184{
3185 return peer_af_flag_set_vty (vty, argv[0], bgp_node_afi (vty),
3186 bgp_node_safi (vty),
3187 PEER_FLAG_NEXTHOP_UNCHANGED);
3188}
6b0655a2 3189
718e3744 3190/* EBGP multihop configuration. */
94f2b392 3191static int
fd79ac91 3192peer_ebgp_multihop_set_vty (struct vty *vty, const char *ip_str,
3193 const char *ttl_str)
718e3744 3194{
3195 struct peer *peer;
fd79ac91 3196 unsigned int ttl;
718e3744 3197
3198 peer = peer_and_group_lookup_vty (vty, ip_str);
3199 if (! peer)
3200 return CMD_WARNING;
3201
3202 if (! ttl_str)
3203 ttl = TTL_MAX;
3204 else
3205 VTY_GET_INTEGER_RANGE ("TTL", ttl, ttl_str, 1, 255);
3206
89b6d1f8 3207 return bgp_vty_return (vty, peer_ebgp_multihop_set (peer, ttl));
718e3744 3208}
3209
94f2b392 3210static int
fd79ac91 3211peer_ebgp_multihop_unset_vty (struct vty *vty, const char *ip_str)
718e3744 3212{
3213 struct peer *peer;
3214
3215 peer = peer_and_group_lookup_vty (vty, ip_str);
3216 if (! peer)
3217 return CMD_WARNING;
3218
89b6d1f8 3219 return bgp_vty_return (vty, peer_ebgp_multihop_unset (peer));
718e3744 3220}
3221
3222/* neighbor ebgp-multihop. */
3223DEFUN (neighbor_ebgp_multihop,
3224 neighbor_ebgp_multihop_cmd,
3225 NEIGHBOR_CMD2 "ebgp-multihop",
3226 NEIGHBOR_STR
3227 NEIGHBOR_ADDR_STR2
3228 "Allow EBGP neighbors not on directly connected networks\n")
3229{
3230 return peer_ebgp_multihop_set_vty (vty, argv[0], NULL);
3231}
3232
3233DEFUN (neighbor_ebgp_multihop_ttl,
3234 neighbor_ebgp_multihop_ttl_cmd,
3235 NEIGHBOR_CMD2 "ebgp-multihop <1-255>",
3236 NEIGHBOR_STR
3237 NEIGHBOR_ADDR_STR2
3238 "Allow EBGP neighbors not on directly connected networks\n"
3239 "maximum hop count\n")
3240{
3241 return peer_ebgp_multihop_set_vty (vty, argv[0], argv[1]);
3242}
3243
3244DEFUN (no_neighbor_ebgp_multihop,
3245 no_neighbor_ebgp_multihop_cmd,
3246 NO_NEIGHBOR_CMD2 "ebgp-multihop",
3247 NO_STR
3248 NEIGHBOR_STR
3249 NEIGHBOR_ADDR_STR2
3250 "Allow EBGP neighbors not on directly connected networks\n")
3251{
3252 return peer_ebgp_multihop_unset_vty (vty, argv[0]);
3253}
3254
3255ALIAS (no_neighbor_ebgp_multihop,
3256 no_neighbor_ebgp_multihop_ttl_cmd,
3257 NO_NEIGHBOR_CMD2 "ebgp-multihop <1-255>",
3258 NO_STR
3259 NEIGHBOR_STR
3260 NEIGHBOR_ADDR_STR2
3261 "Allow EBGP neighbors not on directly connected networks\n"
3262 "maximum hop count\n")
6b0655a2 3263
6ffd2079 3264/* disable-connected-check */
3265DEFUN (neighbor_disable_connected_check,
3266 neighbor_disable_connected_check_cmd,
3267 NEIGHBOR_CMD2 "disable-connected-check",
3268 NEIGHBOR_STR
3269 NEIGHBOR_ADDR_STR2
3270 "one-hop away EBGP peer using loopback address\n")
3271{
3272 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK);
3273}
3274
3275DEFUN (no_neighbor_disable_connected_check,
3276 no_neighbor_disable_connected_check_cmd,
3277 NO_NEIGHBOR_CMD2 "disable-connected-check",
3278 NO_STR
3279 NEIGHBOR_STR
3280 NEIGHBOR_ADDR_STR2
3281 "one-hop away EBGP peer using loopback address\n")
3282{
3283 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_DISABLE_CONNECTED_CHECK);
3284}
3285
718e3744 3286/* Enforce multihop. */
6ffd2079 3287ALIAS (neighbor_disable_connected_check,
718e3744 3288 neighbor_enforce_multihop_cmd,
3289 NEIGHBOR_CMD2 "enforce-multihop",
3290 NEIGHBOR_STR
3291 NEIGHBOR_ADDR_STR2
e8e1946e 3292 "Enforce EBGP neighbors perform multihop\n")
718e3744 3293
6ffd2079 3294/* Enforce multihop. */
3295ALIAS (no_neighbor_disable_connected_check,
718e3744 3296 no_neighbor_enforce_multihop_cmd,
3297 NO_NEIGHBOR_CMD2 "enforce-multihop",
3298 NO_STR
3299 NEIGHBOR_STR
3300 NEIGHBOR_ADDR_STR2
e8e1946e 3301 "Enforce EBGP neighbors perform multihop\n")
6b0655a2 3302
718e3744 3303DEFUN (neighbor_description,
3304 neighbor_description_cmd,
3305 NEIGHBOR_CMD2 "description .LINE",
3306 NEIGHBOR_STR
3307 NEIGHBOR_ADDR_STR2
3308 "Neighbor specific description\n"
3309 "Up to 80 characters describing this neighbor\n")
3310{
3311 struct peer *peer;
718e3744 3312 char *str;
718e3744 3313
3314 peer = peer_and_group_lookup_vty (vty, argv[0]);
3315 if (! peer)
3316 return CMD_WARNING;
3317
3318 if (argc == 1)
3319 return CMD_SUCCESS;
3320
3b8b1855 3321 str = argv_concat(argv, argc, 1);
718e3744 3322
3323 peer_description_set (peer, str);
3324
3b8b1855 3325 XFREE (MTYPE_TMP, str);
718e3744 3326
3327 return CMD_SUCCESS;
3328}
3329
3330DEFUN (no_neighbor_description,
3331 no_neighbor_description_cmd,
3332 NO_NEIGHBOR_CMD2 "description",
3333 NO_STR
3334 NEIGHBOR_STR
3335 NEIGHBOR_ADDR_STR2
3336 "Neighbor specific description\n")
3337{
3338 struct peer *peer;
3339
3340 peer = peer_and_group_lookup_vty (vty, argv[0]);
3341 if (! peer)
3342 return CMD_WARNING;
3343
3344 peer_description_unset (peer);
3345
3346 return CMD_SUCCESS;
3347}
3348
3349ALIAS (no_neighbor_description,
3350 no_neighbor_description_val_cmd,
3351 NO_NEIGHBOR_CMD2 "description .LINE",
3352 NO_STR
3353 NEIGHBOR_STR
3354 NEIGHBOR_ADDR_STR2
3355 "Neighbor specific description\n"
3356 "Up to 80 characters describing this neighbor\n")
6b0655a2 3357
718e3744 3358/* Neighbor update-source. */
94f2b392 3359static int
fd79ac91 3360peer_update_source_vty (struct vty *vty, const char *peer_str,
3361 const char *source_str)
718e3744 3362{
3363 struct peer *peer;
718e3744 3364
3365 peer = peer_and_group_lookup_vty (vty, peer_str);
3366 if (! peer)
3367 return CMD_WARNING;
3368
a80beece
DS
3369 if (peer->conf_if)
3370 return CMD_WARNING;
3371
718e3744 3372 if (source_str)
3373 {
c63b83fe
JBD
3374 union sockunion su;
3375 int ret = str2sockunion (source_str, &su);
3376
3377 if (ret == 0)
3378 peer_update_source_addr_set (peer, &su);
718e3744 3379 else
3380 peer_update_source_if_set (peer, source_str);
3381 }
3382 else
3383 peer_update_source_unset (peer);
3384
3385 return CMD_SUCCESS;
3386}
3387
9a1a331d 3388#define BGP_UPDATE_SOURCE_STR "(A.B.C.D|X:X::X:X|WORD)"
369688c0
PJ
3389#define BGP_UPDATE_SOURCE_HELP_STR \
3390 "IPv4 address\n" \
9a1a331d
PJ
3391 "IPv6 address\n" \
3392 "Interface name (requires zebra to be running)\n"
369688c0 3393
718e3744 3394DEFUN (neighbor_update_source,
3395 neighbor_update_source_cmd,
369688c0 3396 NEIGHBOR_CMD2 "update-source " BGP_UPDATE_SOURCE_STR,
718e3744 3397 NEIGHBOR_STR
3398 NEIGHBOR_ADDR_STR2
3399 "Source of routing updates\n"
369688c0 3400 BGP_UPDATE_SOURCE_HELP_STR)
718e3744 3401{
3402 return peer_update_source_vty (vty, argv[0], argv[1]);
3403}
3404
3405DEFUN (no_neighbor_update_source,
3406 no_neighbor_update_source_cmd,
3407 NO_NEIGHBOR_CMD2 "update-source",
3408 NO_STR
3409 NEIGHBOR_STR
3410 NEIGHBOR_ADDR_STR2
369688c0 3411 "Source of routing updates\n")
718e3744 3412{
3413 return peer_update_source_vty (vty, argv[0], NULL);
3414}
6b0655a2 3415
94f2b392 3416static int
fd79ac91 3417peer_default_originate_set_vty (struct vty *vty, const char *peer_str,
3418 afi_t afi, safi_t safi,
3419 const char *rmap, int set)
718e3744 3420{
3421 int ret;
3422 struct peer *peer;
3423
3424 peer = peer_and_group_lookup_vty (vty, peer_str);
3425 if (! peer)
3426 return CMD_WARNING;
3427
3428 if (set)
3429 ret = peer_default_originate_set (peer, afi, safi, rmap);
3430 else
3431 ret = peer_default_originate_unset (peer, afi, safi);
3432
3433 return bgp_vty_return (vty, ret);
3434}
3435
3436/* neighbor default-originate. */
3437DEFUN (neighbor_default_originate,
3438 neighbor_default_originate_cmd,
3439 NEIGHBOR_CMD2 "default-originate",
3440 NEIGHBOR_STR
3441 NEIGHBOR_ADDR_STR2
3442 "Originate default route to this neighbor\n")
3443{
3444 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
3445 bgp_node_safi (vty), NULL, 1);
3446}
3447
3448DEFUN (neighbor_default_originate_rmap,
3449 neighbor_default_originate_rmap_cmd,
3450 NEIGHBOR_CMD2 "default-originate route-map WORD",
3451 NEIGHBOR_STR
3452 NEIGHBOR_ADDR_STR2
3453 "Originate default route to this neighbor\n"
3454 "Route-map to specify criteria to originate default\n"
3455 "route-map name\n")
3456{
3457 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
3458 bgp_node_safi (vty), argv[1], 1);
3459}
3460
3461DEFUN (no_neighbor_default_originate,
3462 no_neighbor_default_originate_cmd,
3463 NO_NEIGHBOR_CMD2 "default-originate",
3464 NO_STR
3465 NEIGHBOR_STR
3466 NEIGHBOR_ADDR_STR2
3467 "Originate default route to this neighbor\n")
3468{
3469 return peer_default_originate_set_vty (vty, argv[0], bgp_node_afi (vty),
3470 bgp_node_safi (vty), NULL, 0);
3471}
3472
3473ALIAS (no_neighbor_default_originate,
3474 no_neighbor_default_originate_rmap_cmd,
3475 NO_NEIGHBOR_CMD2 "default-originate route-map WORD",
3476 NO_STR
3477 NEIGHBOR_STR
3478 NEIGHBOR_ADDR_STR2
3479 "Originate default route to this neighbor\n"
3480 "Route-map to specify criteria to originate default\n"
3481 "route-map name\n")
6b0655a2 3482
718e3744 3483/* Set neighbor's BGP port. */
94f2b392 3484static int
fd79ac91 3485peer_port_vty (struct vty *vty, const char *ip_str, int afi,
3486 const char *port_str)
718e3744 3487{
3488 struct peer *peer;
3489 u_int16_t port;
3490 struct servent *sp;
3491
3492 peer = peer_lookup_vty (vty, ip_str);
3493 if (! peer)
3494 return CMD_WARNING;
3495
3496 if (! port_str)
3497 {
3498 sp = getservbyname ("bgp", "tcp");
3499 port = (sp == NULL) ? BGP_PORT_DEFAULT : ntohs (sp->s_port);
3500 }
3501 else
3502 {
3503 VTY_GET_INTEGER("port", port, port_str);
3504 }
3505
3506 peer_port_set (peer, port);
3507
3508 return CMD_SUCCESS;
3509}
3510
f418446b 3511/* Set specified peer's BGP port. */
718e3744 3512DEFUN (neighbor_port,
3513 neighbor_port_cmd,
3514 NEIGHBOR_CMD "port <0-65535>",
3515 NEIGHBOR_STR
3516 NEIGHBOR_ADDR_STR
3517 "Neighbor's BGP port\n"
3518 "TCP port number\n")
3519{
3520 return peer_port_vty (vty, argv[0], AFI_IP, argv[1]);
3521}
3522
3523DEFUN (no_neighbor_port,
3524 no_neighbor_port_cmd,
3525 NO_NEIGHBOR_CMD "port",
3526 NO_STR
3527 NEIGHBOR_STR
3528 NEIGHBOR_ADDR_STR
3529 "Neighbor's BGP port\n")
3530{
3531 return peer_port_vty (vty, argv[0], AFI_IP, NULL);
3532}
3533
3534ALIAS (no_neighbor_port,
3535 no_neighbor_port_val_cmd,
3536 NO_NEIGHBOR_CMD "port <0-65535>",
3537 NO_STR
3538 NEIGHBOR_STR
3539 NEIGHBOR_ADDR_STR
3540 "Neighbor's BGP port\n"
3541 "TCP port number\n")
6b0655a2 3542
718e3744 3543/* neighbor weight. */
94f2b392 3544static int
fd79ac91 3545peer_weight_set_vty (struct vty *vty, const char *ip_str,
3546 const char *weight_str)
718e3744 3547{
3548 int ret;
3549 struct peer *peer;
3550 unsigned long weight;
3551
3552 peer = peer_and_group_lookup_vty (vty, ip_str);
3553 if (! peer)
3554 return CMD_WARNING;
3555
3556 VTY_GET_INTEGER_RANGE("weight", weight, weight_str, 0, 65535);
3557
3558 ret = peer_weight_set (peer, weight);
3559
3560 return CMD_SUCCESS;
3561}
3562
94f2b392 3563static int
fd79ac91 3564peer_weight_unset_vty (struct vty *vty, const char *ip_str)
718e3744 3565{
3566 struct peer *peer;
3567
3568 peer = peer_and_group_lookup_vty (vty, ip_str);
3569 if (! peer)
3570 return CMD_WARNING;
3571
3572 peer_weight_unset (peer);
3573
3574 return CMD_SUCCESS;
3575}
3576
3577DEFUN (neighbor_weight,
3578 neighbor_weight_cmd,
3579 NEIGHBOR_CMD2 "weight <0-65535>",
3580 NEIGHBOR_STR
3581 NEIGHBOR_ADDR_STR2
3582 "Set default weight for routes from this neighbor\n"
3583 "default weight\n")
3584{
3585 return peer_weight_set_vty (vty, argv[0], argv[1]);
3586}
3587
3588DEFUN (no_neighbor_weight,
3589 no_neighbor_weight_cmd,
3590 NO_NEIGHBOR_CMD2 "weight",
3591 NO_STR
3592 NEIGHBOR_STR
3593 NEIGHBOR_ADDR_STR2
3594 "Set default weight for routes from this neighbor\n")
3595{
3596 return peer_weight_unset_vty (vty, argv[0]);
3597}
3598
3599ALIAS (no_neighbor_weight,
3600 no_neighbor_weight_val_cmd,
3601 NO_NEIGHBOR_CMD2 "weight <0-65535>",
3602 NO_STR
3603 NEIGHBOR_STR
3604 NEIGHBOR_ADDR_STR2
3605 "Set default weight for routes from this neighbor\n"
3606 "default weight\n")
6b0655a2 3607
718e3744 3608/* Override capability negotiation. */
3609DEFUN (neighbor_override_capability,
3610 neighbor_override_capability_cmd,
3611 NEIGHBOR_CMD2 "override-capability",
3612 NEIGHBOR_STR
3613 NEIGHBOR_ADDR_STR2
3614 "Override capability negotiation result\n")
3615{
3616 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY);
3617}
3618
3619DEFUN (no_neighbor_override_capability,
3620 no_neighbor_override_capability_cmd,
3621 NO_NEIGHBOR_CMD2 "override-capability",
3622 NO_STR
3623 NEIGHBOR_STR
3624 NEIGHBOR_ADDR_STR2
3625 "Override capability negotiation result\n")
3626{
3627 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_OVERRIDE_CAPABILITY);
3628}
6b0655a2 3629
718e3744 3630DEFUN (neighbor_strict_capability,
3631 neighbor_strict_capability_cmd,
3632 NEIGHBOR_CMD "strict-capability-match",
3633 NEIGHBOR_STR
3634 NEIGHBOR_ADDR_STR
3635 "Strict capability negotiation match\n")
3636{
3637 return peer_flag_set_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH);
3638}
3639
3640DEFUN (no_neighbor_strict_capability,
3641 no_neighbor_strict_capability_cmd,
3642 NO_NEIGHBOR_CMD "strict-capability-match",
3643 NO_STR
3644 NEIGHBOR_STR
3645 NEIGHBOR_ADDR_STR
3646 "Strict capability negotiation match\n")
3647{
3648 return peer_flag_unset_vty (vty, argv[0], PEER_FLAG_STRICT_CAP_MATCH);
3649}
6b0655a2 3650
94f2b392 3651static int
fd79ac91 3652peer_timers_set_vty (struct vty *vty, const char *ip_str,
3653 const char *keep_str, const char *hold_str)
718e3744 3654{
3655 int ret;
3656 struct peer *peer;
3657 u_int32_t keepalive;
3658 u_int32_t holdtime;
3659
3660 peer = peer_and_group_lookup_vty (vty, ip_str);
3661 if (! peer)
3662 return CMD_WARNING;
3663
3664 VTY_GET_INTEGER_RANGE ("Keepalive", keepalive, keep_str, 0, 65535);
3665 VTY_GET_INTEGER_RANGE ("Holdtime", holdtime, hold_str, 0, 65535);
3666
3667 ret = peer_timers_set (peer, keepalive, holdtime);
3668
3669 return bgp_vty_return (vty, ret);
3670}
6b0655a2 3671
94f2b392 3672static int
fd79ac91 3673peer_timers_unset_vty (struct vty *vty, const char *ip_str)
718e3744 3674{
3675 int ret;
3676 struct peer *peer;
3677
3678 peer = peer_lookup_vty (vty, ip_str);
3679 if (! peer)
3680 return CMD_WARNING;
3681
3682 ret = peer_timers_unset (peer);
3683
3684 return bgp_vty_return (vty, ret);
3685}
3686
3687DEFUN (neighbor_timers,
3688 neighbor_timers_cmd,
3689 NEIGHBOR_CMD2 "timers <0-65535> <0-65535>",
3690 NEIGHBOR_STR
3691 NEIGHBOR_ADDR_STR2
3692 "BGP per neighbor timers\n"
3693 "Keepalive interval\n"
3694 "Holdtime\n")
3695{
3696 return peer_timers_set_vty (vty, argv[0], argv[1], argv[2]);
3697}
3698
3699DEFUN (no_neighbor_timers,
3700 no_neighbor_timers_cmd,
3701 NO_NEIGHBOR_CMD2 "timers",
3702 NO_STR
3703 NEIGHBOR_STR
3704 NEIGHBOR_ADDR_STR2
3705 "BGP per neighbor timers\n")
3706{
3707 return peer_timers_unset_vty (vty, argv[0]);
3708}
6b0655a2 3709
94f2b392 3710static int
fd79ac91 3711peer_timers_connect_set_vty (struct vty *vty, const char *ip_str,
3712 const char *time_str)
718e3744 3713{
3714 int ret;
3715 struct peer *peer;
3716 u_int32_t connect;
3717
966f821c 3718 peer = peer_and_group_lookup_vty (vty, ip_str);
718e3744 3719 if (! peer)
3720 return CMD_WARNING;
3721
3722 VTY_GET_INTEGER_RANGE ("Connect time", connect, time_str, 0, 65535);
3723
3724 ret = peer_timers_connect_set (peer, connect);
3725
966f821c 3726 return bgp_vty_return (vty, ret);
718e3744 3727}
3728
94f2b392 3729static int
fd79ac91 3730peer_timers_connect_unset_vty (struct vty *vty, const char *ip_str)
718e3744 3731{
3732 int ret;
3733 struct peer *peer;
3734
3735 peer = peer_and_group_lookup_vty (vty, ip_str);
3736 if (! peer)
3737 return CMD_WARNING;
3738
3739 ret = peer_timers_connect_unset (peer);
3740
966f821c 3741 return bgp_vty_return (vty, ret);
718e3744 3742}
3743
3744DEFUN (neighbor_timers_connect,
3745 neighbor_timers_connect_cmd,
966f821c 3746 NEIGHBOR_CMD2 "timers connect <0-65535>",
718e3744 3747 NEIGHBOR_STR
966f821c 3748 NEIGHBOR_ADDR_STR2
718e3744 3749 "BGP per neighbor timers\n"
3750 "BGP connect timer\n"
3751 "Connect timer\n")
3752{
3753 return peer_timers_connect_set_vty (vty, argv[0], argv[1]);
3754}
3755
3756DEFUN (no_neighbor_timers_connect,
3757 no_neighbor_timers_connect_cmd,
966f821c 3758 NO_NEIGHBOR_CMD2 "timers connect",
718e3744 3759 NO_STR
3760 NEIGHBOR_STR
966f821c 3761 NEIGHBOR_ADDR_STR2
718e3744 3762 "BGP per neighbor timers\n"
3763 "BGP connect timer\n")
3764{
3765 return peer_timers_connect_unset_vty (vty, argv[0]);
3766}
3767
3768ALIAS (no_neighbor_timers_connect,
3769 no_neighbor_timers_connect_val_cmd,
966f821c 3770 NO_NEIGHBOR_CMD2 "timers connect <0-65535>",
718e3744 3771 NO_STR
3772 NEIGHBOR_STR
966f821c 3773 NEIGHBOR_ADDR_STR2
718e3744 3774 "BGP per neighbor timers\n"
3775 "BGP connect timer\n"
3776 "Connect timer\n")
6b0655a2 3777
94f2b392 3778static int
fd79ac91 3779peer_advertise_interval_vty (struct vty *vty, const char *ip_str,
3780 const char *time_str, int set)
718e3744 3781{
3782 int ret;
3783 struct peer *peer;
3784 u_int32_t routeadv = 0;
3785
966f821c 3786 peer = peer_and_group_lookup_vty (vty, ip_str);
718e3744 3787 if (! peer)
3788 return CMD_WARNING;
3789
3790 if (time_str)
3791 VTY_GET_INTEGER_RANGE ("advertise interval", routeadv, time_str, 0, 600);
3792
3793 if (set)
3794 ret = peer_advertise_interval_set (peer, routeadv);
3795 else
3796 ret = peer_advertise_interval_unset (peer);
3797
966f821c 3798 return bgp_vty_return (vty, ret);
718e3744 3799}
3800
3801DEFUN (neighbor_advertise_interval,
3802 neighbor_advertise_interval_cmd,
966f821c 3803 NEIGHBOR_CMD2 "advertisement-interval <0-600>",
718e3744 3804 NEIGHBOR_STR
966f821c 3805 NEIGHBOR_ADDR_STR2
718e3744 3806 "Minimum interval between sending BGP routing updates\n"
3807 "time in seconds\n")
3808{
3809 return peer_advertise_interval_vty (vty, argv[0], argv[1], 1);
3810}
3811
3812DEFUN (no_neighbor_advertise_interval,
3813 no_neighbor_advertise_interval_cmd,
966f821c 3814 NO_NEIGHBOR_CMD2 "advertisement-interval",
718e3744 3815 NO_STR
3816 NEIGHBOR_STR
966f821c 3817 NEIGHBOR_ADDR_STR2
718e3744 3818 "Minimum interval between sending BGP routing updates\n")
3819{
3820 return peer_advertise_interval_vty (vty, argv[0], NULL, 0);
3821}
3822
3823ALIAS (no_neighbor_advertise_interval,
3824 no_neighbor_advertise_interval_val_cmd,
966f821c 3825 NO_NEIGHBOR_CMD2 "advertisement-interval <0-600>",
718e3744 3826 NO_STR
3827 NEIGHBOR_STR
966f821c 3828 NEIGHBOR_ADDR_STR2
718e3744 3829 "Minimum interval between sending BGP routing updates\n"
3830 "time in seconds\n")
6b0655a2 3831
718e3744 3832/* neighbor interface */
94f2b392 3833static int
fd79ac91 3834peer_interface_vty (struct vty *vty, const char *ip_str, const char *str)
718e3744 3835{
3836 int ret;
3837 struct peer *peer;
3838
3839 peer = peer_lookup_vty (vty, ip_str);
a80beece 3840 if (! peer || peer->conf_if)
718e3744 3841 return CMD_WARNING;
3842
3843 if (str)
3844 ret = peer_interface_set (peer, str);
3845 else
3846 ret = peer_interface_unset (peer);
3847
3848 return CMD_SUCCESS;
3849}
3850
3851DEFUN (neighbor_interface,
3852 neighbor_interface_cmd,
3853 NEIGHBOR_CMD "interface WORD",
3854 NEIGHBOR_STR
3855 NEIGHBOR_ADDR_STR
3856 "Interface\n"
3857 "Interface name\n")
3858{
3859 return peer_interface_vty (vty, argv[0], argv[1]);
3860}
3861
3862DEFUN (no_neighbor_interface,
3863 no_neighbor_interface_cmd,
3864 NO_NEIGHBOR_CMD "interface WORD",
3865 NO_STR
3866 NEIGHBOR_STR
3867 NEIGHBOR_ADDR_STR
3868 "Interface\n"
3869 "Interface name\n")
3870{
3871 return peer_interface_vty (vty, argv[0], NULL);
3872}
6b0655a2 3873
718e3744 3874/* Set distribute list to the peer. */
94f2b392 3875static int
fd79ac91 3876peer_distribute_set_vty (struct vty *vty, const char *ip_str,
3877 afi_t afi, safi_t safi,
3878 const char *name_str, const char *direct_str)
718e3744 3879{
3880 int ret;
3881 struct peer *peer;
3882 int direct = FILTER_IN;
3883
3884 peer = peer_and_group_lookup_vty (vty, ip_str);
3885 if (! peer)
3886 return CMD_WARNING;
3887
3888 /* Check filter direction. */
3889 if (strncmp (direct_str, "i", 1) == 0)
3890 direct = FILTER_IN;
3891 else if (strncmp (direct_str, "o", 1) == 0)
3892 direct = FILTER_OUT;
3893
3894 ret = peer_distribute_set (peer, afi, safi, direct, name_str);
3895
3896 return bgp_vty_return (vty, ret);
3897}
3898
94f2b392 3899static int
fd79ac91 3900peer_distribute_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
3901 safi_t safi, const char *direct_str)
718e3744 3902{
3903 int ret;
3904 struct peer *peer;
3905 int direct = FILTER_IN;
3906
3907 peer = peer_and_group_lookup_vty (vty, ip_str);
3908 if (! peer)
3909 return CMD_WARNING;
3910
3911 /* Check filter direction. */
3912 if (strncmp (direct_str, "i", 1) == 0)
3913 direct = FILTER_IN;
3914 else if (strncmp (direct_str, "o", 1) == 0)
3915 direct = FILTER_OUT;
3916
3917 ret = peer_distribute_unset (peer, afi, safi, direct);
3918
3919 return bgp_vty_return (vty, ret);
3920}
3921
3922DEFUN (neighbor_distribute_list,
3923 neighbor_distribute_list_cmd,
3924 NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)",
3925 NEIGHBOR_STR
3926 NEIGHBOR_ADDR_STR2
3927 "Filter updates to/from this neighbor\n"
3928 "IP access-list number\n"
3929 "IP access-list number (expanded range)\n"
3930 "IP Access-list name\n"
3931 "Filter incoming updates\n"
3932 "Filter outgoing updates\n")
3933{
3934 return peer_distribute_set_vty (vty, argv[0], bgp_node_afi (vty),
3935 bgp_node_safi (vty), argv[1], argv[2]);
3936}
3937
3938DEFUN (no_neighbor_distribute_list,
3939 no_neighbor_distribute_list_cmd,
3940 NO_NEIGHBOR_CMD2 "distribute-list (<1-199>|<1300-2699>|WORD) (in|out)",
3941 NO_STR
3942 NEIGHBOR_STR
3943 NEIGHBOR_ADDR_STR2
3944 "Filter updates to/from this neighbor\n"
3945 "IP access-list number\n"
3946 "IP access-list number (expanded range)\n"
3947 "IP Access-list name\n"
3948 "Filter incoming updates\n"
3949 "Filter outgoing updates\n")
3950{
3951 return peer_distribute_unset_vty (vty, argv[0], bgp_node_afi (vty),
3952 bgp_node_safi (vty), argv[2]);
3953}
6b0655a2 3954
718e3744 3955/* Set prefix list to the peer. */
94f2b392 3956static int
fd79ac91 3957peer_prefix_list_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
3958 safi_t safi, const char *name_str,
3959 const char *direct_str)
718e3744 3960{
3961 int ret;
3962 struct peer *peer;
3963 int direct = FILTER_IN;
3964
3965 peer = peer_and_group_lookup_vty (vty, ip_str);
3966 if (! peer)
3967 return CMD_WARNING;
3968
3969 /* Check filter direction. */
3970 if (strncmp (direct_str, "i", 1) == 0)
3971 direct = FILTER_IN;
3972 else if (strncmp (direct_str, "o", 1) == 0)
3973 direct = FILTER_OUT;
3974
3975 ret = peer_prefix_list_set (peer, afi, safi, direct, name_str);
3976
3977 return bgp_vty_return (vty, ret);
3978}
3979
94f2b392 3980static int
fd79ac91 3981peer_prefix_list_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
3982 safi_t safi, const char *direct_str)
718e3744 3983{
3984 int ret;
3985 struct peer *peer;
3986 int direct = FILTER_IN;
3987
3988 peer = peer_and_group_lookup_vty (vty, ip_str);
3989 if (! peer)
3990 return CMD_WARNING;
3991
3992 /* Check filter direction. */
3993 if (strncmp (direct_str, "i", 1) == 0)
3994 direct = FILTER_IN;
3995 else if (strncmp (direct_str, "o", 1) == 0)
3996 direct = FILTER_OUT;
3997
3998 ret = peer_prefix_list_unset (peer, afi, safi, direct);
3999
4000 return bgp_vty_return (vty, ret);
4001}
4002
4003DEFUN (neighbor_prefix_list,
4004 neighbor_prefix_list_cmd,
4005 NEIGHBOR_CMD2 "prefix-list WORD (in|out)",
4006 NEIGHBOR_STR
4007 NEIGHBOR_ADDR_STR2
4008 "Filter updates to/from this neighbor\n"
4009 "Name of a prefix list\n"
4010 "Filter incoming updates\n"
4011 "Filter outgoing updates\n")
4012{
4013 return peer_prefix_list_set_vty (vty, argv[0], bgp_node_afi (vty),
4014 bgp_node_safi (vty), argv[1], argv[2]);
4015}
4016
4017DEFUN (no_neighbor_prefix_list,
4018 no_neighbor_prefix_list_cmd,
4019 NO_NEIGHBOR_CMD2 "prefix-list WORD (in|out)",
4020 NO_STR
4021 NEIGHBOR_STR
4022 NEIGHBOR_ADDR_STR2
4023 "Filter updates to/from this neighbor\n"
4024 "Name of a prefix list\n"
4025 "Filter incoming updates\n"
4026 "Filter outgoing updates\n")
4027{
4028 return peer_prefix_list_unset_vty (vty, argv[0], bgp_node_afi (vty),
4029 bgp_node_safi (vty), argv[2]);
4030}
6b0655a2 4031
94f2b392 4032static int
fd79ac91 4033peer_aslist_set_vty (struct vty *vty, const char *ip_str,
4034 afi_t afi, safi_t safi,
4035 const char *name_str, const char *direct_str)
718e3744 4036{
4037 int ret;
4038 struct peer *peer;
4039 int direct = FILTER_IN;
4040
4041 peer = peer_and_group_lookup_vty (vty, ip_str);
4042 if (! peer)
4043 return CMD_WARNING;
4044
4045 /* Check filter direction. */
4046 if (strncmp (direct_str, "i", 1) == 0)
4047 direct = FILTER_IN;
4048 else if (strncmp (direct_str, "o", 1) == 0)
4049 direct = FILTER_OUT;
4050
4051 ret = peer_aslist_set (peer, afi, safi, direct, name_str);
4052
4053 return bgp_vty_return (vty, ret);
4054}
4055
94f2b392 4056static int
fd79ac91 4057peer_aslist_unset_vty (struct vty *vty, const char *ip_str,
4058 afi_t afi, safi_t safi,
4059 const char *direct_str)
718e3744 4060{
4061 int ret;
4062 struct peer *peer;
4063 int direct = FILTER_IN;
4064
4065 peer = peer_and_group_lookup_vty (vty, ip_str);
4066 if (! peer)
4067 return CMD_WARNING;
4068
4069 /* Check filter direction. */
4070 if (strncmp (direct_str, "i", 1) == 0)
4071 direct = FILTER_IN;
4072 else if (strncmp (direct_str, "o", 1) == 0)
4073 direct = FILTER_OUT;
4074
4075 ret = peer_aslist_unset (peer, afi, safi, direct);
4076
4077 return bgp_vty_return (vty, ret);
4078}
4079
4080DEFUN (neighbor_filter_list,
4081 neighbor_filter_list_cmd,
4082 NEIGHBOR_CMD2 "filter-list WORD (in|out)",
4083 NEIGHBOR_STR
4084 NEIGHBOR_ADDR_STR2
4085 "Establish BGP filters\n"
4086 "AS path access-list name\n"
4087 "Filter incoming routes\n"
4088 "Filter outgoing routes\n")
4089{
4090 return peer_aslist_set_vty (vty, argv[0], bgp_node_afi (vty),
4091 bgp_node_safi (vty), argv[1], argv[2]);
4092}
4093
4094DEFUN (no_neighbor_filter_list,
4095 no_neighbor_filter_list_cmd,
4096 NO_NEIGHBOR_CMD2 "filter-list WORD (in|out)",
4097 NO_STR
4098 NEIGHBOR_STR
4099 NEIGHBOR_ADDR_STR2
4100 "Establish BGP filters\n"
4101 "AS path access-list name\n"
4102 "Filter incoming routes\n"
4103 "Filter outgoing routes\n")
4104{
4105 return peer_aslist_unset_vty (vty, argv[0], bgp_node_afi (vty),
4106 bgp_node_safi (vty), argv[2]);
4107}
6b0655a2 4108
718e3744 4109/* Set route-map to the peer. */
94f2b392 4110static int
fd79ac91 4111peer_route_map_set_vty (struct vty *vty, const char *ip_str,
4112 afi_t afi, safi_t safi,
4113 const char *name_str, const char *direct_str)
718e3744 4114{
4115 int ret;
4116 struct peer *peer;
fee0f4c6 4117 int direct = RMAP_IN;
718e3744 4118
4119 peer = peer_and_group_lookup_vty (vty, ip_str);
4120 if (! peer)
4121 return CMD_WARNING;
4122
4123 /* Check filter direction. */
fee0f4c6 4124 if (strncmp (direct_str, "in", 2) == 0)
4125 direct = RMAP_IN;
718e3744 4126 else if (strncmp (direct_str, "o", 1) == 0)
fee0f4c6 4127 direct = RMAP_OUT;
4128 else if (strncmp (direct_str, "im", 2) == 0)
4129 direct = RMAP_IMPORT;
4130 else if (strncmp (direct_str, "e", 1) == 0)
4131 direct = RMAP_EXPORT;
718e3744 4132
4133 ret = peer_route_map_set (peer, afi, safi, direct, name_str);
4134
4135 return bgp_vty_return (vty, ret);
4136}
4137
94f2b392 4138static int
fd79ac91 4139peer_route_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
4140 safi_t safi, const char *direct_str)
718e3744 4141{
4142 int ret;
4143 struct peer *peer;
fee0f4c6 4144 int direct = RMAP_IN;
718e3744 4145
4146 peer = peer_and_group_lookup_vty (vty, ip_str);
4147 if (! peer)
4148 return CMD_WARNING;
4149
4150 /* Check filter direction. */
fee0f4c6 4151 if (strncmp (direct_str, "in", 2) == 0)
4152 direct = RMAP_IN;
718e3744 4153 else if (strncmp (direct_str, "o", 1) == 0)
fee0f4c6 4154 direct = RMAP_OUT;
4155 else if (strncmp (direct_str, "im", 2) == 0)
4156 direct = RMAP_IMPORT;
4157 else if (strncmp (direct_str, "e", 1) == 0)
4158 direct = RMAP_EXPORT;
718e3744 4159
4160 ret = peer_route_map_unset (peer, afi, safi, direct);
4161
4162 return bgp_vty_return (vty, ret);
4163}
4164
4165DEFUN (neighbor_route_map,
4166 neighbor_route_map_cmd,
fee0f4c6 4167 NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)",
718e3744 4168 NEIGHBOR_STR
4169 NEIGHBOR_ADDR_STR2
4170 "Apply route map to neighbor\n"
4171 "Name of route map\n"
4172 "Apply map to incoming routes\n"
fee0f4c6 4173 "Apply map to outbound routes\n"
4174 "Apply map to routes going into a Route-Server client's table\n"
4175 "Apply map to routes coming from a Route-Server client")
718e3744 4176{
4177 return peer_route_map_set_vty (vty, argv[0], bgp_node_afi (vty),
4178 bgp_node_safi (vty), argv[1], argv[2]);
4179}
4180
4181DEFUN (no_neighbor_route_map,
4182 no_neighbor_route_map_cmd,
fee0f4c6 4183 NO_NEIGHBOR_CMD2 "route-map WORD (in|out|import|export)",
718e3744 4184 NO_STR
4185 NEIGHBOR_STR
4186 NEIGHBOR_ADDR_STR2
4187 "Apply route map to neighbor\n"
4188 "Name of route map\n"
4189 "Apply map to incoming routes\n"
fee0f4c6 4190 "Apply map to outbound routes\n"
4191 "Apply map to routes going into a Route-Server client's table\n"
4192 "Apply map to routes coming from a Route-Server client")
718e3744 4193{
4194 return peer_route_map_unset_vty (vty, argv[0], bgp_node_afi (vty),
4195 bgp_node_safi (vty), argv[2]);
4196}
6b0655a2 4197
718e3744 4198/* Set unsuppress-map to the peer. */
94f2b392 4199static int
fd79ac91 4200peer_unsuppress_map_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
4201 safi_t safi, const char *name_str)
718e3744 4202{
4203 int ret;
4204 struct peer *peer;
4205
4206 peer = peer_and_group_lookup_vty (vty, ip_str);
4207 if (! peer)
4208 return CMD_WARNING;
4209
4210 ret = peer_unsuppress_map_set (peer, afi, safi, name_str);
4211
4212 return bgp_vty_return (vty, ret);
4213}
4214
4215/* Unset route-map from the peer. */
94f2b392 4216static int
fd79ac91 4217peer_unsuppress_map_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
718e3744 4218 safi_t safi)
4219{
4220 int ret;
4221 struct peer *peer;
4222
4223 peer = peer_and_group_lookup_vty (vty, ip_str);
4224 if (! peer)
4225 return CMD_WARNING;
4226
4227 ret = peer_unsuppress_map_unset (peer, afi, safi);
4228
4229 return bgp_vty_return (vty, ret);
4230}
4231
4232DEFUN (neighbor_unsuppress_map,
4233 neighbor_unsuppress_map_cmd,
4234 NEIGHBOR_CMD2 "unsuppress-map WORD",
4235 NEIGHBOR_STR
4236 NEIGHBOR_ADDR_STR2
4237 "Route-map to selectively unsuppress suppressed routes\n"
4238 "Name of route map\n")
4239{
4240 return peer_unsuppress_map_set_vty (vty, argv[0], bgp_node_afi (vty),
4241 bgp_node_safi (vty), argv[1]);
4242}
4243
4244DEFUN (no_neighbor_unsuppress_map,
4245 no_neighbor_unsuppress_map_cmd,
4246 NO_NEIGHBOR_CMD2 "unsuppress-map WORD",
4247 NO_STR
4248 NEIGHBOR_STR
4249 NEIGHBOR_ADDR_STR2
4250 "Route-map to selectively unsuppress suppressed routes\n"
4251 "Name of route map\n")
4252{
4253 return peer_unsuppress_map_unset_vty (vty, argv[0], bgp_node_afi (vty),
4254 bgp_node_safi (vty));
4255}
6b0655a2 4256
94f2b392 4257static int
fd79ac91 4258peer_maximum_prefix_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
4259 safi_t safi, const char *num_str,
0a486e5f 4260 const char *threshold_str, int warning,
4261 const char *restart_str)
718e3744 4262{
4263 int ret;
4264 struct peer *peer;
4265 u_int32_t max;
e0701b79 4266 u_char threshold;
0a486e5f 4267 u_int16_t restart;
718e3744 4268
4269 peer = peer_and_group_lookup_vty (vty, ip_str);
4270 if (! peer)
4271 return CMD_WARNING;
4272
e6ec1c36 4273 VTY_GET_INTEGER ("maximum number", max, num_str);
e0701b79 4274 if (threshold_str)
4275 threshold = atoi (threshold_str);
4276 else
4277 threshold = MAXIMUM_PREFIX_THRESHOLD_DEFAULT;
718e3744 4278
0a486e5f 4279 if (restart_str)
4280 restart = atoi (restart_str);
4281 else
4282 restart = 0;
4283
4284 ret = peer_maximum_prefix_set (peer, afi, safi, max, threshold, warning, restart);
718e3744 4285
4286 return bgp_vty_return (vty, ret);
4287}
4288
94f2b392 4289static int
fd79ac91 4290peer_maximum_prefix_unset_vty (struct vty *vty, const char *ip_str, afi_t afi,
718e3744 4291 safi_t safi)
4292{
4293 int ret;
4294 struct peer *peer;
4295
4296 peer = peer_and_group_lookup_vty (vty, ip_str);
4297 if (! peer)
4298 return CMD_WARNING;
4299
4300 ret = peer_maximum_prefix_unset (peer, afi, safi);
4301
4302 return bgp_vty_return (vty, ret);
4303}
4304
4305/* Maximum number of prefix configuration. prefix count is different
4306 for each peer configuration. So this configuration can be set for
4307 each peer configuration. */
4308DEFUN (neighbor_maximum_prefix,
4309 neighbor_maximum_prefix_cmd,
4310 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>",
4311 NEIGHBOR_STR
4312 NEIGHBOR_ADDR_STR2
4313 "Maximum number of prefix accept from this peer\n"
4314 "maximum no. of prefix limit\n")
4315{
4316 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
0a486e5f 4317 bgp_node_safi (vty), argv[1], NULL, 0,
4318 NULL);
718e3744 4319}
4320
e0701b79 4321DEFUN (neighbor_maximum_prefix_threshold,
4322 neighbor_maximum_prefix_threshold_cmd,
4323 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100>",
4324 NEIGHBOR_STR
4325 NEIGHBOR_ADDR_STR2
4326 "Maximum number of prefix accept from this peer\n"
4327 "maximum no. of prefix limit\n"
4328 "Threshold value (%) at which to generate a warning msg\n")
4329{
4330 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
0a486e5f 4331 bgp_node_safi (vty), argv[1], argv[2], 0,
4332 NULL);
4333}
e0701b79 4334
718e3744 4335DEFUN (neighbor_maximum_prefix_warning,
4336 neighbor_maximum_prefix_warning_cmd,
4337 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
4338 NEIGHBOR_STR
4339 NEIGHBOR_ADDR_STR2
4340 "Maximum number of prefix accept from this peer\n"
4341 "maximum no. of prefix limit\n"
4342 "Only give warning message when limit is exceeded\n")
4343{
4344 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
0a486e5f 4345 bgp_node_safi (vty), argv[1], NULL, 1,
4346 NULL);
718e3744 4347}
4348
e0701b79 4349DEFUN (neighbor_maximum_prefix_threshold_warning,
4350 neighbor_maximum_prefix_threshold_warning_cmd,
4351 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only",
4352 NEIGHBOR_STR
4353 NEIGHBOR_ADDR_STR2
4354 "Maximum number of prefix accept from this peer\n"
4355 "maximum no. of prefix limit\n"
4356 "Threshold value (%) at which to generate a warning msg\n"
4357 "Only give warning message when limit is exceeded\n")
4358{
4359 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
0a486e5f 4360 bgp_node_safi (vty), argv[1], argv[2], 1, NULL);
4361}
4362
4363DEFUN (neighbor_maximum_prefix_restart,
4364 neighbor_maximum_prefix_restart_cmd,
4365 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>",
4366 NEIGHBOR_STR
4367 NEIGHBOR_ADDR_STR2
4368 "Maximum number of prefix accept from this peer\n"
4369 "maximum no. of prefix limit\n"
4370 "Restart bgp connection after limit is exceeded\n"
4371 "Restart interval in minutes")
4372{
4373 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
4374 bgp_node_safi (vty), argv[1], NULL, 0, argv[2]);
4375}
4376
4377DEFUN (neighbor_maximum_prefix_threshold_restart,
4378 neighbor_maximum_prefix_threshold_restart_cmd,
4379 NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>",
4380 NEIGHBOR_STR
4381 NEIGHBOR_ADDR_STR2
4382 "Maximum number of prefix accept from this peer\n"
4383 "maximum no. of prefix limit\n"
4384 "Threshold value (%) at which to generate a warning msg\n"
4385 "Restart bgp connection after limit is exceeded\n"
4386 "Restart interval in minutes")
4387{
4388 return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
4389 bgp_node_safi (vty), argv[1], argv[2], 0, argv[3]);
4390}
e0701b79 4391
718e3744 4392DEFUN (no_neighbor_maximum_prefix,
4393 no_neighbor_maximum_prefix_cmd,
4394 NO_NEIGHBOR_CMD2 "maximum-prefix",
4395 NO_STR
4396 NEIGHBOR_STR
4397 NEIGHBOR_ADDR_STR2
4398 "Maximum number of prefix accept from this peer\n")
4399{
4400 return peer_maximum_prefix_unset_vty (vty, argv[0], bgp_node_afi (vty),
4401 bgp_node_safi (vty));
4402}
4403
4404ALIAS (no_neighbor_maximum_prefix,
4405 no_neighbor_maximum_prefix_val_cmd,
4406 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295>",
4407 NO_STR
4408 NEIGHBOR_STR
4409 NEIGHBOR_ADDR_STR2
4410 "Maximum number of prefix accept from this peer\n"
4411 "maximum no. of prefix limit\n")
4412
4413ALIAS (no_neighbor_maximum_prefix,
0a486e5f 4414 no_neighbor_maximum_prefix_threshold_cmd,
4415 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
4416 NO_STR
4417 NEIGHBOR_STR
4418 NEIGHBOR_ADDR_STR2
4419 "Maximum number of prefix accept from this peer\n"
4420 "maximum no. of prefix limit\n"
4421 "Threshold value (%) at which to generate a warning msg\n")
4422
4423ALIAS (no_neighbor_maximum_prefix,
4424 no_neighbor_maximum_prefix_warning_cmd,
4425 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
4426 NO_STR
4427 NEIGHBOR_STR
4428 NEIGHBOR_ADDR_STR2
4429 "Maximum number of prefix accept from this peer\n"
4430 "maximum no. of prefix limit\n"
e8e1946e 4431 "Only give warning message when limit is exceeded\n")
0a486e5f 4432
4433ALIAS (no_neighbor_maximum_prefix,
4434 no_neighbor_maximum_prefix_threshold_warning_cmd,
e0701b79 4435 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only",
4436 NO_STR
4437 NEIGHBOR_STR
4438 NEIGHBOR_ADDR_STR2
4439 "Maximum number of prefix accept from this peer\n"
4440 "maximum no. of prefix limit\n"
4441 "Threshold value (%) at which to generate a warning msg\n"
e8e1946e 4442 "Only give warning message when limit is exceeded\n")
e0701b79 4443
4444ALIAS (no_neighbor_maximum_prefix,
0a486e5f 4445 no_neighbor_maximum_prefix_restart_cmd,
4446 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>",
718e3744 4447 NO_STR
4448 NEIGHBOR_STR
4449 NEIGHBOR_ADDR_STR2
4450 "Maximum number of prefix accept from this peer\n"
4451 "maximum no. of prefix limit\n"
0a486e5f 4452 "Restart bgp connection after limit is exceeded\n"
4453 "Restart interval in minutes")
4454
4455ALIAS (no_neighbor_maximum_prefix,
4456 no_neighbor_maximum_prefix_threshold_restart_cmd,
4457 NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>",
4458 NO_STR
4459 NEIGHBOR_STR
4460 NEIGHBOR_ADDR_STR2
4461 "Maximum number of prefix accept from this peer\n"
4462 "maximum no. of prefix limit\n"
4463 "Threshold value (%) at which to generate a warning msg\n"
4464 "Restart bgp connection after limit is exceeded\n"
4465 "Restart interval in minutes")
6b0655a2 4466
718e3744 4467/* "neighbor allowas-in" */
4468DEFUN (neighbor_allowas_in,
4469 neighbor_allowas_in_cmd,
4470 NEIGHBOR_CMD2 "allowas-in",
4471 NEIGHBOR_STR
4472 NEIGHBOR_ADDR_STR2
4473 "Accept as-path with my AS present in it\n")
4474{
4475 int ret;
4476 struct peer *peer;
fd79ac91 4477 unsigned int allow_num;
718e3744 4478
4479 peer = peer_and_group_lookup_vty (vty, argv[0]);
4480 if (! peer)
4481 return CMD_WARNING;
4482
4483 if (argc == 1)
4484 allow_num = 3;
4485 else
4486 VTY_GET_INTEGER_RANGE ("AS number", allow_num, argv[1], 1, 10);
4487
4488 ret = peer_allowas_in_set (peer, bgp_node_afi (vty), bgp_node_safi (vty),
4489 allow_num);
4490
4491 return bgp_vty_return (vty, ret);
4492}
4493
4494ALIAS (neighbor_allowas_in,
4495 neighbor_allowas_in_arg_cmd,
4496 NEIGHBOR_CMD2 "allowas-in <1-10>",
4497 NEIGHBOR_STR
4498 NEIGHBOR_ADDR_STR2
4499 "Accept as-path with my AS present in it\n"
4500 "Number of occurances of AS number\n")
4501
4502DEFUN (no_neighbor_allowas_in,
4503 no_neighbor_allowas_in_cmd,
4504 NO_NEIGHBOR_CMD2 "allowas-in",
4505 NO_STR
4506 NEIGHBOR_STR
4507 NEIGHBOR_ADDR_STR2
4508 "allow local ASN appears in aspath attribute\n")
4509{
4510 int ret;
4511 struct peer *peer;
4512
4513 peer = peer_and_group_lookup_vty (vty, argv[0]);
4514 if (! peer)
4515 return CMD_WARNING;
4516
4517 ret = peer_allowas_in_unset (peer, bgp_node_afi (vty), bgp_node_safi (vty));
4518
4519 return bgp_vty_return (vty, ret);
4520}
6b0655a2 4521
fa411a21
NH
4522DEFUN (neighbor_ttl_security,
4523 neighbor_ttl_security_cmd,
4524 NEIGHBOR_CMD2 "ttl-security hops <1-254>",
4525 NEIGHBOR_STR
4526 NEIGHBOR_ADDR_STR2
4527 "Specify the maximum number of hops to the BGP peer\n")
4528{
4529 struct peer *peer;
89b6d1f8 4530 int gtsm_hops;
fa411a21
NH
4531
4532 peer = peer_and_group_lookup_vty (vty, argv[0]);
4533 if (! peer)
4534 return CMD_WARNING;
4535
4536 VTY_GET_INTEGER_RANGE ("", gtsm_hops, argv[1], 1, 254);
4537
89b6d1f8 4538 return bgp_vty_return (vty, peer_ttl_security_hops_set (peer, gtsm_hops));
fa411a21
NH
4539}
4540
4541DEFUN (no_neighbor_ttl_security,
4542 no_neighbor_ttl_security_cmd,
4543 NO_NEIGHBOR_CMD2 "ttl-security hops <1-254>",
4544 NO_STR
4545 NEIGHBOR_STR
4546 NEIGHBOR_ADDR_STR2
4547 "Specify the maximum number of hops to the BGP peer\n")
4548{
4549 struct peer *peer;
fa411a21
NH
4550
4551 peer = peer_and_group_lookup_vty (vty, argv[0]);
4552 if (! peer)
4553 return CMD_WARNING;
4554
89b6d1f8 4555 return bgp_vty_return (vty, peer_ttl_security_hops_unset (peer));
fa411a21 4556}
6b0655a2 4557
718e3744 4558/* Address family configuration. */
4559DEFUN (address_family_ipv4,
4560 address_family_ipv4_cmd,
4561 "address-family ipv4",
4562 "Enter Address Family command mode\n"
4563 "Address family\n")
4564{
4565 vty->node = BGP_IPV4_NODE;
4566 return CMD_SUCCESS;
4567}
4568
4569DEFUN (address_family_ipv4_safi,
4570 address_family_ipv4_safi_cmd,
4571 "address-family ipv4 (unicast|multicast)",
4572 "Enter Address Family command mode\n"
4573 "Address family\n"
4574 "Address Family modifier\n"
4575 "Address Family modifier\n")
4576{
4577 if (strncmp (argv[0], "m", 1) == 0)
4578 vty->node = BGP_IPV4M_NODE;
4579 else
4580 vty->node = BGP_IPV4_NODE;
4581
4582 return CMD_SUCCESS;
4583}
4584
25ffbdc1 4585DEFUN (address_family_ipv6,
4586 address_family_ipv6_cmd,
4587 "address-family ipv6",
718e3744 4588 "Enter Address Family command mode\n"
25ffbdc1 4589 "Address family\n")
718e3744 4590{
4591 vty->node = BGP_IPV6_NODE;
4592 return CMD_SUCCESS;
4593}
4594
25ffbdc1 4595DEFUN (address_family_ipv6_safi,
4596 address_family_ipv6_safi_cmd,
4597 "address-family ipv6 (unicast|multicast)",
718e3744 4598 "Enter Address Family command mode\n"
25ffbdc1 4599 "Address family\n"
4600 "Address Family modifier\n"
4601 "Address Family modifier\n")
4602{
4603 if (strncmp (argv[0], "m", 1) == 0)
4604 vty->node = BGP_IPV6M_NODE;
4605 else
4606 vty->node = BGP_IPV6_NODE;
4607
4608 return CMD_SUCCESS;
4609}
718e3744 4610
4611DEFUN (address_family_vpnv4,
4612 address_family_vpnv4_cmd,
4613 "address-family vpnv4",
4614 "Enter Address Family command mode\n"
4615 "Address family\n")
4616{
4617 vty->node = BGP_VPNV4_NODE;
4618 return CMD_SUCCESS;
4619}
4620
4621ALIAS (address_family_vpnv4,
4622 address_family_vpnv4_unicast_cmd,
4623 "address-family vpnv4 unicast",
4624 "Enter Address Family command mode\n"
4625 "Address family\n"
4626 "Address Family Modifier\n")
4627
4628DEFUN (exit_address_family,
4629 exit_address_family_cmd,
4630 "exit-address-family",
4631 "Exit from Address Family configuration mode\n")
4632{
a8a80d53 4633 if (vty->node == BGP_IPV4_NODE
4634 || vty->node == BGP_IPV4M_NODE
718e3744 4635 || vty->node == BGP_VPNV4_NODE
25ffbdc1 4636 || vty->node == BGP_IPV6_NODE
4637 || vty->node == BGP_IPV6M_NODE)
718e3744 4638 vty->node = BGP_NODE;
4639 return CMD_SUCCESS;
4640}
6b0655a2 4641
718e3744 4642/* BGP clear sort. */
4643enum clear_sort
4644{
4645 clear_all,
4646 clear_peer,
4647 clear_group,
4648 clear_external,
4649 clear_as
4650};
4651
94f2b392 4652static void
718e3744 4653bgp_clear_vty_error (struct vty *vty, struct peer *peer, afi_t afi,
4654 safi_t safi, int error)
4655{
4656 switch (error)
4657 {
4658 case BGP_ERR_AF_UNCONFIGURED:
4659 vty_out (vty,
4660 "%%BGP: Enable %s %s address family for the neighbor %s%s",
4661 afi == AFI_IP6 ? "IPv6" : safi == SAFI_MPLS_VPN ? "VPNv4" : "IPv4",
4662 safi == SAFI_MULTICAST ? "Multicast" : "Unicast",
4663 peer->host, VTY_NEWLINE);
4664 break;
4665 case BGP_ERR_SOFT_RECONFIG_UNCONFIGURED:
4666 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);
4667 break;
4668 default:
4669 break;
4670 }
4671}
4672
4673/* `clear ip bgp' functions. */
94f2b392 4674static int
718e3744 4675bgp_clear (struct vty *vty, struct bgp *bgp, afi_t afi, safi_t safi,
fd79ac91 4676 enum clear_sort sort,enum bgp_clear_type stype, const char *arg)
718e3744 4677{
4678 int ret;
4679 struct peer *peer;
1eb8ef25 4680 struct listnode *node, *nnode;
718e3744 4681
4682 /* Clear all neighbors. */
1ff9a340
DS
4683 /*
4684 * Pass along pointer to next node to peer_clear() when walking all nodes
4685 * on the BGP instance as that may get freed if it is a doppelganger
4686 */
718e3744 4687 if (sort == clear_all)
4688 {
1eb8ef25 4689 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
718e3744 4690 {
4691 if (stype == BGP_CLEAR_SOFT_NONE)
1ff9a340 4692 ret = peer_clear (peer, &nnode);
718e3744 4693 else
4694 ret = peer_clear_soft (peer, afi, safi, stype);
4695
4696 if (ret < 0)
4697 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4698 }
f188f2c4
DS
4699
4700 /* This is to apply read-only mode on this clear. */
4701 if (stype == BGP_CLEAR_SOFT_NONE)
4702 bgp->update_delay_over = 0;
4703
0b2aa3a0 4704 return CMD_SUCCESS;
718e3744 4705 }
4706
4707 /* Clear specified neighbors. */
4708 if (sort == clear_peer)
4709 {
4710 union sockunion su;
4711 int ret;
4712
4713 /* Make sockunion for lookup. */
4714 ret = str2sockunion (arg, &su);
4715 if (ret < 0)
a80beece
DS
4716 {
4717 peer = peer_lookup_by_conf_if (bgp, arg);
4718 if (!peer)
4719 {
4720 vty_out (vty, "Malformed address or name: %s%s", arg, VTY_NEWLINE);
4721 return CMD_WARNING;
4722 }
4723 }
4724 else
4725 {
4726 peer = peer_lookup (bgp, &su);
4727 if (! peer)
4728 {
4729 vty_out (vty, "%%BGP: Unknown neighbor - \"%s\"%s", arg, VTY_NEWLINE);
4730 return CMD_WARNING;
4731 }
4732 }
718e3744 4733
4734 if (stype == BGP_CLEAR_SOFT_NONE)
1ff9a340 4735 ret = peer_clear (peer, NULL);
718e3744 4736 else
4737 ret = peer_clear_soft (peer, afi, safi, stype);
4738
4739 if (ret < 0)
4740 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4741
0b2aa3a0 4742 return CMD_SUCCESS;
718e3744 4743 }
4744
4745 /* Clear all peer-group members. */
4746 if (sort == clear_group)
4747 {
4748 struct peer_group *group;
4749
4750 group = peer_group_lookup (bgp, arg);
4751 if (! group)
4752 {
4753 vty_out (vty, "%%BGP: No such peer-group %s%s", arg, VTY_NEWLINE);
0b2aa3a0 4754 return CMD_WARNING;
718e3744 4755 }
4756
1eb8ef25 4757 for (ALL_LIST_ELEMENTS (group->peer, node, nnode, peer))
718e3744 4758 {
4759 if (stype == BGP_CLEAR_SOFT_NONE)
4760 {
1ff9a340 4761 ret = peer_clear (peer, NULL);
718e3744 4762 continue;
4763 }
4764
4765 if (! peer->af_group[afi][safi])
4766 continue;
4767
4768 ret = peer_clear_soft (peer, afi, safi, stype);
4769
4770 if (ret < 0)
4771 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4772 }
0b2aa3a0 4773 return CMD_SUCCESS;
718e3744 4774 }
4775
4776 if (sort == clear_external)
4777 {
1eb8ef25 4778 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
718e3744 4779 {
6d85b15b 4780 if (peer->sort == BGP_PEER_IBGP)
718e3744 4781 continue;
4782
4783 if (stype == BGP_CLEAR_SOFT_NONE)
1ff9a340 4784 ret = peer_clear (peer, &nnode);
718e3744 4785 else
4786 ret = peer_clear_soft (peer, afi, safi, stype);
4787
4788 if (ret < 0)
4789 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4790 }
0b2aa3a0 4791 return CMD_SUCCESS;
718e3744 4792 }
4793
4794 if (sort == clear_as)
4795 {
4796 as_t as;
718e3744 4797 int find = 0;
4798
bde12e3f 4799 VTY_GET_INTEGER_RANGE ("AS", as, arg, 1, BGP_AS4_MAX);
0b2aa3a0 4800
1eb8ef25 4801 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
718e3744 4802 {
4803 if (peer->as != as)
4804 continue;
4805
4806 find = 1;
4807 if (stype == BGP_CLEAR_SOFT_NONE)
1ff9a340 4808 ret = peer_clear (peer, &nnode);
718e3744 4809 else
4810 ret = peer_clear_soft (peer, afi, safi, stype);
4811
4812 if (ret < 0)
4813 bgp_clear_vty_error (vty, peer, afi, safi, ret);
4814 }
4815 if (! find)
4816 vty_out (vty, "%%BGP: No peer is configured with AS %s%s", arg,
4817 VTY_NEWLINE);
0b2aa3a0 4818 return CMD_SUCCESS;
718e3744 4819 }
4820
0b2aa3a0 4821 return CMD_SUCCESS;
718e3744 4822}
4823
94f2b392 4824static int
fd79ac91 4825bgp_clear_vty (struct vty *vty, const char *name, afi_t afi, safi_t safi,
4826 enum clear_sort sort, enum bgp_clear_type stype,
4827 const char *arg)
718e3744 4828{
718e3744 4829 struct bgp *bgp;
4830
4831 /* BGP structure lookup. */
4832 if (name)
4833 {
4834 bgp = bgp_lookup_by_name (name);
4835 if (bgp == NULL)
4836 {
4837 vty_out (vty, "Can't find BGP view %s%s", name, VTY_NEWLINE);
4838 return CMD_WARNING;
4839 }
4840 }
4841 else
4842 {
4843 bgp = bgp_get_default ();
4844 if (bgp == NULL)
4845 {
4846 vty_out (vty, "No BGP process is configured%s", VTY_NEWLINE);
4847 return CMD_WARNING;
4848 }
4849 }
4850
0b2aa3a0 4851 return bgp_clear (vty, bgp, afi, safi, sort, stype, arg);
718e3744 4852}
4853
4854DEFUN (clear_ip_bgp_all,
4855 clear_ip_bgp_all_cmd,
4856 "clear ip bgp *",
4857 CLEAR_STR
4858 IP_STR
4859 BGP_STR
4860 "Clear all peers\n")
4861{
4862 if (argc == 1)
4863 return bgp_clear_vty (vty, argv[0], 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL);
4864
4865 return bgp_clear_vty (vty, NULL, 0, 0, clear_all, BGP_CLEAR_SOFT_NONE, NULL);
4866}
4867
4868ALIAS (clear_ip_bgp_all,
4869 clear_bgp_all_cmd,
4870 "clear bgp *",
4871 CLEAR_STR
4872 BGP_STR
4873 "Clear all peers\n")
4874
4875ALIAS (clear_ip_bgp_all,
4876 clear_bgp_ipv6_all_cmd,
4877 "clear bgp ipv6 *",
4878 CLEAR_STR
4879 BGP_STR
4880 "Address family\n"
4881 "Clear all peers\n")
4882
4883ALIAS (clear_ip_bgp_all,
4884 clear_ip_bgp_instance_all_cmd,
4885 "clear ip bgp view WORD *",
4886 CLEAR_STR
4887 IP_STR
4888 BGP_STR
4889 "BGP view\n"
4890 "view name\n"
4891 "Clear all peers\n")
4892
4893ALIAS (clear_ip_bgp_all,
4894 clear_bgp_instance_all_cmd,
4895 "clear bgp view WORD *",
4896 CLEAR_STR
4897 BGP_STR
4898 "BGP view\n"
4899 "view name\n"
4900 "Clear all peers\n")
4901
4902DEFUN (clear_ip_bgp_peer,
4903 clear_ip_bgp_peer_cmd,
a80beece 4904 "clear ip bgp (A.B.C.D|X:X::X:X|WORD)",
718e3744 4905 CLEAR_STR
4906 IP_STR
4907 BGP_STR
4908 "BGP neighbor IP address to clear\n"
a80beece
DS
4909 "BGP IPv6 neighbor to clear\n"
4910 "BGP neighbor on interface to clear\n")
718e3744 4911{
4912 return bgp_clear_vty (vty, NULL, 0, 0, clear_peer, BGP_CLEAR_SOFT_NONE, argv[0]);
4913}
4914
4915ALIAS (clear_ip_bgp_peer,
4916 clear_bgp_peer_cmd,
a80beece 4917 "clear bgp (A.B.C.D|X:X::X:X|WORD)",
718e3744 4918 CLEAR_STR
4919 BGP_STR
4920 "BGP neighbor address to clear\n"
a80beece
DS
4921 "BGP IPv6 neighbor to clear\n"
4922 "BGP neighbor on interface to clear\n")
718e3744 4923
4924ALIAS (clear_ip_bgp_peer,
4925 clear_bgp_ipv6_peer_cmd,
a80beece 4926 "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD)",
718e3744 4927 CLEAR_STR
4928 BGP_STR
4929 "Address family\n"
4930 "BGP neighbor address to clear\n"
a80beece
DS
4931 "BGP IPv6 neighbor to clear\n"
4932 "BGP neighbor on interface to clear\n")
718e3744 4933
4934DEFUN (clear_ip_bgp_peer_group,
4935 clear_ip_bgp_peer_group_cmd,
4936 "clear ip bgp peer-group WORD",
4937 CLEAR_STR
4938 IP_STR
4939 BGP_STR
4940 "Clear all members of peer-group\n"
4941 "BGP peer-group name\n")
4942{
4943 return bgp_clear_vty (vty, NULL, 0, 0, clear_group, BGP_CLEAR_SOFT_NONE, argv[0]);
4944}
4945
4946ALIAS (clear_ip_bgp_peer_group,
4947 clear_bgp_peer_group_cmd,
4948 "clear bgp peer-group WORD",
4949 CLEAR_STR
4950 BGP_STR
4951 "Clear all members of peer-group\n"
4952 "BGP peer-group name\n")
4953
4954ALIAS (clear_ip_bgp_peer_group,
4955 clear_bgp_ipv6_peer_group_cmd,
4956 "clear bgp ipv6 peer-group WORD",
4957 CLEAR_STR
4958 BGP_STR
4959 "Address family\n"
4960 "Clear all members of peer-group\n"
4961 "BGP peer-group name\n")
4962
4963DEFUN (clear_ip_bgp_external,
4964 clear_ip_bgp_external_cmd,
4965 "clear ip bgp external",
4966 CLEAR_STR
4967 IP_STR
4968 BGP_STR
4969 "Clear all external peers\n")
4970{
4971 return bgp_clear_vty (vty, NULL, 0, 0, clear_external, BGP_CLEAR_SOFT_NONE, NULL);
4972}
4973
4974ALIAS (clear_ip_bgp_external,
4975 clear_bgp_external_cmd,
4976 "clear bgp external",
4977 CLEAR_STR
4978 BGP_STR
4979 "Clear all external peers\n")
4980
4981ALIAS (clear_ip_bgp_external,
4982 clear_bgp_ipv6_external_cmd,
4983 "clear bgp ipv6 external",
4984 CLEAR_STR
4985 BGP_STR
4986 "Address family\n"
4987 "Clear all external peers\n")
4988
4989DEFUN (clear_ip_bgp_as,
4990 clear_ip_bgp_as_cmd,
320da874 4991 "clear ip bgp " CMD_AS_RANGE,
718e3744 4992 CLEAR_STR
4993 IP_STR
4994 BGP_STR
4995 "Clear peers with the AS number\n")
4996{
4997 return bgp_clear_vty (vty, NULL, 0, 0, clear_as, BGP_CLEAR_SOFT_NONE, argv[0]);
4998}
4999
5000ALIAS (clear_ip_bgp_as,
5001 clear_bgp_as_cmd,
320da874 5002 "clear bgp " CMD_AS_RANGE,
718e3744 5003 CLEAR_STR
5004 BGP_STR
5005 "Clear peers with the AS number\n")
5006
5007ALIAS (clear_ip_bgp_as,
5008 clear_bgp_ipv6_as_cmd,
320da874 5009 "clear bgp ipv6 " CMD_AS_RANGE,
718e3744 5010 CLEAR_STR
5011 BGP_STR
5012 "Address family\n"
5013 "Clear peers with the AS number\n")
6b0655a2 5014
718e3744 5015/* Outbound soft-reconfiguration */
5016DEFUN (clear_ip_bgp_all_soft_out,
5017 clear_ip_bgp_all_soft_out_cmd,
5018 "clear ip bgp * soft out",
5019 CLEAR_STR
5020 IP_STR
5021 BGP_STR
5022 "Clear all peers\n"
5023 "Soft reconfig\n"
5024 "Soft reconfig outbound update\n")
5025{
5026 if (argc == 1)
5027 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5028 BGP_CLEAR_SOFT_OUT, NULL);
5029
5030 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5031 BGP_CLEAR_SOFT_OUT, NULL);
5032}
5033
5034ALIAS (clear_ip_bgp_all_soft_out,
5035 clear_ip_bgp_all_out_cmd,
5036 "clear ip bgp * out",
5037 CLEAR_STR
5038 IP_STR
5039 BGP_STR
5040 "Clear all peers\n"
5041 "Soft reconfig outbound update\n")
5042
5043ALIAS (clear_ip_bgp_all_soft_out,
5044 clear_ip_bgp_instance_all_soft_out_cmd,
5045 "clear ip bgp view WORD * soft out",
5046 CLEAR_STR
5047 IP_STR
5048 BGP_STR
5049 "BGP view\n"
5050 "view name\n"
5051 "Clear all peers\n"
5052 "Soft reconfig\n"
5053 "Soft reconfig outbound update\n")
5054
5055DEFUN (clear_ip_bgp_all_ipv4_soft_out,
5056 clear_ip_bgp_all_ipv4_soft_out_cmd,
5057 "clear ip bgp * ipv4 (unicast|multicast) soft out",
5058 CLEAR_STR
5059 IP_STR
5060 BGP_STR
5061 "Clear all peers\n"
5062 "Address family\n"
5063 "Address Family modifier\n"
5064 "Address Family modifier\n"
5065 "Soft reconfig\n"
5066 "Soft reconfig outbound update\n")
5067{
5068 if (strncmp (argv[0], "m", 1) == 0)
5069 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
5070 BGP_CLEAR_SOFT_OUT, NULL);
5071
5072 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5073 BGP_CLEAR_SOFT_OUT, NULL);
5074}
5075
5076ALIAS (clear_ip_bgp_all_ipv4_soft_out,
5077 clear_ip_bgp_all_ipv4_out_cmd,
5078 "clear ip bgp * ipv4 (unicast|multicast) out",
5079 CLEAR_STR
5080 IP_STR
5081 BGP_STR
5082 "Clear all peers\n"
5083 "Address family\n"
5084 "Address Family modifier\n"
5085 "Address Family modifier\n"
5086 "Soft reconfig outbound update\n")
5087
5088DEFUN (clear_ip_bgp_instance_all_ipv4_soft_out,
5089 clear_ip_bgp_instance_all_ipv4_soft_out_cmd,
5090 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft out",
5091 CLEAR_STR
5092 IP_STR
5093 BGP_STR
5094 "BGP view\n"
5095 "view name\n"
5096 "Clear all peers\n"
5097 "Address family\n"
5098 "Address Family modifier\n"
5099 "Address Family modifier\n"
5100 "Soft reconfig outbound update\n")
5101{
5102 if (strncmp (argv[1], "m", 1) == 0)
5103 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
5104 BGP_CLEAR_SOFT_OUT, NULL);
5105
5106 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5107 BGP_CLEAR_SOFT_OUT, NULL);
5108}
5109
5110DEFUN (clear_ip_bgp_all_vpnv4_soft_out,
5111 clear_ip_bgp_all_vpnv4_soft_out_cmd,
5112 "clear ip bgp * vpnv4 unicast soft out",
5113 CLEAR_STR
5114 IP_STR
5115 BGP_STR
5116 "Clear all peers\n"
5117 "Address family\n"
5118 "Address Family Modifier\n"
5119 "Soft reconfig\n"
5120 "Soft reconfig outbound update\n")
5121{
5122 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
5123 BGP_CLEAR_SOFT_OUT, NULL);
5124}
5125
5126ALIAS (clear_ip_bgp_all_vpnv4_soft_out,
5127 clear_ip_bgp_all_vpnv4_out_cmd,
5128 "clear ip bgp * vpnv4 unicast out",
5129 CLEAR_STR
5130 IP_STR
5131 BGP_STR
5132 "Clear all peers\n"
5133 "Address family\n"
5134 "Address Family Modifier\n"
5135 "Soft reconfig outbound update\n")
5136
5137DEFUN (clear_bgp_all_soft_out,
5138 clear_bgp_all_soft_out_cmd,
5139 "clear bgp * soft out",
5140 CLEAR_STR
5141 BGP_STR
5142 "Clear all peers\n"
5143 "Soft reconfig\n"
5144 "Soft reconfig outbound update\n")
5145{
5146 if (argc == 1)
5147 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
5148 BGP_CLEAR_SOFT_OUT, NULL);
5149
5150 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
5151 BGP_CLEAR_SOFT_OUT, NULL);
5152}
5153
5154ALIAS (clear_bgp_all_soft_out,
5155 clear_bgp_instance_all_soft_out_cmd,
5156 "clear bgp view WORD * soft out",
5157 CLEAR_STR
5158 BGP_STR
5159 "BGP view\n"
5160 "view name\n"
5161 "Clear all peers\n"
5162 "Soft reconfig\n"
5163 "Soft reconfig outbound update\n")
5164
5165ALIAS (clear_bgp_all_soft_out,
5166 clear_bgp_all_out_cmd,
5167 "clear bgp * out",
5168 CLEAR_STR
5169 BGP_STR
5170 "Clear all peers\n"
5171 "Soft reconfig outbound update\n")
5172
5173ALIAS (clear_bgp_all_soft_out,
5174 clear_bgp_ipv6_all_soft_out_cmd,
5175 "clear bgp ipv6 * soft out",
5176 CLEAR_STR
5177 BGP_STR
5178 "Address family\n"
5179 "Clear all peers\n"
5180 "Soft reconfig\n"
5181 "Soft reconfig outbound update\n")
5182
5183ALIAS (clear_bgp_all_soft_out,
5184 clear_bgp_ipv6_all_out_cmd,
5185 "clear bgp ipv6 * out",
5186 CLEAR_STR
5187 BGP_STR
5188 "Address family\n"
5189 "Clear all peers\n"
5190 "Soft reconfig outbound update\n")
5191
5192DEFUN (clear_ip_bgp_peer_soft_out,
5193 clear_ip_bgp_peer_soft_out_cmd,
5194 "clear ip bgp A.B.C.D soft out",
5195 CLEAR_STR
5196 IP_STR
5197 BGP_STR
5198 "BGP neighbor address to clear\n"
5199 "Soft reconfig\n"
5200 "Soft reconfig outbound update\n")
5201{
5202 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5203 BGP_CLEAR_SOFT_OUT, argv[0]);
5204}
5205
5206ALIAS (clear_ip_bgp_peer_soft_out,
5207 clear_ip_bgp_peer_out_cmd,
5208 "clear ip bgp A.B.C.D out",
5209 CLEAR_STR
5210 IP_STR
5211 BGP_STR
5212 "BGP neighbor address to clear\n"
5213 "Soft reconfig outbound update\n")
5214
5215DEFUN (clear_ip_bgp_peer_ipv4_soft_out,
5216 clear_ip_bgp_peer_ipv4_soft_out_cmd,
5217 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft out",
5218 CLEAR_STR
5219 IP_STR
5220 BGP_STR
5221 "BGP neighbor address to clear\n"
5222 "Address family\n"
5223 "Address Family modifier\n"
5224 "Address Family modifier\n"
5225 "Soft reconfig\n"
5226 "Soft reconfig outbound update\n")
5227{
5228 if (strncmp (argv[1], "m", 1) == 0)
5229 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
5230 BGP_CLEAR_SOFT_OUT, argv[0]);
5231
5232 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5233 BGP_CLEAR_SOFT_OUT, argv[0]);
5234}
5235
5236ALIAS (clear_ip_bgp_peer_ipv4_soft_out,
5237 clear_ip_bgp_peer_ipv4_out_cmd,
5238 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) out",
5239 CLEAR_STR
5240 IP_STR
5241 BGP_STR
5242 "BGP neighbor address to clear\n"
5243 "Address family\n"
5244 "Address Family modifier\n"
5245 "Address Family modifier\n"
5246 "Soft reconfig outbound update\n")
5247
5248DEFUN (clear_ip_bgp_peer_vpnv4_soft_out,
5249 clear_ip_bgp_peer_vpnv4_soft_out_cmd,
5250 "clear ip bgp A.B.C.D vpnv4 unicast soft out",
5251 CLEAR_STR
5252 IP_STR
5253 BGP_STR
5254 "BGP neighbor address to clear\n"
5255 "Address family\n"
5256 "Address Family Modifier\n"
5257 "Soft reconfig\n"
5258 "Soft reconfig outbound update\n")
5259{
5260 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
5261 BGP_CLEAR_SOFT_OUT, argv[0]);
5262}
5263
5264ALIAS (clear_ip_bgp_peer_vpnv4_soft_out,
5265 clear_ip_bgp_peer_vpnv4_out_cmd,
5266 "clear ip bgp A.B.C.D vpnv4 unicast out",
5267 CLEAR_STR
5268 IP_STR
5269 BGP_STR
5270 "BGP neighbor address to clear\n"
5271 "Address family\n"
5272 "Address Family Modifier\n"
5273 "Soft reconfig outbound update\n")
5274
5275DEFUN (clear_bgp_peer_soft_out,
5276 clear_bgp_peer_soft_out_cmd,
a80beece 5277 "clear bgp (A.B.C.D|X:X::X:X|WORD) soft out",
718e3744 5278 CLEAR_STR
5279 BGP_STR
5280 "BGP neighbor address to clear\n"
5281 "BGP IPv6 neighbor to clear\n"
a80beece 5282 "BGP neighbor on interface to clear\n"
718e3744 5283 "Soft reconfig\n"
5284 "Soft reconfig outbound update\n")
5285{
5286 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
5287 BGP_CLEAR_SOFT_OUT, argv[0]);
5288}
5289
5290ALIAS (clear_bgp_peer_soft_out,
5291 clear_bgp_ipv6_peer_soft_out_cmd,
a80beece 5292 "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) soft out",
718e3744 5293 CLEAR_STR
5294 BGP_STR
5295 "Address family\n"
5296 "BGP neighbor address to clear\n"
5297 "BGP IPv6 neighbor to clear\n"
a80beece 5298 "BGP neighbor on interface to clear\n"
718e3744 5299 "Soft reconfig\n"
5300 "Soft reconfig outbound update\n")
5301
5302ALIAS (clear_bgp_peer_soft_out,
5303 clear_bgp_peer_out_cmd,
a80beece 5304 "clear bgp (A.B.C.D|X:X::X:X|WORD) out",
718e3744 5305 CLEAR_STR
5306 BGP_STR
5307 "BGP neighbor address to clear\n"
5308 "BGP IPv6 neighbor to clear\n"
a80beece 5309 "BGP neighbor on interface to clear\n"
718e3744 5310 "Soft reconfig outbound update\n")
5311
5312ALIAS (clear_bgp_peer_soft_out,
5313 clear_bgp_ipv6_peer_out_cmd,
a80beece 5314 "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) out",
718e3744 5315 CLEAR_STR
5316 BGP_STR
5317 "Address family\n"
5318 "BGP neighbor address to clear\n"
5319 "BGP IPv6 neighbor to clear\n"
a80beece 5320 "BGP neighbor on interface to clear\n"
718e3744 5321 "Soft reconfig outbound update\n")
5322
5323DEFUN (clear_ip_bgp_peer_group_soft_out,
5324 clear_ip_bgp_peer_group_soft_out_cmd,
5325 "clear ip bgp peer-group WORD soft out",
5326 CLEAR_STR
5327 IP_STR
5328 BGP_STR
5329 "Clear all members of peer-group\n"
5330 "BGP peer-group name\n"
5331 "Soft reconfig\n"
5332 "Soft reconfig outbound update\n")
5333{
5334 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5335 BGP_CLEAR_SOFT_OUT, argv[0]);
5336}
5337
5338ALIAS (clear_ip_bgp_peer_group_soft_out,
5339 clear_ip_bgp_peer_group_out_cmd,
5340 "clear ip bgp peer-group WORD out",
5341 CLEAR_STR
5342 IP_STR
5343 BGP_STR
5344 "Clear all members of peer-group\n"
5345 "BGP peer-group name\n"
5346 "Soft reconfig outbound update\n")
5347
5348DEFUN (clear_ip_bgp_peer_group_ipv4_soft_out,
5349 clear_ip_bgp_peer_group_ipv4_soft_out_cmd,
5350 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft out",
5351 CLEAR_STR
5352 IP_STR
5353 BGP_STR
5354 "Clear all members of peer-group\n"
5355 "BGP peer-group name\n"
5356 "Address family\n"
5357 "Address Family modifier\n"
5358 "Address Family modifier\n"
5359 "Soft reconfig\n"
5360 "Soft reconfig outbound update\n")
5361{
5362 if (strncmp (argv[1], "m", 1) == 0)
5363 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
5364 BGP_CLEAR_SOFT_OUT, argv[0]);
5365
5366 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
5367 BGP_CLEAR_SOFT_OUT, argv[0]);
5368}
5369
5370ALIAS (clear_ip_bgp_peer_group_ipv4_soft_out,
5371 clear_ip_bgp_peer_group_ipv4_out_cmd,
5372 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) out",
5373 CLEAR_STR
5374 IP_STR
5375 BGP_STR
5376 "Clear all members of peer-group\n"
5377 "BGP peer-group name\n"
5378 "Address family\n"
5379 "Address Family modifier\n"
5380 "Address Family modifier\n"
5381 "Soft reconfig outbound update\n")
5382
5383DEFUN (clear_bgp_peer_group_soft_out,
5384 clear_bgp_peer_group_soft_out_cmd,
5385 "clear bgp peer-group WORD soft out",
5386 CLEAR_STR
5387 BGP_STR
5388 "Clear all members of peer-group\n"
5389 "BGP peer-group name\n"
5390 "Soft reconfig\n"
5391 "Soft reconfig outbound update\n")
5392{
5393 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
5394 BGP_CLEAR_SOFT_OUT, argv[0]);
5395}
5396
5397ALIAS (clear_bgp_peer_group_soft_out,
5398 clear_bgp_ipv6_peer_group_soft_out_cmd,
5399 "clear bgp ipv6 peer-group WORD soft out",
5400 CLEAR_STR
5401 BGP_STR
5402 "Address family\n"
5403 "Clear all members of peer-group\n"
5404 "BGP peer-group name\n"
5405 "Soft reconfig\n"
5406 "Soft reconfig outbound update\n")
5407
5408ALIAS (clear_bgp_peer_group_soft_out,
5409 clear_bgp_peer_group_out_cmd,
5410 "clear bgp peer-group WORD out",
5411 CLEAR_STR
5412 BGP_STR
5413 "Clear all members of peer-group\n"
5414 "BGP peer-group name\n"
5415 "Soft reconfig outbound update\n")
5416
5417ALIAS (clear_bgp_peer_group_soft_out,
5418 clear_bgp_ipv6_peer_group_out_cmd,
5419 "clear bgp ipv6 peer-group WORD out",
5420 CLEAR_STR
5421 BGP_STR
5422 "Address family\n"
5423 "Clear all members of peer-group\n"
5424 "BGP peer-group name\n"
5425 "Soft reconfig outbound update\n")
5426
5427DEFUN (clear_ip_bgp_external_soft_out,
5428 clear_ip_bgp_external_soft_out_cmd,
5429 "clear ip bgp external soft out",
5430 CLEAR_STR
5431 IP_STR
5432 BGP_STR
5433 "Clear all external peers\n"
5434 "Soft reconfig\n"
5435 "Soft reconfig outbound update\n")
5436{
5437 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5438 BGP_CLEAR_SOFT_OUT, NULL);
5439}
5440
5441ALIAS (clear_ip_bgp_external_soft_out,
5442 clear_ip_bgp_external_out_cmd,
5443 "clear ip bgp external out",
5444 CLEAR_STR
5445 IP_STR
5446 BGP_STR
5447 "Clear all external peers\n"
5448 "Soft reconfig outbound update\n")
5449
5450DEFUN (clear_ip_bgp_external_ipv4_soft_out,
5451 clear_ip_bgp_external_ipv4_soft_out_cmd,
5452 "clear ip bgp external ipv4 (unicast|multicast) soft out",
5453 CLEAR_STR
5454 IP_STR
5455 BGP_STR
5456 "Clear all external peers\n"
5457 "Address family\n"
5458 "Address Family modifier\n"
5459 "Address Family modifier\n"
5460 "Soft reconfig\n"
5461 "Soft reconfig outbound update\n")
5462{
5463 if (strncmp (argv[0], "m", 1) == 0)
5464 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
5465 BGP_CLEAR_SOFT_OUT, NULL);
5466
5467 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
5468 BGP_CLEAR_SOFT_OUT, NULL);
5469}
5470
5471ALIAS (clear_ip_bgp_external_ipv4_soft_out,
5472 clear_ip_bgp_external_ipv4_out_cmd,
5473 "clear ip bgp external ipv4 (unicast|multicast) out",
5474 CLEAR_STR
5475 IP_STR
5476 BGP_STR
5477 "Clear all external peers\n"
5478 "Address family\n"
5479 "Address Family modifier\n"
5480 "Address Family modifier\n"
5481 "Soft reconfig outbound update\n")
5482
5483DEFUN (clear_bgp_external_soft_out,
5484 clear_bgp_external_soft_out_cmd,
5485 "clear bgp external soft out",
5486 CLEAR_STR
5487 BGP_STR
5488 "Clear all external peers\n"
5489 "Soft reconfig\n"
5490 "Soft reconfig outbound update\n")
5491{
5492 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
5493 BGP_CLEAR_SOFT_OUT, NULL);
5494}
5495
5496ALIAS (clear_bgp_external_soft_out,
5497 clear_bgp_ipv6_external_soft_out_cmd,
5498 "clear bgp ipv6 external soft out",
5499 CLEAR_STR
5500 BGP_STR
5501 "Address family\n"
5502 "Clear all external peers\n"
5503 "Soft reconfig\n"
5504 "Soft reconfig outbound update\n")
5505
5506ALIAS (clear_bgp_external_soft_out,
5507 clear_bgp_external_out_cmd,
5508 "clear bgp external out",
5509 CLEAR_STR
5510 BGP_STR
5511 "Clear all external peers\n"
5512 "Soft reconfig outbound update\n")
5513
5514ALIAS (clear_bgp_external_soft_out,
5515 clear_bgp_ipv6_external_out_cmd,
5516 "clear bgp ipv6 external WORD out",
5517 CLEAR_STR
5518 BGP_STR
5519 "Address family\n"
5520 "Clear all external peers\n"
5521 "Soft reconfig outbound update\n")
5522
5523DEFUN (clear_ip_bgp_as_soft_out,
5524 clear_ip_bgp_as_soft_out_cmd,
320da874 5525 "clear ip bgp " CMD_AS_RANGE " soft out",
718e3744 5526 CLEAR_STR
5527 IP_STR
5528 BGP_STR
5529 "Clear peers with the AS number\n"
5530 "Soft reconfig\n"
5531 "Soft reconfig outbound update\n")
5532{
5533 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
5534 BGP_CLEAR_SOFT_OUT, argv[0]);
5535}
5536
5537ALIAS (clear_ip_bgp_as_soft_out,
5538 clear_ip_bgp_as_out_cmd,
320da874 5539 "clear ip bgp " CMD_AS_RANGE " out",
718e3744 5540 CLEAR_STR
5541 IP_STR
5542 BGP_STR
5543 "Clear peers with the AS number\n"
5544 "Soft reconfig outbound update\n")
5545
5546DEFUN (clear_ip_bgp_as_ipv4_soft_out,
5547 clear_ip_bgp_as_ipv4_soft_out_cmd,
320da874 5548 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft out",
718e3744 5549 CLEAR_STR
5550 IP_STR
5551 BGP_STR
5552 "Clear peers with the AS number\n"
5553 "Address family\n"
5554 "Address Family modifier\n"
5555 "Address Family modifier\n"
5556 "Soft reconfig\n"
5557 "Soft reconfig outbound update\n")
5558{
5559 if (strncmp (argv[1], "m", 1) == 0)
5560 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
5561 BGP_CLEAR_SOFT_OUT, argv[0]);
5562
5563 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
5564 BGP_CLEAR_SOFT_OUT, argv[0]);
5565}
5566
5567ALIAS (clear_ip_bgp_as_ipv4_soft_out,
5568 clear_ip_bgp_as_ipv4_out_cmd,
320da874 5569 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) out",
718e3744 5570 CLEAR_STR
5571 IP_STR
5572 BGP_STR
5573 "Clear peers with the AS number\n"
5574 "Address family\n"
5575 "Address Family modifier\n"
5576 "Address Family modifier\n"
5577 "Soft reconfig outbound update\n")
5578
5579DEFUN (clear_ip_bgp_as_vpnv4_soft_out,
5580 clear_ip_bgp_as_vpnv4_soft_out_cmd,
320da874 5581 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft out",
718e3744 5582 CLEAR_STR
5583 IP_STR
5584 BGP_STR
5585 "Clear peers with the AS number\n"
5586 "Address family\n"
5587 "Address Family modifier\n"
5588 "Soft reconfig\n"
5589 "Soft reconfig outbound update\n")
5590{
5591 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
5592 BGP_CLEAR_SOFT_OUT, argv[0]);
5593}
5594
5595ALIAS (clear_ip_bgp_as_vpnv4_soft_out,
5596 clear_ip_bgp_as_vpnv4_out_cmd,
320da874 5597 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast out",
718e3744 5598 CLEAR_STR
5599 IP_STR
5600 BGP_STR
5601 "Clear peers with the AS number\n"
5602 "Address family\n"
5603 "Address Family modifier\n"
5604 "Soft reconfig outbound update\n")
5605
5606DEFUN (clear_bgp_as_soft_out,
5607 clear_bgp_as_soft_out_cmd,
320da874 5608 "clear bgp " CMD_AS_RANGE " soft out",
718e3744 5609 CLEAR_STR
5610 BGP_STR
5611 "Clear peers with the AS number\n"
5612 "Soft reconfig\n"
5613 "Soft reconfig outbound update\n")
5614{
5615 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
5616 BGP_CLEAR_SOFT_OUT, argv[0]);
5617}
5618
5619ALIAS (clear_bgp_as_soft_out,
5620 clear_bgp_ipv6_as_soft_out_cmd,
320da874 5621 "clear bgp ipv6 " CMD_AS_RANGE " soft out",
718e3744 5622 CLEAR_STR
5623 BGP_STR
5624 "Address family\n"
5625 "Clear peers with the AS number\n"
5626 "Soft reconfig\n"
5627 "Soft reconfig outbound update\n")
5628
5629ALIAS (clear_bgp_as_soft_out,
5630 clear_bgp_as_out_cmd,
320da874 5631 "clear bgp " CMD_AS_RANGE " out",
718e3744 5632 CLEAR_STR
5633 BGP_STR
5634 "Clear peers with the AS number\n"
5635 "Soft reconfig outbound update\n")
5636
5637ALIAS (clear_bgp_as_soft_out,
5638 clear_bgp_ipv6_as_out_cmd,
320da874 5639 "clear bgp ipv6 " CMD_AS_RANGE " out",
718e3744 5640 CLEAR_STR
5641 BGP_STR
5642 "Address family\n"
5643 "Clear peers with the AS number\n"
5644 "Soft reconfig outbound update\n")
6b0655a2 5645
718e3744 5646/* Inbound soft-reconfiguration */
5647DEFUN (clear_ip_bgp_all_soft_in,
5648 clear_ip_bgp_all_soft_in_cmd,
5649 "clear ip bgp * soft in",
5650 CLEAR_STR
5651 IP_STR
5652 BGP_STR
5653 "Clear all peers\n"
5654 "Soft reconfig\n"
5655 "Soft reconfig inbound update\n")
5656{
5657 if (argc == 1)
5658 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5659 BGP_CLEAR_SOFT_IN, NULL);
5660
5661 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5662 BGP_CLEAR_SOFT_IN, NULL);
5663}
5664
5665ALIAS (clear_ip_bgp_all_soft_in,
5666 clear_ip_bgp_instance_all_soft_in_cmd,
5667 "clear ip bgp view WORD * soft in",
5668 CLEAR_STR
5669 IP_STR
5670 BGP_STR
5671 "BGP view\n"
5672 "view name\n"
5673 "Clear all peers\n"
5674 "Soft reconfig\n"
5675 "Soft reconfig inbound update\n")
5676
5677ALIAS (clear_ip_bgp_all_soft_in,
5678 clear_ip_bgp_all_in_cmd,
5679 "clear ip bgp * in",
5680 CLEAR_STR
5681 IP_STR
5682 BGP_STR
5683 "Clear all peers\n"
5684 "Soft reconfig inbound update\n")
5685
5686DEFUN (clear_ip_bgp_all_in_prefix_filter,
5687 clear_ip_bgp_all_in_prefix_filter_cmd,
5688 "clear ip bgp * in prefix-filter",
5689 CLEAR_STR
5690 IP_STR
5691 BGP_STR
5692 "Clear all peers\n"
5693 "Soft reconfig inbound update\n"
5694 "Push out prefix-list ORF and do inbound soft reconfig\n")
5695{
5696 if (argc== 1)
5697 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5698 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5699
5700 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5701 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5702}
5703
5704ALIAS (clear_ip_bgp_all_in_prefix_filter,
5705 clear_ip_bgp_instance_all_in_prefix_filter_cmd,
5706 "clear ip bgp view WORD * in prefix-filter",
5707 CLEAR_STR
5708 IP_STR
5709 BGP_STR
5710 "BGP view\n"
5711 "view name\n"
5712 "Clear all peers\n"
5713 "Soft reconfig inbound update\n"
5714 "Push out prefix-list ORF and do inbound soft reconfig\n")
5715
5716
5717DEFUN (clear_ip_bgp_all_ipv4_soft_in,
5718 clear_ip_bgp_all_ipv4_soft_in_cmd,
5719 "clear ip bgp * ipv4 (unicast|multicast) soft in",
5720 CLEAR_STR
5721 IP_STR
5722 BGP_STR
5723 "Clear all peers\n"
5724 "Address family\n"
5725 "Address Family modifier\n"
5726 "Address Family modifier\n"
5727 "Soft reconfig\n"
5728 "Soft reconfig inbound update\n")
5729{
5730 if (strncmp (argv[0], "m", 1) == 0)
5731 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
5732 BGP_CLEAR_SOFT_IN, NULL);
5733
5734 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5735 BGP_CLEAR_SOFT_IN, NULL);
5736}
5737
5738ALIAS (clear_ip_bgp_all_ipv4_soft_in,
5739 clear_ip_bgp_all_ipv4_in_cmd,
5740 "clear ip bgp * ipv4 (unicast|multicast) in",
5741 CLEAR_STR
5742 IP_STR
5743 BGP_STR
5744 "Clear all peers\n"
5745 "Address family\n"
5746 "Address Family modifier\n"
5747 "Address Family modifier\n"
5748 "Soft reconfig inbound update\n")
5749
5750DEFUN (clear_ip_bgp_instance_all_ipv4_soft_in,
5751 clear_ip_bgp_instance_all_ipv4_soft_in_cmd,
5752 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft in",
5753 CLEAR_STR
5754 IP_STR
5755 BGP_STR
5756 "BGP view\n"
5757 "view name\n"
5758 "Clear all peers\n"
5759 "Address family\n"
5760 "Address Family modifier\n"
5761 "Address Family modifier\n"
5762 "Soft reconfig\n"
5763 "Soft reconfig inbound update\n")
5764{
5765 if (strncmp (argv[1], "m", 1) == 0)
5766 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
5767 BGP_CLEAR_SOFT_IN, NULL);
5768
5769 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5770 BGP_CLEAR_SOFT_IN, NULL);
5771}
5772
5773DEFUN (clear_ip_bgp_all_ipv4_in_prefix_filter,
5774 clear_ip_bgp_all_ipv4_in_prefix_filter_cmd,
5775 "clear ip bgp * ipv4 (unicast|multicast) in prefix-filter",
5776 CLEAR_STR
5777 IP_STR
5778 BGP_STR
5779 "Clear all peers\n"
5780 "Address family\n"
5781 "Address Family modifier\n"
5782 "Address Family modifier\n"
5783 "Soft reconfig inbound update\n"
5784 "Push out prefix-list ORF and do inbound soft reconfig\n")
5785{
5786 if (strncmp (argv[0], "m", 1) == 0)
5787 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
5788 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5789
5790 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
5791 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5792}
5793
5794DEFUN (clear_ip_bgp_instance_all_ipv4_in_prefix_filter,
5795 clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd,
5796 "clear ip bgp view WORD * ipv4 (unicast|multicast) in prefix-filter",
5797 CLEAR_STR
5798 IP_STR
5799 BGP_STR
5800 "Clear all peers\n"
5801 "Address family\n"
5802 "Address Family modifier\n"
5803 "Address Family modifier\n"
5804 "Soft reconfig inbound update\n"
5805 "Push out prefix-list ORF and do inbound soft reconfig\n")
5806{
5807 if (strncmp (argv[1], "m", 1) == 0)
5808 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, clear_all,
5809 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5810
5811 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
5812 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5813}
5814
5815DEFUN (clear_ip_bgp_all_vpnv4_soft_in,
5816 clear_ip_bgp_all_vpnv4_soft_in_cmd,
5817 "clear ip bgp * vpnv4 unicast soft in",
5818 CLEAR_STR
5819 IP_STR
5820 BGP_STR
5821 "Clear all peers\n"
5822 "Address family\n"
5823 "Address Family Modifier\n"
5824 "Soft reconfig\n"
5825 "Soft reconfig inbound update\n")
5826{
5827 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
5828 BGP_CLEAR_SOFT_IN, NULL);
5829}
5830
5831ALIAS (clear_ip_bgp_all_vpnv4_soft_in,
5832 clear_ip_bgp_all_vpnv4_in_cmd,
5833 "clear ip bgp * vpnv4 unicast in",
5834 CLEAR_STR
5835 IP_STR
5836 BGP_STR
5837 "Clear all peers\n"
5838 "Address family\n"
5839 "Address Family Modifier\n"
5840 "Soft reconfig inbound update\n")
5841
5842DEFUN (clear_bgp_all_soft_in,
5843 clear_bgp_all_soft_in_cmd,
5844 "clear bgp * soft in",
5845 CLEAR_STR
5846 BGP_STR
5847 "Clear all peers\n"
5848 "Soft reconfig\n"
5849 "Soft reconfig inbound update\n")
5850{
5851 if (argc == 1)
5852 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
5853 BGP_CLEAR_SOFT_IN, NULL);
5854
5855 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
5856 BGP_CLEAR_SOFT_IN, NULL);
5857}
5858
5859ALIAS (clear_bgp_all_soft_in,
5860 clear_bgp_instance_all_soft_in_cmd,
5861 "clear bgp view WORD * soft in",
5862 CLEAR_STR
5863 BGP_STR
5864 "BGP view\n"
5865 "view name\n"
5866 "Clear all peers\n"
5867 "Soft reconfig\n"
5868 "Soft reconfig inbound update\n")
5869
5870ALIAS (clear_bgp_all_soft_in,
5871 clear_bgp_ipv6_all_soft_in_cmd,
5872 "clear bgp ipv6 * soft in",
5873 CLEAR_STR
5874 BGP_STR
5875 "Address family\n"
5876 "Clear all peers\n"
5877 "Soft reconfig\n"
5878 "Soft reconfig inbound update\n")
5879
5880ALIAS (clear_bgp_all_soft_in,
5881 clear_bgp_all_in_cmd,
5882 "clear bgp * in",
5883 CLEAR_STR
5884 BGP_STR
5885 "Clear all peers\n"
5886 "Soft reconfig inbound update\n")
5887
5888ALIAS (clear_bgp_all_soft_in,
5889 clear_bgp_ipv6_all_in_cmd,
5890 "clear bgp ipv6 * in",
5891 CLEAR_STR
5892 BGP_STR
5893 "Address family\n"
5894 "Clear all peers\n"
5895 "Soft reconfig inbound update\n")
5896
5897DEFUN (clear_bgp_all_in_prefix_filter,
5898 clear_bgp_all_in_prefix_filter_cmd,
5899 "clear bgp * in prefix-filter",
5900 CLEAR_STR
5901 BGP_STR
5902 "Clear all peers\n"
5903 "Soft reconfig inbound update\n"
5904 "Push out prefix-list ORF and do inbound soft reconfig\n")
5905{
5906 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
5907 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
5908}
5909
5910ALIAS (clear_bgp_all_in_prefix_filter,
5911 clear_bgp_ipv6_all_in_prefix_filter_cmd,
5912 "clear bgp ipv6 * in prefix-filter",
5913 CLEAR_STR
5914 BGP_STR
5915 "Address family\n"
5916 "Clear all peers\n"
5917 "Soft reconfig inbound update\n"
5918 "Push out prefix-list ORF and do inbound soft reconfig\n")
5919
5920DEFUN (clear_ip_bgp_peer_soft_in,
5921 clear_ip_bgp_peer_soft_in_cmd,
5922 "clear ip bgp A.B.C.D soft in",
5923 CLEAR_STR
5924 IP_STR
5925 BGP_STR
5926 "BGP neighbor address to clear\n"
5927 "Soft reconfig\n"
5928 "Soft reconfig inbound update\n")
5929{
5930 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5931 BGP_CLEAR_SOFT_IN, argv[0]);
5932}
5933
5934ALIAS (clear_ip_bgp_peer_soft_in,
5935 clear_ip_bgp_peer_in_cmd,
5936 "clear ip bgp A.B.C.D in",
5937 CLEAR_STR
5938 IP_STR
5939 BGP_STR
5940 "BGP neighbor address to clear\n"
5941 "Soft reconfig inbound update\n")
5942
5943DEFUN (clear_ip_bgp_peer_in_prefix_filter,
5944 clear_ip_bgp_peer_in_prefix_filter_cmd,
5945 "clear ip bgp A.B.C.D in prefix-filter",
5946 CLEAR_STR
5947 IP_STR
5948 BGP_STR
5949 "BGP neighbor address to clear\n"
5950 "Soft reconfig inbound update\n"
5951 "Push out the existing ORF prefix-list\n")
5952{
5953 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5954 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
5955}
5956
5957DEFUN (clear_ip_bgp_peer_ipv4_soft_in,
5958 clear_ip_bgp_peer_ipv4_soft_in_cmd,
5959 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft in",
5960 CLEAR_STR
5961 IP_STR
5962 BGP_STR
5963 "BGP neighbor address to clear\n"
5964 "Address family\n"
5965 "Address Family modifier\n"
5966 "Address Family modifier\n"
5967 "Soft reconfig\n"
5968 "Soft reconfig inbound update\n")
5969{
5970 if (strncmp (argv[1], "m", 1) == 0)
5971 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
5972 BGP_CLEAR_SOFT_IN, argv[0]);
5973
5974 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
5975 BGP_CLEAR_SOFT_IN, argv[0]);
5976}
5977
5978ALIAS (clear_ip_bgp_peer_ipv4_soft_in,
5979 clear_ip_bgp_peer_ipv4_in_cmd,
5980 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in",
5981 CLEAR_STR
5982 IP_STR
5983 BGP_STR
5984 "BGP neighbor address to clear\n"
5985 "Address family\n"
5986 "Address Family modifier\n"
5987 "Address Family modifier\n"
5988 "Soft reconfig inbound update\n")
5989
5990DEFUN (clear_ip_bgp_peer_ipv4_in_prefix_filter,
5991 clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd,
5992 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) in prefix-filter",
5993 CLEAR_STR
5994 IP_STR
5995 BGP_STR
5996 "BGP neighbor address to clear\n"
5997 "Address family\n"
5998 "Address Family modifier\n"
5999 "Address Family modifier\n"
6000 "Soft reconfig inbound update\n"
6001 "Push out the existing ORF prefix-list\n")
6002{
6003 if (strncmp (argv[1], "m", 1) == 0)
6004 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
6005 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6006
6007 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6008 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6009}
6010
6011DEFUN (clear_ip_bgp_peer_vpnv4_soft_in,
6012 clear_ip_bgp_peer_vpnv4_soft_in_cmd,
6013 "clear ip bgp A.B.C.D vpnv4 unicast soft in",
6014 CLEAR_STR
6015 IP_STR
6016 BGP_STR
6017 "BGP neighbor address to clear\n"
6018 "Address family\n"
6019 "Address Family Modifier\n"
6020 "Soft reconfig\n"
6021 "Soft reconfig inbound update\n")
6022{
6023 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
6024 BGP_CLEAR_SOFT_IN, argv[0]);
6025}
6026
6027ALIAS (clear_ip_bgp_peer_vpnv4_soft_in,
6028 clear_ip_bgp_peer_vpnv4_in_cmd,
6029 "clear ip bgp A.B.C.D vpnv4 unicast in",
6030 CLEAR_STR
6031 IP_STR
6032 BGP_STR
6033 "BGP neighbor address to clear\n"
6034 "Address family\n"
6035 "Address Family Modifier\n"
6036 "Soft reconfig inbound update\n")
6037
6038DEFUN (clear_bgp_peer_soft_in,
6039 clear_bgp_peer_soft_in_cmd,
a80beece 6040 "clear bgp (A.B.C.D|X:X::X:X|WORD) soft in",
718e3744 6041 CLEAR_STR
6042 BGP_STR
6043 "BGP neighbor address to clear\n"
6044 "BGP IPv6 neighbor to clear\n"
a80beece 6045 "BGP neighbor on interface to clear\n"
718e3744 6046 "Soft reconfig\n"
6047 "Soft reconfig inbound update\n")
6048{
6049 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
6050 BGP_CLEAR_SOFT_IN, argv[0]);
6051}
6052
6053ALIAS (clear_bgp_peer_soft_in,
6054 clear_bgp_ipv6_peer_soft_in_cmd,
a80beece 6055 "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) soft in",
718e3744 6056 CLEAR_STR
6057 BGP_STR
6058 "Address family\n"
6059 "BGP neighbor address to clear\n"
6060 "BGP IPv6 neighbor to clear\n"
a80beece 6061 "BGP neighbor on interface to clear\n"
718e3744 6062 "Soft reconfig\n"
6063 "Soft reconfig inbound update\n")
6064
6065ALIAS (clear_bgp_peer_soft_in,
6066 clear_bgp_peer_in_cmd,
a80beece 6067 "clear bgp (A.B.C.D|X:X::X:X|WORD) in",
718e3744 6068 CLEAR_STR
6069 BGP_STR
6070 "BGP neighbor address to clear\n"
6071 "BGP IPv6 neighbor to clear\n"
a80beece 6072 "BGP neighbor on interface to clear\n"
718e3744 6073 "Soft reconfig inbound update\n")
6074
6075ALIAS (clear_bgp_peer_soft_in,
6076 clear_bgp_ipv6_peer_in_cmd,
a80beece 6077 "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) in",
718e3744 6078 CLEAR_STR
6079 BGP_STR
6080 "Address family\n"
6081 "BGP neighbor address to clear\n"
6082 "BGP IPv6 neighbor to clear\n"
a80beece 6083 "BGP neighbor on interface to clear\n"
718e3744 6084 "Soft reconfig inbound update\n")
6085
6086DEFUN (clear_bgp_peer_in_prefix_filter,
6087 clear_bgp_peer_in_prefix_filter_cmd,
a80beece 6088 "clear bgp (A.B.C.D|X:X::X:X|WORD) in prefix-filter",
718e3744 6089 CLEAR_STR
6090 BGP_STR
6091 "BGP neighbor address to clear\n"
6092 "BGP IPv6 neighbor to clear\n"
a80beece 6093 "BGP neighbor on interface to clear\n"
718e3744 6094 "Soft reconfig inbound update\n"
6095 "Push out the existing ORF prefix-list\n")
6096{
6097 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
6098 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6099}
6100
6101ALIAS (clear_bgp_peer_in_prefix_filter,
6102 clear_bgp_ipv6_peer_in_prefix_filter_cmd,
a80beece 6103 "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) in prefix-filter",
718e3744 6104 CLEAR_STR
6105 BGP_STR
6106 "Address family\n"
6107 "BGP neighbor address to clear\n"
6108 "BGP IPv6 neighbor to clear\n"
a80beece 6109 "BGP neighbor on interface to clear\n"
718e3744 6110 "Soft reconfig inbound update\n"
6111 "Push out the existing ORF prefix-list\n")
6112
6113DEFUN (clear_ip_bgp_peer_group_soft_in,
6114 clear_ip_bgp_peer_group_soft_in_cmd,
6115 "clear ip bgp peer-group WORD soft in",
6116 CLEAR_STR
6117 IP_STR
6118 BGP_STR
6119 "Clear all members of peer-group\n"
6120 "BGP peer-group name\n"
6121 "Soft reconfig\n"
6122 "Soft reconfig inbound update\n")
6123{
6124 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6125 BGP_CLEAR_SOFT_IN, argv[0]);
6126}
6127
6128ALIAS (clear_ip_bgp_peer_group_soft_in,
6129 clear_ip_bgp_peer_group_in_cmd,
6130 "clear ip bgp peer-group WORD in",
6131 CLEAR_STR
6132 IP_STR
6133 BGP_STR
6134 "Clear all members of peer-group\n"
6135 "BGP peer-group name\n"
6136 "Soft reconfig inbound update\n")
6137
6138DEFUN (clear_ip_bgp_peer_group_in_prefix_filter,
6139 clear_ip_bgp_peer_group_in_prefix_filter_cmd,
6140 "clear ip bgp peer-group WORD in prefix-filter",
6141 CLEAR_STR
6142 IP_STR
6143 BGP_STR
6144 "Clear all members of peer-group\n"
6145 "BGP peer-group name\n"
6146 "Soft reconfig inbound update\n"
6147 "Push out prefix-list ORF and do inbound soft reconfig\n")
6148{
6149 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6150 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6151}
6152
6153DEFUN (clear_ip_bgp_peer_group_ipv4_soft_in,
6154 clear_ip_bgp_peer_group_ipv4_soft_in_cmd,
6155 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft in",
6156 CLEAR_STR
6157 IP_STR
6158 BGP_STR
6159 "Clear all members of peer-group\n"
6160 "BGP peer-group name\n"
6161 "Address family\n"
6162 "Address Family modifier\n"
6163 "Address Family modifier\n"
6164 "Soft reconfig\n"
6165 "Soft reconfig inbound update\n")
6166{
6167 if (strncmp (argv[1], "m", 1) == 0)
6168 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
6169 BGP_CLEAR_SOFT_IN, argv[0]);
6170
6171 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6172 BGP_CLEAR_SOFT_IN, argv[0]);
6173}
6174
6175ALIAS (clear_ip_bgp_peer_group_ipv4_soft_in,
6176 clear_ip_bgp_peer_group_ipv4_in_cmd,
6177 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in",
6178 CLEAR_STR
6179 IP_STR
6180 BGP_STR
6181 "Clear all members of peer-group\n"
6182 "BGP peer-group name\n"
6183 "Address family\n"
6184 "Address Family modifier\n"
6185 "Address Family modifier\n"
6186 "Soft reconfig inbound update\n")
6187
6188DEFUN (clear_ip_bgp_peer_group_ipv4_in_prefix_filter,
6189 clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd,
6190 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in prefix-filter",
6191 CLEAR_STR
6192 IP_STR
6193 BGP_STR
6194 "Clear all members of peer-group\n"
6195 "BGP peer-group name\n"
6196 "Address family\n"
6197 "Address Family modifier\n"
6198 "Address Family modifier\n"
6199 "Soft reconfig inbound update\n"
6200 "Push out prefix-list ORF and do inbound soft reconfig\n")
6201{
6202 if (strncmp (argv[1], "m", 1) == 0)
6203 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
6204 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6205
6206 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6207 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6208}
6209
6210DEFUN (clear_bgp_peer_group_soft_in,
6211 clear_bgp_peer_group_soft_in_cmd,
6212 "clear bgp peer-group WORD soft in",
6213 CLEAR_STR
6214 BGP_STR
6215 "Clear all members of peer-group\n"
6216 "BGP peer-group name\n"
6217 "Soft reconfig\n"
6218 "Soft reconfig inbound update\n")
6219{
6220 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
6221 BGP_CLEAR_SOFT_IN, argv[0]);
6222}
6223
6224ALIAS (clear_bgp_peer_group_soft_in,
6225 clear_bgp_ipv6_peer_group_soft_in_cmd,
6226 "clear bgp ipv6 peer-group WORD soft in",
6227 CLEAR_STR
6228 BGP_STR
6229 "Address family\n"
6230 "Clear all members of peer-group\n"
6231 "BGP peer-group name\n"
6232 "Soft reconfig\n"
6233 "Soft reconfig inbound update\n")
6234
6235ALIAS (clear_bgp_peer_group_soft_in,
6236 clear_bgp_peer_group_in_cmd,
6237 "clear bgp peer-group WORD in",
6238 CLEAR_STR
6239 BGP_STR
6240 "Clear all members of peer-group\n"
6241 "BGP peer-group name\n"
6242 "Soft reconfig inbound update\n")
6243
6244ALIAS (clear_bgp_peer_group_soft_in,
6245 clear_bgp_ipv6_peer_group_in_cmd,
6246 "clear bgp ipv6 peer-group WORD in",
6247 CLEAR_STR
6248 BGP_STR
6249 "Address family\n"
6250 "Clear all members of peer-group\n"
6251 "BGP peer-group name\n"
6252 "Soft reconfig inbound update\n")
6253
6254DEFUN (clear_bgp_peer_group_in_prefix_filter,
6255 clear_bgp_peer_group_in_prefix_filter_cmd,
6256 "clear bgp peer-group WORD in prefix-filter",
6257 CLEAR_STR
6258 BGP_STR
6259 "Clear all members of peer-group\n"
6260 "BGP peer-group name\n"
6261 "Soft reconfig inbound update\n"
6262 "Push out prefix-list ORF and do inbound soft reconfig\n")
6263{
6264 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
6265 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6266}
6267
6268ALIAS (clear_bgp_peer_group_in_prefix_filter,
6269 clear_bgp_ipv6_peer_group_in_prefix_filter_cmd,
6270 "clear bgp ipv6 peer-group WORD in prefix-filter",
6271 CLEAR_STR
6272 BGP_STR
6273 "Address family\n"
6274 "Clear all members of peer-group\n"
6275 "BGP peer-group name\n"
6276 "Soft reconfig inbound update\n"
6277 "Push out prefix-list ORF and do inbound soft reconfig\n")
6278
6279DEFUN (clear_ip_bgp_external_soft_in,
6280 clear_ip_bgp_external_soft_in_cmd,
6281 "clear ip bgp external soft in",
6282 CLEAR_STR
6283 IP_STR
6284 BGP_STR
6285 "Clear all external peers\n"
6286 "Soft reconfig\n"
6287 "Soft reconfig inbound update\n")
6288{
6289 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6290 BGP_CLEAR_SOFT_IN, NULL);
6291}
6292
6293ALIAS (clear_ip_bgp_external_soft_in,
6294 clear_ip_bgp_external_in_cmd,
6295 "clear ip bgp external in",
6296 CLEAR_STR
6297 IP_STR
6298 BGP_STR
6299 "Clear all external peers\n"
6300 "Soft reconfig inbound update\n")
6301
6302DEFUN (clear_ip_bgp_external_in_prefix_filter,
6303 clear_ip_bgp_external_in_prefix_filter_cmd,
6304 "clear ip bgp external in prefix-filter",
6305 CLEAR_STR
6306 IP_STR
6307 BGP_STR
6308 "Clear all external peers\n"
6309 "Soft reconfig inbound update\n"
6310 "Push out prefix-list ORF and do inbound soft reconfig\n")
6311{
6312 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6313 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
6314}
6315
6316DEFUN (clear_ip_bgp_external_ipv4_soft_in,
6317 clear_ip_bgp_external_ipv4_soft_in_cmd,
6318 "clear ip bgp external ipv4 (unicast|multicast) soft in",
6319 CLEAR_STR
6320 IP_STR
6321 BGP_STR
6322 "Clear all external peers\n"
6323 "Address family\n"
6324 "Address Family modifier\n"
6325 "Address Family modifier\n"
6326 "Soft reconfig\n"
6327 "Soft reconfig inbound update\n")
6328{
6329 if (strncmp (argv[0], "m", 1) == 0)
6330 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
6331 BGP_CLEAR_SOFT_IN, NULL);
6332
6333 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6334 BGP_CLEAR_SOFT_IN, NULL);
6335}
6336
6337ALIAS (clear_ip_bgp_external_ipv4_soft_in,
6338 clear_ip_bgp_external_ipv4_in_cmd,
6339 "clear ip bgp external ipv4 (unicast|multicast) in",
6340 CLEAR_STR
6341 IP_STR
6342 BGP_STR
6343 "Clear all external peers\n"
6344 "Address family\n"
6345 "Address Family modifier\n"
6346 "Address Family modifier\n"
6347 "Soft reconfig inbound update\n")
6348
6349DEFUN (clear_ip_bgp_external_ipv4_in_prefix_filter,
6350 clear_ip_bgp_external_ipv4_in_prefix_filter_cmd,
6351 "clear ip bgp external ipv4 (unicast|multicast) in prefix-filter",
6352 CLEAR_STR
6353 IP_STR
6354 BGP_STR
6355 "Clear all external peers\n"
6356 "Address family\n"
6357 "Address Family modifier\n"
6358 "Address Family modifier\n"
6359 "Soft reconfig inbound update\n"
6360 "Push out prefix-list ORF and do inbound soft reconfig\n")
6361{
6362 if (strncmp (argv[0], "m", 1) == 0)
6363 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
6364 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
6365
6366 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6367 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
6368}
6369
6370DEFUN (clear_bgp_external_soft_in,
6371 clear_bgp_external_soft_in_cmd,
6372 "clear bgp external soft in",
6373 CLEAR_STR
6374 BGP_STR
6375 "Clear all external peers\n"
6376 "Soft reconfig\n"
6377 "Soft reconfig inbound update\n")
6378{
6379 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
6380 BGP_CLEAR_SOFT_IN, NULL);
6381}
6382
6383ALIAS (clear_bgp_external_soft_in,
6384 clear_bgp_ipv6_external_soft_in_cmd,
6385 "clear bgp ipv6 external soft in",
6386 CLEAR_STR
6387 BGP_STR
6388 "Address family\n"
6389 "Clear all external peers\n"
6390 "Soft reconfig\n"
6391 "Soft reconfig inbound update\n")
6392
6393ALIAS (clear_bgp_external_soft_in,
6394 clear_bgp_external_in_cmd,
6395 "clear bgp external in",
6396 CLEAR_STR
6397 BGP_STR
6398 "Clear all external peers\n"
6399 "Soft reconfig inbound update\n")
6400
6401ALIAS (clear_bgp_external_soft_in,
6402 clear_bgp_ipv6_external_in_cmd,
6403 "clear bgp ipv6 external WORD in",
6404 CLEAR_STR
6405 BGP_STR
6406 "Address family\n"
6407 "Clear all external peers\n"
6408 "Soft reconfig inbound update\n")
6409
6410DEFUN (clear_bgp_external_in_prefix_filter,
6411 clear_bgp_external_in_prefix_filter_cmd,
6412 "clear bgp external in prefix-filter",
6413 CLEAR_STR
6414 BGP_STR
6415 "Clear all external peers\n"
6416 "Soft reconfig inbound update\n"
6417 "Push out prefix-list ORF and do inbound soft reconfig\n")
6418{
6419 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
6420 BGP_CLEAR_SOFT_IN_ORF_PREFIX, NULL);
6421}
6422
6423ALIAS (clear_bgp_external_in_prefix_filter,
6424 clear_bgp_ipv6_external_in_prefix_filter_cmd,
6425 "clear bgp ipv6 external in prefix-filter",
6426 CLEAR_STR
6427 BGP_STR
6428 "Address family\n"
6429 "Clear all external peers\n"
6430 "Soft reconfig inbound update\n"
6431 "Push out prefix-list ORF and do inbound soft reconfig\n")
6432
6433DEFUN (clear_ip_bgp_as_soft_in,
6434 clear_ip_bgp_as_soft_in_cmd,
320da874 6435 "clear ip bgp " CMD_AS_RANGE " soft in",
718e3744 6436 CLEAR_STR
6437 IP_STR
6438 BGP_STR
6439 "Clear peers with the AS number\n"
6440 "Soft reconfig\n"
6441 "Soft reconfig inbound update\n")
6442{
6443 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6444 BGP_CLEAR_SOFT_IN, argv[0]);
6445}
6446
6447ALIAS (clear_ip_bgp_as_soft_in,
6448 clear_ip_bgp_as_in_cmd,
320da874 6449 "clear ip bgp " CMD_AS_RANGE " in",
718e3744 6450 CLEAR_STR
6451 IP_STR
6452 BGP_STR
6453 "Clear peers with the AS number\n"
6454 "Soft reconfig inbound update\n")
6455
6456DEFUN (clear_ip_bgp_as_in_prefix_filter,
6457 clear_ip_bgp_as_in_prefix_filter_cmd,
320da874 6458 "clear ip bgp " CMD_AS_RANGE " in prefix-filter",
718e3744 6459 CLEAR_STR
6460 IP_STR
6461 BGP_STR
6462 "Clear peers with the AS number\n"
6463 "Soft reconfig inbound update\n"
6464 "Push out prefix-list ORF and do inbound soft reconfig\n")
6465{
6466 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6467 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6468}
6469
6470DEFUN (clear_ip_bgp_as_ipv4_soft_in,
6471 clear_ip_bgp_as_ipv4_soft_in_cmd,
320da874 6472 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft in",
718e3744 6473 CLEAR_STR
6474 IP_STR
6475 BGP_STR
6476 "Clear peers with the AS number\n"
6477 "Address family\n"
6478 "Address Family modifier\n"
6479 "Address Family modifier\n"
6480 "Soft reconfig\n"
6481 "Soft reconfig inbound update\n")
6482{
6483 if (strncmp (argv[1], "m", 1) == 0)
6484 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
6485 BGP_CLEAR_SOFT_IN, argv[0]);
6486
6487 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6488 BGP_CLEAR_SOFT_IN, argv[0]);
6489}
6490
6491ALIAS (clear_ip_bgp_as_ipv4_soft_in,
6492 clear_ip_bgp_as_ipv4_in_cmd,
320da874 6493 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in",
718e3744 6494 CLEAR_STR
6495 IP_STR
6496 BGP_STR
6497 "Clear peers with the AS number\n"
6498 "Address family\n"
6499 "Address Family modifier\n"
6500 "Address Family modifier\n"
6501 "Soft reconfig inbound update\n")
6502
6503DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter,
6504 clear_ip_bgp_as_ipv4_in_prefix_filter_cmd,
320da874 6505 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in prefix-filter",
718e3744 6506 CLEAR_STR
6507 IP_STR
6508 BGP_STR
6509 "Clear peers with the AS number\n"
6510 "Address family\n"
6511 "Address Family modifier\n"
6512 "Address Family modifier\n"
6513 "Soft reconfig inbound update\n"
6514 "Push out prefix-list ORF and do inbound soft reconfig\n")
6515{
6516 if (strncmp (argv[1], "m", 1) == 0)
6517 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
6518 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6519
6520 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6521 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6522}
6523
6524DEFUN (clear_ip_bgp_as_vpnv4_soft_in,
6525 clear_ip_bgp_as_vpnv4_soft_in_cmd,
320da874 6526 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft in",
718e3744 6527 CLEAR_STR
6528 IP_STR
6529 BGP_STR
6530 "Clear peers with the AS number\n"
6531 "Address family\n"
6532 "Address Family modifier\n"
6533 "Soft reconfig\n"
6534 "Soft reconfig inbound update\n")
6535{
6536 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
6537 BGP_CLEAR_SOFT_IN, argv[0]);
6538}
6539
6540ALIAS (clear_ip_bgp_as_vpnv4_soft_in,
6541 clear_ip_bgp_as_vpnv4_in_cmd,
320da874 6542 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast in",
718e3744 6543 CLEAR_STR
6544 IP_STR
6545 BGP_STR
6546 "Clear peers with the AS number\n"
6547 "Address family\n"
6548 "Address Family modifier\n"
6549 "Soft reconfig inbound update\n")
6550
6551DEFUN (clear_bgp_as_soft_in,
6552 clear_bgp_as_soft_in_cmd,
320da874 6553 "clear bgp " CMD_AS_RANGE " soft in",
718e3744 6554 CLEAR_STR
6555 BGP_STR
6556 "Clear peers with the AS number\n"
6557 "Soft reconfig\n"
6558 "Soft reconfig inbound update\n")
6559{
6560 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
6561 BGP_CLEAR_SOFT_IN, argv[0]);
6562}
6563
6564ALIAS (clear_bgp_as_soft_in,
6565 clear_bgp_ipv6_as_soft_in_cmd,
320da874 6566 "clear bgp ipv6 " CMD_AS_RANGE " soft in",
718e3744 6567 CLEAR_STR
6568 BGP_STR
6569 "Address family\n"
6570 "Clear peers with the AS number\n"
6571 "Soft reconfig\n"
6572 "Soft reconfig inbound update\n")
6573
6574ALIAS (clear_bgp_as_soft_in,
6575 clear_bgp_as_in_cmd,
320da874 6576 "clear bgp " CMD_AS_RANGE " in",
718e3744 6577 CLEAR_STR
6578 BGP_STR
6579 "Clear peers with the AS number\n"
6580 "Soft reconfig inbound update\n")
6581
6582ALIAS (clear_bgp_as_soft_in,
6583 clear_bgp_ipv6_as_in_cmd,
320da874 6584 "clear bgp ipv6 " CMD_AS_RANGE " in",
718e3744 6585 CLEAR_STR
6586 BGP_STR
6587 "Address family\n"
6588 "Clear peers with the AS number\n"
6589 "Soft reconfig inbound update\n")
6590
6591DEFUN (clear_bgp_as_in_prefix_filter,
6592 clear_bgp_as_in_prefix_filter_cmd,
320da874 6593 "clear bgp " CMD_AS_RANGE " in prefix-filter",
718e3744 6594 CLEAR_STR
6595 BGP_STR
6596 "Clear peers with the AS number\n"
6597 "Soft reconfig inbound update\n"
6598 "Push out prefix-list ORF and do inbound soft reconfig\n")
6599{
6600 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
6601 BGP_CLEAR_SOFT_IN_ORF_PREFIX, argv[0]);
6602}
6603
6604ALIAS (clear_bgp_as_in_prefix_filter,
6605 clear_bgp_ipv6_as_in_prefix_filter_cmd,
320da874 6606 "clear bgp ipv6 " CMD_AS_RANGE " in prefix-filter",
718e3744 6607 CLEAR_STR
6608 BGP_STR
6609 "Address family\n"
6610 "Clear peers with the AS number\n"
6611 "Soft reconfig inbound update\n"
6612 "Push out prefix-list ORF and do inbound soft reconfig\n")
6b0655a2 6613
718e3744 6614/* Both soft-reconfiguration */
6615DEFUN (clear_ip_bgp_all_soft,
6616 clear_ip_bgp_all_soft_cmd,
6617 "clear ip bgp * soft",
6618 CLEAR_STR
6619 IP_STR
6620 BGP_STR
6621 "Clear all peers\n"
6622 "Soft reconfig\n")
6623{
6624 if (argc == 1)
6625 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
6626 BGP_CLEAR_SOFT_BOTH, NULL);
6627
6628 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6629 BGP_CLEAR_SOFT_BOTH, NULL);
6630}
6631
6632ALIAS (clear_ip_bgp_all_soft,
6633 clear_ip_bgp_instance_all_soft_cmd,
6634 "clear ip bgp view WORD * soft",
6635 CLEAR_STR
6636 IP_STR
6637 BGP_STR
6638 "BGP view\n"
6639 "view name\n"
6640 "Clear all peers\n"
6641 "Soft reconfig\n")
6642
6643
6644DEFUN (clear_ip_bgp_all_ipv4_soft,
6645 clear_ip_bgp_all_ipv4_soft_cmd,
6646 "clear ip bgp * ipv4 (unicast|multicast) soft",
6647 CLEAR_STR
6648 IP_STR
6649 BGP_STR
6650 "Clear all peers\n"
6651 "Address family\n"
6652 "Address Family Modifier\n"
6653 "Address Family Modifier\n"
6654 "Soft reconfig\n")
6655{
6656 if (strncmp (argv[0], "m", 1) == 0)
6657 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
6658 BGP_CLEAR_SOFT_BOTH, NULL);
6659
6660 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6661 BGP_CLEAR_SOFT_BOTH, NULL);
6662}
6663
6664DEFUN (clear_ip_bgp_instance_all_ipv4_soft,
6665 clear_ip_bgp_instance_all_ipv4_soft_cmd,
6666 "clear ip bgp view WORD * ipv4 (unicast|multicast) soft",
6667 CLEAR_STR
6668 IP_STR
6669 BGP_STR
6670 "BGP view\n"
6671 "view name\n"
6672 "Clear all peers\n"
6673 "Address family\n"
6674 "Address Family Modifier\n"
6675 "Address Family Modifier\n"
6676 "Soft reconfig\n")
6677{
6678 if (strncmp (argv[1], "m", 1) == 0)
6679 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all,
6680 BGP_CLEAR_SOFT_BOTH, NULL);
6681
6682 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
6683 BGP_CLEAR_SOFT_BOTH, NULL);
6684}
6685
6686DEFUN (clear_ip_bgp_all_vpnv4_soft,
6687 clear_ip_bgp_all_vpnv4_soft_cmd,
6688 "clear ip bgp * vpnv4 unicast soft",
6689 CLEAR_STR
6690 IP_STR
6691 BGP_STR
6692 "Clear all peers\n"
6693 "Address family\n"
6694 "Address Family Modifier\n"
6695 "Soft reconfig\n")
6696{
6697 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_all,
6698 BGP_CLEAR_SOFT_BOTH, argv[0]);
6699}
6700
6701DEFUN (clear_bgp_all_soft,
6702 clear_bgp_all_soft_cmd,
6703 "clear bgp * soft",
6704 CLEAR_STR
6705 BGP_STR
6706 "Clear all peers\n"
6707 "Soft reconfig\n")
6708{
6709 if (argc == 1)
6710 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
6711 BGP_CLEAR_SOFT_BOTH, argv[0]);
6712
6713 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
6714 BGP_CLEAR_SOFT_BOTH, argv[0]);
6715}
6716
6717ALIAS (clear_bgp_all_soft,
6718 clear_bgp_instance_all_soft_cmd,
6719 "clear bgp view WORD * soft",
6720 CLEAR_STR
6721 BGP_STR
6722 "BGP view\n"
6723 "view name\n"
6724 "Clear all peers\n"
6725 "Soft reconfig\n")
6726
6727ALIAS (clear_bgp_all_soft,
6728 clear_bgp_ipv6_all_soft_cmd,
6729 "clear bgp ipv6 * soft",
6730 CLEAR_STR
6731 BGP_STR
6732 "Address family\n"
6733 "Clear all peers\n"
6734 "Soft reconfig\n")
6735
6736DEFUN (clear_ip_bgp_peer_soft,
6737 clear_ip_bgp_peer_soft_cmd,
6738 "clear ip bgp A.B.C.D soft",
6739 CLEAR_STR
6740 IP_STR
6741 BGP_STR
6742 "BGP neighbor address to clear\n"
6743 "Soft reconfig\n")
6744{
6745 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6746 BGP_CLEAR_SOFT_BOTH, argv[0]);
6747}
6748
6749DEFUN (clear_ip_bgp_peer_ipv4_soft,
6750 clear_ip_bgp_peer_ipv4_soft_cmd,
6751 "clear ip bgp A.B.C.D ipv4 (unicast|multicast) soft",
6752 CLEAR_STR
6753 IP_STR
6754 BGP_STR
6755 "BGP neighbor address to clear\n"
6756 "Address family\n"
6757 "Address Family Modifier\n"
6758 "Address Family Modifier\n"
6759 "Soft reconfig\n")
6760{
6761 if (strncmp (argv[1], "m", 1) == 0)
6762 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_peer,
6763 BGP_CLEAR_SOFT_BOTH, argv[0]);
6764
6765 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
6766 BGP_CLEAR_SOFT_BOTH, argv[0]);
6767}
6768
6769DEFUN (clear_ip_bgp_peer_vpnv4_soft,
6770 clear_ip_bgp_peer_vpnv4_soft_cmd,
6771 "clear ip bgp A.B.C.D vpnv4 unicast soft",
6772 CLEAR_STR
6773 IP_STR
6774 BGP_STR
6775 "BGP neighbor address to clear\n"
6776 "Address family\n"
6777 "Address Family Modifier\n"
6778 "Soft reconfig\n")
6779{
6780 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_peer,
6781 BGP_CLEAR_SOFT_BOTH, argv[0]);
6782}
6783
6784DEFUN (clear_bgp_peer_soft,
6785 clear_bgp_peer_soft_cmd,
a80beece 6786 "clear bgp (A.B.C.D|X:X::X:X|WORD) soft",
718e3744 6787 CLEAR_STR
6788 BGP_STR
6789 "BGP neighbor address to clear\n"
6790 "BGP IPv6 neighbor to clear\n"
a80beece 6791 "BGP neighbor on interface to clear\n"
718e3744 6792 "Soft reconfig\n")
6793{
6794 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
6795 BGP_CLEAR_SOFT_BOTH, argv[0]);
6796}
6797
6798ALIAS (clear_bgp_peer_soft,
6799 clear_bgp_ipv6_peer_soft_cmd,
a80beece 6800 "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) soft",
718e3744 6801 CLEAR_STR
6802 BGP_STR
6803 "Address family\n"
6804 "BGP neighbor address to clear\n"
6805 "BGP IPv6 neighbor to clear\n"
a80beece 6806 "BGP neighbor on interface to clear\n"
718e3744 6807 "Soft reconfig\n")
6808
6809DEFUN (clear_ip_bgp_peer_group_soft,
6810 clear_ip_bgp_peer_group_soft_cmd,
6811 "clear ip bgp peer-group WORD soft",
6812 CLEAR_STR
6813 IP_STR
6814 BGP_STR
6815 "Clear all members of peer-group\n"
6816 "BGP peer-group name\n"
6817 "Soft reconfig\n")
6818{
6819 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6820 BGP_CLEAR_SOFT_BOTH, argv[0]);
6821}
6822
6823DEFUN (clear_ip_bgp_peer_group_ipv4_soft,
6824 clear_ip_bgp_peer_group_ipv4_soft_cmd,
6825 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft",
6826 CLEAR_STR
6827 IP_STR
6828 BGP_STR
6829 "Clear all members of peer-group\n"
6830 "BGP peer-group name\n"
6831 "Address family\n"
6832 "Address Family modifier\n"
6833 "Address Family modifier\n"
6834 "Soft reconfig\n")
6835{
6836 if (strncmp (argv[1], "m", 1) == 0)
6837 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_group,
6838 BGP_CLEAR_SOFT_BOTH, argv[0]);
6839
6840 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_group,
6841 BGP_CLEAR_SOFT_BOTH, argv[0]);
6842}
6843
6844DEFUN (clear_bgp_peer_group_soft,
6845 clear_bgp_peer_group_soft_cmd,
6846 "clear bgp peer-group WORD soft",
6847 CLEAR_STR
6848 BGP_STR
6849 "Clear all members of peer-group\n"
6850 "BGP peer-group name\n"
6851 "Soft reconfig\n")
6852{
6853 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_group,
6854 BGP_CLEAR_SOFT_BOTH, argv[0]);
6855}
6856
6857ALIAS (clear_bgp_peer_group_soft,
6858 clear_bgp_ipv6_peer_group_soft_cmd,
6859 "clear bgp ipv6 peer-group WORD soft",
6860 CLEAR_STR
6861 BGP_STR
6862 "Address family\n"
6863 "Clear all members of peer-group\n"
6864 "BGP peer-group name\n"
6865 "Soft reconfig\n")
6866
6867DEFUN (clear_ip_bgp_external_soft,
6868 clear_ip_bgp_external_soft_cmd,
6869 "clear ip bgp external soft",
6870 CLEAR_STR
6871 IP_STR
6872 BGP_STR
6873 "Clear all external peers\n"
6874 "Soft reconfig\n")
6875{
6876 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6877 BGP_CLEAR_SOFT_BOTH, NULL);
6878}
6879
6880DEFUN (clear_ip_bgp_external_ipv4_soft,
6881 clear_ip_bgp_external_ipv4_soft_cmd,
6882 "clear ip bgp external ipv4 (unicast|multicast) soft",
6883 CLEAR_STR
6884 IP_STR
6885 BGP_STR
6886 "Clear all external peers\n"
6887 "Address family\n"
6888 "Address Family modifier\n"
6889 "Address Family modifier\n"
6890 "Soft reconfig\n")
6891{
6892 if (strncmp (argv[0], "m", 1) == 0)
6893 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_external,
6894 BGP_CLEAR_SOFT_BOTH, NULL);
6895
6896 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_external,
6897 BGP_CLEAR_SOFT_BOTH, NULL);
6898}
6899
6900DEFUN (clear_bgp_external_soft,
6901 clear_bgp_external_soft_cmd,
6902 "clear bgp external soft",
6903 CLEAR_STR
6904 BGP_STR
6905 "Clear all external peers\n"
6906 "Soft reconfig\n")
6907{
6908 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_external,
6909 BGP_CLEAR_SOFT_BOTH, NULL);
6910}
6911
6912ALIAS (clear_bgp_external_soft,
6913 clear_bgp_ipv6_external_soft_cmd,
6914 "clear bgp ipv6 external soft",
6915 CLEAR_STR
6916 BGP_STR
6917 "Address family\n"
6918 "Clear all external peers\n"
6919 "Soft reconfig\n")
6920
6921DEFUN (clear_ip_bgp_as_soft,
6922 clear_ip_bgp_as_soft_cmd,
320da874 6923 "clear ip bgp " CMD_AS_RANGE " soft",
718e3744 6924 CLEAR_STR
6925 IP_STR
6926 BGP_STR
6927 "Clear peers with the AS number\n"
6928 "Soft reconfig\n")
6929{
6930 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_as,
6931 BGP_CLEAR_SOFT_BOTH, argv[0]);
6932}
6933
6934DEFUN (clear_ip_bgp_as_ipv4_soft,
6935 clear_ip_bgp_as_ipv4_soft_cmd,
320da874 6936 "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft",
718e3744 6937 CLEAR_STR
6938 IP_STR
6939 BGP_STR
6940 "Clear peers with the AS number\n"
6941 "Address family\n"
6942 "Address Family Modifier\n"
6943 "Address Family Modifier\n"
6944 "Soft reconfig\n")
6945{
6946 if (strncmp (argv[1], "m", 1) == 0)
6947 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_as,
6948 BGP_CLEAR_SOFT_BOTH, argv[0]);
6949
6950 return bgp_clear_vty (vty, NULL,AFI_IP, SAFI_UNICAST, clear_as,
6951 BGP_CLEAR_SOFT_BOTH, argv[0]);
6952}
6953
6954DEFUN (clear_ip_bgp_as_vpnv4_soft,
6955 clear_ip_bgp_as_vpnv4_soft_cmd,
320da874 6956 "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft",
718e3744 6957 CLEAR_STR
6958 IP_STR
6959 BGP_STR
6960 "Clear peers with the AS number\n"
6961 "Address family\n"
6962 "Address Family Modifier\n"
6963 "Soft reconfig\n")
6964{
6965 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, clear_as,
6966 BGP_CLEAR_SOFT_BOTH, argv[0]);
6967}
6968
6969DEFUN (clear_bgp_as_soft,
6970 clear_bgp_as_soft_cmd,
320da874 6971 "clear bgp " CMD_AS_RANGE " soft",
718e3744 6972 CLEAR_STR
6973 BGP_STR
6974 "Clear peers with the AS number\n"
6975 "Soft reconfig\n")
6976{
6977 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_as,
6978 BGP_CLEAR_SOFT_BOTH, argv[0]);
6979}
6980
6981ALIAS (clear_bgp_as_soft,
6982 clear_bgp_ipv6_as_soft_cmd,
320da874 6983 "clear bgp ipv6 " CMD_AS_RANGE " soft",
718e3744 6984 CLEAR_STR
6985 BGP_STR
6986 "Address family\n"
6987 "Clear peers with the AS number\n"
6988 "Soft reconfig\n")
6b0655a2 6989
fee0f4c6 6990/* RS-client soft reconfiguration. */
6991#ifdef HAVE_IPV6
6992DEFUN (clear_bgp_all_rsclient,
6993 clear_bgp_all_rsclient_cmd,
6994 "clear bgp * rsclient",
6995 CLEAR_STR
6996 BGP_STR
6997 "Clear all peers\n"
6998 "Soft reconfig for rsclient RIB\n")
6999{
7000 if (argc == 1)
7001 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_all,
7002 BGP_CLEAR_SOFT_RSCLIENT, NULL);
7003
7004 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_all,
7005 BGP_CLEAR_SOFT_RSCLIENT, NULL);
7006}
7007
7008ALIAS (clear_bgp_all_rsclient,
7009 clear_bgp_ipv6_all_rsclient_cmd,
7010 "clear bgp ipv6 * rsclient",
7011 CLEAR_STR
7012 BGP_STR
7013 "Address family\n"
7014 "Clear all peers\n"
7015 "Soft reconfig for rsclient RIB\n")
7016
7017ALIAS (clear_bgp_all_rsclient,
7018 clear_bgp_instance_all_rsclient_cmd,
7019 "clear bgp view WORD * rsclient",
7020 CLEAR_STR
7021 BGP_STR
7022 "BGP view\n"
7023 "view name\n"
7024 "Clear all peers\n"
7025 "Soft reconfig for rsclient RIB\n")
7026
7027ALIAS (clear_bgp_all_rsclient,
7028 clear_bgp_ipv6_instance_all_rsclient_cmd,
7029 "clear bgp ipv6 view WORD * rsclient",
7030 CLEAR_STR
7031 BGP_STR
7032 "Address family\n"
7033 "BGP view\n"
7034 "view name\n"
7035 "Clear all peers\n"
7036 "Soft reconfig for rsclient RIB\n")
7037#endif /* HAVE_IPV6 */
7038
7039DEFUN (clear_ip_bgp_all_rsclient,
7040 clear_ip_bgp_all_rsclient_cmd,
7041 "clear ip bgp * rsclient",
7042 CLEAR_STR
7043 IP_STR
7044 BGP_STR
7045 "Clear all peers\n"
7046 "Soft reconfig for rsclient RIB\n")
7047{
7048 if (argc == 1)
7049 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_all,
7050 BGP_CLEAR_SOFT_RSCLIENT, NULL);
7051
7052 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all,
7053 BGP_CLEAR_SOFT_RSCLIENT, NULL);
7054}
7055
7056ALIAS (clear_ip_bgp_all_rsclient,
7057 clear_ip_bgp_instance_all_rsclient_cmd,
7058 "clear ip bgp view WORD * rsclient",
7059 CLEAR_STR
7060 IP_STR
7061 BGP_STR
7062 "BGP view\n"
7063 "view name\n"
7064 "Clear all peers\n"
7065 "Soft reconfig for rsclient RIB\n")
7066
7067#ifdef HAVE_IPV6
7068DEFUN (clear_bgp_peer_rsclient,
7069 clear_bgp_peer_rsclient_cmd,
a80beece 7070 "clear bgp (A.B.C.D|X:X::X:X|WORD) rsclient",
fee0f4c6 7071 CLEAR_STR
7072 BGP_STR
7073 "BGP neighbor IP address to clear\n"
7074 "BGP IPv6 neighbor to clear\n"
a80beece 7075 "BGP neighbor on interface to clear\n"
fee0f4c6 7076 "Soft reconfig for rsclient RIB\n")
7077{
7078 if (argc == 2)
7079 return bgp_clear_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, clear_peer,
7080 BGP_CLEAR_SOFT_RSCLIENT, argv[1]);
7081
7082 return bgp_clear_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, clear_peer,
7083 BGP_CLEAR_SOFT_RSCLIENT, argv[0]);
7084}
7085
7086ALIAS (clear_bgp_peer_rsclient,
7087 clear_bgp_ipv6_peer_rsclient_cmd,
a80beece 7088 "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) rsclient",
fee0f4c6 7089 CLEAR_STR
7090 BGP_STR
7091 "Address family\n"
7092 "BGP neighbor IP address to clear\n"
7093 "BGP IPv6 neighbor to clear\n"
a80beece 7094 "BGP neighbor on interface to clear\n"
fee0f4c6 7095 "Soft reconfig for rsclient RIB\n")
7096
7097ALIAS (clear_bgp_peer_rsclient,
7098 clear_bgp_instance_peer_rsclient_cmd,
a80beece 7099 "clear bgp view WORD (A.B.C.D|X:X::X:X|WORD) rsclient",
fee0f4c6 7100 CLEAR_STR
7101 BGP_STR
7102 "BGP view\n"
7103 "view name\n"
7104 "BGP neighbor IP address to clear\n"
7105 "BGP IPv6 neighbor to clear\n"
a80beece 7106 "BGP neighbor on interface to clear\n"
fee0f4c6 7107 "Soft reconfig for rsclient RIB\n")
7108
7109ALIAS (clear_bgp_peer_rsclient,
7110 clear_bgp_ipv6_instance_peer_rsclient_cmd,
a80beece 7111 "clear bgp ipv6 view WORD (A.B.C.D|X:X::X:X|WORD) rsclient",
fee0f4c6 7112 CLEAR_STR
7113 BGP_STR
7114 "Address family\n"
7115 "BGP view\n"
7116 "view name\n"
7117 "BGP neighbor IP address to clear\n"
7118 "BGP IPv6 neighbor to clear\n"
a80beece 7119 "BGP neighbor on interface to clear\n"
fee0f4c6 7120 "Soft reconfig for rsclient RIB\n")
7121#endif /* HAVE_IPV6 */
7122
7123DEFUN (clear_ip_bgp_peer_rsclient,
7124 clear_ip_bgp_peer_rsclient_cmd,
a80beece 7125 "clear ip bgp (A.B.C.D|X:X::X:X|WORD) rsclient",
fee0f4c6 7126 CLEAR_STR
7127 IP_STR
7128 BGP_STR
7129 "BGP neighbor IP address to clear\n"
7130 "BGP IPv6 neighbor to clear\n"
a80beece 7131 "BGP neighbor on interface to clear\n"
fee0f4c6 7132 "Soft reconfig for rsclient RIB\n")
7133{
7134 if (argc == 2)
7135 return bgp_clear_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, clear_peer,
7136 BGP_CLEAR_SOFT_RSCLIENT, argv[1]);
7137
7138 return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_peer,
7139 BGP_CLEAR_SOFT_RSCLIENT, argv[0]);
7140}
7141
7142ALIAS (clear_ip_bgp_peer_rsclient,
7143 clear_ip_bgp_instance_peer_rsclient_cmd,
a80beece 7144 "clear ip bgp view WORD (A.B.C.D|X:X::X:X|WORD) rsclient",
fee0f4c6 7145 CLEAR_STR
7146 IP_STR
7147 BGP_STR
7148 "BGP view\n"
7149 "view name\n"
7150 "BGP neighbor IP address to clear\n"
7151 "BGP IPv6 neighbor to clear\n"
a80beece 7152 "BGP neighbor on interface to clear\n"
fee0f4c6 7153 "Soft reconfig for rsclient RIB\n")
7154
e0081f70
ML
7155DEFUN (show_bgp_views,
7156 show_bgp_views_cmd,
7157 "show bgp views",
7158 SHOW_STR
7159 BGP_STR
7160 "Show the defined BGP views\n")
7161{
7162 struct list *inst = bm->bgp;
7163 struct listnode *node;
7164 struct bgp *bgp;
7165
7166 if (!bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE))
7167 {
7168 vty_out (vty, "Multiple BGP views are not defined%s", VTY_NEWLINE);
7169 return CMD_WARNING;
7170 }
7171
7172 vty_out (vty, "Defined BGP views:%s", VTY_NEWLINE);
7173 for (ALL_LIST_ELEMENTS_RO(inst, node, bgp))
7174 vty_out (vty, "\t%s (AS%u)%s",
7175 bgp->name ? bgp->name : "(null)",
7176 bgp->as, VTY_NEWLINE);
7177
7178 return CMD_SUCCESS;
7179}
7180
4bf6a362
PJ
7181DEFUN (show_bgp_memory,
7182 show_bgp_memory_cmd,
7183 "show bgp memory",
7184 SHOW_STR
7185 BGP_STR
7186 "Global BGP memory statistics\n")
7187{
7188 char memstrbuf[MTYPE_MEMSTR_LEN];
7189 unsigned long count;
7190
7191 /* RIB related usage stats */
7192 count = mtype_stats_alloc (MTYPE_BGP_NODE);
7193 vty_out (vty, "%ld RIB nodes, using %s of memory%s", count,
7194 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7195 count * sizeof (struct bgp_node)),
7196 VTY_NEWLINE);
7197
7198 count = mtype_stats_alloc (MTYPE_BGP_ROUTE);
7199 vty_out (vty, "%ld BGP routes, using %s of memory%s", count,
7200 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7201 count * sizeof (struct bgp_info)),
7202 VTY_NEWLINE);
fb982c25
PJ
7203 if ((count = mtype_stats_alloc (MTYPE_BGP_ROUTE_EXTRA)))
7204 vty_out (vty, "%ld BGP route ancillaries, using %s of memory%s", count,
7205 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7206 count * sizeof (struct bgp_info_extra)),
7207 VTY_NEWLINE);
4bf6a362
PJ
7208
7209 if ((count = mtype_stats_alloc (MTYPE_BGP_STATIC)))
7210 vty_out (vty, "%ld Static routes, using %s of memory%s", count,
7211 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7212 count * sizeof (struct bgp_static)),
7213 VTY_NEWLINE);
7214
7215 /* Adj-In/Out */
7216 if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_IN)))
7217 vty_out (vty, "%ld Adj-In entries, using %s of memory%s", count,
7218 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7219 count * sizeof (struct bgp_adj_in)),
7220 VTY_NEWLINE);
7221 if ((count = mtype_stats_alloc (MTYPE_BGP_ADJ_OUT)))
7222 vty_out (vty, "%ld Adj-Out entries, using %s of memory%s", count,
7223 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7224 count * sizeof (struct bgp_adj_out)),
7225 VTY_NEWLINE);
7226
7227 if ((count = mtype_stats_alloc (MTYPE_BGP_NEXTHOP_CACHE)))
7228 vty_out (vty, "%ld Nexthop cache entries, using %s of memory%s", count,
7229 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7230 count * sizeof (struct bgp_nexthop_cache)),
7231 VTY_NEWLINE);
7232
7233 if ((count = mtype_stats_alloc (MTYPE_BGP_DAMP_INFO)))
7234 vty_out (vty, "%ld Dampening entries, using %s of memory%s", count,
7235 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7236 count * sizeof (struct bgp_damp_info)),
7237 VTY_NEWLINE);
7238
7239 /* Attributes */
7240 count = attr_count();
7241 vty_out (vty, "%ld BGP attributes, using %s of memory%s", count,
7242 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7243 count * sizeof(struct attr)),
7244 VTY_NEWLINE);
fb982c25
PJ
7245 if ((count = mtype_stats_alloc (MTYPE_ATTR_EXTRA)))
7246 vty_out (vty, "%ld BGP extra attributes, using %s of memory%s", count,
7247 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7248 count * sizeof(struct attr_extra)),
7249 VTY_NEWLINE);
4bf6a362
PJ
7250
7251 if ((count = attr_unknown_count()))
7252 vty_out (vty, "%ld unknown attributes%s", count, VTY_NEWLINE);
7253
7254 /* AS_PATH attributes */
7255 count = aspath_count ();
7256 vty_out (vty, "%ld BGP AS-PATH entries, using %s of memory%s", count,
7257 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7258 count * sizeof (struct aspath)),
7259 VTY_NEWLINE);
7260
7261 count = mtype_stats_alloc (MTYPE_AS_SEG);
7262 vty_out (vty, "%ld BGP AS-PATH segments, using %s of memory%s", count,
7263 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7264 count * sizeof (struct assegment)),
7265 VTY_NEWLINE);
7266
7267 /* Other attributes */
7268 if ((count = community_count ()))
7269 vty_out (vty, "%ld BGP community entries, using %s of memory%s", count,
7270 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7271 count * sizeof (struct community)),
7272 VTY_NEWLINE);
7273 if ((count = mtype_stats_alloc (MTYPE_ECOMMUNITY)))
7274 vty_out (vty, "%ld BGP community entries, using %s of memory%s", count,
7275 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7276 count * sizeof (struct ecommunity)),
7277 VTY_NEWLINE);
7278
7279 if ((count = mtype_stats_alloc (MTYPE_CLUSTER)))
7280 vty_out (vty, "%ld Cluster lists, using %s of memory%s", count,
7281 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7282 count * sizeof (struct cluster_list)),
7283 VTY_NEWLINE);
7284
7285 /* Peer related usage */
7286 count = mtype_stats_alloc (MTYPE_BGP_PEER);
7287 vty_out (vty, "%ld peers, using %s of memory%s", count,
7288 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7289 count * sizeof (struct peer)),
7290 VTY_NEWLINE);
7291
7292 if ((count = mtype_stats_alloc (MTYPE_PEER_GROUP)))
7293 vty_out (vty, "%ld peer groups, using %s of memory%s", count,
7294 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7295 count * sizeof (struct peer_group)),
7296 VTY_NEWLINE);
7297
7298 /* Other */
7299 if ((count = mtype_stats_alloc (MTYPE_HASH)))
7300 vty_out (vty, "%ld hash tables, using %s of memory%s", count,
7301 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7302 count * sizeof (struct hash)),
7303 VTY_NEWLINE);
7304 if ((count = mtype_stats_alloc (MTYPE_HASH_BACKET)))
7305 vty_out (vty, "%ld hash buckets, using %s of memory%s", count,
7306 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7307 count * sizeof (struct hash_backet)),
7308 VTY_NEWLINE);
7309 if ((count = mtype_stats_alloc (MTYPE_BGP_REGEXP)))
7310 vty_out (vty, "%ld compiled regexes, using %s of memory%s", count,
7311 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7312 count * sizeof (regex_t)),
7313 VTY_NEWLINE);
7314 return CMD_SUCCESS;
7315}
fee0f4c6 7316
47fc97cc
DS
7317static int
7318bgp_adj_out_count (struct peer *peer, int afi, int safi)
7319{
7320 struct bgp_table *table;
7321 struct bgp_node *rn;
7322 struct bgp_adj_out *adj;
7323 int count = 0;
7324
7325 if (!peer) return(0);
7326
7327 table = peer->bgp->rib[afi][safi];
7328 if (!table) return(0);
7329 for (rn = bgp_table_top(table); rn; rn = bgp_route_next(rn))
7330 if (bgp_adj_out_lookup(peer, NULL, afi, safi, rn))
7331 count++;
7332 return (count);
7333}
7334
718e3744 7335/* Show BGP peer's summary information. */
94f2b392 7336static int
47fc97cc 7337bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi, char *delimit)
718e3744 7338{
7339 struct peer *peer;
1eb8ef25 7340 struct listnode *node, *nnode;
4bf6a362 7341 unsigned int count = 0;
718e3744 7342 char timebuf[BGP_UPTIME_LEN];
7343 int len;
7344
7345 /* Header string for each address family. */
7346 static char header[] = "Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd";
47fc97cc
DS
7347 static char header_csv[] = "Neighbor, V, AS, MsgRcvd, MsgSent, TblVer, InQ, OutQ, Up/Down, State/PfxRcd, PfxAdv";
7348
1eb8ef25 7349 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
718e3744 7350 {
1ff9a340
DS
7351 if (!CHECK_FLAG(peer->flags, PEER_FLAG_CONFIG_NODE))
7352 continue;
7353
718e3744 7354 if (peer->afc[afi][safi])
7355 {
47fc97cc
DS
7356 if (delimit)
7357 {
7358 if (!count)
7359 {
7360 vty_out (vty, "%s%s", header_csv, VTY_NEWLINE);
7361 }
7362 }
7363 else if (!count)
4bf6a362
PJ
7364 {
7365 unsigned long ents;
7366 char memstrbuf[MTYPE_MEMSTR_LEN];
7367
7368 /* Usage summary and header */
7369 vty_out (vty,
aea339f7 7370 "BGP router identifier %s, local AS number %u%s",
4bf6a362 7371 inet_ntoa (bgp->router_id), bgp->as, VTY_NEWLINE);
f188f2c4
DS
7372 if (bgp_update_delay_configured(bgp))
7373 {
7374 vty_out (vty, "Read-only mode update-delay limit: %d seconds%s",
7375 bgp->v_update_delay, VTY_NEWLINE);
7376 if (bgp->v_update_delay != bgp->v_establish_wait)
7377 vty_out (vty, " Establish wait: %d seconds%s",
7378 bgp->v_establish_wait, VTY_NEWLINE);
7379 if (bgp_update_delay_active(bgp))
7380 {
7381 vty_out (vty, " First neighbor established: %s%s",
7382 bgp->update_delay_begin_time, VTY_NEWLINE);
7383 vty_out (vty, " Delay in progress%s", VTY_NEWLINE);
7384 }
7385 else
7386 {
7387 if (bgp->update_delay_over)
7388 {
7389 vty_out (vty, " First neighbor established: %s%s",
7390 bgp->update_delay_begin_time, VTY_NEWLINE);
4a16ae86 7391 vty_out (vty, " Best-paths resumed: %s%s",
f188f2c4 7392 bgp->update_delay_end_time, VTY_NEWLINE);
4a16ae86
DS
7393 vty_out (vty, " zebra update resumed: %s%s",
7394 bgp->update_delay_zebra_resume_time, VTY_NEWLINE);
7395 vty_out (vty, " peers update resumed: %s%s",
7396 bgp->update_delay_peers_resume_time, VTY_NEWLINE);
f188f2c4
DS
7397 }
7398 }
7399 }
4bf6a362
PJ
7400
7401 ents = bgp_table_count (bgp->rib[afi][safi]);
7402 vty_out (vty, "RIB entries %ld, using %s of memory%s", ents,
7403 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7404 ents * sizeof (struct bgp_node)),
7405 VTY_NEWLINE);
7406
7407 /* Peer related usage */
7408 ents = listcount (bgp->peer);
7409 vty_out (vty, "Peers %ld, using %s of memory%s",
7410 ents,
7411 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7412 ents * sizeof (struct peer)),
7413 VTY_NEWLINE);
7414
7415 if ((ents = listcount (bgp->rsclient)))
7416 vty_out (vty, "RS-Client peers %ld, using %s of memory%s",
7417 ents,
7418 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7419 ents * sizeof (struct peer)),
7420 VTY_NEWLINE);
7421
7422 if ((ents = listcount (bgp->group)))
7423 vty_out (vty, "Peer groups %ld, using %s of memory%s", ents,
7424 mtype_memstr (memstrbuf, sizeof (memstrbuf),
7425 ents * sizeof (struct peer_group)),
7426 VTY_NEWLINE);
7427
7428 if (CHECK_FLAG (bgp->af_flags[afi][safi], BGP_CONFIG_DAMPENING))
7429 vty_out (vty, "Dampening enabled.%s", VTY_NEWLINE);
7430 vty_out (vty, "%s", VTY_NEWLINE);
7431 vty_out (vty, "%s%s", header, VTY_NEWLINE);
7432 }
7433
718e3744 7434 count++;
7435
7436 len = vty_out (vty, "%s", peer->host);
7437 len = 16 - len;
7438 if (len < 1)
7439 vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " ");
7440 else
7441 vty_out (vty, "%*s", len, " ");
7442
47fc97cc
DS
7443 if (delimit)
7444 vty_out(vty, "%c", *delimit);
718e3744 7445
47fc97cc 7446 vty_out (vty, "4 ");
718e3744 7447
47fc97cc
DS
7448 if (delimit)
7449 vty_out(vty, "%c", *delimit);
7450
7451 if (!delimit)
cdabb8b6 7452 vty_out (vty, "%5u %7d %7d %8d %4d %4lu ",
47fc97cc
DS
7453 peer->as,
7454 peer->open_in + peer->update_in + peer->keepalive_in
7455 + peer->notify_in + peer->refresh_in
7456 + peer->dynamic_cap_in,
7457 peer->open_out + peer->update_out + peer->keepalive_out
7458 + peer->notify_out + peer->refresh_out
7459 + peer->dynamic_cap_out,
7460 0,
7461 0,
cdabb8b6
DS
7462 peer->sync[afi][safi]->update.count +
7463 peer->sync[afi][safi]->withdraw.count);
47fc97cc
DS
7464 else
7465 vty_out (vty, "%5u %c %7d %c %7d %c %8d %c %4d %c %4lu %c",
7466 peer->as, *delimit,
7467 peer->open_in + peer->update_in + peer->keepalive_in
7468 + peer->notify_in + peer->refresh_in
7469 + peer->dynamic_cap_in, *delimit,
7470 peer->open_out + peer->update_out + peer->keepalive_out
7471 + peer->notify_out + peer->refresh_out
7472 + peer->dynamic_cap_out, *delimit,
7473 0, *delimit,
7474 0, *delimit,
cdabb8b6
DS
7475 peer->sync[afi][safi]->update.count +
7476 peer->sync[afi][safi]->withdraw.count, *delimit);
47fc97cc
DS
7477
7478 vty_out (vty, "%8s",
718e3744 7479 peer_uptime (peer->uptime, timebuf, BGP_UPTIME_LEN));
47fc97cc
DS
7480 if (delimit)
7481 vty_out(vty, "%c", *delimit);
718e3744 7482
7483 if (peer->status == Established)
718e3744 7484 vty_out (vty, " %8ld", peer->pcount[afi][safi]);
718e3744 7485 else
7486 {
7487 if (CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN))
7488 vty_out (vty, " Idle (Admin)");
7489 else if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW))
7490 vty_out (vty, " Idle (PfxCt)");
7491 else
7492 vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, peer->status));
7493 }
47fc97cc
DS
7494 if (delimit)
7495 vty_out(vty, ", %d", bgp_adj_out_count(peer, afi, safi));
718e3744 7496
7497 vty_out (vty, "%s", VTY_NEWLINE);
7498 }
7499 }
7500
7501 if (count)
7502 vty_out (vty, "%sTotal number of neighbors %d%s", VTY_NEWLINE,
7503 count, VTY_NEWLINE);
7504 else
7505 vty_out (vty, "No %s neighbor is configured%s",
7506 afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE);
f188f2c4 7507
718e3744 7508 return CMD_SUCCESS;
7509}
7510
47fc97cc
DS
7511static int
7512bgp_show_summary_vty (struct vty *vty, const char *name,
7513 afi_t afi, safi_t safi, char *delimit)
718e3744 7514{
7515 struct bgp *bgp;
7516
7517 if (name)
7518 {
7519 bgp = bgp_lookup_by_name (name);
47fc97cc 7520
718e3744 7521 if (! bgp)
7522 {
47fc97cc 7523 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
718e3744 7524 return CMD_WARNING;
7525 }
7526
47fc97cc 7527 bgp_show_summary (vty, bgp, afi, safi, delimit);
718e3744 7528 return CMD_SUCCESS;
7529 }
47fc97cc 7530
718e3744 7531 bgp = bgp_get_default ();
7532
7533 if (bgp)
47fc97cc
DS
7534 bgp_show_summary (vty, bgp, afi, safi, delimit);
7535
718e3744 7536 return CMD_SUCCESS;
7537}
7538
7539/* `show ip bgp summary' commands. */
47fc97cc 7540DEFUN (show_ip_bgp_summary,
718e3744 7541 show_ip_bgp_summary_cmd,
7542 "show ip bgp summary",
7543 SHOW_STR
7544 IP_STR
7545 BGP_STR
7546 "Summary of BGP neighbor status\n")
7547{
47fc97cc
DS
7548 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST, NULL);
7549}
7550
7551DEFUN (show_ip_bgp_summary_csv,
7552 show_ip_bgp_summary_csv_cmd,
7553 "show ip bgp summary csv",
7554 SHOW_STR
7555 IP_STR
7556 BGP_STR
7557 "Summary of BGP neighbor status\n")
7558{
7559 char csv = ',';
7560 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST, &csv);
718e3744 7561}
7562
7563DEFUN (show_ip_bgp_instance_summary,
7564 show_ip_bgp_instance_summary_cmd,
7565 "show ip bgp view WORD summary",
7566 SHOW_STR
7567 IP_STR
7568 BGP_STR
7569 "BGP view\n"
7570 "View name\n"
7571 "Summary of BGP neighbor status\n")
7572{
47fc97cc 7573 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, NULL);
718e3744 7574}
7575
7576DEFUN (show_ip_bgp_ipv4_summary,
7577 show_ip_bgp_ipv4_summary_cmd,
7578 "show ip bgp ipv4 (unicast|multicast) summary",
7579 SHOW_STR
7580 IP_STR
7581 BGP_STR
7582 "Address family\n"
7583 "Address Family modifier\n"
7584 "Address Family modifier\n"
7585 "Summary of BGP neighbor status\n")
7586{
7587 if (strncmp (argv[0], "m", 1) == 0)
47fc97cc 7588 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, NULL);
718e3744 7589
47fc97cc 7590 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST, NULL);
718e3744 7591}
7592
95cbbd2a
ML
7593ALIAS (show_ip_bgp_ipv4_summary,
7594 show_bgp_ipv4_safi_summary_cmd,
7595 "show bgp ipv4 (unicast|multicast) summary",
7596 SHOW_STR
7597 BGP_STR
7598 "Address family\n"
7599 "Address Family modifier\n"
7600 "Address Family modifier\n"
7601 "Summary of BGP neighbor status\n")
7602
718e3744 7603DEFUN (show_ip_bgp_instance_ipv4_summary,
7604 show_ip_bgp_instance_ipv4_summary_cmd,
7605 "show ip bgp view WORD ipv4 (unicast|multicast) summary",
7606 SHOW_STR
7607 IP_STR
7608 BGP_STR
7609 "BGP view\n"
7610 "View name\n"
7611 "Address family\n"
7612 "Address Family modifier\n"
7613 "Address Family modifier\n"
7614 "Summary of BGP neighbor status\n")
7615{
7616 if (strncmp (argv[1], "m", 1) == 0)
47fc97cc 7617 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST, NULL);
718e3744 7618 else
47fc97cc 7619 return bgp_show_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST, NULL);
718e3744 7620}
7621
95cbbd2a
ML
7622ALIAS (show_ip_bgp_instance_ipv4_summary,
7623 show_bgp_instance_ipv4_safi_summary_cmd,
7624 "show bgp view WORD ipv4 (unicast|multicast) summary",
7625 SHOW_STR
7626 BGP_STR
7627 "BGP view\n"
7628 "View name\n"
7629 "Address family\n"
7630 "Address Family modifier\n"
7631 "Address Family modifier\n"
7632 "Summary of BGP neighbor status\n")
7633
718e3744 7634DEFUN (show_ip_bgp_vpnv4_all_summary,
7635 show_ip_bgp_vpnv4_all_summary_cmd,
7636 "show ip bgp vpnv4 all summary",
7637 SHOW_STR
7638 IP_STR
7639 BGP_STR
7640 "Display VPNv4 NLRI specific information\n"
7641 "Display information about all VPNv4 NLRIs\n"
7642 "Summary of BGP neighbor status\n")
7643{
47fc97cc 7644 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, NULL);
718e3744 7645}
7646
7647DEFUN (show_ip_bgp_vpnv4_rd_summary,
7648 show_ip_bgp_vpnv4_rd_summary_cmd,
7649 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn summary",
7650 SHOW_STR
7651 IP_STR
7652 BGP_STR
7653 "Display VPNv4 NLRI specific information\n"
7654 "Display information for a route distinguisher\n"
7655 "VPN Route Distinguisher\n"
7656 "Summary of BGP neighbor status\n")
7657{
7658 int ret;
7659 struct prefix_rd prd;
7660
7661 ret = str2prefix_rd (argv[0], &prd);
7662 if (! ret)
7663 {
7664 vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
7665 return CMD_WARNING;
7666 }
7667
47fc97cc 7668 return bgp_show_summary_vty (vty, NULL, AFI_IP, SAFI_MPLS_VPN, NULL);
718e3744 7669}
7670
7671#ifdef HAVE_IPV6
47fc97cc 7672DEFUN (show_bgp_summary,
718e3744 7673 show_bgp_summary_cmd,
7674 "show bgp summary",
7675 SHOW_STR
7676 BGP_STR
7677 "Summary of BGP neighbor status\n")
7678{
47fc97cc
DS
7679 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, NULL);
7680}
7681
7682DEFUN (show_bgp_summary_csv,
7683 show_bgp_summary_csv_cmd,
7684 "show bgp summary csv",
7685 SHOW_STR
7686 BGP_STR
7687 "Summary of BGP neighbor status\n")
7688{
7689 char csv = ',';
7690 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, &csv);
718e3744 7691}
7692
7693DEFUN (show_bgp_instance_summary,
7694 show_bgp_instance_summary_cmd,
7695 "show bgp view WORD summary",
7696 SHOW_STR
7697 BGP_STR
7698 "BGP view\n"
7699 "View name\n"
7700 "Summary of BGP neighbor status\n")
7701{
47fc97cc 7702 return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, NULL);
718e3744 7703}
7704
7705ALIAS (show_bgp_summary,
7706 show_bgp_ipv6_summary_cmd,
7707 "show bgp ipv6 summary",
7708 SHOW_STR
7709 BGP_STR
7710 "Address family\n"
7711 "Summary of BGP neighbor status\n")
7712
7713ALIAS (show_bgp_instance_summary,
7714 show_bgp_instance_ipv6_summary_cmd,
7715 "show bgp view WORD ipv6 summary",
7716 SHOW_STR
7717 BGP_STR
7718 "BGP view\n"
7719 "View name\n"
7720 "Address family\n"
7721 "Summary of BGP neighbor status\n")
7722
95cbbd2a
ML
7723DEFUN (show_bgp_ipv6_safi_summary,
7724 show_bgp_ipv6_safi_summary_cmd,
7725 "show bgp ipv6 (unicast|multicast) summary",
7726 SHOW_STR
7727 BGP_STR
7728 "Address family\n"
7729 "Address Family modifier\n"
7730 "Address Family modifier\n"
7731 "Summary of BGP neighbor status\n")
7732{
7733 if (strncmp (argv[0], "m", 1) == 0)
47fc97cc 7734 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST, NULL);
95cbbd2a 7735
47fc97cc 7736 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, NULL);
95cbbd2a
ML
7737}
7738
7739DEFUN (show_bgp_instance_ipv6_safi_summary,
7740 show_bgp_instance_ipv6_safi_summary_cmd,
7741 "show bgp view WORD ipv6 (unicast|multicast) summary",
7742 SHOW_STR
7743 BGP_STR
7744 "BGP view\n"
7745 "View name\n"
7746 "Address family\n"
7747 "Address Family modifier\n"
7748 "Address Family modifier\n"
7749 "Summary of BGP neighbor status\n")
7750{
7751 if (strncmp (argv[1], "m", 1) == 0)
47fc97cc 7752 return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_MULTICAST, NULL);
95cbbd2a 7753
47fc97cc 7754 return bgp_show_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST, NULL);
95cbbd2a
ML
7755}
7756
718e3744 7757/* old command */
7758DEFUN (show_ipv6_bgp_summary,
7759 show_ipv6_bgp_summary_cmd,
7760 "show ipv6 bgp summary",
7761 SHOW_STR
7762 IPV6_STR
7763 BGP_STR
7764 "Summary of BGP neighbor status\n")
7765{
47fc97cc 7766 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST, NULL);
718e3744 7767}
7768
7769/* old command */
7770DEFUN (show_ipv6_mbgp_summary,
7771 show_ipv6_mbgp_summary_cmd,
7772 "show ipv6 mbgp summary",
7773 SHOW_STR
7774 IPV6_STR
7775 MBGP_STR
7776 "Summary of BGP neighbor status\n")
7777{
47fc97cc 7778 return bgp_show_summary_vty (vty, NULL, AFI_IP6, SAFI_MULTICAST, NULL);
718e3744 7779}
7780#endif /* HAVE_IPV6 */
6b0655a2 7781
fd79ac91 7782const char *
538621f2 7783afi_safi_print (afi_t afi, safi_t safi)
7784{
7785 if (afi == AFI_IP && safi == SAFI_UNICAST)
7786 return "IPv4 Unicast";
7787 else if (afi == AFI_IP && safi == SAFI_MULTICAST)
7788 return "IPv4 Multicast";
7789 else if (afi == AFI_IP && safi == SAFI_MPLS_VPN)
7790 return "VPNv4 Unicast";
7791 else if (afi == AFI_IP6 && safi == SAFI_UNICAST)
7792 return "IPv6 Unicast";
7793 else if (afi == AFI_IP6 && safi == SAFI_MULTICAST)
7794 return "IPv6 Multicast";
7795 else
7796 return "Unknown";
7797}
7798
718e3744 7799/* Show BGP peer's information. */
7800enum show_type
7801{
7802 show_all,
7803 show_peer
7804};
7805
94f2b392 7806static void
718e3744 7807bgp_show_peer_afi_orf_cap (struct vty *vty, struct peer *p,
7808 afi_t afi, safi_t safi,
7809 u_int16_t adv_smcap, u_int16_t adv_rmcap,
7810 u_int16_t rcv_smcap, u_int16_t rcv_rmcap)
7811{
7812 /* Send-Mode */
7813 if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap)
7814 || CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap))
7815 {
7816 vty_out (vty, " Send-mode: ");
7817 if (CHECK_FLAG (p->af_cap[afi][safi], adv_smcap))
7818 vty_out (vty, "advertised");
7819 if (CHECK_FLAG (p->af_cap[afi][safi], rcv_smcap))
7820 vty_out (vty, "%sreceived",
7821 CHECK_FLAG (p->af_cap[afi][safi], adv_smcap) ?
7822 ", " : "");
7823 vty_out (vty, "%s", VTY_NEWLINE);
7824 }
7825
7826 /* Receive-Mode */
7827 if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap)
7828 || CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap))
7829 {
7830 vty_out (vty, " Receive-mode: ");
7831 if (CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap))
7832 vty_out (vty, "advertised");
7833 if (CHECK_FLAG (p->af_cap[afi][safi], rcv_rmcap))
7834 vty_out (vty, "%sreceived",
7835 CHECK_FLAG (p->af_cap[afi][safi], adv_rmcap) ?
7836 ", " : "");
7837 vty_out (vty, "%s", VTY_NEWLINE);
7838 }
7839}
7840
94f2b392 7841static void
718e3744 7842bgp_show_peer_afi (struct vty *vty, struct peer *p, afi_t afi, safi_t safi)
7843{
7844 struct bgp_filter *filter;
7845 char orf_pfx_name[BUFSIZ];
7846 int orf_pfx_count;
7847
7848 filter = &p->filter[afi][safi];
7849
538621f2 7850 vty_out (vty, " For address family: %s%s", afi_safi_print (afi, safi),
718e3744 7851 VTY_NEWLINE);
538621f2 7852
718e3744 7853 if (p->af_group[afi][safi])
7854 vty_out (vty, " %s peer-group member%s", p->group->name, VTY_NEWLINE);
7855
7856 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
7857 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
7858 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)
7859 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
7860 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV)
7861 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
7862 vty_out (vty, " AF-dependant capabilities:%s", VTY_NEWLINE);
7863
7864 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
7865 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_RCV)
7866 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
7867 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_RCV))
7868 {
7869 vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
7870 ORF_TYPE_PREFIX, VTY_NEWLINE);
7871 bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
7872 PEER_CAP_ORF_PREFIX_SM_ADV,
7873 PEER_CAP_ORF_PREFIX_RM_ADV,
7874 PEER_CAP_ORF_PREFIX_SM_RCV,
7875 PEER_CAP_ORF_PREFIX_RM_RCV);
7876 }
7877 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_ADV)
7878 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_SM_OLD_RCV)
7879 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_ADV)
7880 || CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_ORF_PREFIX_RM_OLD_RCV))
7881 {
7882 vty_out (vty, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
7883 ORF_TYPE_PREFIX_OLD, VTY_NEWLINE);
7884 bgp_show_peer_afi_orf_cap (vty, p, afi, safi,
7885 PEER_CAP_ORF_PREFIX_SM_ADV,
7886 PEER_CAP_ORF_PREFIX_RM_ADV,
7887 PEER_CAP_ORF_PREFIX_SM_OLD_RCV,
7888 PEER_CAP_ORF_PREFIX_RM_OLD_RCV);
7889 }
7890
7891 sprintf (orf_pfx_name, "%s.%d.%d", p->host, afi, safi);
7892 orf_pfx_count = prefix_bgp_show_prefix_list (NULL, afi, orf_pfx_name);
7893
7894 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND)
7895 || orf_pfx_count)
7896 {
7897 vty_out (vty, " Outbound Route Filter (ORF):");
7898 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_PREFIX_SEND))
7899 vty_out (vty, " sent;");
7900 if (orf_pfx_count)
7901 vty_out (vty, " received (%d entries)", orf_pfx_count);
7902 vty_out (vty, "%s", VTY_NEWLINE);
7903 }
7904 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_ORF_WAIT_REFRESH))
7905 vty_out (vty, " First update is deferred until ORF or ROUTE-REFRESH is received%s", VTY_NEWLINE);
7906
7907 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REFLECTOR_CLIENT))
7908 vty_out (vty, " Route-Reflector Client%s", VTY_NEWLINE);
7909 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT))
7910 vty_out (vty, " Route-Server Client%s", VTY_NEWLINE);
7911 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SOFT_RECONFIG))
7912 vty_out (vty, " Inbound soft reconfiguration allowed%s", VTY_NEWLINE);
7913 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_REMOVE_PRIVATE_AS))
7914 vty_out (vty, " Private AS number removed from updates to this neighbor%s", VTY_NEWLINE);
7915 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_SELF))
7916 vty_out (vty, " NEXT_HOP is always this router%s", VTY_NEWLINE);
7917 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_AS_PATH_UNCHANGED))
7918 vty_out (vty, " AS_PATH is propagated unchanged to this neighbor%s", VTY_NEWLINE);
7919 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_NEXTHOP_UNCHANGED))
7920 vty_out (vty, " NEXT_HOP is propagated unchanged to this neighbor%s", VTY_NEWLINE);
7921 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MED_UNCHANGED))
7922 vty_out (vty, " MED is propagated unchanged to this neighbor%s", VTY_NEWLINE);
7923 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
7924 || CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
7925 {
7926 vty_out (vty, " Community attribute sent to this neighbor");
7927 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_COMMUNITY)
7928 && CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
538621f2 7929 vty_out (vty, "(both)%s", VTY_NEWLINE);
718e3744 7930 else if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_SEND_EXT_COMMUNITY))
538621f2 7931 vty_out (vty, "(extended)%s", VTY_NEWLINE);
718e3744 7932 else
538621f2 7933 vty_out (vty, "(standard)%s", VTY_NEWLINE);
718e3744 7934 }
7935 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_DEFAULT_ORIGINATE))
7936 {
7937 vty_out (vty, " Default information originate,");
7938
7939 if (p->default_rmap[afi][safi].name)
7940 vty_out (vty, " default route-map %s%s,",
7941 p->default_rmap[afi][safi].map ? "*" : "",
7942 p->default_rmap[afi][safi].name);
7943 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_DEFAULT_ORIGINATE))
7944 vty_out (vty, " default sent%s", VTY_NEWLINE);
7945 else
7946 vty_out (vty, " default not sent%s", VTY_NEWLINE);
7947 }
7948
7949 if (filter->plist[FILTER_IN].name
7950 || filter->dlist[FILTER_IN].name
7951 || filter->aslist[FILTER_IN].name
fee0f4c6 7952 || filter->map[RMAP_IN].name)
718e3744 7953 vty_out (vty, " Inbound path policy configured%s", VTY_NEWLINE);
7954 if (filter->plist[FILTER_OUT].name
7955 || filter->dlist[FILTER_OUT].name
7956 || filter->aslist[FILTER_OUT].name
fee0f4c6 7957 || filter->map[RMAP_OUT].name
718e3744 7958 || filter->usmap.name)
7959 vty_out (vty, " Outbound path policy configured%s", VTY_NEWLINE);
fee0f4c6 7960 if (filter->map[RMAP_IMPORT].name)
7961 vty_out (vty, " Import policy for this RS-client configured%s", VTY_NEWLINE);
7962 if (filter->map[RMAP_EXPORT].name)
7963 vty_out (vty, " Export policy for this RS-client configured%s", VTY_NEWLINE);
718e3744 7964
7965 /* prefix-list */
7966 if (filter->plist[FILTER_IN].name)
7967 vty_out (vty, " Incoming update prefix filter list is %s%s%s",
7968 filter->plist[FILTER_IN].plist ? "*" : "",
7969 filter->plist[FILTER_IN].name,
7970 VTY_NEWLINE);
7971 if (filter->plist[FILTER_OUT].name)
7972 vty_out (vty, " Outgoing update prefix filter list is %s%s%s",
7973 filter->plist[FILTER_OUT].plist ? "*" : "",
7974 filter->plist[FILTER_OUT].name,
7975 VTY_NEWLINE);
7976
7977 /* distribute-list */
7978 if (filter->dlist[FILTER_IN].name)
7979 vty_out (vty, " Incoming update network filter list is %s%s%s",
7980 filter->dlist[FILTER_IN].alist ? "*" : "",
7981 filter->dlist[FILTER_IN].name,
7982 VTY_NEWLINE);
7983 if (filter->dlist[FILTER_OUT].name)
7984 vty_out (vty, " Outgoing update network filter list is %s%s%s",
7985 filter->dlist[FILTER_OUT].alist ? "*" : "",
7986 filter->dlist[FILTER_OUT].name,
7987 VTY_NEWLINE);
7988
7989 /* filter-list. */
7990 if (filter->aslist[FILTER_IN].name)
7991 vty_out (vty, " Incoming update AS path filter list is %s%s%s",
7992 filter->aslist[FILTER_IN].aslist ? "*" : "",
7993 filter->aslist[FILTER_IN].name,
7994 VTY_NEWLINE);
7995 if (filter->aslist[FILTER_OUT].name)
7996 vty_out (vty, " Outgoing update AS path filter list is %s%s%s",
7997 filter->aslist[FILTER_OUT].aslist ? "*" : "",
7998 filter->aslist[FILTER_OUT].name,
7999 VTY_NEWLINE);
8000
8001 /* route-map. */
fee0f4c6 8002 if (filter->map[RMAP_IN].name)
718e3744 8003 vty_out (vty, " Route map for incoming advertisements is %s%s%s",
fee0f4c6 8004 filter->map[RMAP_IN].map ? "*" : "",
8005 filter->map[RMAP_IN].name,
718e3744 8006 VTY_NEWLINE);
fee0f4c6 8007 if (filter->map[RMAP_OUT].name)
718e3744 8008 vty_out (vty, " Route map for outgoing advertisements is %s%s%s",
fee0f4c6 8009 filter->map[RMAP_OUT].map ? "*" : "",
8010 filter->map[RMAP_OUT].name,
8011 VTY_NEWLINE);
8012 if (filter->map[RMAP_IMPORT].name)
8013 vty_out (vty, " Route map for advertisements going into this RS-client's table is %s%s%s",
8014 filter->map[RMAP_IMPORT].map ? "*" : "",
8015 filter->map[RMAP_IMPORT].name,
8016 VTY_NEWLINE);
8017 if (filter->map[RMAP_EXPORT].name)
8018 vty_out (vty, " Route map for advertisements coming from this RS-client is %s%s%s",
8019 filter->map[RMAP_EXPORT].map ? "*" : "",
8020 filter->map[RMAP_EXPORT].name,
718e3744 8021 VTY_NEWLINE);
8022
8023 /* unsuppress-map */
8024 if (filter->usmap.name)
8025 vty_out (vty, " Route map for selective unsuppress is %s%s%s",
8026 filter->usmap.map ? "*" : "",
8027 filter->usmap.name, VTY_NEWLINE);
8028
8029 /* Receive prefix count */
e0701b79 8030 vty_out (vty, " %ld accepted prefixes%s", p->pcount[afi][safi], VTY_NEWLINE);
8031
718e3744 8032 /* Maximum prefix */
8033 if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX))
8034 {
0a486e5f 8035 vty_out (vty, " Maximum prefixes allowed %ld%s%s", p->pmax[afi][safi],
718e3744 8036 CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING)
0a486e5f 8037 ? " (warning-only)" : "", VTY_NEWLINE);
8038 vty_out (vty, " Threshold for warning message %d%%",
8039 p->pmax_threshold[afi][safi]);
8040 if (p->pmax_restart[afi][safi])
8041 vty_out (vty, ", restart interval %d min", p->pmax_restart[afi][safi]);
8042 vty_out (vty, "%s", VTY_NEWLINE);
718e3744 8043 }
718e3744 8044
8045 vty_out (vty, "%s", VTY_NEWLINE);
8046}
8047
94f2b392 8048static void
718e3744 8049bgp_show_peer (struct vty *vty, struct peer *p)
8050{
8051 struct bgp *bgp;
a80beece 8052 char buf1[BUFSIZ], buf[SU_ADDRSTRLEN];
718e3744 8053 char timebuf[BGP_UPTIME_LEN];
538621f2 8054 afi_t afi;
8055 safi_t safi;
d6661008
DS
8056 u_int16_t i;
8057 u_char *msg;
718e3744 8058
8059 bgp = p->bgp;
8060
a80beece
DS
8061 if (p->conf_if) /* Configured interface name. */
8062 vty_out (vty, "BGP neighbor on %s: %s, ", p->conf_if,
8063 BGP_PEER_SU_UNSPEC(p) ? "None" :
8064 sockunion2str (&p->su, buf, SU_ADDRSTRLEN));
8065 else /* Configured IP address. */
8066 vty_out (vty, "BGP neighbor is %s, ", p->host);
aea339f7 8067 vty_out (vty, "remote AS %u, ", p->as);
9d3f9705 8068 vty_out (vty, "local AS %u%s%s, ",
718e3744 8069 p->change_local_as ? p->change_local_as : p->local_as,
8070 CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND) ?
9d3f9705
AC
8071 " no-prepend" : "",
8072 CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_REPLACE_AS) ?
8073 " replace-as" : "");
718e3744 8074 vty_out (vty, "%s link%s",
8075 p->as == p->local_as ? "internal" : "external",
8076 VTY_NEWLINE);
8077
8078 /* Description. */
8079 if (p->desc)
8080 vty_out (vty, " Description: %s%s", p->desc, VTY_NEWLINE);
8081
8082 /* Peer-group */
8083 if (p->group)
8084 vty_out (vty, " Member of peer-group %s for session parameters%s",
8085 p->group->name, VTY_NEWLINE);
8086
8087 /* Administrative shutdown. */
8088 if (CHECK_FLAG (p->flags, PEER_FLAG_SHUTDOWN))
8089 vty_out (vty, " Administratively shut down%s", VTY_NEWLINE);
8090
8091 /* BGP Version. */
8092 vty_out (vty, " BGP version 4");
718e3744 8093 vty_out (vty, ", remote router ID %s%s",
8094 inet_ntop (AF_INET, &p->remote_id, buf1, BUFSIZ),
8095 VTY_NEWLINE);
8096
8097 /* Confederation */
e0701b79 8098 if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION)
8099 && bgp_confederation_peers_check (bgp, p->as))
718e3744 8100 vty_out (vty, " Neighbor under common administration%s", VTY_NEWLINE);
8101
8102 /* Status. */
8103 vty_out (vty, " BGP state = %s",
8104 LOOKUP (bgp_status_msg, p->status));
8105 if (p->status == Established)
8106 vty_out (vty, ", up for %8s",
8107 peer_uptime (p->uptime, timebuf, BGP_UPTIME_LEN));
93406d87 8108 else if (p->status == Active)
8109 {
8110 if (CHECK_FLAG (p->flags, PEER_FLAG_PASSIVE))
8111 vty_out (vty, " (passive)");
8112 else if (CHECK_FLAG (p->sflags, PEER_STATUS_NSF_WAIT))
8113 vty_out (vty, " (NSF passive)");
8114 }
718e3744 8115 vty_out (vty, "%s", VTY_NEWLINE);
8116
8117 /* read timer */
8118 vty_out (vty, " Last read %s", peer_uptime (p->readtime, timebuf, BGP_UPTIME_LEN));
cb1faec9
DS
8119 vty_out (vty, ", Last write %s%s",
8120 peer_uptime (p->last_write, timebuf, BGP_UPTIME_LEN), VTY_NEWLINE);
718e3744 8121
8122 /* Configured timer values. */
cb1faec9 8123 vty_out (vty, " Hold time is %d, keepalive interval is %d seconds%s",
718e3744 8124 p->v_holdtime, p->v_keepalive, VTY_NEWLINE);
8125 if (CHECK_FLAG (p->config, PEER_CONFIG_TIMER))
8126 {
8127 vty_out (vty, " Configured hold time is %d", p->holdtime);
8128 vty_out (vty, ", keepalive interval is %d seconds%s",
8129 p->keepalive, VTY_NEWLINE);
8130 }
93406d87 8131
718e3744 8132 /* Capability. */
8133 if (p->status == Established)
8134 {
538621f2 8135 if (p->cap
718e3744 8136 || p->afc_adv[AFI_IP][SAFI_UNICAST]
8137 || p->afc_recv[AFI_IP][SAFI_UNICAST]
8138 || p->afc_adv[AFI_IP][SAFI_MULTICAST]
8139 || p->afc_recv[AFI_IP][SAFI_MULTICAST]
8140#ifdef HAVE_IPV6
8141 || p->afc_adv[AFI_IP6][SAFI_UNICAST]
8142 || p->afc_recv[AFI_IP6][SAFI_UNICAST]
8143 || p->afc_adv[AFI_IP6][SAFI_MULTICAST]
8144 || p->afc_recv[AFI_IP6][SAFI_MULTICAST]
8145#endif /* HAVE_IPV6 */
8146 || p->afc_adv[AFI_IP][SAFI_MPLS_VPN]
8147 || p->afc_recv[AFI_IP][SAFI_MPLS_VPN])
8148 {
8149 vty_out (vty, " Neighbor capabilities:%s", VTY_NEWLINE);
8150
0b2aa3a0
PJ
8151 /* AS4 */
8152 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV)
8153 || CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV))
8154 {
8155 vty_out (vty, " 4 Byte AS:");
8156 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV))
8157 vty_out (vty, " advertised");
8158 if (CHECK_FLAG (p->cap, PEER_CAP_AS4_RCV))
8159 vty_out (vty, " %sreceived",
8160 CHECK_FLAG (p->cap, PEER_CAP_AS4_ADV) ? "and " : "");
8161 vty_out (vty, "%s", VTY_NEWLINE);
8162 }
718e3744 8163 /* Dynamic */
8164 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV)
8165 || CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV))
8166 {
8167 vty_out (vty, " Dynamic:");
8168 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV))
8169 vty_out (vty, " advertised");
8170 if (CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_RCV))
538621f2 8171 vty_out (vty, " %sreceived",
8172 CHECK_FLAG (p->cap, PEER_CAP_DYNAMIC_ADV) ? "and " : "");
718e3744 8173 vty_out (vty, "%s", VTY_NEWLINE);
8174 }
8175
8176 /* Route Refresh */
8177 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV)
8178 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)
8179 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
8180 {
8181 vty_out (vty, " Route refresh:");
8182 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV))
8183 vty_out (vty, " advertised");
8184 if (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)
8185 || CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV))
538621f2 8186 vty_out (vty, " %sreceived(%s)",
8187 CHECK_FLAG (p->cap, PEER_CAP_REFRESH_ADV) ? "and " : "",
8188 (CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV)
8189 && CHECK_FLAG (p->cap, PEER_CAP_REFRESH_NEW_RCV)) ?
8190 "old & new" : CHECK_FLAG (p->cap, PEER_CAP_REFRESH_OLD_RCV) ? "old" : "new");
718e3744 8191
718e3744 8192 vty_out (vty, "%s", VTY_NEWLINE);
8193 }
538621f2 8194
8195 /* Multiprotocol Extensions */
8196 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
8197 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
8198 if (p->afc_adv[afi][safi] || p->afc_recv[afi][safi])
718e3744 8199 {
538621f2 8200 vty_out (vty, " Address family %s:", afi_safi_print (afi, safi));
8201 if (p->afc_adv[afi][safi])
8202 vty_out (vty, " advertised");
8203 if (p->afc_recv[afi][safi])
8204 vty_out (vty, " %sreceived", p->afc_adv[afi][safi] ? "and " : "");
8205 vty_out (vty, "%s", VTY_NEWLINE);
8206 }
8207
8208 /* Gracefull Restart */
8209 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)
8210 || CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
718e3744 8211 {
538621f2 8212 vty_out (vty, " Graceful Restart Capabilty:");
8213 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV))
718e3744 8214 vty_out (vty, " advertised");
538621f2 8215 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
8216 vty_out (vty, " %sreceived",
8217 CHECK_FLAG (p->cap, PEER_CAP_RESTART_ADV) ? "and " : "");
718e3744 8218 vty_out (vty, "%s", VTY_NEWLINE);
538621f2 8219
8220 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV))
718e3744 8221 {
538621f2 8222 int restart_af_count = 0;
8223
8224 vty_out (vty, " Remote Restart timer is %d seconds%s",
93406d87 8225 p->v_gr_restart, VTY_NEWLINE);
8226 vty_out (vty, " Address families by peer:%s ", VTY_NEWLINE);
538621f2 8227
8228 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
8229 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
8230 if (CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_RCV))
8231 {
93406d87 8232 vty_out (vty, "%s%s(%s)", restart_af_count ? ", " : "",
8233 afi_safi_print (afi, safi),
8234 CHECK_FLAG (p->af_cap[afi][safi], PEER_CAP_RESTART_AF_PRESERVE_RCV) ?
8235 "preserved" : "not preserved");
538621f2 8236 restart_af_count++;
93406d87 8237 }
538621f2 8238 if (! restart_af_count)
8239 vty_out (vty, "none");
8240 vty_out (vty, "%s", VTY_NEWLINE);
718e3744 8241 }
718e3744 8242 }
718e3744 8243 }
8244 }
8245
93406d87 8246 /* graceful restart information */
8247 if (CHECK_FLAG (p->cap, PEER_CAP_RESTART_RCV)
8248 || p->t_gr_restart
8249 || p->t_gr_stale)
8250 {
8251 int eor_send_af_count = 0;
8252 int eor_receive_af_count = 0;
8253
8254 vty_out (vty, " Graceful restart informations:%s", VTY_NEWLINE);
8255 if (p->status == Established)
8256 {
8257 vty_out (vty, " End-of-RIB send: ");
8258 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
8259 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
8260 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_SEND))
8261 {
8262 vty_out (vty, "%s%s", eor_send_af_count ? ", " : "",
8263 afi_safi_print (afi, safi));
8264 eor_send_af_count++;
8265 }
8266 vty_out (vty, "%s", VTY_NEWLINE);
8267
8268 vty_out (vty, " End-of-RIB received: ");
8269 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
8270 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
8271 if (CHECK_FLAG (p->af_sflags[afi][safi], PEER_STATUS_EOR_RECEIVED))
8272 {
8273 vty_out (vty, "%s%s", eor_receive_af_count ? ", " : "",
8274 afi_safi_print (afi, safi));
8275 eor_receive_af_count++;
8276 }
8277 vty_out (vty, "%s", VTY_NEWLINE);
8278 }
8279
8280 if (p->t_gr_restart)
0b2aa3a0
PJ
8281 vty_out (vty, " The remaining time of restart timer is %ld%s",
8282 thread_timer_remain_second (p->t_gr_restart), VTY_NEWLINE);
8283
93406d87 8284 if (p->t_gr_stale)
0b2aa3a0
PJ
8285 vty_out (vty, " The remaining time of stalepath timer is %ld%s",
8286 thread_timer_remain_second (p->t_gr_stale), VTY_NEWLINE);
93406d87 8287 }
8288
718e3744 8289 /* Packet counts. */
93406d87 8290 vty_out (vty, " Message statistics:%s", VTY_NEWLINE);
8291 vty_out (vty, " Inq depth is 0%s", VTY_NEWLINE);
0b2aa3a0 8292 vty_out (vty, " Outq depth is %lu%s", (unsigned long) p->obuf->count, VTY_NEWLINE);
93406d87 8293 vty_out (vty, " Sent Rcvd%s", VTY_NEWLINE);
8294 vty_out (vty, " Opens: %10d %10d%s", p->open_out, p->open_in, VTY_NEWLINE);
8295 vty_out (vty, " Notifications: %10d %10d%s", p->notify_out, p->notify_in, VTY_NEWLINE);
8296 vty_out (vty, " Updates: %10d %10d%s", p->update_out, p->update_in, VTY_NEWLINE);
8297 vty_out (vty, " Keepalives: %10d %10d%s", p->keepalive_out, p->keepalive_in, VTY_NEWLINE);
8298 vty_out (vty, " Route Refresh: %10d %10d%s", p->refresh_out, p->refresh_in, VTY_NEWLINE);
8299 vty_out (vty, " Capability: %10d %10d%s", p->dynamic_cap_out, p->dynamic_cap_in, VTY_NEWLINE);
8300 vty_out (vty, " Total: %10d %10d%s", p->open_out + p->notify_out +
8301 p->update_out + p->keepalive_out + p->refresh_out + p->dynamic_cap_out,
8302 p->open_in + p->notify_in + p->update_in + p->keepalive_in + p->refresh_in +
8303 p->dynamic_cap_in, VTY_NEWLINE);
718e3744 8304
8305 /* advertisement-interval */
8306 vty_out (vty, " Minimum time between advertisement runs is %d seconds%s",
8307 p->v_routeadv, VTY_NEWLINE);
8308
8309 /* Update-source. */
8310 if (p->update_if || p->update_source)
8311 {
8312 vty_out (vty, " Update source is ");
8313 if (p->update_if)
8314 vty_out (vty, "%s", p->update_if);
8315 else if (p->update_source)
8316 vty_out (vty, "%s",
8317 sockunion2str (p->update_source, buf1, SU_ADDRSTRLEN));
8318 vty_out (vty, "%s", VTY_NEWLINE);
8319 }
8320
8321 /* Default weight */
8322 if (CHECK_FLAG (p->config, PEER_CONFIG_WEIGHT))
8323 vty_out (vty, " Default weight %d%s", p->weight,
8324 VTY_NEWLINE);
8325
8326 vty_out (vty, "%s", VTY_NEWLINE);
8327
8328 /* Address Family Information */
538621f2 8329 for (afi = AFI_IP ; afi < AFI_MAX ; afi++)
8330 for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
8331 if (p->afc[afi][safi])
8332 bgp_show_peer_afi (vty, p, afi, safi);
718e3744 8333
8334 vty_out (vty, " Connections established %d; dropped %d%s",
8335 p->established, p->dropped,
8336 VTY_NEWLINE);
8337
d6661008 8338 if (! p->last_reset)
e0701b79 8339 vty_out (vty, " Last reset never%s", VTY_NEWLINE);
8340 else
d6661008
DS
8341 {
8342 vty_out (vty, " Last reset %s, due to %s%s",
8343 peer_uptime (p->resettime, timebuf, BGP_UPTIME_LEN),
8344 peer_down_str[(int) p->last_reset], VTY_NEWLINE);
8345
8346 if (p->last_reset_cause_size)
8347 {
8348 msg = p->last_reset_cause;
8349 vty_out(vty, " Message received that caused BGP to send a NOTIFICATION:%s ", VTY_NEWLINE);
8350 for (i = 1; i <= p->last_reset_cause_size; i++)
8351 {
8352 vty_out(vty, "%02X", *msg++);
8353
8354 if (i != p->last_reset_cause_size)
8355 if (i % 16 == 0)
8356 vty_out(vty, "%s ", VTY_NEWLINE);
8357 else if (i % 4 == 0)
8358 vty_out(vty, " ");
8359 }
8360 vty_out(vty, "%s", VTY_NEWLINE);
8361 }
8362 }
848973c7 8363
718e3744 8364 if (CHECK_FLAG (p->sflags, PEER_STATUS_PREFIX_OVERFLOW))
8365 {
8366 vty_out (vty, " Peer had exceeded the max. no. of prefixes configured.%s", VTY_NEWLINE);
0a486e5f 8367
8368 if (p->t_pmax_restart)
8369 vty_out (vty, " Reduce the no. of prefix from %s, will restart in %ld seconds%s",
8370 p->host, thread_timer_remain_second (p->t_pmax_restart),
8371 VTY_NEWLINE);
8372 else
8373 vty_out (vty, " Reduce the no. of prefix and clear ip bgp %s to restore peering%s",
8374 p->host, VTY_NEWLINE);
718e3744 8375 }
8376
f5a4827d 8377 /* EBGP Multihop and GTSM */
6d85b15b 8378 if (p->sort != BGP_PEER_IBGP)
f5a4827d
SH
8379 {
8380 if (p->gtsm_hops > 0)
8381 vty_out (vty, " External BGP neighbor may be up to %d hops away.%s",
8382 p->gtsm_hops, VTY_NEWLINE);
8383 else if (p->ttl > 1)
8384 vty_out (vty, " External BGP neighbor may be up to %d hops away.%s",
8385 p->ttl, VTY_NEWLINE);
8386 }
5d804b43
PM
8387 else
8388 {
8389 if (p->gtsm_hops > 0)
8390 vty_out (vty, " Internal BGP neighbor may be up to %d hops away.%s",
8391 p->gtsm_hops, VTY_NEWLINE);
8392 }
718e3744 8393
8394 /* Local address. */
8395 if (p->su_local)
8396 {
93406d87 8397 vty_out (vty, "Local host: %s, Local port: %d%s",
718e3744 8398 sockunion2str (p->su_local, buf1, SU_ADDRSTRLEN),
8399 ntohs (p->su_local->sin.sin_port),
718e3744 8400 VTY_NEWLINE);
8401 }
8402
8403 /* Remote address. */
8404 if (p->su_remote)
8405 {
8406 vty_out (vty, "Foreign host: %s, Foreign port: %d%s",
8407 sockunion2str (p->su_remote, buf1, SU_ADDRSTRLEN),
8408 ntohs (p->su_remote->sin.sin_port),
8409 VTY_NEWLINE);
8410 }
8411
8412 /* Nexthop display. */
8413 if (p->su_local)
8414 {
8415 vty_out (vty, "Nexthop: %s%s",
8416 inet_ntop (AF_INET, &p->nexthop.v4, buf1, BUFSIZ),
8417 VTY_NEWLINE);
8418#ifdef HAVE_IPV6
8419 vty_out (vty, "Nexthop global: %s%s",
8420 inet_ntop (AF_INET6, &p->nexthop.v6_global, buf1, BUFSIZ),
8421 VTY_NEWLINE);
8422 vty_out (vty, "Nexthop local: %s%s",
8423 inet_ntop (AF_INET6, &p->nexthop.v6_local, buf1, BUFSIZ),
8424 VTY_NEWLINE);
8425 vty_out (vty, "BGP connection: %s%s",
8426 p->shared_network ? "shared network" : "non shared network",
8427 VTY_NEWLINE);
8428#endif /* HAVE_IPV6 */
8429 }
8430
8431 /* Timer information. */
8432 if (p->t_start)
8433 vty_out (vty, "Next start timer due in %ld seconds%s",
8434 thread_timer_remain_second (p->t_start), VTY_NEWLINE);
8435 if (p->t_connect)
8436 vty_out (vty, "Next connect timer due in %ld seconds%s",
8437 thread_timer_remain_second (p->t_connect), VTY_NEWLINE);
cb1faec9
DS
8438 if (p->t_routeadv)
8439 vty_out (vty, "MRAI (interval %ld) timer expires in %ld seconds%s",
8440 p->v_routeadv, thread_timer_remain_second (p->t_routeadv),
8441 VTY_NEWLINE);
8442
8443 vty_out (vty, "Read thread: %s Write thread: %s%s",
718e3744 8444 p->t_read ? "on" : "off",
8445 p->t_write ? "on" : "off",
8446 VTY_NEWLINE);
8447
8448 if (p->notify.code == BGP_NOTIFY_OPEN_ERR
8449 && p->notify.subcode == BGP_NOTIFY_OPEN_UNSUP_CAPBL)
8450 bgp_capability_vty_out (vty, p);
8451
8452 vty_out (vty, "%s", VTY_NEWLINE);
8453}
8454
94f2b392 8455static int
718e3744 8456bgp_show_neighbor (struct vty *vty, struct bgp *bgp,
a80beece 8457 enum show_type type, union sockunion *su, const char *conf_if)
718e3744 8458{
1eb8ef25 8459 struct listnode *node, *nnode;
718e3744 8460 struct peer *peer;
8461 int find = 0;
8462
1eb8ef25 8463 for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
718e3744 8464 {
1ff9a340
DS
8465 if (!CHECK_FLAG(peer->flags, PEER_FLAG_CONFIG_NODE))
8466 continue;
8467
718e3744 8468 switch (type)
8469 {
8470 case show_all:
8471 bgp_show_peer (vty, peer);
8472 break;
8473 case show_peer:
a80beece
DS
8474 if (conf_if)
8475 {
8476 if (peer->conf_if && !strcmp(peer->conf_if, conf_if))
8477 {
8478 find = 1;
8479 bgp_show_peer (vty, peer);
8480 }
8481 }
8482 else
8483 {
8484 if (sockunion_same (&peer->su, su))
8485 {
8486 find = 1;
8487 bgp_show_peer (vty, peer);
8488 }
8489 }
718e3744 8490 break;
8491 }
8492 }
8493
8494 if (type == show_peer && ! find)
8495 vty_out (vty, "%% No such neighbor%s", VTY_NEWLINE);
8496
8497 return CMD_SUCCESS;
8498}
8499
94f2b392 8500static int
fd79ac91 8501bgp_show_neighbor_vty (struct vty *vty, const char *name,
8502 enum show_type type, const char *ip_str)
718e3744 8503{
8504 int ret;
8505 struct bgp *bgp;
8506 union sockunion su;
8507
718e3744 8508 if (name)
8509 {
8510 bgp = bgp_lookup_by_name (name);
718e3744 8511 if (! bgp)
8512 {
8513 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
8514 return CMD_WARNING;
8515 }
718e3744 8516 }
a80beece
DS
8517 else
8518 {
8519 bgp = bgp_get_default ();
8520 }
718e3744 8521
8522 if (bgp)
a80beece
DS
8523 {
8524 if (ip_str)
8525 {
8526 ret = str2sockunion (ip_str, &su);
8527 if (ret < 0)
8528 bgp_show_neighbor (vty, bgp, type, NULL, ip_str);
8529 else
8530 bgp_show_neighbor (vty, bgp, type, &su, NULL);
8531 }
8532 else
8533 {
8534 bgp_show_neighbor (vty, bgp, type, NULL, NULL);
8535 }
8536 }
718e3744 8537
8538 return CMD_SUCCESS;
8539}
8540
8541/* "show ip bgp neighbors" commands. */
8542DEFUN (show_ip_bgp_neighbors,
8543 show_ip_bgp_neighbors_cmd,
8544 "show ip bgp neighbors",
8545 SHOW_STR
8546 IP_STR
8547 BGP_STR
8548 "Detailed information on TCP and BGP neighbor connections\n")
8549{
8550 return bgp_show_neighbor_vty (vty, NULL, show_all, NULL);
8551}
8552
8553ALIAS (show_ip_bgp_neighbors,
8554 show_ip_bgp_ipv4_neighbors_cmd,
8555 "show ip bgp ipv4 (unicast|multicast) neighbors",
8556 SHOW_STR
8557 IP_STR
8558 BGP_STR
8559 "Address family\n"
8560 "Address Family modifier\n"
8561 "Address Family modifier\n"
8562 "Detailed information on TCP and BGP neighbor connections\n")
8563
8564ALIAS (show_ip_bgp_neighbors,
8565 show_ip_bgp_vpnv4_all_neighbors_cmd,
8566 "show ip bgp vpnv4 all neighbors",
8567 SHOW_STR
8568 IP_STR
8569 BGP_STR
8570 "Display VPNv4 NLRI specific information\n"
8571 "Display information about all VPNv4 NLRIs\n"
8572 "Detailed information on TCP and BGP neighbor connections\n")
8573
8574ALIAS (show_ip_bgp_neighbors,
8575 show_ip_bgp_vpnv4_rd_neighbors_cmd,
8576 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors",
8577 SHOW_STR
8578 IP_STR
8579 BGP_STR
8580 "Display VPNv4 NLRI specific information\n"
8581 "Display information for a route distinguisher\n"
8582 "VPN Route Distinguisher\n"
8583 "Detailed information on TCP and BGP neighbor connections\n")
8584
8585ALIAS (show_ip_bgp_neighbors,
8586 show_bgp_neighbors_cmd,
8587 "show bgp neighbors",
8588 SHOW_STR
8589 BGP_STR
8590 "Detailed information on TCP and BGP neighbor connections\n")
8591
8592ALIAS (show_ip_bgp_neighbors,
8593 show_bgp_ipv6_neighbors_cmd,
8594 "show bgp ipv6 neighbors",
8595 SHOW_STR
8596 BGP_STR
8597 "Address family\n"
8598 "Detailed information on TCP and BGP neighbor connections\n")
8599
8600DEFUN (show_ip_bgp_neighbors_peer,
8601 show_ip_bgp_neighbors_peer_cmd,
a80beece 8602 "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD)",
718e3744 8603 SHOW_STR
8604 IP_STR
8605 BGP_STR
8606 "Detailed information on TCP and BGP neighbor connections\n"
8607 "Neighbor to display information about\n"
a80beece
DS
8608 "Neighbor to display information about\n"
8609 "Neighbor on bgp configured interface\n")
718e3744 8610{
8611 return bgp_show_neighbor_vty (vty, NULL, show_peer, argv[argc - 1]);
8612}
8613
8614ALIAS (show_ip_bgp_neighbors_peer,
8615 show_ip_bgp_ipv4_neighbors_peer_cmd,
a80beece 8616 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD)",
718e3744 8617 SHOW_STR
8618 IP_STR
8619 BGP_STR
8620 "Address family\n"
8621 "Address Family modifier\n"
8622 "Address Family modifier\n"
8623 "Detailed information on TCP and BGP neighbor connections\n"
8624 "Neighbor to display information about\n"
a80beece
DS
8625 "Neighbor to display information about\n"
8626 "Neighbor on bgp configured interface\n")
718e3744 8627
8628ALIAS (show_ip_bgp_neighbors_peer,
8629 show_ip_bgp_vpnv4_all_neighbors_peer_cmd,
8630 "show ip bgp vpnv4 all neighbors A.B.C.D",
8631 SHOW_STR
8632 IP_STR
8633 BGP_STR
8634 "Display VPNv4 NLRI specific information\n"
8635 "Display information about all VPNv4 NLRIs\n"
8636 "Detailed information on TCP and BGP neighbor connections\n"
8637 "Neighbor to display information about\n")
8638
8639ALIAS (show_ip_bgp_neighbors_peer,
8640 show_ip_bgp_vpnv4_rd_neighbors_peer_cmd,
8641 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D",
8642 SHOW_STR
8643 IP_STR
8644 BGP_STR
8645 "Display VPNv4 NLRI specific information\n"
8646 "Display information about all VPNv4 NLRIs\n"
8647 "Detailed information on TCP and BGP neighbor connections\n"
8648 "Neighbor to display information about\n")
8649
8650ALIAS (show_ip_bgp_neighbors_peer,
8651 show_bgp_neighbors_peer_cmd,
a80beece 8652 "show bgp neighbors (A.B.C.D|X:X::X:X|WORD)",
718e3744 8653 SHOW_STR
8654 BGP_STR
8655 "Detailed information on TCP and BGP neighbor connections\n"
8656 "Neighbor to display information about\n"
a80beece
DS
8657 "Neighbor to display information about\n"
8658 "Neighbor on bgp configured interface\n")
718e3744 8659
8660ALIAS (show_ip_bgp_neighbors_peer,
8661 show_bgp_ipv6_neighbors_peer_cmd,
a80beece 8662 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD)",
718e3744 8663 SHOW_STR
8664 BGP_STR
8665 "Address family\n"
8666 "Detailed information on TCP and BGP neighbor connections\n"
8667 "Neighbor to display information about\n"
a80beece
DS
8668 "Neighbor to display information about\n"
8669 "Neighbor on bgp configured interface\n")
718e3744 8670
8671DEFUN (show_ip_bgp_instance_neighbors,
8672 show_ip_bgp_instance_neighbors_cmd,
8673 "show ip bgp view WORD neighbors",
8674 SHOW_STR
8675 IP_STR
8676 BGP_STR
8677 "BGP view\n"
8678 "View name\n"
8679 "Detailed information on TCP and BGP neighbor connections\n")
8680{
8681 return bgp_show_neighbor_vty (vty, argv[0], show_all, NULL);
8682}
8683
bb46e94f 8684ALIAS (show_ip_bgp_instance_neighbors,
8685 show_bgp_instance_neighbors_cmd,
8686 "show bgp view WORD neighbors",
8687 SHOW_STR
8688 BGP_STR
8689 "BGP view\n"
8690 "View name\n"
8691 "Detailed information on TCP and BGP neighbor connections\n")
8692
8693ALIAS (show_ip_bgp_instance_neighbors,
8694 show_bgp_instance_ipv6_neighbors_cmd,
8695 "show bgp view WORD ipv6 neighbors",
8696 SHOW_STR
8697 BGP_STR
8698 "BGP view\n"
8699 "View name\n"
8700 "Address family\n"
8701 "Detailed information on TCP and BGP neighbor connections\n")
8702
718e3744 8703DEFUN (show_ip_bgp_instance_neighbors_peer,
8704 show_ip_bgp_instance_neighbors_peer_cmd,
a80beece 8705 "show ip bgp view WORD neighbors (A.B.C.D|X:X::X:X|WORD)",
718e3744 8706 SHOW_STR
8707 IP_STR
8708 BGP_STR
8709 "BGP view\n"
8710 "View name\n"
8711 "Detailed information on TCP and BGP neighbor connections\n"
8712 "Neighbor to display information about\n"
a80beece
DS
8713 "Neighbor to display information about\n"
8714 "Neighbor on bgp configured interface\n")
718e3744 8715{
8716 return bgp_show_neighbor_vty (vty, argv[0], show_peer, argv[1]);
8717}
bb46e94f 8718
8719ALIAS (show_ip_bgp_instance_neighbors_peer,
8720 show_bgp_instance_neighbors_peer_cmd,
a80beece 8721 "show bgp view WORD neighbors (A.B.C.D|X:X::X:X|WORD)",
bb46e94f 8722 SHOW_STR
8723 BGP_STR
8724 "BGP view\n"
8725 "View name\n"
8726 "Detailed information on TCP and BGP neighbor connections\n"
8727 "Neighbor to display information about\n"
a80beece
DS
8728 "Neighbor to display information about\n"
8729 "Neighbor on bgp configured interface\n")
bb46e94f 8730
8731ALIAS (show_ip_bgp_instance_neighbors_peer,
8732 show_bgp_instance_ipv6_neighbors_peer_cmd,
a80beece 8733 "show bgp view WORD ipv6 neighbors (A.B.C.D|X:X::X:X|WORD)",
bb46e94f 8734 SHOW_STR
8735 BGP_STR
8736 "BGP view\n"
8737 "View name\n"
8738 "Address family\n"
8739 "Detailed information on TCP and BGP neighbor connections\n"
8740 "Neighbor to display information about\n"
a80beece
DS
8741 "Neighbor to display information about\n"
8742 "Neighbor on bgp configured interface\n")
6b0655a2 8743
718e3744 8744/* Show BGP's AS paths internal data. There are both `show ip bgp
8745 paths' and `show ip mbgp paths'. Those functions results are the
8746 same.*/
8747DEFUN (show_ip_bgp_paths,
8748 show_ip_bgp_paths_cmd,
8749 "show ip bgp paths",
8750 SHOW_STR
8751 IP_STR
8752 BGP_STR
8753 "Path information\n")
8754{
8755 vty_out (vty, "Address Refcnt Path%s", VTY_NEWLINE);
8756 aspath_print_all_vty (vty);
8757 return CMD_SUCCESS;
8758}
8759
8760DEFUN (show_ip_bgp_ipv4_paths,
8761 show_ip_bgp_ipv4_paths_cmd,
8762 "show ip bgp ipv4 (unicast|multicast) paths",
8763 SHOW_STR
8764 IP_STR
8765 BGP_STR
8766 "Address family\n"
8767 "Address Family modifier\n"
8768 "Address Family modifier\n"
8769 "Path information\n")
8770{
8771 vty_out (vty, "Address Refcnt Path\r\n");
8772 aspath_print_all_vty (vty);
8773
8774 return CMD_SUCCESS;
8775}
6b0655a2 8776
718e3744 8777#include "hash.h"
8778
94f2b392 8779static void
718e3744 8780community_show_all_iterator (struct hash_backet *backet, struct vty *vty)
8781{
8782 struct community *com;
8783
8784 com = (struct community *) backet->data;
8785 vty_out (vty, "[%p] (%ld) %s%s", backet, com->refcnt,
8786 community_str (com), VTY_NEWLINE);
8787}
8788
8789/* Show BGP's community internal data. */
8790DEFUN (show_ip_bgp_community_info,
8791 show_ip_bgp_community_info_cmd,
8792 "show ip bgp community-info",
8793 SHOW_STR
8794 IP_STR
8795 BGP_STR
8796 "List all bgp community information\n")
8797{
8798 vty_out (vty, "Address Refcnt Community%s", VTY_NEWLINE);
8799
8800 hash_iterate (community_hash (),
8801 (void (*) (struct hash_backet *, void *))
8802 community_show_all_iterator,
8803 vty);
8804
8805 return CMD_SUCCESS;
8806}
8807
8808DEFUN (show_ip_bgp_attr_info,
8809 show_ip_bgp_attr_info_cmd,
8810 "show ip bgp attribute-info",
8811 SHOW_STR
8812 IP_STR
8813 BGP_STR
8814 "List all bgp attribute information\n")
8815{
8816 attr_show_all (vty);
8817 return CMD_SUCCESS;
8818}
6b0655a2 8819
94f2b392 8820static int
fee0f4c6 8821bgp_write_rsclient_summary (struct vty *vty, struct peer *rsclient,
8822 afi_t afi, safi_t safi)
8823{
8824 char timebuf[BGP_UPTIME_LEN];
8825 char rmbuf[14];
fd79ac91 8826 const char *rmname;
fee0f4c6 8827 struct peer *peer;
1eb8ef25 8828 struct listnode *node, *nnode;
fee0f4c6 8829 int len;
8830 int count = 0;
8831
8832 if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_GROUP))
8833 {
1eb8ef25 8834 for (ALL_LIST_ELEMENTS (rsclient->group->peer, node, nnode, peer))
fee0f4c6 8835 {
8836 count++;
8837 bgp_write_rsclient_summary (vty, peer, afi, safi);
8838 }
8839 return count;
8840 }
8841
8842 len = vty_out (vty, "%s", rsclient->host);
8843 len = 16 - len;
8844
8845 if (len < 1)
8846 vty_out (vty, "%s%*s", VTY_NEWLINE, 16, " ");
8847 else
8848 vty_out (vty, "%*s", len, " ");
8849
3d515fd9 8850 vty_out (vty, "4 ");
fee0f4c6 8851
0b2aa3a0 8852 vty_out (vty, "%11d ", rsclient->as);
fee0f4c6 8853
8854 rmname = ROUTE_MAP_EXPORT_NAME(&rsclient->filter[afi][safi]);
8855 if ( rmname && strlen (rmname) > 13 )
8856 {
8857 sprintf (rmbuf, "%13s", "...");
8858 rmname = strncpy (rmbuf, rmname, 10);
8859 }
8860 else if (! rmname)
8861 rmname = "<none>";
8862 vty_out (vty, " %13s ", rmname);
8863
8864 rmname = ROUTE_MAP_IMPORT_NAME(&rsclient->filter[afi][safi]);
8865 if ( rmname && strlen (rmname) > 13 )
8866 {
8867 sprintf (rmbuf, "%13s", "...");
8868 rmname = strncpy (rmbuf, rmname, 10);
8869 }
8870 else if (! rmname)
8871 rmname = "<none>";
8872 vty_out (vty, " %13s ", rmname);
8873
8874 vty_out (vty, "%8s", peer_uptime (rsclient->uptime, timebuf, BGP_UPTIME_LEN));
8875
8876 if (CHECK_FLAG (rsclient->flags, PEER_FLAG_SHUTDOWN))
8877 vty_out (vty, " Idle (Admin)");
8878 else if (CHECK_FLAG (rsclient->sflags, PEER_STATUS_PREFIX_OVERFLOW))
8879 vty_out (vty, " Idle (PfxCt)");
8880 else
8881 vty_out (vty, " %-11s", LOOKUP(bgp_status_msg, rsclient->status));
8882
8883 vty_out (vty, "%s", VTY_NEWLINE);
8884
8885 return 1;
8886}
8887
94f2b392 8888static int
fd79ac91 8889bgp_show_rsclient_summary (struct vty *vty, struct bgp *bgp,
8890 afi_t afi, safi_t safi)
fee0f4c6 8891{
8892 struct peer *peer;
1eb8ef25 8893 struct listnode *node, *nnode;
fee0f4c6 8894 int count = 0;
8895
8896 /* Header string for each address family. */
8897 static char header[] = "Neighbor V AS Export-Policy Import-Policy Up/Down State";
8898
1eb8ef25 8899 for (ALL_LIST_ELEMENTS (bgp->rsclient, node, nnode, peer))
fee0f4c6 8900 {
8901 if (peer->afc[afi][safi] &&
8902 CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT))
8903 {
8904 if (! count)
8905 {
8906 vty_out (vty,
8907 "Route Server's BGP router identifier %s%s",
8908 inet_ntoa (bgp->router_id), VTY_NEWLINE);
8909 vty_out (vty,
aea339f7 8910 "Route Server's local AS number %u%s", bgp->as,
fee0f4c6 8911 VTY_NEWLINE);
8912
8913 vty_out (vty, "%s", VTY_NEWLINE);
8914 vty_out (vty, "%s%s", header, VTY_NEWLINE);
8915 }
8916
8917 count += bgp_write_rsclient_summary (vty, peer, afi, safi);
8918 }
8919 }
8920
8921 if (count)
8922 vty_out (vty, "%sTotal number of Route Server Clients %d%s", VTY_NEWLINE,
8923 count, VTY_NEWLINE);
8924 else
8925 vty_out (vty, "No %s Route Server Client is configured%s",
8926 afi == AFI_IP ? "IPv4" : "IPv6", VTY_NEWLINE);
8927
8928 return CMD_SUCCESS;
8929}
8930
94f2b392 8931static int
fd79ac91 8932bgp_show_rsclient_summary_vty (struct vty *vty, const char *name,
8933 afi_t afi, safi_t safi)
fee0f4c6 8934{
8935 struct bgp *bgp;
8936
8937 if (name)
8938 {
8939 bgp = bgp_lookup_by_name (name);
8940
8941 if (! bgp)
8942 {
8943 vty_out (vty, "%% No such BGP instance exist%s", VTY_NEWLINE);
8944 return CMD_WARNING;
8945 }
8946
8947 bgp_show_rsclient_summary (vty, bgp, afi, safi);
8948 return CMD_SUCCESS;
8949 }
8950
8951 bgp = bgp_get_default ();
8952
8953 if (bgp)
8954 bgp_show_rsclient_summary (vty, bgp, afi, safi);
8955
8956 return CMD_SUCCESS;
8957}
8958
8959/* 'show bgp rsclient' commands. */
8960DEFUN (show_ip_bgp_rsclient_summary,
8961 show_ip_bgp_rsclient_summary_cmd,
8962 "show ip bgp rsclient summary",
8963 SHOW_STR
8964 IP_STR
8965 BGP_STR
8966 "Information about Route Server Clients\n"
8967 "Summary of all Route Server Clients\n")
8968{
8969 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
8970}
8971
8972DEFUN (show_ip_bgp_instance_rsclient_summary,
8973 show_ip_bgp_instance_rsclient_summary_cmd,
8974 "show ip bgp view WORD rsclient summary",
8975 SHOW_STR
8976 IP_STR
8977 BGP_STR
8978 "BGP view\n"
8979 "View name\n"
8980 "Information about Route Server Clients\n"
8981 "Summary of all Route Server Clients\n")
8982{
8983 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
8984}
8985
8986DEFUN (show_ip_bgp_ipv4_rsclient_summary,
8987 show_ip_bgp_ipv4_rsclient_summary_cmd,
8988 "show ip bgp ipv4 (unicast|multicast) rsclient summary",
8989 SHOW_STR
8990 IP_STR
8991 BGP_STR
8992 "Address family\n"
8993 "Address Family modifier\n"
8994 "Address Family modifier\n"
8995 "Information about Route Server Clients\n"
8996 "Summary of all Route Server Clients\n")
8997{
8998 if (strncmp (argv[0], "m", 1) == 0)
8999 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_MULTICAST);
9000
9001 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, SAFI_UNICAST);
9002}
9003
9004DEFUN (show_ip_bgp_instance_ipv4_rsclient_summary,
9005 show_ip_bgp_instance_ipv4_rsclient_summary_cmd,
9006 "show ip bgp view WORD ipv4 (unicast|multicast) rsclient summary",
9007 SHOW_STR
9008 IP_STR
9009 BGP_STR
9010 "BGP view\n"
9011 "View name\n"
9012 "Address family\n"
9013 "Address Family modifier\n"
9014 "Address Family modifier\n"
9015 "Information about Route Server Clients\n"
9016 "Summary of all Route Server Clients\n")
9017{
9018 if (strncmp (argv[1], "m", 1) == 0)
9019 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_MULTICAST);
9020
9021 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, SAFI_UNICAST);
9022}
9023
95cbbd2a
ML
9024DEFUN (show_bgp_instance_ipv4_safi_rsclient_summary,
9025 show_bgp_instance_ipv4_safi_rsclient_summary_cmd,
9026 "show bgp view WORD ipv4 (unicast|multicast) rsclient summary",
9027 SHOW_STR
9028 BGP_STR
9029 "BGP view\n"
9030 "View name\n"
9031 "Address family\n"
9032 "Address Family modifier\n"
9033 "Address Family modifier\n"
9034 "Information about Route Server Clients\n"
9035 "Summary of all Route Server Clients\n")
9036{
9037 safi_t safi;
9038
9039 if (argc == 2) {
9040 safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
9041 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP, safi);
9042 } else {
9043 safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
9044 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP, safi);
9045 }
9046}
9047
9048ALIAS (show_bgp_instance_ipv4_safi_rsclient_summary,
9049 show_bgp_ipv4_safi_rsclient_summary_cmd,
9050 "show bgp ipv4 (unicast|multicast) rsclient summary",
9051 SHOW_STR
9052 BGP_STR
9053 "Address family\n"
9054 "Address Family modifier\n"
9055 "Address Family modifier\n"
9056 "Information about Route Server Clients\n"
9057 "Summary of all Route Server Clients\n")
9058
fee0f4c6 9059#ifdef HAVE_IPV6
9060DEFUN (show_bgp_rsclient_summary,
9061 show_bgp_rsclient_summary_cmd,
9062 "show bgp rsclient summary",
9063 SHOW_STR
9064 BGP_STR
9065 "Information about Route Server Clients\n"
9066 "Summary of all Route Server Clients\n")
9067{
9068 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, SAFI_UNICAST);
9069}
9070
9071DEFUN (show_bgp_instance_rsclient_summary,
9072 show_bgp_instance_rsclient_summary_cmd,
9073 "show bgp view WORD rsclient summary",
9074 SHOW_STR
9075 BGP_STR
9076 "BGP view\n"
9077 "View name\n"
9078 "Information about Route Server Clients\n"
9079 "Summary of all Route Server Clients\n")
9080{
9081 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, SAFI_UNICAST);
9082}
9083
9084ALIAS (show_bgp_rsclient_summary,
9085 show_bgp_ipv6_rsclient_summary_cmd,
9086 "show bgp ipv6 rsclient summary",
9087 SHOW_STR
9088 BGP_STR
9089 "Address family\n"
9090 "Information about Route Server Clients\n"
9091 "Summary of all Route Server Clients\n")
9092
9093ALIAS (show_bgp_instance_rsclient_summary,
9094 show_bgp_instance_ipv6_rsclient_summary_cmd,
9095 "show bgp view WORD ipv6 rsclient summary",
9096 SHOW_STR
9097 BGP_STR
9098 "BGP view\n"
9099 "View name\n"
9100 "Address family\n"
9101 "Information about Route Server Clients\n"
9102 "Summary of all Route Server Clients\n")
95cbbd2a
ML
9103
9104DEFUN (show_bgp_instance_ipv6_safi_rsclient_summary,
9105 show_bgp_instance_ipv6_safi_rsclient_summary_cmd,
9106 "show bgp view WORD ipv6 (unicast|multicast) rsclient summary",
9107 SHOW_STR
9108 BGP_STR
9109 "BGP view\n"
9110 "View name\n"
9111 "Address family\n"
9112 "Address Family modifier\n"
9113 "Address Family modifier\n"
9114 "Information about Route Server Clients\n"
9115 "Summary of all Route Server Clients\n")
9116{
9117 safi_t safi;
9118
9119 if (argc == 2) {
9120 safi = (strncmp (argv[1], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
9121 return bgp_show_rsclient_summary_vty (vty, argv[0], AFI_IP6, safi);
9122 } else {
9123 safi = (strncmp (argv[0], "m", 1) == 0) ? SAFI_MULTICAST : SAFI_UNICAST;
9124 return bgp_show_rsclient_summary_vty (vty, NULL, AFI_IP6, safi);
9125 }
9126}
9127
9128ALIAS (show_bgp_instance_ipv6_safi_rsclient_summary,
9129 show_bgp_ipv6_safi_rsclient_summary_cmd,
9130 "show bgp ipv6 (unicast|multicast) rsclient summary",
9131 SHOW_STR
9132 BGP_STR
9133 "Address family\n"
9134 "Address Family modifier\n"
9135 "Address Family modifier\n"
9136 "Information about Route Server Clients\n"
9137 "Summary of all Route Server Clients\n")
9138
fee0f4c6 9139#endif /* HAVE IPV6 */
6b0655a2 9140
718e3744 9141/* Redistribute VTY commands. */
9142
718e3744 9143DEFUN (bgp_redistribute_ipv4,
9144 bgp_redistribute_ipv4_cmd,
e0ca5fde 9145 "redistribute " QUAGGA_IP_REDIST_STR_BGPD,
718e3744 9146 "Redistribute information from another routing protocol\n"
e0ca5fde 9147 QUAGGA_IP_REDIST_HELP_STR_BGPD)
718e3744 9148{
9149 int type;
9150
e0ca5fde
DL
9151 type = proto_redistnum (AFI_IP, argv[0]);
9152 if (type < 0 || type == ZEBRA_ROUTE_BGP)
718e3744 9153 {
9154 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9155 return CMD_WARNING;
9156 }
9157 return bgp_redistribute_set (vty->index, AFI_IP, type);
9158}
9159
9160DEFUN (bgp_redistribute_ipv4_rmap,
9161 bgp_redistribute_ipv4_rmap_cmd,
e0ca5fde 9162 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD",
718e3744 9163 "Redistribute information from another routing protocol\n"
e0ca5fde 9164 QUAGGA_IP_REDIST_HELP_STR_BGPD
718e3744 9165 "Route map reference\n"
9166 "Pointer to route-map entries\n")
9167{
9168 int type;
9169
e0ca5fde
DL
9170 type = proto_redistnum (AFI_IP, argv[0]);
9171 if (type < 0 || type == ZEBRA_ROUTE_BGP)
718e3744 9172 {
9173 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9174 return CMD_WARNING;
9175 }
9176
9177 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]);
9178 return bgp_redistribute_set (vty->index, AFI_IP, type);
9179}
9180
9181DEFUN (bgp_redistribute_ipv4_metric,
9182 bgp_redistribute_ipv4_metric_cmd,
e0ca5fde 9183 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>",
718e3744 9184 "Redistribute information from another routing protocol\n"
e0ca5fde 9185 QUAGGA_IP_REDIST_HELP_STR_BGPD
718e3744 9186 "Metric for redistributed routes\n"
9187 "Default metric\n")
9188{
9189 int type;
9190 u_int32_t metric;
9191
e0ca5fde
DL
9192 type = proto_redistnum (AFI_IP, argv[0]);
9193 if (type < 0 || type == ZEBRA_ROUTE_BGP)
718e3744 9194 {
9195 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9196 return CMD_WARNING;
9197 }
9198 VTY_GET_INTEGER ("metric", metric, argv[1]);
9199
9200 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
9201 return bgp_redistribute_set (vty->index, AFI_IP, type);
9202}
9203
9204DEFUN (bgp_redistribute_ipv4_rmap_metric,
9205 bgp_redistribute_ipv4_rmap_metric_cmd,
e0ca5fde 9206 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
718e3744 9207 "Redistribute information from another routing protocol\n"
e0ca5fde 9208 QUAGGA_IP_REDIST_HELP_STR_BGPD
718e3744 9209 "Route map reference\n"
9210 "Pointer to route-map entries\n"
9211 "Metric for redistributed routes\n"
9212 "Default metric\n")
9213{
9214 int type;
9215 u_int32_t metric;
9216
e0ca5fde
DL
9217 type = proto_redistnum (AFI_IP, argv[0]);
9218 if (type < 0 || type == ZEBRA_ROUTE_BGP)
718e3744 9219 {
9220 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9221 return CMD_WARNING;
9222 }
9223 VTY_GET_INTEGER ("metric", metric, argv[2]);
9224
9225 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[1]);
9226 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
9227 return bgp_redistribute_set (vty->index, AFI_IP, type);
9228}
9229
9230DEFUN (bgp_redistribute_ipv4_metric_rmap,
9231 bgp_redistribute_ipv4_metric_rmap_cmd,
e0ca5fde 9232 "redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
718e3744 9233 "Redistribute information from another routing protocol\n"
e0ca5fde 9234 QUAGGA_IP_REDIST_HELP_STR_BGPD
718e3744 9235 "Metric for redistributed routes\n"
9236 "Default metric\n"
9237 "Route map reference\n"
9238 "Pointer to route-map entries\n")
9239{
9240 int type;
9241 u_int32_t metric;
9242
e0ca5fde
DL
9243 type = proto_redistnum (AFI_IP, argv[0]);
9244 if (type < 0 || type == ZEBRA_ROUTE_BGP)
718e3744 9245 {
9246 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9247 return CMD_WARNING;
9248 }
9249 VTY_GET_INTEGER ("metric", metric, argv[1]);
9250
9251 bgp_redistribute_metric_set (vty->index, AFI_IP, type, metric);
9252 bgp_redistribute_rmap_set (vty->index, AFI_IP, type, argv[2]);
9253 return bgp_redistribute_set (vty->index, AFI_IP, type);
9254}
9255
9256DEFUN (no_bgp_redistribute_ipv4,
9257 no_bgp_redistribute_ipv4_cmd,
e0ca5fde 9258 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD,
718e3744 9259 NO_STR
9260 "Redistribute information from another routing protocol\n"
e0ca5fde 9261 QUAGGA_IP_REDIST_HELP_STR_BGPD)
718e3744 9262{
9263 int type;
9264
e0ca5fde
DL
9265 type = proto_redistnum (AFI_IP, argv[0]);
9266 if (type < 0 || type == ZEBRA_ROUTE_BGP)
718e3744 9267 {
9268 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9269 return CMD_WARNING;
9270 }
9271
9272 return bgp_redistribute_unset (vty->index, AFI_IP, type);
9273}
9274
9275DEFUN (no_bgp_redistribute_ipv4_rmap,
9276 no_bgp_redistribute_ipv4_rmap_cmd,
e0ca5fde 9277 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD",
718e3744 9278 NO_STR
9279 "Redistribute information from another routing protocol\n"
e0ca5fde 9280 QUAGGA_IP_REDIST_HELP_STR_BGPD
718e3744 9281 "Route map reference\n"
9282 "Pointer to route-map entries\n")
9283{
9284 int type;
9285
e0ca5fde
DL
9286 type = proto_redistnum (AFI_IP, argv[0]);
9287 if (type < 0 || type == ZEBRA_ROUTE_BGP)
718e3744 9288 {
9289 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9290 return CMD_WARNING;
9291 }
9292
9293 bgp_redistribute_routemap_unset (vty->index, AFI_IP, type);
9294 return CMD_SUCCESS;
9295}
9296
9297DEFUN (no_bgp_redistribute_ipv4_metric,
9298 no_bgp_redistribute_ipv4_metric_cmd,
e0ca5fde 9299 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295>",
718e3744 9300 NO_STR
9301 "Redistribute information from another routing protocol\n"
e0ca5fde 9302 QUAGGA_IP_REDIST_HELP_STR_BGPD
718e3744 9303 "Metric for redistributed routes\n"
9304 "Default metric\n")
9305{
9306 int type;
9307
e0ca5fde
DL
9308 type = proto_redistnum (AFI_IP, argv[0]);
9309 if (type < 0 || type == ZEBRA_ROUTE_BGP)
718e3744 9310 {
9311 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9312 return CMD_WARNING;
9313 }
9314
9315 bgp_redistribute_metric_unset (vty->index, AFI_IP, type);
9316 return CMD_SUCCESS;
9317}
9318
9319DEFUN (no_bgp_redistribute_ipv4_rmap_metric,
9320 no_bgp_redistribute_ipv4_rmap_metric_cmd,
e0ca5fde 9321 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
718e3744 9322 NO_STR
9323 "Redistribute information from another routing protocol\n"
e0ca5fde 9324 QUAGGA_IP_REDIST_HELP_STR_BGPD
718e3744 9325 "Route map reference\n"
9326 "Pointer to route-map entries\n"
9327 "Metric for redistributed routes\n"
9328 "Default metric\n")
9329{
9330 int type;
9331
e0ca5fde
DL
9332 type = proto_redistnum (AFI_IP, argv[0]);
9333 if (type < 0 || type == ZEBRA_ROUTE_BGP)
718e3744 9334 {
9335 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9336 return CMD_WARNING;
9337 }
9338
9339 bgp_redistribute_metric_unset (vty->index, AFI_IP, type);
9340 bgp_redistribute_routemap_unset (vty->index, AFI_IP, type);
9341 return CMD_SUCCESS;
9342}
9343
9344ALIAS (no_bgp_redistribute_ipv4_rmap_metric,
9345 no_bgp_redistribute_ipv4_metric_rmap_cmd,
e0ca5fde 9346 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
718e3744 9347 NO_STR
9348 "Redistribute information from another routing protocol\n"
e0ca5fde 9349 QUAGGA_IP_REDIST_HELP_STR_BGPD
718e3744 9350 "Metric for redistributed routes\n"
9351 "Default metric\n"
9352 "Route map reference\n"
9353 "Pointer to route-map entries\n")
6b0655a2 9354
718e3744 9355#ifdef HAVE_IPV6
9356DEFUN (bgp_redistribute_ipv6,
9357 bgp_redistribute_ipv6_cmd,
e0ca5fde 9358 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD,
718e3744 9359 "Redistribute information from another routing protocol\n"
e0ca5fde 9360 QUAGGA_IP6_REDIST_HELP_STR_BGPD)
718e3744 9361{
9362 int type;
9363
e0ca5fde
DL
9364 type = proto_redistnum (AFI_IP6, argv[0]);
9365 if (type < 0 || type == ZEBRA_ROUTE_BGP)
718e3744 9366 {
9367 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9368 return CMD_WARNING;
9369 }
9370
9371 return bgp_redistribute_set (vty->index, AFI_IP6, type);
9372}
9373
9374DEFUN (bgp_redistribute_ipv6_rmap,
9375 bgp_redistribute_ipv6_rmap_cmd,
e0ca5fde 9376 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD",
718e3744 9377 "Redistribute information from another routing protocol\n"
e0ca5fde 9378 QUAGGA_IP6_REDIST_HELP_STR_BGPD
718e3744 9379 "Route map reference\n"
9380 "Pointer to route-map entries\n")
9381{
9382 int type;
9383
e0ca5fde
DL
9384 type = proto_redistnum (AFI_IP6, argv[0]);
9385 if (type < 0 || type == ZEBRA_ROUTE_BGP)
718e3744 9386 {
9387 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9388 return CMD_WARNING;
9389 }
9390
9391 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]);
9392 return bgp_redistribute_set (vty->index, AFI_IP6, type);
9393}
9394
9395DEFUN (bgp_redistribute_ipv6_metric,
9396 bgp_redistribute_ipv6_metric_cmd,
e0ca5fde 9397 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>",
718e3744 9398 "Redistribute information from another routing protocol\n"
e0ca5fde 9399 QUAGGA_IP6_REDIST_HELP_STR_BGPD
718e3744 9400 "Metric for redistributed routes\n"
9401 "Default metric\n")
9402{
9403 int type;
9404 u_int32_t metric;
9405
e0ca5fde
DL
9406 type = proto_redistnum (AFI_IP6, argv[0]);
9407 if (type < 0 || type == ZEBRA_ROUTE_BGP)
718e3744 9408 {
9409 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9410 return CMD_WARNING;
9411 }
9412 VTY_GET_INTEGER ("metric", metric, argv[1]);
9413
9414 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
9415 return bgp_redistribute_set (vty->index, AFI_IP6, type);
9416}
9417
9418DEFUN (bgp_redistribute_ipv6_rmap_metric,
9419 bgp_redistribute_ipv6_rmap_metric_cmd,
e0ca5fde 9420 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
718e3744 9421 "Redistribute information from another routing protocol\n"
e0ca5fde 9422 QUAGGA_IP6_REDIST_HELP_STR_BGPD
718e3744 9423 "Route map reference\n"
9424 "Pointer to route-map entries\n"
9425 "Metric for redistributed routes\n"
9426 "Default metric\n")
9427{
9428 int type;
9429 u_int32_t metric;
9430
e0ca5fde
DL
9431 type = proto_redistnum (AFI_IP6, argv[0]);
9432 if (type < 0 || type == ZEBRA_ROUTE_BGP)
718e3744 9433 {
9434 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9435 return CMD_WARNING;
9436 }
9437 VTY_GET_INTEGER ("metric", metric, argv[2]);
9438
9439 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[1]);
9440 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
9441 return bgp_redistribute_set (vty->index, AFI_IP6, type);
9442}
9443
9444DEFUN (bgp_redistribute_ipv6_metric_rmap,
9445 bgp_redistribute_ipv6_metric_rmap_cmd,
e0ca5fde 9446 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
718e3744 9447 "Redistribute information from another routing protocol\n"
e0ca5fde 9448 QUAGGA_IP6_REDIST_HELP_STR_BGPD
718e3744 9449 "Metric for redistributed routes\n"
9450 "Default metric\n"
9451 "Route map reference\n"
9452 "Pointer to route-map entries\n")
9453{
9454 int type;
9455 u_int32_t metric;
9456
e0ca5fde
DL
9457 type = proto_redistnum (AFI_IP6, argv[0]);
9458 if (type < 0 || type == ZEBRA_ROUTE_BGP)
718e3744 9459 {
9460 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9461 return CMD_WARNING;
9462 }
9463 VTY_GET_INTEGER ("metric", metric, argv[1]);
9464
9465 bgp_redistribute_metric_set (vty->index, AFI_IP6, type, metric);
9466 bgp_redistribute_rmap_set (vty->index, AFI_IP6, type, argv[2]);
9467 return bgp_redistribute_set (vty->index, AFI_IP6, type);
9468}
9469
9470DEFUN (no_bgp_redistribute_ipv6,
9471 no_bgp_redistribute_ipv6_cmd,
e0ca5fde 9472 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD,
718e3744 9473 NO_STR
9474 "Redistribute information from another routing protocol\n"
e0ca5fde 9475 QUAGGA_IP6_REDIST_HELP_STR_BGPD)
718e3744 9476{
9477 int type;
9478
e0ca5fde
DL
9479 type = proto_redistnum (AFI_IP6, argv[0]);
9480 if (type < 0 || type == ZEBRA_ROUTE_BGP)
718e3744 9481 {
9482 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9483 return CMD_WARNING;
9484 }
9485
9486 return bgp_redistribute_unset (vty->index, AFI_IP6, type);
9487}
9488
9489DEFUN (no_bgp_redistribute_ipv6_rmap,
9490 no_bgp_redistribute_ipv6_rmap_cmd,
e0ca5fde 9491 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD",
718e3744 9492 NO_STR
9493 "Redistribute information from another routing protocol\n"
e0ca5fde 9494 QUAGGA_IP6_REDIST_HELP_STR_BGPD
718e3744 9495 "Route map reference\n"
9496 "Pointer to route-map entries\n")
9497{
9498 int type;
9499
e0ca5fde
DL
9500 type = proto_redistnum (AFI_IP6, argv[0]);
9501 if (type < 0 || type == ZEBRA_ROUTE_BGP)
718e3744 9502 {
9503 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9504 return CMD_WARNING;
9505 }
9506
9507 bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type);
9508 return CMD_SUCCESS;
9509}
9510
9511DEFUN (no_bgp_redistribute_ipv6_metric,
9512 no_bgp_redistribute_ipv6_metric_cmd,
e0ca5fde 9513 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295>",
718e3744 9514 NO_STR
9515 "Redistribute information from another routing protocol\n"
e0ca5fde 9516 QUAGGA_IP6_REDIST_HELP_STR_BGPD
718e3744 9517 "Metric for redistributed routes\n"
9518 "Default metric\n")
9519{
9520 int type;
9521
e0ca5fde
DL
9522 type = proto_redistnum (AFI_IP6, argv[0]);
9523 if (type < 0 || type == ZEBRA_ROUTE_BGP)
718e3744 9524 {
9525 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9526 return CMD_WARNING;
9527 }
9528
9529 bgp_redistribute_metric_unset (vty->index, AFI_IP6, type);
9530 return CMD_SUCCESS;
9531}
9532
9533DEFUN (no_bgp_redistribute_ipv6_rmap_metric,
9534 no_bgp_redistribute_ipv6_rmap_metric_cmd,
e0ca5fde 9535 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " route-map WORD metric <0-4294967295>",
718e3744 9536 NO_STR
9537 "Redistribute information from another routing protocol\n"
e0ca5fde 9538 QUAGGA_IP6_REDIST_HELP_STR_BGPD
718e3744 9539 "Route map reference\n"
9540 "Pointer to route-map entries\n"
9541 "Metric for redistributed routes\n"
9542 "Default metric\n")
9543{
9544 int type;
9545
e0ca5fde
DL
9546 type = proto_redistnum (AFI_IP6, argv[0]);
9547 if (type < 0 || type == ZEBRA_ROUTE_BGP)
718e3744 9548 {
9549 vty_out (vty, "%% Invalid route type%s", VTY_NEWLINE);
9550 return CMD_WARNING;
9551 }
9552
9553 bgp_redistribute_metric_unset (vty->index, AFI_IP6, type);
9554 bgp_redistribute_routemap_unset (vty->index, AFI_IP6, type);
9555 return CMD_SUCCESS;
9556}
9557
9558ALIAS (no_bgp_redistribute_ipv6_rmap_metric,
9559 no_bgp_redistribute_ipv6_metric_rmap_cmd,
e0ca5fde 9560 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD " metric <0-4294967295> route-map WORD",
718e3744 9561 NO_STR
9562 "Redistribute information from another routing protocol\n"
e0ca5fde 9563 QUAGGA_IP6_REDIST_HELP_STR_BGPD
718e3744 9564 "Metric for redistributed routes\n"
9565 "Default metric\n"
9566 "Route map reference\n"
9567 "Pointer to route-map entries\n")
9568#endif /* HAVE_IPV6 */
6b0655a2 9569
718e3744 9570int
9571bgp_config_write_redistribute (struct vty *vty, struct bgp *bgp, afi_t afi,
9572 safi_t safi, int *write)
9573{
9574 int i;
718e3744 9575
9576 /* Unicast redistribution only. */
9577 if (safi != SAFI_UNICAST)
9578 return 0;
9579
9580 for (i = 0; i < ZEBRA_ROUTE_MAX; i++)
9581 {
9582 /* Redistribute BGP does not make sense. */
9583 if (bgp->redist[afi][i] && i != ZEBRA_ROUTE_BGP)
9584 {
9585 /* Display "address-family" when it is not yet diplayed. */
9586 bgp_config_write_family_header (vty, afi, safi, write);
9587
9588 /* "redistribute" configuration. */
f52d13cb 9589 vty_out (vty, " redistribute %s", zebra_route_string(i));
718e3744 9590
9591 if (bgp->redist_metric_flag[afi][i])
ddc943de 9592 vty_out (vty, " metric %u", bgp->redist_metric[afi][i]);
718e3744 9593
9594 if (bgp->rmap[afi][i].name)
9595 vty_out (vty, " route-map %s", bgp->rmap[afi][i].name);
9596
9597 vty_out (vty, "%s", VTY_NEWLINE);
9598 }
9599 }
9600 return *write;
9601}
6b0655a2 9602
718e3744 9603/* BGP node structure. */
7fc626de 9604static struct cmd_node bgp_node =
718e3744 9605{
9606 BGP_NODE,
9607 "%s(config-router)# ",
9608 1,
9609};
9610
7fc626de 9611static struct cmd_node bgp_ipv4_unicast_node =
718e3744 9612{
9613 BGP_IPV4_NODE,
9614 "%s(config-router-af)# ",
9615 1,
9616};
9617
7fc626de 9618static struct cmd_node bgp_ipv4_multicast_node =
718e3744 9619{
9620 BGP_IPV4M_NODE,
9621 "%s(config-router-af)# ",
9622 1,
9623};
9624
7fc626de 9625static struct cmd_node bgp_ipv6_unicast_node =
718e3744 9626{
9627 BGP_IPV6_NODE,
9628 "%s(config-router-af)# ",
9629 1,
9630};
9631
7fc626de 9632static struct cmd_node bgp_ipv6_multicast_node =
25ffbdc1 9633{
9634 BGP_IPV6M_NODE,
9635 "%s(config-router-af)# ",
9636 1,
9637};
9638
7fc626de 9639static struct cmd_node bgp_vpnv4_node =
718e3744 9640{
9641 BGP_VPNV4_NODE,
9642 "%s(config-router-af)# ",
9643 1
9644};
6b0655a2 9645
1f8ae70b 9646static void community_list_vty (void);
9647
718e3744 9648void
94f2b392 9649bgp_vty_init (void)
718e3744 9650{
718e3744 9651 /* Install bgp top node. */
9652 install_node (&bgp_node, bgp_config_write);
9653 install_node (&bgp_ipv4_unicast_node, NULL);
9654 install_node (&bgp_ipv4_multicast_node, NULL);
9655 install_node (&bgp_ipv6_unicast_node, NULL);
25ffbdc1 9656 install_node (&bgp_ipv6_multicast_node, NULL);
718e3744 9657 install_node (&bgp_vpnv4_node, NULL);
9658
9659 /* Install default VTY commands to new nodes. */
9660 install_default (BGP_NODE);
9661 install_default (BGP_IPV4_NODE);
9662 install_default (BGP_IPV4M_NODE);
9663 install_default (BGP_IPV6_NODE);
25ffbdc1 9664 install_default (BGP_IPV6M_NODE);
718e3744 9665 install_default (BGP_VPNV4_NODE);
9666
9667 /* "bgp multiple-instance" commands. */
9668 install_element (CONFIG_NODE, &bgp_multiple_instance_cmd);
9669 install_element (CONFIG_NODE, &no_bgp_multiple_instance_cmd);
9670
9671 /* "bgp config-type" commands. */
9672 install_element (CONFIG_NODE, &bgp_config_type_cmd);
9673 install_element (CONFIG_NODE, &no_bgp_config_type_cmd);
9674
9675 /* Dummy commands (Currently not supported) */
9676 install_element (BGP_NODE, &no_synchronization_cmd);
9677 install_element (BGP_NODE, &no_auto_summary_cmd);
9678
9679 /* "router bgp" commands. */
9680 install_element (CONFIG_NODE, &router_bgp_cmd);
9681 install_element (CONFIG_NODE, &router_bgp_view_cmd);
9682
9683 /* "no router bgp" commands. */
9684 install_element (CONFIG_NODE, &no_router_bgp_cmd);
9685 install_element (CONFIG_NODE, &no_router_bgp_view_cmd);
9686
9687 /* "bgp router-id" commands. */
9688 install_element (BGP_NODE, &bgp_router_id_cmd);
9689 install_element (BGP_NODE, &no_bgp_router_id_cmd);
9690 install_element (BGP_NODE, &no_bgp_router_id_val_cmd);
9691
9692 /* "bgp cluster-id" commands. */
9693 install_element (BGP_NODE, &bgp_cluster_id_cmd);
9694 install_element (BGP_NODE, &bgp_cluster_id32_cmd);
9695 install_element (BGP_NODE, &no_bgp_cluster_id_cmd);
9696 install_element (BGP_NODE, &no_bgp_cluster_id_arg_cmd);
9697
9698 /* "bgp confederation" commands. */
9699 install_element (BGP_NODE, &bgp_confederation_identifier_cmd);
9700 install_element (BGP_NODE, &no_bgp_confederation_identifier_cmd);
9701 install_element (BGP_NODE, &no_bgp_confederation_identifier_arg_cmd);
9702
9703 /* "bgp confederation peers" commands. */
9704 install_element (BGP_NODE, &bgp_confederation_peers_cmd);
9705 install_element (BGP_NODE, &no_bgp_confederation_peers_cmd);
9706
f188f2c4
DS
9707 /* bgp update-delay command */
9708 install_element (BGP_NODE, &bgp_update_delay_cmd);
9709 install_element (BGP_NODE, &no_bgp_update_delay_cmd);
9710 install_element (BGP_NODE, &bgp_update_delay_establish_wait_cmd);
9711 install_element (BGP_NODE, &no_bgp_update_delay_establish_wait_cmd);
9712
cb1faec9
DS
9713 install_element (BGP_NODE, &bgp_wpkt_quanta_cmd);
9714 install_element (BGP_NODE, &no_bgp_wpkt_quanta_cmd);
9715
165b5fff
JB
9716 /* "maximum-paths" commands. */
9717 install_element (BGP_NODE, &bgp_maxpaths_cmd);
9718 install_element (BGP_NODE, &no_bgp_maxpaths_cmd);
9719 install_element (BGP_NODE, &no_bgp_maxpaths_arg_cmd);
9720 install_element (BGP_IPV4_NODE, &bgp_maxpaths_cmd);
9721 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_cmd);
9722 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_arg_cmd);
431aa9f9
DS
9723 install_element (BGP_IPV6_NODE, &bgp_maxpaths_cmd);
9724 install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_cmd);
9725 install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_arg_cmd);
165b5fff 9726 install_element (BGP_NODE, &bgp_maxpaths_ibgp_cmd);
5e242b0d 9727 install_element(BGP_NODE, &bgp_maxpaths_ibgp_cluster_cmd);
165b5fff
JB
9728 install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_cmd);
9729 install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_arg_cmd);
5e242b0d 9730 install_element (BGP_NODE, &no_bgp_maxpaths_ibgp_cluster_cmd);
165b5fff 9731 install_element (BGP_IPV4_NODE, &bgp_maxpaths_ibgp_cmd);
5e242b0d 9732 install_element(BGP_IPV4_NODE, &bgp_maxpaths_ibgp_cluster_cmd);
165b5fff 9733 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_cmd);
5e242b0d 9734 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_cluster_cmd);
165b5fff 9735 install_element (BGP_IPV4_NODE, &no_bgp_maxpaths_ibgp_arg_cmd);
431aa9f9 9736 install_element (BGP_IPV6_NODE, &bgp_maxpaths_ibgp_cmd);
5e242b0d 9737 install_element(BGP_IPV6_NODE, &bgp_maxpaths_ibgp_cluster_cmd);
431aa9f9
DS
9738 install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_ibgp_cmd);
9739 install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_ibgp_arg_cmd);
5e242b0d 9740 install_element (BGP_IPV6_NODE, &no_bgp_maxpaths_ibgp_cluster_cmd);
165b5fff 9741
718e3744 9742 /* "timers bgp" commands. */
9743 install_element (BGP_NODE, &bgp_timers_cmd);
9744 install_element (BGP_NODE, &no_bgp_timers_cmd);
9745 install_element (BGP_NODE, &no_bgp_timers_arg_cmd);
9746
9747 /* "bgp client-to-client reflection" commands */
9748 install_element (BGP_NODE, &no_bgp_client_to_client_reflection_cmd);
9749 install_element (BGP_NODE, &bgp_client_to_client_reflection_cmd);
9750
9751 /* "bgp always-compare-med" commands */
9752 install_element (BGP_NODE, &bgp_always_compare_med_cmd);
9753 install_element (BGP_NODE, &no_bgp_always_compare_med_cmd);
9754
9755 /* "bgp deterministic-med" commands */
9756 install_element (BGP_NODE, &bgp_deterministic_med_cmd);
9757 install_element (BGP_NODE, &no_bgp_deterministic_med_cmd);
538621f2 9758
538621f2 9759 /* "bgp graceful-restart" commands */
9760 install_element (BGP_NODE, &bgp_graceful_restart_cmd);
9761 install_element (BGP_NODE, &no_bgp_graceful_restart_cmd);
93406d87 9762 install_element (BGP_NODE, &bgp_graceful_restart_stalepath_time_cmd);
9763 install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_cmd);
9764 install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_val_cmd);
718e3744 9765
9766 /* "bgp fast-external-failover" commands */
9767 install_element (BGP_NODE, &bgp_fast_external_failover_cmd);
9768 install_element (BGP_NODE, &no_bgp_fast_external_failover_cmd);
9769
9770 /* "bgp enforce-first-as" commands */
9771 install_element (BGP_NODE, &bgp_enforce_first_as_cmd);
9772 install_element (BGP_NODE, &no_bgp_enforce_first_as_cmd);
9773
9774 /* "bgp bestpath compare-routerid" commands */
9775 install_element (BGP_NODE, &bgp_bestpath_compare_router_id_cmd);
9776 install_element (BGP_NODE, &no_bgp_bestpath_compare_router_id_cmd);
9777
9778 /* "bgp bestpath as-path ignore" commands */
9779 install_element (BGP_NODE, &bgp_bestpath_aspath_ignore_cmd);
9780 install_element (BGP_NODE, &no_bgp_bestpath_aspath_ignore_cmd);
9781
6811845b 9782 /* "bgp bestpath as-path confed" commands */
9783 install_element (BGP_NODE, &bgp_bestpath_aspath_confed_cmd);
9784 install_element (BGP_NODE, &no_bgp_bestpath_aspath_confed_cmd);
9785
2fdd455c
PM
9786 /* "bgp bestpath as-path multipath-relax" commands */
9787 install_element (BGP_NODE, &bgp_bestpath_aspath_multipath_relax_cmd);
9788 install_element (BGP_NODE, &no_bgp_bestpath_aspath_multipath_relax_cmd);
9789
848973c7 9790 /* "bgp log-neighbor-changes" commands */
9791 install_element (BGP_NODE, &bgp_log_neighbor_changes_cmd);
9792 install_element (BGP_NODE, &no_bgp_log_neighbor_changes_cmd);
9793
718e3744 9794 /* "bgp bestpath med" commands */
9795 install_element (BGP_NODE, &bgp_bestpath_med_cmd);
9796 install_element (BGP_NODE, &bgp_bestpath_med2_cmd);
9797 install_element (BGP_NODE, &bgp_bestpath_med3_cmd);
9798 install_element (BGP_NODE, &no_bgp_bestpath_med_cmd);
9799 install_element (BGP_NODE, &no_bgp_bestpath_med2_cmd);
9800 install_element (BGP_NODE, &no_bgp_bestpath_med3_cmd);
9801
9802 /* "no bgp default ipv4-unicast" commands. */
9803 install_element (BGP_NODE, &no_bgp_default_ipv4_unicast_cmd);
9804 install_element (BGP_NODE, &bgp_default_ipv4_unicast_cmd);
9805
9806 /* "bgp network import-check" commands. */
9807 install_element (BGP_NODE, &bgp_network_import_check_cmd);
9808 install_element (BGP_NODE, &no_bgp_network_import_check_cmd);
9809
9810 /* "bgp default local-preference" commands. */
9811 install_element (BGP_NODE, &bgp_default_local_preference_cmd);
9812 install_element (BGP_NODE, &no_bgp_default_local_preference_cmd);
9813 install_element (BGP_NODE, &no_bgp_default_local_preference_val_cmd);
9814
8bd9d948
DS
9815 /* bgp ibgp-allow-policy-mods command */
9816 install_element (BGP_NODE, &bgp_rr_allow_outbound_policy_cmd);
9817 install_element (BGP_NODE, &no_bgp_rr_allow_outbound_policy_cmd);
9818
718e3744 9819 /* "neighbor remote-as" commands. */
9820 install_element (BGP_NODE, &neighbor_remote_as_cmd);
a80beece 9821 install_element (BGP_NODE, &neighbor_interface_config_cmd);
718e3744 9822 install_element (BGP_NODE, &no_neighbor_cmd);
9823 install_element (BGP_NODE, &no_neighbor_remote_as_cmd);
a80beece 9824 install_element (BGP_NODE, &no_neighbor_interface_config_cmd);
718e3744 9825
9826 /* "neighbor peer-group" commands. */
9827 install_element (BGP_NODE, &neighbor_peer_group_cmd);
9828 install_element (BGP_NODE, &no_neighbor_peer_group_cmd);
a80beece 9829 install_element (BGP_NODE, &no_neighbor_interface_peer_group_remote_as_cmd);
718e3744 9830
9831 /* "neighbor local-as" commands. */
9832 install_element (BGP_NODE, &neighbor_local_as_cmd);
9833 install_element (BGP_NODE, &neighbor_local_as_no_prepend_cmd);
9d3f9705 9834 install_element (BGP_NODE, &neighbor_local_as_no_prepend_replace_as_cmd);
718e3744 9835 install_element (BGP_NODE, &no_neighbor_local_as_cmd);
9836 install_element (BGP_NODE, &no_neighbor_local_as_val_cmd);
9837 install_element (BGP_NODE, &no_neighbor_local_as_val2_cmd);
9d3f9705 9838 install_element (BGP_NODE, &no_neighbor_local_as_val3_cmd);
718e3744 9839
0df7c91f
PJ
9840 /* "neighbor password" commands. */
9841 install_element (BGP_NODE, &neighbor_password_cmd);
9842 install_element (BGP_NODE, &no_neighbor_password_cmd);
9843
718e3744 9844 /* "neighbor activate" commands. */
9845 install_element (BGP_NODE, &neighbor_activate_cmd);
9846 install_element (BGP_IPV4_NODE, &neighbor_activate_cmd);
9847 install_element (BGP_IPV4M_NODE, &neighbor_activate_cmd);
9848 install_element (BGP_IPV6_NODE, &neighbor_activate_cmd);
25ffbdc1 9849 install_element (BGP_IPV6M_NODE, &neighbor_activate_cmd);
718e3744 9850 install_element (BGP_VPNV4_NODE, &neighbor_activate_cmd);
9851
9852 /* "no neighbor activate" commands. */
9853 install_element (BGP_NODE, &no_neighbor_activate_cmd);
9854 install_element (BGP_IPV4_NODE, &no_neighbor_activate_cmd);
9855 install_element (BGP_IPV4M_NODE, &no_neighbor_activate_cmd);
9856 install_element (BGP_IPV6_NODE, &no_neighbor_activate_cmd);
25ffbdc1 9857 install_element (BGP_IPV6M_NODE, &no_neighbor_activate_cmd);
718e3744 9858 install_element (BGP_VPNV4_NODE, &no_neighbor_activate_cmd);
9859
9860 /* "neighbor peer-group set" commands. */
9861 install_element (BGP_NODE, &neighbor_set_peer_group_cmd);
9862 install_element (BGP_IPV4_NODE, &neighbor_set_peer_group_cmd);
9863 install_element (BGP_IPV4M_NODE, &neighbor_set_peer_group_cmd);
9864 install_element (BGP_IPV6_NODE, &neighbor_set_peer_group_cmd);
25ffbdc1 9865 install_element (BGP_IPV6M_NODE, &neighbor_set_peer_group_cmd);
a58545bb 9866 install_element (BGP_VPNV4_NODE, &neighbor_set_peer_group_cmd);
9867
718e3744 9868 /* "no neighbor peer-group unset" commands. */
9869 install_element (BGP_NODE, &no_neighbor_set_peer_group_cmd);
9870 install_element (BGP_IPV4_NODE, &no_neighbor_set_peer_group_cmd);
9871 install_element (BGP_IPV4M_NODE, &no_neighbor_set_peer_group_cmd);
9872 install_element (BGP_IPV6_NODE, &no_neighbor_set_peer_group_cmd);
25ffbdc1 9873 install_element (BGP_IPV6M_NODE, &no_neighbor_set_peer_group_cmd);
a58545bb 9874 install_element (BGP_VPNV4_NODE, &no_neighbor_set_peer_group_cmd);
9875
718e3744 9876 /* "neighbor softreconfiguration inbound" commands.*/
9877 install_element (BGP_NODE, &neighbor_soft_reconfiguration_cmd);
9878 install_element (BGP_NODE, &no_neighbor_soft_reconfiguration_cmd);
9879 install_element (BGP_IPV4_NODE, &neighbor_soft_reconfiguration_cmd);
9880 install_element (BGP_IPV4_NODE, &no_neighbor_soft_reconfiguration_cmd);
9881 install_element (BGP_IPV4M_NODE, &neighbor_soft_reconfiguration_cmd);
9882 install_element (BGP_IPV4M_NODE, &no_neighbor_soft_reconfiguration_cmd);
9883 install_element (BGP_IPV6_NODE, &neighbor_soft_reconfiguration_cmd);
9884 install_element (BGP_IPV6_NODE, &no_neighbor_soft_reconfiguration_cmd);
25ffbdc1 9885 install_element (BGP_IPV6M_NODE, &neighbor_soft_reconfiguration_cmd);
9886 install_element (BGP_IPV6M_NODE, &no_neighbor_soft_reconfiguration_cmd);
a58545bb 9887 install_element (BGP_VPNV4_NODE, &neighbor_soft_reconfiguration_cmd);
9888 install_element (BGP_VPNV4_NODE, &no_neighbor_soft_reconfiguration_cmd);
718e3744 9889
9890 /* "neighbor attribute-unchanged" commands. */
9891 install_element (BGP_NODE, &neighbor_attr_unchanged_cmd);
9892 install_element (BGP_NODE, &neighbor_attr_unchanged1_cmd);
9893 install_element (BGP_NODE, &neighbor_attr_unchanged2_cmd);
9894 install_element (BGP_NODE, &neighbor_attr_unchanged3_cmd);
9895 install_element (BGP_NODE, &neighbor_attr_unchanged4_cmd);
9896 install_element (BGP_NODE, &neighbor_attr_unchanged5_cmd);
9897 install_element (BGP_NODE, &neighbor_attr_unchanged6_cmd);
9898 install_element (BGP_NODE, &neighbor_attr_unchanged7_cmd);
9899 install_element (BGP_NODE, &neighbor_attr_unchanged8_cmd);
9900 install_element (BGP_NODE, &neighbor_attr_unchanged9_cmd);
9901 install_element (BGP_NODE, &neighbor_attr_unchanged10_cmd);
9902 install_element (BGP_NODE, &no_neighbor_attr_unchanged_cmd);
9903 install_element (BGP_NODE, &no_neighbor_attr_unchanged1_cmd);
9904 install_element (BGP_NODE, &no_neighbor_attr_unchanged2_cmd);
9905 install_element (BGP_NODE, &no_neighbor_attr_unchanged3_cmd);
9906 install_element (BGP_NODE, &no_neighbor_attr_unchanged4_cmd);
9907 install_element (BGP_NODE, &no_neighbor_attr_unchanged5_cmd);
9908 install_element (BGP_NODE, &no_neighbor_attr_unchanged6_cmd);
9909 install_element (BGP_NODE, &no_neighbor_attr_unchanged7_cmd);
9910 install_element (BGP_NODE, &no_neighbor_attr_unchanged8_cmd);
9911 install_element (BGP_NODE, &no_neighbor_attr_unchanged9_cmd);
9912 install_element (BGP_NODE, &no_neighbor_attr_unchanged10_cmd);
9913 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged_cmd);
9914 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged1_cmd);
9915 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged2_cmd);
9916 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged3_cmd);
9917 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged4_cmd);
9918 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged5_cmd);
9919 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged6_cmd);
9920 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged7_cmd);
9921 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged8_cmd);
9922 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged9_cmd);
9923 install_element (BGP_IPV4_NODE, &neighbor_attr_unchanged10_cmd);
9924 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged_cmd);
9925 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged1_cmd);
9926 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged2_cmd);
9927 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged3_cmd);
9928 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged4_cmd);
9929 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged5_cmd);
9930 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged6_cmd);
9931 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged7_cmd);
9932 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged8_cmd);
9933 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged9_cmd);
9934 install_element (BGP_IPV4_NODE, &no_neighbor_attr_unchanged10_cmd);
9935 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged_cmd);
9936 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged1_cmd);
9937 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged2_cmd);
9938 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged3_cmd);
9939 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged4_cmd);
9940 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged5_cmd);
9941 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged6_cmd);
9942 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged7_cmd);
9943 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged8_cmd);
9944 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged9_cmd);
9945 install_element (BGP_IPV4M_NODE, &neighbor_attr_unchanged10_cmd);
9946 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged_cmd);
9947 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged1_cmd);
9948 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged2_cmd);
9949 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged3_cmd);
9950 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged4_cmd);
9951 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged5_cmd);
9952 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged6_cmd);
9953 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged7_cmd);
9954 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged8_cmd);
9955 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged9_cmd);
9956 install_element (BGP_IPV4M_NODE, &no_neighbor_attr_unchanged10_cmd);
9957 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged_cmd);
9958 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged1_cmd);
9959 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged2_cmd);
9960 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged3_cmd);
9961 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged4_cmd);
9962 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged5_cmd);
9963 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged6_cmd);
9964 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged7_cmd);
9965 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged8_cmd);
9966 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged9_cmd);
9967 install_element (BGP_IPV6_NODE, &neighbor_attr_unchanged10_cmd);
9968 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged_cmd);
9969 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged1_cmd);
9970 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged2_cmd);
9971 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged3_cmd);
9972 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged4_cmd);
9973 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged5_cmd);
9974 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged6_cmd);
9975 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged7_cmd);
9976 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged8_cmd);
9977 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged9_cmd);
9978 install_element (BGP_IPV6_NODE, &no_neighbor_attr_unchanged10_cmd);
25ffbdc1 9979 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged_cmd);
9980 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged1_cmd);
9981 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged2_cmd);
9982 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged3_cmd);
9983 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged4_cmd);
9984 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged5_cmd);
9985 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged6_cmd);
9986 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged7_cmd);
9987 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged8_cmd);
9988 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged9_cmd);
9989 install_element (BGP_IPV6M_NODE, &neighbor_attr_unchanged10_cmd);
9990 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged_cmd);
9991 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged1_cmd);
9992 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged2_cmd);
9993 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged3_cmd);
9994 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged4_cmd);
9995 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged5_cmd);
9996 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged6_cmd);
9997 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged7_cmd);
9998 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged8_cmd);
9999 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged9_cmd);
10000 install_element (BGP_IPV6M_NODE, &no_neighbor_attr_unchanged10_cmd);
718e3744 10001 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged_cmd);
10002 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged1_cmd);
10003 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged2_cmd);
10004 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged3_cmd);
10005 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged4_cmd);
10006 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged5_cmd);
10007 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged6_cmd);
10008 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged7_cmd);
10009 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged8_cmd);
10010 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged9_cmd);
10011 install_element (BGP_VPNV4_NODE, &neighbor_attr_unchanged10_cmd);
10012 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged_cmd);
10013 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged1_cmd);
10014 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged2_cmd);
10015 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged3_cmd);
10016 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged4_cmd);
10017 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged5_cmd);
10018 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged6_cmd);
10019 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged7_cmd);
10020 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged8_cmd);
10021 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged9_cmd);
10022 install_element (BGP_VPNV4_NODE, &no_neighbor_attr_unchanged10_cmd);
10023
fee0f4c6 10024 /* "nexthop-local unchanged" commands */
10025 install_element (BGP_IPV6_NODE, &neighbor_nexthop_local_unchanged_cmd);
10026 install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_local_unchanged_cmd);
10027
718e3744 10028 /* "transparent-as" and "transparent-nexthop" for old version
10029 compatibility. */
10030 install_element (BGP_NODE, &neighbor_transparent_as_cmd);
10031 install_element (BGP_NODE, &neighbor_transparent_nexthop_cmd);
10032
10033 /* "neighbor next-hop-self" commands. */
10034 install_element (BGP_NODE, &neighbor_nexthop_self_cmd);
10035 install_element (BGP_NODE, &no_neighbor_nexthop_self_cmd);
10036 install_element (BGP_IPV4_NODE, &neighbor_nexthop_self_cmd);
10037 install_element (BGP_IPV4_NODE, &no_neighbor_nexthop_self_cmd);
10038 install_element (BGP_IPV4M_NODE, &neighbor_nexthop_self_cmd);
10039 install_element (BGP_IPV4M_NODE, &no_neighbor_nexthop_self_cmd);
10040 install_element (BGP_IPV6_NODE, &neighbor_nexthop_self_cmd);
10041 install_element (BGP_IPV6_NODE, &no_neighbor_nexthop_self_cmd);
25ffbdc1 10042 install_element (BGP_IPV6M_NODE, &neighbor_nexthop_self_cmd);
10043 install_element (BGP_IPV6M_NODE, &no_neighbor_nexthop_self_cmd);
718e3744 10044 install_element (BGP_VPNV4_NODE, &neighbor_nexthop_self_cmd);
10045 install_element (BGP_VPNV4_NODE, &no_neighbor_nexthop_self_cmd);
10046
10047 /* "neighbor remove-private-AS" commands. */
10048 install_element (BGP_NODE, &neighbor_remove_private_as_cmd);
10049 install_element (BGP_NODE, &no_neighbor_remove_private_as_cmd);
10050 install_element (BGP_IPV4_NODE, &neighbor_remove_private_as_cmd);
10051 install_element (BGP_IPV4_NODE, &no_neighbor_remove_private_as_cmd);
10052 install_element (BGP_IPV4M_NODE, &neighbor_remove_private_as_cmd);
10053 install_element (BGP_IPV4M_NODE, &no_neighbor_remove_private_as_cmd);
10054 install_element (BGP_IPV6_NODE, &neighbor_remove_private_as_cmd);
10055 install_element (BGP_IPV6_NODE, &no_neighbor_remove_private_as_cmd);
25ffbdc1 10056 install_element (BGP_IPV6M_NODE, &neighbor_remove_private_as_cmd);
10057 install_element (BGP_IPV6M_NODE, &no_neighbor_remove_private_as_cmd);
718e3744 10058 install_element (BGP_VPNV4_NODE, &neighbor_remove_private_as_cmd);
10059 install_element (BGP_VPNV4_NODE, &no_neighbor_remove_private_as_cmd);
10060
10061 /* "neighbor send-community" commands.*/
10062 install_element (BGP_NODE, &neighbor_send_community_cmd);
10063 install_element (BGP_NODE, &neighbor_send_community_type_cmd);
10064 install_element (BGP_NODE, &no_neighbor_send_community_cmd);
10065 install_element (BGP_NODE, &no_neighbor_send_community_type_cmd);
10066 install_element (BGP_IPV4_NODE, &neighbor_send_community_cmd);
10067 install_element (BGP_IPV4_NODE, &neighbor_send_community_type_cmd);
10068 install_element (BGP_IPV4_NODE, &no_neighbor_send_community_cmd);
10069 install_element (BGP_IPV4_NODE, &no_neighbor_send_community_type_cmd);
10070 install_element (BGP_IPV4M_NODE, &neighbor_send_community_cmd);
10071 install_element (BGP_IPV4M_NODE, &neighbor_send_community_type_cmd);
10072 install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_cmd);
10073 install_element (BGP_IPV4M_NODE, &no_neighbor_send_community_type_cmd);
10074 install_element (BGP_IPV6_NODE, &neighbor_send_community_cmd);
10075 install_element (BGP_IPV6_NODE, &neighbor_send_community_type_cmd);
10076 install_element (BGP_IPV6_NODE, &no_neighbor_send_community_cmd);
10077 install_element (BGP_IPV6_NODE, &no_neighbor_send_community_type_cmd);
25ffbdc1 10078 install_element (BGP_IPV6M_NODE, &neighbor_send_community_cmd);
10079 install_element (BGP_IPV6M_NODE, &neighbor_send_community_type_cmd);
10080 install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_cmd);
10081 install_element (BGP_IPV6M_NODE, &no_neighbor_send_community_type_cmd);
718e3744 10082 install_element (BGP_VPNV4_NODE, &neighbor_send_community_cmd);
10083 install_element (BGP_VPNV4_NODE, &neighbor_send_community_type_cmd);
10084 install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_cmd);
10085 install_element (BGP_VPNV4_NODE, &no_neighbor_send_community_type_cmd);
10086
10087 /* "neighbor route-reflector" commands.*/
10088 install_element (BGP_NODE, &neighbor_route_reflector_client_cmd);
10089 install_element (BGP_NODE, &no_neighbor_route_reflector_client_cmd);
10090 install_element (BGP_IPV4_NODE, &neighbor_route_reflector_client_cmd);
10091 install_element (BGP_IPV4_NODE, &no_neighbor_route_reflector_client_cmd);
10092 install_element (BGP_IPV4M_NODE, &neighbor_route_reflector_client_cmd);
10093 install_element (BGP_IPV4M_NODE, &no_neighbor_route_reflector_client_cmd);
10094 install_element (BGP_IPV6_NODE, &neighbor_route_reflector_client_cmd);
10095 install_element (BGP_IPV6_NODE, &no_neighbor_route_reflector_client_cmd);
25ffbdc1 10096 install_element (BGP_IPV6M_NODE, &neighbor_route_reflector_client_cmd);
10097 install_element (BGP_IPV6M_NODE, &no_neighbor_route_reflector_client_cmd);
718e3744 10098 install_element (BGP_VPNV4_NODE, &neighbor_route_reflector_client_cmd);
10099 install_element (BGP_VPNV4_NODE, &no_neighbor_route_reflector_client_cmd);
10100
10101 /* "neighbor route-server" commands.*/
10102 install_element (BGP_NODE, &neighbor_route_server_client_cmd);
10103 install_element (BGP_NODE, &no_neighbor_route_server_client_cmd);
10104 install_element (BGP_IPV4_NODE, &neighbor_route_server_client_cmd);
10105 install_element (BGP_IPV4_NODE, &no_neighbor_route_server_client_cmd);
10106 install_element (BGP_IPV4M_NODE, &neighbor_route_server_client_cmd);
10107 install_element (BGP_IPV4M_NODE, &no_neighbor_route_server_client_cmd);
10108 install_element (BGP_IPV6_NODE, &neighbor_route_server_client_cmd);
10109 install_element (BGP_IPV6_NODE, &no_neighbor_route_server_client_cmd);
25ffbdc1 10110 install_element (BGP_IPV6M_NODE, &neighbor_route_server_client_cmd);
10111 install_element (BGP_IPV6M_NODE, &no_neighbor_route_server_client_cmd);
718e3744 10112 install_element (BGP_VPNV4_NODE, &neighbor_route_server_client_cmd);
10113 install_element (BGP_VPNV4_NODE, &no_neighbor_route_server_client_cmd);
10114
10115 /* "neighbor passive" commands. */
10116 install_element (BGP_NODE, &neighbor_passive_cmd);
10117 install_element (BGP_NODE, &no_neighbor_passive_cmd);
10118
10119 /* "neighbor shutdown" commands. */
10120 install_element (BGP_NODE, &neighbor_shutdown_cmd);
10121 install_element (BGP_NODE, &no_neighbor_shutdown_cmd);
10122
c9502438 10123 /* Deprecated "neighbor capability route-refresh" commands.*/
718e3744 10124 install_element (BGP_NODE, &neighbor_capability_route_refresh_cmd);
10125 install_element (BGP_NODE, &no_neighbor_capability_route_refresh_cmd);
10126
10127 /* "neighbor capability orf prefix-list" commands.*/
10128 install_element (BGP_NODE, &neighbor_capability_orf_prefix_cmd);
10129 install_element (BGP_NODE, &no_neighbor_capability_orf_prefix_cmd);
10130 install_element (BGP_IPV4_NODE, &neighbor_capability_orf_prefix_cmd);
10131 install_element (BGP_IPV4_NODE, &no_neighbor_capability_orf_prefix_cmd);
10132 install_element (BGP_IPV4M_NODE, &neighbor_capability_orf_prefix_cmd);
10133 install_element (BGP_IPV4M_NODE, &no_neighbor_capability_orf_prefix_cmd);
10134 install_element (BGP_IPV6_NODE, &neighbor_capability_orf_prefix_cmd);
10135 install_element (BGP_IPV6_NODE, &no_neighbor_capability_orf_prefix_cmd);
25ffbdc1 10136 install_element (BGP_IPV6M_NODE, &neighbor_capability_orf_prefix_cmd);
10137 install_element (BGP_IPV6M_NODE, &no_neighbor_capability_orf_prefix_cmd);
718e3744 10138
10139 /* "neighbor capability dynamic" commands.*/
10140 install_element (BGP_NODE, &neighbor_capability_dynamic_cmd);
10141 install_element (BGP_NODE, &no_neighbor_capability_dynamic_cmd);
10142
10143 /* "neighbor dont-capability-negotiate" commands. */
10144 install_element (BGP_NODE, &neighbor_dont_capability_negotiate_cmd);
10145 install_element (BGP_NODE, &no_neighbor_dont_capability_negotiate_cmd);
10146
10147 /* "neighbor ebgp-multihop" commands. */
10148 install_element (BGP_NODE, &neighbor_ebgp_multihop_cmd);
10149 install_element (BGP_NODE, &neighbor_ebgp_multihop_ttl_cmd);
10150 install_element (BGP_NODE, &no_neighbor_ebgp_multihop_cmd);
10151 install_element (BGP_NODE, &no_neighbor_ebgp_multihop_ttl_cmd);
10152
6ffd2079 10153 /* "neighbor disable-connected-check" commands. */
10154 install_element (BGP_NODE, &neighbor_disable_connected_check_cmd);
10155 install_element (BGP_NODE, &no_neighbor_disable_connected_check_cmd);
718e3744 10156 install_element (BGP_NODE, &neighbor_enforce_multihop_cmd);
10157 install_element (BGP_NODE, &no_neighbor_enforce_multihop_cmd);
10158
10159 /* "neighbor description" commands. */
10160 install_element (BGP_NODE, &neighbor_description_cmd);
10161 install_element (BGP_NODE, &no_neighbor_description_cmd);
10162 install_element (BGP_NODE, &no_neighbor_description_val_cmd);
10163
10164 /* "neighbor update-source" commands. "*/
10165 install_element (BGP_NODE, &neighbor_update_source_cmd);
10166 install_element (BGP_NODE, &no_neighbor_update_source_cmd);
10167
10168 /* "neighbor default-originate" commands. */
10169 install_element (BGP_NODE, &neighbor_default_originate_cmd);
10170 install_element (BGP_NODE, &neighbor_default_originate_rmap_cmd);
10171 install_element (BGP_NODE, &no_neighbor_default_originate_cmd);
10172 install_element (BGP_NODE, &no_neighbor_default_originate_rmap_cmd);
10173 install_element (BGP_IPV4_NODE, &neighbor_default_originate_cmd);
10174 install_element (BGP_IPV4_NODE, &neighbor_default_originate_rmap_cmd);
10175 install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_cmd);
10176 install_element (BGP_IPV4_NODE, &no_neighbor_default_originate_rmap_cmd);
10177 install_element (BGP_IPV4M_NODE, &neighbor_default_originate_cmd);
10178 install_element (BGP_IPV4M_NODE, &neighbor_default_originate_rmap_cmd);
10179 install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_cmd);
10180 install_element (BGP_IPV4M_NODE, &no_neighbor_default_originate_rmap_cmd);
10181 install_element (BGP_IPV6_NODE, &neighbor_default_originate_cmd);
10182 install_element (BGP_IPV6_NODE, &neighbor_default_originate_rmap_cmd);
10183 install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_cmd);
10184 install_element (BGP_IPV6_NODE, &no_neighbor_default_originate_rmap_cmd);
25ffbdc1 10185 install_element (BGP_IPV6M_NODE, &neighbor_default_originate_cmd);
10186 install_element (BGP_IPV6M_NODE, &neighbor_default_originate_rmap_cmd);
10187 install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_cmd);
10188 install_element (BGP_IPV6M_NODE, &no_neighbor_default_originate_rmap_cmd);
718e3744 10189
10190 /* "neighbor port" commands. */
10191 install_element (BGP_NODE, &neighbor_port_cmd);
10192 install_element (BGP_NODE, &no_neighbor_port_cmd);
10193 install_element (BGP_NODE, &no_neighbor_port_val_cmd);
10194
10195 /* "neighbor weight" commands. */
10196 install_element (BGP_NODE, &neighbor_weight_cmd);
10197 install_element (BGP_NODE, &no_neighbor_weight_cmd);
10198 install_element (BGP_NODE, &no_neighbor_weight_val_cmd);
10199
10200 /* "neighbor override-capability" commands. */
10201 install_element (BGP_NODE, &neighbor_override_capability_cmd);
10202 install_element (BGP_NODE, &no_neighbor_override_capability_cmd);
10203
10204 /* "neighbor strict-capability-match" commands. */
10205 install_element (BGP_NODE, &neighbor_strict_capability_cmd);
10206 install_element (BGP_NODE, &no_neighbor_strict_capability_cmd);
10207
10208 /* "neighbor timers" commands. */
10209 install_element (BGP_NODE, &neighbor_timers_cmd);
10210 install_element (BGP_NODE, &no_neighbor_timers_cmd);
10211
10212 /* "neighbor timers connect" commands. */
10213 install_element (BGP_NODE, &neighbor_timers_connect_cmd);
10214 install_element (BGP_NODE, &no_neighbor_timers_connect_cmd);
10215 install_element (BGP_NODE, &no_neighbor_timers_connect_val_cmd);
10216
10217 /* "neighbor advertisement-interval" commands. */
10218 install_element (BGP_NODE, &neighbor_advertise_interval_cmd);
10219 install_element (BGP_NODE, &no_neighbor_advertise_interval_cmd);
10220 install_element (BGP_NODE, &no_neighbor_advertise_interval_val_cmd);
10221
10222 /* "neighbor version" commands. */
10223 install_element (BGP_NODE, &neighbor_version_cmd);
718e3744 10224
10225 /* "neighbor interface" commands. */
10226 install_element (BGP_NODE, &neighbor_interface_cmd);
10227 install_element (BGP_NODE, &no_neighbor_interface_cmd);
10228
10229 /* "neighbor distribute" commands. */
10230 install_element (BGP_NODE, &neighbor_distribute_list_cmd);
10231 install_element (BGP_NODE, &no_neighbor_distribute_list_cmd);
10232 install_element (BGP_IPV4_NODE, &neighbor_distribute_list_cmd);
10233 install_element (BGP_IPV4_NODE, &no_neighbor_distribute_list_cmd);
10234 install_element (BGP_IPV4M_NODE, &neighbor_distribute_list_cmd);
10235 install_element (BGP_IPV4M_NODE, &no_neighbor_distribute_list_cmd);
10236 install_element (BGP_IPV6_NODE, &neighbor_distribute_list_cmd);
10237 install_element (BGP_IPV6_NODE, &no_neighbor_distribute_list_cmd);
25ffbdc1 10238 install_element (BGP_IPV6M_NODE, &neighbor_distribute_list_cmd);
10239 install_element (BGP_IPV6M_NODE, &no_neighbor_distribute_list_cmd);
718e3744 10240 install_element (BGP_VPNV4_NODE, &neighbor_distribute_list_cmd);
10241 install_element (BGP_VPNV4_NODE, &no_neighbor_distribute_list_cmd);
10242
10243 /* "neighbor prefix-list" commands. */
10244 install_element (BGP_NODE, &neighbor_prefix_list_cmd);
10245 install_element (BGP_NODE, &no_neighbor_prefix_list_cmd);
10246 install_element (BGP_IPV4_NODE, &neighbor_prefix_list_cmd);
10247 install_element (BGP_IPV4_NODE, &no_neighbor_prefix_list_cmd);
10248 install_element (BGP_IPV4M_NODE, &neighbor_prefix_list_cmd);
10249 install_element (BGP_IPV4M_NODE, &no_neighbor_prefix_list_cmd);
10250 install_element (BGP_IPV6_NODE, &neighbor_prefix_list_cmd);
10251 install_element (BGP_IPV6_NODE, &no_neighbor_prefix_list_cmd);
25ffbdc1 10252 install_element (BGP_IPV6M_NODE, &neighbor_prefix_list_cmd);
10253 install_element (BGP_IPV6M_NODE, &no_neighbor_prefix_list_cmd);
718e3744 10254 install_element (BGP_VPNV4_NODE, &neighbor_prefix_list_cmd);
10255 install_element (BGP_VPNV4_NODE, &no_neighbor_prefix_list_cmd);
10256
10257 /* "neighbor filter-list" commands. */
10258 install_element (BGP_NODE, &neighbor_filter_list_cmd);
10259 install_element (BGP_NODE, &no_neighbor_filter_list_cmd);
10260 install_element (BGP_IPV4_NODE, &neighbor_filter_list_cmd);
10261 install_element (BGP_IPV4_NODE, &no_neighbor_filter_list_cmd);
10262 install_element (BGP_IPV4M_NODE, &neighbor_filter_list_cmd);
10263 install_element (BGP_IPV4M_NODE, &no_neighbor_filter_list_cmd);
10264 install_element (BGP_IPV6_NODE, &neighbor_filter_list_cmd);
10265 install_element (BGP_IPV6_NODE, &no_neighbor_filter_list_cmd);
25ffbdc1 10266 install_element (BGP_IPV6M_NODE, &neighbor_filter_list_cmd);
10267 install_element (BGP_IPV6M_NODE, &no_neighbor_filter_list_cmd);
718e3744 10268 install_element (BGP_VPNV4_NODE, &neighbor_filter_list_cmd);
10269 install_element (BGP_VPNV4_NODE, &no_neighbor_filter_list_cmd);
10270
10271 /* "neighbor route-map" commands. */
10272 install_element (BGP_NODE, &neighbor_route_map_cmd);
10273 install_element (BGP_NODE, &no_neighbor_route_map_cmd);
10274 install_element (BGP_IPV4_NODE, &neighbor_route_map_cmd);
10275 install_element (BGP_IPV4_NODE, &no_neighbor_route_map_cmd);
10276 install_element (BGP_IPV4M_NODE, &neighbor_route_map_cmd);
10277 install_element (BGP_IPV4M_NODE, &no_neighbor_route_map_cmd);
10278 install_element (BGP_IPV6_NODE, &neighbor_route_map_cmd);
10279 install_element (BGP_IPV6_NODE, &no_neighbor_route_map_cmd);
25ffbdc1 10280 install_element (BGP_IPV6M_NODE, &neighbor_route_map_cmd);
10281 install_element (BGP_IPV6M_NODE, &no_neighbor_route_map_cmd);
718e3744 10282 install_element (BGP_VPNV4_NODE, &neighbor_route_map_cmd);
10283 install_element (BGP_VPNV4_NODE, &no_neighbor_route_map_cmd);
10284
10285 /* "neighbor unsuppress-map" commands. */
10286 install_element (BGP_NODE, &neighbor_unsuppress_map_cmd);
10287 install_element (BGP_NODE, &no_neighbor_unsuppress_map_cmd);
10288 install_element (BGP_IPV4_NODE, &neighbor_unsuppress_map_cmd);
10289 install_element (BGP_IPV4_NODE, &no_neighbor_unsuppress_map_cmd);
10290 install_element (BGP_IPV4M_NODE, &neighbor_unsuppress_map_cmd);
10291 install_element (BGP_IPV4M_NODE, &no_neighbor_unsuppress_map_cmd);
10292 install_element (BGP_IPV6_NODE, &neighbor_unsuppress_map_cmd);
10293 install_element (BGP_IPV6_NODE, &no_neighbor_unsuppress_map_cmd);
25ffbdc1 10294 install_element (BGP_IPV6M_NODE, &neighbor_unsuppress_map_cmd);
10295 install_element (BGP_IPV6M_NODE, &no_neighbor_unsuppress_map_cmd);
a58545bb 10296 install_element (BGP_VPNV4_NODE, &neighbor_unsuppress_map_cmd);
10297 install_element (BGP_VPNV4_NODE, &no_neighbor_unsuppress_map_cmd);
718e3744 10298
10299 /* "neighbor maximum-prefix" commands. */
10300 install_element (BGP_NODE, &neighbor_maximum_prefix_cmd);
e0701b79 10301 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_cmd);
718e3744 10302 install_element (BGP_NODE, &neighbor_maximum_prefix_warning_cmd);
e0701b79 10303 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
0a486e5f 10304 install_element (BGP_NODE, &neighbor_maximum_prefix_restart_cmd);
10305 install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
718e3744 10306 install_element (BGP_NODE, &no_neighbor_maximum_prefix_cmd);
10307 install_element (BGP_NODE, &no_neighbor_maximum_prefix_val_cmd);
0a486e5f 10308 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10309 install_element (BGP_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10310 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10311 install_element (BGP_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10312 install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
718e3744 10313 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_cmd);
e0701b79 10314 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_cmd);
718e3744 10315 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_warning_cmd);
e0701b79 10316 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
0a486e5f 10317 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_restart_cmd);
10318 install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
718e3744 10319 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_cmd);
10320 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_val_cmd);
0a486e5f 10321 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10322 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10323 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10324 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10325 install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
718e3744 10326 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_cmd);
e0701b79 10327 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_cmd);
718e3744 10328 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_warning_cmd);
e0701b79 10329 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
0a486e5f 10330 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_restart_cmd);
10331 install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
718e3744 10332 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_cmd);
10333 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_val_cmd);
0a486e5f 10334 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10335 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10336 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10337 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10338 install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
718e3744 10339 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_cmd);
e0701b79 10340 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_cmd);
718e3744 10341 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_warning_cmd);
e0701b79 10342 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
0a486e5f 10343 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_restart_cmd);
10344 install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
718e3744 10345 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_cmd);
10346 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_val_cmd);
0a486e5f 10347 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10348 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10349 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10350 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10351 install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
25ffbdc1 10352 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_cmd);
10353 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_cmd);
10354 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_warning_cmd);
10355 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
10356 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_restart_cmd);
10357 install_element (BGP_IPV6M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
10358 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_cmd);
10359 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_val_cmd);
10360 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10361 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10362 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10363 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10364 install_element (BGP_IPV6M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
718e3744 10365 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_cmd);
e0701b79 10366 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_cmd);
718e3744 10367 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_warning_cmd);
e0701b79 10368 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
0a486e5f 10369 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_restart_cmd);
10370 install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
718e3744 10371 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_cmd);
10372 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_val_cmd);
0a486e5f 10373 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
10374 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_warning_cmd);
10375 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
10376 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_restart_cmd);
10377 install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
718e3744 10378
10379 /* "neighbor allowas-in" */
10380 install_element (BGP_NODE, &neighbor_allowas_in_cmd);
10381 install_element (BGP_NODE, &neighbor_allowas_in_arg_cmd);
10382 install_element (BGP_NODE, &no_neighbor_allowas_in_cmd);
10383 install_element (BGP_IPV4_NODE, &neighbor_allowas_in_cmd);
10384 install_element (BGP_IPV4_NODE, &neighbor_allowas_in_arg_cmd);
10385 install_element (BGP_IPV4_NODE, &no_neighbor_allowas_in_cmd);
10386 install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_cmd);
10387 install_element (BGP_IPV4M_NODE, &neighbor_allowas_in_arg_cmd);
10388 install_element (BGP_IPV4M_NODE, &no_neighbor_allowas_in_cmd);
10389 install_element (BGP_IPV6_NODE, &neighbor_allowas_in_cmd);
10390 install_element (BGP_IPV6_NODE, &neighbor_allowas_in_arg_cmd);
10391 install_element (BGP_IPV6_NODE, &no_neighbor_allowas_in_cmd);
25ffbdc1 10392 install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_cmd);
10393 install_element (BGP_IPV6M_NODE, &neighbor_allowas_in_arg_cmd);
10394 install_element (BGP_IPV6M_NODE, &no_neighbor_allowas_in_cmd);
718e3744 10395 install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_cmd);
10396 install_element (BGP_VPNV4_NODE, &neighbor_allowas_in_arg_cmd);
10397 install_element (BGP_VPNV4_NODE, &no_neighbor_allowas_in_cmd);
10398
10399 /* address-family commands. */
10400 install_element (BGP_NODE, &address_family_ipv4_cmd);
10401 install_element (BGP_NODE, &address_family_ipv4_safi_cmd);
10402#ifdef HAVE_IPV6
10403 install_element (BGP_NODE, &address_family_ipv6_cmd);
25ffbdc1 10404 install_element (BGP_NODE, &address_family_ipv6_safi_cmd);
718e3744 10405#endif /* HAVE_IPV6 */
10406 install_element (BGP_NODE, &address_family_vpnv4_cmd);
10407 install_element (BGP_NODE, &address_family_vpnv4_unicast_cmd);
10408
10409 /* "exit-address-family" command. */
10410 install_element (BGP_IPV4_NODE, &exit_address_family_cmd);
10411 install_element (BGP_IPV4M_NODE, &exit_address_family_cmd);
10412 install_element (BGP_IPV6_NODE, &exit_address_family_cmd);
25ffbdc1 10413 install_element (BGP_IPV6M_NODE, &exit_address_family_cmd);
718e3744 10414 install_element (BGP_VPNV4_NODE, &exit_address_family_cmd);
10415
10416 /* "clear ip bgp commands" */
10417 install_element (ENABLE_NODE, &clear_ip_bgp_all_cmd);
10418 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_cmd);
10419 install_element (ENABLE_NODE, &clear_ip_bgp_as_cmd);
10420 install_element (ENABLE_NODE, &clear_ip_bgp_peer_cmd);
10421 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_cmd);
10422 install_element (ENABLE_NODE, &clear_ip_bgp_external_cmd);
10423#ifdef HAVE_IPV6
10424 install_element (ENABLE_NODE, &clear_bgp_all_cmd);
10425 install_element (ENABLE_NODE, &clear_bgp_instance_all_cmd);
10426 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_cmd);
10427 install_element (ENABLE_NODE, &clear_bgp_peer_cmd);
10428 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_cmd);
10429 install_element (ENABLE_NODE, &clear_bgp_peer_group_cmd);
10430 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_cmd);
10431 install_element (ENABLE_NODE, &clear_bgp_external_cmd);
10432 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_cmd);
10433 install_element (ENABLE_NODE, &clear_bgp_as_cmd);
10434 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_cmd);
10435#endif /* HAVE_IPV6 */
10436
10437 /* "clear ip bgp neighbor soft in" */
10438 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_in_cmd);
10439 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_in_cmd);
10440 install_element (ENABLE_NODE, &clear_ip_bgp_all_in_cmd);
10441 install_element (ENABLE_NODE, &clear_ip_bgp_all_in_prefix_filter_cmd);
10442 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_in_prefix_filter_cmd);
10443 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_in_cmd);
10444 install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_cmd);
10445 install_element (ENABLE_NODE, &clear_ip_bgp_peer_in_prefix_filter_cmd);
10446 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_in_cmd);
10447 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_cmd);
10448 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_in_prefix_filter_cmd);
10449 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_in_cmd);
10450 install_element (ENABLE_NODE, &clear_ip_bgp_external_in_cmd);
10451 install_element (ENABLE_NODE, &clear_ip_bgp_external_in_prefix_filter_cmd);
10452 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_in_cmd);
10453 install_element (ENABLE_NODE, &clear_ip_bgp_as_in_cmd);
10454 install_element (ENABLE_NODE, &clear_ip_bgp_as_in_prefix_filter_cmd);
10455 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_in_cmd);
10456 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_in_cmd);
10457 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_cmd);
10458 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_in_prefix_filter_cmd);
10459 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd);
10460 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_in_cmd);
10461 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_cmd);
10462 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd);
10463 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_in_cmd);
10464 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_cmd);
10465 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd);
10466 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_in_cmd);
10467 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_cmd);
10468 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_in_prefix_filter_cmd);
10469 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_in_cmd);
10470 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_cmd);
10471 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_in_prefix_filter_cmd);
10472 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_in_cmd);
10473 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_in_cmd);
10474 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_in_cmd);
10475 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_in_cmd);
10476 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_in_cmd);
10477 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_in_cmd);
10478#ifdef HAVE_IPV6
10479 install_element (ENABLE_NODE, &clear_bgp_all_soft_in_cmd);
10480 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_in_cmd);
10481 install_element (ENABLE_NODE, &clear_bgp_all_in_cmd);
10482 install_element (ENABLE_NODE, &clear_bgp_all_in_prefix_filter_cmd);
10483 install_element (ENABLE_NODE, &clear_bgp_peer_soft_in_cmd);
10484 install_element (ENABLE_NODE, &clear_bgp_peer_in_cmd);
10485 install_element (ENABLE_NODE, &clear_bgp_peer_in_prefix_filter_cmd);
10486 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_in_cmd);
10487 install_element (ENABLE_NODE, &clear_bgp_peer_group_in_cmd);
10488 install_element (ENABLE_NODE, &clear_bgp_peer_group_in_prefix_filter_cmd);
10489 install_element (ENABLE_NODE, &clear_bgp_external_soft_in_cmd);
10490 install_element (ENABLE_NODE, &clear_bgp_external_in_cmd);
10491 install_element (ENABLE_NODE, &clear_bgp_external_in_prefix_filter_cmd);
10492 install_element (ENABLE_NODE, &clear_bgp_as_soft_in_cmd);
10493 install_element (ENABLE_NODE, &clear_bgp_as_in_cmd);
10494 install_element (ENABLE_NODE, &clear_bgp_as_in_prefix_filter_cmd);
10495 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_in_cmd);
10496 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_cmd);
10497 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_in_prefix_filter_cmd);
10498 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_in_cmd);
10499 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_cmd);
10500 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_in_prefix_filter_cmd);
10501 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_in_cmd);
10502 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_cmd);
10503 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_in_prefix_filter_cmd);
10504 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_in_cmd);
10505 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_cmd);
10506 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_in_prefix_filter_cmd);
10507 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_in_cmd);
10508 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_cmd);
10509 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_in_prefix_filter_cmd);
10510#endif /* HAVE_IPV6 */
10511
10512 /* "clear ip bgp neighbor soft out" */
10513 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_out_cmd);
10514 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_out_cmd);
10515 install_element (ENABLE_NODE, &clear_ip_bgp_all_out_cmd);
10516 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_out_cmd);
10517 install_element (ENABLE_NODE, &clear_ip_bgp_peer_out_cmd);
10518 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_out_cmd);
10519 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_out_cmd);
10520 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_out_cmd);
10521 install_element (ENABLE_NODE, &clear_ip_bgp_external_out_cmd);
10522 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_out_cmd);
10523 install_element (ENABLE_NODE, &clear_ip_bgp_as_out_cmd);
10524 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_out_cmd);
10525 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_out_cmd);
10526 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_out_cmd);
10527 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_out_cmd);
10528 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_out_cmd);
10529 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_out_cmd);
10530 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_out_cmd);
10531 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_out_cmd);
10532 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_out_cmd);
10533 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_out_cmd);
10534 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_out_cmd);
10535 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_out_cmd);
10536 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_out_cmd);
10537 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_out_cmd);
10538 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_out_cmd);
10539 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_out_cmd);
10540 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_out_cmd);
10541#ifdef HAVE_IPV6
10542 install_element (ENABLE_NODE, &clear_bgp_all_soft_out_cmd);
10543 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_out_cmd);
10544 install_element (ENABLE_NODE, &clear_bgp_all_out_cmd);
10545 install_element (ENABLE_NODE, &clear_bgp_peer_soft_out_cmd);
10546 install_element (ENABLE_NODE, &clear_bgp_peer_out_cmd);
10547 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_out_cmd);
10548 install_element (ENABLE_NODE, &clear_bgp_peer_group_out_cmd);
10549 install_element (ENABLE_NODE, &clear_bgp_external_soft_out_cmd);
10550 install_element (ENABLE_NODE, &clear_bgp_external_out_cmd);
10551 install_element (ENABLE_NODE, &clear_bgp_as_soft_out_cmd);
10552 install_element (ENABLE_NODE, &clear_bgp_as_out_cmd);
10553 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_out_cmd);
10554 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_out_cmd);
10555 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_out_cmd);
10556 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_out_cmd);
10557 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_out_cmd);
10558 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_out_cmd);
10559 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_out_cmd);
10560 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_out_cmd);
10561 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_out_cmd);
10562 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_out_cmd);
10563#endif /* HAVE_IPV6 */
10564
10565 /* "clear ip bgp neighbor soft" */
10566 install_element (ENABLE_NODE, &clear_ip_bgp_all_soft_cmd);
10567 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_soft_cmd);
10568 install_element (ENABLE_NODE, &clear_ip_bgp_peer_soft_cmd);
10569 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_soft_cmd);
10570 install_element (ENABLE_NODE, &clear_ip_bgp_external_soft_cmd);
10571 install_element (ENABLE_NODE, &clear_ip_bgp_as_soft_cmd);
10572 install_element (ENABLE_NODE, &clear_ip_bgp_all_ipv4_soft_cmd);
10573 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_ipv4_soft_cmd);
10574 install_element (ENABLE_NODE, &clear_ip_bgp_peer_ipv4_soft_cmd);
10575 install_element (ENABLE_NODE, &clear_ip_bgp_peer_group_ipv4_soft_cmd);
10576 install_element (ENABLE_NODE, &clear_ip_bgp_external_ipv4_soft_cmd);
10577 install_element (ENABLE_NODE, &clear_ip_bgp_as_ipv4_soft_cmd);
10578 install_element (ENABLE_NODE, &clear_ip_bgp_all_vpnv4_soft_cmd);
10579 install_element (ENABLE_NODE, &clear_ip_bgp_peer_vpnv4_soft_cmd);
10580 install_element (ENABLE_NODE, &clear_ip_bgp_as_vpnv4_soft_cmd);
10581#ifdef HAVE_IPV6
10582 install_element (ENABLE_NODE, &clear_bgp_all_soft_cmd);
10583 install_element (ENABLE_NODE, &clear_bgp_instance_all_soft_cmd);
10584 install_element (ENABLE_NODE, &clear_bgp_peer_soft_cmd);
10585 install_element (ENABLE_NODE, &clear_bgp_peer_group_soft_cmd);
10586 install_element (ENABLE_NODE, &clear_bgp_external_soft_cmd);
10587 install_element (ENABLE_NODE, &clear_bgp_as_soft_cmd);
10588 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_soft_cmd);
10589 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_soft_cmd);
10590 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_group_soft_cmd);
10591 install_element (ENABLE_NODE, &clear_bgp_ipv6_external_soft_cmd);
10592 install_element (ENABLE_NODE, &clear_bgp_ipv6_as_soft_cmd);
10593#endif /* HAVE_IPV6 */
10594
fee0f4c6 10595 /* "clear ip bgp neighbor rsclient" */
10596 install_element (ENABLE_NODE, &clear_ip_bgp_all_rsclient_cmd);
10597 install_element (ENABLE_NODE, &clear_ip_bgp_instance_all_rsclient_cmd);
10598 install_element (ENABLE_NODE, &clear_ip_bgp_peer_rsclient_cmd);
10599 install_element (ENABLE_NODE, &clear_ip_bgp_instance_peer_rsclient_cmd);
10600#ifdef HAVE_IPV6
10601 install_element (ENABLE_NODE, &clear_bgp_all_rsclient_cmd);
10602 install_element (ENABLE_NODE, &clear_bgp_instance_all_rsclient_cmd);
10603 install_element (ENABLE_NODE, &clear_bgp_ipv6_all_rsclient_cmd);
10604 install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_all_rsclient_cmd);
10605 install_element (ENABLE_NODE, &clear_bgp_peer_rsclient_cmd);
10606 install_element (ENABLE_NODE, &clear_bgp_instance_peer_rsclient_cmd);
10607 install_element (ENABLE_NODE, &clear_bgp_ipv6_peer_rsclient_cmd);
10608 install_element (ENABLE_NODE, &clear_bgp_ipv6_instance_peer_rsclient_cmd);
10609#endif /* HAVE_IPV6 */
10610
718e3744 10611 /* "show ip bgp summary" commands. */
10612 install_element (VIEW_NODE, &show_ip_bgp_summary_cmd);
47fc97cc 10613 install_element (VIEW_NODE, &show_ip_bgp_summary_csv_cmd);
718e3744 10614 install_element (VIEW_NODE, &show_ip_bgp_instance_summary_cmd);
10615 install_element (VIEW_NODE, &show_ip_bgp_ipv4_summary_cmd);
95cbbd2a 10616 install_element (VIEW_NODE, &show_bgp_ipv4_safi_summary_cmd);
718e3744 10617 install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
95cbbd2a 10618 install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_summary_cmd);
718e3744 10619 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
10620 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
10621#ifdef HAVE_IPV6
10622 install_element (VIEW_NODE, &show_bgp_summary_cmd);
47fc97cc 10623 install_element (VIEW_NODE, &show_bgp_summary_csv_cmd);
718e3744 10624 install_element (VIEW_NODE, &show_bgp_instance_summary_cmd);
10625 install_element (VIEW_NODE, &show_bgp_ipv6_summary_cmd);
95cbbd2a 10626 install_element (VIEW_NODE, &show_bgp_ipv6_safi_summary_cmd);
718e3744 10627 install_element (VIEW_NODE, &show_bgp_instance_ipv6_summary_cmd);
95cbbd2a 10628 install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_summary_cmd);
62687ff1
PJ
10629#endif /* HAVE_IPV6 */
10630 install_element (RESTRICTED_NODE, &show_ip_bgp_summary_cmd);
47fc97cc 10631 install_element (RESTRICTED_NODE, &show_ip_bgp_summary_csv_cmd);
62687ff1
PJ
10632 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_summary_cmd);
10633 install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_summary_cmd);
95cbbd2a 10634 install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_summary_cmd);
62687ff1 10635 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
95cbbd2a 10636 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_summary_cmd);
62687ff1
PJ
10637 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
10638 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
10639#ifdef HAVE_IPV6
10640 install_element (RESTRICTED_NODE, &show_bgp_summary_cmd);
47fc97cc 10641 install_element (RESTRICTED_NODE, &show_bgp_summary_csv_cmd);
62687ff1
PJ
10642 install_element (RESTRICTED_NODE, &show_bgp_instance_summary_cmd);
10643 install_element (RESTRICTED_NODE, &show_bgp_ipv6_summary_cmd);
95cbbd2a 10644 install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_summary_cmd);
62687ff1 10645 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_summary_cmd);
95cbbd2a 10646 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_summary_cmd);
718e3744 10647#endif /* HAVE_IPV6 */
10648 install_element (ENABLE_NODE, &show_ip_bgp_summary_cmd);
47fc97cc 10649 install_element (ENABLE_NODE, &show_ip_bgp_summary_csv_cmd);
718e3744 10650 install_element (ENABLE_NODE, &show_ip_bgp_instance_summary_cmd);
10651 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_summary_cmd);
95cbbd2a 10652 install_element (ENABLE_NODE, &show_bgp_ipv4_safi_summary_cmd);
718e3744 10653 install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_summary_cmd);
95cbbd2a 10654 install_element (ENABLE_NODE, &show_bgp_instance_ipv4_safi_summary_cmd);
718e3744 10655 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_summary_cmd);
10656 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_summary_cmd);
10657#ifdef HAVE_IPV6
10658 install_element (ENABLE_NODE, &show_bgp_summary_cmd);
47fc97cc 10659 install_element (ENABLE_NODE, &show_bgp_summary_csv_cmd);
718e3744 10660 install_element (ENABLE_NODE, &show_bgp_instance_summary_cmd);
10661 install_element (ENABLE_NODE, &show_bgp_ipv6_summary_cmd);
95cbbd2a 10662 install_element (ENABLE_NODE, &show_bgp_ipv6_safi_summary_cmd);
718e3744 10663 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_summary_cmd);
95cbbd2a 10664 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_summary_cmd);
718e3744 10665#endif /* HAVE_IPV6 */
10666
10667 /* "show ip bgp neighbors" commands. */
10668 install_element (VIEW_NODE, &show_ip_bgp_neighbors_cmd);
10669 install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_cmd);
10670 install_element (VIEW_NODE, &show_ip_bgp_neighbors_peer_cmd);
10671 install_element (VIEW_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
10672 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd);
10673 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd);
10674 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
10675 install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
10676 install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_cmd);
10677 install_element (VIEW_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
62687ff1
PJ
10678 install_element (RESTRICTED_NODE, &show_ip_bgp_neighbors_peer_cmd);
10679 install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
10680 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
10681 install_element (RESTRICTED_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
10682 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
718e3744 10683 install_element (ENABLE_NODE, &show_ip_bgp_neighbors_cmd);
10684 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_cmd);
10685 install_element (ENABLE_NODE, &show_ip_bgp_neighbors_peer_cmd);
10686 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_neighbors_peer_cmd);
10687 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_cmd);
10688 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_cmd);
10689 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd);
10690 install_element (ENABLE_NODE, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd);
10691 install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_cmd);
10692 install_element (ENABLE_NODE, &show_ip_bgp_instance_neighbors_peer_cmd);
10693
10694#ifdef HAVE_IPV6
10695 install_element (VIEW_NODE, &show_bgp_neighbors_cmd);
10696 install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_cmd);
10697 install_element (VIEW_NODE, &show_bgp_neighbors_peer_cmd);
10698 install_element (VIEW_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
bb46e94f 10699 install_element (VIEW_NODE, &show_bgp_instance_neighbors_cmd);
10700 install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_cmd);
10701 install_element (VIEW_NODE, &show_bgp_instance_neighbors_peer_cmd);
10702 install_element (VIEW_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
62687ff1
PJ
10703 install_element (RESTRICTED_NODE, &show_bgp_neighbors_peer_cmd);
10704 install_element (RESTRICTED_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
10705 install_element (RESTRICTED_NODE, &show_bgp_instance_neighbors_peer_cmd);
10706 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
718e3744 10707 install_element (ENABLE_NODE, &show_bgp_neighbors_cmd);
10708 install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_cmd);
10709 install_element (ENABLE_NODE, &show_bgp_neighbors_peer_cmd);
10710 install_element (ENABLE_NODE, &show_bgp_ipv6_neighbors_peer_cmd);
bb46e94f 10711 install_element (ENABLE_NODE, &show_bgp_instance_neighbors_cmd);
10712 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_cmd);
10713 install_element (ENABLE_NODE, &show_bgp_instance_neighbors_peer_cmd);
10714 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_neighbors_peer_cmd);
718e3744 10715
10716 /* Old commands. */
10717 install_element (VIEW_NODE, &show_ipv6_bgp_summary_cmd);
10718 install_element (VIEW_NODE, &show_ipv6_mbgp_summary_cmd);
10719 install_element (ENABLE_NODE, &show_ipv6_bgp_summary_cmd);
10720 install_element (ENABLE_NODE, &show_ipv6_mbgp_summary_cmd);
10721#endif /* HAVE_IPV6 */
fee0f4c6 10722
10723 /* "show ip bgp rsclient" commands. */
10724 install_element (VIEW_NODE, &show_ip_bgp_rsclient_summary_cmd);
10725 install_element (VIEW_NODE, &show_ip_bgp_instance_rsclient_summary_cmd);
10726 install_element (VIEW_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd);
10727 install_element (VIEW_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd);
95cbbd2a
ML
10728 install_element (VIEW_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd);
10729 install_element (VIEW_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd);
62687ff1
PJ
10730 install_element (RESTRICTED_NODE, &show_ip_bgp_rsclient_summary_cmd);
10731 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_rsclient_summary_cmd);
10732 install_element (RESTRICTED_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd);
10733 install_element (RESTRICTED_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd);
95cbbd2a
ML
10734 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd);
10735 install_element (RESTRICTED_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd);
fee0f4c6 10736 install_element (ENABLE_NODE, &show_ip_bgp_rsclient_summary_cmd);
10737 install_element (ENABLE_NODE, &show_ip_bgp_instance_rsclient_summary_cmd);
10738 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_rsclient_summary_cmd);
10739 install_element (ENABLE_NODE, &show_ip_bgp_instance_ipv4_rsclient_summary_cmd);
95cbbd2a
ML
10740 install_element (ENABLE_NODE, &show_bgp_instance_ipv4_safi_rsclient_summary_cmd);
10741 install_element (ENABLE_NODE, &show_bgp_ipv4_safi_rsclient_summary_cmd);
fee0f4c6 10742
10743#ifdef HAVE_IPV6
10744 install_element (VIEW_NODE, &show_bgp_rsclient_summary_cmd);
10745 install_element (VIEW_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
10746 install_element (VIEW_NODE, &show_bgp_instance_rsclient_summary_cmd);
10747 install_element (VIEW_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
95cbbd2a
ML
10748 install_element (VIEW_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd);
10749 install_element (VIEW_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd);
62687ff1
PJ
10750 install_element (RESTRICTED_NODE, &show_bgp_rsclient_summary_cmd);
10751 install_element (RESTRICTED_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
10752 install_element (RESTRICTED_NODE, &show_bgp_instance_rsclient_summary_cmd);
10753 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
95cbbd2a
ML
10754 install_element (RESTRICTED_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd);
10755 install_element (RESTRICTED_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd);
fee0f4c6 10756 install_element (ENABLE_NODE, &show_bgp_rsclient_summary_cmd);
10757 install_element (ENABLE_NODE, &show_bgp_ipv6_rsclient_summary_cmd);
10758 install_element (ENABLE_NODE, &show_bgp_instance_rsclient_summary_cmd);
10759 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_rsclient_summary_cmd);
95cbbd2a
ML
10760 install_element (ENABLE_NODE, &show_bgp_instance_ipv6_safi_rsclient_summary_cmd);
10761 install_element (ENABLE_NODE, &show_bgp_ipv6_safi_rsclient_summary_cmd);
fee0f4c6 10762#endif /* HAVE_IPV6 */
718e3744 10763
10764 /* "show ip bgp paths" commands. */
10765 install_element (VIEW_NODE, &show_ip_bgp_paths_cmd);
10766 install_element (VIEW_NODE, &show_ip_bgp_ipv4_paths_cmd);
10767 install_element (ENABLE_NODE, &show_ip_bgp_paths_cmd);
10768 install_element (ENABLE_NODE, &show_ip_bgp_ipv4_paths_cmd);
10769
10770 /* "show ip bgp community" commands. */
10771 install_element (VIEW_NODE, &show_ip_bgp_community_info_cmd);
10772 install_element (ENABLE_NODE, &show_ip_bgp_community_info_cmd);
10773
10774 /* "show ip bgp attribute-info" commands. */
10775 install_element (VIEW_NODE, &show_ip_bgp_attr_info_cmd);
10776 install_element (ENABLE_NODE, &show_ip_bgp_attr_info_cmd);
10777
10778 /* "redistribute" commands. */
10779 install_element (BGP_NODE, &bgp_redistribute_ipv4_cmd);
10780 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_cmd);
10781 install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_cmd);
10782 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_cmd);
10783 install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_cmd);
10784 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_cmd);
10785 install_element (BGP_NODE, &bgp_redistribute_ipv4_rmap_metric_cmd);
10786 install_element (BGP_NODE, &bgp_redistribute_ipv4_metric_rmap_cmd);
10787 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_rmap_metric_cmd);
10788 install_element (BGP_NODE, &no_bgp_redistribute_ipv4_metric_rmap_cmd);
10789#ifdef HAVE_IPV6
10790 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_cmd);
10791 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_cmd);
10792 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_cmd);
10793 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_cmd);
10794 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_cmd);
10795 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_cmd);
10796 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_rmap_metric_cmd);
10797 install_element (BGP_IPV6_NODE, &bgp_redistribute_ipv6_metric_rmap_cmd);
10798 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_rmap_metric_cmd);
10799 install_element (BGP_IPV6_NODE, &no_bgp_redistribute_ipv6_metric_rmap_cmd);
10800#endif /* HAVE_IPV6 */
10801
fa411a21
NH
10802 /* ttl_security commands */
10803 install_element (BGP_NODE, &neighbor_ttl_security_cmd);
10804 install_element (BGP_NODE, &no_neighbor_ttl_security_cmd);
10805
4bf6a362
PJ
10806 /* "show bgp memory" commands. */
10807 install_element (VIEW_NODE, &show_bgp_memory_cmd);
62687ff1 10808 install_element (RESTRICTED_NODE, &show_bgp_memory_cmd);
4bf6a362
PJ
10809 install_element (ENABLE_NODE, &show_bgp_memory_cmd);
10810
e0081f70
ML
10811 /* "show bgp views" commands. */
10812 install_element (VIEW_NODE, &show_bgp_views_cmd);
10813 install_element (RESTRICTED_NODE, &show_bgp_views_cmd);
10814 install_element (ENABLE_NODE, &show_bgp_views_cmd);
10815
718e3744 10816 /* Community-list. */
10817 community_list_vty ();
10818}
6b0655a2 10819
718e3744 10820#include "memory.h"
10821#include "bgp_regex.h"
10822#include "bgp_clist.h"
10823#include "bgp_ecommunity.h"
10824
10825/* VTY functions. */
10826
10827/* Direction value to string conversion. */
94f2b392 10828static const char *
718e3744 10829community_direct_str (int direct)
10830{
10831 switch (direct)
10832 {
10833 case COMMUNITY_DENY:
10834 return "deny";
718e3744 10835 case COMMUNITY_PERMIT:
10836 return "permit";
718e3744 10837 default:
10838 return "unknown";
718e3744 10839 }
10840}
10841
10842/* Display error string. */
94f2b392 10843static void
718e3744 10844community_list_perror (struct vty *vty, int ret)
10845{
10846 switch (ret)
10847 {
10848 case COMMUNITY_LIST_ERR_CANT_FIND_LIST:
b729294c 10849 vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE);
718e3744 10850 break;
10851 case COMMUNITY_LIST_ERR_MALFORMED_VAL:
10852 vty_out (vty, "%% Malformed community-list value%s", VTY_NEWLINE);
10853 break;
10854 case COMMUNITY_LIST_ERR_STANDARD_CONFLICT:
10855 vty_out (vty, "%% Community name conflict, previously defined as standard community%s", VTY_NEWLINE);
10856 break;
10857 case COMMUNITY_LIST_ERR_EXPANDED_CONFLICT:
10858 vty_out (vty, "%% Community name conflict, previously defined as expanded community%s", VTY_NEWLINE);
10859 break;
10860 }
10861}
10862
10863/* VTY interface for community_set() function. */
94f2b392 10864static int
fd79ac91 10865community_list_set_vty (struct vty *vty, int argc, const char **argv,
10866 int style, int reject_all_digit_name)
718e3744 10867{
10868 int ret;
10869 int direct;
10870 char *str;
10871
10872 /* Check the list type. */
10873 if (strncmp (argv[1], "p", 1) == 0)
10874 direct = COMMUNITY_PERMIT;
10875 else if (strncmp (argv[1], "d", 1) == 0)
10876 direct = COMMUNITY_DENY;
10877 else
10878 {
10879 vty_out (vty, "%% Matching condition must be permit or deny%s",
10880 VTY_NEWLINE);
10881 return CMD_WARNING;
10882 }
10883
10884 /* All digit name check. */
10885 if (reject_all_digit_name && all_digit (argv[0]))
10886 {
10887 vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE);
10888 return CMD_WARNING;
10889 }
10890
10891 /* Concat community string argument. */
10892 if (argc > 1)
10893 str = argv_concat (argv, argc, 2);
10894 else
10895 str = NULL;
10896
10897 /* When community_list_set() return nevetive value, it means
10898 malformed community string. */
10899 ret = community_list_set (bgp_clist, argv[0], str, direct, style);
10900
10901 /* Free temporary community list string allocated by
10902 argv_concat(). */
10903 if (str)
10904 XFREE (MTYPE_TMP, str);
10905
10906 if (ret < 0)
10907 {
10908 /* Display error string. */
10909 community_list_perror (vty, ret);
10910 return CMD_WARNING;
10911 }
10912
10913 return CMD_SUCCESS;
10914}
10915
718e3744 10916/* Communiyt-list entry delete. */
94f2b392 10917static int
fee6e4e4 10918community_list_unset_vty (struct vty *vty, int argc, const char **argv,
10919 int style)
718e3744 10920{
10921 int ret;
fee6e4e4 10922 int direct = 0;
10923 char *str = NULL;
718e3744 10924
fee6e4e4 10925 if (argc > 1)
718e3744 10926 {
fee6e4e4 10927 /* Check the list direct. */
10928 if (strncmp (argv[1], "p", 1) == 0)
10929 direct = COMMUNITY_PERMIT;
10930 else if (strncmp (argv[1], "d", 1) == 0)
10931 direct = COMMUNITY_DENY;
10932 else
10933 {
10934 vty_out (vty, "%% Matching condition must be permit or deny%s",
10935 VTY_NEWLINE);
10936 return CMD_WARNING;
10937 }
718e3744 10938
fee6e4e4 10939 /* Concat community string argument. */
10940 str = argv_concat (argv, argc, 2);
10941 }
718e3744 10942
10943 /* Unset community list. */
10944 ret = community_list_unset (bgp_clist, argv[0], str, direct, style);
10945
10946 /* Free temporary community list string allocated by
10947 argv_concat(). */
fee6e4e4 10948 if (str)
10949 XFREE (MTYPE_TMP, str);
718e3744 10950
10951 if (ret < 0)
10952 {
10953 community_list_perror (vty, ret);
10954 return CMD_WARNING;
10955 }
10956
10957 return CMD_SUCCESS;
10958}
10959
10960/* "community-list" keyword help string. */
10961#define COMMUNITY_LIST_STR "Add a community list entry\n"
10962#define COMMUNITY_VAL_STR "Community number in aa:nn format or internet|local-AS|no-advertise|no-export\n"
10963
718e3744 10964DEFUN (ip_community_list_standard,
10965 ip_community_list_standard_cmd,
10966 "ip community-list <1-99> (deny|permit) .AA:NN",
10967 IP_STR
10968 COMMUNITY_LIST_STR
10969 "Community list number (standard)\n"
10970 "Specify community to reject\n"
10971 "Specify community to accept\n"
10972 COMMUNITY_VAL_STR)
10973{
10974 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 0);
10975}
10976
10977ALIAS (ip_community_list_standard,
10978 ip_community_list_standard2_cmd,
10979 "ip community-list <1-99> (deny|permit)",
10980 IP_STR
10981 COMMUNITY_LIST_STR
10982 "Community list number (standard)\n"
10983 "Specify community to reject\n"
10984 "Specify community to accept\n")
10985
10986DEFUN (ip_community_list_expanded,
10987 ip_community_list_expanded_cmd,
fee6e4e4 10988 "ip community-list <100-500> (deny|permit) .LINE",
718e3744 10989 IP_STR
10990 COMMUNITY_LIST_STR
10991 "Community list number (expanded)\n"
10992 "Specify community to reject\n"
10993 "Specify community to accept\n"
10994 "An ordered list as a regular-expression\n")
10995{
10996 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 0);
10997}
10998
10999DEFUN (ip_community_list_name_standard,
11000 ip_community_list_name_standard_cmd,
11001 "ip community-list standard WORD (deny|permit) .AA:NN",
11002 IP_STR
11003 COMMUNITY_LIST_STR
11004 "Add a standard community-list entry\n"
11005 "Community list name\n"
11006 "Specify community to reject\n"
11007 "Specify community to accept\n"
11008 COMMUNITY_VAL_STR)
11009{
11010 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD, 1);
11011}
11012
11013ALIAS (ip_community_list_name_standard,
11014 ip_community_list_name_standard2_cmd,
11015 "ip community-list standard WORD (deny|permit)",
11016 IP_STR
11017 COMMUNITY_LIST_STR
11018 "Add a standard community-list entry\n"
11019 "Community list name\n"
11020 "Specify community to reject\n"
11021 "Specify community to accept\n")
11022
11023DEFUN (ip_community_list_name_expanded,
11024 ip_community_list_name_expanded_cmd,
11025 "ip community-list expanded WORD (deny|permit) .LINE",
11026 IP_STR
11027 COMMUNITY_LIST_STR
11028 "Add an expanded community-list entry\n"
11029 "Community list name\n"
11030 "Specify community to reject\n"
11031 "Specify community to accept\n"
11032 "An ordered list as a regular-expression\n")
11033{
11034 return community_list_set_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED, 1);
11035}
11036
fee6e4e4 11037DEFUN (no_ip_community_list_standard_all,
11038 no_ip_community_list_standard_all_cmd,
11039 "no ip community-list <1-99>",
11040 NO_STR
11041 IP_STR
11042 COMMUNITY_LIST_STR
11043 "Community list number (standard)\n")
11044{
11045 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
11046}
11047
11048DEFUN (no_ip_community_list_expanded_all,
11049 no_ip_community_list_expanded_all_cmd,
11050 "no ip community-list <100-500>",
718e3744 11051 NO_STR
11052 IP_STR
11053 COMMUNITY_LIST_STR
718e3744 11054 "Community list number (expanded)\n")
11055{
fee6e4e4 11056 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
718e3744 11057}
11058
fee6e4e4 11059DEFUN (no_ip_community_list_name_standard_all,
11060 no_ip_community_list_name_standard_all_cmd,
11061 "no ip community-list standard WORD",
718e3744 11062 NO_STR
11063 IP_STR
11064 COMMUNITY_LIST_STR
11065 "Add a standard community-list entry\n"
718e3744 11066 "Community list name\n")
11067{
fee6e4e4 11068 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
718e3744 11069}
11070
fee6e4e4 11071DEFUN (no_ip_community_list_name_expanded_all,
11072 no_ip_community_list_name_expanded_all_cmd,
11073 "no ip community-list expanded WORD",
718e3744 11074 NO_STR
11075 IP_STR
11076 COMMUNITY_LIST_STR
fee6e4e4 11077 "Add an expanded community-list entry\n"
11078 "Community list name\n")
718e3744 11079{
fee6e4e4 11080 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
718e3744 11081}
11082
11083DEFUN (no_ip_community_list_standard,
11084 no_ip_community_list_standard_cmd,
11085 "no ip community-list <1-99> (deny|permit) .AA:NN",
11086 NO_STR
11087 IP_STR
11088 COMMUNITY_LIST_STR
11089 "Community list number (standard)\n"
11090 "Specify community to reject\n"
11091 "Specify community to accept\n"
11092 COMMUNITY_VAL_STR)
11093{
11094 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
11095}
11096
11097DEFUN (no_ip_community_list_expanded,
11098 no_ip_community_list_expanded_cmd,
fee6e4e4 11099 "no ip community-list <100-500> (deny|permit) .LINE",
718e3744 11100 NO_STR
11101 IP_STR
11102 COMMUNITY_LIST_STR
11103 "Community list number (expanded)\n"
11104 "Specify community to reject\n"
11105 "Specify community to accept\n"
11106 "An ordered list as a regular-expression\n")
11107{
11108 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
11109}
11110
11111DEFUN (no_ip_community_list_name_standard,
11112 no_ip_community_list_name_standard_cmd,
11113 "no ip community-list standard WORD (deny|permit) .AA:NN",
11114 NO_STR
11115 IP_STR
11116 COMMUNITY_LIST_STR
11117 "Specify a standard community-list\n"
11118 "Community list name\n"
11119 "Specify community to reject\n"
11120 "Specify community to accept\n"
11121 COMMUNITY_VAL_STR)
11122{
11123 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_STANDARD);
11124}
11125
11126DEFUN (no_ip_community_list_name_expanded,
11127 no_ip_community_list_name_expanded_cmd,
11128 "no ip community-list expanded WORD (deny|permit) .LINE",
11129 NO_STR
11130 IP_STR
11131 COMMUNITY_LIST_STR
11132 "Specify an expanded community-list\n"
11133 "Community list name\n"
11134 "Specify community to reject\n"
11135 "Specify community to accept\n"
11136 "An ordered list as a regular-expression\n")
11137{
11138 return community_list_unset_vty (vty, argc, argv, COMMUNITY_LIST_EXPANDED);
11139}
11140
94f2b392 11141static void
718e3744 11142community_list_show (struct vty *vty, struct community_list *list)
11143{
11144 struct community_entry *entry;
11145
11146 for (entry = list->head; entry; entry = entry->next)
11147 {
11148 if (entry == list->head)
11149 {
11150 if (all_digit (list->name))
11151 vty_out (vty, "Community %s list %s%s",
11152 entry->style == COMMUNITY_LIST_STANDARD ?
11153 "standard" : "(expanded) access",
11154 list->name, VTY_NEWLINE);
11155 else
11156 vty_out (vty, "Named Community %s list %s%s",
11157 entry->style == COMMUNITY_LIST_STANDARD ?
11158 "standard" : "expanded",
11159 list->name, VTY_NEWLINE);
11160 }
11161 if (entry->any)
11162 vty_out (vty, " %s%s",
11163 community_direct_str (entry->direct), VTY_NEWLINE);
11164 else
11165 vty_out (vty, " %s %s%s",
11166 community_direct_str (entry->direct),
11167 entry->style == COMMUNITY_LIST_STANDARD
11168 ? community_str (entry->u.com) : entry->config,
11169 VTY_NEWLINE);
11170 }
11171}
11172
11173DEFUN (show_ip_community_list,
11174 show_ip_community_list_cmd,
11175 "show ip community-list",
11176 SHOW_STR
11177 IP_STR
11178 "List community-list\n")
11179{
11180 struct community_list *list;
11181 struct community_list_master *cm;
11182
fee6e4e4 11183 cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER);
718e3744 11184 if (! cm)
11185 return CMD_SUCCESS;
11186
11187 for (list = cm->num.head; list; list = list->next)
11188 community_list_show (vty, list);
11189
11190 for (list = cm->str.head; list; list = list->next)
11191 community_list_show (vty, list);
11192
11193 return CMD_SUCCESS;
11194}
11195
11196DEFUN (show_ip_community_list_arg,
11197 show_ip_community_list_arg_cmd,
fee6e4e4 11198 "show ip community-list (<1-500>|WORD)",
718e3744 11199 SHOW_STR
11200 IP_STR
11201 "List community-list\n"
11202 "Community-list number\n"
11203 "Community-list name\n")
11204{
11205 struct community_list *list;
11206
fee6e4e4 11207 list = community_list_lookup (bgp_clist, argv[0], COMMUNITY_LIST_MASTER);
718e3744 11208 if (! list)
11209 {
b729294c 11210 vty_out (vty, "%% Can't find community-list%s", VTY_NEWLINE);
718e3744 11211 return CMD_WARNING;
11212 }
11213
11214 community_list_show (vty, list);
11215
11216 return CMD_SUCCESS;
11217}
6b0655a2 11218
94f2b392 11219static int
fd79ac91 11220extcommunity_list_set_vty (struct vty *vty, int argc, const char **argv,
11221 int style, int reject_all_digit_name)
718e3744 11222{
11223 int ret;
11224 int direct;
11225 char *str;
11226
11227 /* Check the list type. */
11228 if (strncmp (argv[1], "p", 1) == 0)
11229 direct = COMMUNITY_PERMIT;
11230 else if (strncmp (argv[1], "d", 1) == 0)
11231 direct = COMMUNITY_DENY;
11232 else
11233 {
11234 vty_out (vty, "%% Matching condition must be permit or deny%s",
11235 VTY_NEWLINE);
11236 return CMD_WARNING;
11237 }
11238
11239 /* All digit name check. */
11240 if (reject_all_digit_name && all_digit (argv[0]))
11241 {
11242 vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE);
11243 return CMD_WARNING;
11244 }
11245
11246 /* Concat community string argument. */
11247 if (argc > 1)
11248 str = argv_concat (argv, argc, 2);
11249 else
11250 str = NULL;
11251
11252 ret = extcommunity_list_set (bgp_clist, argv[0], str, direct, style);
11253
11254 /* Free temporary community list string allocated by
11255 argv_concat(). */
11256 if (str)
11257 XFREE (MTYPE_TMP, str);
11258
11259 if (ret < 0)
11260 {
11261 community_list_perror (vty, ret);
11262 return CMD_WARNING;
11263 }
11264 return CMD_SUCCESS;
11265}
11266
94f2b392 11267static int
fee6e4e4 11268extcommunity_list_unset_vty (struct vty *vty, int argc, const char **argv,
11269 int style)
718e3744 11270{
11271 int ret;
fee6e4e4 11272 int direct = 0;
11273 char *str = NULL;
718e3744 11274
fee6e4e4 11275 if (argc > 1)
718e3744 11276 {
fee6e4e4 11277 /* Check the list direct. */
11278 if (strncmp (argv[1], "p", 1) == 0)
11279 direct = COMMUNITY_PERMIT;
11280 else if (strncmp (argv[1], "d", 1) == 0)
11281 direct = COMMUNITY_DENY;
11282 else
11283 {
11284 vty_out (vty, "%% Matching condition must be permit or deny%s",
11285 VTY_NEWLINE);
11286 return CMD_WARNING;
11287 }
718e3744 11288
fee6e4e4 11289 /* Concat community string argument. */
11290 str = argv_concat (argv, argc, 2);
718e3744 11291 }
11292
718e3744 11293 /* Unset community list. */
11294 ret = extcommunity_list_unset (bgp_clist, argv[0], str, direct, style);
11295
11296 /* Free temporary community list string allocated by
11297 argv_concat(). */
fee6e4e4 11298 if (str)
11299 XFREE (MTYPE_TMP, str);
718e3744 11300
11301 if (ret < 0)
11302 {
11303 community_list_perror (vty, ret);
11304 return CMD_WARNING;
11305 }
11306
11307 return CMD_SUCCESS;
11308}
11309
11310/* "extcommunity-list" keyword help string. */
11311#define EXTCOMMUNITY_LIST_STR "Add a extended community list entry\n"
11312#define EXTCOMMUNITY_VAL_STR "Extended community attribute in 'rt aa:nn_or_IPaddr:nn' OR 'soo aa:nn_or_IPaddr:nn' format\n"
11313
11314DEFUN (ip_extcommunity_list_standard,
11315 ip_extcommunity_list_standard_cmd,
11316 "ip extcommunity-list <1-99> (deny|permit) .AA:NN",
11317 IP_STR
11318 EXTCOMMUNITY_LIST_STR
11319 "Extended Community list number (standard)\n"
11320 "Specify community to reject\n"
11321 "Specify community to accept\n"
11322 EXTCOMMUNITY_VAL_STR)
11323{
11324 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 0);
11325}
11326
11327ALIAS (ip_extcommunity_list_standard,
11328 ip_extcommunity_list_standard2_cmd,
11329 "ip extcommunity-list <1-99> (deny|permit)",
11330 IP_STR
11331 EXTCOMMUNITY_LIST_STR
11332 "Extended Community list number (standard)\n"
11333 "Specify community to reject\n"
11334 "Specify community to accept\n")
11335
11336DEFUN (ip_extcommunity_list_expanded,
11337 ip_extcommunity_list_expanded_cmd,
fee6e4e4 11338 "ip extcommunity-list <100-500> (deny|permit) .LINE",
718e3744 11339 IP_STR
11340 EXTCOMMUNITY_LIST_STR
11341 "Extended Community list number (expanded)\n"
11342 "Specify community to reject\n"
11343 "Specify community to accept\n"
11344 "An ordered list as a regular-expression\n")
11345{
11346 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 0);
11347}
11348
11349DEFUN (ip_extcommunity_list_name_standard,
11350 ip_extcommunity_list_name_standard_cmd,
11351 "ip extcommunity-list standard WORD (deny|permit) .AA:NN",
11352 IP_STR
11353 EXTCOMMUNITY_LIST_STR
11354 "Specify standard extcommunity-list\n"
11355 "Extended Community list name\n"
11356 "Specify community to reject\n"
11357 "Specify community to accept\n"
11358 EXTCOMMUNITY_VAL_STR)
11359{
11360 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD, 1);
11361}
11362
11363ALIAS (ip_extcommunity_list_name_standard,
11364 ip_extcommunity_list_name_standard2_cmd,
11365 "ip extcommunity-list standard WORD (deny|permit)",
11366 IP_STR
11367 EXTCOMMUNITY_LIST_STR
11368 "Specify standard extcommunity-list\n"
11369 "Extended Community list name\n"
11370 "Specify community to reject\n"
11371 "Specify community to accept\n")
11372
11373DEFUN (ip_extcommunity_list_name_expanded,
11374 ip_extcommunity_list_name_expanded_cmd,
11375 "ip extcommunity-list expanded WORD (deny|permit) .LINE",
11376 IP_STR
11377 EXTCOMMUNITY_LIST_STR
11378 "Specify expanded extcommunity-list\n"
11379 "Extended Community list name\n"
11380 "Specify community to reject\n"
11381 "Specify community to accept\n"
11382 "An ordered list as a regular-expression\n")
11383{
11384 return extcommunity_list_set_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED, 1);
11385}
11386
fee6e4e4 11387DEFUN (no_ip_extcommunity_list_standard_all,
11388 no_ip_extcommunity_list_standard_all_cmd,
11389 "no ip extcommunity-list <1-99>",
11390 NO_STR
11391 IP_STR
11392 EXTCOMMUNITY_LIST_STR
11393 "Extended Community list number (standard)\n")
11394{
11395 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
11396}
11397
11398DEFUN (no_ip_extcommunity_list_expanded_all,
11399 no_ip_extcommunity_list_expanded_all_cmd,
11400 "no ip extcommunity-list <100-500>",
718e3744 11401 NO_STR
11402 IP_STR
11403 EXTCOMMUNITY_LIST_STR
718e3744 11404 "Extended Community list number (expanded)\n")
11405{
fee6e4e4 11406 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
718e3744 11407}
11408
fee6e4e4 11409DEFUN (no_ip_extcommunity_list_name_standard_all,
11410 no_ip_extcommunity_list_name_standard_all_cmd,
11411 "no ip extcommunity-list standard WORD",
718e3744 11412 NO_STR
11413 IP_STR
11414 EXTCOMMUNITY_LIST_STR
11415 "Specify standard extcommunity-list\n"
fee6e4e4 11416 "Extended Community list name\n")
11417{
11418 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
11419}
11420
11421DEFUN (no_ip_extcommunity_list_name_expanded_all,
11422 no_ip_extcommunity_list_name_expanded_all_cmd,
11423 "no ip extcommunity-list expanded WORD",
11424 NO_STR
11425 IP_STR
11426 EXTCOMMUNITY_LIST_STR
718e3744 11427 "Specify expanded extcommunity-list\n"
11428 "Extended Community list name\n")
11429{
fee6e4e4 11430 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
718e3744 11431}
11432
11433DEFUN (no_ip_extcommunity_list_standard,
11434 no_ip_extcommunity_list_standard_cmd,
11435 "no ip extcommunity-list <1-99> (deny|permit) .AA:NN",
11436 NO_STR
11437 IP_STR
11438 EXTCOMMUNITY_LIST_STR
11439 "Extended Community list number (standard)\n"
11440 "Specify community to reject\n"
11441 "Specify community to accept\n"
11442 EXTCOMMUNITY_VAL_STR)
11443{
11444 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
11445}
11446
11447DEFUN (no_ip_extcommunity_list_expanded,
11448 no_ip_extcommunity_list_expanded_cmd,
fee6e4e4 11449 "no ip extcommunity-list <100-500> (deny|permit) .LINE",
718e3744 11450 NO_STR
11451 IP_STR
11452 EXTCOMMUNITY_LIST_STR
11453 "Extended Community list number (expanded)\n"
11454 "Specify community to reject\n"
11455 "Specify community to accept\n"
11456 "An ordered list as a regular-expression\n")
11457{
11458 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
11459}
11460
11461DEFUN (no_ip_extcommunity_list_name_standard,
11462 no_ip_extcommunity_list_name_standard_cmd,
11463 "no ip extcommunity-list standard WORD (deny|permit) .AA:NN",
11464 NO_STR
11465 IP_STR
11466 EXTCOMMUNITY_LIST_STR
11467 "Specify standard extcommunity-list\n"
11468 "Extended Community list name\n"
11469 "Specify community to reject\n"
11470 "Specify community to accept\n"
11471 EXTCOMMUNITY_VAL_STR)
11472{
11473 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_STANDARD);
11474}
11475
11476DEFUN (no_ip_extcommunity_list_name_expanded,
11477 no_ip_extcommunity_list_name_expanded_cmd,
11478 "no ip extcommunity-list expanded WORD (deny|permit) .LINE",
11479 NO_STR
11480 IP_STR
11481 EXTCOMMUNITY_LIST_STR
11482 "Specify expanded extcommunity-list\n"
11483 "Community list name\n"
11484 "Specify community to reject\n"
11485 "Specify community to accept\n"
11486 "An ordered list as a regular-expression\n")
11487{
11488 return extcommunity_list_unset_vty (vty, argc, argv, EXTCOMMUNITY_LIST_EXPANDED);
11489}
11490
94f2b392 11491static void
718e3744 11492extcommunity_list_show (struct vty *vty, struct community_list *list)
11493{
11494 struct community_entry *entry;
11495
11496 for (entry = list->head; entry; entry = entry->next)
11497 {
11498 if (entry == list->head)
11499 {
11500 if (all_digit (list->name))
11501 vty_out (vty, "Extended community %s list %s%s",
11502 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
11503 "standard" : "(expanded) access",
11504 list->name, VTY_NEWLINE);
11505 else
11506 vty_out (vty, "Named extended community %s list %s%s",
11507 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
11508 "standard" : "expanded",
11509 list->name, VTY_NEWLINE);
11510 }
11511 if (entry->any)
11512 vty_out (vty, " %s%s",
11513 community_direct_str (entry->direct), VTY_NEWLINE);
11514 else
11515 vty_out (vty, " %s %s%s",
11516 community_direct_str (entry->direct),
11517 entry->style == EXTCOMMUNITY_LIST_STANDARD ?
11518 entry->u.ecom->str : entry->config,
11519 VTY_NEWLINE);
11520 }
11521}
11522
11523DEFUN (show_ip_extcommunity_list,
11524 show_ip_extcommunity_list_cmd,
11525 "show ip extcommunity-list",
11526 SHOW_STR
11527 IP_STR
11528 "List extended-community list\n")
11529{
11530 struct community_list *list;
11531 struct community_list_master *cm;
11532
fee6e4e4 11533 cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER);
718e3744 11534 if (! cm)
11535 return CMD_SUCCESS;
11536
11537 for (list = cm->num.head; list; list = list->next)
11538 extcommunity_list_show (vty, list);
11539
11540 for (list = cm->str.head; list; list = list->next)
11541 extcommunity_list_show (vty, list);
11542
11543 return CMD_SUCCESS;
11544}
11545
11546DEFUN (show_ip_extcommunity_list_arg,
11547 show_ip_extcommunity_list_arg_cmd,
fee6e4e4 11548 "show ip extcommunity-list (<1-500>|WORD)",
718e3744 11549 SHOW_STR
11550 IP_STR
11551 "List extended-community list\n"
11552 "Extcommunity-list number\n"
11553 "Extcommunity-list name\n")
11554{
11555 struct community_list *list;
11556
fee6e4e4 11557 list = community_list_lookup (bgp_clist, argv[0], EXTCOMMUNITY_LIST_MASTER);
718e3744 11558 if (! list)
11559 {
b729294c 11560 vty_out (vty, "%% Can't find extcommunity-list%s", VTY_NEWLINE);
718e3744 11561 return CMD_WARNING;
11562 }
11563
11564 extcommunity_list_show (vty, list);
11565
11566 return CMD_SUCCESS;
11567}
6b0655a2 11568
718e3744 11569/* Return configuration string of community-list entry. */
fd79ac91 11570static const char *
718e3744 11571community_list_config_str (struct community_entry *entry)
11572{
fd79ac91 11573 const char *str;
718e3744 11574
11575 if (entry->any)
11576 str = "";
11577 else
11578 {
11579 if (entry->style == COMMUNITY_LIST_STANDARD)
11580 str = community_str (entry->u.com);
11581 else
11582 str = entry->config;
11583 }
11584 return str;
11585}
11586
11587/* Display community-list and extcommunity-list configuration. */
94f2b392 11588static int
718e3744 11589community_list_config_write (struct vty *vty)
11590{
11591 struct community_list *list;
11592 struct community_entry *entry;
11593 struct community_list_master *cm;
11594 int write = 0;
11595
11596 /* Community-list. */
fee6e4e4 11597 cm = community_list_master_lookup (bgp_clist, COMMUNITY_LIST_MASTER);
718e3744 11598
11599 for (list = cm->num.head; list; list = list->next)
11600 for (entry = list->head; entry; entry = entry->next)
11601 {
fee6e4e4 11602 vty_out (vty, "ip community-list %s %s %s%s",
11603 list->name, community_direct_str (entry->direct),
11604 community_list_config_str (entry),
11605 VTY_NEWLINE);
718e3744 11606 write++;
11607 }
11608 for (list = cm->str.head; list; list = list->next)
11609 for (entry = list->head; entry; entry = entry->next)
11610 {
11611 vty_out (vty, "ip community-list %s %s %s %s%s",
11612 entry->style == COMMUNITY_LIST_STANDARD
11613 ? "standard" : "expanded",
11614 list->name, community_direct_str (entry->direct),
11615 community_list_config_str (entry),
11616 VTY_NEWLINE);
11617 write++;
11618 }
11619
11620 /* Extcommunity-list. */
fee6e4e4 11621 cm = community_list_master_lookup (bgp_clist, EXTCOMMUNITY_LIST_MASTER);
718e3744 11622
11623 for (list = cm->num.head; list; list = list->next)
11624 for (entry = list->head; entry; entry = entry->next)
11625 {
fee6e4e4 11626 vty_out (vty, "ip extcommunity-list %s %s %s%s",
11627 list->name, community_direct_str (entry->direct),
11628 community_list_config_str (entry), VTY_NEWLINE);
718e3744 11629 write++;
11630 }
11631 for (list = cm->str.head; list; list = list->next)
11632 for (entry = list->head; entry; entry = entry->next)
11633 {
11634 vty_out (vty, "ip extcommunity-list %s %s %s %s%s",
11635 entry->style == EXTCOMMUNITY_LIST_STANDARD
11636 ? "standard" : "expanded",
11637 list->name, community_direct_str (entry->direct),
11638 community_list_config_str (entry), VTY_NEWLINE);
11639 write++;
11640 }
11641 return write;
11642}
11643
7fc626de 11644static struct cmd_node community_list_node =
718e3744 11645{
11646 COMMUNITY_LIST_NODE,
11647 "",
11648 1 /* Export to vtysh. */
11649};
11650
94f2b392 11651static void
11652community_list_vty (void)
718e3744 11653{
11654 install_node (&community_list_node, community_list_config_write);
11655
11656 /* Community-list. */
718e3744 11657 install_element (CONFIG_NODE, &ip_community_list_standard_cmd);
11658 install_element (CONFIG_NODE, &ip_community_list_standard2_cmd);
11659 install_element (CONFIG_NODE, &ip_community_list_expanded_cmd);
11660 install_element (CONFIG_NODE, &ip_community_list_name_standard_cmd);
11661 install_element (CONFIG_NODE, &ip_community_list_name_standard2_cmd);
11662 install_element (CONFIG_NODE, &ip_community_list_name_expanded_cmd);
fee6e4e4 11663 install_element (CONFIG_NODE, &no_ip_community_list_standard_all_cmd);
11664 install_element (CONFIG_NODE, &no_ip_community_list_expanded_all_cmd);
11665 install_element (CONFIG_NODE, &no_ip_community_list_name_standard_all_cmd);
11666 install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_all_cmd);
718e3744 11667 install_element (CONFIG_NODE, &no_ip_community_list_standard_cmd);
11668 install_element (CONFIG_NODE, &no_ip_community_list_expanded_cmd);
11669 install_element (CONFIG_NODE, &no_ip_community_list_name_standard_cmd);
11670 install_element (CONFIG_NODE, &no_ip_community_list_name_expanded_cmd);
11671 install_element (VIEW_NODE, &show_ip_community_list_cmd);
11672 install_element (VIEW_NODE, &show_ip_community_list_arg_cmd);
11673 install_element (ENABLE_NODE, &show_ip_community_list_cmd);
11674 install_element (ENABLE_NODE, &show_ip_community_list_arg_cmd);
11675
11676 /* Extcommunity-list. */
11677 install_element (CONFIG_NODE, &ip_extcommunity_list_standard_cmd);
11678 install_element (CONFIG_NODE, &ip_extcommunity_list_standard2_cmd);
11679 install_element (CONFIG_NODE, &ip_extcommunity_list_expanded_cmd);
11680 install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard_cmd);
11681 install_element (CONFIG_NODE, &ip_extcommunity_list_name_standard2_cmd);
11682 install_element (CONFIG_NODE, &ip_extcommunity_list_name_expanded_cmd);
fee6e4e4 11683 install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_all_cmd);
11684 install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_all_cmd);
11685 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_all_cmd);
11686 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_all_cmd);
718e3744 11687 install_element (CONFIG_NODE, &no_ip_extcommunity_list_standard_cmd);
11688 install_element (CONFIG_NODE, &no_ip_extcommunity_list_expanded_cmd);
11689 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_standard_cmd);
11690 install_element (CONFIG_NODE, &no_ip_extcommunity_list_name_expanded_cmd);
11691 install_element (VIEW_NODE, &show_ip_extcommunity_list_cmd);
11692 install_element (VIEW_NODE, &show_ip_extcommunity_list_arg_cmd);
11693 install_element (ENABLE_NODE, &show_ip_extcommunity_list_cmd);
11694 install_element (ENABLE_NODE, &show_ip_extcommunity_list_arg_cmd);
11695}