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