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