2 Copyright (C) 1996, 97, 98, 99, 2000 Kunihiro Ishiguro
4 This file is part of GNU Zebra.
6 GNU Zebra is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option) any
11 GNU Zebra is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Zebra; see the file COPYING. If not, write to the Free
18 Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
36 #include "bgpd/bgpd.h"
37 #include "bgpd/bgp_advertise.h"
38 #include "bgpd/bgp_attr.h"
39 #include "bgpd/bgp_aspath.h"
40 #include "bgpd/bgp_community.h"
41 #include "bgpd/bgp_ecommunity.h"
42 #include "bgpd/bgp_damp.h"
43 #include "bgpd/bgp_debug.h"
44 #include "bgpd/bgp_fsm.h"
45 #include "bgpd/bgp_mplsvpn.h"
46 #include "bgpd/bgp_nexthop.h"
47 #include "bgpd/bgp_open.h"
48 #include "bgpd/bgp_regex.h"
49 #include "bgpd/bgp_route.h"
50 #include "bgpd/bgp_zebra.h"
51 #include "bgpd/bgp_table.h"
52 #include "bgpd/bgp_vty.h"
53 #include "bgpd/bgp_mpath.h"
54 #include "bgpd/bgp_packet.h"
55 #include "bgpd/bgp_updgrp.h"
56 #include "bgpd/bgp_bfd.h"
58 static struct peer_group
*
59 listen_range_exists (struct bgp
*bgp
, struct prefix
*range
, int exact
);
61 /* Utility function to get address family from current node. */
63 bgp_node_afi (struct vty
*vty
)
65 if (vty
->node
== BGP_IPV6_NODE
|| vty
->node
== BGP_IPV6M_NODE
)
70 /* Utility function to get subsequent address family from current
73 bgp_node_safi (struct vty
*vty
)
75 if (vty
->node
== BGP_VPNV4_NODE
)
77 if (vty
->node
== BGP_IPV4M_NODE
|| vty
->node
== BGP_IPV6M_NODE
)
78 return SAFI_MULTICAST
;
83 peer_address_self_check (struct bgp
*bgp
, union sockunion
*su
)
85 struct interface
*ifp
= NULL
;
87 if (su
->sa
.sa_family
== AF_INET
)
88 ifp
= if_lookup_by_ipv4_exact (&su
->sin
.sin_addr
, bgp
->vrf_id
);
90 else if (su
->sa
.sa_family
== AF_INET6
)
91 ifp
= if_lookup_by_ipv6_exact (&su
->sin6
.sin6_addr
,
92 su
->sin6
.sin6_scope_id
, bgp
->vrf_id
);
93 #endif /* HAVE IPV6 */
101 /* Utility function for looking up peer from VTY. */
102 /* This is used only for configuration, so disallow if attempted on
103 * a dynamic neighbor.
106 peer_lookup_vty (struct vty
*vty
, const char *ip_str
)
115 ret
= str2sockunion (ip_str
, &su
);
118 peer
= peer_lookup_by_conf_if (bgp
, ip_str
);
121 if ((peer
= peer_lookup_by_hostname(bgp
, ip_str
)) == NULL
)
123 vty_out (vty
, "%% Malformed address or name: %s%s", ip_str
, VTY_NEWLINE
);
130 peer
= peer_lookup (bgp
, &su
);
133 vty_out (vty
, "%% Specify remote-as or peer-group commands first%s",
137 if (peer_dynamic_neighbor (peer
))
139 vty_out (vty
, "%% Operation not allowed on a dynamic neighbor%s",
148 /* Utility function for looking up peer or peer group. */
149 /* This is used only for configuration, so disallow if attempted on
150 * a dynamic neighbor.
153 peer_and_group_lookup_vty (struct vty
*vty
, const char *peer_str
)
158 struct peer
*peer
= NULL
;
159 struct peer_group
*group
= NULL
;
163 ret
= str2sockunion (peer_str
, &su
);
166 /* IP address, locate peer. */
167 peer
= peer_lookup (bgp
, &su
);
171 /* Not IP, could match either peer configured on interface or a group. */
172 peer
= peer_lookup_by_conf_if (bgp
, peer_str
);
174 group
= peer_group_lookup (bgp
, peer_str
);
179 if (peer_dynamic_neighbor (peer
))
181 vty_out (vty
, "%% Operation not allowed on a dynamic neighbor%s",
192 vty_out (vty
, "%% Specify remote-as or peer-group commands first%s",
199 bgp_vty_return (struct vty
*vty
, int ret
)
201 const char *str
= NULL
;
205 case BGP_ERR_INVALID_VALUE
:
206 str
= "Invalid value";
208 case BGP_ERR_INVALID_FLAG
:
209 str
= "Invalid flag";
211 case BGP_ERR_PEER_GROUP_SHUTDOWN
:
212 str
= "Peer-group has been shutdown. Activate the peer-group first";
214 case BGP_ERR_PEER_FLAG_CONFLICT
:
215 str
= "Can't set override-capability and strict-capability-match at the same time";
217 case BGP_ERR_PEER_GROUP_NO_REMOTE_AS
:
218 str
= "Specify remote-as or peer-group remote AS first";
220 case BGP_ERR_PEER_GROUP_CANT_CHANGE
:
221 str
= "Cannot change the peer-group. Deconfigure first";
223 case BGP_ERR_PEER_GROUP_MISMATCH
:
224 str
= "Peer is not a member of this peer-group";
226 case BGP_ERR_PEER_FILTER_CONFLICT
:
227 str
= "Prefix/distribute list can not co-exist";
229 case BGP_ERR_NOT_INTERNAL_PEER
:
230 str
= "Invalid command. Not an internal neighbor";
232 case BGP_ERR_REMOVE_PRIVATE_AS
:
233 str
= "remove-private-AS cannot be configured for IBGP peers";
235 case BGP_ERR_LOCAL_AS_ALLOWED_ONLY_FOR_EBGP
:
236 str
= "Local-AS allowed only for EBGP peers";
238 case BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS
:
239 str
= "Cannot have local-as same as BGP AS number";
241 case BGP_ERR_TCPSIG_FAILED
:
242 str
= "Error while applying TCP-Sig to session(s)";
244 case BGP_ERR_NO_EBGP_MULTIHOP_WITH_TTLHACK
:
245 str
= "ebgp-multihop and ttl-security cannot be configured together";
247 case BGP_ERR_NO_IBGP_WITH_TTLHACK
:
248 str
= "ttl-security only allowed for EBGP peers";
250 case BGP_ERR_AS_OVERRIDE
:
251 str
= "as-override cannot be configured for IBGP peers";
253 case BGP_ERR_INVALID_DYNAMIC_NEIGHBORS_LIMIT
:
254 str
= "Invalid limit for number of dynamic neighbors";
256 case BGP_ERR_DYNAMIC_NEIGHBORS_RANGE_EXISTS
:
257 str
= "Dynamic neighbor listen range already exists";
259 case BGP_ERR_INVALID_FOR_DYNAMIC_PEER
:
260 str
= "Operation not allowed on a dynamic neighbor";
265 vty_out (vty
, "%% %s%s", str
, VTY_NEWLINE
);
271 /* BGP clear sort. */
282 bgp_clear_vty_error (struct vty
*vty
, struct peer
*peer
, afi_t afi
,
283 safi_t safi
, int error
)
287 case BGP_ERR_AF_UNCONFIGURED
:
289 "%%BGP: Enable %s %s address family for the neighbor %s%s",
290 afi
== AFI_IP6
? "IPv6" : safi
== SAFI_MPLS_VPN
? "VPNv4" : "IPv4",
291 safi
== SAFI_MULTICAST
? "Multicast" : "Unicast",
292 peer
->host
, VTY_NEWLINE
);
294 case BGP_ERR_SOFT_RECONFIG_UNCONFIGURED
:
295 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
);
302 /* `clear ip bgp' functions. */
304 bgp_clear (struct vty
*vty
, struct bgp
*bgp
, afi_t afi
, safi_t safi
,
305 enum clear_sort sort
,enum bgp_clear_type stype
, const char *arg
)
309 struct listnode
*node
, *nnode
;
311 /* Clear all neighbors. */
313 * Pass along pointer to next node to peer_clear() when walking all nodes
314 * on the BGP instance as that may get freed if it is a doppelganger
316 if (sort
== clear_all
)
318 for (ALL_LIST_ELEMENTS (bgp
->peer
, node
, nnode
, peer
))
320 if (stype
== BGP_CLEAR_SOFT_NONE
)
321 ret
= peer_clear (peer
, &nnode
);
322 else if (peer
->afc
[afi
][safi
])
323 ret
= peer_clear_soft (peer
, afi
, safi
, stype
);
328 bgp_clear_vty_error (vty
, peer
, afi
, safi
, ret
);
331 /* This is to apply read-only mode on this clear. */
332 if (stype
== BGP_CLEAR_SOFT_NONE
)
333 bgp
->update_delay_over
= 0;
338 /* Clear specified neighbors. */
339 if (sort
== clear_peer
)
344 /* Make sockunion for lookup. */
345 ret
= str2sockunion (arg
, &su
);
348 peer
= peer_lookup_by_conf_if (bgp
, arg
);
351 peer
= peer_lookup_by_hostname(bgp
, arg
);
354 vty_out (vty
, "Malformed address or name: %s%s", arg
, VTY_NEWLINE
);
361 peer
= peer_lookup (bgp
, &su
);
364 vty_out (vty
, "%%BGP: Unknown neighbor - \"%s\"%s", arg
, VTY_NEWLINE
);
369 if (stype
== BGP_CLEAR_SOFT_NONE
)
370 ret
= peer_clear (peer
, NULL
);
372 ret
= peer_clear_soft (peer
, afi
, safi
, stype
);
375 bgp_clear_vty_error (vty
, peer
, afi
, safi
, ret
);
380 /* Clear all peer-group members. */
381 if (sort
== clear_group
)
383 struct peer_group
*group
;
385 group
= peer_group_lookup (bgp
, arg
);
388 vty_out (vty
, "%%BGP: No such peer-group %s%s", arg
, VTY_NEWLINE
);
392 for (ALL_LIST_ELEMENTS (group
->peer
, node
, nnode
, peer
))
394 if (stype
== BGP_CLEAR_SOFT_NONE
)
396 ret
= peer_clear (peer
, NULL
);
400 if (! peer
->afc
[afi
][safi
])
403 ret
= peer_clear_soft (peer
, afi
, safi
, stype
);
406 bgp_clear_vty_error (vty
, peer
, afi
, safi
, ret
);
411 if (sort
== clear_external
)
413 for (ALL_LIST_ELEMENTS (bgp
->peer
, node
, nnode
, peer
))
415 if (peer
->sort
== BGP_PEER_IBGP
)
418 if (stype
== BGP_CLEAR_SOFT_NONE
)
419 ret
= peer_clear (peer
, &nnode
);
421 ret
= peer_clear_soft (peer
, afi
, safi
, stype
);
424 bgp_clear_vty_error (vty
, peer
, afi
, safi
, ret
);
429 if (sort
== clear_as
)
434 VTY_GET_INTEGER_RANGE ("AS", as
, arg
, 1, BGP_AS4_MAX
);
436 for (ALL_LIST_ELEMENTS (bgp
->peer
, node
, nnode
, peer
))
442 if (stype
== BGP_CLEAR_SOFT_NONE
)
443 ret
= peer_clear (peer
, &nnode
);
445 ret
= peer_clear_soft (peer
, afi
, safi
, stype
);
448 bgp_clear_vty_error (vty
, peer
, afi
, safi
, ret
);
451 vty_out (vty
, "%%BGP: No peer is configured with AS %s%s", arg
,
460 bgp_clear_vty (struct vty
*vty
, const char *name
, afi_t afi
, safi_t safi
,
461 enum clear_sort sort
, enum bgp_clear_type stype
,
466 /* BGP structure lookup. */
469 bgp
= bgp_lookup_by_name (name
);
472 vty_out (vty
, "Can't find BGP instance %s%s", name
, VTY_NEWLINE
);
478 bgp
= bgp_get_default ();
481 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
486 return bgp_clear (vty
, bgp
, afi
, safi
, sort
, stype
, arg
);
489 /* clear soft inbound */
491 bgp_clear_star_soft_in (struct vty
*vty
)
493 bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, clear_all
,
494 BGP_CLEAR_SOFT_IN
, NULL
);
496 bgp_clear_vty (vty
, NULL
, AFI_IP6
, SAFI_UNICAST
, clear_all
,
497 BGP_CLEAR_SOFT_IN
, NULL
);
498 #endif /* HAVE_IPV6 */
501 /* clear soft outbound */
503 bgp_clear_star_soft_out (struct vty
*vty
)
505 bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, clear_all
,
506 BGP_CLEAR_SOFT_OUT
, NULL
);
508 bgp_clear_vty (vty
, NULL
, AFI_IP6
, SAFI_UNICAST
, clear_all
,
509 BGP_CLEAR_SOFT_OUT
, NULL
);
510 #endif /* HAVE_IPV6 */
514 /* BGP global configuration. */
516 DEFUN (bgp_multiple_instance_func
,
517 bgp_multiple_instance_cmd
,
518 "bgp multiple-instance",
520 "Enable bgp multiple instance\n")
522 bgp_option_set (BGP_OPT_MULTIPLE_INSTANCE
);
526 DEFUN (no_bgp_multiple_instance
,
527 no_bgp_multiple_instance_cmd
,
528 "no bgp multiple-instance",
531 "BGP multiple instance\n")
535 ret
= bgp_option_unset (BGP_OPT_MULTIPLE_INSTANCE
);
538 vty_out (vty
, "%% There are more than two BGP instances%s", VTY_NEWLINE
);
544 DEFUN (bgp_config_type
,
546 "bgp config-type (cisco|zebra)",
548 "Configuration type\n"
552 if (strncmp (argv
[0], "c", 1) == 0)
553 bgp_option_set (BGP_OPT_CONFIG_CISCO
);
555 bgp_option_unset (BGP_OPT_CONFIG_CISCO
);
560 DEFUN (no_bgp_config_type
,
561 no_bgp_config_type_cmd
,
562 "no bgp config-type",
565 "Display configuration type\n")
567 bgp_option_unset (BGP_OPT_CONFIG_CISCO
);
571 ALIAS (no_bgp_config_type
,
572 no_bgp_config_type_val_cmd
,
573 "no bgp config-type (cisco|zebra)",
576 "Configuration type\n"
580 DEFUN (no_synchronization
,
581 no_synchronization_cmd
,
582 "no synchronization",
584 "Perform IGP synchronization\n")
589 DEFUN (no_auto_summary
,
593 "Enable automatic network number summarization\n")
598 /* "router bgp" commands. */
601 "router bgp " CMD_AS_RANGE
,
609 const char *name
= NULL
;
610 enum bgp_instance_type inst_type
;
612 // "router bgp" without an ASN
615 //Pending: Make VRF option available for ASN less config
616 bgp
= bgp_get_default();
620 vty_out (vty
, "%% No BGP process is configured%s", VTY_NEWLINE
);
624 if (listcount(bm
->bgp
) > 1)
626 vty_out (vty
, "%% Multiple BGP processes are configured%s", VTY_NEWLINE
);
634 VTY_GET_INTEGER_RANGE ("AS", as
, argv
[0], 1, BGP_AS4_MAX
);
636 inst_type
= BGP_INSTANCE_TYPE_DEFAULT
;
640 if (!strcmp(argv
[1], "vrf"))
641 inst_type
= BGP_INSTANCE_TYPE_VRF
;
642 else if (!strcmp(argv
[1], "view"))
643 inst_type
= BGP_INSTANCE_TYPE_VIEW
;
646 ret
= bgp_get (&bgp
, &as
, name
, inst_type
);
649 case BGP_ERR_MULTIPLE_INSTANCE_NOT_SET
:
650 vty_out (vty
, "Please specify 'bgp multiple-instance' first%s",
653 case BGP_ERR_AS_MISMATCH
:
654 vty_out (vty
, "BGP is already running; AS is %u%s", as
, VTY_NEWLINE
);
656 case BGP_ERR_INSTANCE_MISMATCH
:
657 vty_out (vty
, "BGP instance name and AS number mismatch%s", VTY_NEWLINE
);
658 vty_out (vty
, "BGP instance is already running; AS is %u%s",
663 /* Pending: handle when user tries to change a view to vrf n vv. */
666 vty
->node
= BGP_NODE
;
673 router_bgp_instance_cmd
,
674 "router bgp " CMD_AS_RANGE
" (view|vrf) WORD",
678 "BGP view\nBGP VRF\n"
682 router_bgp_noasn_cmd
,
687 /* "no router bgp" commands. */
688 DEFUN (no_router_bgp
,
690 "no router bgp " CMD_AS_RANGE
,
698 const char *name
= NULL
;
700 VTY_GET_INTEGER_RANGE ("AS", as
, argv
[0], 1, BGP_AS4_MAX
);
705 /* Lookup bgp structure. */
706 bgp
= bgp_lookup (as
, name
);
709 vty_out (vty
, "%% Can't find BGP instance%s", VTY_NEWLINE
);
718 ALIAS (no_router_bgp
,
719 no_router_bgp_instance_cmd
,
720 "no router bgp " CMD_AS_RANGE
" (view|vrf) WORD",
725 "BGP view\nBGP VRF\n"
730 DEFUN (bgp_router_id
,
732 "bgp router-id A.B.C.D",
734 "Override configured router identifier\n"
735 "Manually configured router identifier\n")
743 ret
= inet_aton (argv
[0], &id
);
746 vty_out (vty
, "%% Malformed bgp router identifier%s", VTY_NEWLINE
);
750 if (IPV4_ADDR_SAME (&bgp
->router_id_static
, &id
))
753 bgp
->router_id_static
= id
;
754 bgp_router_id_set (bgp
, &id
);
759 DEFUN (no_bgp_router_id
,
760 no_bgp_router_id_cmd
,
764 "Override configured router identifier\n")
774 ret
= inet_aton (argv
[0], &id
);
777 vty_out (vty
, "%% Malformed BGP router identifier%s", VTY_NEWLINE
);
781 if (! IPV4_ADDR_SAME (&bgp
->router_id_static
, &id
))
783 vty_out (vty
, "%% BGP router-id doesn't match%s", VTY_NEWLINE
);
788 bgp
->router_id_static
.s_addr
= 0;
789 bgp_router_id_set (bgp
, &bgp
->router_id_zebra
);
794 ALIAS (no_bgp_router_id
,
795 no_bgp_router_id_val_cmd
,
796 "no bgp router-id A.B.C.D",
799 "Override configured router identifier\n"
800 "Manually configured router identifier\n")
802 /* BGP Cluster ID. */
804 DEFUN (bgp_cluster_id
,
806 "bgp cluster-id A.B.C.D",
808 "Configure Route-Reflector Cluster-id\n"
809 "Route-Reflector Cluster-id in IP address format\n")
813 struct in_addr cluster
;
817 ret
= inet_aton (argv
[0], &cluster
);
820 vty_out (vty
, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE
);
824 bgp_cluster_id_set (bgp
, &cluster
);
825 bgp_clear_star_soft_out (vty
);
830 ALIAS (bgp_cluster_id
,
831 bgp_cluster_id32_cmd
,
832 "bgp cluster-id <1-4294967295>",
834 "Configure Route-Reflector Cluster-id\n"
835 "Route-Reflector Cluster-id as 32 bit quantity\n")
837 DEFUN (no_bgp_cluster_id
,
838 no_bgp_cluster_id_cmd
,
842 "Configure Route-Reflector Cluster-id\n")
846 struct in_addr cluster
;
852 ret
= inet_aton (argv
[0], &cluster
);
855 vty_out (vty
, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE
);
860 bgp_cluster_id_unset (bgp
);
861 bgp_clear_star_soft_out (vty
);
866 ALIAS (no_bgp_cluster_id
,
867 no_bgp_cluster_id_ip_cmd
,
868 "no bgp cluster-id A.B.C.D",
871 "Configure Route-Reflector Cluster-id\n"
872 "Route-Reflector Cluster-id in IP address format\n")
874 ALIAS (no_bgp_cluster_id
,
875 no_bgp_cluster_id_decimal_cmd
,
876 "no bgp cluster-id <1-4294967295>",
879 "Configure Route-Reflector Cluster-id\n"
880 "Route-Reflector Cluster-id as 32 bit quantity\n")
882 DEFUN (bgp_confederation_identifier
,
883 bgp_confederation_identifier_cmd
,
884 "bgp confederation identifier " CMD_AS_RANGE
,
885 "BGP specific commands\n"
886 "AS confederation parameters\n"
888 "Set routing domain confederation AS\n")
895 VTY_GET_INTEGER_RANGE ("AS", as
, argv
[0], 1, BGP_AS4_MAX
);
897 bgp_confederation_id_set (bgp
, as
);
902 DEFUN (no_bgp_confederation_identifier
,
903 no_bgp_confederation_identifier_cmd
,
904 "no bgp confederation identifier",
906 "BGP specific commands\n"
907 "AS confederation parameters\n"
914 bgp_confederation_id_unset (bgp
);
919 ALIAS (no_bgp_confederation_identifier
,
920 no_bgp_confederation_identifier_arg_cmd
,
921 "no bgp confederation identifier " CMD_AS_RANGE
,
923 "BGP specific commands\n"
924 "AS confederation parameters\n"
926 "Set routing domain confederation AS\n")
928 DEFUN (bgp_confederation_peers
,
929 bgp_confederation_peers_cmd
,
930 "bgp confederation peers ." CMD_AS_RANGE
,
931 "BGP specific commands\n"
932 "AS confederation parameters\n"
933 "Peer ASs in BGP confederation\n"
942 for (i
= 0; i
< argc
; i
++)
944 VTY_GET_INTEGER_RANGE ("AS", as
, argv
[i
], 1, BGP_AS4_MAX
);
948 vty_out (vty
, "%% Local member-AS not allowed in confed peer list%s",
953 bgp_confederation_peers_add (bgp
, as
);
958 DEFUN (no_bgp_confederation_peers
,
959 no_bgp_confederation_peers_cmd
,
960 "no bgp confederation peers ." CMD_AS_RANGE
,
962 "BGP specific commands\n"
963 "AS confederation parameters\n"
964 "Peer ASs in BGP confederation\n"
973 for (i
= 0; i
< argc
; i
++)
975 VTY_GET_INTEGER_RANGE ("AS", as
, argv
[i
], 1, BGP_AS4_MAX
);
977 bgp_confederation_peers_remove (bgp
, as
);
983 * Central routine for maximum-paths configuration.
984 * @peer_type: BGP_PEER_EBGP or BGP_PEER_IBGP
985 * @set: 1 for setting values, 0 for removing the max-paths config.
988 bgp_maxpaths_config_vty (struct vty
*vty
, int peer_type
, const char *mpaths
,
989 u_int16_t options
, int set
)
992 u_int16_t maxpaths
= 0;
998 afi
= bgp_node_afi (vty
);
999 safi
= bgp_node_safi (vty
);
1003 VTY_GET_INTEGER_RANGE ("maximum-paths", maxpaths
, mpaths
, 1,
1005 ret
= bgp_maximum_paths_set (bgp
, afi
, safi
, peer_type
, maxpaths
,
1009 ret
= bgp_maximum_paths_unset (bgp
, afi
, safi
, peer_type
);
1014 "%% Failed to %sset maximum-paths %s %u for afi %u, safi %u%s",
1015 (set
== 1) ? "" : "un",
1016 (peer_type
== BGP_PEER_EBGP
) ? "ebgp" : "ibgp",
1017 maxpaths
, afi
, safi
, VTY_NEWLINE
);
1021 bgp_recalculate_all_bestpaths (bgp
);
1026 DEFUN (bgp_maxmed_admin
,
1027 bgp_maxmed_admin_cmd
,
1028 "bgp max-med administrative ",
1030 "Advertise routes with max-med\n"
1031 "Administratively applied, for an indefinite period\n")
1037 bgp
->v_maxmed_admin
= 1;
1038 bgp
->maxmed_admin_value
= BGP_MAXMED_VALUE_DEFAULT
;
1040 bgp_maxmed_update(bgp
);
1045 DEFUN (bgp_maxmed_admin_medv
,
1046 bgp_maxmed_admin_medv_cmd
,
1047 "bgp max-med administrative <0-4294967294>",
1049 "Advertise routes with max-med\n"
1050 "Administratively applied, for an indefinite period\n"
1051 "Max MED value to be used\n")
1057 bgp
->v_maxmed_admin
= 1;
1058 VTY_GET_INTEGER ("max-med admin med-value", bgp
->maxmed_admin_value
, argv
[0]);
1060 bgp_maxmed_update(bgp
);
1065 DEFUN (no_bgp_maxmed_admin
,
1066 no_bgp_maxmed_admin_cmd
,
1067 "no bgp max-med administrative",
1070 "Advertise routes with max-med\n"
1071 "Administratively applied, for an indefinite period\n")
1077 bgp
->v_maxmed_admin
= BGP_MAXMED_ADMIN_UNCONFIGURED
;
1078 bgp
->maxmed_admin_value
= BGP_MAXMED_VALUE_DEFAULT
;
1080 bgp_maxmed_update(bgp
);
1085 ALIAS (no_bgp_maxmed_admin
,
1086 no_bgp_maxmed_admin_medv_cmd
,
1087 "no bgp max-med administrative <0-4294967294>",
1090 "Advertise routes with max-med\n"
1091 "Administratively applied, for an indefinite period\n"
1092 "Max MED value to be used\n")
1095 DEFUN (bgp_maxmed_onstartup
,
1096 bgp_maxmed_onstartup_cmd
,
1097 "bgp max-med on-startup <5-86400>",
1099 "Advertise routes with max-med\n"
1100 "Effective on a startup\n"
1101 "Time (seconds) period for max-med\n")
1109 vty_out (vty
, "%% Must supply max-med on-startup period");
1113 VTY_GET_INTEGER ("max-med on-startup period", bgp
->v_maxmed_onstartup
, argv
[0]);
1114 bgp
->maxmed_onstartup_value
= BGP_MAXMED_VALUE_DEFAULT
;
1116 bgp_maxmed_update(bgp
);
1121 DEFUN (bgp_maxmed_onstartup_medv
,
1122 bgp_maxmed_onstartup_medv_cmd
,
1123 "bgp max-med on-startup <5-86400> <0-4294967294>",
1125 "Advertise routes with max-med\n"
1126 "Effective on a startup\n"
1127 "Time (seconds) period for max-med\n"
1128 "Max MED value to be used\n")
1136 vty_out (vty
, "%% Must supply max-med on-startup period and med value");
1140 VTY_GET_INTEGER ("max-med on-startup period", bgp
->v_maxmed_onstartup
, argv
[0]);
1141 VTY_GET_INTEGER ("max-med on-startup med-value", bgp
->maxmed_onstartup_value
, argv
[1]);
1143 bgp_maxmed_update(bgp
);
1148 DEFUN (no_bgp_maxmed_onstartup
,
1149 no_bgp_maxmed_onstartup_cmd
,
1150 "no bgp max-med on-startup",
1153 "Advertise routes with max-med\n"
1154 "Effective on a startup\n")
1160 /* Cancel max-med onstartup if its on */
1161 if (bgp
->t_maxmed_onstartup
)
1163 THREAD_TIMER_OFF (bgp
->t_maxmed_onstartup
);
1164 bgp
->maxmed_onstartup_over
= 1;
1167 bgp
->v_maxmed_onstartup
= BGP_MAXMED_ONSTARTUP_UNCONFIGURED
;
1168 bgp
->maxmed_onstartup_value
= BGP_MAXMED_VALUE_DEFAULT
;
1170 bgp_maxmed_update(bgp
);
1175 ALIAS (no_bgp_maxmed_onstartup
,
1176 no_bgp_maxmed_onstartup_period_cmd
,
1177 "no bgp max-med on-startup <5-86400>",
1180 "Advertise routes with max-med\n"
1181 "Effective on a startup\n"
1182 "Time (seconds) period for max-med\n")
1184 ALIAS (no_bgp_maxmed_onstartup
,
1185 no_bgp_maxmed_onstartup_period_medv_cmd
,
1186 "no bgp max-med on-startup <5-86400> <0-4294967294>",
1189 "Advertise routes with max-med\n"
1190 "Effective on a startup\n"
1191 "Time (seconds) period for max-med\n"
1192 "Max MED value to be used\n")
1195 bgp_update_delay_config_vty (struct vty
*vty
, const char *delay
,
1199 u_int16_t update_delay
;
1200 u_int16_t establish_wait
;
1205 VTY_GET_INTEGER_RANGE ("update-delay", update_delay
, delay
,
1206 BGP_UPDATE_DELAY_MIN
, BGP_UPDATE_DELAY_MAX
);
1208 if (!wait
) /* update-delay <delay> */
1210 bgp
->v_update_delay
= update_delay
;
1211 bgp
->v_establish_wait
= bgp
->v_update_delay
;
1215 /* update-delay <delay> <establish-wait> */
1216 establish_wait
= atoi (wait
);
1217 if (update_delay
< establish_wait
)
1219 vty_out (vty
, "%%Failed: update-delay less than the establish-wait!%s",
1224 bgp
->v_update_delay
= update_delay
;
1225 bgp
->v_establish_wait
= establish_wait
;
1231 bgp_update_delay_deconfig_vty (struct vty
*vty
)
1237 bgp
->v_update_delay
= BGP_UPDATE_DELAY_DEF
;
1238 bgp
->v_establish_wait
= bgp
->v_update_delay
;
1244 bgp_config_write_update_delay (struct vty
*vty
, struct bgp
*bgp
)
1246 if (bgp
->v_update_delay
!= BGP_UPDATE_DELAY_DEF
)
1248 vty_out (vty
, " update-delay %d", bgp
->v_update_delay
);
1249 if (bgp
->v_update_delay
!= bgp
->v_establish_wait
)
1250 vty_out (vty
, " %d", bgp
->v_establish_wait
);
1251 vty_out (vty
, "%s", VTY_NEWLINE
);
1258 /* Update-delay configuration */
1259 DEFUN (bgp_update_delay
,
1260 bgp_update_delay_cmd
,
1261 "update-delay <0-3600>",
1262 "Force initial delay for best-path and updates\n"
1265 return bgp_update_delay_config_vty(vty
, argv
[0], NULL
);
1268 DEFUN (bgp_update_delay_establish_wait
,
1269 bgp_update_delay_establish_wait_cmd
,
1270 "update-delay <0-3600> <1-3600>",
1271 "Force initial delay for best-path and updates\n"
1273 "Wait for peers to be established\n"
1276 return bgp_update_delay_config_vty(vty
, argv
[0], argv
[1]);
1279 /* Update-delay deconfiguration */
1280 DEFUN (no_bgp_update_delay
,
1281 no_bgp_update_delay_cmd
,
1282 "no update-delay <0-3600>",
1283 "Force initial delay for best-path and updates\n"
1286 return bgp_update_delay_deconfig_vty(vty
);
1289 ALIAS (no_bgp_update_delay
,
1290 no_bgp_update_delay_establish_wait_cmd
,
1291 "no update-delay <0-3600> <1-3600>",
1292 "Force initial delay for best-path and updates\n"
1294 "Wait for peers to be established\n"
1298 bgp_wpkt_quanta_config_vty (struct vty
*vty
, const char *num
, char set
)
1305 VTY_GET_INTEGER_RANGE ("write-quanta", bgp
->wpkt_quanta
, num
,
1308 bgp
->wpkt_quanta
= BGP_WRITE_PACKET_MAX
;
1314 bgp_config_write_wpkt_quanta (struct vty
*vty
, struct bgp
*bgp
)
1316 if (bgp
->wpkt_quanta
!= BGP_WRITE_PACKET_MAX
)
1317 vty_out (vty
, " write-quanta %d%s",
1318 bgp
->wpkt_quanta
, VTY_NEWLINE
);
1324 /* Update-delay configuration */
1325 DEFUN (bgp_wpkt_quanta
,
1326 bgp_wpkt_quanta_cmd
,
1327 "write-quanta <1-10000>",
1328 "How many packets to write to peer socket per run\n"
1329 "Number of packets\n")
1331 return bgp_wpkt_quanta_config_vty(vty
, argv
[0], 1);
1334 /* Update-delay deconfiguration */
1335 DEFUN (no_bgp_wpkt_quanta
,
1336 no_bgp_wpkt_quanta_cmd
,
1337 "no write-quanta <1-10000>",
1338 "How many packets to write to peer socket per run\n"
1339 "Number of packets\n")
1341 return bgp_wpkt_quanta_config_vty(vty
, argv
[0], 0);
1345 bgp_coalesce_config_vty (struct vty
*vty
, const char *num
, char set
)
1352 VTY_GET_INTEGER_RANGE ("coalesce-time", bgp
->coalesce_time
, num
,
1355 bgp
->coalesce_time
= BGP_DEFAULT_SUBGROUP_COALESCE_TIME
;
1361 bgp_config_write_coalesce_time (struct vty
*vty
, struct bgp
*bgp
)
1363 if (bgp
->coalesce_time
!= BGP_DEFAULT_SUBGROUP_COALESCE_TIME
)
1364 vty_out (vty
, " coalesce-time %d%s",
1365 bgp
->coalesce_time
, VTY_NEWLINE
);
1371 DEFUN (bgp_coalesce_time
,
1372 bgp_coalesce_time_cmd
,
1373 "coalesce-time <0-4294967295>",
1374 "Subgroup coalesce timer\n"
1375 "Subgroup coalesce timer value (in ms)\n")
1377 return bgp_coalesce_config_vty(vty
, argv
[0], 1);
1380 DEFUN (no_bgp_coalesce_time
,
1381 no_bgp_coalesce_time_cmd
,
1382 "no coalesce-time <0-4294967295>",
1383 "Subgroup coalesce timer\n"
1384 "Subgroup coalesce timer value (in ms)\n")
1386 return bgp_coalesce_config_vty(vty
, argv
[0], 0);
1389 /* Maximum-paths configuration */
1390 DEFUN (bgp_maxpaths
,
1392 "maximum-paths " CMD_RANGE_STR(1, MULTIPATH_NUM
),
1393 "Forward packets over multiple paths\n"
1394 "Number of paths\n")
1396 return bgp_maxpaths_config_vty(vty
, BGP_PEER_EBGP
, argv
[0], 0, 1);
1399 DEFUN (bgp_maxpaths_ibgp
,
1400 bgp_maxpaths_ibgp_cmd
,
1401 "maximum-paths ibgp " CMD_RANGE_STR(1, MULTIPATH_NUM
),
1402 "Forward packets over multiple paths\n"
1404 "Number of paths\n")
1406 return bgp_maxpaths_config_vty(vty
, BGP_PEER_IBGP
, argv
[0], 0, 1);
1409 DEFUN (bgp_maxpaths_ibgp_cluster
,
1410 bgp_maxpaths_ibgp_cluster_cmd
,
1411 "maximum-paths ibgp " CMD_RANGE_STR(1, MULTIPATH_NUM
) " equal-cluster-length",
1412 "Forward packets over multiple paths\n"
1415 "Match the cluster length\n")
1417 return bgp_maxpaths_config_vty(vty
, BGP_PEER_IBGP
, argv
[0],
1418 BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN
, 1);
1421 DEFUN (no_bgp_maxpaths
,
1422 no_bgp_maxpaths_cmd
,
1425 "Forward packets over multiple paths\n"
1426 "Number of paths\n")
1428 return bgp_maxpaths_config_vty(vty
, BGP_PEER_EBGP
, NULL
, 0, 0);
1431 ALIAS (no_bgp_maxpaths
,
1432 no_bgp_maxpaths_arg_cmd
,
1433 "no maximum-paths " CMD_RANGE_STR(1, MULTIPATH_NUM
),
1435 "Forward packets over multiple paths\n"
1436 "Number of paths\n")
1438 DEFUN (no_bgp_maxpaths_ibgp
,
1439 no_bgp_maxpaths_ibgp_cmd
,
1440 "no maximum-paths ibgp",
1442 "Forward packets over multiple paths\n"
1444 "Number of paths\n")
1446 return bgp_maxpaths_config_vty(vty
, BGP_PEER_IBGP
, NULL
, 0, 0);
1449 ALIAS (no_bgp_maxpaths_ibgp
,
1450 no_bgp_maxpaths_ibgp_arg_cmd
,
1451 "no maximum-paths ibgp " CMD_RANGE_STR(1, MULTIPATH_NUM
),
1453 "Forward packets over multiple paths\n"
1455 "Number of paths\n")
1457 ALIAS (no_bgp_maxpaths_ibgp
,
1458 no_bgp_maxpaths_ibgp_cluster_cmd
,
1459 "no maximum-paths ibgp " CMD_RANGE_STR(1, MULTIPATH_NUM
) " equal-cluster-length",
1461 "Forward packets over multiple paths\n"
1464 "Match the cluster length\n")
1467 bgp_config_write_maxpaths (struct vty
*vty
, struct bgp
*bgp
, afi_t afi
,
1468 safi_t safi
, int *write
)
1470 if (bgp
->maxpaths
[afi
][safi
].maxpaths_ebgp
!= MULTIPATH_NUM
)
1472 bgp_config_write_family_header (vty
, afi
, safi
, write
);
1473 vty_out (vty
, " maximum-paths %d%s",
1474 bgp
->maxpaths
[afi
][safi
].maxpaths_ebgp
, VTY_NEWLINE
);
1477 if (bgp
->maxpaths
[afi
][safi
].maxpaths_ibgp
!= MULTIPATH_NUM
)
1479 bgp_config_write_family_header (vty
, afi
, safi
, write
);
1480 vty_out (vty
, " maximum-paths ibgp %d",
1481 bgp
->maxpaths
[afi
][safi
].maxpaths_ibgp
);
1482 if (CHECK_FLAG (bgp
->maxpaths
[afi
][safi
].ibgp_flags
,
1483 BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN
))
1484 vty_out (vty
, " equal-cluster-length");
1485 vty_out (vty
, "%s", VTY_NEWLINE
);
1495 "timers bgp <0-65535> <0-65535>",
1496 "Adjust routing timers\n"
1498 "Keepalive interval\n"
1502 unsigned long keepalive
= 0;
1503 unsigned long holdtime
= 0;
1507 VTY_GET_INTEGER ("keepalive", keepalive
, argv
[0]);
1508 VTY_GET_INTEGER ("holdtime", holdtime
, argv
[1]);
1510 /* Holdtime value check. */
1511 if (holdtime
< 3 && holdtime
!= 0)
1513 vty_out (vty
, "%% hold time value must be either 0 or greater than 3%s",
1518 bgp_timers_set (bgp
, keepalive
, holdtime
);
1523 DEFUN (no_bgp_timers
,
1527 "Adjust routing timers\n"
1533 bgp_timers_unset (bgp
);
1538 ALIAS (no_bgp_timers
,
1539 no_bgp_timers_arg_cmd
,
1540 "no timers bgp <0-65535> <0-65535>",
1542 "Adjust routing timers\n"
1544 "Keepalive interval\n"
1547 DEFUN (bgp_client_to_client_reflection
,
1548 bgp_client_to_client_reflection_cmd
,
1549 "bgp client-to-client reflection",
1550 "BGP specific commands\n"
1551 "Configure client to client route reflection\n"
1552 "reflection of routes allowed\n")
1557 bgp_flag_unset (bgp
, BGP_FLAG_NO_CLIENT_TO_CLIENT
);
1558 bgp_clear_star_soft_out (vty
);
1563 DEFUN (no_bgp_client_to_client_reflection
,
1564 no_bgp_client_to_client_reflection_cmd
,
1565 "no bgp client-to-client reflection",
1567 "BGP specific commands\n"
1568 "Configure client to client route reflection\n"
1569 "reflection of routes allowed\n")
1574 bgp_flag_set (bgp
, BGP_FLAG_NO_CLIENT_TO_CLIENT
);
1575 bgp_clear_star_soft_out (vty
);
1580 /* "bgp always-compare-med" configuration. */
1581 DEFUN (bgp_always_compare_med
,
1582 bgp_always_compare_med_cmd
,
1583 "bgp always-compare-med",
1584 "BGP specific commands\n"
1585 "Allow comparing MED from different neighbors\n")
1590 bgp_flag_set (bgp
, BGP_FLAG_ALWAYS_COMPARE_MED
);
1591 bgp_recalculate_all_bestpaths (bgp
);
1596 DEFUN (no_bgp_always_compare_med
,
1597 no_bgp_always_compare_med_cmd
,
1598 "no bgp always-compare-med",
1600 "BGP specific commands\n"
1601 "Allow comparing MED from different neighbors\n")
1606 bgp_flag_unset (bgp
, BGP_FLAG_ALWAYS_COMPARE_MED
);
1607 bgp_recalculate_all_bestpaths (bgp
);
1612 /* "bgp deterministic-med" configuration. */
1613 DEFUN (bgp_deterministic_med
,
1614 bgp_deterministic_med_cmd
,
1615 "bgp deterministic-med",
1616 "BGP specific commands\n"
1617 "Pick the best-MED path among paths advertised from the neighboring AS\n")
1623 if (!bgp_flag_check(bgp
, BGP_FLAG_DETERMINISTIC_MED
))
1625 bgp_flag_set (bgp
, BGP_FLAG_DETERMINISTIC_MED
);
1626 bgp_recalculate_all_bestpaths (bgp
);
1632 DEFUN (no_bgp_deterministic_med
,
1633 no_bgp_deterministic_med_cmd
,
1634 "no bgp deterministic-med",
1636 "BGP specific commands\n"
1637 "Pick the best-MED path among paths advertised from the neighboring AS\n")
1640 int bestpath_per_as_used
;
1644 struct listnode
*node
, *nnode
;
1648 if (bgp_flag_check(bgp
, BGP_FLAG_DETERMINISTIC_MED
))
1650 bestpath_per_as_used
= 0;
1652 for (ALL_LIST_ELEMENTS (bgp
->peer
, node
, nnode
, peer
))
1654 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
1655 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
1656 if (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS
))
1658 bestpath_per_as_used
= 1;
1662 if (bestpath_per_as_used
)
1666 if (bestpath_per_as_used
)
1668 vty_out (vty
, "bgp deterministic-med cannot be disabled while addpath-tx-bestpath-per-AS is in use%s",
1674 bgp_flag_unset (bgp
, BGP_FLAG_DETERMINISTIC_MED
);
1675 bgp_recalculate_all_bestpaths (bgp
);
1682 /* "bgp graceful-restart" configuration. */
1683 DEFUN (bgp_graceful_restart
,
1684 bgp_graceful_restart_cmd
,
1685 "bgp graceful-restart",
1686 "BGP specific commands\n"
1687 "Graceful restart capability parameters\n")
1692 bgp_flag_set (bgp
, BGP_FLAG_GRACEFUL_RESTART
);
1696 DEFUN (no_bgp_graceful_restart
,
1697 no_bgp_graceful_restart_cmd
,
1698 "no bgp graceful-restart",
1700 "BGP specific commands\n"
1701 "Graceful restart capability parameters\n")
1706 bgp_flag_unset (bgp
, BGP_FLAG_GRACEFUL_RESTART
);
1710 DEFUN (bgp_graceful_restart_stalepath_time
,
1711 bgp_graceful_restart_stalepath_time_cmd
,
1712 "bgp graceful-restart stalepath-time <1-3600>",
1713 "BGP specific commands\n"
1714 "Graceful restart capability parameters\n"
1715 "Set the max time to hold onto restarting peer's stale paths\n"
1716 "Delay value (seconds)\n")
1719 u_int32_t stalepath
;
1725 VTY_GET_INTEGER_RANGE ("stalepath-time", stalepath
, argv
[0], 1, 3600);
1726 bgp
->stalepath_time
= stalepath
;
1730 DEFUN (no_bgp_graceful_restart_stalepath_time
,
1731 no_bgp_graceful_restart_stalepath_time_cmd
,
1732 "no bgp graceful-restart stalepath-time",
1734 "BGP specific commands\n"
1735 "Graceful restart capability parameters\n"
1736 "Set the max time to hold onto restarting peer's stale paths\n")
1744 bgp
->stalepath_time
= BGP_DEFAULT_STALEPATH_TIME
;
1748 ALIAS (no_bgp_graceful_restart_stalepath_time
,
1749 no_bgp_graceful_restart_stalepath_time_val_cmd
,
1750 "no bgp graceful-restart stalepath-time <1-3600>",
1752 "BGP specific commands\n"
1753 "Graceful restart capability parameters\n"
1754 "Set the max time to hold onto restarting peer's stale paths\n"
1755 "Delay value (seconds)\n")
1757 /* "bgp fast-external-failover" configuration. */
1758 DEFUN (bgp_fast_external_failover
,
1759 bgp_fast_external_failover_cmd
,
1760 "bgp fast-external-failover",
1762 "Immediately reset session if a link to a directly connected external peer goes down\n")
1767 bgp_flag_unset (bgp
, BGP_FLAG_NO_FAST_EXT_FAILOVER
);
1771 DEFUN (no_bgp_fast_external_failover
,
1772 no_bgp_fast_external_failover_cmd
,
1773 "no bgp fast-external-failover",
1776 "Immediately reset session if a link to a directly connected external peer goes down\n")
1781 bgp_flag_set (bgp
, BGP_FLAG_NO_FAST_EXT_FAILOVER
);
1785 /* "bgp enforce-first-as" configuration. */
1786 DEFUN (bgp_enforce_first_as
,
1787 bgp_enforce_first_as_cmd
,
1788 "bgp enforce-first-as",
1790 "Enforce the first AS for EBGP routes\n")
1795 bgp_flag_set (bgp
, BGP_FLAG_ENFORCE_FIRST_AS
);
1796 bgp_clear_star_soft_in (vty
);
1801 DEFUN (no_bgp_enforce_first_as
,
1802 no_bgp_enforce_first_as_cmd
,
1803 "no bgp enforce-first-as",
1806 "Enforce the first AS for EBGP routes\n")
1811 bgp_flag_unset (bgp
, BGP_FLAG_ENFORCE_FIRST_AS
);
1812 bgp_clear_star_soft_in (vty
);
1817 /* "bgp bestpath compare-routerid" configuration. */
1818 DEFUN (bgp_bestpath_compare_router_id
,
1819 bgp_bestpath_compare_router_id_cmd
,
1820 "bgp bestpath compare-routerid",
1821 "BGP specific commands\n"
1822 "Change the default bestpath selection\n"
1823 "Compare router-id for identical EBGP paths\n")
1828 bgp_flag_set (bgp
, BGP_FLAG_COMPARE_ROUTER_ID
);
1829 bgp_recalculate_all_bestpaths (bgp
);
1834 DEFUN (no_bgp_bestpath_compare_router_id
,
1835 no_bgp_bestpath_compare_router_id_cmd
,
1836 "no bgp bestpath compare-routerid",
1838 "BGP specific commands\n"
1839 "Change the default bestpath selection\n"
1840 "Compare router-id for identical EBGP paths\n")
1845 bgp_flag_unset (bgp
, BGP_FLAG_COMPARE_ROUTER_ID
);
1846 bgp_recalculate_all_bestpaths (bgp
);
1851 /* "bgp bestpath as-path ignore" configuration. */
1852 DEFUN (bgp_bestpath_aspath_ignore
,
1853 bgp_bestpath_aspath_ignore_cmd
,
1854 "bgp bestpath as-path ignore",
1855 "BGP specific commands\n"
1856 "Change the default bestpath selection\n"
1857 "AS-path attribute\n"
1858 "Ignore as-path length in selecting a route\n")
1863 bgp_flag_set (bgp
, BGP_FLAG_ASPATH_IGNORE
);
1864 bgp_recalculate_all_bestpaths (bgp
);
1869 DEFUN (no_bgp_bestpath_aspath_ignore
,
1870 no_bgp_bestpath_aspath_ignore_cmd
,
1871 "no bgp bestpath as-path ignore",
1873 "BGP specific commands\n"
1874 "Change the default bestpath selection\n"
1875 "AS-path attribute\n"
1876 "Ignore as-path length in selecting a route\n")
1881 bgp_flag_unset (bgp
, BGP_FLAG_ASPATH_IGNORE
);
1882 bgp_recalculate_all_bestpaths (bgp
);
1887 /* "bgp bestpath as-path confed" configuration. */
1888 DEFUN (bgp_bestpath_aspath_confed
,
1889 bgp_bestpath_aspath_confed_cmd
,
1890 "bgp bestpath as-path confed",
1891 "BGP specific commands\n"
1892 "Change the default bestpath selection\n"
1893 "AS-path attribute\n"
1894 "Compare path lengths including confederation sets & sequences in selecting a route\n")
1899 bgp_flag_set (bgp
, BGP_FLAG_ASPATH_CONFED
);
1900 bgp_recalculate_all_bestpaths (bgp
);
1905 DEFUN (no_bgp_bestpath_aspath_confed
,
1906 no_bgp_bestpath_aspath_confed_cmd
,
1907 "no bgp bestpath as-path confed",
1909 "BGP specific commands\n"
1910 "Change the default bestpath selection\n"
1911 "AS-path attribute\n"
1912 "Compare path lengths including confederation sets & sequences in selecting a route\n")
1917 bgp_flag_unset (bgp
, BGP_FLAG_ASPATH_CONFED
);
1918 bgp_recalculate_all_bestpaths (bgp
);
1923 /* "bgp bestpath as-path multipath-relax" configuration. */
1924 DEFUN (bgp_bestpath_aspath_multipath_relax
,
1925 bgp_bestpath_aspath_multipath_relax_cmd
,
1926 "bgp bestpath as-path multipath-relax {as-set|no-as-set}",
1927 "BGP specific commands\n"
1928 "Change the default bestpath selection\n"
1929 "AS-path attribute\n"
1930 "Allow load sharing across routes that have different AS paths (but same length)\n"
1931 "Generate an AS_SET\n"
1932 "Do not generate an AS_SET\n")
1937 bgp_flag_set (bgp
, BGP_FLAG_ASPATH_MULTIPATH_RELAX
);
1939 /* no-as-set is now the default behavior so we can silently
1941 if (argv
[0] != NULL
&& strncmp (argv
[0], "a", 1) == 0)
1942 bgp_flag_set (bgp
, BGP_FLAG_MULTIPATH_RELAX_AS_SET
);
1944 bgp_flag_unset (bgp
, BGP_FLAG_MULTIPATH_RELAX_AS_SET
) ;
1946 bgp_recalculate_all_bestpaths (bgp
);
1951 DEFUN (no_bgp_bestpath_aspath_multipath_relax
,
1952 no_bgp_bestpath_aspath_multipath_relax_cmd
,
1953 "no bgp bestpath as-path multipath-relax {as-set|no-as-set}",
1955 "BGP specific commands\n"
1956 "Change the default bestpath selection\n"
1957 "AS-path attribute\n"
1958 "Allow load sharing across routes that have different AS paths (but same length)\n"
1959 "Generate an AS_SET\n"
1960 "Do not generate an AS_SET\n")
1965 bgp_flag_unset (bgp
, BGP_FLAG_ASPATH_MULTIPATH_RELAX
);
1966 bgp_flag_unset (bgp
, BGP_FLAG_MULTIPATH_RELAX_AS_SET
);
1967 bgp_recalculate_all_bestpaths (bgp
);
1972 /* "bgp log-neighbor-changes" configuration. */
1973 DEFUN (bgp_log_neighbor_changes
,
1974 bgp_log_neighbor_changes_cmd
,
1975 "bgp log-neighbor-changes",
1976 "BGP specific commands\n"
1977 "Log neighbor up/down and reset reason\n")
1982 bgp_flag_set (bgp
, BGP_FLAG_LOG_NEIGHBOR_CHANGES
);
1986 DEFUN (no_bgp_log_neighbor_changes
,
1987 no_bgp_log_neighbor_changes_cmd
,
1988 "no bgp log-neighbor-changes",
1990 "BGP specific commands\n"
1991 "Log neighbor up/down and reset reason\n")
1996 bgp_flag_unset (bgp
, BGP_FLAG_LOG_NEIGHBOR_CHANGES
);
2000 /* "bgp bestpath med" configuration. */
2001 DEFUN (bgp_bestpath_med
,
2002 bgp_bestpath_med_cmd
,
2003 "bgp bestpath med (confed|missing-as-worst)",
2004 "BGP specific commands\n"
2005 "Change the default bestpath selection\n"
2007 "Compare MED among confederation paths\n"
2008 "Treat missing MED as the least preferred one\n")
2014 if (strncmp (argv
[0], "confed", 1) == 0)
2015 bgp_flag_set (bgp
, BGP_FLAG_MED_CONFED
);
2017 bgp_flag_set (bgp
, BGP_FLAG_MED_MISSING_AS_WORST
);
2019 bgp_recalculate_all_bestpaths (bgp
);
2024 DEFUN (bgp_bestpath_med2
,
2025 bgp_bestpath_med2_cmd
,
2026 "bgp bestpath med confed missing-as-worst",
2027 "BGP specific commands\n"
2028 "Change the default bestpath selection\n"
2030 "Compare MED among confederation paths\n"
2031 "Treat missing MED as the least preferred one\n")
2036 bgp_flag_set (bgp
, BGP_FLAG_MED_CONFED
);
2037 bgp_flag_set (bgp
, BGP_FLAG_MED_MISSING_AS_WORST
);
2038 bgp_recalculate_all_bestpaths (bgp
);
2043 ALIAS (bgp_bestpath_med2
,
2044 bgp_bestpath_med3_cmd
,
2045 "bgp bestpath med missing-as-worst confed",
2046 "BGP specific commands\n"
2047 "Change the default bestpath selection\n"
2049 "Treat missing MED as the least preferred one\n"
2050 "Compare MED among confederation paths\n")
2052 DEFUN (no_bgp_bestpath_med
,
2053 no_bgp_bestpath_med_cmd
,
2054 "no bgp bestpath med (confed|missing-as-worst)",
2056 "BGP specific commands\n"
2057 "Change the default bestpath selection\n"
2059 "Compare MED among confederation paths\n"
2060 "Treat missing MED as the least preferred one\n")
2066 if (strncmp (argv
[0], "confed", 1) == 0)
2067 bgp_flag_unset (bgp
, BGP_FLAG_MED_CONFED
);
2069 bgp_flag_unset (bgp
, BGP_FLAG_MED_MISSING_AS_WORST
);
2071 bgp_recalculate_all_bestpaths (bgp
);
2076 DEFUN (no_bgp_bestpath_med2
,
2077 no_bgp_bestpath_med2_cmd
,
2078 "no bgp bestpath med confed missing-as-worst",
2080 "BGP specific commands\n"
2081 "Change the default bestpath selection\n"
2083 "Compare MED among confederation paths\n"
2084 "Treat missing MED as the least preferred one\n")
2089 bgp_flag_unset (bgp
, BGP_FLAG_MED_CONFED
);
2090 bgp_flag_unset (bgp
, BGP_FLAG_MED_MISSING_AS_WORST
);
2091 bgp_recalculate_all_bestpaths (bgp
);
2096 ALIAS (no_bgp_bestpath_med2
,
2097 no_bgp_bestpath_med3_cmd
,
2098 "no bgp bestpath med missing-as-worst confed",
2100 "BGP specific commands\n"
2101 "Change the default bestpath selection\n"
2103 "Treat missing MED as the least preferred one\n"
2104 "Compare MED among confederation paths\n")
2106 /* "no bgp default ipv4-unicast". */
2107 DEFUN (no_bgp_default_ipv4_unicast
,
2108 no_bgp_default_ipv4_unicast_cmd
,
2109 "no bgp default ipv4-unicast",
2111 "BGP specific commands\n"
2112 "Configure BGP defaults\n"
2113 "Activate ipv4-unicast for a peer by default\n")
2118 bgp_flag_set (bgp
, BGP_FLAG_NO_DEFAULT_IPV4
);
2122 DEFUN (bgp_default_ipv4_unicast
,
2123 bgp_default_ipv4_unicast_cmd
,
2124 "bgp default ipv4-unicast",
2125 "BGP specific commands\n"
2126 "Configure BGP defaults\n"
2127 "Activate ipv4-unicast for a peer by default\n")
2132 bgp_flag_unset (bgp
, BGP_FLAG_NO_DEFAULT_IPV4
);
2136 /* Display hostname in certain command outputs */
2137 DEFUN (bgp_default_show_hostname
,
2138 bgp_default_show_hostname_cmd
,
2139 "bgp default show-hostname",
2140 "BGP specific commands\n"
2141 "Configure BGP defaults\n"
2142 "Show hostname in certain command ouputs\n")
2147 bgp_flag_set (bgp
, BGP_FLAG_SHOW_HOSTNAME
);
2151 DEFUN (no_bgp_default_show_hostname
,
2152 no_bgp_default_show_hostname_cmd
,
2153 "no bgp default show-hostname",
2155 "BGP specific commands\n"
2156 "Configure BGP defaults\n"
2157 "Show hostname in certain command ouputs\n")
2162 bgp_flag_unset (bgp
, BGP_FLAG_SHOW_HOSTNAME
);
2166 /* "bgp import-check" configuration. */
2167 DEFUN (bgp_network_import_check
,
2168 bgp_network_import_check_cmd
,
2169 "bgp network import-check",
2170 "BGP specific commands\n"
2171 "BGP network command\n"
2172 "Check BGP network route exists in IGP\n")
2177 if (!bgp_flag_check(bgp
, BGP_FLAG_IMPORT_CHECK
))
2179 bgp_flag_set (bgp
, BGP_FLAG_IMPORT_CHECK
);
2180 bgp_static_redo_import_check(bgp
);
2186 DEFUN (no_bgp_network_import_check
,
2187 no_bgp_network_import_check_cmd
,
2188 "no bgp network import-check",
2190 "BGP specific commands\n"
2191 "BGP network command\n"
2192 "Check BGP network route exists in IGP\n")
2197 if (bgp_flag_check(bgp
, BGP_FLAG_IMPORT_CHECK
))
2199 bgp_flag_unset (bgp
, BGP_FLAG_IMPORT_CHECK
);
2200 bgp_static_redo_import_check(bgp
);
2206 DEFUN (bgp_default_local_preference
,
2207 bgp_default_local_preference_cmd
,
2208 "bgp default local-preference <0-4294967295>",
2209 "BGP specific commands\n"
2210 "Configure BGP defaults\n"
2211 "local preference (higher=more preferred)\n"
2212 "Configure default local preference value\n")
2215 u_int32_t local_pref
;
2219 VTY_GET_INTEGER ("local preference", local_pref
, argv
[0]);
2221 bgp_default_local_preference_set (bgp
, local_pref
);
2222 bgp_clear_star_soft_in (vty
);
2227 DEFUN (no_bgp_default_local_preference
,
2228 no_bgp_default_local_preference_cmd
,
2229 "no bgp default local-preference",
2231 "BGP specific commands\n"
2232 "Configure BGP defaults\n"
2233 "local preference (higher=more preferred)\n")
2238 bgp_default_local_preference_unset (bgp
);
2239 bgp_clear_star_soft_in (vty
);
2244 ALIAS (no_bgp_default_local_preference
,
2245 no_bgp_default_local_preference_val_cmd
,
2246 "no bgp default local-preference <0-4294967295>",
2248 "BGP specific commands\n"
2249 "Configure BGP defaults\n"
2250 "local preference (higher=more preferred)\n"
2251 "Configure default local preference value\n")
2253 DEFUN (bgp_default_subgroup_pkt_queue_max
,
2254 bgp_default_subgroup_pkt_queue_max_cmd
,
2255 "bgp default subgroup-pkt-queue-max <20-100>",
2256 "BGP specific commands\n"
2257 "Configure BGP defaults\n"
2258 "subgroup-pkt-queue-max\n"
2259 "Configure subgroup packet queue max\n")
2266 VTY_GET_INTEGER ("subgroup packet queue max", max_size
, argv
[0]);
2268 bgp_default_subgroup_pkt_queue_max_set (bgp
, max_size
);
2273 DEFUN (no_bgp_default_subgroup_pkt_queue_max
,
2274 no_bgp_default_subgroup_pkt_queue_max_cmd
,
2275 "no bgp default subgroup-pkt-queue-max",
2277 "BGP specific commands\n"
2278 "Configure BGP defaults\n"
2279 "subgroup-pkt-queue-max\n")
2284 bgp_default_subgroup_pkt_queue_max_unset (bgp
);
2288 ALIAS (no_bgp_default_subgroup_pkt_queue_max
,
2289 no_bgp_default_subgroup_pkt_queue_max_val_cmd
,
2290 "no bgp default subgroup-pkt-queue-max <20-100>",
2292 "BGP specific commands\n"
2293 "Configure BGP defaults\n"
2294 "subgroup-pkt-queue-max\n"
2295 "Configure subgroup packet queue max\n")
2297 DEFUN (bgp_rr_allow_outbound_policy
,
2298 bgp_rr_allow_outbound_policy_cmd
,
2299 "bgp route-reflector allow-outbound-policy",
2300 "BGP specific commands\n"
2301 "Allow modifications made by out route-map\n"
2302 "on ibgp neighbors\n")
2308 if (!bgp_flag_check(bgp
, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY
))
2310 bgp_flag_set(bgp
, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY
);
2311 update_group_announce_rrclients(bgp
);
2312 bgp_clear_star_soft_out (vty
);
2318 DEFUN (no_bgp_rr_allow_outbound_policy
,
2319 no_bgp_rr_allow_outbound_policy_cmd
,
2320 "no bgp route-reflector allow-outbound-policy",
2322 "BGP specific commands\n"
2323 "Allow modifications made by out route-map\n"
2324 "on ibgp neighbors\n")
2330 if (bgp_flag_check(bgp
, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY
))
2332 bgp_flag_unset(bgp
, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY
);
2333 update_group_announce_rrclients(bgp
);
2334 bgp_clear_star_soft_out (vty
);
2340 DEFUN (bgp_listen_limit
,
2341 bgp_listen_limit_cmd
,
2342 "bgp listen limit " DYNAMIC_NEIGHBOR_LIMIT_RANGE
,
2343 "BGP specific commands\n"
2344 "Configure BGP defaults\n"
2345 "maximum number of BGP Dynamic Neighbors that can be created\n"
2346 "Configure Dynamic Neighbors listen limit value\n")
2353 VTY_GET_INTEGER_RANGE ("listen limit", listen_limit
, argv
[0],
2354 BGP_DYNAMIC_NEIGHBORS_LIMIT_MIN
,
2355 BGP_DYNAMIC_NEIGHBORS_LIMIT_MAX
);
2357 bgp_listen_limit_set (bgp
, listen_limit
);
2362 DEFUN (no_bgp_listen_limit
,
2363 no_bgp_listen_limit_cmd
,
2364 "no bgp listen limit",
2365 "BGP specific commands\n"
2366 "Configure BGP defaults\n"
2367 "unset maximum number of BGP Dynamic Neighbors that can be created\n"
2368 "Configure Dynamic Neighbors listen limit value to default\n")
2373 bgp_listen_limit_unset (bgp
);
2377 ALIAS (no_bgp_listen_limit
,
2378 no_bgp_listen_limit_val_cmd
,
2379 "no bgp listen limit " DYNAMIC_NEIGHBOR_LIMIT_RANGE
,
2381 "BGP specific commands\n"
2382 "Configure BGP defaults\n"
2383 "maximum number of BGP Dynamic Neighbors that can be created\n"
2384 "Configure Dynamic Neighbors listen limit value\n")
2387 * Check if this listen range is already configured. Check for exact
2388 * match or overlap based on input.
2390 static struct peer_group
*
2391 listen_range_exists (struct bgp
*bgp
, struct prefix
*range
, int exact
)
2393 struct listnode
*node
, *nnode
;
2394 struct listnode
*node1
, *nnode1
;
2395 struct peer_group
*group
;
2400 afi
= family2afi(range
->family
);
2401 for (ALL_LIST_ELEMENTS (bgp
->group
, node
, nnode
, group
))
2403 for (ALL_LIST_ELEMENTS (group
->listen_range
[afi
], node1
,
2407 match
= prefix_same (range
, lr
);
2409 match
= (prefix_match (range
, lr
) || prefix_match (lr
, range
));
2418 DEFUN (bgp_listen_range
,
2419 bgp_listen_range_cmd
,
2420 LISTEN_RANGE_CMD
"peer-group WORD" ,
2421 "BGP specific commands\n"
2422 "Configure BGP Dynamic Neighbors\n"
2423 "add a listening range for Dynamic Neighbors\n"
2424 LISTEN_RANGE_ADDR_STR
)
2427 struct prefix range
;
2428 struct peer_group
*group
, *existing_group
;
2434 //VTY_GET_IPV4_PREFIX ("listen range", range, argv[0]);
2436 /* Convert IP prefix string to struct prefix. */
2437 ret
= str2prefix (argv
[0], &range
);
2440 vty_out (vty
, "%% Malformed listen range%s", VTY_NEWLINE
);
2444 afi
= family2afi(range
.family
);
2447 if (afi
== AFI_IP6
&& IN6_IS_ADDR_LINKLOCAL (&range
.u
.prefix6
))
2449 vty_out (vty
, "%% Malformed listen range (link-local address)%s",
2453 #endif /* HAVE_IPV6 */
2455 apply_mask (&range
);
2457 /* Check if same listen range is already configured. */
2458 existing_group
= listen_range_exists (bgp
, &range
, 1);
2461 if (strcmp (existing_group
->name
, argv
[1]) == 0)
2465 vty_out (vty
, "%% Same listen range is attached to peer-group %s%s",
2466 existing_group
->name
, VTY_NEWLINE
);
2471 /* Check if an overlapping listen range exists. */
2472 if (listen_range_exists (bgp
, &range
, 0))
2474 vty_out (vty
, "%% Listen range overlaps with existing listen range%s",
2479 group
= peer_group_lookup (bgp
, argv
[1]);
2482 vty_out (vty
, "%% Configure the peer-group first%s", VTY_NEWLINE
);
2486 ret
= peer_group_listen_range_add(group
, &range
);
2487 return bgp_vty_return (vty
, ret
);
2490 DEFUN (no_bgp_listen_range
,
2491 no_bgp_listen_range_cmd
,
2492 "no bgp listen range A.B.C.D/M peer-group WORD" ,
2493 "BGP specific commands\n"
2494 "Configure BGP defaults\n"
2495 "delete a listening range for Dynamic Neighbors\n"
2496 "Remove Dynamic Neighbors listening range\n")
2499 struct prefix range
;
2500 struct peer_group
*group
;
2506 // VTY_GET_IPV4_PREFIX ("listen range", range, argv[0]);
2508 /* Convert IP prefix string to struct prefix. */
2509 ret
= str2prefix (argv
[0], &range
);
2512 vty_out (vty
, "%% Malformed listen range%s", VTY_NEWLINE
);
2516 afi
= family2afi(range
.family
);
2519 if (afi
== AFI_IP6
&& IN6_IS_ADDR_LINKLOCAL (&range
.u
.prefix6
))
2521 vty_out (vty
, "%% Malformed listen range (link-local address)%s",
2525 #endif /* HAVE_IPV6 */
2527 apply_mask (&range
);
2530 group
= peer_group_lookup (bgp
, argv
[1]);
2533 vty_out (vty
, "%% Peer-group does not exist%s", VTY_NEWLINE
);
2537 ret
= peer_group_listen_range_del(group
, &range
);
2538 return bgp_vty_return (vty
, ret
);
2542 bgp_config_write_listen (struct vty
*vty
, struct bgp
*bgp
)
2544 struct peer_group
*group
;
2545 struct listnode
*node
, *nnode
, *rnode
, *nrnode
;
2546 struct prefix
*range
;
2548 char buf
[PREFIX2STR_BUFFER
];
2550 if (bgp
->dynamic_neighbors_limit
!= BGP_DYNAMIC_NEIGHBORS_LIMIT_DEFAULT
)
2551 vty_out (vty
, " bgp listen limit %d%s",
2552 bgp
->dynamic_neighbors_limit
, VTY_NEWLINE
);
2554 for (ALL_LIST_ELEMENTS (bgp
->group
, node
, nnode
, group
))
2556 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
2558 for (ALL_LIST_ELEMENTS (group
->listen_range
[afi
], rnode
, nrnode
, range
))
2560 prefix2str(range
, buf
, sizeof(buf
));
2561 vty_out(vty
, " bgp listen range %s peer-group %s%s",
2562 buf
, group
->name
, VTY_NEWLINE
);
2571 DEFUN (bgp_disable_connected_route_check
,
2572 bgp_disable_connected_route_check_cmd
,
2573 "bgp disable-ebgp-connected-route-check",
2574 "BGP specific commands\n"
2575 "Disable checking if nexthop is connected on ebgp sessions\n")
2580 bgp_flag_set (bgp
, BGP_FLAG_DISABLE_NH_CONNECTED_CHK
);
2581 bgp_clear_star_soft_in (vty
);
2586 DEFUN (no_bgp_disable_connected_route_check
,
2587 no_bgp_disable_connected_route_check_cmd
,
2588 "no bgp disable-ebgp-connected-route-check",
2590 "BGP specific commands\n"
2591 "Disable checking if nexthop is connected on ebgp sessions\n")
2596 bgp_flag_unset (bgp
, BGP_FLAG_DISABLE_NH_CONNECTED_CHK
);
2597 bgp_clear_star_soft_in (vty
);
2604 peer_remote_as_vty (struct vty
*vty
, const char *peer_str
,
2605 const char *as_str
, afi_t afi
, safi_t safi
)
2610 int as_type
= AS_SPECIFIED
;
2615 if (strncmp(as_str
, "internal", strlen("internal")) == 0)
2618 as_type
= AS_INTERNAL
;
2620 else if (strncmp(as_str
, "external", strlen("external")) == 0)
2623 as_type
= AS_EXTERNAL
;
2627 /* Get AS number. */
2628 VTY_GET_INTEGER_RANGE ("AS", as
, as_str
, 1, BGP_AS4_MAX
);
2631 /* If peer is peer group, call proper function. */
2632 ret
= str2sockunion (peer_str
, &su
);
2635 /* Check for peer by interface */
2636 ret
= peer_remote_as (bgp
, NULL
, peer_str
, &as
, as_type
, afi
, safi
);
2639 ret
= peer_group_remote_as (bgp
, peer_str
, &as
, as_type
);
2642 vty_out (vty
, "%% Create the peer-group or interface first%s",
2651 if (peer_address_self_check (bgp
, &su
))
2653 vty_out (vty
, "%% Can not configure the local system as neighbor%s",
2657 ret
= peer_remote_as (bgp
, &su
, NULL
, &as
, as_type
, afi
, safi
);
2660 /* This peer belongs to peer group. */
2663 case BGP_ERR_PEER_GROUP_MEMBER
:
2664 vty_out (vty
, "%% Peer-group AS %u. Cannot configure remote-as for member%s", as
, VTY_NEWLINE
);
2666 case BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT
:
2667 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
);
2670 return bgp_vty_return (vty
, ret
);
2673 DEFUN (neighbor_remote_as
,
2674 neighbor_remote_as_cmd
,
2675 NEIGHBOR_CMD2
"remote-as (" CMD_AS_RANGE
"|external|internal)",
2678 "Specify a BGP neighbor\n"
2681 return peer_remote_as_vty (vty
, argv
[0], argv
[1], AFI_IP
, SAFI_UNICAST
);
2685 peer_conf_interface_get (struct vty
*vty
, const char *conf_if
, afi_t afi
,
2686 safi_t safi
, int v6only
, const char *peer_group_name
)
2691 struct peer_group
*group
;
2696 group
= peer_group_lookup (bgp
, conf_if
);
2700 vty_out (vty
, "%% Name conflict with peer-group %s", VTY_NEWLINE
);
2704 peer
= peer_lookup_by_conf_if (bgp
, conf_if
);
2707 if (bgp_flag_check (bgp
, BGP_FLAG_NO_DEFAULT_IPV4
)
2708 && afi
== AFI_IP
&& safi
== SAFI_UNICAST
)
2709 peer
= peer_create (NULL
, conf_if
, bgp
, bgp
->as
, 0, AS_UNSPECIFIED
, 0, 0);
2711 peer
= peer_create (NULL
, conf_if
, bgp
, bgp
->as
, 0, AS_UNSPECIFIED
, afi
, safi
);
2714 SET_FLAG(peer
->flags
, PEER_FLAG_IFPEER_V6ONLY
);
2716 else if ((v6only
&& !CHECK_FLAG(peer
->flags
, PEER_FLAG_IFPEER_V6ONLY
)) ||
2717 (!v6only
&& CHECK_FLAG(peer
->flags
, PEER_FLAG_IFPEER_V6ONLY
)))
2720 SET_FLAG(peer
->flags
, PEER_FLAG_IFPEER_V6ONLY
);
2722 UNSET_FLAG(peer
->flags
, PEER_FLAG_IFPEER_V6ONLY
);
2724 /* v6only flag changed. Reset bgp seesion */
2725 if (BGP_IS_VALID_STATE_FOR_NOTIF(peer
->status
))
2727 peer
->last_reset
= PEER_DOWN_V6ONLY_CHANGE
;
2728 bgp_notify_send (peer
, BGP_NOTIFY_CEASE
,
2729 BGP_NOTIFY_CEASE_CONFIG_CHANGE
);
2732 bgp_session_reset(peer
);
2738 if (peer_group_name
)
2740 group
= peer_group_lookup (bgp
, peer_group_name
);
2743 vty_out (vty
, "%% Configure the peer-group first%s", VTY_NEWLINE
);
2747 ret
= peer_group_bind (bgp
, &su
, peer
, group
, &as
);
2750 return bgp_vty_return (vty
, ret
);
2753 DEFUN (neighbor_interface_config
,
2754 neighbor_interface_config_cmd
,
2755 "neighbor WORD interface",
2757 "Interface name or neighbor tag\n"
2758 "Enable BGP on interface\n")
2761 return peer_conf_interface_get (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
, 0, argv
[1]);
2763 return peer_conf_interface_get (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
, 0, NULL
);
2766 ALIAS (neighbor_interface_config
,
2767 neighbor_interface_config_peergroup_cmd
,
2768 "neighbor WORD interface peer-group WORD",
2770 "Interface name or neighbor tag\n"
2771 "Enable BGP on interface\n"
2772 "Member of the peer-group\n"
2773 "peer-group name\n")
2775 DEFUN (neighbor_interface_config_v6only
,
2776 neighbor_interface_config_v6only_cmd
,
2777 "neighbor WORD interface v6only",
2779 "Interface name or neighbor tag\n"
2780 "Enable BGP on interface\n"
2781 "Enable BGP with v6 link-local only\n")
2784 return peer_conf_interface_get (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
, 1, argv
[1]);
2786 return peer_conf_interface_get (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
, 1, NULL
);
2789 ALIAS (neighbor_interface_config_v6only
,
2790 neighbor_interface_config_v6only_peergroup_cmd
,
2791 "neighbor WORD interface v6only peer-group WORD",
2793 "Interface name or neighbor tag\n"
2794 "Enable BGP on interface\n"
2795 "Enable BGP with v6 link-local only\n"
2796 "Member of the peer-group\n"
2797 "peer-group name\n")
2799 DEFUN (neighbor_peer_group
,
2800 neighbor_peer_group_cmd
,
2801 "neighbor WORD peer-group",
2803 "Interface name or neighbor tag\n"
2804 "Configure peer-group\n")
2808 struct peer_group
*group
;
2811 peer
= peer_lookup_by_conf_if (bgp
, argv
[0]);
2814 vty_out (vty
, "%% Name conflict with interface: %s", VTY_NEWLINE
);
2818 group
= peer_group_get (bgp
, argv
[0]);
2834 struct peer_group
*group
;
2838 ret
= str2sockunion (argv
[0], &su
);
2841 /* look up for neighbor by interface name config. */
2842 peer
= peer_lookup_by_conf_if (vty
->index
, argv
[0]);
2849 group
= peer_group_lookup (vty
->index
, argv
[0]);
2851 peer_group_delete (group
);
2854 vty_out (vty
, "%% Create the peer-group first%s", VTY_NEWLINE
);
2860 peer
= peer_lookup (vty
->index
, &su
);
2863 if (peer_dynamic_neighbor (peer
))
2865 vty_out (vty
, "%% Operation not allowed on a dynamic neighbor%s",
2870 other
= peer
->doppelganger
;
2872 if (other
&& other
->status
!= Deleted
)
2881 no_neighbor_remote_as_cmd
,
2882 NO_NEIGHBOR_CMD
"remote-as (" CMD_AS_RANGE
"|internal|external)",
2886 "Specify a BGP neighbor\n"
2889 DEFUN (no_neighbor_interface_config
,
2890 no_neighbor_interface_config_cmd
,
2891 "no neighbor WORD interface",
2895 "Configure BGP on interface\n")
2899 /* look up for neighbor by interface name config. */
2900 peer
= peer_lookup_by_conf_if (vty
->index
, argv
[0]);
2907 vty_out (vty
, "%% Create the bgp interface first%s", VTY_NEWLINE
);
2913 ALIAS (no_neighbor_interface_config
,
2914 no_neighbor_interface_config_peergroup_cmd
,
2915 "no neighbor WORD interface peer-group WORD",
2919 "Configure BGP on interface\n"
2920 "Member of the peer-group\n"
2921 "peer-group name\n")
2923 ALIAS (no_neighbor_interface_config
,
2924 no_neighbor_interface_config_v6only_cmd
,
2925 "no neighbor WORD interface v6only",
2929 "Configure BGP on interface\n"
2930 "Enable BGP with v6 link-local only\n")
2932 ALIAS (no_neighbor_interface_config
,
2933 no_neighbor_interface_config_v6only_peergroup_cmd
,
2934 "no neighbor WORD interface v6only peer-group WORD",
2938 "Configure BGP on interface\n"
2939 "Enable BGP with v6 link-local only\n"
2940 "Member of the peer-group\n"
2941 "peer-group name\n")
2944 DEFUN (no_neighbor_peer_group
,
2945 no_neighbor_peer_group_cmd
,
2946 "no neighbor WORD peer-group",
2950 "Configure peer-group\n")
2952 struct peer_group
*group
;
2954 group
= peer_group_lookup (vty
->index
, argv
[0]);
2956 peer_group_delete (group
);
2959 vty_out (vty
, "%% Create the peer-group first%s", VTY_NEWLINE
);
2965 DEFUN (no_neighbor_interface_peer_group_remote_as
,
2966 no_neighbor_interface_peer_group_remote_as_cmd
,
2967 "no neighbor WORD remote-as (" CMD_AS_RANGE
"|internal|external)",
2970 "Interface name or neighbor tag\n"
2971 "Specify a BGP neighbor\n"
2974 struct peer_group
*group
;
2977 /* look up for neighbor by interface name config. */
2978 peer
= peer_lookup_by_conf_if (vty
->index
, argv
[0]);
2981 peer_as_change (peer
, 0, AS_SPECIFIED
);
2985 group
= peer_group_lookup (vty
->index
, argv
[0]);
2987 peer_group_remote_as_delete (group
);
2990 vty_out (vty
, "%% Create the peer-group or interface first%s", VTY_NEWLINE
);
2996 DEFUN (neighbor_local_as
,
2997 neighbor_local_as_cmd
,
2998 NEIGHBOR_CMD2
"local-as " CMD_AS_RANGE
,
3001 "Specify a local-as number\n"
3002 "AS number used as local AS\n")
3007 peer
= peer_and_group_lookup_vty (vty
, argv
[0]);
3011 ret
= peer_local_as_set (peer
, atoi (argv
[1]), 0, 0);
3012 return bgp_vty_return (vty
, ret
);
3015 DEFUN (neighbor_local_as_no_prepend
,
3016 neighbor_local_as_no_prepend_cmd
,
3017 NEIGHBOR_CMD2
"local-as " CMD_AS_RANGE
" no-prepend",
3020 "Specify a local-as number\n"
3021 "AS number used as local AS\n"
3022 "Do not prepend local-as to updates from ebgp peers\n")
3027 peer
= peer_and_group_lookup_vty (vty
, argv
[0]);
3031 ret
= peer_local_as_set (peer
, atoi (argv
[1]), 1, 0);
3032 return bgp_vty_return (vty
, ret
);
3035 DEFUN (neighbor_local_as_no_prepend_replace_as
,
3036 neighbor_local_as_no_prepend_replace_as_cmd
,
3037 NEIGHBOR_CMD2
"local-as " CMD_AS_RANGE
" no-prepend replace-as",
3040 "Specify a local-as number\n"
3041 "AS number used as local AS\n"
3042 "Do not prepend local-as to updates from ebgp peers\n"
3043 "Do not prepend local-as to updates from ibgp peers\n")
3048 peer
= peer_and_group_lookup_vty (vty
, argv
[0]);
3052 ret
= peer_local_as_set (peer
, atoi (argv
[1]), 1, 1);
3053 return bgp_vty_return (vty
, ret
);
3057 DEFUN (no_neighbor_local_as
,
3058 no_neighbor_local_as_cmd
,
3059 NO_NEIGHBOR_CMD2
"local-as",
3063 "Specify a local-as number\n")
3068 peer
= peer_and_group_lookup_vty (vty
, argv
[0]);
3072 ret
= peer_local_as_unset (peer
);
3073 return bgp_vty_return (vty
, ret
);
3076 ALIAS (no_neighbor_local_as
,
3077 no_neighbor_local_as_val_cmd
,
3078 NO_NEIGHBOR_CMD2
"local-as " CMD_AS_RANGE
,
3082 "Specify a local-as number\n"
3083 "AS number used as local AS\n")
3085 ALIAS (no_neighbor_local_as
,
3086 no_neighbor_local_as_val2_cmd
,
3087 NO_NEIGHBOR_CMD2
"local-as " CMD_AS_RANGE
" no-prepend",
3091 "Specify a local-as number\n"
3092 "AS number used as local AS\n"
3093 "Do not prepend local-as to updates from ebgp peers\n")
3095 ALIAS (no_neighbor_local_as
,
3096 no_neighbor_local_as_val3_cmd
,
3097 NO_NEIGHBOR_CMD2
"local-as " CMD_AS_RANGE
" no-prepend replace-as",
3101 "Specify a local-as number\n"
3102 "AS number used as local AS\n"
3103 "Do not prepend local-as to updates from ebgp peers\n"
3104 "Do not prepend local-as to updates from ibgp peers\n")
3106 DEFUN (neighbor_solo
,
3108 NEIGHBOR_CMD2
"solo",
3111 "Solo peer - part of its own update group\n")
3116 peer
= peer_and_group_lookup_vty (vty
, argv
[0]);
3120 ret
= update_group_adjust_soloness(peer
, 1);
3121 return bgp_vty_return (vty
, ret
);
3124 DEFUN (no_neighbor_solo
,
3125 no_neighbor_solo_cmd
,
3126 NO_NEIGHBOR_CMD2
"solo",
3130 "Solo peer - part of its own update group\n")
3135 peer
= peer_and_group_lookup_vty (vty
, argv
[0]);
3139 ret
= update_group_adjust_soloness(peer
, 0);
3140 return bgp_vty_return (vty
, ret
);
3143 DEFUN (neighbor_password
,
3144 neighbor_password_cmd
,
3145 NEIGHBOR_CMD2
"password LINE",
3154 peer
= peer_and_group_lookup_vty (vty
, argv
[0]);
3158 ret
= peer_password_set (peer
, argv
[1]);
3159 return bgp_vty_return (vty
, ret
);
3162 DEFUN (no_neighbor_password
,
3163 no_neighbor_password_cmd
,
3164 NO_NEIGHBOR_CMD2
"password",
3173 peer
= peer_and_group_lookup_vty (vty
, argv
[0]);
3177 ret
= peer_password_unset (peer
);
3178 return bgp_vty_return (vty
, ret
);
3181 ALIAS (no_neighbor_password
,
3182 no_neighbor_password_val_cmd
,
3183 NO_NEIGHBOR_CMD2
"password LINE",
3190 DEFUN (neighbor_activate
,
3191 neighbor_activate_cmd
,
3192 NEIGHBOR_CMD2
"activate",
3195 "Enable the Address Family for this Neighbor\n")
3200 peer
= peer_and_group_lookup_vty (vty
, argv
[0]);
3204 ret
= peer_activate (peer
, bgp_node_afi (vty
), bgp_node_safi (vty
));
3211 DEFUN (no_neighbor_activate
,
3212 no_neighbor_activate_cmd
,
3213 NO_NEIGHBOR_CMD2
"activate",
3217 "Enable the Address Family for this Neighbor\n")
3223 peer
= peer_and_group_lookup_vty (vty
, argv
[0]);
3227 ret
= peer_deactivate (peer
, bgp_node_afi (vty
), bgp_node_safi (vty
));
3234 DEFUN (neighbor_set_peer_group
,
3235 neighbor_set_peer_group_cmd
,
3236 NEIGHBOR_CMD2
"peer-group WORD",
3239 "Member of the peer-group\n"
3240 "peer-group name\n")
3247 struct peer_group
*group
;
3252 ret
= str2sockunion (argv
[0], &su
);
3255 peer
= peer_lookup_by_conf_if (bgp
, argv
[0]);
3258 vty_out (vty
, "%% Malformed address or name: %s%s", argv
[0], VTY_NEWLINE
);
3264 if (peer_address_self_check (bgp
, &su
))
3266 vty_out (vty
, "%% Can not configure the local system as neighbor%s",
3271 /* Disallow for dynamic neighbor. */
3272 peer
= peer_lookup (bgp
, &su
);
3273 if (peer
&& peer_dynamic_neighbor (peer
))
3275 vty_out (vty
, "%% Operation not allowed on a dynamic neighbor%s",
3281 group
= peer_group_lookup (bgp
, argv
[1]);
3284 vty_out (vty
, "%% Configure the peer-group first%s", VTY_NEWLINE
);
3288 ret
= peer_group_bind (bgp
, &su
, peer
, group
, &as
);
3290 if (ret
== BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT
)
3292 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
);
3296 return bgp_vty_return (vty
, ret
);
3299 DEFUN (no_neighbor_set_peer_group
,
3300 no_neighbor_set_peer_group_cmd
,
3301 NO_NEIGHBOR_CMD2
"peer-group WORD",
3305 "Member of the peer-group\n"
3306 "peer-group name\n")
3311 struct peer_group
*group
;
3315 peer
= peer_lookup_vty (vty
, argv
[0]);
3319 group
= peer_group_lookup (bgp
, argv
[1]);
3322 vty_out (vty
, "%% Configure the peer-group first%s", VTY_NEWLINE
);
3326 ret
= peer_group_unbind (bgp
, peer
, group
);
3328 return bgp_vty_return (vty
, ret
);
3332 peer_flag_modify_vty (struct vty
*vty
, const char *ip_str
,
3333 u_int16_t flag
, int set
)
3338 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
3343 ret
= peer_flag_set (peer
, flag
);
3345 ret
= peer_flag_unset (peer
, flag
);
3347 return bgp_vty_return (vty
, ret
);
3351 peer_flag_set_vty (struct vty
*vty
, const char *ip_str
, u_int16_t flag
)
3353 return peer_flag_modify_vty (vty
, ip_str
, flag
, 1);
3357 peer_flag_unset_vty (struct vty
*vty
, const char *ip_str
, u_int16_t flag
)
3359 return peer_flag_modify_vty (vty
, ip_str
, flag
, 0);
3362 /* neighbor passive. */
3363 DEFUN (neighbor_passive
,
3364 neighbor_passive_cmd
,
3365 NEIGHBOR_CMD2
"passive",
3368 "Don't send open messages to this neighbor\n")
3370 return peer_flag_set_vty (vty
, argv
[0], PEER_FLAG_PASSIVE
);
3373 DEFUN (no_neighbor_passive
,
3374 no_neighbor_passive_cmd
,
3375 NO_NEIGHBOR_CMD2
"passive",
3379 "Don't send open messages to this neighbor\n")
3381 return peer_flag_unset_vty (vty
, argv
[0], PEER_FLAG_PASSIVE
);
3384 /* neighbor shutdown. */
3385 DEFUN (neighbor_shutdown
,
3386 neighbor_shutdown_cmd
,
3387 NEIGHBOR_CMD2
"shutdown",
3390 "Administratively shut down this neighbor\n")
3392 return peer_flag_set_vty (vty
, argv
[0], PEER_FLAG_SHUTDOWN
);
3395 DEFUN (no_neighbor_shutdown
,
3396 no_neighbor_shutdown_cmd
,
3397 NO_NEIGHBOR_CMD2
"shutdown",
3401 "Administratively shut down this neighbor\n")
3403 return peer_flag_unset_vty (vty
, argv
[0], PEER_FLAG_SHUTDOWN
);
3406 /* neighbor capability dynamic. */
3407 DEFUN (neighbor_capability_dynamic
,
3408 neighbor_capability_dynamic_cmd
,
3409 NEIGHBOR_CMD2
"capability dynamic",
3412 "Advertise capability to the peer\n"
3413 "Advertise dynamic capability to this neighbor\n")
3415 return peer_flag_set_vty (vty
, argv
[0], PEER_FLAG_DYNAMIC_CAPABILITY
);
3418 DEFUN (no_neighbor_capability_dynamic
,
3419 no_neighbor_capability_dynamic_cmd
,
3420 NO_NEIGHBOR_CMD2
"capability dynamic",
3424 "Advertise capability to the peer\n"
3425 "Advertise dynamic capability to this neighbor\n")
3427 return peer_flag_unset_vty (vty
, argv
[0], PEER_FLAG_DYNAMIC_CAPABILITY
);
3430 /* neighbor dont-capability-negotiate */
3431 DEFUN (neighbor_dont_capability_negotiate
,
3432 neighbor_dont_capability_negotiate_cmd
,
3433 NEIGHBOR_CMD2
"dont-capability-negotiate",
3436 "Do not perform capability negotiation\n")
3438 return peer_flag_set_vty (vty
, argv
[0], PEER_FLAG_DONT_CAPABILITY
);
3441 DEFUN (no_neighbor_dont_capability_negotiate
,
3442 no_neighbor_dont_capability_negotiate_cmd
,
3443 NO_NEIGHBOR_CMD2
"dont-capability-negotiate",
3447 "Do not perform capability negotiation\n")
3449 return peer_flag_unset_vty (vty
, argv
[0], PEER_FLAG_DONT_CAPABILITY
);
3452 /* neighbor capability extended next hop encoding */
3453 DEFUN (neighbor_capability_enhe
,
3454 neighbor_capability_enhe_cmd
,
3455 NEIGHBOR_CMD2
"capability extended-nexthop",
3458 "Advertise capability to the peer\n"
3459 "Advertise extended next-hop capability to the peer\n")
3461 return peer_flag_set_vty (vty
, argv
[0], PEER_FLAG_CAPABILITY_ENHE
);
3464 DEFUN (no_neighbor_capability_enhe
,
3465 no_neighbor_capability_enhe_cmd
,
3466 NO_NEIGHBOR_CMD2
"capability extended-nexthop",
3470 "Advertise capability to the peer\n"
3471 "Advertise extended next-hop capability to the peer\n")
3473 return peer_flag_unset_vty (vty
, argv
[0], PEER_FLAG_CAPABILITY_ENHE
);
3477 peer_af_flag_modify_vty (struct vty
*vty
, const char *peer_str
, afi_t afi
,
3478 safi_t safi
, u_int32_t flag
, int set
)
3483 peer
= peer_and_group_lookup_vty (vty
, peer_str
);
3488 ret
= peer_af_flag_set (peer
, afi
, safi
, flag
);
3490 ret
= peer_af_flag_unset (peer
, afi
, safi
, flag
);
3492 return bgp_vty_return (vty
, ret
);
3496 peer_af_flag_set_vty (struct vty
*vty
, const char *peer_str
, afi_t afi
,
3497 safi_t safi
, u_int32_t flag
)
3499 return peer_af_flag_modify_vty (vty
, peer_str
, afi
, safi
, flag
, 1);
3503 peer_af_flag_unset_vty (struct vty
*vty
, const char *peer_str
, afi_t afi
,
3504 safi_t safi
, u_int32_t flag
)
3506 return peer_af_flag_modify_vty (vty
, peer_str
, afi
, safi
, flag
, 0);
3509 /* neighbor capability orf prefix-list. */
3510 DEFUN (neighbor_capability_orf_prefix
,
3511 neighbor_capability_orf_prefix_cmd
,
3512 NEIGHBOR_CMD2
"capability orf prefix-list (both|send|receive)",
3515 "Advertise capability to the peer\n"
3516 "Advertise ORF capability to the peer\n"
3517 "Advertise prefixlist ORF capability to this neighbor\n"
3518 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
3519 "Capability to RECEIVE the ORF from this neighbor\n"
3520 "Capability to SEND the ORF to this neighbor\n")
3524 if (strncmp (argv
[1], "s", 1) == 0)
3525 flag
= PEER_FLAG_ORF_PREFIX_SM
;
3526 else if (strncmp (argv
[1], "r", 1) == 0)
3527 flag
= PEER_FLAG_ORF_PREFIX_RM
;
3528 else if (strncmp (argv
[1], "b", 1) == 0)
3529 flag
= PEER_FLAG_ORF_PREFIX_SM
|PEER_FLAG_ORF_PREFIX_RM
;
3533 return peer_af_flag_set_vty (vty
, argv
[0], bgp_node_afi (vty
),
3534 bgp_node_safi (vty
), flag
);
3537 DEFUN (no_neighbor_capability_orf_prefix
,
3538 no_neighbor_capability_orf_prefix_cmd
,
3539 NO_NEIGHBOR_CMD2
"capability orf prefix-list (both|send|receive)",
3543 "Advertise capability to the peer\n"
3544 "Advertise ORF capability to the peer\n"
3545 "Advertise prefixlist ORF capability to this neighbor\n"
3546 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
3547 "Capability to RECEIVE the ORF from this neighbor\n"
3548 "Capability to SEND the ORF to this neighbor\n")
3552 if (strncmp (argv
[1], "s", 1) == 0)
3553 flag
= PEER_FLAG_ORF_PREFIX_SM
;
3554 else if (strncmp (argv
[1], "r", 1) == 0)
3555 flag
= PEER_FLAG_ORF_PREFIX_RM
;
3556 else if (strncmp (argv
[1], "b", 1) == 0)
3557 flag
= PEER_FLAG_ORF_PREFIX_SM
|PEER_FLAG_ORF_PREFIX_RM
;
3561 return peer_af_flag_unset_vty (vty
, argv
[0], bgp_node_afi (vty
),
3562 bgp_node_safi (vty
), flag
);
3565 /* neighbor next-hop-self. */
3566 DEFUN (neighbor_nexthop_self
,
3567 neighbor_nexthop_self_cmd
,
3568 NEIGHBOR_CMD2
"next-hop-self",
3571 "Disable the next hop calculation for this neighbor\n")
3573 return peer_af_flag_set_vty (vty
, argv
[0], bgp_node_afi (vty
),
3574 bgp_node_safi (vty
), PEER_FLAG_NEXTHOP_SELF
);
3577 /* neighbor next-hop-self. */
3578 DEFUN (neighbor_nexthop_self_force
,
3579 neighbor_nexthop_self_force_cmd
,
3580 NEIGHBOR_CMD2
"next-hop-self force",
3583 "Disable the next hop calculation for this neighbor\n"
3584 "Set the next hop to self for reflected routes\n")
3586 return peer_af_flag_set_vty (vty
, argv
[0], bgp_node_afi (vty
),
3587 bgp_node_safi (vty
),
3588 PEER_FLAG_FORCE_NEXTHOP_SELF
);
3591 DEFUN (no_neighbor_nexthop_self
,
3592 no_neighbor_nexthop_self_cmd
,
3593 NO_NEIGHBOR_CMD2
"next-hop-self",
3597 "Disable the next hop calculation for this neighbor\n")
3599 return peer_af_flag_unset_vty (vty
, argv
[0], bgp_node_afi (vty
),
3600 bgp_node_safi (vty
),
3601 PEER_FLAG_NEXTHOP_SELF
);
3604 DEFUN (no_neighbor_nexthop_self_force
,
3605 no_neighbor_nexthop_self_force_cmd
,
3606 NO_NEIGHBOR_CMD2
"next-hop-self force",
3610 "Disable the next hop calculation for this neighbor\n"
3611 "Set the next hop to self for reflected routes\n")
3613 return peer_af_flag_unset_vty (vty
, argv
[0], bgp_node_afi (vty
),
3614 bgp_node_safi (vty
),
3615 PEER_FLAG_FORCE_NEXTHOP_SELF
);
3618 /* neighbor as-override */
3619 DEFUN (neighbor_as_override
,
3620 neighbor_as_override_cmd
,
3621 NEIGHBOR_CMD2
"as-override",
3624 "Override ASNs in outbound updates if aspath equals remote-as\n")
3626 return peer_af_flag_set_vty (vty
, argv
[0], bgp_node_afi (vty
),
3627 bgp_node_safi (vty
),
3628 PEER_FLAG_AS_OVERRIDE
);
3631 DEFUN (no_neighbor_as_override
,
3632 no_neighbor_as_override_cmd
,
3633 NO_NEIGHBOR_CMD2
"as-override",
3637 "Override ASNs in outbound updates if aspath equals remote-as\n")
3639 return peer_af_flag_unset_vty (vty
, argv
[0], bgp_node_afi (vty
),
3640 bgp_node_safi (vty
),
3641 PEER_FLAG_AS_OVERRIDE
);
3644 /* neighbor remove-private-AS. */
3645 DEFUN (neighbor_remove_private_as
,
3646 neighbor_remove_private_as_cmd
,
3647 NEIGHBOR_CMD2
"remove-private-AS",
3650 "Remove private ASNs in outbound updates\n")
3652 return peer_af_flag_set_vty (vty
, argv
[0], bgp_node_afi (vty
),
3653 bgp_node_safi (vty
),
3654 PEER_FLAG_REMOVE_PRIVATE_AS
);
3657 DEFUN (neighbor_remove_private_as_all
,
3658 neighbor_remove_private_as_all_cmd
,
3659 NEIGHBOR_CMD2
"remove-private-AS all",
3662 "Remove private ASNs in outbound updates\n"
3663 "Apply to all AS numbers")
3665 return peer_af_flag_set_vty (vty
, argv
[0], bgp_node_afi (vty
),
3666 bgp_node_safi (vty
),
3667 PEER_FLAG_REMOVE_PRIVATE_AS_ALL
);
3670 DEFUN (neighbor_remove_private_as_replace_as
,
3671 neighbor_remove_private_as_replace_as_cmd
,
3672 NEIGHBOR_CMD2
"remove-private-AS replace-AS",
3675 "Remove private ASNs in outbound updates\n"
3676 "Replace private ASNs with our ASN in outbound updates\n")
3678 return peer_af_flag_set_vty (vty
, argv
[0], bgp_node_afi (vty
),
3679 bgp_node_safi (vty
),
3680 PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE
);
3683 DEFUN (neighbor_remove_private_as_all_replace_as
,
3684 neighbor_remove_private_as_all_replace_as_cmd
,
3685 NEIGHBOR_CMD2
"remove-private-AS all replace-AS",
3688 "Remove private ASNs in outbound updates\n"
3689 "Apply to all AS numbers"
3690 "Replace private ASNs with our ASN in outbound updates\n")
3692 return peer_af_flag_set_vty (vty
, argv
[0], bgp_node_afi (vty
),
3693 bgp_node_safi (vty
),
3694 PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE
);
3697 DEFUN (no_neighbor_remove_private_as
,
3698 no_neighbor_remove_private_as_cmd
,
3699 NO_NEIGHBOR_CMD2
"remove-private-AS",
3703 "Remove private ASNs in outbound updates\n")
3705 return peer_af_flag_unset_vty (vty
, argv
[0], bgp_node_afi (vty
),
3706 bgp_node_safi (vty
),
3707 PEER_FLAG_REMOVE_PRIVATE_AS
);
3710 DEFUN (no_neighbor_remove_private_as_all
,
3711 no_neighbor_remove_private_as_all_cmd
,
3712 NO_NEIGHBOR_CMD2
"remove-private-AS all",
3716 "Remove private ASNs in outbound updates\n"
3717 "Apply to all AS numbers")
3719 return peer_af_flag_unset_vty (vty
, argv
[0], bgp_node_afi (vty
),
3720 bgp_node_safi (vty
),
3721 PEER_FLAG_REMOVE_PRIVATE_AS_ALL
);
3724 DEFUN (no_neighbor_remove_private_as_replace_as
,
3725 no_neighbor_remove_private_as_replace_as_cmd
,
3726 NO_NEIGHBOR_CMD2
"remove-private-AS replace-AS",
3730 "Remove private ASNs in outbound updates\n"
3731 "Replace private ASNs with our ASN in outbound updates\n")
3733 return peer_af_flag_unset_vty (vty
, argv
[0], bgp_node_afi (vty
),
3734 bgp_node_safi (vty
),
3735 PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE
);
3738 DEFUN (no_neighbor_remove_private_as_all_replace_as
,
3739 no_neighbor_remove_private_as_all_replace_as_cmd
,
3740 NO_NEIGHBOR_CMD2
"remove-private-AS all replace-AS",
3744 "Remove private ASNs in outbound updates\n"
3745 "Apply to all AS numbers"
3746 "Replace private ASNs with our ASN in outbound updates\n")
3748 return peer_af_flag_unset_vty (vty
, argv
[0], bgp_node_afi (vty
),
3749 bgp_node_safi (vty
),
3750 PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE
);
3754 /* neighbor send-community. */
3755 DEFUN (neighbor_send_community
,
3756 neighbor_send_community_cmd
,
3757 NEIGHBOR_CMD2
"send-community",
3760 "Send Community attribute to this neighbor\n")
3762 return peer_af_flag_set_vty (vty
, argv
[0], bgp_node_afi (vty
),
3763 bgp_node_safi (vty
),
3764 PEER_FLAG_SEND_COMMUNITY
);
3767 DEFUN (no_neighbor_send_community
,
3768 no_neighbor_send_community_cmd
,
3769 NO_NEIGHBOR_CMD2
"send-community",
3773 "Send Community attribute to this neighbor\n")
3775 return peer_af_flag_unset_vty (vty
, argv
[0], bgp_node_afi (vty
),
3776 bgp_node_safi (vty
),
3777 PEER_FLAG_SEND_COMMUNITY
);
3780 /* neighbor send-community extended. */
3781 DEFUN (neighbor_send_community_type
,
3782 neighbor_send_community_type_cmd
,
3783 NEIGHBOR_CMD2
"send-community (both|extended|standard)",
3786 "Send Community attribute to this neighbor\n"
3787 "Send Standard and Extended Community attributes\n"
3788 "Send Extended Community attributes\n"
3789 "Send Standard Community attributes\n")
3791 if (strncmp (argv
[1], "s", 1) == 0)
3792 return peer_af_flag_set_vty (vty
, argv
[0], bgp_node_afi (vty
),
3793 bgp_node_safi (vty
),
3794 PEER_FLAG_SEND_COMMUNITY
);
3795 if (strncmp (argv
[1], "e", 1) == 0)
3796 return peer_af_flag_set_vty (vty
, argv
[0], bgp_node_afi (vty
),
3797 bgp_node_safi (vty
),
3798 PEER_FLAG_SEND_EXT_COMMUNITY
);
3800 return peer_af_flag_set_vty (vty
, argv
[0], bgp_node_afi (vty
),
3801 bgp_node_safi (vty
),
3802 (PEER_FLAG_SEND_COMMUNITY
|
3803 PEER_FLAG_SEND_EXT_COMMUNITY
));
3806 DEFUN (no_neighbor_send_community_type
,
3807 no_neighbor_send_community_type_cmd
,
3808 NO_NEIGHBOR_CMD2
"send-community (both|extended|standard)",
3812 "Send Community attribute to this neighbor\n"
3813 "Send Standard and Extended Community attributes\n"
3814 "Send Extended Community attributes\n"
3815 "Send Standard Community attributes\n")
3817 if (strncmp (argv
[1], "s", 1) == 0)
3818 return peer_af_flag_unset_vty (vty
, argv
[0], bgp_node_afi (vty
),
3819 bgp_node_safi (vty
),
3820 PEER_FLAG_SEND_COMMUNITY
);
3821 if (strncmp (argv
[1], "e", 1) == 0)
3822 return peer_af_flag_unset_vty (vty
, argv
[0], bgp_node_afi (vty
),
3823 bgp_node_safi (vty
),
3824 PEER_FLAG_SEND_EXT_COMMUNITY
);
3826 return peer_af_flag_unset_vty (vty
, argv
[0], bgp_node_afi (vty
),
3827 bgp_node_safi (vty
),
3828 (PEER_FLAG_SEND_COMMUNITY
|
3829 PEER_FLAG_SEND_EXT_COMMUNITY
));
3832 /* neighbor soft-reconfig. */
3833 DEFUN (neighbor_soft_reconfiguration
,
3834 neighbor_soft_reconfiguration_cmd
,
3835 NEIGHBOR_CMD2
"soft-reconfiguration inbound",
3838 "Per neighbor soft reconfiguration\n"
3839 "Allow inbound soft reconfiguration for this neighbor\n")
3841 return peer_af_flag_set_vty (vty
, argv
[0],
3842 bgp_node_afi (vty
), bgp_node_safi (vty
),
3843 PEER_FLAG_SOFT_RECONFIG
);
3846 DEFUN (no_neighbor_soft_reconfiguration
,
3847 no_neighbor_soft_reconfiguration_cmd
,
3848 NO_NEIGHBOR_CMD2
"soft-reconfiguration inbound",
3852 "Per neighbor soft reconfiguration\n"
3853 "Allow inbound soft reconfiguration for this neighbor\n")
3855 return peer_af_flag_unset_vty (vty
, argv
[0],
3856 bgp_node_afi (vty
), bgp_node_safi (vty
),
3857 PEER_FLAG_SOFT_RECONFIG
);
3860 DEFUN (neighbor_route_reflector_client
,
3861 neighbor_route_reflector_client_cmd
,
3862 NEIGHBOR_CMD2
"route-reflector-client",
3865 "Configure a neighbor as Route Reflector client\n")
3870 peer
= peer_and_group_lookup_vty (vty
, argv
[0]);
3874 return peer_af_flag_set_vty (vty
, argv
[0], bgp_node_afi (vty
),
3875 bgp_node_safi (vty
),
3876 PEER_FLAG_REFLECTOR_CLIENT
);
3879 DEFUN (no_neighbor_route_reflector_client
,
3880 no_neighbor_route_reflector_client_cmd
,
3881 NO_NEIGHBOR_CMD2
"route-reflector-client",
3885 "Configure a neighbor as Route Reflector client\n")
3887 return peer_af_flag_unset_vty (vty
, argv
[0], bgp_node_afi (vty
),
3888 bgp_node_safi (vty
),
3889 PEER_FLAG_REFLECTOR_CLIENT
);
3892 /* neighbor route-server-client. */
3893 DEFUN (neighbor_route_server_client
,
3894 neighbor_route_server_client_cmd
,
3895 NEIGHBOR_CMD2
"route-server-client",
3898 "Configure a neighbor as Route Server client\n")
3902 peer
= peer_and_group_lookup_vty (vty
, argv
[0]);
3905 return peer_af_flag_set_vty (vty
, argv
[0], bgp_node_afi (vty
),
3906 bgp_node_safi (vty
),
3907 PEER_FLAG_RSERVER_CLIENT
);
3910 DEFUN (no_neighbor_route_server_client
,
3911 no_neighbor_route_server_client_cmd
,
3912 NO_NEIGHBOR_CMD2
"route-server-client",
3916 "Configure a neighbor as Route Server client\n")
3918 return peer_af_flag_unset_vty (vty
, argv
[0], bgp_node_afi (vty
),
3919 bgp_node_safi (vty
),
3920 PEER_FLAG_RSERVER_CLIENT
);
3923 DEFUN (neighbor_nexthop_local_unchanged
,
3924 neighbor_nexthop_local_unchanged_cmd
,
3925 NEIGHBOR_CMD2
"nexthop-local unchanged",
3928 "Configure treatment of outgoing link-local nexthop attribute\n"
3929 "Leave link-local nexthop unchanged for this peer\n")
3931 return peer_af_flag_set_vty (vty
, argv
[0], bgp_node_afi (vty
),
3932 bgp_node_safi (vty
),
3933 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED
);
3936 DEFUN (no_neighbor_nexthop_local_unchanged
,
3937 no_neighbor_nexthop_local_unchanged_cmd
,
3938 NO_NEIGHBOR_CMD2
"nexthop-local unchanged",
3942 "Configure treatment of outgoing link-local-nexthop attribute\n"
3943 "Leave link-local nexthop unchanged for this peer\n")
3945 return peer_af_flag_unset_vty (vty
, argv
[0], bgp_node_afi (vty
),
3946 bgp_node_safi (vty
),
3947 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED
);
3950 DEFUN (neighbor_attr_unchanged
,
3951 neighbor_attr_unchanged_cmd
,
3952 NEIGHBOR_CMD2
"attribute-unchanged",
3955 "BGP attribute is propagated unchanged to this neighbor\n")
3957 return peer_af_flag_set_vty (vty
, argv
[0], bgp_node_afi (vty
),
3958 bgp_node_safi (vty
),
3959 (PEER_FLAG_AS_PATH_UNCHANGED
|
3960 PEER_FLAG_NEXTHOP_UNCHANGED
|
3961 PEER_FLAG_MED_UNCHANGED
));
3964 DEFUN (neighbor_attr_unchanged1
,
3965 neighbor_attr_unchanged1_cmd
,
3966 NEIGHBOR_CMD2
"attribute-unchanged (as-path|next-hop|med)",
3969 "BGP attribute is propagated unchanged to this neighbor\n"
3970 "As-path attribute\n"
3971 "Nexthop attribute\n"
3974 u_int16_t flags
= 0;
3976 if (strncmp (argv
[1], "as-path", 1) == 0)
3977 SET_FLAG (flags
, PEER_FLAG_AS_PATH_UNCHANGED
);
3978 else if (strncmp (argv
[1], "next-hop", 1) == 0)
3979 SET_FLAG (flags
, PEER_FLAG_NEXTHOP_UNCHANGED
);
3980 else if (strncmp (argv
[1], "med", 1) == 0)
3981 SET_FLAG (flags
, PEER_FLAG_MED_UNCHANGED
);
3983 return peer_af_flag_set_vty (vty
, argv
[0], bgp_node_afi (vty
),
3984 bgp_node_safi (vty
), flags
);
3987 DEFUN (neighbor_attr_unchanged2
,
3988 neighbor_attr_unchanged2_cmd
,
3989 NEIGHBOR_CMD2
"attribute-unchanged as-path (next-hop|med)",
3992 "BGP attribute is propagated unchanged to this neighbor\n"
3993 "As-path attribute\n"
3994 "Nexthop attribute\n"
3997 u_int16_t flags
= PEER_FLAG_AS_PATH_UNCHANGED
;
3999 if (strncmp (argv
[1], "next-hop", 1) == 0)
4000 SET_FLAG (flags
, PEER_FLAG_NEXTHOP_UNCHANGED
);
4001 else if (strncmp (argv
[1], "med", 1) == 0)
4002 SET_FLAG (flags
, PEER_FLAG_MED_UNCHANGED
);
4004 return peer_af_flag_set_vty (vty
, argv
[0], bgp_node_afi (vty
),
4005 bgp_node_safi (vty
), flags
);
4009 DEFUN (neighbor_attr_unchanged3
,
4010 neighbor_attr_unchanged3_cmd
,
4011 NEIGHBOR_CMD2
"attribute-unchanged next-hop (as-path|med)",
4014 "BGP attribute is propagated unchanged to this neighbor\n"
4015 "Nexthop attribute\n"
4016 "As-path attribute\n"
4019 u_int16_t flags
= PEER_FLAG_NEXTHOP_UNCHANGED
;
4021 if (strncmp (argv
[1], "as-path", 1) == 0)
4022 SET_FLAG (flags
, PEER_FLAG_AS_PATH_UNCHANGED
);
4023 else if (strncmp (argv
[1], "med", 1) == 0)
4024 SET_FLAG (flags
, PEER_FLAG_MED_UNCHANGED
);
4026 return peer_af_flag_set_vty (vty
, argv
[0], bgp_node_afi (vty
),
4027 bgp_node_safi (vty
), flags
);
4030 DEFUN (neighbor_attr_unchanged4
,
4031 neighbor_attr_unchanged4_cmd
,
4032 NEIGHBOR_CMD2
"attribute-unchanged med (as-path|next-hop)",
4035 "BGP attribute is propagated unchanged to this neighbor\n"
4037 "As-path attribute\n"
4038 "Nexthop attribute\n")
4040 u_int16_t flags
= PEER_FLAG_MED_UNCHANGED
;
4042 if (strncmp (argv
[1], "as-path", 1) == 0)
4043 SET_FLAG (flags
, PEER_FLAG_AS_PATH_UNCHANGED
);
4044 else if (strncmp (argv
[1], "next-hop", 1) == 0)
4045 SET_FLAG (flags
, PEER_FLAG_NEXTHOP_UNCHANGED
);
4047 return peer_af_flag_set_vty (vty
, argv
[0], bgp_node_afi (vty
),
4048 bgp_node_safi (vty
), flags
);
4051 ALIAS (neighbor_attr_unchanged
,
4052 neighbor_attr_unchanged5_cmd
,
4053 NEIGHBOR_CMD2
"attribute-unchanged as-path next-hop med",
4056 "BGP attribute is propagated unchanged to this neighbor\n"
4057 "As-path attribute\n"
4058 "Nexthop attribute\n"
4061 ALIAS (neighbor_attr_unchanged
,
4062 neighbor_attr_unchanged6_cmd
,
4063 NEIGHBOR_CMD2
"attribute-unchanged as-path med next-hop",
4066 "BGP attribute is propagated unchanged to this neighbor\n"
4067 "As-path attribute\n"
4069 "Nexthop attribute\n")
4071 ALIAS (neighbor_attr_unchanged
,
4072 neighbor_attr_unchanged7_cmd
,
4073 NEIGHBOR_CMD2
"attribute-unchanged next-hop med as-path",
4076 "BGP attribute is propagated unchanged to this neighbor\n"
4077 "Nexthop attribute\n"
4079 "As-path attribute\n")
4081 ALIAS (neighbor_attr_unchanged
,
4082 neighbor_attr_unchanged8_cmd
,
4083 NEIGHBOR_CMD2
"attribute-unchanged next-hop as-path med",
4086 "BGP attribute is propagated unchanged to this neighbor\n"
4087 "Nexthop attribute\n"
4088 "As-path attribute\n"
4091 ALIAS (neighbor_attr_unchanged
,
4092 neighbor_attr_unchanged9_cmd
,
4093 NEIGHBOR_CMD2
"attribute-unchanged med next-hop as-path",
4096 "BGP attribute is propagated unchanged to this neighbor\n"
4098 "Nexthop attribute\n"
4099 "As-path attribute\n")
4101 ALIAS (neighbor_attr_unchanged
,
4102 neighbor_attr_unchanged10_cmd
,
4103 NEIGHBOR_CMD2
"attribute-unchanged med as-path next-hop",
4106 "BGP attribute is propagated unchanged to this neighbor\n"
4108 "As-path attribute\n"
4109 "Nexthop attribute\n")
4111 DEFUN (no_neighbor_attr_unchanged
,
4112 no_neighbor_attr_unchanged_cmd
,
4113 NO_NEIGHBOR_CMD2
"attribute-unchanged",
4117 "BGP attribute is propagated unchanged to this neighbor\n")
4119 return peer_af_flag_unset_vty (vty
, argv
[0], bgp_node_afi (vty
),
4120 bgp_node_safi (vty
),
4121 (PEER_FLAG_AS_PATH_UNCHANGED
|
4122 PEER_FLAG_NEXTHOP_UNCHANGED
|
4123 PEER_FLAG_MED_UNCHANGED
));
4126 DEFUN (no_neighbor_attr_unchanged1
,
4127 no_neighbor_attr_unchanged1_cmd
,
4128 NO_NEIGHBOR_CMD2
"attribute-unchanged (as-path|next-hop|med)",
4132 "BGP attribute is propagated unchanged to this neighbor\n"
4133 "As-path attribute\n"
4134 "Nexthop attribute\n"
4137 u_int16_t flags
= 0;
4139 if (strncmp (argv
[1], "as-path", 1) == 0)
4140 SET_FLAG (flags
, PEER_FLAG_AS_PATH_UNCHANGED
);
4141 else if (strncmp (argv
[1], "next-hop", 1) == 0)
4142 SET_FLAG (flags
, PEER_FLAG_NEXTHOP_UNCHANGED
);
4143 else if (strncmp (argv
[1], "med", 1) == 0)
4144 SET_FLAG (flags
, PEER_FLAG_MED_UNCHANGED
);
4146 return peer_af_flag_unset_vty (vty
, argv
[0], bgp_node_afi (vty
),
4147 bgp_node_safi (vty
), flags
);
4150 DEFUN (no_neighbor_attr_unchanged2
,
4151 no_neighbor_attr_unchanged2_cmd
,
4152 NO_NEIGHBOR_CMD2
"attribute-unchanged as-path (next-hop|med)",
4156 "BGP attribute is propagated unchanged to this neighbor\n"
4157 "As-path attribute\n"
4158 "Nexthop attribute\n"
4161 u_int16_t flags
= PEER_FLAG_AS_PATH_UNCHANGED
;
4163 if (strncmp (argv
[1], "next-hop", 1) == 0)
4164 SET_FLAG (flags
, PEER_FLAG_NEXTHOP_UNCHANGED
);
4165 else if (strncmp (argv
[1], "med", 1) == 0)
4166 SET_FLAG (flags
, PEER_FLAG_MED_UNCHANGED
);
4168 return peer_af_flag_unset_vty (vty
, argv
[0], bgp_node_afi (vty
),
4169 bgp_node_safi (vty
), flags
);
4172 DEFUN (no_neighbor_attr_unchanged3
,
4173 no_neighbor_attr_unchanged3_cmd
,
4174 NO_NEIGHBOR_CMD2
"attribute-unchanged next-hop (as-path|med)",
4178 "BGP attribute is propagated unchanged to this neighbor\n"
4179 "Nexthop attribute\n"
4180 "As-path attribute\n"
4183 u_int16_t flags
= PEER_FLAG_NEXTHOP_UNCHANGED
;
4185 if (strncmp (argv
[1], "as-path", 1) == 0)
4186 SET_FLAG (flags
, PEER_FLAG_AS_PATH_UNCHANGED
);
4187 else if (strncmp (argv
[1], "med", 1) == 0)
4188 SET_FLAG (flags
, PEER_FLAG_MED_UNCHANGED
);
4190 return peer_af_flag_unset_vty (vty
, argv
[0], bgp_node_afi (vty
),
4191 bgp_node_safi (vty
), flags
);
4194 DEFUN (no_neighbor_attr_unchanged4
,
4195 no_neighbor_attr_unchanged4_cmd
,
4196 NO_NEIGHBOR_CMD2
"attribute-unchanged med (as-path|next-hop)",
4200 "BGP attribute is propagated unchanged to this neighbor\n"
4202 "As-path attribute\n"
4203 "Nexthop attribute\n")
4205 u_int16_t flags
= PEER_FLAG_MED_UNCHANGED
;
4207 if (strncmp (argv
[1], "as-path", 1) == 0)
4208 SET_FLAG (flags
, PEER_FLAG_AS_PATH_UNCHANGED
);
4209 else if (strncmp (argv
[1], "next-hop", 1) == 0)
4210 SET_FLAG (flags
, PEER_FLAG_NEXTHOP_UNCHANGED
);
4212 return peer_af_flag_unset_vty (vty
, argv
[0], bgp_node_afi (vty
),
4213 bgp_node_safi (vty
), flags
);
4216 ALIAS (no_neighbor_attr_unchanged
,
4217 no_neighbor_attr_unchanged5_cmd
,
4218 NO_NEIGHBOR_CMD2
"attribute-unchanged as-path next-hop med",
4222 "BGP attribute is propagated unchanged to this neighbor\n"
4223 "As-path attribute\n"
4224 "Nexthop attribute\n"
4227 ALIAS (no_neighbor_attr_unchanged
,
4228 no_neighbor_attr_unchanged6_cmd
,
4229 NO_NEIGHBOR_CMD2
"attribute-unchanged as-path med next-hop",
4233 "BGP attribute is propagated unchanged to this neighbor\n"
4234 "As-path attribute\n"
4236 "Nexthop attribute\n")
4238 ALIAS (no_neighbor_attr_unchanged
,
4239 no_neighbor_attr_unchanged7_cmd
,
4240 NO_NEIGHBOR_CMD2
"attribute-unchanged next-hop med as-path",
4244 "BGP attribute is propagated unchanged to this neighbor\n"
4245 "Nexthop attribute\n"
4247 "As-path attribute\n")
4249 ALIAS (no_neighbor_attr_unchanged
,
4250 no_neighbor_attr_unchanged8_cmd
,
4251 NO_NEIGHBOR_CMD2
"attribute-unchanged next-hop as-path med",
4255 "BGP attribute is propagated unchanged to this neighbor\n"
4256 "Nexthop attribute\n"
4257 "As-path attribute\n"
4260 ALIAS (no_neighbor_attr_unchanged
,
4261 no_neighbor_attr_unchanged9_cmd
,
4262 NO_NEIGHBOR_CMD2
"attribute-unchanged med next-hop as-path",
4266 "BGP attribute is propagated unchanged to this neighbor\n"
4268 "Nexthop attribute\n"
4269 "As-path attribute\n")
4271 ALIAS (no_neighbor_attr_unchanged
,
4272 no_neighbor_attr_unchanged10_cmd
,
4273 NO_NEIGHBOR_CMD2
"attribute-unchanged med as-path next-hop",
4277 "BGP attribute is propagated unchanged to this neighbor\n"
4279 "As-path attribute\n"
4280 "Nexthop attribute\n")
4282 /* EBGP multihop configuration. */
4284 peer_ebgp_multihop_set_vty (struct vty
*vty
, const char *ip_str
,
4285 const char *ttl_str
)
4290 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
4297 VTY_GET_INTEGER_RANGE ("TTL", ttl
, ttl_str
, 1, MAXTTL
);
4299 return bgp_vty_return (vty
, peer_ebgp_multihop_set (peer
, ttl
));
4303 peer_ebgp_multihop_unset_vty (struct vty
*vty
, const char *ip_str
)
4307 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
4311 return bgp_vty_return (vty
, peer_ebgp_multihop_unset (peer
));
4314 /* neighbor ebgp-multihop. */
4315 DEFUN (neighbor_ebgp_multihop
,
4316 neighbor_ebgp_multihop_cmd
,
4317 NEIGHBOR_CMD2
"ebgp-multihop",
4320 "Allow EBGP neighbors not on directly connected networks\n")
4322 return peer_ebgp_multihop_set_vty (vty
, argv
[0], NULL
);
4325 DEFUN (neighbor_ebgp_multihop_ttl
,
4326 neighbor_ebgp_multihop_ttl_cmd
,
4327 NEIGHBOR_CMD2
"ebgp-multihop " CMD_RANGE_STR(1, MAXTTL
),
4330 "Allow EBGP neighbors not on directly connected networks\n"
4331 "maximum hop count\n")
4333 return peer_ebgp_multihop_set_vty (vty
, argv
[0], argv
[1]);
4336 DEFUN (no_neighbor_ebgp_multihop
,
4337 no_neighbor_ebgp_multihop_cmd
,
4338 NO_NEIGHBOR_CMD2
"ebgp-multihop",
4342 "Allow EBGP neighbors not on directly connected networks\n")
4344 return peer_ebgp_multihop_unset_vty (vty
, argv
[0]);
4347 ALIAS (no_neighbor_ebgp_multihop
,
4348 no_neighbor_ebgp_multihop_ttl_cmd
,
4349 NO_NEIGHBOR_CMD2
"ebgp-multihop " CMD_RANGE_STR(1, MAXTTL
),
4353 "Allow EBGP neighbors not on directly connected networks\n"
4354 "maximum hop count\n")
4356 /* disable-connected-check */
4357 DEFUN (neighbor_disable_connected_check
,
4358 neighbor_disable_connected_check_cmd
,
4359 NEIGHBOR_CMD2
"disable-connected-check",
4362 "one-hop away EBGP peer using loopback address\n")
4364 return peer_flag_set_vty (vty
, argv
[0], PEER_FLAG_DISABLE_CONNECTED_CHECK
);
4367 DEFUN (no_neighbor_disable_connected_check
,
4368 no_neighbor_disable_connected_check_cmd
,
4369 NO_NEIGHBOR_CMD2
"disable-connected-check",
4373 "one-hop away EBGP peer using loopback address\n")
4375 return peer_flag_unset_vty (vty
, argv
[0], PEER_FLAG_DISABLE_CONNECTED_CHECK
);
4378 /* Enforce multihop. */
4379 ALIAS (neighbor_disable_connected_check
,
4380 neighbor_enforce_multihop_cmd
,
4381 NEIGHBOR_CMD2
"enforce-multihop",
4384 "Enforce EBGP neighbors perform multihop\n")
4386 /* Enforce multihop. */
4387 ALIAS (no_neighbor_disable_connected_check
,
4388 no_neighbor_enforce_multihop_cmd
,
4389 NO_NEIGHBOR_CMD2
"enforce-multihop",
4393 "Enforce EBGP neighbors perform multihop\n")
4395 DEFUN (neighbor_description
,
4396 neighbor_description_cmd
,
4397 NEIGHBOR_CMD2
"description .LINE",
4400 "Neighbor specific description\n"
4401 "Up to 80 characters describing this neighbor\n")
4406 peer
= peer_and_group_lookup_vty (vty
, argv
[0]);
4413 str
= argv_concat(argv
, argc
, 1);
4415 peer_description_set (peer
, str
);
4417 XFREE (MTYPE_TMP
, str
);
4422 DEFUN (no_neighbor_description
,
4423 no_neighbor_description_cmd
,
4424 NO_NEIGHBOR_CMD2
"description",
4428 "Neighbor specific description\n")
4432 peer
= peer_and_group_lookup_vty (vty
, argv
[0]);
4436 peer_description_unset (peer
);
4441 ALIAS (no_neighbor_description
,
4442 no_neighbor_description_val_cmd
,
4443 NO_NEIGHBOR_CMD2
"description .LINE",
4447 "Neighbor specific description\n"
4448 "Up to 80 characters describing this neighbor\n")
4450 /* Neighbor update-source. */
4452 peer_update_source_vty (struct vty
*vty
, const char *peer_str
,
4453 const char *source_str
)
4457 peer
= peer_and_group_lookup_vty (vty
, peer_str
);
4467 int ret
= str2sockunion (source_str
, &su
);
4470 peer_update_source_addr_set (peer
, &su
);
4472 peer_update_source_if_set (peer
, source_str
);
4475 peer_update_source_unset (peer
);
4480 #define BGP_UPDATE_SOURCE_STR "A.B.C.D|X:X::X:X|WORD"
4481 #define BGP_UPDATE_SOURCE_REQ_STR "(" BGP_UPDATE_SOURCE_STR ")"
4482 #define BGP_UPDATE_SOURCE_OPT_STR "{" BGP_UPDATE_SOURCE_STR "}"
4483 #define BGP_UPDATE_SOURCE_HELP_STR \
4486 "Interface name (requires zebra to be running)\n"
4488 DEFUN (neighbor_update_source
,
4489 neighbor_update_source_cmd
,
4490 NEIGHBOR_CMD2
"update-source " BGP_UPDATE_SOURCE_REQ_STR
,
4493 "Source of routing updates\n"
4494 BGP_UPDATE_SOURCE_HELP_STR
)
4496 return peer_update_source_vty (vty
, argv
[0], argv
[1]);
4499 DEFUN (no_neighbor_update_source
,
4500 no_neighbor_update_source_cmd
,
4501 NO_NEIGHBOR_CMD2
"update-source " BGP_UPDATE_SOURCE_OPT_STR
,
4505 "Source of routing updates\n"
4506 BGP_UPDATE_SOURCE_HELP_STR
)
4508 return peer_update_source_vty (vty
, argv
[0], NULL
);
4512 peer_default_originate_set_vty (struct vty
*vty
, const char *peer_str
,
4513 afi_t afi
, safi_t safi
,
4514 const char *rmap
, int set
)
4519 peer
= peer_and_group_lookup_vty (vty
, peer_str
);
4524 ret
= peer_default_originate_set (peer
, afi
, safi
, rmap
);
4526 ret
= peer_default_originate_unset (peer
, afi
, safi
);
4528 return bgp_vty_return (vty
, ret
);
4531 /* neighbor default-originate. */
4532 DEFUN (neighbor_default_originate
,
4533 neighbor_default_originate_cmd
,
4534 NEIGHBOR_CMD2
"default-originate",
4537 "Originate default route to this neighbor\n")
4539 return peer_default_originate_set_vty (vty
, argv
[0], bgp_node_afi (vty
),
4540 bgp_node_safi (vty
), NULL
, 1);
4543 DEFUN (neighbor_default_originate_rmap
,
4544 neighbor_default_originate_rmap_cmd
,
4545 NEIGHBOR_CMD2
"default-originate route-map WORD",
4548 "Originate default route to this neighbor\n"
4549 "Route-map to specify criteria to originate default\n"
4552 return peer_default_originate_set_vty (vty
, argv
[0], bgp_node_afi (vty
),
4553 bgp_node_safi (vty
), argv
[1], 1);
4556 DEFUN (no_neighbor_default_originate
,
4557 no_neighbor_default_originate_cmd
,
4558 NO_NEIGHBOR_CMD2
"default-originate",
4562 "Originate default route to this neighbor\n")
4564 return peer_default_originate_set_vty (vty
, argv
[0], bgp_node_afi (vty
),
4565 bgp_node_safi (vty
), NULL
, 0);
4568 ALIAS (no_neighbor_default_originate
,
4569 no_neighbor_default_originate_rmap_cmd
,
4570 NO_NEIGHBOR_CMD2
"default-originate route-map WORD",
4574 "Originate default route to this neighbor\n"
4575 "Route-map to specify criteria to originate default\n"
4578 /* Set neighbor's BGP port. */
4580 peer_port_vty (struct vty
*vty
, const char *ip_str
, int afi
,
4581 const char *port_str
)
4587 peer
= peer_lookup_vty (vty
, ip_str
);
4593 sp
= getservbyname ("bgp", "tcp");
4594 port
= (sp
== NULL
) ? BGP_PORT_DEFAULT
: ntohs (sp
->s_port
);
4598 VTY_GET_INTEGER("port", port
, port_str
);
4601 peer_port_set (peer
, port
);
4606 /* Set specified peer's BGP port. */
4607 DEFUN (neighbor_port
,
4609 NEIGHBOR_CMD
"port <0-65535>",
4612 "Neighbor's BGP port\n"
4613 "TCP port number\n")
4615 return peer_port_vty (vty
, argv
[0], AFI_IP
, argv
[1]);
4618 DEFUN (no_neighbor_port
,
4619 no_neighbor_port_cmd
,
4620 NO_NEIGHBOR_CMD
"port",
4624 "Neighbor's BGP port\n")
4626 return peer_port_vty (vty
, argv
[0], AFI_IP
, NULL
);
4629 ALIAS (no_neighbor_port
,
4630 no_neighbor_port_val_cmd
,
4631 NO_NEIGHBOR_CMD
"port <0-65535>",
4635 "Neighbor's BGP port\n"
4636 "TCP port number\n")
4638 /* neighbor weight. */
4640 peer_weight_set_vty (struct vty
*vty
, const char *ip_str
,
4641 const char *weight_str
)
4644 unsigned long weight
;
4646 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
4650 VTY_GET_INTEGER_RANGE("weight", weight
, weight_str
, 0, 65535);
4652 peer_weight_set (peer
, weight
);
4658 peer_weight_unset_vty (struct vty
*vty
, const char *ip_str
)
4662 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
4666 peer_weight_unset (peer
);
4671 DEFUN (neighbor_weight
,
4672 neighbor_weight_cmd
,
4673 NEIGHBOR_CMD2
"weight <0-65535>",
4676 "Set default weight for routes from this neighbor\n"
4679 return peer_weight_set_vty (vty
, argv
[0], argv
[1]);
4682 DEFUN (no_neighbor_weight
,
4683 no_neighbor_weight_cmd
,
4684 NO_NEIGHBOR_CMD2
"weight",
4688 "Set default weight for routes from this neighbor\n")
4690 return peer_weight_unset_vty (vty
, argv
[0]);
4693 ALIAS (no_neighbor_weight
,
4694 no_neighbor_weight_val_cmd
,
4695 NO_NEIGHBOR_CMD2
"weight <0-65535>",
4699 "Set default weight for routes from this neighbor\n"
4702 /* Override capability negotiation. */
4703 DEFUN (neighbor_override_capability
,
4704 neighbor_override_capability_cmd
,
4705 NEIGHBOR_CMD2
"override-capability",
4708 "Override capability negotiation result\n")
4710 return peer_flag_set_vty (vty
, argv
[0], PEER_FLAG_OVERRIDE_CAPABILITY
);
4713 DEFUN (no_neighbor_override_capability
,
4714 no_neighbor_override_capability_cmd
,
4715 NO_NEIGHBOR_CMD2
"override-capability",
4719 "Override capability negotiation result\n")
4721 return peer_flag_unset_vty (vty
, argv
[0], PEER_FLAG_OVERRIDE_CAPABILITY
);
4724 DEFUN (neighbor_strict_capability
,
4725 neighbor_strict_capability_cmd
,
4726 NEIGHBOR_CMD
"strict-capability-match",
4729 "Strict capability negotiation match\n")
4731 return peer_flag_set_vty (vty
, argv
[0], PEER_FLAG_STRICT_CAP_MATCH
);
4734 DEFUN (no_neighbor_strict_capability
,
4735 no_neighbor_strict_capability_cmd
,
4736 NO_NEIGHBOR_CMD
"strict-capability-match",
4740 "Strict capability negotiation match\n")
4742 return peer_flag_unset_vty (vty
, argv
[0], PEER_FLAG_STRICT_CAP_MATCH
);
4746 peer_timers_set_vty (struct vty
*vty
, const char *ip_str
,
4747 const char *keep_str
, const char *hold_str
)
4751 u_int32_t keepalive
;
4754 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
4758 VTY_GET_INTEGER_RANGE ("Keepalive", keepalive
, keep_str
, 0, 65535);
4759 VTY_GET_INTEGER_RANGE ("Holdtime", holdtime
, hold_str
, 0, 65535);
4761 ret
= peer_timers_set (peer
, keepalive
, holdtime
);
4763 return bgp_vty_return (vty
, ret
);
4767 peer_timers_unset_vty (struct vty
*vty
, const char *ip_str
)
4772 peer
= peer_lookup_vty (vty
, ip_str
);
4776 ret
= peer_timers_unset (peer
);
4778 return bgp_vty_return (vty
, ret
);
4781 DEFUN (neighbor_timers
,
4782 neighbor_timers_cmd
,
4783 NEIGHBOR_CMD2
"timers <0-65535> <0-65535>",
4786 "BGP per neighbor timers\n"
4787 "Keepalive interval\n"
4790 return peer_timers_set_vty (vty
, argv
[0], argv
[1], argv
[2]);
4793 DEFUN (no_neighbor_timers
,
4794 no_neighbor_timers_cmd
,
4795 NO_NEIGHBOR_CMD2
"timers",
4799 "BGP per neighbor timers\n")
4801 return peer_timers_unset_vty (vty
, argv
[0]);
4804 ALIAS (no_neighbor_timers
,
4805 no_neighbor_timers_val_cmd
,
4806 NO_NEIGHBOR_CMD2
"timers <0-65535> <0-65535>",
4810 "BGP per neighbor timers\n"
4811 "Keepalive interval\n"
4815 peer_timers_connect_set_vty (struct vty
*vty
, const char *ip_str
,
4816 const char *time_str
)
4822 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
4826 VTY_GET_INTEGER_RANGE ("Connect time", connect
, time_str
, 0, 65535);
4828 ret
= peer_timers_connect_set (peer
, connect
);
4830 return bgp_vty_return (vty
, ret
);
4834 peer_timers_connect_unset_vty (struct vty
*vty
, const char *ip_str
)
4839 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
4843 ret
= peer_timers_connect_unset (peer
);
4845 return bgp_vty_return (vty
, ret
);
4848 DEFUN (neighbor_timers_connect
,
4849 neighbor_timers_connect_cmd
,
4850 NEIGHBOR_CMD2
"timers connect <1-65535>",
4853 "BGP per neighbor timers\n"
4854 "BGP connect timer\n"
4857 return peer_timers_connect_set_vty (vty
, argv
[0], argv
[1]);
4860 DEFUN (no_neighbor_timers_connect
,
4861 no_neighbor_timers_connect_cmd
,
4862 NO_NEIGHBOR_CMD2
"timers connect",
4866 "BGP per neighbor timers\n"
4867 "BGP connect timer\n")
4869 return peer_timers_connect_unset_vty (vty
, argv
[0]);
4872 ALIAS (no_neighbor_timers_connect
,
4873 no_neighbor_timers_connect_val_cmd
,
4874 NO_NEIGHBOR_CMD2
"timers connect <1-65535>",
4878 "BGP per neighbor timers\n"
4879 "BGP connect timer\n"
4883 peer_advertise_interval_vty (struct vty
*vty
, const char *ip_str
,
4884 const char *time_str
, int set
)
4888 u_int32_t routeadv
= 0;
4890 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
4895 VTY_GET_INTEGER_RANGE ("advertise interval", routeadv
, time_str
, 0, 600);
4898 ret
= peer_advertise_interval_set (peer
, routeadv
);
4900 ret
= peer_advertise_interval_unset (peer
);
4902 return bgp_vty_return (vty
, ret
);
4905 DEFUN (neighbor_advertise_interval
,
4906 neighbor_advertise_interval_cmd
,
4907 NEIGHBOR_CMD2
"advertisement-interval <0-600>",
4910 "Minimum interval between sending BGP routing updates\n"
4911 "time in seconds\n")
4913 return peer_advertise_interval_vty (vty
, argv
[0], argv
[1], 1);
4916 DEFUN (no_neighbor_advertise_interval
,
4917 no_neighbor_advertise_interval_cmd
,
4918 NO_NEIGHBOR_CMD2
"advertisement-interval",
4922 "Minimum interval between sending BGP routing updates\n")
4924 return peer_advertise_interval_vty (vty
, argv
[0], NULL
, 0);
4927 ALIAS (no_neighbor_advertise_interval
,
4928 no_neighbor_advertise_interval_val_cmd
,
4929 NO_NEIGHBOR_CMD2
"advertisement-interval <0-600>",
4933 "Minimum interval between sending BGP routing updates\n"
4934 "time in seconds\n")
4936 /* Time to wait before processing route-map updates */
4937 DEFUN (bgp_set_route_map_delay_timer
,
4938 bgp_set_route_map_delay_timer_cmd
,
4939 "bgp route-map delay-timer <0-600>",
4941 "BGP route-map delay timer\n"
4942 "Time in secs to wait before processing route-map changes\n"
4943 "0 disables the timer, no route updates happen when route-maps change\n")
4945 u_int32_t rmap_delay_timer
;
4951 VTY_GET_INTEGER_RANGE ("delay-timer", rmap_delay_timer
, argv
[0], 0, 600);
4952 bgp
->rmap_update_timer
= rmap_delay_timer
;
4954 /* if the dynamic update handling is being disabled, and a timer is
4955 * running, stop the timer and act as if the timer has already fired.
4957 if (!rmap_delay_timer
&& bgp
->t_rmap_update
)
4959 BGP_TIMER_OFF(bgp
->t_rmap_update
);
4960 thread_execute (bm
->master
, bgp_route_map_update_timer
, &bgp
, 0);
4968 DEFUN (no_bgp_set_route_map_delay_timer
,
4969 no_bgp_set_route_map_delay_timer_cmd
,
4970 "no bgp route-map delay-timer",
4972 "Default BGP route-map delay timer\n"
4973 "Reset to default time to wait for processing route-map changes\n")
4978 bgp
->rmap_update_timer
= RMAP_DEFAULT_UPDATE_TIMER
;
4983 ALIAS (no_bgp_set_route_map_delay_timer
,
4984 no_bgp_set_route_map_delay_timer_val_cmd
,
4985 "no bgp route-map delay-timer <0-600>",
4987 "Default BGP route-map delay timer\n"
4988 "Reset to default time to wait for processing route-map changes\n"
4989 "0 disables the timer, no route updates happen when route-maps change\n")
4991 /* neighbor interface */
4993 peer_interface_vty (struct vty
*vty
, const char *ip_str
, const char *str
)
4997 peer
= peer_lookup_vty (vty
, ip_str
);
4998 if (! peer
|| peer
->conf_if
)
5002 peer_interface_set (peer
, str
);
5004 peer_interface_unset (peer
);
5009 DEFUN (neighbor_interface
,
5010 neighbor_interface_cmd
,
5011 NEIGHBOR_CMD
"interface WORD",
5018 return peer_interface_vty (vty
, argv
[0], argv
[1]);
5020 return peer_interface_vty (vty
, argv
[0], argv
[1]);
5023 DEFUN (no_neighbor_interface
,
5024 no_neighbor_interface_cmd
,
5025 NO_NEIGHBOR_CMD2
"interface WORD",
5032 return peer_interface_vty (vty
, argv
[0], NULL
);
5035 /* Set distribute list to the peer. */
5037 peer_distribute_set_vty (struct vty
*vty
, const char *ip_str
,
5038 afi_t afi
, safi_t safi
,
5039 const char *name_str
, const char *direct_str
)
5043 int direct
= FILTER_IN
;
5045 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5049 /* Check filter direction. */
5050 if (strncmp (direct_str
, "i", 1) == 0)
5052 else if (strncmp (direct_str
, "o", 1) == 0)
5053 direct
= FILTER_OUT
;
5055 ret
= peer_distribute_set (peer
, afi
, safi
, direct
, name_str
);
5057 return bgp_vty_return (vty
, ret
);
5061 peer_distribute_unset_vty (struct vty
*vty
, const char *ip_str
, afi_t afi
,
5062 safi_t safi
, const char *direct_str
)
5066 int direct
= FILTER_IN
;
5068 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5072 /* Check filter direction. */
5073 if (strncmp (direct_str
, "i", 1) == 0)
5075 else if (strncmp (direct_str
, "o", 1) == 0)
5076 direct
= FILTER_OUT
;
5078 ret
= peer_distribute_unset (peer
, afi
, safi
, direct
);
5080 return bgp_vty_return (vty
, ret
);
5083 DEFUN (neighbor_distribute_list
,
5084 neighbor_distribute_list_cmd
,
5085 NEIGHBOR_CMD2
"distribute-list (<1-199>|<1300-2699>|WORD) (in|out)",
5088 "Filter updates to/from this neighbor\n"
5089 "IP access-list number\n"
5090 "IP access-list number (expanded range)\n"
5091 "IP Access-list name\n"
5092 "Filter incoming updates\n"
5093 "Filter outgoing updates\n")
5095 return peer_distribute_set_vty (vty
, argv
[0], bgp_node_afi (vty
),
5096 bgp_node_safi (vty
), argv
[1], argv
[2]);
5099 DEFUN (no_neighbor_distribute_list
,
5100 no_neighbor_distribute_list_cmd
,
5101 NO_NEIGHBOR_CMD2
"distribute-list (<1-199>|<1300-2699>|WORD) (in|out)",
5105 "Filter updates to/from this neighbor\n"
5106 "IP access-list number\n"
5107 "IP access-list number (expanded range)\n"
5108 "IP Access-list name\n"
5109 "Filter incoming updates\n"
5110 "Filter outgoing updates\n")
5112 return peer_distribute_unset_vty (vty
, argv
[0], bgp_node_afi (vty
),
5113 bgp_node_safi (vty
), argv
[2]);
5116 /* Set prefix list to the peer. */
5118 peer_prefix_list_set_vty (struct vty
*vty
, const char *ip_str
, afi_t afi
,
5119 safi_t safi
, const char *name_str
,
5120 const char *direct_str
)
5124 int direct
= FILTER_IN
;
5126 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5130 /* Check filter direction. */
5131 if (strncmp (direct_str
, "i", 1) == 0)
5133 else if (strncmp (direct_str
, "o", 1) == 0)
5134 direct
= FILTER_OUT
;
5136 ret
= peer_prefix_list_set (peer
, afi
, safi
, direct
, name_str
);
5138 return bgp_vty_return (vty
, ret
);
5142 peer_prefix_list_unset_vty (struct vty
*vty
, const char *ip_str
, afi_t afi
,
5143 safi_t safi
, const char *direct_str
)
5147 int direct
= FILTER_IN
;
5149 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5153 /* Check filter direction. */
5154 if (strncmp (direct_str
, "i", 1) == 0)
5156 else if (strncmp (direct_str
, "o", 1) == 0)
5157 direct
= FILTER_OUT
;
5159 ret
= peer_prefix_list_unset (peer
, afi
, safi
, direct
);
5161 return bgp_vty_return (vty
, ret
);
5164 DEFUN (neighbor_prefix_list
,
5165 neighbor_prefix_list_cmd
,
5166 NEIGHBOR_CMD2
"prefix-list WORD (in|out)",
5169 "Filter updates to/from this neighbor\n"
5170 "Name of a prefix list\n"
5171 "Filter incoming updates\n"
5172 "Filter outgoing updates\n")
5174 return peer_prefix_list_set_vty (vty
, argv
[0], bgp_node_afi (vty
),
5175 bgp_node_safi (vty
), argv
[1], argv
[2]);
5178 DEFUN (no_neighbor_prefix_list
,
5179 no_neighbor_prefix_list_cmd
,
5180 NO_NEIGHBOR_CMD2
"prefix-list WORD (in|out)",
5184 "Filter updates to/from this neighbor\n"
5185 "Name of a prefix list\n"
5186 "Filter incoming updates\n"
5187 "Filter outgoing updates\n")
5189 return peer_prefix_list_unset_vty (vty
, argv
[0], bgp_node_afi (vty
),
5190 bgp_node_safi (vty
), argv
[2]);
5194 peer_aslist_set_vty (struct vty
*vty
, const char *ip_str
,
5195 afi_t afi
, safi_t safi
,
5196 const char *name_str
, const char *direct_str
)
5200 int direct
= FILTER_IN
;
5202 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5206 /* Check filter direction. */
5207 if (strncmp (direct_str
, "i", 1) == 0)
5209 else if (strncmp (direct_str
, "o", 1) == 0)
5210 direct
= FILTER_OUT
;
5212 ret
= peer_aslist_set (peer
, afi
, safi
, direct
, name_str
);
5214 return bgp_vty_return (vty
, ret
);
5218 peer_aslist_unset_vty (struct vty
*vty
, const char *ip_str
,
5219 afi_t afi
, safi_t safi
,
5220 const char *direct_str
)
5224 int direct
= FILTER_IN
;
5226 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5230 /* Check filter direction. */
5231 if (strncmp (direct_str
, "i", 1) == 0)
5233 else if (strncmp (direct_str
, "o", 1) == 0)
5234 direct
= FILTER_OUT
;
5236 ret
= peer_aslist_unset (peer
, afi
, safi
, direct
);
5238 return bgp_vty_return (vty
, ret
);
5241 DEFUN (neighbor_filter_list
,
5242 neighbor_filter_list_cmd
,
5243 NEIGHBOR_CMD2
"filter-list WORD (in|out)",
5246 "Establish BGP filters\n"
5247 "AS path access-list name\n"
5248 "Filter incoming routes\n"
5249 "Filter outgoing routes\n")
5251 return peer_aslist_set_vty (vty
, argv
[0], bgp_node_afi (vty
),
5252 bgp_node_safi (vty
), argv
[1], argv
[2]);
5255 DEFUN (no_neighbor_filter_list
,
5256 no_neighbor_filter_list_cmd
,
5257 NO_NEIGHBOR_CMD2
"filter-list WORD (in|out)",
5261 "Establish BGP filters\n"
5262 "AS path access-list name\n"
5263 "Filter incoming routes\n"
5264 "Filter outgoing routes\n")
5266 return peer_aslist_unset_vty (vty
, argv
[0], bgp_node_afi (vty
),
5267 bgp_node_safi (vty
), argv
[2]);
5270 /* Set route-map to the peer. */
5272 peer_route_map_set_vty (struct vty
*vty
, const char *ip_str
,
5273 afi_t afi
, safi_t safi
,
5274 const char *name_str
, const char *direct_str
)
5278 int direct
= RMAP_IN
;
5280 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5284 /* Check filter direction. */
5285 if (strncmp (direct_str
, "in", 2) == 0)
5287 else if (strncmp (direct_str
, "o", 1) == 0)
5290 ret
= peer_route_map_set (peer
, afi
, safi
, direct
, name_str
);
5292 return bgp_vty_return (vty
, ret
);
5296 peer_route_map_unset_vty (struct vty
*vty
, const char *ip_str
, afi_t afi
,
5297 safi_t safi
, const char *direct_str
)
5301 int direct
= RMAP_IN
;
5303 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5307 /* Check filter direction. */
5308 if (strncmp (direct_str
, "in", 2) == 0)
5310 else if (strncmp (direct_str
, "o", 1) == 0)
5313 ret
= peer_route_map_unset (peer
, afi
, safi
, direct
);
5315 return bgp_vty_return (vty
, ret
);
5318 DEFUN (neighbor_route_map
,
5319 neighbor_route_map_cmd
,
5320 NEIGHBOR_CMD2
"route-map WORD (in|out)",
5323 "Apply route map to neighbor\n"
5324 "Name of route map\n"
5325 "Apply map to incoming routes\n"
5326 "Apply map to outbound routes\n")
5328 return peer_route_map_set_vty (vty
, argv
[0], bgp_node_afi (vty
),
5329 bgp_node_safi (vty
), argv
[1], argv
[2]);
5332 DEFUN (no_neighbor_route_map
,
5333 no_neighbor_route_map_cmd
,
5334 NO_NEIGHBOR_CMD2
"route-map WORD (in|out)",
5338 "Apply route map to neighbor\n"
5339 "Name of route map\n"
5340 "Apply map to incoming routes\n"
5341 "Apply map to outbound routes\n")
5343 return peer_route_map_unset_vty (vty
, argv
[0], bgp_node_afi (vty
),
5344 bgp_node_safi (vty
), argv
[2]);
5347 /* Set unsuppress-map to the peer. */
5349 peer_unsuppress_map_set_vty (struct vty
*vty
, const char *ip_str
, afi_t afi
,
5350 safi_t safi
, const char *name_str
)
5355 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5359 ret
= peer_unsuppress_map_set (peer
, afi
, safi
, name_str
);
5361 return bgp_vty_return (vty
, ret
);
5364 /* Unset route-map from the peer. */
5366 peer_unsuppress_map_unset_vty (struct vty
*vty
, const char *ip_str
, afi_t afi
,
5372 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5376 ret
= peer_unsuppress_map_unset (peer
, afi
, safi
);
5378 return bgp_vty_return (vty
, ret
);
5381 DEFUN (neighbor_unsuppress_map
,
5382 neighbor_unsuppress_map_cmd
,
5383 NEIGHBOR_CMD2
"unsuppress-map WORD",
5386 "Route-map to selectively unsuppress suppressed routes\n"
5387 "Name of route map\n")
5389 return peer_unsuppress_map_set_vty (vty
, argv
[0], bgp_node_afi (vty
),
5390 bgp_node_safi (vty
), argv
[1]);
5393 DEFUN (no_neighbor_unsuppress_map
,
5394 no_neighbor_unsuppress_map_cmd
,
5395 NO_NEIGHBOR_CMD2
"unsuppress-map WORD",
5399 "Route-map to selectively unsuppress suppressed routes\n"
5400 "Name of route map\n")
5402 return peer_unsuppress_map_unset_vty (vty
, argv
[0], bgp_node_afi (vty
),
5403 bgp_node_safi (vty
));
5407 peer_maximum_prefix_set_vty (struct vty
*vty
, const char *ip_str
, afi_t afi
,
5408 safi_t safi
, const char *num_str
,
5409 const char *threshold_str
, int warning
,
5410 const char *restart_str
)
5418 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5422 VTY_GET_INTEGER ("maximum number", max
, num_str
);
5424 threshold
= atoi (threshold_str
);
5426 threshold
= MAXIMUM_PREFIX_THRESHOLD_DEFAULT
;
5429 restart
= atoi (restart_str
);
5433 ret
= peer_maximum_prefix_set (peer
, afi
, safi
, max
, threshold
, warning
, restart
);
5435 return bgp_vty_return (vty
, ret
);
5439 peer_maximum_prefix_unset_vty (struct vty
*vty
, const char *ip_str
, afi_t afi
,
5445 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5449 ret
= peer_maximum_prefix_unset (peer
, afi
, safi
);
5451 return bgp_vty_return (vty
, ret
);
5454 /* Maximum number of prefix configuration. prefix count is different
5455 for each peer configuration. So this configuration can be set for
5456 each peer configuration. */
5457 DEFUN (neighbor_maximum_prefix
,
5458 neighbor_maximum_prefix_cmd
,
5459 NEIGHBOR_CMD2
"maximum-prefix <1-4294967295>",
5462 "Maximum number of prefix accept from this peer\n"
5463 "maximum no. of prefix limit\n")
5465 return peer_maximum_prefix_set_vty (vty
, argv
[0], bgp_node_afi (vty
),
5466 bgp_node_safi (vty
), argv
[1], NULL
, 0,
5470 DEFUN (neighbor_maximum_prefix_threshold
,
5471 neighbor_maximum_prefix_threshold_cmd
,
5472 NEIGHBOR_CMD2
"maximum-prefix <1-4294967295> <1-100>",
5475 "Maximum number of prefix accept from this peer\n"
5476 "maximum no. of prefix limit\n"
5477 "Threshold value (%) at which to generate a warning msg\n")
5479 return peer_maximum_prefix_set_vty (vty
, argv
[0], bgp_node_afi (vty
),
5480 bgp_node_safi (vty
), argv
[1], argv
[2], 0,
5484 DEFUN (neighbor_maximum_prefix_warning
,
5485 neighbor_maximum_prefix_warning_cmd
,
5486 NEIGHBOR_CMD2
"maximum-prefix <1-4294967295> warning-only",
5489 "Maximum number of prefix accept from this peer\n"
5490 "maximum no. of prefix limit\n"
5491 "Only give warning message when limit is exceeded\n")
5493 return peer_maximum_prefix_set_vty (vty
, argv
[0], bgp_node_afi (vty
),
5494 bgp_node_safi (vty
), argv
[1], NULL
, 1,
5498 DEFUN (neighbor_maximum_prefix_threshold_warning
,
5499 neighbor_maximum_prefix_threshold_warning_cmd
,
5500 NEIGHBOR_CMD2
"maximum-prefix <1-4294967295> <1-100> warning-only",
5503 "Maximum number of prefix accept from this peer\n"
5504 "maximum no. of prefix limit\n"
5505 "Threshold value (%) at which to generate a warning msg\n"
5506 "Only give warning message when limit is exceeded\n")
5508 return peer_maximum_prefix_set_vty (vty
, argv
[0], bgp_node_afi (vty
),
5509 bgp_node_safi (vty
), argv
[1], argv
[2], 1, NULL
);
5512 DEFUN (neighbor_maximum_prefix_restart
,
5513 neighbor_maximum_prefix_restart_cmd
,
5514 NEIGHBOR_CMD2
"maximum-prefix <1-4294967295> restart <1-65535>",
5517 "Maximum number of prefix accept from this peer\n"
5518 "maximum no. of prefix limit\n"
5519 "Restart bgp connection after limit is exceeded\n"
5520 "Restart interval in minutes")
5522 return peer_maximum_prefix_set_vty (vty
, argv
[0], bgp_node_afi (vty
),
5523 bgp_node_safi (vty
), argv
[1], NULL
, 0, argv
[2]);
5526 DEFUN (neighbor_maximum_prefix_threshold_restart
,
5527 neighbor_maximum_prefix_threshold_restart_cmd
,
5528 NEIGHBOR_CMD2
"maximum-prefix <1-4294967295> <1-100> restart <1-65535>",
5531 "Maximum number of prefix accept from this peer\n"
5532 "maximum no. of prefix limit\n"
5533 "Threshold value (%) at which to generate a warning msg\n"
5534 "Restart bgp connection after limit is exceeded\n"
5535 "Restart interval in minutes")
5537 return peer_maximum_prefix_set_vty (vty
, argv
[0], bgp_node_afi (vty
),
5538 bgp_node_safi (vty
), argv
[1], argv
[2], 0, argv
[3]);
5541 DEFUN (no_neighbor_maximum_prefix
,
5542 no_neighbor_maximum_prefix_cmd
,
5543 NO_NEIGHBOR_CMD2
"maximum-prefix",
5547 "Maximum number of prefix accept from this peer\n")
5549 return peer_maximum_prefix_unset_vty (vty
, argv
[0], bgp_node_afi (vty
),
5550 bgp_node_safi (vty
));
5553 ALIAS (no_neighbor_maximum_prefix
,
5554 no_neighbor_maximum_prefix_val_cmd
,
5555 NO_NEIGHBOR_CMD2
"maximum-prefix <1-4294967295>",
5559 "Maximum number of prefix accept from this peer\n"
5560 "maximum no. of prefix limit\n")
5562 ALIAS (no_neighbor_maximum_prefix
,
5563 no_neighbor_maximum_prefix_threshold_cmd
,
5564 NO_NEIGHBOR_CMD2
"maximum-prefix <1-4294967295> <1-100>",
5568 "Maximum number of prefix accept from this peer\n"
5569 "maximum no. of prefix limit\n"
5570 "Threshold value (%) at which to generate a warning msg\n")
5572 ALIAS (no_neighbor_maximum_prefix
,
5573 no_neighbor_maximum_prefix_warning_cmd
,
5574 NO_NEIGHBOR_CMD2
"maximum-prefix <1-4294967295> warning-only",
5578 "Maximum number of prefix accept from this peer\n"
5579 "maximum no. of prefix limit\n"
5580 "Only give warning message when limit is exceeded\n")
5582 ALIAS (no_neighbor_maximum_prefix
,
5583 no_neighbor_maximum_prefix_threshold_warning_cmd
,
5584 NO_NEIGHBOR_CMD2
"maximum-prefix <1-4294967295> <1-100> warning-only",
5588 "Maximum number of prefix accept from this peer\n"
5589 "maximum no. of prefix limit\n"
5590 "Threshold value (%) at which to generate a warning msg\n"
5591 "Only give warning message when limit is exceeded\n")
5593 ALIAS (no_neighbor_maximum_prefix
,
5594 no_neighbor_maximum_prefix_restart_cmd
,
5595 NO_NEIGHBOR_CMD2
"maximum-prefix <1-4294967295> restart <1-65535>",
5599 "Maximum number of prefix accept from this peer\n"
5600 "maximum no. of prefix limit\n"
5601 "Restart bgp connection after limit is exceeded\n"
5602 "Restart interval in minutes")
5604 ALIAS (no_neighbor_maximum_prefix
,
5605 no_neighbor_maximum_prefix_threshold_restart_cmd
,
5606 NO_NEIGHBOR_CMD2
"maximum-prefix <1-4294967295> <1-100> restart <1-65535>",
5610 "Maximum number of prefix accept from this peer\n"
5611 "maximum no. of prefix limit\n"
5612 "Threshold value (%) at which to generate a warning msg\n"
5613 "Restart bgp connection after limit is exceeded\n"
5614 "Restart interval in minutes")
5616 /* "neighbor allowas-in" */
5617 DEFUN (neighbor_allowas_in
,
5618 neighbor_allowas_in_cmd
,
5619 NEIGHBOR_CMD2
"allowas-in",
5622 "Accept as-path with my AS present in it\n")
5626 unsigned int allow_num
;
5628 peer
= peer_and_group_lookup_vty (vty
, argv
[0]);
5635 VTY_GET_INTEGER_RANGE ("AS number", allow_num
, argv
[1], 1, 10);
5637 ret
= peer_allowas_in_set (peer
, bgp_node_afi (vty
), bgp_node_safi (vty
),
5640 return bgp_vty_return (vty
, ret
);
5643 ALIAS (neighbor_allowas_in
,
5644 neighbor_allowas_in_arg_cmd
,
5645 NEIGHBOR_CMD2
"allowas-in <1-10>",
5648 "Accept as-path with my AS present in it\n"
5649 "Number of occurances of AS number\n")
5651 DEFUN (no_neighbor_allowas_in
,
5652 no_neighbor_allowas_in_cmd
,
5653 NO_NEIGHBOR_CMD2
"allowas-in",
5657 "allow local ASN appears in aspath attribute\n")
5662 peer
= peer_and_group_lookup_vty (vty
, argv
[0]);
5666 ret
= peer_allowas_in_unset (peer
, bgp_node_afi (vty
), bgp_node_safi (vty
));
5668 return bgp_vty_return (vty
, ret
);
5671 ALIAS (no_neighbor_allowas_in
,
5672 no_neighbor_allowas_in_val_cmd
,
5673 NO_NEIGHBOR_CMD2
"allowas-in <1-10>",
5677 "allow local ASN appears in aspath attribute\n"
5678 "Number of occurances of AS number\n")
5680 DEFUN (neighbor_ttl_security
,
5681 neighbor_ttl_security_cmd
,
5682 NEIGHBOR_CMD2
"ttl-security hops <1-254>",
5685 "Specify the maximum number of hops to the BGP peer\n")
5690 peer
= peer_and_group_lookup_vty (vty
, argv
[0]);
5694 VTY_GET_INTEGER_RANGE ("", gtsm_hops
, argv
[1], 1, 254);
5696 return bgp_vty_return (vty
, peer_ttl_security_hops_set (peer
, gtsm_hops
));
5699 DEFUN (no_neighbor_ttl_security
,
5700 no_neighbor_ttl_security_cmd
,
5701 NO_NEIGHBOR_CMD2
"ttl-security hops <1-254>",
5705 "Specify the maximum number of hops to the BGP peer\n")
5709 peer
= peer_and_group_lookup_vty (vty
, argv
[0]);
5713 return bgp_vty_return (vty
, peer_ttl_security_hops_unset (peer
));
5716 DEFUN (neighbor_addpath_tx_all_paths
,
5717 neighbor_addpath_tx_all_paths_cmd
,
5718 NEIGHBOR_CMD2
"addpath-tx-all-paths",
5721 "Use addpath to advertise all paths to a neighbor\n")
5725 peer
= peer_and_group_lookup_vty (vty
, argv
[0]);
5729 return peer_af_flag_set_vty (vty
, argv
[0], bgp_node_afi (vty
),
5730 bgp_node_safi (vty
),
5731 PEER_FLAG_ADDPATH_TX_ALL_PATHS
);
5734 DEFUN (no_neighbor_addpath_tx_all_paths
,
5735 no_neighbor_addpath_tx_all_paths_cmd
,
5736 NO_NEIGHBOR_CMD2
"addpath-tx-all-paths",
5740 "Use addpath to advertise all paths to a neighbor\n")
5742 return peer_af_flag_unset_vty (vty
, argv
[0], bgp_node_afi (vty
),
5743 bgp_node_safi (vty
),
5744 PEER_FLAG_ADDPATH_TX_ALL_PATHS
);
5747 DEFUN (neighbor_addpath_tx_bestpath_per_as
,
5748 neighbor_addpath_tx_bestpath_per_as_cmd
,
5749 NEIGHBOR_CMD2
"addpath-tx-bestpath-per-AS",
5752 "Use addpath to advertise the bestpath per each neighboring AS\n")
5756 peer
= peer_and_group_lookup_vty (vty
, argv
[0]);
5760 return peer_af_flag_set_vty (vty
, argv
[0], bgp_node_afi (vty
),
5761 bgp_node_safi (vty
),
5762 PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS
);
5765 DEFUN (no_neighbor_addpath_tx_bestpath_per_as
,
5766 no_neighbor_addpath_tx_bestpath_per_as_cmd
,
5767 NO_NEIGHBOR_CMD2
"addpath-tx-bestpath-per-AS",
5771 "Use addpath to advertise the bestpath per each neighboring AS\n")
5773 return peer_af_flag_unset_vty (vty
, argv
[0], bgp_node_afi (vty
),
5774 bgp_node_safi (vty
),
5775 PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS
);
5779 /* Address family configuration. */
5780 DEFUN (address_family_ipv4
,
5781 address_family_ipv4_cmd
,
5782 "address-family ipv4",
5783 "Enter Address Family command mode\n"
5786 vty
->node
= BGP_IPV4_NODE
;
5790 DEFUN (address_family_ipv4_safi
,
5791 address_family_ipv4_safi_cmd
,
5792 "address-family ipv4 (unicast|multicast)",
5793 "Enter Address Family command mode\n"
5795 "Address Family modifier\n"
5796 "Address Family modifier\n")
5798 if (strncmp (argv
[0], "m", 1) == 0)
5799 vty
->node
= BGP_IPV4M_NODE
;
5801 vty
->node
= BGP_IPV4_NODE
;
5806 DEFUN (address_family_ipv6
,
5807 address_family_ipv6_cmd
,
5808 "address-family ipv6",
5809 "Enter Address Family command mode\n"
5812 vty
->node
= BGP_IPV6_NODE
;
5816 DEFUN (address_family_ipv6_safi
,
5817 address_family_ipv6_safi_cmd
,
5818 "address-family ipv6 (unicast|multicast)",
5819 "Enter Address Family command mode\n"
5821 "Address Family modifier\n"
5822 "Address Family modifier\n")
5824 if (strncmp (argv
[0], "m", 1) == 0)
5825 vty
->node
= BGP_IPV6M_NODE
;
5827 vty
->node
= BGP_IPV6_NODE
;
5832 DEFUN (address_family_vpnv4
,
5833 address_family_vpnv4_cmd
,
5834 "address-family vpnv4",
5835 "Enter Address Family command mode\n"
5838 vty
->node
= BGP_VPNV4_NODE
;
5842 ALIAS (address_family_vpnv4
,
5843 address_family_vpnv4_unicast_cmd
,
5844 "address-family vpnv4 unicast",
5845 "Enter Address Family command mode\n"
5847 "Address Family Modifier\n")
5849 DEFUN (exit_address_family
,
5850 exit_address_family_cmd
,
5851 "exit-address-family",
5852 "Exit from Address Family configuration mode\n")
5854 if (vty
->node
== BGP_IPV4_NODE
5855 || vty
->node
== BGP_IPV4M_NODE
5856 || vty
->node
== BGP_VPNV4_NODE
5857 || vty
->node
== BGP_IPV6_NODE
5858 || vty
->node
== BGP_IPV6M_NODE
)
5859 vty
->node
= BGP_NODE
;
5863 /* Recalculate bestpath and re-advertise a prefix */
5865 bgp_clear_prefix (struct vty
*vty
, char *view_name
, const char *ip_str
,
5866 afi_t afi
, safi_t safi
, struct prefix_rd
*prd
)
5869 struct prefix match
;
5870 struct bgp_node
*rn
;
5871 struct bgp_node
*rm
;
5873 struct bgp_table
*table
;
5874 struct bgp_table
*rib
;
5876 /* BGP structure lookup. */
5879 bgp
= bgp_lookup_by_name (view_name
);
5882 vty_out (vty
, "%% Can't find BGP instance %s%s", view_name
, VTY_NEWLINE
);
5888 bgp
= bgp_get_default ();
5891 vty_out (vty
, "%% No BGP process is configured%s", VTY_NEWLINE
);
5896 /* Check IP address argument. */
5897 ret
= str2prefix (ip_str
, &match
);
5900 vty_out (vty
, "%% address is malformed%s", VTY_NEWLINE
);
5904 match
.family
= afi2family (afi
);
5905 rib
= bgp
->rib
[afi
][safi
];
5907 if (safi
== SAFI_MPLS_VPN
)
5909 for (rn
= bgp_table_top (rib
); rn
; rn
= bgp_route_next (rn
))
5911 if (prd
&& memcmp (rn
->p
.u
.val
, prd
->val
, 8) != 0)
5914 if ((table
= rn
->info
) != NULL
)
5916 if ((rm
= bgp_node_match (table
, &match
)) != NULL
)
5918 if (rm
->p
.prefixlen
== match
.prefixlen
)
5920 SET_FLAG (rn
->flags
, BGP_NODE_USER_CLEAR
);
5921 bgp_process (bgp
, rm
, afi
, safi
);
5923 bgp_unlock_node (rm
);
5930 if ((rn
= bgp_node_match (rib
, &match
)) != NULL
)
5932 if (rn
->p
.prefixlen
== match
.prefixlen
)
5934 SET_FLAG (rn
->flags
, BGP_NODE_USER_CLEAR
);
5935 bgp_process (bgp
, rn
, afi
, safi
);
5937 bgp_unlock_node (rn
);
5944 DEFUN (clear_ip_bgp_all
,
5945 clear_ip_bgp_all_cmd
,
5950 "Clear all peers\n")
5953 return bgp_clear_vty (vty
, argv
[1], 0, 0, clear_all
, BGP_CLEAR_SOFT_NONE
, NULL
);
5955 return bgp_clear_vty (vty
, NULL
, 0, 0, clear_all
, BGP_CLEAR_SOFT_NONE
, NULL
);
5958 ALIAS (clear_ip_bgp_all
,
5963 "Clear all peers\n")
5965 ALIAS (clear_ip_bgp_all
,
5966 clear_bgp_ipv6_all_cmd
,
5971 "Clear all peers\n")
5973 ALIAS (clear_ip_bgp_all
,
5974 clear_ip_bgp_instance_all_cmd
,
5975 "clear ip bgp " BGP_INSTANCE_CMD
" *",
5979 BGP_INSTANCE_HELP_STR
5980 "Clear all peers\n")
5982 ALIAS (clear_ip_bgp_all
,
5983 clear_bgp_instance_all_cmd
,
5984 "clear bgp " BGP_INSTANCE_CMD
" *",
5987 BGP_INSTANCE_HELP_STR
5988 "Clear all peers\n")
5990 DEFUN (clear_ip_bgp_peer
,
5991 clear_ip_bgp_peer_cmd
,
5992 "clear ip bgp (A.B.C.D|X:X::X:X|WORD)",
5996 "BGP neighbor IP address to clear\n"
5997 "BGP IPv6 neighbor to clear\n"
5998 "BGP neighbor on interface to clear\n")
6000 return bgp_clear_vty (vty
, NULL
, 0, 0, clear_peer
, BGP_CLEAR_SOFT_NONE
, argv
[0]);
6003 ALIAS (clear_ip_bgp_peer
,
6005 "clear bgp (A.B.C.D|X:X::X:X|WORD)",
6008 "BGP neighbor address to clear\n"
6009 "BGP IPv6 neighbor to clear\n"
6010 "BGP neighbor on interface to clear\n")
6012 ALIAS (clear_ip_bgp_peer
,
6013 clear_bgp_ipv6_peer_cmd
,
6014 "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD)",
6018 "BGP neighbor address to clear\n"
6019 "BGP IPv6 neighbor to clear\n"
6020 "BGP neighbor on interface to clear\n")
6022 DEFUN (clear_ip_bgp_peer_group
,
6023 clear_ip_bgp_peer_group_cmd
,
6024 "clear ip bgp peer-group WORD",
6028 "Clear all members of peer-group\n"
6029 "BGP peer-group name\n")
6031 return bgp_clear_vty (vty
, NULL
, 0, 0, clear_group
, BGP_CLEAR_SOFT_NONE
, argv
[0]);
6034 ALIAS (clear_ip_bgp_peer_group
,
6035 clear_bgp_peer_group_cmd
,
6036 "clear bgp peer-group WORD",
6039 "Clear all members of peer-group\n"
6040 "BGP peer-group name\n")
6042 ALIAS (clear_ip_bgp_peer_group
,
6043 clear_bgp_ipv6_peer_group_cmd
,
6044 "clear bgp ipv6 peer-group WORD",
6048 "Clear all members of peer-group\n"
6049 "BGP peer-group name\n")
6051 DEFUN (clear_ip_bgp_external
,
6052 clear_ip_bgp_external_cmd
,
6053 "clear ip bgp external",
6057 "Clear all external peers\n")
6059 return bgp_clear_vty (vty
, NULL
, 0, 0, clear_external
, BGP_CLEAR_SOFT_NONE
, NULL
);
6062 ALIAS (clear_ip_bgp_external
,
6063 clear_bgp_external_cmd
,
6064 "clear bgp external",
6067 "Clear all external peers\n")
6069 ALIAS (clear_ip_bgp_external
,
6070 clear_bgp_ipv6_external_cmd
,
6071 "clear bgp ipv6 external",
6075 "Clear all external peers\n")
6077 DEFUN (clear_ip_bgp_prefix
,
6078 clear_ip_bgp_prefix_cmd
,
6079 "clear ip bgp prefix A.B.C.D/M",
6083 "Clear bestpath and re-advertise\n"
6084 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
6086 return bgp_clear_prefix (vty
, NULL
, argv
[0], AFI_IP
, SAFI_UNICAST
, NULL
);
6089 ALIAS (clear_ip_bgp_prefix
,
6090 clear_bgp_prefix_cmd
,
6091 "clear bgp prefix A.B.C.D/M",
6094 "Clear bestpath and re-advertise\n"
6095 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
6098 DEFUN (clear_ip_bgp_as
,
6099 clear_ip_bgp_as_cmd
,
6100 "clear ip bgp " CMD_AS_RANGE
,
6104 "Clear peers with the AS number\n")
6106 return bgp_clear_vty (vty
, NULL
, 0, 0, clear_as
, BGP_CLEAR_SOFT_NONE
, argv
[0]);
6109 ALIAS (clear_ip_bgp_as
,
6111 "clear bgp " CMD_AS_RANGE
,
6114 "Clear peers with the AS number\n")
6116 ALIAS (clear_ip_bgp_as
,
6117 clear_bgp_ipv6_as_cmd
,
6118 "clear bgp ipv6 " CMD_AS_RANGE
,
6122 "Clear peers with the AS number\n")
6124 /* Outbound soft-reconfiguration */
6125 DEFUN (clear_ip_bgp_all_soft_out
,
6126 clear_ip_bgp_all_soft_out_cmd
,
6127 "clear ip bgp * soft out",
6136 return bgp_clear_vty (vty
, argv
[1], AFI_IP
, SAFI_UNICAST
, clear_all
,
6137 BGP_CLEAR_SOFT_OUT
, NULL
);
6139 return bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, clear_all
,
6140 BGP_CLEAR_SOFT_OUT
, NULL
);
6143 ALIAS (clear_ip_bgp_all_soft_out
,
6144 clear_ip_bgp_all_out_cmd
,
6145 "clear ip bgp * out",
6152 ALIAS (clear_ip_bgp_all_soft_out
,
6153 clear_ip_bgp_instance_all_soft_out_cmd
,
6154 "clear ip bgp " BGP_INSTANCE_CMD
" * soft out",
6158 BGP_INSTANCE_HELP_STR
6163 DEFUN (clear_ip_bgp_all_ipv4_soft_out
,
6164 clear_ip_bgp_all_ipv4_soft_out_cmd
,
6165 "clear ip bgp * ipv4 (unicast|multicast) soft out",
6171 "Address Family modifier\n"
6172 "Address Family modifier\n"
6176 if (strncmp (argv
[0], "m", 1) == 0)
6177 return bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_MULTICAST
, clear_all
,
6178 BGP_CLEAR_SOFT_OUT
, NULL
);
6180 return bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, clear_all
,
6181 BGP_CLEAR_SOFT_OUT
, NULL
);
6184 ALIAS (clear_ip_bgp_all_ipv4_soft_out
,
6185 clear_ip_bgp_all_ipv4_out_cmd
,
6186 "clear ip bgp * ipv4 (unicast|multicast) out",
6192 "Address Family modifier\n"
6193 "Address Family modifier\n"
6196 DEFUN (clear_ip_bgp_instance_all_ipv4_soft_out
,
6197 clear_ip_bgp_instance_all_ipv4_soft_out_cmd
,
6198 "clear ip bgp " BGP_INSTANCE_CMD
" * ipv4 (unicast|multicast) soft out",
6202 BGP_INSTANCE_HELP_STR
6205 "Address Family modifier\n"
6206 "Address Family modifier\n"
6209 if (strncmp (argv
[2], "m", 1) == 0)
6210 return bgp_clear_vty (vty
, argv
[1], AFI_IP
, SAFI_MULTICAST
, clear_all
,
6211 BGP_CLEAR_SOFT_OUT
, NULL
);
6213 return bgp_clear_vty (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
, clear_all
,
6214 BGP_CLEAR_SOFT_OUT
, NULL
);
6217 DEFUN (clear_ip_bgp_all_vpnv4_soft_out
,
6218 clear_ip_bgp_all_vpnv4_soft_out_cmd
,
6219 "clear ip bgp * vpnv4 unicast soft out",
6225 "Address Family Modifier\n"
6229 return bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_MPLS_VPN
, clear_all
,
6230 BGP_CLEAR_SOFT_OUT
, NULL
);
6233 ALIAS (clear_ip_bgp_all_vpnv4_soft_out
,
6234 clear_ip_bgp_all_vpnv4_out_cmd
,
6235 "clear ip bgp * vpnv4 unicast out",
6241 "Address Family Modifier\n"
6244 DEFUN (clear_bgp_all_soft_out
,
6245 clear_bgp_all_soft_out_cmd
,
6246 "clear bgp * soft out",
6254 return bgp_clear_vty (vty
, argv
[1], AFI_IP6
, SAFI_UNICAST
, clear_all
,
6255 BGP_CLEAR_SOFT_OUT
, NULL
);
6257 return bgp_clear_vty (vty
, NULL
, AFI_IP6
, SAFI_UNICAST
, clear_all
,
6258 BGP_CLEAR_SOFT_OUT
, NULL
);
6261 ALIAS (clear_bgp_all_soft_out
,
6262 clear_bgp_instance_all_soft_out_cmd
,
6263 "clear bgp " BGP_INSTANCE_CMD
" * soft out",
6266 BGP_INSTANCE_HELP_STR
6271 ALIAS (clear_bgp_all_soft_out
,
6272 clear_bgp_all_out_cmd
,
6279 ALIAS (clear_bgp_all_soft_out
,
6280 clear_bgp_ipv6_all_soft_out_cmd
,
6281 "clear bgp ipv6 * soft out",
6289 ALIAS (clear_bgp_all_soft_out
,
6290 clear_bgp_ipv6_all_out_cmd
,
6291 "clear bgp ipv6 * out",
6298 DEFUN (clear_bgp_ipv6_safi_prefix
,
6299 clear_bgp_ipv6_safi_prefix_cmd
,
6300 "clear bgp ipv6 (unicast|multicast) prefix X:X::X:X/M",
6304 "Address Family Modifier\n"
6305 "Clear bestpath and re-advertise\n"
6306 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
6308 if (strncmp (argv
[0], "m", 1) == 0)
6309 return bgp_clear_prefix (vty
, NULL
, argv
[1], AFI_IP6
, SAFI_MULTICAST
, NULL
);
6311 return bgp_clear_prefix (vty
, NULL
, argv
[1], AFI_IP6
, SAFI_UNICAST
, NULL
);
6314 DEFUN (clear_ip_bgp_peer_soft_out
,
6315 clear_ip_bgp_peer_soft_out_cmd
,
6316 "clear ip bgp (A.B.C.D|WORD) soft out",
6320 "BGP neighbor address to clear\n"
6321 "BGP neighbor on interface to clear\n"
6325 return bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, clear_peer
,
6326 BGP_CLEAR_SOFT_OUT
, argv
[0]);
6329 ALIAS (clear_ip_bgp_peer_soft_out
,
6330 clear_ip_bgp_peer_out_cmd
,
6331 "clear ip bgp (A.B.C.D|WORD) out",
6335 "BGP neighbor address to clear\n"
6336 "BGP neighbor on interface to clear\n"
6339 DEFUN (clear_ip_bgp_peer_ipv4_soft_out
,
6340 clear_ip_bgp_peer_ipv4_soft_out_cmd
,
6341 "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) soft out",
6345 "BGP neighbor address to clear\n"
6346 "BGP neighbor on interface to clear\n"
6348 "Address Family modifier\n"
6349 "Address Family modifier\n"
6353 if (strncmp (argv
[1], "m", 1) == 0)
6354 return bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_MULTICAST
, clear_peer
,
6355 BGP_CLEAR_SOFT_OUT
, argv
[0]);
6357 return bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, clear_peer
,
6358 BGP_CLEAR_SOFT_OUT
, argv
[0]);
6361 ALIAS (clear_ip_bgp_peer_ipv4_soft_out
,
6362 clear_ip_bgp_peer_ipv4_out_cmd
,
6363 "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) out",
6367 "BGP neighbor address to clear\n"
6368 "BGP neighbor on interface to clear\n"
6370 "Address Family modifier\n"
6371 "Address Family modifier\n"
6374 /* NOTE: WORD peers have not been tested for vpnv4 */
6375 DEFUN (clear_ip_bgp_peer_vpnv4_soft_out
,
6376 clear_ip_bgp_peer_vpnv4_soft_out_cmd
,
6377 "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast soft out",
6381 "BGP neighbor address to clear\n"
6382 "BGP neighbor on interface to clear\n"
6384 "Address Family Modifier\n"
6388 return bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_MPLS_VPN
, clear_peer
,
6389 BGP_CLEAR_SOFT_OUT
, argv
[0]);
6392 ALIAS (clear_ip_bgp_peer_vpnv4_soft_out
,
6393 clear_ip_bgp_peer_vpnv4_out_cmd
,
6394 "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast out",
6398 "BGP neighbor address to clear\n"
6399 "BGP neighbor on interface to clear\n"
6401 "Address Family Modifier\n"
6404 DEFUN (clear_bgp_peer_soft_out
,
6405 clear_bgp_peer_soft_out_cmd
,
6406 "clear bgp (A.B.C.D|X:X::X:X|WORD) soft out",
6409 "BGP neighbor address to clear\n"
6410 "BGP IPv6 neighbor to clear\n"
6411 "BGP neighbor on interface to clear\n"
6415 return bgp_clear_vty (vty
, NULL
, AFI_IP6
, SAFI_UNICAST
, clear_peer
,
6416 BGP_CLEAR_SOFT_OUT
, argv
[0]);
6419 ALIAS (clear_bgp_peer_soft_out
,
6420 clear_bgp_ipv6_peer_soft_out_cmd
,
6421 "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) soft out",
6425 "BGP neighbor address to clear\n"
6426 "BGP IPv6 neighbor to clear\n"
6427 "BGP neighbor on interface to clear\n"
6431 ALIAS (clear_bgp_peer_soft_out
,
6432 clear_bgp_peer_out_cmd
,
6433 "clear bgp (A.B.C.D|X:X::X:X|WORD) out",
6436 "BGP neighbor address to clear\n"
6437 "BGP IPv6 neighbor to clear\n"
6438 "BGP neighbor on interface to clear\n"
6441 ALIAS (clear_bgp_peer_soft_out
,
6442 clear_bgp_ipv6_peer_out_cmd
,
6443 "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) out",
6447 "BGP neighbor address to clear\n"
6448 "BGP IPv6 neighbor to clear\n"
6449 "BGP neighbor on interface to clear\n"
6452 DEFUN (clear_ip_bgp_peer_group_soft_out
,
6453 clear_ip_bgp_peer_group_soft_out_cmd
,
6454 "clear ip bgp peer-group WORD soft out",
6458 "Clear all members of peer-group\n"
6459 "BGP peer-group name\n"
6463 return bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, clear_group
,
6464 BGP_CLEAR_SOFT_OUT
, argv
[0]);
6467 ALIAS (clear_ip_bgp_peer_group_soft_out
,
6468 clear_ip_bgp_peer_group_out_cmd
,
6469 "clear ip bgp peer-group WORD out",
6473 "Clear all members of peer-group\n"
6474 "BGP peer-group name\n"
6477 DEFUN (clear_ip_bgp_peer_group_ipv4_soft_out
,
6478 clear_ip_bgp_peer_group_ipv4_soft_out_cmd
,
6479 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft out",
6483 "Clear all members of peer-group\n"
6484 "BGP peer-group name\n"
6486 "Address Family modifier\n"
6487 "Address Family modifier\n"
6491 if (strncmp (argv
[1], "m", 1) == 0)
6492 return bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_MULTICAST
, clear_group
,
6493 BGP_CLEAR_SOFT_OUT
, argv
[0]);
6495 return bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, clear_group
,
6496 BGP_CLEAR_SOFT_OUT
, argv
[0]);
6499 ALIAS (clear_ip_bgp_peer_group_ipv4_soft_out
,
6500 clear_ip_bgp_peer_group_ipv4_out_cmd
,
6501 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) out",
6505 "Clear all members of peer-group\n"
6506 "BGP peer-group name\n"
6508 "Address Family modifier\n"
6509 "Address Family modifier\n"
6512 DEFUN (clear_bgp_peer_group_soft_out
,
6513 clear_bgp_peer_group_soft_out_cmd
,
6514 "clear bgp peer-group WORD soft out",
6517 "Clear all members of peer-group\n"
6518 "BGP peer-group name\n"
6522 return bgp_clear_vty (vty
, NULL
, AFI_IP6
, SAFI_UNICAST
, clear_group
,
6523 BGP_CLEAR_SOFT_OUT
, argv
[0]);
6526 ALIAS (clear_bgp_peer_group_soft_out
,
6527 clear_bgp_ipv6_peer_group_soft_out_cmd
,
6528 "clear bgp ipv6 peer-group WORD soft out",
6532 "Clear all members of peer-group\n"
6533 "BGP peer-group name\n"
6537 ALIAS (clear_bgp_peer_group_soft_out
,
6538 clear_bgp_peer_group_out_cmd
,
6539 "clear bgp peer-group WORD out",
6542 "Clear all members of peer-group\n"
6543 "BGP peer-group name\n"
6546 ALIAS (clear_bgp_peer_group_soft_out
,
6547 clear_bgp_ipv6_peer_group_out_cmd
,
6548 "clear bgp ipv6 peer-group WORD out",
6552 "Clear all members of peer-group\n"
6553 "BGP peer-group name\n"
6556 DEFUN (clear_ip_bgp_external_soft_out
,
6557 clear_ip_bgp_external_soft_out_cmd
,
6558 "clear ip bgp external soft out",
6562 "Clear all external peers\n"
6566 return bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, clear_external
,
6567 BGP_CLEAR_SOFT_OUT
, NULL
);
6570 ALIAS (clear_ip_bgp_external_soft_out
,
6571 clear_ip_bgp_external_out_cmd
,
6572 "clear ip bgp external out",
6576 "Clear all external peers\n"
6579 DEFUN (clear_ip_bgp_external_ipv4_soft_out
,
6580 clear_ip_bgp_external_ipv4_soft_out_cmd
,
6581 "clear ip bgp external ipv4 (unicast|multicast) soft out",
6585 "Clear all external peers\n"
6587 "Address Family modifier\n"
6588 "Address Family modifier\n"
6592 if (strncmp (argv
[0], "m", 1) == 0)
6593 return bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_MULTICAST
, clear_external
,
6594 BGP_CLEAR_SOFT_OUT
, NULL
);
6596 return bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, clear_external
,
6597 BGP_CLEAR_SOFT_OUT
, NULL
);
6600 ALIAS (clear_ip_bgp_external_ipv4_soft_out
,
6601 clear_ip_bgp_external_ipv4_out_cmd
,
6602 "clear ip bgp external ipv4 (unicast|multicast) out",
6606 "Clear all external peers\n"
6608 "Address Family modifier\n"
6609 "Address Family modifier\n"
6612 DEFUN (clear_bgp_external_soft_out
,
6613 clear_bgp_external_soft_out_cmd
,
6614 "clear bgp external soft out",
6617 "Clear all external peers\n"
6621 return bgp_clear_vty (vty
, NULL
, AFI_IP6
, SAFI_UNICAST
, clear_external
,
6622 BGP_CLEAR_SOFT_OUT
, NULL
);
6625 ALIAS (clear_bgp_external_soft_out
,
6626 clear_bgp_ipv6_external_soft_out_cmd
,
6627 "clear bgp ipv6 external soft out",
6631 "Clear all external peers\n"
6635 ALIAS (clear_bgp_external_soft_out
,
6636 clear_bgp_external_out_cmd
,
6637 "clear bgp external out",
6640 "Clear all external peers\n"
6643 ALIAS (clear_bgp_external_soft_out
,
6644 clear_bgp_ipv6_external_out_cmd
,
6645 "clear bgp ipv6 external WORD out",
6649 "Clear all external peers\n"
6652 DEFUN (clear_ip_bgp_as_soft_out
,
6653 clear_ip_bgp_as_soft_out_cmd
,
6654 "clear ip bgp " CMD_AS_RANGE
" soft out",
6658 "Clear peers with the AS number\n"
6662 return bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, clear_as
,
6663 BGP_CLEAR_SOFT_OUT
, argv
[0]);
6666 ALIAS (clear_ip_bgp_as_soft_out
,
6667 clear_ip_bgp_as_out_cmd
,
6668 "clear ip bgp " CMD_AS_RANGE
" out",
6672 "Clear peers with the AS number\n"
6675 DEFUN (clear_ip_bgp_as_ipv4_soft_out
,
6676 clear_ip_bgp_as_ipv4_soft_out_cmd
,
6677 "clear ip bgp " CMD_AS_RANGE
" ipv4 (unicast|multicast) soft out",
6681 "Clear peers with the AS number\n"
6683 "Address Family modifier\n"
6684 "Address Family modifier\n"
6688 if (strncmp (argv
[1], "m", 1) == 0)
6689 return bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_MULTICAST
, clear_as
,
6690 BGP_CLEAR_SOFT_OUT
, argv
[0]);
6692 return bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, clear_as
,
6693 BGP_CLEAR_SOFT_OUT
, argv
[0]);
6696 ALIAS (clear_ip_bgp_as_ipv4_soft_out
,
6697 clear_ip_bgp_as_ipv4_out_cmd
,
6698 "clear ip bgp " CMD_AS_RANGE
" ipv4 (unicast|multicast) out",
6702 "Clear peers with the AS number\n"
6704 "Address Family modifier\n"
6705 "Address Family modifier\n"
6708 DEFUN (clear_ip_bgp_as_vpnv4_soft_out
,
6709 clear_ip_bgp_as_vpnv4_soft_out_cmd
,
6710 "clear ip bgp " CMD_AS_RANGE
" vpnv4 unicast soft out",
6714 "Clear peers with the AS number\n"
6716 "Address Family modifier\n"
6720 return bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_MPLS_VPN
, clear_as
,
6721 BGP_CLEAR_SOFT_OUT
, argv
[0]);
6724 ALIAS (clear_ip_bgp_as_vpnv4_soft_out
,
6725 clear_ip_bgp_as_vpnv4_out_cmd
,
6726 "clear ip bgp " CMD_AS_RANGE
" vpnv4 unicast out",
6730 "Clear peers with the AS number\n"
6732 "Address Family modifier\n"
6735 DEFUN (clear_bgp_as_soft_out
,
6736 clear_bgp_as_soft_out_cmd
,
6737 "clear bgp " CMD_AS_RANGE
" soft out",
6740 "Clear peers with the AS number\n"
6744 return bgp_clear_vty (vty
, NULL
, AFI_IP6
, SAFI_UNICAST
, clear_as
,
6745 BGP_CLEAR_SOFT_OUT
, argv
[0]);
6748 ALIAS (clear_bgp_as_soft_out
,
6749 clear_bgp_ipv6_as_soft_out_cmd
,
6750 "clear bgp ipv6 " CMD_AS_RANGE
" soft out",
6754 "Clear peers with the AS number\n"
6758 ALIAS (clear_bgp_as_soft_out
,
6759 clear_bgp_as_out_cmd
,
6760 "clear bgp " CMD_AS_RANGE
" out",
6763 "Clear peers with the AS number\n"
6766 ALIAS (clear_bgp_as_soft_out
,
6767 clear_bgp_ipv6_as_out_cmd
,
6768 "clear bgp ipv6 " CMD_AS_RANGE
" out",
6772 "Clear peers with the AS number\n"
6775 /* Inbound soft-reconfiguration */
6776 DEFUN (clear_ip_bgp_all_soft_in
,
6777 clear_ip_bgp_all_soft_in_cmd
,
6778 "clear ip bgp * soft in",
6787 return bgp_clear_vty (vty
, argv
[1], AFI_IP
, SAFI_UNICAST
, clear_all
,
6788 BGP_CLEAR_SOFT_IN
, NULL
);
6790 return bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, clear_all
,
6791 BGP_CLEAR_SOFT_IN
, NULL
);
6794 ALIAS (clear_ip_bgp_all_soft_in
,
6795 clear_ip_bgp_instance_all_soft_in_cmd
,
6796 "clear ip bgp " BGP_INSTANCE_CMD
" * soft in",
6800 BGP_INSTANCE_HELP_STR
6805 ALIAS (clear_ip_bgp_all_soft_in
,
6806 clear_ip_bgp_all_in_cmd
,
6807 "clear ip bgp * in",
6814 DEFUN (clear_ip_bgp_all_in_prefix_filter
,
6815 clear_ip_bgp_all_in_prefix_filter_cmd
,
6816 "clear ip bgp * in prefix-filter",
6822 "Push out prefix-list ORF and do inbound soft reconfig\n")
6825 return bgp_clear_vty (vty
, argv
[1], AFI_IP
, SAFI_UNICAST
, clear_all
,
6826 BGP_CLEAR_SOFT_IN_ORF_PREFIX
, NULL
);
6828 return bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, clear_all
,
6829 BGP_CLEAR_SOFT_IN_ORF_PREFIX
, NULL
);
6832 ALIAS (clear_ip_bgp_all_in_prefix_filter
,
6833 clear_ip_bgp_instance_all_in_prefix_filter_cmd
,
6834 "clear ip bgp " BGP_INSTANCE_CMD
" * in prefix-filter",
6838 BGP_INSTANCE_HELP_STR
6841 "Push out prefix-list ORF and do inbound soft reconfig\n")
6844 DEFUN (clear_ip_bgp_all_ipv4_soft_in
,
6845 clear_ip_bgp_all_ipv4_soft_in_cmd
,
6846 "clear ip bgp * ipv4 (unicast|multicast) soft in",
6852 "Address Family modifier\n"
6853 "Address Family modifier\n"
6857 if (strncmp (argv
[0], "m", 1) == 0)
6858 return bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_MULTICAST
, clear_all
,
6859 BGP_CLEAR_SOFT_IN
, NULL
);
6861 return bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, clear_all
,
6862 BGP_CLEAR_SOFT_IN
, NULL
);
6865 ALIAS (clear_ip_bgp_all_ipv4_soft_in
,
6866 clear_ip_bgp_all_ipv4_in_cmd
,
6867 "clear ip bgp * ipv4 (unicast|multicast) in",
6873 "Address Family modifier\n"
6874 "Address Family modifier\n"
6877 DEFUN (clear_ip_bgp_instance_all_ipv4_soft_in
,
6878 clear_ip_bgp_instance_all_ipv4_soft_in_cmd
,
6879 "clear ip bgp " BGP_INSTANCE_CMD
" * ipv4 (unicast|multicast) soft in",
6883 BGP_INSTANCE_HELP_STR
6886 "Address Family modifier\n"
6887 "Address Family modifier\n"
6891 if (strncmp (argv
[2], "m", 1) == 0)
6892 return bgp_clear_vty (vty
, argv
[1], AFI_IP
, SAFI_MULTICAST
, clear_all
,
6893 BGP_CLEAR_SOFT_IN
, NULL
);
6895 return bgp_clear_vty (vty
, argv
[1], AFI_IP
, SAFI_UNICAST
, clear_all
,
6896 BGP_CLEAR_SOFT_IN
, NULL
);
6899 DEFUN (clear_ip_bgp_all_ipv4_in_prefix_filter
,
6900 clear_ip_bgp_all_ipv4_in_prefix_filter_cmd
,
6901 "clear ip bgp * ipv4 (unicast|multicast) in prefix-filter",
6907 "Address Family modifier\n"
6908 "Address Family modifier\n"
6910 "Push out prefix-list ORF and do inbound soft reconfig\n")
6912 if (strncmp (argv
[0], "m", 1) == 0)
6913 return bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_MULTICAST
, clear_all
,
6914 BGP_CLEAR_SOFT_IN_ORF_PREFIX
, NULL
);
6916 return bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, clear_all
,
6917 BGP_CLEAR_SOFT_IN_ORF_PREFIX
, NULL
);
6920 DEFUN (clear_ip_bgp_instance_all_ipv4_in_prefix_filter
,
6921 clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd
,
6922 "clear ip bgp " BGP_INSTANCE_CMD
" * ipv4 (unicast|multicast) in prefix-filter",
6928 "Address Family modifier\n"
6929 "Address Family modifier\n"
6931 "Push out prefix-list ORF and do inbound soft reconfig\n")
6933 if (strncmp (argv
[2], "m", 1) == 0)
6934 return bgp_clear_vty (vty
, argv
[1], AFI_IP
, SAFI_MULTICAST
, clear_all
,
6935 BGP_CLEAR_SOFT_IN_ORF_PREFIX
, NULL
);
6937 return bgp_clear_vty (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
, clear_all
,
6938 BGP_CLEAR_SOFT_IN_ORF_PREFIX
, NULL
);
6941 DEFUN (clear_ip_bgp_all_vpnv4_soft_in
,
6942 clear_ip_bgp_all_vpnv4_soft_in_cmd
,
6943 "clear ip bgp * vpnv4 unicast soft in",
6949 "Address Family Modifier\n"
6953 return bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_MPLS_VPN
, clear_all
,
6954 BGP_CLEAR_SOFT_IN
, NULL
);
6957 ALIAS (clear_ip_bgp_all_vpnv4_soft_in
,
6958 clear_ip_bgp_all_vpnv4_in_cmd
,
6959 "clear ip bgp * vpnv4 unicast in",
6965 "Address Family Modifier\n"
6968 DEFUN (clear_bgp_all_soft_in
,
6969 clear_bgp_all_soft_in_cmd
,
6970 "clear bgp * soft in",
6978 return bgp_clear_vty (vty
, argv
[1], AFI_IP6
, SAFI_UNICAST
, clear_all
,
6979 BGP_CLEAR_SOFT_IN
, NULL
);
6981 return bgp_clear_vty (vty
, NULL
, AFI_IP6
, SAFI_UNICAST
, clear_all
,
6982 BGP_CLEAR_SOFT_IN
, NULL
);
6985 ALIAS (clear_bgp_all_soft_in
,
6986 clear_bgp_instance_all_soft_in_cmd
,
6987 "clear bgp " BGP_INSTANCE_CMD
" * soft in",
6990 BGP_INSTANCE_HELP_STR
6995 ALIAS (clear_bgp_all_soft_in
,
6996 clear_bgp_ipv6_all_soft_in_cmd
,
6997 "clear bgp ipv6 * soft in",
7005 ALIAS (clear_bgp_all_soft_in
,
7006 clear_bgp_all_in_cmd
,
7013 ALIAS (clear_bgp_all_soft_in
,
7014 clear_bgp_ipv6_all_in_cmd
,
7015 "clear bgp ipv6 * in",
7022 DEFUN (clear_bgp_all_in_prefix_filter
,
7023 clear_bgp_all_in_prefix_filter_cmd
,
7024 "clear bgp * in prefix-filter",
7029 "Push out prefix-list ORF and do inbound soft reconfig\n")
7031 return bgp_clear_vty (vty
, NULL
, AFI_IP6
, SAFI_UNICAST
, clear_all
,
7032 BGP_CLEAR_SOFT_IN_ORF_PREFIX
, NULL
);
7035 ALIAS (clear_bgp_all_in_prefix_filter
,
7036 clear_bgp_ipv6_all_in_prefix_filter_cmd
,
7037 "clear bgp ipv6 * in prefix-filter",
7043 "Push out prefix-list ORF and do inbound soft reconfig\n")
7045 DEFUN (clear_ip_bgp_peer_soft_in
,
7046 clear_ip_bgp_peer_soft_in_cmd
,
7047 "clear ip bgp (A.B.C.D|WORD) soft in",
7051 "BGP neighbor address to clear\n"
7052 "BGP neighbor on interface to clear\n"
7056 return bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, clear_peer
,
7057 BGP_CLEAR_SOFT_IN
, argv
[0]);
7060 ALIAS (clear_ip_bgp_peer_soft_in
,
7061 clear_ip_bgp_peer_in_cmd
,
7062 "clear ip bgp (A.B.C.D|WORD) in",
7066 "BGP neighbor address to clear\n"
7067 "BGP neighbor on interface to clear\n"
7070 DEFUN (clear_ip_bgp_peer_in_prefix_filter
,
7071 clear_ip_bgp_peer_in_prefix_filter_cmd
,
7072 "clear ip bgp (A.B.C.D|WORD) in prefix-filter",
7076 "BGP neighbor address to clear\n"
7077 "BGP neighbor on interface to clear\n"
7079 "Push out the existing ORF prefix-list\n")
7081 return bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, clear_peer
,
7082 BGP_CLEAR_SOFT_IN_ORF_PREFIX
, argv
[0]);
7085 DEFUN (clear_ip_bgp_peer_ipv4_soft_in
,
7086 clear_ip_bgp_peer_ipv4_soft_in_cmd
,
7087 "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) soft in",
7091 "BGP neighbor address to clear\n"
7092 "BGP neighbor on interface to clear\n"
7094 "Address Family modifier\n"
7095 "Address Family modifier\n"
7099 if (strncmp (argv
[1], "m", 1) == 0)
7100 return bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_MULTICAST
, clear_peer
,
7101 BGP_CLEAR_SOFT_IN
, argv
[0]);
7103 return bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, clear_peer
,
7104 BGP_CLEAR_SOFT_IN
, argv
[0]);
7107 ALIAS (clear_ip_bgp_peer_ipv4_soft_in
,
7108 clear_ip_bgp_peer_ipv4_in_cmd
,
7109 "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) in",
7113 "BGP neighbor address to clear\n"
7114 "BGP neighbor on interface to clear\n"
7116 "Address Family modifier\n"
7117 "Address Family modifier\n"
7120 DEFUN (clear_ip_bgp_peer_ipv4_in_prefix_filter
,
7121 clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd
,
7122 "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) in prefix-filter",
7126 "BGP neighbor address to clear\n"
7127 "BGP neighbor on interface to clear\n"
7129 "Address Family modifier\n"
7130 "Address Family modifier\n"
7132 "Push out the existing ORF prefix-list\n")
7134 if (strncmp (argv
[1], "m", 1) == 0)
7135 return bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_MULTICAST
, clear_peer
,
7136 BGP_CLEAR_SOFT_IN_ORF_PREFIX
, argv
[0]);
7138 return bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, clear_peer
,
7139 BGP_CLEAR_SOFT_IN_ORF_PREFIX
, argv
[0]);
7142 DEFUN (clear_ip_bgp_peer_vpnv4_soft_in
,
7143 clear_ip_bgp_peer_vpnv4_soft_in_cmd
,
7144 "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast soft in",
7148 "BGP neighbor address to clear\n"
7149 "BGP neighbor on interface to clear\n"
7151 "Address Family Modifier\n"
7155 return bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_MPLS_VPN
, clear_peer
,
7156 BGP_CLEAR_SOFT_IN
, argv
[0]);
7159 ALIAS (clear_ip_bgp_peer_vpnv4_soft_in
,
7160 clear_ip_bgp_peer_vpnv4_in_cmd
,
7161 "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast in",
7165 "BGP neighbor address to clear\n"
7166 "BGP neighbor on interface to clear\n"
7168 "Address Family Modifier\n"
7171 DEFUN (clear_bgp_peer_soft_in
,
7172 clear_bgp_peer_soft_in_cmd
,
7173 "clear bgp (A.B.C.D|X:X::X:X|WORD) soft in",
7176 "BGP neighbor address to clear\n"
7177 "BGP IPv6 neighbor to clear\n"
7178 "BGP neighbor on interface to clear\n"
7182 return bgp_clear_vty (vty
, NULL
, AFI_IP6
, SAFI_UNICAST
, clear_peer
,
7183 BGP_CLEAR_SOFT_IN
, argv
[0]);
7186 ALIAS (clear_bgp_peer_soft_in
,
7187 clear_bgp_ipv6_peer_soft_in_cmd
,
7188 "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) soft in",
7192 "BGP neighbor address to clear\n"
7193 "BGP IPv6 neighbor to clear\n"
7194 "BGP neighbor on interface to clear\n"
7198 ALIAS (clear_bgp_peer_soft_in
,
7199 clear_bgp_peer_in_cmd
,
7200 "clear bgp (A.B.C.D|X:X::X:X|WORD) in",
7203 "BGP neighbor address to clear\n"
7204 "BGP IPv6 neighbor to clear\n"
7205 "BGP neighbor on interface to clear\n"
7208 ALIAS (clear_bgp_peer_soft_in
,
7209 clear_bgp_ipv6_peer_in_cmd
,
7210 "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) in",
7214 "BGP neighbor address to clear\n"
7215 "BGP IPv6 neighbor to clear\n"
7216 "BGP neighbor on interface to clear\n"
7219 DEFUN (clear_bgp_peer_in_prefix_filter
,
7220 clear_bgp_peer_in_prefix_filter_cmd
,
7221 "clear bgp (A.B.C.D|X:X::X:X|WORD) in prefix-filter",
7224 "BGP neighbor address to clear\n"
7225 "BGP IPv6 neighbor to clear\n"
7226 "BGP neighbor on interface to clear\n"
7228 "Push out the existing ORF prefix-list\n")
7230 return bgp_clear_vty (vty
, NULL
, AFI_IP6
, SAFI_UNICAST
, clear_peer
,
7231 BGP_CLEAR_SOFT_IN_ORF_PREFIX
, argv
[0]);
7234 ALIAS (clear_bgp_peer_in_prefix_filter
,
7235 clear_bgp_ipv6_peer_in_prefix_filter_cmd
,
7236 "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) in prefix-filter",
7240 "BGP neighbor address to clear\n"
7241 "BGP IPv6 neighbor to clear\n"
7242 "BGP neighbor on interface to clear\n"
7244 "Push out the existing ORF prefix-list\n")
7246 DEFUN (clear_ip_bgp_peer_group_soft_in
,
7247 clear_ip_bgp_peer_group_soft_in_cmd
,
7248 "clear ip bgp peer-group WORD soft in",
7252 "Clear all members of peer-group\n"
7253 "BGP peer-group name\n"
7257 return bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, clear_group
,
7258 BGP_CLEAR_SOFT_IN
, argv
[0]);
7261 ALIAS (clear_ip_bgp_peer_group_soft_in
,
7262 clear_ip_bgp_peer_group_in_cmd
,
7263 "clear ip bgp peer-group WORD in",
7267 "Clear all members of peer-group\n"
7268 "BGP peer-group name\n"
7271 DEFUN (clear_ip_bgp_peer_group_in_prefix_filter
,
7272 clear_ip_bgp_peer_group_in_prefix_filter_cmd
,
7273 "clear ip bgp peer-group WORD in prefix-filter",
7277 "Clear all members of peer-group\n"
7278 "BGP peer-group name\n"
7280 "Push out prefix-list ORF and do inbound soft reconfig\n")
7282 return bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, clear_group
,
7283 BGP_CLEAR_SOFT_IN_ORF_PREFIX
, argv
[0]);
7286 DEFUN (clear_ip_bgp_peer_group_ipv4_soft_in
,
7287 clear_ip_bgp_peer_group_ipv4_soft_in_cmd
,
7288 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft in",
7292 "Clear all members of peer-group\n"
7293 "BGP peer-group name\n"
7295 "Address Family modifier\n"
7296 "Address Family modifier\n"
7300 if (strncmp (argv
[1], "m", 1) == 0)
7301 return bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_MULTICAST
, clear_group
,
7302 BGP_CLEAR_SOFT_IN
, argv
[0]);
7304 return bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, clear_group
,
7305 BGP_CLEAR_SOFT_IN
, argv
[0]);
7308 ALIAS (clear_ip_bgp_peer_group_ipv4_soft_in
,
7309 clear_ip_bgp_peer_group_ipv4_in_cmd
,
7310 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in",
7314 "Clear all members of peer-group\n"
7315 "BGP peer-group name\n"
7317 "Address Family modifier\n"
7318 "Address Family modifier\n"
7321 DEFUN (clear_ip_bgp_peer_group_ipv4_in_prefix_filter
,
7322 clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd
,
7323 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) in prefix-filter",
7327 "Clear all members of peer-group\n"
7328 "BGP peer-group name\n"
7330 "Address Family modifier\n"
7331 "Address Family modifier\n"
7333 "Push out prefix-list ORF and do inbound soft reconfig\n")
7335 if (strncmp (argv
[1], "m", 1) == 0)
7336 return bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_MULTICAST
, clear_group
,
7337 BGP_CLEAR_SOFT_IN_ORF_PREFIX
, argv
[0]);
7339 return bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, clear_group
,
7340 BGP_CLEAR_SOFT_IN_ORF_PREFIX
, argv
[0]);
7343 DEFUN (clear_bgp_peer_group_soft_in
,
7344 clear_bgp_peer_group_soft_in_cmd
,
7345 "clear bgp peer-group WORD soft in",
7348 "Clear all members of peer-group\n"
7349 "BGP peer-group name\n"
7353 return bgp_clear_vty (vty
, NULL
, AFI_IP6
, SAFI_UNICAST
, clear_group
,
7354 BGP_CLEAR_SOFT_IN
, argv
[0]);
7357 ALIAS (clear_bgp_peer_group_soft_in
,
7358 clear_bgp_ipv6_peer_group_soft_in_cmd
,
7359 "clear bgp ipv6 peer-group WORD soft in",
7363 "Clear all members of peer-group\n"
7364 "BGP peer-group name\n"
7368 ALIAS (clear_bgp_peer_group_soft_in
,
7369 clear_bgp_peer_group_in_cmd
,
7370 "clear bgp peer-group WORD in",
7373 "Clear all members of peer-group\n"
7374 "BGP peer-group name\n"
7377 ALIAS (clear_bgp_peer_group_soft_in
,
7378 clear_bgp_ipv6_peer_group_in_cmd
,
7379 "clear bgp ipv6 peer-group WORD in",
7383 "Clear all members of peer-group\n"
7384 "BGP peer-group name\n"
7387 DEFUN (clear_bgp_peer_group_in_prefix_filter
,
7388 clear_bgp_peer_group_in_prefix_filter_cmd
,
7389 "clear bgp peer-group WORD in prefix-filter",
7392 "Clear all members of peer-group\n"
7393 "BGP peer-group name\n"
7395 "Push out prefix-list ORF and do inbound soft reconfig\n")
7397 return bgp_clear_vty (vty
, NULL
, AFI_IP6
, SAFI_UNICAST
, clear_group
,
7398 BGP_CLEAR_SOFT_IN_ORF_PREFIX
, argv
[0]);
7401 ALIAS (clear_bgp_peer_group_in_prefix_filter
,
7402 clear_bgp_ipv6_peer_group_in_prefix_filter_cmd
,
7403 "clear bgp ipv6 peer-group WORD in prefix-filter",
7407 "Clear all members of peer-group\n"
7408 "BGP peer-group name\n"
7410 "Push out prefix-list ORF and do inbound soft reconfig\n")
7412 DEFUN (clear_ip_bgp_external_soft_in
,
7413 clear_ip_bgp_external_soft_in_cmd
,
7414 "clear ip bgp external soft in",
7418 "Clear all external peers\n"
7422 return bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, clear_external
,
7423 BGP_CLEAR_SOFT_IN
, NULL
);
7426 ALIAS (clear_ip_bgp_external_soft_in
,
7427 clear_ip_bgp_external_in_cmd
,
7428 "clear ip bgp external in",
7432 "Clear all external peers\n"
7435 DEFUN (clear_ip_bgp_external_in_prefix_filter
,
7436 clear_ip_bgp_external_in_prefix_filter_cmd
,
7437 "clear ip bgp external in prefix-filter",
7441 "Clear all external peers\n"
7443 "Push out prefix-list ORF and do inbound soft reconfig\n")
7445 return bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, clear_external
,
7446 BGP_CLEAR_SOFT_IN_ORF_PREFIX
, NULL
);
7449 DEFUN (clear_ip_bgp_external_ipv4_soft_in
,
7450 clear_ip_bgp_external_ipv4_soft_in_cmd
,
7451 "clear ip bgp external ipv4 (unicast|multicast) soft in",
7455 "Clear all external peers\n"
7457 "Address Family modifier\n"
7458 "Address Family modifier\n"
7462 if (strncmp (argv
[0], "m", 1) == 0)
7463 return bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_MULTICAST
, clear_external
,
7464 BGP_CLEAR_SOFT_IN
, NULL
);
7466 return bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, clear_external
,
7467 BGP_CLEAR_SOFT_IN
, NULL
);
7470 ALIAS (clear_ip_bgp_external_ipv4_soft_in
,
7471 clear_ip_bgp_external_ipv4_in_cmd
,
7472 "clear ip bgp external ipv4 (unicast|multicast) in",
7476 "Clear all external peers\n"
7478 "Address Family modifier\n"
7479 "Address Family modifier\n"
7482 DEFUN (clear_ip_bgp_external_ipv4_in_prefix_filter
,
7483 clear_ip_bgp_external_ipv4_in_prefix_filter_cmd
,
7484 "clear ip bgp external ipv4 (unicast|multicast) in prefix-filter",
7488 "Clear all external peers\n"
7490 "Address Family modifier\n"
7491 "Address Family modifier\n"
7493 "Push out prefix-list ORF and do inbound soft reconfig\n")
7495 if (strncmp (argv
[0], "m", 1) == 0)
7496 return bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_MULTICAST
, clear_external
,
7497 BGP_CLEAR_SOFT_IN_ORF_PREFIX
, NULL
);
7499 return bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, clear_external
,
7500 BGP_CLEAR_SOFT_IN_ORF_PREFIX
, NULL
);
7503 DEFUN (clear_bgp_external_soft_in
,
7504 clear_bgp_external_soft_in_cmd
,
7505 "clear bgp external soft in",
7508 "Clear all external peers\n"
7512 return bgp_clear_vty (vty
, NULL
, AFI_IP6
, SAFI_UNICAST
, clear_external
,
7513 BGP_CLEAR_SOFT_IN
, NULL
);
7516 ALIAS (clear_bgp_external_soft_in
,
7517 clear_bgp_ipv6_external_soft_in_cmd
,
7518 "clear bgp ipv6 external soft in",
7522 "Clear all external peers\n"
7526 ALIAS (clear_bgp_external_soft_in
,
7527 clear_bgp_external_in_cmd
,
7528 "clear bgp external in",
7531 "Clear all external peers\n"
7534 ALIAS (clear_bgp_external_soft_in
,
7535 clear_bgp_ipv6_external_in_cmd
,
7536 "clear bgp ipv6 external WORD in",
7540 "Clear all external peers\n"
7543 DEFUN (clear_bgp_external_in_prefix_filter
,
7544 clear_bgp_external_in_prefix_filter_cmd
,
7545 "clear bgp external in prefix-filter",
7548 "Clear all external peers\n"
7550 "Push out prefix-list ORF and do inbound soft reconfig\n")
7552 return bgp_clear_vty (vty
, NULL
, AFI_IP6
, SAFI_UNICAST
, clear_external
,
7553 BGP_CLEAR_SOFT_IN_ORF_PREFIX
, NULL
);
7556 ALIAS (clear_bgp_external_in_prefix_filter
,
7557 clear_bgp_ipv6_external_in_prefix_filter_cmd
,
7558 "clear bgp ipv6 external in prefix-filter",
7562 "Clear all external peers\n"
7564 "Push out prefix-list ORF and do inbound soft reconfig\n")
7566 DEFUN (clear_ip_bgp_as_soft_in
,
7567 clear_ip_bgp_as_soft_in_cmd
,
7568 "clear ip bgp " CMD_AS_RANGE
" soft in",
7572 "Clear peers with the AS number\n"
7576 return bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, clear_as
,
7577 BGP_CLEAR_SOFT_IN
, argv
[0]);
7580 ALIAS (clear_ip_bgp_as_soft_in
,
7581 clear_ip_bgp_as_in_cmd
,
7582 "clear ip bgp " CMD_AS_RANGE
" in",
7586 "Clear peers with the AS number\n"
7589 DEFUN (clear_ip_bgp_as_in_prefix_filter
,
7590 clear_ip_bgp_as_in_prefix_filter_cmd
,
7591 "clear ip bgp " CMD_AS_RANGE
" in prefix-filter",
7595 "Clear peers with the AS number\n"
7597 "Push out prefix-list ORF and do inbound soft reconfig\n")
7599 return bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, clear_as
,
7600 BGP_CLEAR_SOFT_IN_ORF_PREFIX
, argv
[0]);
7603 DEFUN (clear_ip_bgp_as_ipv4_soft_in
,
7604 clear_ip_bgp_as_ipv4_soft_in_cmd
,
7605 "clear ip bgp " CMD_AS_RANGE
" ipv4 (unicast|multicast) soft in",
7609 "Clear peers with the AS number\n"
7611 "Address Family modifier\n"
7612 "Address Family modifier\n"
7616 if (strncmp (argv
[1], "m", 1) == 0)
7617 return bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_MULTICAST
, clear_as
,
7618 BGP_CLEAR_SOFT_IN
, argv
[0]);
7620 return bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, clear_as
,
7621 BGP_CLEAR_SOFT_IN
, argv
[0]);
7624 ALIAS (clear_ip_bgp_as_ipv4_soft_in
,
7625 clear_ip_bgp_as_ipv4_in_cmd
,
7626 "clear ip bgp " CMD_AS_RANGE
" ipv4 (unicast|multicast) in",
7630 "Clear peers with the AS number\n"
7632 "Address Family modifier\n"
7633 "Address Family modifier\n"
7636 DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter
,
7637 clear_ip_bgp_as_ipv4_in_prefix_filter_cmd
,
7638 "clear ip bgp " CMD_AS_RANGE
" ipv4 (unicast|multicast) in prefix-filter",
7642 "Clear peers with the AS number\n"
7644 "Address Family modifier\n"
7645 "Address Family modifier\n"
7647 "Push out prefix-list ORF and do inbound soft reconfig\n")
7649 if (strncmp (argv
[1], "m", 1) == 0)
7650 return bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_MULTICAST
, clear_as
,
7651 BGP_CLEAR_SOFT_IN_ORF_PREFIX
, argv
[0]);
7653 return bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, clear_as
,
7654 BGP_CLEAR_SOFT_IN_ORF_PREFIX
, argv
[0]);
7657 DEFUN (clear_ip_bgp_as_vpnv4_soft_in
,
7658 clear_ip_bgp_as_vpnv4_soft_in_cmd
,
7659 "clear ip bgp " CMD_AS_RANGE
" vpnv4 unicast soft in",
7663 "Clear peers with the AS number\n"
7665 "Address Family modifier\n"
7669 return bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_MPLS_VPN
, clear_as
,
7670 BGP_CLEAR_SOFT_IN
, argv
[0]);
7673 ALIAS (clear_ip_bgp_as_vpnv4_soft_in
,
7674 clear_ip_bgp_as_vpnv4_in_cmd
,
7675 "clear ip bgp " CMD_AS_RANGE
" vpnv4 unicast in",
7679 "Clear peers with the AS number\n"
7681 "Address Family modifier\n"
7684 DEFUN (clear_bgp_as_soft_in
,
7685 clear_bgp_as_soft_in_cmd
,
7686 "clear bgp " CMD_AS_RANGE
" soft in",
7689 "Clear peers with the AS number\n"
7693 return bgp_clear_vty (vty
, NULL
, AFI_IP6
, SAFI_UNICAST
, clear_as
,
7694 BGP_CLEAR_SOFT_IN
, argv
[0]);
7697 ALIAS (clear_bgp_as_soft_in
,
7698 clear_bgp_ipv6_as_soft_in_cmd
,
7699 "clear bgp ipv6 " CMD_AS_RANGE
" soft in",
7703 "Clear peers with the AS number\n"
7707 ALIAS (clear_bgp_as_soft_in
,
7708 clear_bgp_as_in_cmd
,
7709 "clear bgp " CMD_AS_RANGE
" in",
7712 "Clear peers with the AS number\n"
7715 ALIAS (clear_bgp_as_soft_in
,
7716 clear_bgp_ipv6_as_in_cmd
,
7717 "clear bgp ipv6 " CMD_AS_RANGE
" in",
7721 "Clear peers with the AS number\n"
7724 DEFUN (clear_bgp_as_in_prefix_filter
,
7725 clear_bgp_as_in_prefix_filter_cmd
,
7726 "clear bgp " CMD_AS_RANGE
" in prefix-filter",
7729 "Clear peers with the AS number\n"
7731 "Push out prefix-list ORF and do inbound soft reconfig\n")
7733 return bgp_clear_vty (vty
, NULL
, AFI_IP6
, SAFI_UNICAST
, clear_as
,
7734 BGP_CLEAR_SOFT_IN_ORF_PREFIX
, argv
[0]);
7737 ALIAS (clear_bgp_as_in_prefix_filter
,
7738 clear_bgp_ipv6_as_in_prefix_filter_cmd
,
7739 "clear bgp ipv6 " CMD_AS_RANGE
" in prefix-filter",
7743 "Clear peers with the AS number\n"
7745 "Push out prefix-list ORF and do inbound soft reconfig\n")
7747 /* Both soft-reconfiguration */
7748 DEFUN (clear_ip_bgp_all_soft
,
7749 clear_ip_bgp_all_soft_cmd
,
7750 "clear ip bgp * soft",
7758 return bgp_clear_vty (vty
, argv
[1], AFI_IP
, SAFI_UNICAST
, clear_all
,
7759 BGP_CLEAR_SOFT_BOTH
, NULL
);
7761 return bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, clear_all
,
7762 BGP_CLEAR_SOFT_BOTH
, NULL
);
7765 ALIAS (clear_ip_bgp_all_soft
,
7766 clear_ip_bgp_instance_all_soft_cmd
,
7767 "clear ip bgp " BGP_INSTANCE_CMD
" * soft",
7771 BGP_INSTANCE_HELP_STR
7776 DEFUN (clear_ip_bgp_all_ipv4_soft
,
7777 clear_ip_bgp_all_ipv4_soft_cmd
,
7778 "clear ip bgp * ipv4 (unicast|multicast) soft",
7784 "Address Family Modifier\n"
7785 "Address Family Modifier\n"
7788 if (strncmp (argv
[0], "m", 1) == 0)
7789 return bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_MULTICAST
, clear_all
,
7790 BGP_CLEAR_SOFT_BOTH
, NULL
);
7792 return bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, clear_all
,
7793 BGP_CLEAR_SOFT_BOTH
, NULL
);
7796 DEFUN (clear_ip_bgp_instance_all_ipv4_soft
,
7797 clear_ip_bgp_instance_all_ipv4_soft_cmd
,
7798 "clear ip bgp " BGP_INSTANCE_CMD
" * ipv4 (unicast|multicast) soft",
7802 BGP_INSTANCE_HELP_STR
7805 "Address Family Modifier\n"
7806 "Address Family Modifier\n"
7809 if (strncmp (argv
[2], "m", 1) == 0)
7810 return bgp_clear_vty (vty
, argv
[1], AFI_IP
, SAFI_MULTICAST
, clear_all
,
7811 BGP_CLEAR_SOFT_BOTH
, NULL
);
7813 return bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, clear_all
,
7814 BGP_CLEAR_SOFT_BOTH
, NULL
);
7817 DEFUN (clear_ip_bgp_all_vpnv4_soft
,
7818 clear_ip_bgp_all_vpnv4_soft_cmd
,
7819 "clear ip bgp * vpnv4 unicast soft",
7825 "Address Family Modifier\n"
7828 return bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_MPLS_VPN
, clear_all
,
7829 BGP_CLEAR_SOFT_BOTH
, argv
[0]);
7832 DEFUN (clear_bgp_all_soft
,
7833 clear_bgp_all_soft_cmd
,
7841 return bgp_clear_vty (vty
, argv
[1], AFI_IP6
, SAFI_UNICAST
, clear_all
,
7842 BGP_CLEAR_SOFT_BOTH
, argv
[0]);
7844 return bgp_clear_vty (vty
, NULL
, AFI_IP6
, SAFI_UNICAST
, clear_all
,
7845 BGP_CLEAR_SOFT_BOTH
, argv
[0]);
7848 ALIAS (clear_bgp_all_soft
,
7849 clear_bgp_instance_all_soft_cmd
,
7850 "clear bgp " BGP_INSTANCE_CMD
" * soft",
7853 BGP_INSTANCE_HELP_STR
7857 ALIAS (clear_bgp_all_soft
,
7858 clear_bgp_ipv6_all_soft_cmd
,
7859 "clear bgp ipv6 * soft",
7866 DEFUN (clear_ip_bgp_peer_soft
,
7867 clear_ip_bgp_peer_soft_cmd
,
7868 "clear ip bgp (A.B.C.D|WORD) soft",
7872 "BGP neighbor address to clear\n"
7873 "BGP neighbor on interface to clear\n"
7876 return bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, clear_peer
,
7877 BGP_CLEAR_SOFT_BOTH
, argv
[0]);
7880 DEFUN (clear_ip_bgp_peer_ipv4_soft
,
7881 clear_ip_bgp_peer_ipv4_soft_cmd
,
7882 "clear ip bgp (A.B.C.D|WORD) ipv4 (unicast|multicast) soft",
7886 "BGP neighbor address to clear\n"
7887 "BGP neighbor on interface to clear\n"
7889 "Address Family Modifier\n"
7890 "Address Family Modifier\n"
7893 if (strncmp (argv
[1], "m", 1) == 0)
7894 return bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_MULTICAST
, clear_peer
,
7895 BGP_CLEAR_SOFT_BOTH
, argv
[0]);
7897 return bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, clear_peer
,
7898 BGP_CLEAR_SOFT_BOTH
, argv
[0]);
7901 DEFUN (clear_ip_bgp_peer_vpnv4_soft
,
7902 clear_ip_bgp_peer_vpnv4_soft_cmd
,
7903 "clear ip bgp (A.B.C.D|WORD) vpnv4 unicast soft",
7907 "BGP neighbor address to clear\n"
7908 "BGP neighbor on interface to clear\n"
7910 "Address Family Modifier\n"
7913 return bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_MPLS_VPN
, clear_peer
,
7914 BGP_CLEAR_SOFT_BOTH
, argv
[0]);
7917 DEFUN (clear_bgp_peer_soft
,
7918 clear_bgp_peer_soft_cmd
,
7919 "clear bgp (A.B.C.D|X:X::X:X|WORD) soft",
7922 "BGP neighbor address to clear\n"
7923 "BGP IPv6 neighbor to clear\n"
7924 "BGP neighbor on interface to clear\n"
7927 return bgp_clear_vty (vty
, NULL
, AFI_IP6
, SAFI_UNICAST
, clear_peer
,
7928 BGP_CLEAR_SOFT_BOTH
, argv
[0]);
7931 ALIAS (clear_bgp_peer_soft
,
7932 clear_bgp_ipv6_peer_soft_cmd
,
7933 "clear bgp ipv6 (A.B.C.D|X:X::X:X|WORD) soft",
7937 "BGP neighbor address to clear\n"
7938 "BGP IPv6 neighbor to clear\n"
7939 "BGP neighbor on interface to clear\n"
7942 DEFUN (clear_ip_bgp_peer_group_soft
,
7943 clear_ip_bgp_peer_group_soft_cmd
,
7944 "clear ip bgp peer-group WORD soft",
7948 "Clear all members of peer-group\n"
7949 "BGP peer-group name\n"
7952 return bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, clear_group
,
7953 BGP_CLEAR_SOFT_BOTH
, argv
[0]);
7956 DEFUN (clear_ip_bgp_peer_group_ipv4_soft
,
7957 clear_ip_bgp_peer_group_ipv4_soft_cmd
,
7958 "clear ip bgp peer-group WORD ipv4 (unicast|multicast) soft",
7962 "Clear all members of peer-group\n"
7963 "BGP peer-group name\n"
7965 "Address Family modifier\n"
7966 "Address Family modifier\n"
7969 if (strncmp (argv
[1], "m", 1) == 0)
7970 return bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_MULTICAST
, clear_group
,
7971 BGP_CLEAR_SOFT_BOTH
, argv
[0]);
7973 return bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, clear_group
,
7974 BGP_CLEAR_SOFT_BOTH
, argv
[0]);
7977 DEFUN (clear_bgp_peer_group_soft
,
7978 clear_bgp_peer_group_soft_cmd
,
7979 "clear bgp peer-group WORD soft",
7982 "Clear all members of peer-group\n"
7983 "BGP peer-group name\n"
7986 return bgp_clear_vty (vty
, NULL
, AFI_IP6
, SAFI_UNICAST
, clear_group
,
7987 BGP_CLEAR_SOFT_BOTH
, argv
[0]);
7990 ALIAS (clear_bgp_peer_group_soft
,
7991 clear_bgp_ipv6_peer_group_soft_cmd
,
7992 "clear bgp ipv6 peer-group WORD soft",
7996 "Clear all members of peer-group\n"
7997 "BGP peer-group name\n"
8000 DEFUN (clear_ip_bgp_external_soft
,
8001 clear_ip_bgp_external_soft_cmd
,
8002 "clear ip bgp external soft",
8006 "Clear all external peers\n"
8009 return bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, clear_external
,
8010 BGP_CLEAR_SOFT_BOTH
, NULL
);
8013 DEFUN (clear_ip_bgp_external_ipv4_soft
,
8014 clear_ip_bgp_external_ipv4_soft_cmd
,
8015 "clear ip bgp external ipv4 (unicast|multicast) soft",
8019 "Clear all external peers\n"
8021 "Address Family modifier\n"
8022 "Address Family modifier\n"
8025 if (strncmp (argv
[0], "m", 1) == 0)
8026 return bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_MULTICAST
, clear_external
,
8027 BGP_CLEAR_SOFT_BOTH
, NULL
);
8029 return bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, clear_external
,
8030 BGP_CLEAR_SOFT_BOTH
, NULL
);
8033 DEFUN (clear_bgp_external_soft
,
8034 clear_bgp_external_soft_cmd
,
8035 "clear bgp external soft",
8038 "Clear all external peers\n"
8041 return bgp_clear_vty (vty
, NULL
, AFI_IP6
, SAFI_UNICAST
, clear_external
,
8042 BGP_CLEAR_SOFT_BOTH
, NULL
);
8045 ALIAS (clear_bgp_external_soft
,
8046 clear_bgp_ipv6_external_soft_cmd
,
8047 "clear bgp ipv6 external soft",
8051 "Clear all external peers\n"
8054 DEFUN (clear_ip_bgp_as_soft
,
8055 clear_ip_bgp_as_soft_cmd
,
8056 "clear ip bgp " CMD_AS_RANGE
" soft",
8060 "Clear peers with the AS number\n"
8063 return bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, clear_as
,
8064 BGP_CLEAR_SOFT_BOTH
, argv
[0]);
8067 DEFUN (clear_ip_bgp_as_ipv4_soft
,
8068 clear_ip_bgp_as_ipv4_soft_cmd
,
8069 "clear ip bgp " CMD_AS_RANGE
" ipv4 (unicast|multicast) soft",
8073 "Clear peers with the AS number\n"
8075 "Address Family Modifier\n"
8076 "Address Family Modifier\n"
8079 if (strncmp (argv
[1], "m", 1) == 0)
8080 return bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_MULTICAST
, clear_as
,
8081 BGP_CLEAR_SOFT_BOTH
, argv
[0]);
8083 return bgp_clear_vty (vty
, NULL
,AFI_IP
, SAFI_UNICAST
, clear_as
,
8084 BGP_CLEAR_SOFT_BOTH
, argv
[0]);
8087 DEFUN (clear_ip_bgp_as_vpnv4_soft
,
8088 clear_ip_bgp_as_vpnv4_soft_cmd
,
8089 "clear ip bgp " CMD_AS_RANGE
" vpnv4 unicast soft",
8093 "Clear peers with the AS number\n"
8095 "Address Family Modifier\n"
8098 return bgp_clear_vty (vty
, NULL
, AFI_IP
, SAFI_MPLS_VPN
, clear_as
,
8099 BGP_CLEAR_SOFT_BOTH
, argv
[0]);
8102 DEFUN (clear_bgp_as_soft
,
8103 clear_bgp_as_soft_cmd
,
8104 "clear bgp " CMD_AS_RANGE
" soft",
8107 "Clear peers with the AS number\n"
8110 return bgp_clear_vty (vty
, NULL
, AFI_IP6
, SAFI_UNICAST
, clear_as
,
8111 BGP_CLEAR_SOFT_BOTH
, argv
[0]);
8114 ALIAS (clear_bgp_as_soft
,
8115 clear_bgp_ipv6_as_soft_cmd
,
8116 "clear bgp ipv6 " CMD_AS_RANGE
" soft",
8120 "Clear peers with the AS number\n"
8123 DEFUN (show_bgp_views
,
8128 "Show the defined BGP views\n")
8130 struct list
*inst
= bm
->bgp
;
8131 struct listnode
*node
;
8134 if (!bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE
))
8136 vty_out (vty
, "BGP Multiple Instance is not enabled%s", VTY_NEWLINE
);
8140 vty_out (vty
, "Defined BGP views:%s", VTY_NEWLINE
);
8141 for (ALL_LIST_ELEMENTS_RO(inst
, node
, bgp
))
8144 if (bgp
->inst_type
== BGP_INSTANCE_TYPE_VRF
)
8146 vty_out (vty
, "\t%s (AS%u)%s",
8147 bgp
->name
? bgp
->name
: "(null)",
8148 bgp
->as
, VTY_NEWLINE
);
8154 DEFUN (show_bgp_vrfs
,
8156 "show bgp vrfs {json}",
8160 "JavaScript Object Notation\n")
8162 struct list
*inst
= bm
->bgp
;
8163 struct listnode
*node
;
8165 u_char uj
= use_json(argc
, argv
);
8166 json_object
*json
= NULL
;
8167 json_object
*json_vrfs
= NULL
;
8169 static char header
[] = "Type Id RouterId #PeersCfg #PeersEstb Name";
8171 if (!bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE
))
8173 vty_out (vty
, "BGP Multiple Instance is not enabled%s", VTY_NEWLINE
);
8179 json
= json_object_new_object();
8180 json_vrfs
= json_object_new_object();
8183 for (ALL_LIST_ELEMENTS_RO(inst
, node
, bgp
))
8185 const char *name
, *type
;
8187 struct listnode
*node
, *nnode
;
8188 int peers_cfg
, peers_estb
;
8189 json_object
*json_vrf
= NULL
;
8192 if (bgp
->inst_type
== BGP_INSTANCE_TYPE_VIEW
)
8196 if (!uj
&& count
== 1)
8197 vty_out (vty
, "%s%s", header
, VTY_NEWLINE
);
8199 peers_cfg
= peers_estb
= 0;
8201 json_vrf
= json_object_new_object();
8204 for (ALL_LIST_ELEMENTS (bgp
->peer
, node
, nnode
, peer
))
8206 if (!CHECK_FLAG(peer
->flags
, PEER_FLAG_CONFIG_NODE
))
8209 if (peer
->status
== Established
)
8213 if (bgp
->inst_type
== BGP_INSTANCE_TYPE_DEFAULT
)
8226 json_object_string_add(json_vrf
, "type", type
);
8227 json_object_int_add(json_vrf
, "vrfId", bgp
->vrf_id
);
8228 json_object_string_add(json_vrf
, "routerId", inet_ntoa (bgp
->router_id
));
8229 json_object_int_add(json_vrf
, "numConfiguredPeers", peers_cfg
);
8230 json_object_int_add(json_vrf
, "numEstablishedPeers", peers_estb
);
8232 json_object_object_add(json_vrfs
, name
, json_vrf
);
8235 vty_out (vty
, "%4s %-5u %-16s %9u %10u %s%s",
8236 type
, bgp
->vrf_id
, inet_ntoa (bgp
->router_id
),
8237 peers_cfg
, peers_estb
, name
,
8243 json_object_object_add(json
, "vrfs", json_vrfs
);
8245 json_object_int_add(json
, "totalVrfs", count
);
8247 vty_out (vty
, "%s%s", json_object_to_json_string(json
), VTY_NEWLINE
);
8248 json_object_free(json
);
8253 vty_out (vty
, "%sTotal number of VRFs (including default): %d%s",
8254 VTY_NEWLINE
, count
, VTY_NEWLINE
);
8260 DEFUN (show_bgp_memory
,
8261 show_bgp_memory_cmd
,
8265 "Global BGP memory statistics\n")
8267 char memstrbuf
[MTYPE_MEMSTR_LEN
];
8268 unsigned long count
;
8270 /* RIB related usage stats */
8271 count
= mtype_stats_alloc (MTYPE_BGP_NODE
);
8272 vty_out (vty
, "%ld RIB nodes, using %s of memory%s", count
,
8273 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
8274 count
* sizeof (struct bgp_node
)),
8277 count
= mtype_stats_alloc (MTYPE_BGP_ROUTE
);
8278 vty_out (vty
, "%ld BGP routes, using %s of memory%s", count
,
8279 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
8280 count
* sizeof (struct bgp_info
)),
8282 if ((count
= mtype_stats_alloc (MTYPE_BGP_ROUTE_EXTRA
)))
8283 vty_out (vty
, "%ld BGP route ancillaries, using %s of memory%s", count
,
8284 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
8285 count
* sizeof (struct bgp_info_extra
)),
8288 if ((count
= mtype_stats_alloc (MTYPE_BGP_STATIC
)))
8289 vty_out (vty
, "%ld Static routes, using %s of memory%s", count
,
8290 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
8291 count
* sizeof (struct bgp_static
)),
8294 if ((count
= mtype_stats_alloc (MTYPE_BGP_PACKET
)))
8295 vty_out (vty
, "%ld Packets, using %s of memory%s", count
,
8296 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
8297 count
* sizeof (struct bpacket
)),
8301 if ((count
= mtype_stats_alloc (MTYPE_BGP_ADJ_IN
)))
8302 vty_out (vty
, "%ld Adj-In entries, using %s of memory%s", count
,
8303 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
8304 count
* sizeof (struct bgp_adj_in
)),
8306 if ((count
= mtype_stats_alloc (MTYPE_BGP_ADJ_OUT
)))
8307 vty_out (vty
, "%ld Adj-Out entries, using %s of memory%s", count
,
8308 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
8309 count
* sizeof (struct bgp_adj_out
)),
8312 if ((count
= mtype_stats_alloc (MTYPE_BGP_NEXTHOP_CACHE
)))
8313 vty_out (vty
, "%ld Nexthop cache entries, using %s of memory%s", count
,
8314 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
8315 count
* sizeof (struct bgp_nexthop_cache
)),
8318 if ((count
= mtype_stats_alloc (MTYPE_BGP_DAMP_INFO
)))
8319 vty_out (vty
, "%ld Dampening entries, using %s of memory%s", count
,
8320 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
8321 count
* sizeof (struct bgp_damp_info
)),
8325 count
= attr_count();
8326 vty_out (vty
, "%ld BGP attributes, using %s of memory%s", count
,
8327 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
8328 count
* sizeof(struct attr
)),
8330 if ((count
= mtype_stats_alloc (MTYPE_ATTR_EXTRA
)))
8331 vty_out (vty
, "%ld BGP extra attributes, using %s of memory%s", count
,
8332 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
8333 count
* sizeof(struct attr_extra
)),
8336 if ((count
= attr_unknown_count()))
8337 vty_out (vty
, "%ld unknown attributes%s", count
, VTY_NEWLINE
);
8339 /* AS_PATH attributes */
8340 count
= aspath_count ();
8341 vty_out (vty
, "%ld BGP AS-PATH entries, using %s of memory%s", count
,
8342 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
8343 count
* sizeof (struct aspath
)),
8346 count
= mtype_stats_alloc (MTYPE_AS_SEG
);
8347 vty_out (vty
, "%ld BGP AS-PATH segments, using %s of memory%s", count
,
8348 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
8349 count
* sizeof (struct assegment
)),
8352 /* Other attributes */
8353 if ((count
= community_count ()))
8354 vty_out (vty
, "%ld BGP community entries, using %s of memory%s", count
,
8355 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
8356 count
* sizeof (struct community
)),
8358 if ((count
= mtype_stats_alloc (MTYPE_ECOMMUNITY
)))
8359 vty_out (vty
, "%ld BGP community entries, using %s of memory%s", count
,
8360 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
8361 count
* sizeof (struct ecommunity
)),
8364 if ((count
= mtype_stats_alloc (MTYPE_CLUSTER
)))
8365 vty_out (vty
, "%ld Cluster lists, using %s of memory%s", count
,
8366 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
8367 count
* sizeof (struct cluster_list
)),
8370 /* Peer related usage */
8371 count
= mtype_stats_alloc (MTYPE_BGP_PEER
);
8372 vty_out (vty
, "%ld peers, using %s of memory%s", count
,
8373 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
8374 count
* sizeof (struct peer
)),
8377 if ((count
= mtype_stats_alloc (MTYPE_BGP_PEER_GROUP
)))
8378 vty_out (vty
, "%ld peer groups, using %s of memory%s", count
,
8379 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
8380 count
* sizeof (struct peer_group
)),
8384 if ((count
= mtype_stats_alloc (MTYPE_HASH
)))
8385 vty_out (vty
, "%ld hash tables, using %s of memory%s", count
,
8386 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
8387 count
* sizeof (struct hash
)),
8389 if ((count
= mtype_stats_alloc (MTYPE_HASH_BACKET
)))
8390 vty_out (vty
, "%ld hash buckets, using %s of memory%s", count
,
8391 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
8392 count
* sizeof (struct hash_backet
)),
8394 if ((count
= mtype_stats_alloc (MTYPE_BGP_REGEXP
)))
8395 vty_out (vty
, "%ld compiled regexes, using %s of memory%s", count
,
8396 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
8397 count
* sizeof (regex_t
)),
8402 /* Show BGP peer's summary information. */
8404 bgp_show_summary (struct vty
*vty
, struct bgp
*bgp
, int afi
, int safi
,
8408 struct listnode
*node
, *nnode
;
8409 unsigned int count
= 0, dn_count
= 0;
8410 char timebuf
[BGP_UPTIME_LEN
], dn_flag
[2];
8412 json_object
*json
= NULL
;
8413 json_object
*json_peer
= NULL
;
8414 json_object
*json_peers
= NULL
;
8416 /* Header string for each address family. */
8417 static char header
[] = "Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd";
8421 json
= json_object_new_object();
8422 json_peers
= json_object_new_object();
8425 for (ALL_LIST_ELEMENTS (bgp
->peer
, node
, nnode
, peer
))
8427 if (!CHECK_FLAG(peer
->flags
, PEER_FLAG_CONFIG_NODE
))
8430 if (peer
->afc
[afi
][safi
])
8435 char memstrbuf
[MTYPE_MEMSTR_LEN
];
8437 /* Usage summary and header */
8440 json_object_string_add(json
, "routerId", inet_ntoa (bgp
->router_id
));
8441 json_object_int_add(json
, "as", bgp
->as
);
8444 json_object_int_add(json
, "vrf-id", bgp
->vrf_id
);
8450 "BGP router identifier %s, local AS number %u",
8451 inet_ntoa (bgp
->router_id
), bgp
->as
);
8454 vty_out (vty
, " vrf-id %u", bgp
->vrf_id
);
8456 vty_out (vty
, "%s", VTY_NEWLINE
);
8459 if (bgp_update_delay_configured(bgp
))
8463 json_object_int_add(json
, "updateDelayLimit", bgp
->v_update_delay
);
8465 if (bgp
->v_update_delay
!= bgp
->v_establish_wait
)
8466 json_object_int_add(json
, "updateDelayEstablishWait", bgp
->v_establish_wait
);
8468 if (bgp_update_delay_active(bgp
))
8470 json_object_string_add(json
, "updateDelayFirstNeighbor", bgp
->update_delay_begin_time
);
8471 json_object_boolean_true_add(json
, "updateDelayInProgress");
8475 if (bgp
->update_delay_over
)
8477 json_object_string_add(json
, "updateDelayFirstNeighbor",
8478 bgp
->update_delay_begin_time
);
8479 json_object_string_add(json
, "updateDelayBestpathResumed",
8480 bgp
->update_delay_end_time
);
8481 json_object_string_add(json
, "updateDelayZebraUpdateResume",
8482 bgp
->update_delay_zebra_resume_time
);
8483 json_object_string_add(json
, "updateDelayPeerUpdateResume",
8484 bgp
->update_delay_peers_resume_time
);
8490 vty_out (vty
, "Read-only mode update-delay limit: %d seconds%s",
8491 bgp
->v_update_delay
, VTY_NEWLINE
);
8492 if (bgp
->v_update_delay
!= bgp
->v_establish_wait
)
8493 vty_out (vty
, " Establish wait: %d seconds%s",
8494 bgp
->v_establish_wait
, VTY_NEWLINE
);
8496 if (bgp_update_delay_active(bgp
))
8498 vty_out (vty
, " First neighbor established: %s%s",
8499 bgp
->update_delay_begin_time
, VTY_NEWLINE
);
8500 vty_out (vty
, " Delay in progress%s", VTY_NEWLINE
);
8504 if (bgp
->update_delay_over
)
8506 vty_out (vty
, " First neighbor established: %s%s",
8507 bgp
->update_delay_begin_time
, VTY_NEWLINE
);
8508 vty_out (vty
, " Best-paths resumed: %s%s",
8509 bgp
->update_delay_end_time
, VTY_NEWLINE
);
8510 vty_out (vty
, " zebra update resumed: %s%s",
8511 bgp
->update_delay_zebra_resume_time
, VTY_NEWLINE
);
8512 vty_out (vty
, " peers update resumed: %s%s",
8513 bgp
->update_delay_peers_resume_time
, VTY_NEWLINE
);
8521 if (bgp_maxmed_onstartup_configured(bgp
) && bgp
->maxmed_active
)
8522 json_object_boolean_true_add(json
, "maxMedOnStartup");
8523 if (bgp
->v_maxmed_admin
)
8524 json_object_boolean_true_add(json
, "maxMedAdministrative");
8526 json_object_int_add(json
, "tableVersion", bgp_table_version(bgp
->rib
[afi
][safi
]));
8528 ents
= bgp_table_count (bgp
->rib
[afi
][safi
]);
8529 json_object_int_add(json
, "ribCount", ents
);
8530 json_object_int_add(json
, "ribMemory", ents
* sizeof (struct bgp_node
));
8532 ents
= listcount (bgp
->peer
);
8533 json_object_int_add(json
, "peerCount", ents
);
8534 json_object_int_add(json
, "peerMemory", ents
* sizeof (struct peer
));
8536 if ((ents
= listcount (bgp
->group
)))
8538 json_object_int_add(json
, "peerGroupCount", ents
);
8539 json_object_int_add(json
, "peerGroupMemory", ents
* sizeof (struct peer_group
));
8542 if (CHECK_FLAG (bgp
->af_flags
[afi
][safi
], BGP_CONFIG_DAMPENING
))
8543 json_object_boolean_true_add(json
, "dampeningEnabled");
8547 if (bgp_maxmed_onstartup_configured(bgp
) && bgp
->maxmed_active
)
8548 vty_out (vty
, "Max-med on-startup active%s", VTY_NEWLINE
);
8549 if (bgp
->v_maxmed_admin
)
8550 vty_out (vty
, "Max-med administrative active%s", VTY_NEWLINE
);
8552 vty_out(vty
, "BGP table version %" PRIu64
"%s",
8553 bgp_table_version(bgp
->rib
[afi
][safi
]), VTY_NEWLINE
);
8555 ents
= bgp_table_count (bgp
->rib
[afi
][safi
]);
8556 vty_out (vty
, "RIB entries %ld, using %s of memory%s", ents
,
8557 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
8558 ents
* sizeof (struct bgp_node
)),
8561 /* Peer related usage */
8562 ents
= listcount (bgp
->peer
);
8563 vty_out (vty
, "Peers %ld, using %s of memory%s",
8565 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
8566 ents
* sizeof (struct peer
)),
8569 if ((ents
= listcount (bgp
->group
)))
8570 vty_out (vty
, "Peer groups %ld, using %s of memory%s", ents
,
8571 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
8572 ents
* sizeof (struct peer_group
)),
8575 if (CHECK_FLAG (bgp
->af_flags
[afi
][safi
], BGP_CONFIG_DAMPENING
))
8576 vty_out (vty
, "Dampening enabled.%s", VTY_NEWLINE
);
8577 vty_out (vty
, "%s", VTY_NEWLINE
);
8578 vty_out (vty
, "%s%s", header
, VTY_NEWLINE
);
8586 json_peer
= json_object_new_object();
8588 if (peer_dynamic_neighbor(peer
))
8589 json_object_boolean_true_add(json_peer
, "dynamicPeer");
8592 json_object_string_add(json_peer
, "hostname", peer
->hostname
);
8594 if (peer
->domainname
)
8595 json_object_string_add(json_peer
, "domainname", peer
->domainname
);
8597 json_object_int_add(json_peer
, "remoteAs", peer
->as
);
8598 json_object_int_add(json_peer
, "version", 4);
8599 json_object_int_add(json_peer
, "msgRcvd",
8600 peer
->open_in
+ peer
->update_in
+ peer
->keepalive_in
8601 + peer
->notify_in
+ peer
->refresh_in
8602 + peer
->dynamic_cap_in
);
8603 json_object_int_add(json_peer
, "msgSent",
8604 peer
->open_out
+ peer
->update_out
+ peer
->keepalive_out
8605 + peer
->notify_out
+ peer
->refresh_out
8606 + peer
->dynamic_cap_out
);
8608 json_object_int_add(json_peer
, "tableVersion", peer
->version
[afi
][safi
]);
8609 json_object_int_add(json_peer
, "outq", peer
->obuf
->count
);
8610 json_object_int_add(json_peer
, "inq", 0);
8611 peer_uptime (peer
->uptime
, timebuf
, BGP_UPTIME_LEN
, use_json
, json_peer
);
8612 json_object_int_add(json_peer
, "prefixReceivedCount", peer
->pcount
[afi
][safi
]);
8614 if (CHECK_FLAG (peer
->flags
, PEER_FLAG_SHUTDOWN
))
8615 json_object_string_add(json_peer
, "state", "Idle (Admin)");
8616 else if (CHECK_FLAG (peer
->sflags
, PEER_STATUS_PREFIX_OVERFLOW
))
8617 json_object_string_add(json_peer
, "state", "Idle (PfxCt)");
8619 json_object_string_add(json_peer
, "state", LOOKUP(bgp_status_msg
, peer
->status
));
8622 json_object_string_add(json_peer
, "idType", "interface");
8623 else if (peer
->su
.sa
.sa_family
== AF_INET
)
8624 json_object_string_add(json_peer
, "idType", "ipv4");
8625 else if (peer
->su
.sa
.sa_family
== AF_INET6
)
8626 json_object_string_add(json_peer
, "idType", "ipv6");
8628 json_object_object_add(json_peers
, peer
->host
, json_peer
);
8632 memset(dn_flag
, '\0', sizeof(dn_flag
));
8633 if (peer_dynamic_neighbor(peer
))
8639 if (peer
->hostname
&& bgp_flag_check(bgp
, BGP_FLAG_SHOW_HOSTNAME
))
8640 len
= vty_out (vty
, "%s%s(%s)", dn_flag
, peer
->hostname
,
8643 len
= vty_out (vty
, "%s%s", dn_flag
, peer
->host
);
8647 vty_out (vty
, "%s%*s", VTY_NEWLINE
, 16, " ");
8649 vty_out (vty
, "%*s", len
, " ");
8651 vty_out (vty
, "4 ");
8653 vty_out (vty
, "%5u %7d %7d %8" PRIu64
" %4d %4zd ",
8655 peer
->open_in
+ peer
->update_in
+ peer
->keepalive_in
8656 + peer
->notify_in
+ peer
->refresh_in
8657 + peer
->dynamic_cap_in
,
8658 peer
->open_out
+ peer
->update_out
+ peer
->keepalive_out
8659 + peer
->notify_out
+ peer
->refresh_out
8660 + peer
->dynamic_cap_out
,
8661 peer
->version
[afi
][safi
],
8665 vty_out (vty
, "%-8s",
8666 peer_uptime (peer
->uptime
, timebuf
, BGP_UPTIME_LEN
, 0, NULL
));
8668 if (peer
->status
== Established
)
8669 vty_out (vty
, " %8ld", peer
->pcount
[afi
][safi
]);
8672 if (CHECK_FLAG (peer
->flags
, PEER_FLAG_SHUTDOWN
))
8673 vty_out (vty
, " Idle (Admin)");
8674 else if (CHECK_FLAG (peer
->sflags
, PEER_STATUS_PREFIX_OVERFLOW
))
8675 vty_out (vty
, " Idle (PfxCt)");
8677 vty_out (vty
, " %-11s", LOOKUP(bgp_status_msg
, peer
->status
));
8679 vty_out (vty
, "%s", VTY_NEWLINE
);
8686 json_object_object_add(json
, "peers", json_peers
);
8688 json_object_int_add(json
, "totalPeers", count
);
8689 json_object_int_add(json
, "dynamicPeers", dn_count
);
8691 vty_out (vty
, "%s%s", json_object_to_json_string(json
), VTY_NEWLINE
);
8692 json_object_free(json
);
8697 vty_out (vty
, "%sTotal number of neighbors %d%s", VTY_NEWLINE
,
8698 count
, VTY_NEWLINE
);
8700 vty_out (vty
, "No %s neighbor is configured%s",
8701 afi
== AFI_IP
? "IPv4" : "IPv6", VTY_NEWLINE
);
8705 vty_out(vty
, "* - dynamic neighbor%s", VTY_NEWLINE
);
8707 "%d dynamic neighbor(s), limit %d%s",
8708 dn_count
, bgp
->dynamic_neighbors_limit
, VTY_NEWLINE
);
8716 bgp_show_summary_vty (struct vty
*vty
, const char *name
,
8717 afi_t afi
, safi_t safi
, u_char use_json
)
8723 bgp
= bgp_lookup_by_name (name
);
8727 vty_out (vty
, "%% No such BGP instance exist%s", VTY_NEWLINE
);
8731 bgp_show_summary (vty
, bgp
, afi
, safi
, use_json
);
8735 bgp
= bgp_get_default ();
8738 bgp_show_summary (vty
, bgp
, afi
, safi
, use_json
);
8743 /* `show ip bgp summary' commands. */
8744 DEFUN (show_ip_bgp_summary
,
8745 show_ip_bgp_summary_cmd
,
8746 "show ip bgp summary {json}",
8750 "Summary of BGP neighbor status\n"
8751 "JavaScript Object Notation\n")
8753 u_char uj
= use_json(argc
, argv
);
8754 return bgp_show_summary_vty (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, uj
);
8757 DEFUN (show_ip_bgp_instance_summary
,
8758 show_ip_bgp_instance_summary_cmd
,
8759 "show ip bgp " BGP_INSTANCE_CMD
" summary {json}",
8763 BGP_INSTANCE_HELP_STR
8764 "Summary of BGP neighbor status\n"
8765 "JavaScript Object Notation\n")
8767 u_char uj
= use_json(argc
, argv
);
8768 return bgp_show_summary_vty (vty
, argv
[1], AFI_IP
, SAFI_UNICAST
, uj
);
8771 DEFUN (show_ip_bgp_ipv4_summary
,
8772 show_ip_bgp_ipv4_summary_cmd
,
8773 "show ip bgp ipv4 (unicast|multicast) summary {json}",
8778 "Address Family modifier\n"
8779 "Address Family modifier\n"
8780 "Summary of BGP neighbor status\n"
8781 "JavaScript Object Notation\n")
8783 u_char uj
= use_json(argc
, argv
);
8784 if (strncmp (argv
[0], "m", 1) == 0)
8785 return bgp_show_summary_vty (vty
, NULL
, AFI_IP
, SAFI_MULTICAST
, uj
);
8787 return bgp_show_summary_vty (vty
, NULL
, AFI_IP
, SAFI_UNICAST
, uj
);
8790 ALIAS (show_ip_bgp_ipv4_summary
,
8791 show_bgp_ipv4_safi_summary_cmd
,
8792 "show bgp ipv4 (unicast|multicast) summary {json}",
8796 "Address Family modifier\n"
8797 "Address Family modifier\n"
8798 "Summary of BGP neighbor status\n")
8800 DEFUN (show_ip_bgp_instance_ipv4_summary
,
8801 show_ip_bgp_instance_ipv4_summary_cmd
,
8802 "show ip bgp view WORD ipv4 (unicast|multicast) summary {json}",
8809 "Address Family modifier\n"
8810 "Address Family modifier\n"
8811 "Summary of BGP neighbor status\n"
8812 "JavaScript Object Notation\n")
8814 u_char uj
= use_json(argc
, argv
);
8815 if (strncmp (argv
[1], "m", 1) == 0)
8816 return bgp_show_summary_vty (vty
, argv
[0], AFI_IP
, SAFI_MULTICAST
, uj
);
8818 return bgp_show_summary_vty (vty
, argv
[0], AFI_IP
, SAFI_UNICAST
, uj
);
8821 ALIAS (show_ip_bgp_instance_ipv4_summary
,
8822 show_bgp_instance_ipv4_safi_summary_cmd
,
8823 "show bgp view WORD ipv4 (unicast|multicast) summary {json}",
8829 "Address Family modifier\n"
8830 "Address Family modifier\n"
8831 "Summary of BGP neighbor status\n")
8833 DEFUN (show_ip_bgp_vpnv4_all_summary
,
8834 show_ip_bgp_vpnv4_all_summary_cmd
,
8835 "show ip bgp vpnv4 all summary {json}",
8839 "Display VPNv4 NLRI specific information\n"
8840 "Display information about all VPNv4 NLRIs\n"
8841 "Summary of BGP neighbor status\n"
8842 "JavaScript Object Notation\n")
8844 u_char uj
= use_json(argc
, argv
);
8845 return bgp_show_summary_vty (vty
, NULL
, AFI_IP
, SAFI_MPLS_VPN
, uj
);
8848 DEFUN (show_ip_bgp_vpnv4_rd_summary
,
8849 show_ip_bgp_vpnv4_rd_summary_cmd
,
8850 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn summary {json}",
8854 "Display VPNv4 NLRI specific information\n"
8855 "Display information for a route distinguisher\n"
8856 "VPN Route Distinguisher\n"
8857 "Summary of BGP neighbor status\n"
8858 "JavaScript Object Notation\n")
8861 struct prefix_rd prd
;
8862 u_char uj
= use_json(argc
, argv
);
8864 ret
= str2prefix_rd (argv
[0], &prd
);
8867 vty_out (vty
, "%% Malformed Route Distinguisher%s", VTY_NEWLINE
);
8871 return bgp_show_summary_vty (vty
, NULL
, AFI_IP
, SAFI_MPLS_VPN
, uj
);
8875 DEFUN (show_bgp_summary
,
8876 show_bgp_summary_cmd
,
8877 "show bgp summary {json}",
8880 "Summary of BGP neighbor status\n"
8881 "JavaScript Object Notation\n")
8883 return bgp_show_summary_vty (vty
, NULL
, AFI_IP6
, SAFI_UNICAST
, use_json(argc
, argv
));
8886 DEFUN (show_bgp_instance_summary
,
8887 show_bgp_instance_summary_cmd
,
8888 "show bgp " BGP_INSTANCE_CMD
" summary {json}",
8891 BGP_INSTANCE_HELP_STR
8892 "Summary of BGP neighbor status\n"
8893 "JavaScript Object Notation\n")
8895 return bgp_show_summary_vty (vty
, argv
[1], AFI_IP6
, SAFI_UNICAST
, use_json(argc
, argv
));
8898 ALIAS (show_bgp_summary
,
8899 show_bgp_ipv6_summary_cmd
,
8900 "show bgp ipv6 summary {json}",
8904 "Summary of BGP neighbor status\n")
8906 ALIAS (show_bgp_instance_summary
,
8907 show_bgp_instance_ipv6_summary_cmd
,
8908 "show bgp " BGP_INSTANCE_CMD
" ipv6 summary {json}",
8911 BGP_INSTANCE_HELP_STR
8913 "Summary of BGP neighbor status\n")
8915 DEFUN (show_bgp_ipv6_safi_summary
,
8916 show_bgp_ipv6_safi_summary_cmd
,
8917 "show bgp ipv6 (unicast|multicast) summary {json}",
8921 "Address Family modifier\n"
8922 "Address Family modifier\n"
8923 "Summary of BGP neighbor status\n"
8924 "JavaScript Object Notation\n")
8926 u_char uj
= use_json(argc
, argv
);
8927 if (strncmp (argv
[0], "m", 1) == 0)
8928 return bgp_show_summary_vty (vty
, NULL
, AFI_IP6
, SAFI_MULTICAST
, uj
);
8930 return bgp_show_summary_vty (vty
, NULL
, AFI_IP6
, SAFI_UNICAST
, uj
);
8933 DEFUN (show_bgp_instance_ipv6_safi_summary
,
8934 show_bgp_instance_ipv6_safi_summary_cmd
,
8935 "show bgp " BGP_INSTANCE_CMD
" ipv6 (unicast|multicast) summary {json}",
8938 BGP_INSTANCE_HELP_STR
8940 "Address Family modifier\n"
8941 "Address Family modifier\n"
8942 "Summary of BGP neighbor status\n"
8943 "JavaScript Object Notation\n")
8945 u_char uj
= use_json(argc
, argv
);
8946 if (strncmp (argv
[2], "m", 1) == 0)
8947 return bgp_show_summary_vty (vty
, argv
[1], AFI_IP6
, SAFI_MULTICAST
, uj
);
8949 return bgp_show_summary_vty (vty
, argv
[1], AFI_IP6
, SAFI_UNICAST
, uj
);
8953 DEFUN (show_ipv6_bgp_summary
,
8954 show_ipv6_bgp_summary_cmd
,
8955 "show ipv6 bgp summary {json}",
8959 "Summary of BGP neighbor status\n"
8960 "JavaScript Object Notation\n")
8962 u_char uj
= use_json(argc
, argv
);
8963 return bgp_show_summary_vty (vty
, NULL
, AFI_IP6
, SAFI_UNICAST
, uj
);
8967 DEFUN (show_ipv6_mbgp_summary
,
8968 show_ipv6_mbgp_summary_cmd
,
8969 "show ipv6 mbgp summary {json}",
8973 "Summary of BGP neighbor status\n"
8974 "JavaScript Object Notation\n")
8976 u_char uj
= use_json(argc
, argv
);
8977 return bgp_show_summary_vty (vty
, NULL
, AFI_IP6
, SAFI_MULTICAST
, uj
);
8979 #endif /* HAVE_IPV6 */
8982 afi_safi_print (afi_t afi
, safi_t safi
)
8984 if (afi
== AFI_IP
&& safi
== SAFI_UNICAST
)
8985 return "IPv4 Unicast";
8986 else if (afi
== AFI_IP
&& safi
== SAFI_MULTICAST
)
8987 return "IPv4 Multicast";
8988 else if (afi
== AFI_IP
&& safi
== SAFI_MPLS_VPN
)
8989 return "VPNv4 Unicast";
8990 else if (afi
== AFI_IP6
&& safi
== SAFI_UNICAST
)
8991 return "IPv6 Unicast";
8992 else if (afi
== AFI_IP6
&& safi
== SAFI_MULTICAST
)
8993 return "IPv6 Multicast";
8998 /* Show BGP peer's information. */
9006 bgp_show_peer_afi_orf_cap (struct vty
*vty
, struct peer
*p
, afi_t afi
, safi_t safi
,
9007 u_int16_t adv_smcap
, u_int16_t adv_rmcap
, u_int16_t rcv_smcap
,
9008 u_int16_t rcv_rmcap
, u_char use_json
, json_object
*json_pref
)
9011 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], adv_smcap
)
9012 || CHECK_FLAG (p
->af_cap
[afi
][safi
], rcv_smcap
))
9016 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], adv_smcap
) && CHECK_FLAG (p
->af_cap
[afi
][safi
], rcv_smcap
))
9017 json_object_string_add(json_pref
, "sendMode", "advertisedAndReceived");
9018 else if (CHECK_FLAG (p
->af_cap
[afi
][safi
], adv_smcap
))
9019 json_object_string_add(json_pref
, "sendMode", "advertised");
9020 else if (CHECK_FLAG (p
->af_cap
[afi
][safi
], rcv_smcap
))
9021 json_object_string_add(json_pref
, "sendMode", "received");
9025 vty_out (vty
, " Send-mode: ");
9026 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], adv_smcap
))
9027 vty_out (vty
, "advertised");
9028 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], rcv_smcap
))
9029 vty_out (vty
, "%sreceived",
9030 CHECK_FLAG (p
->af_cap
[afi
][safi
], adv_smcap
) ?
9032 vty_out (vty
, "%s", VTY_NEWLINE
);
9037 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], adv_rmcap
)
9038 || CHECK_FLAG (p
->af_cap
[afi
][safi
], rcv_rmcap
))
9042 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], adv_rmcap
) && CHECK_FLAG (p
->af_cap
[afi
][safi
], rcv_rmcap
))
9043 json_object_string_add(json_pref
, "recvMode", "advertisedAndReceived");
9044 else if (CHECK_FLAG (p
->af_cap
[afi
][safi
], adv_rmcap
))
9045 json_object_string_add(json_pref
, "recvMode", "advertised");
9046 else if (CHECK_FLAG (p
->af_cap
[afi
][safi
], rcv_rmcap
))
9047 json_object_string_add(json_pref
, "recvMode", "received");
9051 vty_out (vty
, " Receive-mode: ");
9052 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], adv_rmcap
))
9053 vty_out (vty
, "advertised");
9054 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], rcv_rmcap
))
9055 vty_out (vty
, "%sreceived",
9056 CHECK_FLAG (p
->af_cap
[afi
][safi
], adv_rmcap
) ?
9058 vty_out (vty
, "%s", VTY_NEWLINE
);
9064 bgp_show_peer_afi (struct vty
*vty
, struct peer
*p
, afi_t afi
, safi_t safi
,
9065 u_char use_json
, json_object
*json_neigh
)
9067 struct bgp_filter
*filter
;
9068 struct peer_af
*paf
;
9069 char orf_pfx_name
[BUFSIZ
];
9071 json_object
*json_af
= NULL
;
9072 json_object
*json_prefA
= NULL
;
9073 json_object
*json_prefB
= NULL
;
9074 json_object
*json_addr
= NULL
;
9078 json_addr
= json_object_new_object();
9079 json_af
= json_object_new_object();
9080 json_prefA
= json_object_new_object();
9081 json_prefB
= json_object_new_object();
9082 filter
= &p
->filter
[afi
][safi
];
9084 if (peer_group_active(p
))
9085 json_object_string_add(json_addr
, "peerGroupMember", p
->group
->name
);
9087 paf
= peer_af_find(p
, afi
, safi
);
9088 if (paf
&& PAF_SUBGRP(paf
))
9090 json_object_int_add(json_addr
, "updateGroupId", PAF_UPDGRP(paf
)->id
);
9091 json_object_int_add(json_addr
, "subGroupId", PAF_SUBGRP(paf
)->id
);
9092 json_object_int_add(json_addr
, "packetQueueLength", bpacket_queue_virtual_length(paf
));
9095 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_ADV
)
9096 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_RCV
)
9097 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_ADV
)
9098 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_RCV
))
9100 json_object_int_add(json_af
, "orfType", ORF_TYPE_PREFIX
);
9101 bgp_show_peer_afi_orf_cap (vty
, p
, afi
, safi
,
9102 PEER_CAP_ORF_PREFIX_SM_ADV
,
9103 PEER_CAP_ORF_PREFIX_RM_ADV
,
9104 PEER_CAP_ORF_PREFIX_SM_RCV
,
9105 PEER_CAP_ORF_PREFIX_RM_RCV
, use_json
, json_prefA
);
9106 json_object_object_add(json_af
, "orfPrefixList", json_prefA
);
9109 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_ADV
)
9110 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_OLD_RCV
)
9111 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_ADV
)
9112 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_OLD_RCV
))
9114 json_object_int_add(json_af
, "orfOldType", ORF_TYPE_PREFIX_OLD
);
9115 bgp_show_peer_afi_orf_cap (vty
, p
, afi
, safi
,
9116 PEER_CAP_ORF_PREFIX_SM_ADV
,
9117 PEER_CAP_ORF_PREFIX_RM_ADV
,
9118 PEER_CAP_ORF_PREFIX_SM_OLD_RCV
,
9119 PEER_CAP_ORF_PREFIX_RM_OLD_RCV
, use_json
, json_prefB
);
9120 json_object_object_add(json_af
, "orfOldPrefixList", json_prefB
);
9123 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_ADV
)
9124 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_RCV
)
9125 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_OLD_RCV
)
9126 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_ADV
)
9127 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_RCV
)
9128 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_OLD_RCV
))
9129 json_object_object_add(json_addr
, "afDependentCap", json_af
);
9131 sprintf (orf_pfx_name
, "%s.%d.%d", p
->host
, afi
, safi
);
9132 orf_pfx_count
= prefix_bgp_show_prefix_list (NULL
, afi
, orf_pfx_name
, use_json
);
9134 if (CHECK_FLAG (p
->af_sflags
[afi
][safi
], PEER_STATUS_ORF_PREFIX_SEND
)
9137 if (CHECK_FLAG (p
->af_sflags
[afi
][safi
], PEER_STATUS_ORF_PREFIX_SEND
))
9138 json_object_boolean_true_add(json_neigh
, "orfSent");
9140 json_object_int_add(json_addr
, "orfRecvCounter", orf_pfx_count
);
9142 if (CHECK_FLAG (p
->af_sflags
[afi
][safi
], PEER_STATUS_ORF_WAIT_REFRESH
))
9143 json_object_string_add(json_addr
, "orfFirstUpdate", "deferredUntilORFOrRouteRefreshRecvd");
9145 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_REFLECTOR_CLIENT
))
9146 json_object_boolean_true_add(json_addr
, "routeReflectorClient");
9147 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
9148 json_object_boolean_true_add(json_addr
, "routeServerClient");
9149 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SOFT_RECONFIG
))
9150 json_object_boolean_true_add(json_addr
, "inboundSoftConfigPermit");
9152 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE
))
9153 json_object_boolean_true_add(json_addr
, "privateAsNumsAllReplacedInUpdatesToNbr");
9154 else if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE
))
9155 json_object_boolean_true_add(json_addr
, "privateAsNumsReplacedInUpdatesToNbr");
9156 else if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_REMOVE_PRIVATE_AS_ALL
))
9157 json_object_boolean_true_add(json_addr
, "privateAsNumsAllRemovedInUpdatesToNbr");
9158 else if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_REMOVE_PRIVATE_AS
))
9159 json_object_boolean_true_add(json_addr
, "privateAsNumsRemovedInUpdatesToNbr");
9161 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_ADDPATH_TX_ALL_PATHS
))
9162 json_object_boolean_true_add(json_addr
, "addpathTxAllPaths");
9164 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS
))
9165 json_object_boolean_true_add(json_addr
, "addpathTxBestpathPerAS");
9167 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_AS_OVERRIDE
))
9168 json_object_string_add(json_addr
, "overrideASNsInOutboundUpdates", "ifAspathEqualRemoteAs");
9170 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_NEXTHOP_SELF
) ||
9171 CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_FORCE_NEXTHOP_SELF
))
9172 json_object_boolean_true_add(json_addr
, "routerAlwaysNextHop");
9173 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_AS_PATH_UNCHANGED
))
9174 json_object_boolean_true_add(json_addr
, "unchangedAsPathPropogatedToNbr");
9175 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_NEXTHOP_UNCHANGED
))
9176 json_object_boolean_true_add(json_addr
, "unchangedNextHopPropogatedToNbr");
9177 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_MED_UNCHANGED
))
9178 json_object_boolean_true_add(json_addr
, "unchangedMedPropogatedToNbr");
9179 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_COMMUNITY
)
9180 || CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_EXT_COMMUNITY
))
9182 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_COMMUNITY
)
9183 && CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_EXT_COMMUNITY
))
9184 json_object_string_add(json_addr
, "commAttriSentToNbr", "extendedAndStandard");
9185 else if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_EXT_COMMUNITY
))
9186 json_object_string_add(json_addr
, "commAttriSentToNbr", "extended");
9188 json_object_string_add(json_addr
, "commAttriSentToNbr", "standard");
9190 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_DEFAULT_ORIGINATE
))
9192 if (p
->default_rmap
[afi
][safi
].name
)
9193 json_object_string_add(json_addr
, "defaultRouteMap", p
->default_rmap
[afi
][safi
].name
);
9195 if (paf
&& PAF_SUBGRP(paf
) && CHECK_FLAG(PAF_SUBGRP(paf
)->sflags
, SUBGRP_STATUS_DEFAULT_ORIGINATE
))
9196 json_object_boolean_true_add(json_addr
, "defaultSent");
9198 json_object_boolean_true_add(json_addr
, "defaultNotSent");
9201 if (filter
->plist
[FILTER_IN
].name
9202 || filter
->dlist
[FILTER_IN
].name
9203 || filter
->aslist
[FILTER_IN
].name
9204 || filter
->map
[RMAP_IN
].name
)
9205 json_object_boolean_true_add(json_addr
, "inboundPathPolicyConfig");
9206 if (filter
->plist
[FILTER_OUT
].name
9207 || filter
->dlist
[FILTER_OUT
].name
9208 || filter
->aslist
[FILTER_OUT
].name
9209 || filter
->map
[RMAP_OUT
].name
9210 || filter
->usmap
.name
)
9211 json_object_boolean_true_add(json_addr
, "outboundPathPolicyConfig");
9214 if (filter
->plist
[FILTER_IN
].name
)
9215 json_object_string_add(json_addr
, "incomingUpdatePrefixFilterList", filter
->plist
[FILTER_IN
].name
);
9216 if (filter
->plist
[FILTER_OUT
].name
)
9217 json_object_string_add(json_addr
, "outgoingUpdatePrefixFilterList", filter
->plist
[FILTER_OUT
].name
);
9219 /* distribute-list */
9220 if (filter
->dlist
[FILTER_IN
].name
)
9221 json_object_string_add(json_addr
, "incomingUpdateNetworkFilterList", filter
->dlist
[FILTER_IN
].name
);
9222 if (filter
->dlist
[FILTER_OUT
].name
)
9223 json_object_string_add(json_addr
, "outgoingUpdateNetworkFilterList", filter
->dlist
[FILTER_OUT
].name
);
9226 if (filter
->aslist
[FILTER_IN
].name
)
9227 json_object_string_add(json_addr
, "incomingUpdateAsPathFilterList", filter
->aslist
[FILTER_IN
].name
);
9228 if (filter
->aslist
[FILTER_OUT
].name
)
9229 json_object_string_add(json_addr
, "outgoingUpdateAsPathFilterList", filter
->aslist
[FILTER_OUT
].name
);
9232 if (filter
->map
[RMAP_IN
].name
)
9233 json_object_string_add(json_addr
, "routeMapForIncomingAdvertisements", filter
->map
[RMAP_IN
].name
);
9234 if (filter
->map
[RMAP_OUT
].name
)
9235 json_object_string_add(json_addr
, "routeMapForOutgoingAdvertisements", filter
->map
[RMAP_OUT
].name
);
9237 /* unsuppress-map */
9238 if (filter
->usmap
.name
)
9239 json_object_string_add(json_addr
, "selectiveUnsuppressRouteMap", filter
->usmap
.name
);
9241 /* Receive prefix count */
9242 json_object_int_add(json_addr
, "acceptedPrefixCounter", p
->pcount
[afi
][safi
]);
9244 /* Maximum prefix */
9245 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_MAX_PREFIX
))
9247 json_object_int_add(json_addr
, "prefixAllowedMax", p
->pmax
[afi
][safi
]);
9248 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_MAX_PREFIX_WARNING
))
9249 json_object_boolean_true_add(json_addr
, "prefixAllowedMaxWarning");
9250 json_object_int_add(json_addr
, "prefixAllowedWarningThresh", p
->pmax_threshold
[afi
][safi
]);
9251 if (p
->pmax_restart
[afi
][safi
])
9252 json_object_int_add(json_addr
, "prefixAllowedRestartIntervalMsecs", p
->pmax_restart
[afi
][safi
] * 60000);
9254 json_object_object_add(json_neigh
, afi_safi_print (afi
, safi
), json_addr
);
9259 filter
= &p
->filter
[afi
][safi
];
9261 vty_out (vty
, " For address family: %s%s", afi_safi_print (afi
, safi
),
9264 if (peer_group_active(p
))
9265 vty_out (vty
, " %s peer-group member%s", p
->group
->name
, VTY_NEWLINE
);
9267 paf
= peer_af_find(p
, afi
, safi
);
9268 if (paf
&& PAF_SUBGRP(paf
))
9270 vty_out (vty
, " Update group %" PRIu64
", subgroup %" PRIu64
"%s",
9271 PAF_UPDGRP(paf
)->id
, PAF_SUBGRP(paf
)->id
, VTY_NEWLINE
);
9272 vty_out (vty
, " Packet Queue length %d%s",
9273 bpacket_queue_virtual_length(paf
), VTY_NEWLINE
);
9277 vty_out(vty
, " Not part of any update group%s", VTY_NEWLINE
);
9279 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_ADV
)
9280 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_RCV
)
9281 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_OLD_RCV
)
9282 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_ADV
)
9283 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_RCV
)
9284 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_OLD_RCV
))
9285 vty_out (vty
, " AF-dependant capabilities:%s", VTY_NEWLINE
);
9287 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_ADV
)
9288 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_RCV
)
9289 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_ADV
)
9290 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_RCV
))
9292 vty_out (vty
, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
9293 ORF_TYPE_PREFIX
, VTY_NEWLINE
);
9294 bgp_show_peer_afi_orf_cap (vty
, p
, afi
, safi
,
9295 PEER_CAP_ORF_PREFIX_SM_ADV
,
9296 PEER_CAP_ORF_PREFIX_RM_ADV
,
9297 PEER_CAP_ORF_PREFIX_SM_RCV
,
9298 PEER_CAP_ORF_PREFIX_RM_RCV
, use_json
, NULL
);
9300 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_ADV
)
9301 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_OLD_RCV
)
9302 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_ADV
)
9303 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_OLD_RCV
))
9305 vty_out (vty
, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
9306 ORF_TYPE_PREFIX_OLD
, VTY_NEWLINE
);
9307 bgp_show_peer_afi_orf_cap (vty
, p
, afi
, safi
,
9308 PEER_CAP_ORF_PREFIX_SM_ADV
,
9309 PEER_CAP_ORF_PREFIX_RM_ADV
,
9310 PEER_CAP_ORF_PREFIX_SM_OLD_RCV
,
9311 PEER_CAP_ORF_PREFIX_RM_OLD_RCV
, use_json
, NULL
);
9314 sprintf (orf_pfx_name
, "%s.%d.%d", p
->host
, afi
, safi
);
9315 orf_pfx_count
= prefix_bgp_show_prefix_list (NULL
, afi
, orf_pfx_name
, use_json
);
9317 if (CHECK_FLAG (p
->af_sflags
[afi
][safi
], PEER_STATUS_ORF_PREFIX_SEND
)
9320 vty_out (vty
, " Outbound Route Filter (ORF):");
9321 if (CHECK_FLAG (p
->af_sflags
[afi
][safi
], PEER_STATUS_ORF_PREFIX_SEND
))
9322 vty_out (vty
, " sent;");
9324 vty_out (vty
, " received (%d entries)", orf_pfx_count
);
9325 vty_out (vty
, "%s", VTY_NEWLINE
);
9327 if (CHECK_FLAG (p
->af_sflags
[afi
][safi
], PEER_STATUS_ORF_WAIT_REFRESH
))
9328 vty_out (vty
, " First update is deferred until ORF or ROUTE-REFRESH is received%s", VTY_NEWLINE
);
9330 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_REFLECTOR_CLIENT
))
9331 vty_out (vty
, " Route-Reflector Client%s", VTY_NEWLINE
);
9332 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
9333 vty_out (vty
, " Route-Server Client%s", VTY_NEWLINE
);
9334 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SOFT_RECONFIG
))
9335 vty_out (vty
, " Inbound soft reconfiguration allowed%s", VTY_NEWLINE
);
9337 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE
))
9338 vty_out (vty
, " Private AS numbers (all) replaced in updates to this neighbor%s", VTY_NEWLINE
);
9339 else if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE
))
9340 vty_out (vty
, " Private AS numbers replaced in updates to this neighbor%s", VTY_NEWLINE
);
9341 else if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_REMOVE_PRIVATE_AS_ALL
))
9342 vty_out (vty
, " Private AS numbers (all) removed in updates to this neighbor%s", VTY_NEWLINE
);
9343 else if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_REMOVE_PRIVATE_AS
))
9344 vty_out (vty
, " Private AS numbers removed in updates to this neighbor%s", VTY_NEWLINE
);
9346 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_ADDPATH_TX_ALL_PATHS
))
9347 vty_out (vty
, " Advertise all paths via addpath%s", VTY_NEWLINE
);
9349 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS
))
9350 vty_out (vty
, " Advertise bestpath per AS via addpath%s", VTY_NEWLINE
);
9352 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_AS_OVERRIDE
))
9353 vty_out (vty
, " Override ASNs in outbound updates if aspath equals remote-as%s", VTY_NEWLINE
);
9355 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_NEXTHOP_SELF
) ||
9356 CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_FORCE_NEXTHOP_SELF
))
9357 vty_out (vty
, " NEXT_HOP is always this router%s", VTY_NEWLINE
);
9358 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_AS_PATH_UNCHANGED
))
9359 vty_out (vty
, " AS_PATH is propagated unchanged to this neighbor%s", VTY_NEWLINE
);
9360 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_NEXTHOP_UNCHANGED
))
9361 vty_out (vty
, " NEXT_HOP is propagated unchanged to this neighbor%s", VTY_NEWLINE
);
9362 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_MED_UNCHANGED
))
9363 vty_out (vty
, " MED is propagated unchanged to this neighbor%s", VTY_NEWLINE
);
9364 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_COMMUNITY
)
9365 || CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_EXT_COMMUNITY
))
9367 vty_out (vty
, " Community attribute sent to this neighbor");
9368 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_COMMUNITY
)
9369 && CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_EXT_COMMUNITY
))
9370 vty_out (vty
, "(both)%s", VTY_NEWLINE
);
9371 else if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_EXT_COMMUNITY
))
9372 vty_out (vty
, "(extended)%s", VTY_NEWLINE
);
9374 vty_out (vty
, "(standard)%s", VTY_NEWLINE
);
9376 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_DEFAULT_ORIGINATE
))
9378 vty_out (vty
, " Default information originate,");
9380 if (p
->default_rmap
[afi
][safi
].name
)
9381 vty_out (vty
, " default route-map %s%s,",
9382 p
->default_rmap
[afi
][safi
].map
? "*" : "",
9383 p
->default_rmap
[afi
][safi
].name
);
9384 if (paf
&& PAF_SUBGRP(paf
) && CHECK_FLAG(PAF_SUBGRP(paf
)->sflags
, SUBGRP_STATUS_DEFAULT_ORIGINATE
))
9385 vty_out (vty
, " default sent%s", VTY_NEWLINE
);
9387 vty_out (vty
, " default not sent%s", VTY_NEWLINE
);
9390 if (filter
->plist
[FILTER_IN
].name
9391 || filter
->dlist
[FILTER_IN
].name
9392 || filter
->aslist
[FILTER_IN
].name
9393 || filter
->map
[RMAP_IN
].name
)
9394 vty_out (vty
, " Inbound path policy configured%s", VTY_NEWLINE
);
9395 if (filter
->plist
[FILTER_OUT
].name
9396 || filter
->dlist
[FILTER_OUT
].name
9397 || filter
->aslist
[FILTER_OUT
].name
9398 || filter
->map
[RMAP_OUT
].name
9399 || filter
->usmap
.name
)
9400 vty_out (vty
, " Outbound path policy configured%s", VTY_NEWLINE
);
9403 if (filter
->plist
[FILTER_IN
].name
)
9404 vty_out (vty
, " Incoming update prefix filter list is %s%s%s",
9405 filter
->plist
[FILTER_IN
].plist
? "*" : "",
9406 filter
->plist
[FILTER_IN
].name
,
9408 if (filter
->plist
[FILTER_OUT
].name
)
9409 vty_out (vty
, " Outgoing update prefix filter list is %s%s%s",
9410 filter
->plist
[FILTER_OUT
].plist
? "*" : "",
9411 filter
->plist
[FILTER_OUT
].name
,
9414 /* distribute-list */
9415 if (filter
->dlist
[FILTER_IN
].name
)
9416 vty_out (vty
, " Incoming update network filter list is %s%s%s",
9417 filter
->dlist
[FILTER_IN
].alist
? "*" : "",
9418 filter
->dlist
[FILTER_IN
].name
,
9420 if (filter
->dlist
[FILTER_OUT
].name
)
9421 vty_out (vty
, " Outgoing update network filter list is %s%s%s",
9422 filter
->dlist
[FILTER_OUT
].alist
? "*" : "",
9423 filter
->dlist
[FILTER_OUT
].name
,
9427 if (filter
->aslist
[FILTER_IN
].name
)
9428 vty_out (vty
, " Incoming update AS path filter list is %s%s%s",
9429 filter
->aslist
[FILTER_IN
].aslist
? "*" : "",
9430 filter
->aslist
[FILTER_IN
].name
,
9432 if (filter
->aslist
[FILTER_OUT
].name
)
9433 vty_out (vty
, " Outgoing update AS path filter list is %s%s%s",
9434 filter
->aslist
[FILTER_OUT
].aslist
? "*" : "",
9435 filter
->aslist
[FILTER_OUT
].name
,
9439 if (filter
->map
[RMAP_IN
].name
)
9440 vty_out (vty
, " Route map for incoming advertisements is %s%s%s",
9441 filter
->map
[RMAP_IN
].map
? "*" : "",
9442 filter
->map
[RMAP_IN
].name
,
9444 if (filter
->map
[RMAP_OUT
].name
)
9445 vty_out (vty
, " Route map for outgoing advertisements is %s%s%s",
9446 filter
->map
[RMAP_OUT
].map
? "*" : "",
9447 filter
->map
[RMAP_OUT
].name
,
9450 /* unsuppress-map */
9451 if (filter
->usmap
.name
)
9452 vty_out (vty
, " Route map for selective unsuppress is %s%s%s",
9453 filter
->usmap
.map
? "*" : "",
9454 filter
->usmap
.name
, VTY_NEWLINE
);
9456 /* Receive prefix count */
9457 vty_out (vty
, " %ld accepted prefixes%s", p
->pcount
[afi
][safi
], VTY_NEWLINE
);
9459 /* Maximum prefix */
9460 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_MAX_PREFIX
))
9462 vty_out (vty
, " Maximum prefixes allowed %ld%s%s", p
->pmax
[afi
][safi
],
9463 CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_MAX_PREFIX_WARNING
)
9464 ? " (warning-only)" : "", VTY_NEWLINE
);
9465 vty_out (vty
, " Threshold for warning message %d%%",
9466 p
->pmax_threshold
[afi
][safi
]);
9467 if (p
->pmax_restart
[afi
][safi
])
9468 vty_out (vty
, ", restart interval %d min", p
->pmax_restart
[afi
][safi
]);
9469 vty_out (vty
, "%s", VTY_NEWLINE
);
9472 vty_out (vty
, "%s", VTY_NEWLINE
);
9477 bgp_show_peer (struct vty
*vty
, struct peer
*p
, u_char use_json
, json_object
*json
, json_object
*json_neigh
)
9480 char buf1
[PREFIX2STR_BUFFER
], buf
[SU_ADDRSTRLEN
];
9481 char timebuf
[BGP_UPTIME_LEN
];
9483 const char *subcode_str
;
9484 const char *code_str
;
9494 if (p
->conf_if
) /* Configured interface name. */
9495 vty_out (vty
, "BGP neighbor on %s: %s, ", p
->conf_if
,
9496 BGP_PEER_SU_UNSPEC(p
) ? "None" :
9497 sockunion2str (&p
->su
, buf
, SU_ADDRSTRLEN
));
9498 else /* Configured IP address. */
9500 memset(dn_flag
, '\0', sizeof(dn_flag
));
9501 if (peer_dynamic_neighbor(p
))
9504 vty_out (vty
, "BGP neighbor is %s%s, ", dn_flag
, p
->host
);
9510 if (p
->conf_if
&& BGP_PEER_SU_UNSPEC(p
))
9511 json_object_string_add(json_neigh
, "bgpNeighborAddr", "none");
9512 else if (p
->conf_if
&& !BGP_PEER_SU_UNSPEC(p
))
9513 json_object_string_add(json_neigh
, "bgpNeighborAddr", sockunion2str (&p
->su
, buf
, SU_ADDRSTRLEN
));
9515 json_object_int_add(json_neigh
, "remoteAs", p
->as
);
9517 if (p
->change_local_as
)
9518 json_object_int_add(json_neigh
, "localAs", p
->change_local_as
);
9520 json_object_int_add(json_neigh
, "localAs", p
->local_as
);
9522 if (CHECK_FLAG (p
->flags
, PEER_FLAG_LOCAL_AS_NO_PREPEND
))
9523 json_object_boolean_true_add(json_neigh
, "localAsNoPrepend");
9525 if (CHECK_FLAG (p
->flags
, PEER_FLAG_LOCAL_AS_REPLACE_AS
))
9526 json_object_boolean_true_add(json_neigh
, "localAsReplaceAs");
9530 if ((p
->as_type
== AS_SPECIFIED
) ||
9531 (p
->as_type
== AS_EXTERNAL
) ||
9532 (p
->as_type
== AS_INTERNAL
))
9533 vty_out (vty
, "remote AS %u, ", p
->as
);
9535 vty_out (vty
, "remote AS Unspecified, ");
9536 vty_out (vty
, "local AS %u%s%s, ",
9537 p
->change_local_as
? p
->change_local_as
: p
->local_as
,
9538 CHECK_FLAG (p
->flags
, PEER_FLAG_LOCAL_AS_NO_PREPEND
) ?
9540 CHECK_FLAG (p
->flags
, PEER_FLAG_LOCAL_AS_REPLACE_AS
) ?
9541 " replace-as" : "");
9543 /* peer type internal, external, confed-internal or confed-external */
9544 if (p
->as
== p
->local_as
)
9548 if (CHECK_FLAG(bgp
->config
, BGP_CONFIG_CONFEDERATION
))
9549 json_object_boolean_true_add(json_neigh
, "nbrConfedInternalLink");
9551 json_object_boolean_true_add(json_neigh
, "nbrInternalLink");
9555 if (CHECK_FLAG(bgp
->config
, BGP_CONFIG_CONFEDERATION
))
9556 vty_out (vty
, "confed-internal link%s", VTY_NEWLINE
);
9558 vty_out (vty
, "internal link%s", VTY_NEWLINE
);
9565 if (CHECK_FLAG(bgp
->config
, BGP_CONFIG_CONFEDERATION
))
9566 json_object_boolean_true_add(json_neigh
, "nbrConfedExternalLink");
9568 json_object_boolean_true_add(json_neigh
, "nbrExternalLink");
9572 if (bgp_confederation_peers_check(bgp
, p
->as
))
9573 vty_out (vty
, "confed-external link%s", VTY_NEWLINE
);
9575 vty_out (vty
, "external link%s", VTY_NEWLINE
);
9583 json_object_string_add(json_neigh
, "nbrDesc", p
->desc
);
9585 vty_out (vty
, " Description: %s%s", p
->desc
, VTY_NEWLINE
);
9593 json_object_string_add(json_neigh
, "hostname", p
->hostname
);
9596 json_object_string_add(json_neigh
, "domainname", p
->domainname
);
9600 if (p
->domainname
&& (p
->domainname
[0] != '\0'))
9601 vty_out(vty
, "Hostname: %s.%s%s", p
->hostname
, p
->domainname
,
9604 vty_out(vty
, "Hostname: %s%s", p
->hostname
, VTY_NEWLINE
);
9614 json_object_string_add(json_neigh
, "peerGroup", p
->group
->name
);
9618 struct prefix
*prefix
= NULL
, *range
= NULL
;
9620 prefix
= sockunion2hostprefix(&(p
->su
));
9622 range
= peer_group_lookup_dynamic_neighbor_range (p
->group
, prefix
);
9626 prefix2str(range
, buf1
, sizeof(buf1
));
9627 json_object_string_add(json_neigh
, "peerSubnetRangeGroup", buf1
);
9633 vty_out (vty
, " Member of peer-group %s for session parameters%s",
9634 p
->group
->name
, VTY_NEWLINE
);
9638 struct prefix
*prefix
= NULL
, *range
= NULL
;
9640 prefix
= sockunion2hostprefix(&(p
->su
));
9642 range
= peer_group_lookup_dynamic_neighbor_range (p
->group
, prefix
);
9646 prefix2str(range
, buf1
, sizeof(buf1
));
9647 vty_out (vty
, " Belongs to the subnet range group: %s%s", buf1
, VTY_NEWLINE
);
9655 /* Administrative shutdown. */
9656 if (CHECK_FLAG (p
->flags
, PEER_FLAG_SHUTDOWN
))
9657 json_object_boolean_true_add(json_neigh
, "adminShutDown");
9660 json_object_int_add(json_neigh
, "bgpVersion", 4);
9661 json_object_string_add(json_neigh
, "remoteRouterId", inet_ntop (AF_INET
, &p
->remote_id
, buf1
, BUFSIZ
));
9664 if (CHECK_FLAG (bgp
->config
, BGP_CONFIG_CONFEDERATION
) && bgp_confederation_peers_check (bgp
, p
->as
))
9665 json_object_boolean_true_add(json_neigh
, "nbrCommonAdmin");
9668 json_object_string_add(json_neigh
, "bgpState", LOOKUP (bgp_status_msg
, p
->status
));
9670 if (p
->status
== Established
)
9675 uptime
= bgp_clock();
9676 uptime
-= p
->uptime
;
9677 tm
= gmtime(&uptime
);
9679 json_object_int_add(json_neigh
, "bgpTimerUp", (tm
->tm_sec
* 1000) + (tm
->tm_min
* 60000) + (tm
->tm_hour
* 3600000));
9682 else if (p
->status
== Active
)
9684 if (CHECK_FLAG (p
->flags
, PEER_FLAG_PASSIVE
))
9685 json_object_string_add(json_neigh
, "bgpStateIs", "passive");
9686 else if (CHECK_FLAG (p
->sflags
, PEER_STATUS_NSF_WAIT
))
9687 json_object_string_add(json_neigh
, "bgpStateIs", "passiveNSF");
9694 uptime
= bgp_clock();
9695 uptime
-= p
->readtime
;
9696 tm
= gmtime(&uptime
);
9697 json_object_int_add(json_neigh
, "bgpTimerLastRead", (tm
->tm_sec
* 1000) + (tm
->tm_min
* 60000) + (tm
->tm_hour
* 3600000));
9699 uptime
= bgp_clock();
9700 uptime
-= p
->last_write
;
9701 tm
= gmtime(&uptime
);
9702 json_object_int_add(json_neigh
, "bgpTimerLastRead", (tm
->tm_sec
* 1000) + (tm
->tm_min
* 60000) + (tm
->tm_hour
* 3600000));
9704 /* Configured timer values. */
9705 json_object_int_add(json_neigh
, "bgpTimerHoldTimeMsecs", p
->v_holdtime
* 1000);
9706 json_object_int_add(json_neigh
, "bgpTimerKeepAliveIntervalMsecs", p
->v_keepalive
* 1000);
9708 if (CHECK_FLAG (p
->config
, PEER_CONFIG_TIMER
))
9710 json_object_int_add(json_neigh
, "bgpTimerConfiguredHoldTimeMsecs", p
->holdtime
* 1000);
9711 json_object_int_add(json_neigh
, "bgpTimerConfiguredKeepAliveIntervalMsecs", p
->keepalive
* 1000);
9716 /* Administrative shutdown. */
9717 if (CHECK_FLAG (p
->flags
, PEER_FLAG_SHUTDOWN
))
9718 vty_out (vty
, " Administratively shut down%s", VTY_NEWLINE
);
9721 vty_out (vty
, " BGP version 4");
9722 vty_out (vty
, ", remote router ID %s%s", inet_ntop (AF_INET
, &p
->remote_id
, buf1
, BUFSIZ
),
9726 if (CHECK_FLAG (bgp
->config
, BGP_CONFIG_CONFEDERATION
)
9727 && bgp_confederation_peers_check (bgp
, p
->as
))
9728 vty_out (vty
, " Neighbor under common administration%s", VTY_NEWLINE
);
9731 vty_out (vty
, " BGP state = %s", LOOKUP (bgp_status_msg
, p
->status
));
9733 if (p
->status
== Established
)
9734 vty_out (vty
, ", up for %8s", peer_uptime (p
->uptime
, timebuf
, BGP_UPTIME_LEN
, 0, NULL
));
9736 else if (p
->status
== Active
)
9738 if (CHECK_FLAG (p
->flags
, PEER_FLAG_PASSIVE
))
9739 vty_out (vty
, " (passive)");
9740 else if (CHECK_FLAG (p
->sflags
, PEER_STATUS_NSF_WAIT
))
9741 vty_out (vty
, " (NSF passive)");
9743 vty_out (vty
, "%s", VTY_NEWLINE
);
9746 vty_out (vty
, " Last read %s", peer_uptime (p
->readtime
, timebuf
, BGP_UPTIME_LEN
, 0, NULL
));
9747 vty_out (vty
, ", Last write %s%s",
9748 peer_uptime (p
->last_write
, timebuf
, BGP_UPTIME_LEN
, 0, NULL
), VTY_NEWLINE
);
9750 /* Configured timer values. */
9751 vty_out (vty
, " Hold time is %d, keepalive interval is %d seconds%s",
9752 p
->v_holdtime
, p
->v_keepalive
, VTY_NEWLINE
);
9753 if (CHECK_FLAG (p
->config
, PEER_CONFIG_TIMER
))
9755 vty_out (vty
, " Configured hold time is %d", p
->holdtime
);
9756 vty_out (vty
, ", keepalive interval is %d seconds%s",
9757 p
->keepalive
, VTY_NEWLINE
);
9761 if (p
->status
== Established
)
9764 || p
->afc_adv
[AFI_IP
][SAFI_UNICAST
]
9765 || p
->afc_recv
[AFI_IP
][SAFI_UNICAST
]
9766 || p
->afc_adv
[AFI_IP
][SAFI_MULTICAST
]
9767 || p
->afc_recv
[AFI_IP
][SAFI_MULTICAST
]
9769 || p
->afc_adv
[AFI_IP6
][SAFI_UNICAST
]
9770 || p
->afc_recv
[AFI_IP6
][SAFI_UNICAST
]
9771 || p
->afc_adv
[AFI_IP6
][SAFI_MULTICAST
]
9772 || p
->afc_recv
[AFI_IP6
][SAFI_MULTICAST
]
9773 #endif /* HAVE_IPV6 */
9774 || p
->afc_adv
[AFI_IP
][SAFI_MPLS_VPN
]
9775 || p
->afc_recv
[AFI_IP
][SAFI_MPLS_VPN
])
9779 json_object
*json_cap
= NULL
;
9781 json_cap
= json_object_new_object();
9784 if (CHECK_FLAG (p
->cap
, PEER_CAP_AS4_RCV
)
9785 || CHECK_FLAG (p
->cap
, PEER_CAP_AS4_ADV
))
9787 if (CHECK_FLAG (p
->cap
, PEER_CAP_AS4_ADV
) && CHECK_FLAG (p
->cap
, PEER_CAP_AS4_RCV
))
9788 json_object_string_add(json_cap
, "4byteAs", "advertisedAndReceived");
9789 else if (CHECK_FLAG (p
->cap
, PEER_CAP_AS4_ADV
))
9790 json_object_string_add(json_cap
, "4byteAs", "advertised");
9791 else if (CHECK_FLAG (p
->cap
, PEER_CAP_AS4_RCV
))
9792 json_object_string_add(json_cap
, "4byteAs", "received");
9796 if (CHECK_FLAG (p
->cap
, PEER_CAP_ADDPATH_RCV
)
9797 || CHECK_FLAG (p
->cap
, PEER_CAP_ADDPATH_ADV
))
9799 json_object
*json_add
= NULL
;
9800 const char *print_store
;
9802 json_add
= json_object_new_object();
9804 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
9805 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
9807 json_object
*json_sub
= NULL
;
9808 json_sub
= json_object_new_object();
9809 print_store
= afi_safi_print (afi
, safi
);
9811 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_ADV
) ||
9812 CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_RCV
))
9814 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_ADV
) && CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_RCV
))
9815 json_object_boolean_true_add(json_sub
, "txAdvertisedAndReceived");
9816 else if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_ADV
))
9817 json_object_boolean_true_add(json_sub
, "txAdvertised");
9818 else if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_RCV
))
9819 json_object_boolean_true_add(json_sub
, "txReceived");
9822 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_ADV
) ||
9823 CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_RCV
))
9825 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_ADV
) && CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_RCV
))
9826 json_object_boolean_true_add(json_sub
, "rxAdvertisedAndReceived");
9827 else if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_ADV
))
9828 json_object_boolean_true_add(json_sub
, "rxAdvertised");
9829 else if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_RCV
))
9830 json_object_boolean_true_add(json_sub
, "rxReceived");
9833 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_ADV
) ||
9834 CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_RCV
) ||
9835 CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_ADV
) ||
9836 CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_RCV
))
9837 json_object_object_add(json_add
, print_store
, json_sub
);
9840 json_object_object_add(json_cap
, "addPath", json_add
);
9844 if (CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_RCV
)
9845 || CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_ADV
))
9847 if (CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_ADV
) && CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_RCV
))
9848 json_object_string_add(json_cap
, "dynamic", "advertisedAndReceived");
9849 else if (CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_ADV
))
9850 json_object_string_add(json_cap
, "dynamic", "advertised");
9851 else if (CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_RCV
))
9852 json_object_string_add(json_cap
, "dynamic", "received");
9855 /* Extended nexthop */
9856 if (CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_RCV
)
9857 || CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_ADV
))
9859 json_object
*json_nxt
= NULL
;
9860 const char *print_store
;
9862 json_nxt
= json_object_new_object();
9864 if (CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_ADV
) && CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_RCV
))
9865 json_object_string_add(json_cap
, "extendedNexthop", "advertisedAndReceived");
9866 else if (CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_ADV
))
9867 json_object_string_add(json_cap
, "extendedNexthop", "advertised");
9868 else if (CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_RCV
))
9869 json_object_string_add(json_cap
, "extendedNexthop", "received");
9871 if (CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_RCV
))
9873 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
9875 if (CHECK_FLAG (p
->af_cap
[AFI_IP
][safi
], PEER_CAP_ENHE_AF_RCV
))
9877 print_store
= afi_safi_print (AFI_IP
, safi
);
9878 json_object_string_add(json_nxt
, print_store
, "recieved");
9881 json_object_object_add(json_cap
, "extendedNexthopFamililesByPeer", json_nxt
);
9886 if (CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_ADV
)
9887 || CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_NEW_RCV
)
9888 || CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_OLD_RCV
))
9890 if (CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_ADV
) && (CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_NEW_RCV
) || CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_OLD_RCV
)))
9892 if (CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_OLD_RCV
) && CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_NEW_RCV
))
9893 json_object_string_add(json_cap
, "routeRefresh", "advertisedAndReceivedOldNew");
9896 if (CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_OLD_RCV
))
9897 json_object_string_add(json_cap
, "routeRefresh", "advertisedAndReceivedOld");
9899 json_object_string_add(json_cap
, "routeRefresh", "advertisedAndReceivedNew");
9902 else if (CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_ADV
))
9903 json_object_string_add(json_cap
, "routeRefresh", "advertised");
9904 else if (CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_NEW_RCV
) || CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_OLD_RCV
))
9905 json_object_string_add(json_cap
, "routeRefresh", "received");
9908 /* Multiprotocol Extensions */
9909 json_object
*json_multi
= NULL
;
9910 json_multi
= json_object_new_object();
9912 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
9914 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
9916 if (p
->afc_adv
[afi
][safi
] || p
->afc_recv
[afi
][safi
])
9918 json_object
*json_exten
= NULL
;
9919 json_exten
= json_object_new_object();
9921 if (p
->afc_adv
[afi
][safi
] && p
->afc_recv
[afi
][safi
])
9922 json_object_boolean_true_add(json_exten
, "advertisedAndReceived");
9923 else if (p
->afc_adv
[afi
][safi
])
9924 json_object_boolean_true_add(json_exten
, "advertised");
9925 else if (p
->afc_recv
[afi
][safi
])
9926 json_object_boolean_true_add(json_exten
, "received");
9928 json_object_object_add(json_multi
, afi_safi_print (afi
, safi
), json_exten
);
9932 json_object_object_add(json_cap
, "multiprotocolExtensions", json_multi
);
9934 /* Gracefull Restart */
9935 if (CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_RCV
)
9936 || CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_ADV
))
9938 if (CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_ADV
) && CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_RCV
))
9939 json_object_string_add(json_cap
, "gracefulRestart", "advertisedAndReceived");
9940 else if (CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_ADV
))
9941 json_object_string_add(json_cap
, "gracefulRestartCapability", "advertised");
9942 else if (CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_RCV
))
9943 json_object_string_add(json_cap
, "gracefulRestartCapability", "received");
9945 if (CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_RCV
))
9947 int restart_af_count
= 0;
9948 json_object
*json_restart
= NULL
;
9949 json_restart
= json_object_new_object();
9951 json_object_int_add(json_cap
, "gracefulRestartRemoteTimerMsecs", p
->v_gr_restart
* 1000);
9953 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
9955 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
9957 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_RESTART_AF_RCV
))
9959 json_object
*json_sub
= NULL
;
9960 json_sub
= json_object_new_object();
9962 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_RESTART_AF_PRESERVE_RCV
))
9963 json_object_boolean_true_add(json_sub
, "preserved");
9965 json_object_object_add(json_restart
, afi_safi_print (afi
, safi
), json_sub
);
9969 if (! restart_af_count
)
9970 json_object_string_add(json_cap
, "addressFamiliesByPeer", "none");
9972 json_object_object_add(json_cap
, "addressFamiliesByPeer", json_restart
);
9975 json_object_object_add(json_neigh
, "neighborCapabilities", json_cap
);
9979 vty_out (vty
, " Neighbor capabilities:%s", VTY_NEWLINE
);
9982 if (CHECK_FLAG (p
->cap
, PEER_CAP_AS4_RCV
)
9983 || CHECK_FLAG (p
->cap
, PEER_CAP_AS4_ADV
))
9985 vty_out (vty
, " 4 Byte AS:");
9986 if (CHECK_FLAG (p
->cap
, PEER_CAP_AS4_ADV
))
9987 vty_out (vty
, " advertised");
9988 if (CHECK_FLAG (p
->cap
, PEER_CAP_AS4_RCV
))
9989 vty_out (vty
, " %sreceived",
9990 CHECK_FLAG (p
->cap
, PEER_CAP_AS4_ADV
) ? "and " : "");
9991 vty_out (vty
, "%s", VTY_NEWLINE
);
9995 if (CHECK_FLAG (p
->cap
, PEER_CAP_ADDPATH_RCV
)
9996 || CHECK_FLAG (p
->cap
, PEER_CAP_ADDPATH_ADV
))
9998 vty_out (vty
, " AddPath:%s", VTY_NEWLINE
);
10000 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
10001 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
10003 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_ADV
) ||
10004 CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_RCV
))
10006 vty_out (vty
, " %s: TX ", afi_safi_print (afi
, safi
));
10008 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_ADV
))
10009 vty_out (vty
, "advertised %s", afi_safi_print (afi
, safi
));
10011 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_RCV
))
10012 vty_out (vty
, "%sreceived", CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_ADV
) ? " and " : "" );
10014 vty_out (vty
, "%s", VTY_NEWLINE
);
10017 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_ADV
) ||
10018 CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_RCV
))
10020 vty_out (vty
, " %s: RX ", afi_safi_print (afi
, safi
));
10022 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_ADV
))
10023 vty_out (vty
, "advertised %s", afi_safi_print (afi
, safi
));
10025 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_RCV
))
10026 vty_out (vty
, "%sreceived", CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_ADV
) ? " and " : "" );
10028 vty_out (vty
, "%s", VTY_NEWLINE
);
10034 if (CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_RCV
)
10035 || CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_ADV
))
10037 vty_out (vty
, " Dynamic:");
10038 if (CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_ADV
))
10039 vty_out (vty
, " advertised");
10040 if (CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_RCV
))
10041 vty_out (vty
, " %sreceived",
10042 CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_ADV
) ? "and " : "");
10043 vty_out (vty
, "%s", VTY_NEWLINE
);
10046 /* Extended nexthop */
10047 if (CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_RCV
)
10048 || CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_ADV
))
10050 vty_out (vty
, " Extended nexthop:");
10051 if (CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_ADV
))
10052 vty_out (vty
, " advertised");
10053 if (CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_RCV
))
10054 vty_out (vty
, " %sreceived",
10055 CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_ADV
) ? "and " : "");
10056 vty_out (vty
, "%s", VTY_NEWLINE
);
10058 if (CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_RCV
))
10060 vty_out (vty
, " Address families by peer:%s ", VTY_NEWLINE
);
10061 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
10062 if (CHECK_FLAG (p
->af_cap
[AFI_IP
][safi
], PEER_CAP_ENHE_AF_RCV
))
10063 vty_out (vty
, " %s%s",
10064 afi_safi_print (AFI_IP
, safi
), VTY_NEWLINE
);
10068 /* Route Refresh */
10069 if (CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_ADV
)
10070 || CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_NEW_RCV
)
10071 || CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_OLD_RCV
))
10073 vty_out (vty
, " Route refresh:");
10074 if (CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_ADV
))
10075 vty_out (vty
, " advertised");
10076 if (CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_NEW_RCV
)
10077 || CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_OLD_RCV
))
10078 vty_out (vty
, " %sreceived(%s)",
10079 CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_ADV
) ? "and " : "",
10080 (CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_OLD_RCV
)
10081 && CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_NEW_RCV
)) ?
10082 "old & new" : CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_OLD_RCV
) ? "old" : "new");
10084 vty_out (vty
, "%s", VTY_NEWLINE
);
10087 /* Multiprotocol Extensions */
10088 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
10089 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
10090 if (p
->afc_adv
[afi
][safi
] || p
->afc_recv
[afi
][safi
])
10092 vty_out (vty
, " Address family %s:", afi_safi_print (afi
, safi
));
10093 if (p
->afc_adv
[afi
][safi
])
10094 vty_out (vty
, " advertised");
10095 if (p
->afc_recv
[afi
][safi
])
10096 vty_out (vty
, " %sreceived", p
->afc_adv
[afi
][safi
] ? "and " : "");
10097 vty_out (vty
, "%s", VTY_NEWLINE
);
10100 /* Hostname capability */
10101 if (CHECK_FLAG(p
->cap
, PEER_CAP_HOSTNAME_ADV
) ||
10102 CHECK_FLAG(p
->cap
, PEER_CAP_HOSTNAME_RCV
))
10104 vty_out (vty
, " Hostname Capability:");
10105 if (CHECK_FLAG (p
->cap
, PEER_CAP_HOSTNAME_ADV
))
10106 vty_out (vty
, " advertised");
10107 if (CHECK_FLAG (p
->cap
, PEER_CAP_HOSTNAME_RCV
))
10108 vty_out (vty
, " %sreceived",
10109 CHECK_FLAG (p
->cap
, PEER_CAP_HOSTNAME_ADV
) ? "and " : "");
10110 vty_out (vty
, "%s", VTY_NEWLINE
);
10113 /* Gracefull Restart */
10114 if (CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_RCV
)
10115 || CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_ADV
))
10117 vty_out (vty
, " Graceful Restart Capabilty:");
10118 if (CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_ADV
))
10119 vty_out (vty
, " advertised");
10120 if (CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_RCV
))
10121 vty_out (vty
, " %sreceived",
10122 CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_ADV
) ? "and " : "");
10123 vty_out (vty
, "%s", VTY_NEWLINE
);
10125 if (CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_RCV
))
10127 int restart_af_count
= 0;
10129 vty_out (vty
, " Remote Restart timer is %d seconds%s",
10130 p
->v_gr_restart
, VTY_NEWLINE
);
10131 vty_out (vty
, " Address families by peer:%s ", VTY_NEWLINE
);
10133 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
10134 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
10135 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_RESTART_AF_RCV
))
10137 vty_out (vty
, "%s%s(%s)", restart_af_count
? ", " : "",
10138 afi_safi_print (afi
, safi
),
10139 CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_RESTART_AF_PRESERVE_RCV
) ?
10140 "preserved" : "not preserved");
10141 restart_af_count
++;
10143 if (! restart_af_count
)
10144 vty_out (vty
, "none");
10145 vty_out (vty
, "%s", VTY_NEWLINE
);
10152 /* graceful restart information */
10153 if (CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_RCV
)
10157 json_object
*json_grace
= NULL
;
10158 json_object
*json_grace_send
= NULL
;
10159 json_object
*json_grace_recv
= NULL
;
10160 int eor_send_af_count
= 0;
10161 int eor_receive_af_count
= 0;
10165 json_grace
= json_object_new_object();
10166 json_grace_send
= json_object_new_object();
10167 json_grace_recv
= json_object_new_object();
10169 if (p
->status
== Established
)
10171 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
10173 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
10175 if (CHECK_FLAG (p
->af_sflags
[afi
][safi
], PEER_STATUS_EOR_SEND
))
10177 json_object_boolean_true_add(json_grace_send
, afi_safi_print (afi
, safi
));
10178 eor_send_af_count
++;
10182 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
10184 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
10186 if (CHECK_FLAG (p
->af_sflags
[afi
][safi
], PEER_STATUS_EOR_RECEIVED
))
10188 json_object_boolean_true_add(json_grace_recv
, afi_safi_print (afi
, safi
));
10189 eor_receive_af_count
++;
10195 json_object_object_add(json_grace
, "endOfRibSend", json_grace_send
);
10196 json_object_object_add(json_grace
, "endOfRibRecv", json_grace_recv
);
10198 if (p
->t_gr_restart
)
10199 json_object_int_add(json_grace
, "gracefulRestartTimerMsecs", thread_timer_remain_second (p
->t_gr_restart
) * 1000);
10202 json_object_int_add(json_grace
, "gracefulStalepathTimerMsecs", thread_timer_remain_second (p
->t_gr_stale
) * 1000);
10204 json_object_object_add(json_neigh
, "gracefulRestartInfo", json_grace
);
10208 vty_out (vty
, " Graceful restart informations:%s", VTY_NEWLINE
);
10209 if (p
->status
== Established
)
10211 vty_out (vty
, " End-of-RIB send: ");
10212 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
10214 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
10216 if (CHECK_FLAG (p
->af_sflags
[afi
][safi
], PEER_STATUS_EOR_SEND
))
10218 vty_out (vty
, "%s%s", eor_send_af_count
? ", " : "",
10219 afi_safi_print (afi
, safi
));
10220 eor_send_af_count
++;
10224 vty_out (vty
, "%s", VTY_NEWLINE
);
10225 vty_out (vty
, " End-of-RIB received: ");
10226 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
10228 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
10230 if (CHECK_FLAG (p
->af_sflags
[afi
][safi
], PEER_STATUS_EOR_RECEIVED
))
10232 vty_out (vty
, "%s%s", eor_receive_af_count
? ", " : "",
10233 afi_safi_print (afi
, safi
));
10234 eor_receive_af_count
++;
10238 vty_out (vty
, "%s", VTY_NEWLINE
);
10241 if (p
->t_gr_restart
)
10242 vty_out (vty
, " The remaining time of restart timer is %ld%s",
10243 thread_timer_remain_second (p
->t_gr_restart
), VTY_NEWLINE
);
10246 vty_out (vty
, " The remaining time of stalepath timer is %ld%s",
10247 thread_timer_remain_second (p
->t_gr_stale
), VTY_NEWLINE
);
10252 json_object
*json_stat
= NULL
;
10253 json_stat
= json_object_new_object();
10254 /* Packet counts. */
10255 json_object_int_add(json_stat
, "depthInq", 0);
10256 json_object_int_add(json_stat
, "depthOutq", (unsigned long) p
->obuf
->count
);
10257 json_object_int_add(json_stat
, "opensSent", p
->open_out
);
10258 json_object_int_add(json_stat
, "opensRecv", p
->open_in
);
10259 json_object_int_add(json_stat
, "notificationsSent", p
->notify_out
);
10260 json_object_int_add(json_stat
, "notificationsRecv", p
->notify_in
);
10261 json_object_int_add(json_stat
, "updatesSent", p
->update_out
);
10262 json_object_int_add(json_stat
, "updatesRecv", p
->update_in
);
10263 json_object_int_add(json_stat
, "keepalivesSent", p
->keepalive_out
);
10264 json_object_int_add(json_stat
, "keepalivesRecv", p
->keepalive_in
);
10265 json_object_int_add(json_stat
, "routeRefreshSent", p
->refresh_out
);
10266 json_object_int_add(json_stat
, "routeRefreshRecv", p
->refresh_in
);
10267 json_object_int_add(json_stat
, "capabilitySent", p
->dynamic_cap_out
);
10268 json_object_int_add(json_stat
, "capabilityRecv", p
->dynamic_cap_in
);
10269 json_object_int_add(json_stat
, "totalSent", p
->open_out
+ p
->notify_out
+ p
->update_out
+ p
->keepalive_out
+ p
->refresh_out
+ p
->dynamic_cap_out
);
10270 json_object_int_add(json_stat
, "totalRecv", p
->open_in
+ p
->notify_in
+ p
->update_in
+ p
->keepalive_in
+ p
->refresh_in
+ p
->dynamic_cap_in
);
10271 json_object_object_add(json_neigh
, "messageStats", json_stat
);
10275 /* Packet counts. */
10276 vty_out (vty
, " Message statistics:%s", VTY_NEWLINE
);
10277 vty_out (vty
, " Inq depth is 0%s", VTY_NEWLINE
);
10278 vty_out (vty
, " Outq depth is %lu%s", (unsigned long) p
->obuf
->count
, VTY_NEWLINE
);
10279 vty_out (vty
, " Sent Rcvd%s", VTY_NEWLINE
);
10280 vty_out (vty
, " Opens: %10d %10d%s", p
->open_out
, p
->open_in
, VTY_NEWLINE
);
10281 vty_out (vty
, " Notifications: %10d %10d%s", p
->notify_out
, p
->notify_in
, VTY_NEWLINE
);
10282 vty_out (vty
, " Updates: %10d %10d%s", p
->update_out
, p
->update_in
, VTY_NEWLINE
);
10283 vty_out (vty
, " Keepalives: %10d %10d%s", p
->keepalive_out
, p
->keepalive_in
, VTY_NEWLINE
);
10284 vty_out (vty
, " Route Refresh: %10d %10d%s", p
->refresh_out
, p
->refresh_in
, VTY_NEWLINE
);
10285 vty_out (vty
, " Capability: %10d %10d%s", p
->dynamic_cap_out
, p
->dynamic_cap_in
, VTY_NEWLINE
);
10286 vty_out (vty
, " Total: %10d %10d%s", p
->open_out
+ p
->notify_out
+
10287 p
->update_out
+ p
->keepalive_out
+ p
->refresh_out
+ p
->dynamic_cap_out
,
10288 p
->open_in
+ p
->notify_in
+ p
->update_in
+ p
->keepalive_in
+ p
->refresh_in
+
10289 p
->dynamic_cap_in
, VTY_NEWLINE
);
10294 /* advertisement-interval */
10295 json_object_int_add(json_neigh
, "minBtwnAdvertisementRunsTimerMsecs", p
->v_routeadv
* 1000);
10297 /* Update-source. */
10298 if (p
->update_if
|| p
->update_source
)
10301 json_object_string_add(json_neigh
, "updateSource", p
->update_if
);
10302 else if (p
->update_source
)
10303 json_object_string_add(json_neigh
, "updateSource", sockunion2str (p
->update_source
, buf1
, SU_ADDRSTRLEN
));
10306 /* Default weight */
10307 if (CHECK_FLAG (p
->config
, PEER_CONFIG_WEIGHT
))
10308 json_object_int_add(json_neigh
, "defaultWeight", p
->weight
);
10313 /* advertisement-interval */
10314 vty_out (vty
, " Minimum time between advertisement runs is %d seconds%s",
10315 p
->v_routeadv
, VTY_NEWLINE
);
10317 /* Update-source. */
10318 if (p
->update_if
|| p
->update_source
)
10320 vty_out (vty
, " Update source is ");
10322 vty_out (vty
, "%s", p
->update_if
);
10323 else if (p
->update_source
)
10324 vty_out (vty
, "%s", sockunion2str (p
->update_source
, buf1
, SU_ADDRSTRLEN
));
10325 vty_out (vty
, "%s", VTY_NEWLINE
);
10328 /* Default weight */
10329 if (CHECK_FLAG (p
->config
, PEER_CONFIG_WEIGHT
))
10330 vty_out (vty
, " Default weight %d%s", p
->weight
, VTY_NEWLINE
);
10332 vty_out (vty
, "%s", VTY_NEWLINE
);
10335 /* Address Family Information */
10336 json_object
*json_hold
= NULL
;
10339 json_hold
= json_object_new_object();
10341 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
10342 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
10343 if (p
->afc
[afi
][safi
])
10344 bgp_show_peer_afi (vty
, p
, afi
, safi
, use_json
, json_hold
);
10348 json_object_int_add(json_hold
, "connectionsEstablished", p
->established
);
10349 json_object_int_add(json_hold
, "connectionsDropped", p
->dropped
);
10352 vty_out (vty
, " Connections established %d; dropped %d%s", p
->established
, p
->dropped
,
10355 if (! p
->last_reset
)
10358 json_object_string_add(json_hold
, "lastReset", "never");
10360 vty_out (vty
, " Last reset never%s", VTY_NEWLINE
);
10369 uptime
= bgp_clock();
10370 uptime
-= p
->resettime
;
10371 tm
= gmtime(&uptime
);
10372 json_object_int_add(json_hold
, "lastResetTimerMsecs", (tm
->tm_sec
* 1000) + (tm
->tm_min
* 60000) + (tm
->tm_hour
* 3600000));
10373 json_object_string_add(json_hold
, "lastResetDueTo", peer_down_str
[(int) p
->last_reset
]);
10374 if (p
->last_reset_cause_size
)
10376 msg
= p
->last_reset_cause
;
10377 char adapter
[BUFSIZ
];
10378 sprintf(adapter
, "%s", msg
);
10379 json_object_string_add(json_hold
, "messageReceivedThatCausedBgpNotification", adapter
);
10384 vty_out (vty
, " Last reset %s, ",
10385 peer_uptime (p
->resettime
, timebuf
, BGP_UPTIME_LEN
, 0, NULL
));
10387 if (p
->last_reset
== PEER_DOWN_NOTIFY_SEND
||
10388 p
->last_reset
== PEER_DOWN_NOTIFY_RECEIVED
)
10390 code_str
= bgp_notify_code_str(p
->notify
.code
);
10391 subcode_str
= bgp_notify_subcode_str(p
->notify
.code
, p
->notify
.subcode
);
10392 vty_out (vty
, "due to NOTIFICATION %s (%s%s)%s",
10393 p
->last_reset
== PEER_DOWN_NOTIFY_SEND
? "sent" : "received",
10394 code_str
, subcode_str
, VTY_NEWLINE
);
10398 vty_out (vty
, "due to %s%s",
10399 peer_down_str
[(int) p
->last_reset
], VTY_NEWLINE
);
10402 if (p
->last_reset_cause_size
)
10404 msg
= p
->last_reset_cause
;
10405 vty_out(vty
, " Message received that caused BGP to send a NOTIFICATION:%s ", VTY_NEWLINE
);
10406 for (i
= 1; i
<= p
->last_reset_cause_size
; i
++)
10408 vty_out(vty
, "%02X", *msg
++);
10410 if (i
!= p
->last_reset_cause_size
)
10414 vty_out(vty
, "%s ", VTY_NEWLINE
);
10416 else if (i
% 4 == 0)
10422 vty_out(vty
, "%s", VTY_NEWLINE
);
10427 if (CHECK_FLAG (p
->sflags
, PEER_STATUS_PREFIX_OVERFLOW
))
10430 json_object_boolean_true_add(json_hold
, "prefixesConfigExceedMax");
10432 vty_out (vty
, " Peer had exceeded the max. no. of prefixes configured.%s", VTY_NEWLINE
);
10434 if (p
->t_pmax_restart
)
10438 json_object_string_add(json_hold
, "reducePrefixNumFrom", p
->host
);
10439 json_object_int_add(json_hold
, "restartInTimerMsec", thread_timer_remain_second (p
->t_pmax_restart
) * 1000);
10442 vty_out (vty
, " Reduce the no. of prefix from %s, will restart in %ld seconds%s",
10443 p
->host
, thread_timer_remain_second (p
->t_pmax_restart
),
10449 json_object_string_add(json_hold
, "reducePrefixNumAndClearIpBgp", p
->host
);
10451 vty_out (vty
, " Reduce the no. of prefix and clear ip bgp %s to restore peering%s",
10452 p
->host
, VTY_NEWLINE
);
10457 json_object_object_add(json_neigh
, "addressFamilyInfo", json_hold
);
10459 /* EBGP Multihop and GTSM */
10460 if (p
->sort
!= BGP_PEER_IBGP
)
10464 if (p
->gtsm_hops
> 0)
10465 json_object_int_add(json_neigh
, "externalBgpNbrMaxHopsAway", p
->gtsm_hops
);
10466 else if (p
->ttl
> 1)
10467 json_object_int_add(json_neigh
, "externalBgpNbrMaxHopsAway", p
->ttl
);
10471 if (p
->gtsm_hops
> 0)
10472 vty_out (vty
, " External BGP neighbor may be up to %d hops away.%s",
10473 p
->gtsm_hops
, VTY_NEWLINE
);
10474 else if (p
->ttl
> 1)
10475 vty_out (vty
, " External BGP neighbor may be up to %d hops away.%s",
10476 p
->ttl
, VTY_NEWLINE
);
10481 if (p
->gtsm_hops
> 0)
10484 json_object_int_add(json_neigh
, "internalBgpNbrMaxHopsAway", p
->gtsm_hops
);
10486 vty_out (vty
, " Internal BGP neighbor may be up to %d hops away.%s",
10487 p
->gtsm_hops
, VTY_NEWLINE
);
10491 /* Local address. */
10496 json_object_string_add(json_neigh
, "hostLocal", sockunion2str (p
->su_local
, buf1
, SU_ADDRSTRLEN
));
10497 json_object_int_add(json_neigh
, "portLocal", ntohs (p
->su_local
->sin
.sin_port
));
10500 vty_out (vty
, "Local host: %s, Local port: %d%s",
10501 sockunion2str (p
->su_local
, buf1
, SU_ADDRSTRLEN
),
10502 ntohs (p
->su_local
->sin
.sin_port
),
10506 /* Remote address. */
10511 json_object_string_add(json_neigh
, "hostForeign", sockunion2str (p
->su_remote
, buf1
, SU_ADDRSTRLEN
));
10512 json_object_int_add(json_neigh
, "portForeign", ntohs (p
->su_remote
->sin
.sin_port
));
10515 vty_out (vty
, "Foreign host: %s, Foreign port: %d%s",
10516 sockunion2str (p
->su_remote
, buf1
, SU_ADDRSTRLEN
),
10517 ntohs (p
->su_remote
->sin
.sin_port
),
10521 /* Nexthop display. */
10526 json_object_string_add(json_neigh
, "nexthop", inet_ntop (AF_INET
, &p
->nexthop
.v4
, buf1
, BUFSIZ
));
10528 json_object_string_add(json_neigh
, "nexthopGlobal", inet_ntop (AF_INET6
, &p
->nexthop
.v6_global
, buf1
, BUFSIZ
));
10529 json_object_string_add(json_neigh
, "nexthopLocal", inet_ntop (AF_INET6
, &p
->nexthop
.v6_local
, buf1
, BUFSIZ
));
10530 if (p
->shared_network
)
10531 json_object_string_add(json_neigh
, "bgpConnection", "sharedNetwork");
10533 json_object_string_add(json_neigh
, "bgpConnection", "nonSharedNetwork");
10534 #endif /* HAVE_IPV6 */
10538 vty_out (vty
, "Nexthop: %s%s",
10539 inet_ntop (AF_INET
, &p
->nexthop
.v4
, buf1
, BUFSIZ
),
10542 vty_out (vty
, "Nexthop global: %s%s",
10543 inet_ntop (AF_INET6
, &p
->nexthop
.v6_global
, buf1
, BUFSIZ
),
10545 vty_out (vty
, "Nexthop local: %s%s",
10546 inet_ntop (AF_INET6
, &p
->nexthop
.v6_local
, buf1
, BUFSIZ
),
10548 vty_out (vty
, "BGP connection: %s%s",
10549 p
->shared_network
? "shared network" : "non shared network",
10551 #endif /* HAVE_IPV6 */
10555 /* Timer information. */
10559 json_object_int_add(json_neigh
, "nextStartTimerDueInMsecs", thread_timer_remain_second (p
->t_start
) * 1000);
10561 json_object_int_add(json_neigh
, "nextConnectTimerDueInMsecs", thread_timer_remain_second (p
->t_connect
) * 1000);
10564 json_object_int_add(json_neigh
, "mraiInterval", p
->v_routeadv
);
10565 json_object_int_add(json_neigh
, "mraiTimerExpireInMsecs", thread_timer_remain_second (p
->t_routeadv
) * 1000);
10569 json_object_string_add(json_neigh
, "readThread", "on");
10571 json_object_string_add(json_neigh
, "readThread", "off");
10573 json_object_string_add(json_neigh
, "writeThread", "on");
10575 json_object_string_add(json_neigh
, "writeThread", "off");
10580 vty_out (vty
, "Next start timer due in %ld seconds%s",
10581 thread_timer_remain_second (p
->t_start
), VTY_NEWLINE
);
10583 vty_out (vty
, "Next connect timer due in %ld seconds%s",
10584 thread_timer_remain_second (p
->t_connect
), VTY_NEWLINE
);
10586 vty_out (vty
, "MRAI (interval %u) timer expires in %ld seconds%s",
10587 p
->v_routeadv
, thread_timer_remain_second (p
->t_routeadv
),
10590 vty_out (vty
, "Read thread: %s Write thread: %s%s",
10591 p
->t_read
? "on" : "off",
10592 p
->t_write
? "on" : "off",
10596 if (p
->notify
.code
== BGP_NOTIFY_OPEN_ERR
10597 && p
->notify
.subcode
== BGP_NOTIFY_OPEN_UNSUP_CAPBL
)
10598 bgp_capability_vty_out (vty
, p
, use_json
, json_neigh
);
10601 vty_out (vty
, "%s", VTY_NEWLINE
);
10603 /* BFD information. */
10604 bgp_bfd_show_info(vty
, p
, use_json
, json_neigh
);
10608 if (p
->conf_if
) /* Configured interface name. */
10609 json_object_object_add(json
, p
->conf_if
, json_neigh
);
10610 else /* Configured IP address. */
10611 json_object_object_add(json
, p
->host
, json_neigh
);
10616 bgp_show_neighbor (struct vty
*vty
, struct bgp
*bgp
, enum show_type type
,
10617 union sockunion
*su
, const char *conf_if
, u_char use_json
, json_object
*json
)
10619 struct listnode
*node
, *nnode
;
10622 json_object
*json_neigh
= NULL
;
10625 json_neigh
= json_object_new_object();
10627 for (ALL_LIST_ELEMENTS (bgp
->peer
, node
, nnode
, peer
))
10629 if (!CHECK_FLAG(peer
->flags
, PEER_FLAG_CONFIG_NODE
))
10635 bgp_show_peer (vty
, peer
, use_json
, json
, json_neigh
);
10640 if (peer
->conf_if
&& !strcmp(peer
->conf_if
, conf_if
))
10643 bgp_show_peer (vty
, peer
, use_json
, json
, json_neigh
);
10648 if (sockunion_same (&peer
->su
, su
))
10651 bgp_show_peer (vty
, peer
, use_json
, json
, json_neigh
);
10658 if (type
== show_peer
&& ! find
)
10661 json_object_boolean_true_add(json
, "bgpNoSuchNeighbor");
10663 vty_out (vty
, "%% No such neighbor%s", VTY_NEWLINE
);
10668 vty_out (vty
, "%s%s", json_object_to_json_string(json
), VTY_NEWLINE
);
10669 json_object_free(json
);
10673 vty_out (vty
, "%s", VTY_NEWLINE
);
10676 return CMD_SUCCESS
;
10680 bgp_show_neighbor_vty (struct vty
*vty
, const char *name
,
10681 enum show_type type
, const char *ip_str
, u_char use_json
)
10685 union sockunion su
;
10686 json_object
*json
= NULL
;
10689 json
= json_object_new_object();
10693 bgp
= bgp_lookup_by_name (name
);
10698 json_object_boolean_true_add(json
, "bgpNoSuchInstance");
10699 vty_out (vty
, "%s%s", json_object_to_json_string(json
), VTY_NEWLINE
);
10700 json_object_free(json
);
10703 vty_out (vty
, "%% No such BGP instance exist%s", VTY_NEWLINE
);
10705 return CMD_WARNING
;
10710 bgp
= bgp_get_default ();
10717 ret
= str2sockunion (ip_str
, &su
);
10719 bgp_show_neighbor (vty
, bgp
, type
, NULL
, ip_str
, use_json
, json
);
10721 bgp_show_neighbor (vty
, bgp
, type
, &su
, NULL
, use_json
, json
);
10725 bgp_show_neighbor (vty
, bgp
, type
, NULL
, NULL
, use_json
, json
);
10729 return CMD_SUCCESS
;
10732 /* "show ip bgp neighbors" commands. */
10733 DEFUN (show_ip_bgp_neighbors
,
10734 show_ip_bgp_neighbors_cmd
,
10735 "show ip bgp neighbors {json}",
10739 "Detailed information on TCP and BGP neighbor connections\n"
10740 "JavaScript Object Notation\n")
10742 u_char uj
= use_json(argc
, argv
);
10744 return bgp_show_neighbor_vty (vty
, NULL
, show_all
, NULL
, uj
);
10747 ALIAS (show_ip_bgp_neighbors
,
10748 show_ip_bgp_ipv4_neighbors_cmd
,
10749 "show ip bgp ipv4 (unicast|multicast) neighbors {json}",
10754 "Address Family modifier\n"
10755 "Address Family modifier\n"
10756 "Detailed information on TCP and BGP neighbor connections\n"
10757 "JavaScript Object Notation\n")
10759 ALIAS (show_ip_bgp_neighbors
,
10760 show_ip_bgp_vpnv4_all_neighbors_cmd
,
10761 "show ip bgp vpnv4 all neighbors {json}",
10765 "Display VPNv4 NLRI specific information\n"
10766 "Display information about all VPNv4 NLRIs\n"
10767 "Detailed information on TCP and BGP neighbor connections\n"
10768 "JavaScript Object Notation\n")
10770 ALIAS (show_ip_bgp_neighbors
,
10771 show_ip_bgp_vpnv4_rd_neighbors_cmd
,
10772 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors {json}",
10776 "Display VPNv4 NLRI specific information\n"
10777 "Display information for a route distinguisher\n"
10778 "VPN Route Distinguisher\n"
10779 "Detailed information on TCP and BGP neighbor connections\n"
10780 "JavaScript Object Notation\n")
10782 ALIAS (show_ip_bgp_neighbors
,
10783 show_bgp_neighbors_cmd
,
10784 "show bgp neighbors {json}",
10787 "Detailed information on TCP and BGP neighbor connections\n"
10788 "JavaScript Object Notation\n")
10790 ALIAS (show_ip_bgp_neighbors
,
10791 show_bgp_ipv6_neighbors_cmd
,
10792 "show bgp ipv6 neighbors {json}",
10796 "Detailed information on TCP and BGP neighbor connections\n"
10797 "JavaScript Object Notation\n")
10799 DEFUN (show_ip_bgp_neighbors_peer
,
10800 show_ip_bgp_neighbors_peer_cmd
,
10801 "show ip bgp neighbors (A.B.C.D|X:X::X:X|WORD) {json}",
10805 "Detailed information on TCP and BGP neighbor connections\n"
10806 "Neighbor to display information about\n"
10807 "Neighbor to display information about\n"
10808 "Neighbor on bgp configured interface\n"
10809 "JavaScript Object Notation\n")
10811 u_char uj
= use_json(argc
, argv
);
10813 return bgp_show_neighbor_vty (vty
, NULL
, show_peer
, argv
[argc
- 2], uj
);
10816 ALIAS (show_ip_bgp_neighbors_peer
,
10817 show_ip_bgp_ipv4_neighbors_peer_cmd
,
10818 "show ip bgp ipv4 (unicast|multicast) neighbors (A.B.C.D|X:X::X:X|WORD) {json}",
10823 "Address Family modifier\n"
10824 "Address Family modifier\n"
10825 "Detailed information on TCP and BGP neighbor connections\n"
10826 "Neighbor to display information about\n"
10827 "Neighbor to display information about\n"
10828 "Neighbor on bgp configured interface\n"
10829 "JavaScript Object Notation\n")
10831 ALIAS (show_ip_bgp_neighbors_peer
,
10832 show_ip_bgp_vpnv4_all_neighbors_peer_cmd
,
10833 "show ip bgp vpnv4 all neighbors A.B.C.D {json}",
10837 "Display VPNv4 NLRI specific information\n"
10838 "Display information about all VPNv4 NLRIs\n"
10839 "Detailed information on TCP and BGP neighbor connections\n"
10840 "Neighbor to display information about\n"
10841 "JavaScript Object Notation\n")
10843 ALIAS (show_ip_bgp_neighbors_peer
,
10844 show_ip_bgp_vpnv4_rd_neighbors_peer_cmd
,
10845 "show ip bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D {json}",
10849 "Display VPNv4 NLRI specific information\n"
10850 "Display information about all VPNv4 NLRIs\n"
10851 "Detailed information on TCP and BGP neighbor connections\n"
10852 "Neighbor to display information about\n"
10853 "JavaScript Object Notation\n")
10855 ALIAS (show_ip_bgp_neighbors_peer
,
10856 show_bgp_neighbors_peer_cmd
,
10857 "show bgp neighbors (A.B.C.D|X:X::X:X|WORD) {json}",
10860 "Detailed information on TCP and BGP neighbor connections\n"
10861 "Neighbor to display information about\n"
10862 "Neighbor to display information about\n"
10863 "Neighbor on bgp configured interface\n"
10864 "JavaScript Object Notation\n")
10866 ALIAS (show_ip_bgp_neighbors_peer
,
10867 show_bgp_ipv6_neighbors_peer_cmd
,
10868 "show bgp ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) {json}",
10872 "Detailed information on TCP and BGP neighbor connections\n"
10873 "Neighbor to display information about\n"
10874 "Neighbor to display information about\n"
10875 "Neighbor on bgp configured interface\n"
10876 "JavaScript Object Notation\n")
10878 DEFUN (show_ip_bgp_instance_neighbors
,
10879 show_ip_bgp_instance_neighbors_cmd
,
10880 "show ip bgp " BGP_INSTANCE_CMD
" neighbors {json}",
10884 BGP_INSTANCE_HELP_STR
10885 "Detailed information on TCP and BGP neighbor connections\n"
10886 "JavaScript Object Notation\n")
10888 u_char uj
= use_json(argc
, argv
);
10890 return bgp_show_neighbor_vty (vty
, argv
[1], show_all
, NULL
, uj
);
10893 ALIAS (show_ip_bgp_instance_neighbors
,
10894 show_bgp_instance_neighbors_cmd
,
10895 "show bgp " BGP_INSTANCE_CMD
" neighbors {json}",
10898 BGP_INSTANCE_HELP_STR
10899 "Detailed information on TCP and BGP neighbor connections\n"
10900 "JavaScript Object Notation\n")
10902 ALIAS (show_ip_bgp_instance_neighbors
,
10903 show_bgp_instance_ipv6_neighbors_cmd
,
10904 "show bgp " BGP_INSTANCE_CMD
" ipv6 neighbors {json}",
10907 BGP_INSTANCE_HELP_STR
10909 "Detailed information on TCP and BGP neighbor connections\n"
10910 "JavaScript Object Notation\n")
10912 DEFUN (show_ip_bgp_instance_neighbors_peer
,
10913 show_ip_bgp_instance_neighbors_peer_cmd
,
10914 "show ip bgp " BGP_INSTANCE_CMD
" neighbors (A.B.C.D|X:X::X:X|WORD) {json}",
10918 BGP_INSTANCE_HELP_STR
10919 "Detailed information on TCP and BGP neighbor connections\n"
10920 "Neighbor to display information about\n"
10921 "Neighbor to display information about\n"
10922 "Neighbor on bgp configured interface\n"
10923 "JavaScript Object Notation\n")
10925 u_char uj
= use_json(argc
, argv
);
10927 return bgp_show_neighbor_vty (vty
, argv
[1], show_peer
, argv
[2], uj
);
10930 ALIAS (show_ip_bgp_instance_neighbors_peer
,
10931 show_bgp_instance_neighbors_peer_cmd
,
10932 "show bgp " BGP_INSTANCE_CMD
" neighbors (A.B.C.D|X:X::X:X|WORD) {json}",
10935 BGP_INSTANCE_HELP_STR
10936 "Detailed information on TCP and BGP neighbor connections\n"
10937 "Neighbor to display information about\n"
10938 "Neighbor to display information about\n"
10939 "Neighbor on bgp configured interface\n"
10940 "JavaScript Object Notation\n")
10942 ALIAS (show_ip_bgp_instance_neighbors_peer
,
10943 show_bgp_instance_ipv6_neighbors_peer_cmd
,
10944 "show bgp " BGP_INSTANCE_CMD
" ipv6 neighbors (A.B.C.D|X:X::X:X|WORD) {json}",
10947 BGP_INSTANCE_HELP_STR
10949 "Detailed information on TCP and BGP neighbor connections\n"
10950 "Neighbor to display information about\n"
10951 "Neighbor to display information about\n"
10952 "Neighbor on bgp configured interface\n"
10953 "JavaScript Object Notation\n")
10955 /* Show BGP's AS paths internal data. There are both `show ip bgp
10956 paths' and `show ip mbgp paths'. Those functions results are the
10958 DEFUN (show_ip_bgp_paths
,
10959 show_ip_bgp_paths_cmd
,
10960 "show ip bgp paths",
10964 "Path information\n")
10966 vty_out (vty
, "Address Refcnt Path%s", VTY_NEWLINE
);
10967 aspath_print_all_vty (vty
);
10968 return CMD_SUCCESS
;
10971 DEFUN (show_ip_bgp_ipv4_paths
,
10972 show_ip_bgp_ipv4_paths_cmd
,
10973 "show ip bgp ipv4 (unicast|multicast) paths",
10978 "Address Family modifier\n"
10979 "Address Family modifier\n"
10980 "Path information\n")
10982 vty_out (vty
, "Address Refcnt Path\r\n");
10983 aspath_print_all_vty (vty
);
10985 return CMD_SUCCESS
;
10991 community_show_all_iterator (struct hash_backet
*backet
, struct vty
*vty
)
10993 struct community
*com
;
10995 com
= (struct community
*) backet
->data
;
10996 vty_out (vty
, "[%p] (%ld) %s%s", backet
, com
->refcnt
,
10997 community_str (com
), VTY_NEWLINE
);
11000 /* Show BGP's community internal data. */
11001 DEFUN (show_ip_bgp_community_info
,
11002 show_ip_bgp_community_info_cmd
,
11003 "show ip bgp community-info",
11007 "List all bgp community information\n")
11009 vty_out (vty
, "Address Refcnt Community%s", VTY_NEWLINE
);
11011 hash_iterate (community_hash (),
11012 (void (*) (struct hash_backet
*, void *))
11013 community_show_all_iterator
,
11016 return CMD_SUCCESS
;
11019 DEFUN (show_ip_bgp_attr_info
,
11020 show_ip_bgp_attr_info_cmd
,
11021 "show ip bgp attribute-info",
11025 "List all bgp attribute information\n")
11027 attr_show_all (vty
);
11028 return CMD_SUCCESS
;
11031 static int bgp_show_update_groups(struct vty
*vty
, const char *name
,
11033 u_int64_t subgrp_id
)
11038 bgp
= bgp_lookup_by_name (name
);
11040 bgp
= bgp_get_default ();
11043 update_group_show(bgp
, afi
, safi
, vty
, subgrp_id
);
11044 return CMD_SUCCESS
;
11047 DEFUN (show_ip_bgp_updgrps
,
11048 show_ip_bgp_updgrps_cmd
,
11049 "show ip bgp update-groups",
11053 "Detailed info about dynamic update groups\n")
11055 return (bgp_show_update_groups(vty
, NULL
, AFI_IP
, SAFI_UNICAST
, 0));
11058 DEFUN (show_ip_bgp_instance_updgrps
,
11059 show_ip_bgp_instance_updgrps_cmd
,
11060 "show ip bgp " BGP_INSTANCE_CMD
" update-groups",
11064 BGP_INSTANCE_HELP_STR
11065 "Detailed info about dynamic update groups\n")
11067 return (bgp_show_update_groups(vty
, argv
[1], AFI_IP
, SAFI_UNICAST
, 0));
11070 DEFUN (show_bgp_ipv6_updgrps
,
11071 show_bgp_ipv6_updgrps_cmd
,
11072 "show bgp update-groups",
11075 "Detailed info about v6 dynamic update groups\n")
11077 return (bgp_show_update_groups(vty
, NULL
, AFI_IP6
, SAFI_UNICAST
, 0));
11080 DEFUN (show_bgp_instance_ipv6_updgrps
,
11081 show_bgp_instance_ipv6_updgrps_cmd
,
11082 "show bgp " BGP_INSTANCE_CMD
" update-groups",
11085 BGP_INSTANCE_HELP_STR
11086 "Detailed info about v6 dynamic update groups\n")
11088 return (bgp_show_update_groups(vty
, argv
[1], AFI_IP6
, SAFI_UNICAST
, 0));
11091 DEFUN (show_bgp_updgrps
,
11092 show_bgp_updgrps_cmd
,
11093 "show bgp (ipv4|ipv6) (unicast|multicast) update-groups",
11098 "Address Family modifier\n"
11099 "Address Family modifier\n"
11100 "Detailed info about dynamic update groups\n")
11105 afi
= (strcmp(argv
[0], "ipv4") == 0) ? AFI_IP
: AFI_IP6
;
11106 safi
= (strncmp (argv
[1], "m", 1) == 0) ? SAFI_MULTICAST
: SAFI_UNICAST
;
11107 return (bgp_show_update_groups(vty
, NULL
, afi
, safi
, 0));
11110 DEFUN (show_ip_bgp_updgrps_s
,
11111 show_ip_bgp_updgrps_s_cmd
,
11112 "show ip bgp update-groups SUBGROUP-ID",
11116 "Detailed info about dynamic update groups\n"
11117 "Specific subgroup to display detailed info for\n")
11119 u_int64_t subgrp_id
;
11121 VTY_GET_ULL("subgroup-id", subgrp_id
, argv
[0]);
11122 return (bgp_show_update_groups(vty
, NULL
, AFI_IP
, SAFI_UNICAST
, subgrp_id
));
11125 DEFUN (show_ip_bgp_instance_updgrps_s
,
11126 show_ip_bgp_instance_updgrps_s_cmd
,
11127 "show ip bgp " BGP_INSTANCE_CMD
" update-groups SUBGROUP-ID",
11131 BGP_INSTANCE_HELP_STR
11132 "Detailed info about dynamic update groups\n"
11133 "Specific subgroup to display detailed info for\n")
11135 u_int64_t subgrp_id
;
11137 VTY_GET_ULL("subgroup-id", subgrp_id
, argv
[2]);
11138 return (bgp_show_update_groups(vty
, argv
[1], AFI_IP
, SAFI_UNICAST
, subgrp_id
));
11141 DEFUN (show_bgp_ipv6_updgrps_s
,
11142 show_bgp_ipv6_updgrps_s_cmd
,
11143 "show bgp update-groups SUBGROUP-ID",
11146 "Detailed info about v6 dynamic update groups\n"
11147 "Specific subgroup to display detailed info for\n")
11149 u_int64_t subgrp_id
;
11151 VTY_GET_ULL("subgroup-id", subgrp_id
, argv
[0]);
11152 return(bgp_show_update_groups(vty
, NULL
, AFI_IP6
, SAFI_UNICAST
, subgrp_id
));
11155 DEFUN (show_bgp_instance_ipv6_updgrps_s
,
11156 show_bgp_instance_ipv6_updgrps_s_cmd
,
11157 "show bgp " BGP_INSTANCE_CMD
" update-groups SUBGROUP-ID",
11160 "Detailed info about v6 dynamic update groups\n"
11161 "Specific subgroup to display detailed info for\n")
11163 u_int64_t subgrp_id
;
11165 VTY_GET_ULL("subgroup-id", subgrp_id
, argv
[2]);
11166 return(bgp_show_update_groups(vty
, argv
[1], AFI_IP6
, SAFI_UNICAST
, subgrp_id
));
11169 DEFUN (show_bgp_updgrps_s
,
11170 show_bgp_updgrps_s_cmd
,
11171 "show bgp (ipv4|ipv6) (unicast|multicast) update-groups SUBGROUP-ID",
11176 "Address Family modifier\n"
11177 "Address Family modifier\n"
11178 "Detailed info about v6 dynamic update groups\n"
11179 "Specific subgroup to display detailed info for")
11183 u_int64_t subgrp_id
;
11185 afi
= (strcmp(argv
[0], "ipv4") == 0) ? AFI_IP
: AFI_IP6
;
11186 safi
= (strncmp (argv
[1], "m", 1) == 0) ? SAFI_MULTICAST
: SAFI_UNICAST
;
11188 VTY_GET_ULL("subgroup-id", subgrp_id
, argv
[2]);
11189 return(bgp_show_update_groups(vty
, NULL
, afi
, safi
, subgrp_id
));
11192 DEFUN (show_bgp_updgrps_stats
,
11193 show_bgp_updgrps_stats_cmd
,
11194 "show bgp update-groups statistics",
11197 "BGP update groups\n"
11202 bgp
= bgp_get_default();
11204 update_group_show_stats(bgp
, vty
);
11206 return CMD_SUCCESS
;
11209 DEFUN (show_bgp_instance_updgrps_stats
,
11210 show_bgp_instance_updgrps_stats_cmd
,
11211 "show bgp " BGP_INSTANCE_CMD
" update-groups statistics",
11214 BGP_INSTANCE_HELP_STR
11215 "BGP update groups\n"
11220 bgp
= bgp_lookup_by_name (argv
[1]);
11222 update_group_show_stats(bgp
, vty
);
11224 return CMD_SUCCESS
;
11228 show_bgp_updgrps_adj_info_aux (struct vty
*vty
, const char *name
,
11229 afi_t afi
, safi_t safi
,
11230 const char *what
, u_int64_t subgrp_id
)
11235 bgp
= bgp_lookup_by_name (name
);
11237 bgp
= bgp_get_default ();
11241 if (!strcmp(what
, "advertise-queue"))
11242 update_group_show_adj_queue(bgp
, afi
, safi
, vty
, subgrp_id
);
11243 else if (!strcmp(what
, "advertised-routes"))
11244 update_group_show_advertised(bgp
, afi
, safi
, vty
, subgrp_id
);
11245 else if (!strcmp(what
, "packet-queue"))
11246 update_group_show_packet_queue(bgp
, afi
, safi
, vty
, subgrp_id
);
11250 DEFUN (show_ip_bgp_updgrps_adj
,
11251 show_ip_bgp_updgrps_adj_cmd
,
11252 "show ip bgp update-groups (advertise-queue|advertised-routes|packet-queue)",
11256 "BGP update groups\n"
11257 "Advertisement queue\n"
11258 "Announced routes\n"
11262 show_bgp_updgrps_adj_info_aux(vty
, NULL
, AFI_IP
, SAFI_UNICAST
, argv
[0], 0);
11263 return CMD_SUCCESS
;
11266 DEFUN (show_ip_bgp_instance_updgrps_adj
,
11267 show_ip_bgp_instance_updgrps_adj_cmd
,
11268 "show ip bgp " BGP_INSTANCE_CMD
" update-groups (advertise-queue|advertised-routes|packet-queue)",
11272 BGP_INSTANCE_HELP_STR
11273 "BGP update groups\n"
11274 "Advertisement queue\n"
11275 "Announced routes\n"
11279 show_bgp_updgrps_adj_info_aux(vty
, argv
[1], AFI_IP
, SAFI_UNICAST
, argv
[2], 0);
11280 return CMD_SUCCESS
;
11283 DEFUN (show_bgp_updgrps_afi_adj
,
11284 show_bgp_updgrps_afi_adj_cmd
,
11285 "show bgp (ipv4|ipv6) (unicast|multicast) update-groups (advertise-queue|advertised-routes|packet-queue)",
11290 "Address Family modifier\n"
11291 "Address Family modifier\n"
11292 "BGP update groups\n"
11293 "Advertisement queue\n"
11294 "Announced routes\n"
11296 "Specific subgroup info wanted for\n")
11301 afi
= (strcmp(argv
[0], "ipv4") == 0) ? AFI_IP
: AFI_IP6
;
11302 safi
= (strncmp (argv
[1], "m", 1) == 0) ? SAFI_MULTICAST
: SAFI_UNICAST
;
11303 show_bgp_updgrps_adj_info_aux(vty
, NULL
, afi
, safi
, argv
[2], 0);
11304 return CMD_SUCCESS
;
11307 DEFUN (show_bgp_updgrps_adj
,
11308 show_bgp_updgrps_adj_cmd
,
11309 "show bgp update-groups (advertise-queue|advertised-routes|packet-queue)",
11312 "BGP update groups\n"
11313 "Advertisement queue\n"
11314 "Announced routes\n"
11317 show_bgp_updgrps_adj_info_aux(vty
, NULL
, AFI_IP6
, SAFI_UNICAST
, argv
[0], 0);
11318 return CMD_SUCCESS
;
11321 DEFUN (show_bgp_instance_updgrps_adj
,
11322 show_bgp_instance_updgrps_adj_cmd
,
11323 "show bgp " BGP_INSTANCE_CMD
" update-groups (advertise-queue|advertised-routes|packet-queue)",
11326 BGP_INSTANCE_HELP_STR
11327 "BGP update groups\n"
11328 "Advertisement queue\n"
11329 "Announced routes\n"
11332 show_bgp_updgrps_adj_info_aux(vty
, argv
[1], AFI_IP6
, SAFI_UNICAST
, argv
[2], 0);
11333 return CMD_SUCCESS
;
11336 DEFUN (show_ip_bgp_updgrps_adj_s
,
11337 show_ip_bgp_updgrps_adj_s_cmd
,
11338 "show ip bgp update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)",
11342 "BGP update groups\n"
11343 "Specific subgroup to display info for\n"
11344 "Advertisement queue\n"
11345 "Announced routes\n"
11349 u_int64_t subgrp_id
;
11351 VTY_GET_ULL("subgroup-id", subgrp_id
, argv
[0]);
11353 show_bgp_updgrps_adj_info_aux(vty
, NULL
, AFI_IP
, SAFI_UNICAST
, argv
[1], subgrp_id
);
11354 return CMD_SUCCESS
;
11357 DEFUN (show_ip_bgp_instance_updgrps_adj_s
,
11358 show_ip_bgp_instance_updgrps_adj_s_cmd
,
11359 "show ip bgp " BGP_INSTANCE_CMD
" update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)",
11363 BGP_INSTANCE_HELP_STR
11364 "BGP update groups\n"
11365 "Specific subgroup to display info for\n"
11366 "Advertisement queue\n"
11367 "Announced routes\n"
11371 u_int64_t subgrp_id
;
11373 VTY_GET_ULL("subgroup-id", subgrp_id
, argv
[2]);
11375 show_bgp_updgrps_adj_info_aux(vty
, argv
[1], AFI_IP
, SAFI_UNICAST
, argv
[3], subgrp_id
);
11376 return CMD_SUCCESS
;
11379 DEFUN (show_bgp_updgrps_afi_adj_s
,
11380 show_bgp_updgrps_afi_adj_s_cmd
,
11381 "show bgp (ipv4|ipv6) (unicast|multicast) update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)",
11386 "Address Family modifier\n"
11387 "Address Family modifier\n"
11388 "BGP update groups\n"
11389 "Specific subgroup to display info for\n"
11390 "Advertisement queue\n"
11391 "Announced routes\n"
11393 "Specific subgroup info wanted for\n")
11397 u_int64_t subgrp_id
;
11399 afi
= (strcmp(argv
[0], "ipv4") == 0) ? AFI_IP
: AFI_IP6
;
11400 safi
= (strncmp (argv
[1], "m", 1) == 0) ? SAFI_MULTICAST
: SAFI_UNICAST
;
11401 VTY_GET_ULL("subgroup-id", subgrp_id
, argv
[2]);
11403 show_bgp_updgrps_adj_info_aux(vty
, NULL
, afi
, safi
, argv
[3], subgrp_id
);
11404 return CMD_SUCCESS
;
11407 DEFUN (show_bgp_updgrps_adj_s
,
11408 show_bgp_updgrps_adj_s_cmd
,
11409 "show bgp update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)",
11412 "BGP update groups\n"
11413 "Specific subgroup to display info for\n"
11414 "Advertisement queue\n"
11415 "Announced routes\n"
11418 u_int64_t subgrp_id
;
11420 VTY_GET_ULL("subgroup-id", subgrp_id
, argv
[0]);
11422 show_bgp_updgrps_adj_info_aux(vty
, NULL
, AFI_IP6
, SAFI_UNICAST
, argv
[1], subgrp_id
);
11423 return CMD_SUCCESS
;
11426 DEFUN (show_bgp_instance_updgrps_adj_s
,
11427 show_bgp_instance_updgrps_adj_s_cmd
,
11428 "show bgp " BGP_INSTANCE_CMD
" update-groups SUBGROUP-ID (advertise-queue|advertised-routes|packet-queue)",
11431 BGP_INSTANCE_HELP_STR
11432 "BGP update groups\n"
11433 "Specific subgroup to display info for\n"
11434 "Advertisement queue\n"
11435 "Announced routes\n"
11438 u_int64_t subgrp_id
;
11440 VTY_GET_ULL("subgroup-id", subgrp_id
, argv
[2]);
11442 show_bgp_updgrps_adj_info_aux(vty
, argv
[1], AFI_IP6
, SAFI_UNICAST
, argv
[3], subgrp_id
);
11443 return CMD_SUCCESS
;
11449 bgp_show_one_peer_group (struct vty
*vty
, struct peer_group
*group
)
11451 struct listnode
*node
, *nnode
;
11452 struct prefix
*range
;
11455 char buf
[PREFIX2STR_BUFFER
];
11458 const char *peer_status
;
11459 const char *af_str
;
11464 conf
= group
->conf
;
11466 if (conf
->as_type
== AS_SPECIFIED
||
11467 conf
->as_type
== AS_EXTERNAL
) {
11468 vty_out (vty
, "%sBGP peer-group %s, remote AS %d%s",
11469 VTY_NEWLINE
, group
->name
, conf
->as
, VTY_NEWLINE
);
11470 } else if (conf
->as_type
== AS_INTERNAL
) {
11471 vty_out (vty
, "%sBGP peer-group %s, remote AS %d%s",
11472 VTY_NEWLINE
, group
->name
, group
->bgp
->as
, VTY_NEWLINE
);
11474 vty_out (vty
, "%sBGP peer-group %s%s",
11475 VTY_NEWLINE
, group
->name
, VTY_NEWLINE
);
11478 if ((group
->bgp
->as
== conf
->as
) || (conf
->as_type
== AS_INTERNAL
))
11479 vty_out (vty
, " Peer-group type is internal%s", VTY_NEWLINE
);
11481 vty_out (vty
, " Peer-group type is external%s", VTY_NEWLINE
);
11483 /* Display AFs configured. */
11484 vty_out (vty
, " Configured address-families:");
11485 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
11486 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
11488 if (conf
->afc
[afi
][safi
])
11491 vty_out (vty
, " %s;", afi_safi_print(afi
, safi
));
11495 vty_out (vty
, " none%s", VTY_NEWLINE
);
11497 vty_out (vty
, "%s", VTY_NEWLINE
);
11499 /* Display listen ranges (for dynamic neighbors), if any */
11500 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
11504 else if (afi
== AFI_IP6
)
11506 lr_count
= listcount(group
->listen_range
[afi
]);
11510 " %d %s listen range(s)%s",
11511 lr_count
, af_str
, VTY_NEWLINE
);
11514 for (ALL_LIST_ELEMENTS (group
->listen_range
[afi
], node
,
11517 prefix2str(range
, buf
, sizeof(buf
));
11518 vty_out(vty
, " %s%s", buf
, VTY_NEWLINE
);
11523 /* Display group members and their status */
11524 if (listcount(group
->peer
))
11526 vty_out (vty
, " Peer-group members:%s", VTY_NEWLINE
);
11527 for (ALL_LIST_ELEMENTS (group
->peer
, node
, nnode
, peer
))
11529 if (CHECK_FLAG (peer
->flags
, PEER_FLAG_SHUTDOWN
))
11530 peer_status
= "Idle (Admin)";
11531 else if (CHECK_FLAG (peer
->sflags
, PEER_STATUS_PREFIX_OVERFLOW
))
11532 peer_status
= "Idle (PfxCt)";
11534 peer_status
= LOOKUP(bgp_status_msg
, peer
->status
);
11536 dynamic
= peer_dynamic_neighbor(peer
);
11537 vty_out (vty
, " %s %s %s %s",
11538 peer
->host
, dynamic
? "(dynamic)" : "",
11539 peer_status
, VTY_NEWLINE
);
11543 return CMD_SUCCESS
;
11546 /* Show BGP peer group's information. */
11547 enum show_group_type
11554 bgp_show_peer_group (struct vty
*vty
, struct bgp
*bgp
,
11555 enum show_group_type type
, const char *group_name
)
11557 struct listnode
*node
, *nnode
;
11558 struct peer_group
*group
;
11561 for (ALL_LIST_ELEMENTS (bgp
->group
, node
, nnode
, group
))
11565 case show_all_groups
:
11566 bgp_show_one_peer_group (vty
, group
);
11568 case show_peer_group
:
11569 if (group_name
&& (strcmp(group
->name
, group_name
) == 0))
11572 bgp_show_one_peer_group (vty
, group
);
11578 if (type
== show_peer_group
&& ! find
)
11579 vty_out (vty
, "%% No such peer-groupr%s", VTY_NEWLINE
);
11581 return CMD_SUCCESS
;
11585 bgp_show_peer_group_vty (struct vty
*vty
, const char *name
,
11586 enum show_group_type type
, const char *group_name
)
11589 int ret
= CMD_SUCCESS
;
11592 bgp
= bgp_lookup_by_name (name
);
11594 bgp
= bgp_get_default ();
11598 vty_out (vty
, "%% No such BGP instance exist%s", VTY_NEWLINE
);
11599 return CMD_WARNING
;
11602 ret
= bgp_show_peer_group (vty
, bgp
, type
, group_name
);
11607 DEFUN (show_ip_bgp_peer_groups
,
11608 show_ip_bgp_peer_groups_cmd
,
11609 "show ip bgp peer-group",
11613 "Detailed information on all BGP peer groups\n")
11615 return bgp_show_peer_group_vty (vty
, NULL
, show_all_groups
, NULL
);
11618 DEFUN (show_ip_bgp_instance_peer_groups
,
11619 show_ip_bgp_instance_peer_groups_cmd
,
11620 "show ip bgp " BGP_INSTANCE_CMD
" peer-group",
11624 BGP_INSTANCE_HELP_STR
11625 "Detailed information on all BGP peer groups\n")
11627 return bgp_show_peer_group_vty (vty
, argv
[1], show_all_groups
, NULL
);
11630 DEFUN (show_ip_bgp_peer_group
,
11631 show_ip_bgp_peer_group_cmd
,
11632 "show ip bgp peer-group WORD",
11636 "BGP peer-group name\n"
11637 "Detailed information on a BGP peer group\n")
11639 return bgp_show_peer_group_vty (vty
, NULL
, show_peer_group
, argv
[0]);
11642 DEFUN (show_ip_bgp_instance_peer_group
,
11643 show_ip_bgp_instance_peer_group_cmd
,
11644 "show ip bgp " BGP_INSTANCE_CMD
" peer-group WORD",
11648 BGP_INSTANCE_HELP_STR
11649 "BGP peer-group name\n"
11650 "Detailed information on a BGP peer group\n")
11652 return bgp_show_peer_group_vty (vty
, argv
[1], show_peer_group
, argv
[2]);
11655 /* Redistribute VTY commands. */
11657 DEFUN (bgp_redistribute_ipv4
,
11658 bgp_redistribute_ipv4_cmd
,
11659 "redistribute " QUAGGA_IP_REDIST_STR_BGPD
,
11660 "Redistribute information from another routing protocol\n"
11661 QUAGGA_IP_REDIST_HELP_STR_BGPD
)
11665 type
= proto_redistnum (AFI_IP
, argv
[0]);
11666 if (type
< 0 || type
== ZEBRA_ROUTE_BGP
)
11668 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
11669 return CMD_WARNING
;
11671 bgp_redist_add(vty
->index
, AFI_IP
, type
, 0);
11672 return bgp_redistribute_set (vty
->index
, AFI_IP
, type
, 0);
11675 DEFUN (bgp_redistribute_ipv4_rmap
,
11676 bgp_redistribute_ipv4_rmap_cmd
,
11677 "redistribute " QUAGGA_IP_REDIST_STR_BGPD
" route-map WORD",
11678 "Redistribute information from another routing protocol\n"
11679 QUAGGA_IP_REDIST_HELP_STR_BGPD
11680 "Route map reference\n"
11681 "Pointer to route-map entries\n")
11684 struct bgp_redist
*red
;
11686 type
= proto_redistnum (AFI_IP
, argv
[0]);
11687 if (type
< 0 || type
== ZEBRA_ROUTE_BGP
)
11689 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
11690 return CMD_WARNING
;
11693 red
= bgp_redist_add(vty
->index
, AFI_IP
, type
, 0);
11694 bgp_redistribute_rmap_set (red
, argv
[1]);
11695 return bgp_redistribute_set (vty
->index
, AFI_IP
, type
, 0);
11698 DEFUN (bgp_redistribute_ipv4_metric
,
11699 bgp_redistribute_ipv4_metric_cmd
,
11700 "redistribute " QUAGGA_IP_REDIST_STR_BGPD
" metric <0-4294967295>",
11701 "Redistribute information from another routing protocol\n"
11702 QUAGGA_IP_REDIST_HELP_STR_BGPD
11703 "Metric for redistributed routes\n"
11704 "Default metric\n")
11708 struct bgp_redist
*red
;
11710 type
= proto_redistnum (AFI_IP
, argv
[0]);
11711 if (type
< 0 || type
== ZEBRA_ROUTE_BGP
)
11713 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
11714 return CMD_WARNING
;
11716 VTY_GET_INTEGER ("metric", metric
, argv
[1]);
11718 red
= bgp_redist_add(vty
->index
, AFI_IP
, type
, 0);
11719 bgp_redistribute_metric_set(vty
->index
, red
, AFI_IP
, type
, metric
);
11720 return bgp_redistribute_set (vty
->index
, AFI_IP
, type
, 0);
11723 DEFUN (bgp_redistribute_ipv4_rmap_metric
,
11724 bgp_redistribute_ipv4_rmap_metric_cmd
,
11725 "redistribute " QUAGGA_IP_REDIST_STR_BGPD
" route-map WORD metric <0-4294967295>",
11726 "Redistribute information from another routing protocol\n"
11727 QUAGGA_IP_REDIST_HELP_STR_BGPD
11728 "Route map reference\n"
11729 "Pointer to route-map entries\n"
11730 "Metric for redistributed routes\n"
11731 "Default metric\n")
11735 struct bgp_redist
*red
;
11737 type
= proto_redistnum (AFI_IP
, argv
[0]);
11738 if (type
< 0 || type
== ZEBRA_ROUTE_BGP
)
11740 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
11741 return CMD_WARNING
;
11743 VTY_GET_INTEGER ("metric", metric
, argv
[2]);
11745 red
= bgp_redist_add(vty
->index
, AFI_IP
, type
, 0);
11746 bgp_redistribute_rmap_set (red
, argv
[1]);
11747 bgp_redistribute_metric_set(vty
->index
, red
, AFI_IP
, type
, metric
);
11748 return bgp_redistribute_set (vty
->index
, AFI_IP
, type
, 0);
11751 DEFUN (bgp_redistribute_ipv4_metric_rmap
,
11752 bgp_redistribute_ipv4_metric_rmap_cmd
,
11753 "redistribute " QUAGGA_IP_REDIST_STR_BGPD
" metric <0-4294967295> route-map WORD",
11754 "Redistribute information from another routing protocol\n"
11755 QUAGGA_IP_REDIST_HELP_STR_BGPD
11756 "Metric for redistributed routes\n"
11758 "Route map reference\n"
11759 "Pointer to route-map entries\n")
11763 struct bgp_redist
*red
;
11765 type
= proto_redistnum (AFI_IP
, argv
[0]);
11766 if (type
< 0 || type
== ZEBRA_ROUTE_BGP
)
11768 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
11769 return CMD_WARNING
;
11771 VTY_GET_INTEGER ("metric", metric
, argv
[1]);
11773 red
= bgp_redist_add(vty
->index
, AFI_IP
, type
, 0);
11774 bgp_redistribute_metric_set(vty
->index
, red
, AFI_IP
, type
, metric
);
11775 bgp_redistribute_rmap_set (red
, argv
[2]);
11776 return bgp_redistribute_set (vty
->index
, AFI_IP
, type
, 0);
11779 DEFUN (bgp_redistribute_ipv4_ospf
,
11780 bgp_redistribute_ipv4_ospf_cmd
,
11781 "redistribute (ospf|table) <1-65535>",
11782 "Redistribute information from another routing protocol\n"
11783 "Open Shortest Path First (OSPFv2)\n"
11784 "Non-main Kernel Routing Table\n"
11785 "Instance ID/Table ID\n")
11790 VTY_GET_INTEGER ("Instance ID", instance
, argv
[1]);
11792 if (strncmp(argv
[0], "o", 1) == 0)
11793 protocol
= ZEBRA_ROUTE_OSPF
;
11795 protocol
= ZEBRA_ROUTE_TABLE
;
11797 bgp_redist_add(vty
->index
, AFI_IP
, protocol
, instance
);
11798 return bgp_redistribute_set (vty
->index
, AFI_IP
, protocol
, instance
);
11801 DEFUN (bgp_redistribute_ipv4_ospf_rmap
,
11802 bgp_redistribute_ipv4_ospf_rmap_cmd
,
11803 "redistribute (ospf|table) <1-65535> route-map WORD",
11804 "Redistribute information from another routing protocol\n"
11805 "Open Shortest Path First (OSPFv2)\n"
11806 "Non-main Kernel Routing Table\n"
11807 "Instance ID/Table ID\n"
11808 "Route map reference\n"
11809 "Pointer to route-map entries\n")
11811 struct bgp_redist
*red
;
11815 if (strncmp(argv
[0], "o", 1) == 0)
11816 protocol
= ZEBRA_ROUTE_OSPF
;
11818 protocol
= ZEBRA_ROUTE_TABLE
;
11820 VTY_GET_INTEGER ("Instance ID", instance
, argv
[1]);
11821 red
= bgp_redist_add(vty
->index
, AFI_IP
, protocol
, instance
);
11822 bgp_redistribute_rmap_set (red
, argv
[2]);
11823 return bgp_redistribute_set (vty
->index
, AFI_IP
, protocol
, instance
);
11826 DEFUN (bgp_redistribute_ipv4_ospf_metric
,
11827 bgp_redistribute_ipv4_ospf_metric_cmd
,
11828 "redistribute (ospf|table) <1-65535> metric <0-4294967295>",
11829 "Redistribute information from another routing protocol\n"
11830 "Open Shortest Path First (OSPFv2)\n"
11831 "Non-main Kernel Routing Table\n"
11832 "Instance ID/Table ID\n"
11833 "Metric for redistributed routes\n"
11834 "Default metric\n")
11837 struct bgp_redist
*red
;
11841 if (strncmp(argv
[0], "o", 1) == 0)
11842 protocol
= ZEBRA_ROUTE_OSPF
;
11844 protocol
= ZEBRA_ROUTE_TABLE
;
11846 VTY_GET_INTEGER ("Instance ID", instance
, argv
[1]);
11847 VTY_GET_INTEGER ("metric", metric
, argv
[2]);
11849 red
= bgp_redist_add(vty
->index
, AFI_IP
, protocol
, instance
);
11850 bgp_redistribute_metric_set(vty
->index
, red
, AFI_IP
, protocol
, metric
);
11851 return bgp_redistribute_set (vty
->index
, AFI_IP
, protocol
, instance
);
11854 DEFUN (bgp_redistribute_ipv4_ospf_rmap_metric
,
11855 bgp_redistribute_ipv4_ospf_rmap_metric_cmd
,
11856 "redistribute (ospf|table) <1-65535> route-map WORD metric <0-4294967295>",
11857 "Redistribute information from another routing protocol\n"
11858 "Open Shortest Path First (OSPFv2)\n"
11859 "Non-main Kernel Routing Table\n"
11860 "Instance ID/Table ID\n"
11861 "Route map reference\n"
11862 "Pointer to route-map entries\n"
11863 "Metric for redistributed routes\n"
11864 "Default metric\n")
11867 struct bgp_redist
*red
;
11871 if (strncmp(argv
[0], "o", 1) == 0)
11872 protocol
= ZEBRA_ROUTE_OSPF
;
11874 protocol
= ZEBRA_ROUTE_TABLE
;
11876 VTY_GET_INTEGER ("Instance ID", instance
, argv
[1]);
11877 VTY_GET_INTEGER ("metric", metric
, argv
[3]);
11879 red
= bgp_redist_add(vty
->index
, AFI_IP
, protocol
, instance
);
11880 bgp_redistribute_rmap_set (red
, argv
[2]);
11881 bgp_redistribute_metric_set(vty
->index
, red
, AFI_IP
, protocol
, metric
);
11882 return bgp_redistribute_set (vty
->index
, AFI_IP
, protocol
, instance
);
11885 DEFUN (bgp_redistribute_ipv4_ospf_metric_rmap
,
11886 bgp_redistribute_ipv4_ospf_metric_rmap_cmd
,
11887 "redistribute (ospf|table) <1-65535> metric <0-4294967295> route-map WORD",
11888 "Redistribute information from another routing protocol\n"
11889 "Open Shortest Path First (OSPFv2)\n"
11890 "Non-main Kernel Routing Table\n"
11891 "Instance ID/Table ID\n"
11892 "Metric for redistributed routes\n"
11894 "Route map reference\n"
11895 "Pointer to route-map entries\n")
11898 struct bgp_redist
*red
;
11902 if (strncmp(argv
[0], "o", 1) == 0)
11903 protocol
= ZEBRA_ROUTE_OSPF
;
11905 protocol
= ZEBRA_ROUTE_TABLE
;
11907 VTY_GET_INTEGER ("Instance ID", instance
, argv
[1]);
11908 VTY_GET_INTEGER ("metric", metric
, argv
[2]);
11910 red
= bgp_redist_add(vty
->index
, AFI_IP
, protocol
, instance
);
11911 bgp_redistribute_metric_set(vty
->index
, red
, AFI_IP
, protocol
, metric
);
11912 bgp_redistribute_rmap_set (red
, argv
[3]);
11913 return bgp_redistribute_set (vty
->index
, AFI_IP
, protocol
, instance
);
11916 DEFUN (no_bgp_redistribute_ipv4_ospf
,
11917 no_bgp_redistribute_ipv4_ospf_cmd
,
11918 "no redistribute (ospf|table) <1-65535>",
11920 "Redistribute information from another routing protocol\n"
11921 "Open Shortest Path First (OSPFv2)\n"
11922 "Non-main Kernel Routing Table\n"
11923 "Instance ID/Table ID\n")
11928 if (strncmp(argv
[0], "o", 1) == 0)
11929 protocol
= ZEBRA_ROUTE_OSPF
;
11931 protocol
= ZEBRA_ROUTE_TABLE
;
11933 VTY_GET_INTEGER ("Instance ID", instance
, argv
[1]);
11934 return bgp_redistribute_unset (vty
->index
, AFI_IP
, protocol
, instance
);
11937 ALIAS (no_bgp_redistribute_ipv4_ospf
,
11938 no_bgp_redistribute_ipv4_ospf_rmap_cmd
,
11939 "no redistribute (ospf|table) <1-65535> route-map WORD",
11941 "Redistribute information from another routing protocol\n"
11942 "Open Shortest Path First (OSPFv2)\n"
11943 "Non-main Kernel Routing Table\n"
11944 "Instance ID/Table ID\n"
11945 "Route map reference\n"
11946 "Pointer to route-map entries\n")
11948 ALIAS (no_bgp_redistribute_ipv4_ospf
,
11949 no_bgp_redistribute_ipv4_ospf_metric_cmd
,
11950 "no redistribute (ospf|table) <1-65535> metric <0-4294967295>",
11952 "Redistribute information from another routing protocol\n"
11953 "Open Shortest Path First (OSPFv2)\n"
11954 "Non-main Kernel Routing Table\n"
11955 "Instance ID/Table ID\n"
11956 "Metric for redistributed routes\n"
11957 "Default metric\n")
11959 ALIAS (no_bgp_redistribute_ipv4_ospf
,
11960 no_bgp_redistribute_ipv4_ospf_rmap_metric_cmd
,
11961 "no redistribute (ospf|table) <1-65535> route-map WORD metric <0-4294967295>",
11963 "Redistribute information from another routing protocol\n"
11964 "Open Shortest Path First (OSPFv2)\n"
11965 "Non-main Kernel Routing Table\n"
11966 "Instance ID/Table ID\n"
11967 "Route map reference\n"
11968 "Pointer to route-map entries\n"
11969 "Metric for redistributed routes\n"
11970 "Default metric\n")
11972 ALIAS (no_bgp_redistribute_ipv4_ospf
,
11973 no_bgp_redistribute_ipv4_ospf_metric_rmap_cmd
,
11974 "no redistribute (ospf|table) <1-65535> metric <0-4294967295> route-map WORD",
11976 "Redistribute information from another routing protocol\n"
11977 "Open Shortest Path First (OSPFv2)\n"
11978 "Non-main Kernel Routing Table\n"
11979 "Instance ID/Table ID\n"
11980 "Metric for redistributed routes\n"
11982 "Route map reference\n"
11983 "Pointer to route-map entries\n")
11985 DEFUN (no_bgp_redistribute_ipv4
,
11986 no_bgp_redistribute_ipv4_cmd
,
11987 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD
,
11989 "Redistribute information from another routing protocol\n"
11990 QUAGGA_IP_REDIST_HELP_STR_BGPD
)
11994 type
= proto_redistnum (AFI_IP
, argv
[0]);
11995 if (type
< 0 || type
== ZEBRA_ROUTE_BGP
)
11997 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
11998 return CMD_WARNING
;
12000 return bgp_redistribute_unset (vty
->index
, AFI_IP
, type
, 0);
12003 ALIAS (no_bgp_redistribute_ipv4
,
12004 no_bgp_redistribute_ipv4_rmap_cmd
,
12005 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD
" route-map WORD",
12007 "Redistribute information from another routing protocol\n"
12008 QUAGGA_IP_REDIST_HELP_STR_BGPD
12009 "Route map reference\n"
12010 "Pointer to route-map entries\n")
12012 ALIAS (no_bgp_redistribute_ipv4
,
12013 no_bgp_redistribute_ipv4_metric_cmd
,
12014 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD
" metric <0-4294967295>",
12016 "Redistribute information from another routing protocol\n"
12017 QUAGGA_IP_REDIST_HELP_STR_BGPD
12018 "Metric for redistributed routes\n"
12019 "Default metric\n")
12021 ALIAS (no_bgp_redistribute_ipv4
,
12022 no_bgp_redistribute_ipv4_rmap_metric_cmd
,
12023 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD
" route-map WORD metric <0-4294967295>",
12025 "Redistribute information from another routing protocol\n"
12026 QUAGGA_IP_REDIST_HELP_STR_BGPD
12027 "Route map reference\n"
12028 "Pointer to route-map entries\n"
12029 "Metric for redistributed routes\n"
12030 "Default metric\n")
12032 ALIAS (no_bgp_redistribute_ipv4
,
12033 no_bgp_redistribute_ipv4_metric_rmap_cmd
,
12034 "no redistribute " QUAGGA_IP_REDIST_STR_BGPD
" metric <0-4294967295> route-map WORD",
12036 "Redistribute information from another routing protocol\n"
12037 QUAGGA_IP_REDIST_HELP_STR_BGPD
12038 "Metric for redistributed routes\n"
12040 "Route map reference\n"
12041 "Pointer to route-map entries\n")
12044 DEFUN (bgp_redistribute_ipv6
,
12045 bgp_redistribute_ipv6_cmd
,
12046 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD
,
12047 "Redistribute information from another routing protocol\n"
12048 QUAGGA_IP6_REDIST_HELP_STR_BGPD
)
12052 type
= proto_redistnum (AFI_IP6
, argv
[0]);
12053 if (type
< 0 || type
== ZEBRA_ROUTE_BGP
)
12055 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
12056 return CMD_WARNING
;
12059 bgp_redist_add(vty
->index
, AFI_IP6
, type
, 0);
12060 return bgp_redistribute_set (vty
->index
, AFI_IP6
, type
, 0);
12063 DEFUN (bgp_redistribute_ipv6_rmap
,
12064 bgp_redistribute_ipv6_rmap_cmd
,
12065 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD
" route-map WORD",
12066 "Redistribute information from another routing protocol\n"
12067 QUAGGA_IP6_REDIST_HELP_STR_BGPD
12068 "Route map reference\n"
12069 "Pointer to route-map entries\n")
12072 struct bgp_redist
*red
;
12074 type
= proto_redistnum (AFI_IP6
, argv
[0]);
12075 if (type
< 0 || type
== ZEBRA_ROUTE_BGP
)
12077 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
12078 return CMD_WARNING
;
12081 red
= bgp_redist_add(vty
->index
, AFI_IP6
, type
, 0);
12082 bgp_redistribute_rmap_set (red
, argv
[1]);
12083 return bgp_redistribute_set (vty
->index
, AFI_IP6
, type
, 0);
12086 DEFUN (bgp_redistribute_ipv6_metric
,
12087 bgp_redistribute_ipv6_metric_cmd
,
12088 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD
" metric <0-4294967295>",
12089 "Redistribute information from another routing protocol\n"
12090 QUAGGA_IP6_REDIST_HELP_STR_BGPD
12091 "Metric for redistributed routes\n"
12092 "Default metric\n")
12096 struct bgp_redist
*red
;
12098 type
= proto_redistnum (AFI_IP6
, argv
[0]);
12099 if (type
< 0 || type
== ZEBRA_ROUTE_BGP
)
12101 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
12102 return CMD_WARNING
;
12104 VTY_GET_INTEGER ("metric", metric
, argv
[1]);
12106 red
= bgp_redist_add(vty
->index
, AFI_IP6
, type
, 0);
12107 bgp_redistribute_metric_set(vty
->index
, red
, AFI_IP6
, type
, metric
);
12108 return bgp_redistribute_set (vty
->index
, AFI_IP6
, type
, 0);
12111 DEFUN (bgp_redistribute_ipv6_rmap_metric
,
12112 bgp_redistribute_ipv6_rmap_metric_cmd
,
12113 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD
" route-map WORD metric <0-4294967295>",
12114 "Redistribute information from another routing protocol\n"
12115 QUAGGA_IP6_REDIST_HELP_STR_BGPD
12116 "Route map reference\n"
12117 "Pointer to route-map entries\n"
12118 "Metric for redistributed routes\n"
12119 "Default metric\n")
12123 struct bgp_redist
*red
;
12125 type
= proto_redistnum (AFI_IP6
, argv
[0]);
12126 if (type
< 0 || type
== ZEBRA_ROUTE_BGP
)
12128 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
12129 return CMD_WARNING
;
12131 VTY_GET_INTEGER ("metric", metric
, argv
[2]);
12133 red
= bgp_redist_add(vty
->index
, AFI_IP6
, type
, 0);
12134 bgp_redistribute_rmap_set (red
, argv
[1]);
12135 bgp_redistribute_metric_set(vty
->index
, red
, AFI_IP6
, type
, metric
);
12136 return bgp_redistribute_set (vty
->index
, AFI_IP6
, type
, 0);
12139 DEFUN (bgp_redistribute_ipv6_metric_rmap
,
12140 bgp_redistribute_ipv6_metric_rmap_cmd
,
12141 "redistribute " QUAGGA_IP6_REDIST_STR_BGPD
" metric <0-4294967295> route-map WORD",
12142 "Redistribute information from another routing protocol\n"
12143 QUAGGA_IP6_REDIST_HELP_STR_BGPD
12144 "Metric for redistributed routes\n"
12146 "Route map reference\n"
12147 "Pointer to route-map entries\n")
12151 struct bgp_redist
*red
;
12153 type
= proto_redistnum (AFI_IP6
, argv
[0]);
12154 if (type
< 0 || type
== ZEBRA_ROUTE_BGP
)
12156 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
12157 return CMD_WARNING
;
12159 VTY_GET_INTEGER ("metric", metric
, argv
[1]);
12161 red
= bgp_redist_add(vty
->index
, AFI_IP6
, type
, 0);
12162 bgp_redistribute_metric_set(vty
->index
, red
, AFI_IP6
, SAFI_UNICAST
, metric
);
12163 bgp_redistribute_rmap_set (red
, argv
[2]);
12164 return bgp_redistribute_set (vty
->index
, AFI_IP6
, type
, 0);
12167 DEFUN (no_bgp_redistribute_ipv6
,
12168 no_bgp_redistribute_ipv6_cmd
,
12169 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD
,
12171 "Redistribute information from another routing protocol\n"
12172 QUAGGA_IP6_REDIST_HELP_STR_BGPD
)
12176 type
= proto_redistnum (AFI_IP6
, argv
[0]);
12177 if (type
< 0 || type
== ZEBRA_ROUTE_BGP
)
12179 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
12180 return CMD_WARNING
;
12183 return bgp_redistribute_unset (vty
->index
, AFI_IP6
, type
, 0);
12186 ALIAS (no_bgp_redistribute_ipv6
,
12187 no_bgp_redistribute_ipv6_rmap_cmd
,
12188 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD
" route-map WORD",
12190 "Redistribute information from another routing protocol\n"
12191 QUAGGA_IP6_REDIST_HELP_STR_BGPD
12192 "Route map reference\n"
12193 "Pointer to route-map entries\n")
12195 ALIAS (no_bgp_redistribute_ipv6
,
12196 no_bgp_redistribute_ipv6_metric_cmd
,
12197 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD
" metric <0-4294967295>",
12199 "Redistribute information from another routing protocol\n"
12200 QUAGGA_IP6_REDIST_HELP_STR_BGPD
12201 "Metric for redistributed routes\n"
12202 "Default metric\n")
12204 ALIAS (no_bgp_redistribute_ipv6
,
12205 no_bgp_redistribute_ipv6_rmap_metric_cmd
,
12206 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD
" route-map WORD metric <0-4294967295>",
12208 "Redistribute information from another routing protocol\n"
12209 QUAGGA_IP6_REDIST_HELP_STR_BGPD
12210 "Route map reference\n"
12211 "Pointer to route-map entries\n"
12212 "Metric for redistributed routes\n"
12213 "Default metric\n")
12215 ALIAS (no_bgp_redistribute_ipv6
,
12216 no_bgp_redistribute_ipv6_metric_rmap_cmd
,
12217 "no redistribute " QUAGGA_IP6_REDIST_STR_BGPD
" metric <0-4294967295> route-map WORD",
12219 "Redistribute information from another routing protocol\n"
12220 QUAGGA_IP6_REDIST_HELP_STR_BGPD
12221 "Metric for redistributed routes\n"
12223 "Route map reference\n"
12224 "Pointer to route-map entries\n")
12225 #endif /* HAVE_IPV6 */
12228 bgp_config_write_redistribute (struct vty
*vty
, struct bgp
*bgp
, afi_t afi
,
12229 safi_t safi
, int *write
)
12233 /* Unicast redistribution only. */
12234 if (safi
!= SAFI_UNICAST
)
12237 for (i
= 0; i
< ZEBRA_ROUTE_MAX
; i
++)
12239 /* Redistribute BGP does not make sense. */
12240 if (i
!= ZEBRA_ROUTE_BGP
)
12242 struct list
*red_list
;
12243 struct listnode
*node
;
12244 struct bgp_redist
*red
;
12246 red_list
= bgp
->redist
[afi
][i
];
12250 for (ALL_LIST_ELEMENTS_RO(red_list
, node
, red
))
12252 /* Display "address-family" when it is not yet diplayed. */
12253 bgp_config_write_family_header (vty
, afi
, safi
, write
);
12255 /* "redistribute" configuration. */
12256 vty_out (vty
, " redistribute %s", zebra_route_string(i
));
12258 vty_out (vty
, " %d", red
->instance
);
12259 if (red
->redist_metric_flag
)
12260 vty_out (vty
, " metric %u", red
->redist_metric
);
12261 if (red
->rmap
.name
)
12262 vty_out (vty
, " route-map %s", red
->rmap
.name
);
12263 vty_out (vty
, "%s", VTY_NEWLINE
);
12270 /* BGP node structure. */
12271 static struct cmd_node bgp_node
=
12274 "%s(config-router)# ",
12278 static struct cmd_node bgp_ipv4_unicast_node
=
12281 "%s(config-router-af)# ",
12285 static struct cmd_node bgp_ipv4_multicast_node
=
12288 "%s(config-router-af)# ",
12292 static struct cmd_node bgp_ipv6_unicast_node
=
12295 "%s(config-router-af)# ",
12299 static struct cmd_node bgp_ipv6_multicast_node
=
12302 "%s(config-router-af)# ",
12306 static struct cmd_node bgp_vpnv4_node
=
12309 "%s(config-router-af)# ",
12313 static void community_list_vty (void);
12316 bgp_vty_init (void)
12318 /* Install bgp top node. */
12319 install_node (&bgp_node
, bgp_config_write
);
12320 install_node (&bgp_ipv4_unicast_node
, NULL
);
12321 install_node (&bgp_ipv4_multicast_node
, NULL
);
12322 install_node (&bgp_ipv6_unicast_node
, NULL
);
12323 install_node (&bgp_ipv6_multicast_node
, NULL
);
12324 install_node (&bgp_vpnv4_node
, NULL
);
12326 /* Install default VTY commands to new nodes. */
12327 install_default (BGP_NODE
);
12328 install_default (BGP_IPV4_NODE
);
12329 install_default (BGP_IPV4M_NODE
);
12330 install_default (BGP_IPV6_NODE
);
12331 install_default (BGP_IPV6M_NODE
);
12332 install_default (BGP_VPNV4_NODE
);
12334 /* "bgp multiple-instance" commands. */
12335 install_element (CONFIG_NODE
, &bgp_multiple_instance_cmd
);
12336 install_element (CONFIG_NODE
, &no_bgp_multiple_instance_cmd
);
12338 /* "bgp config-type" commands. */
12339 install_element (CONFIG_NODE
, &bgp_config_type_cmd
);
12340 install_element (CONFIG_NODE
, &no_bgp_config_type_val_cmd
);
12342 /* Dummy commands (Currently not supported) */
12343 install_element (BGP_NODE
, &no_synchronization_cmd
);
12344 install_element (BGP_NODE
, &no_auto_summary_cmd
);
12346 /* "router bgp" commands. */
12347 install_element (CONFIG_NODE
, &router_bgp_cmd
);
12348 install_element (CONFIG_NODE
, &router_bgp_instance_cmd
);
12349 install_element (CONFIG_NODE
, &router_bgp_noasn_cmd
);
12351 /* "no router bgp" commands. */
12352 install_element (CONFIG_NODE
, &no_router_bgp_cmd
);
12353 install_element (CONFIG_NODE
, &no_router_bgp_instance_cmd
);
12355 /* "bgp router-id" commands. */
12356 install_element (BGP_NODE
, &bgp_router_id_cmd
);
12357 install_element (BGP_NODE
, &no_bgp_router_id_cmd
);
12358 install_element (BGP_NODE
, &no_bgp_router_id_val_cmd
);
12360 /* "bgp cluster-id" commands. */
12361 install_element (BGP_NODE
, &bgp_cluster_id_cmd
);
12362 install_element (BGP_NODE
, &bgp_cluster_id32_cmd
);
12363 install_element (BGP_NODE
, &no_bgp_cluster_id_cmd
);
12364 install_element (BGP_NODE
, &no_bgp_cluster_id_ip_cmd
);
12365 install_element (BGP_NODE
, &no_bgp_cluster_id_decimal_cmd
);
12367 /* "bgp confederation" commands. */
12368 install_element (BGP_NODE
, &bgp_confederation_identifier_cmd
);
12369 install_element (BGP_NODE
, &no_bgp_confederation_identifier_cmd
);
12370 install_element (BGP_NODE
, &no_bgp_confederation_identifier_arg_cmd
);
12372 /* "bgp confederation peers" commands. */
12373 install_element (BGP_NODE
, &bgp_confederation_peers_cmd
);
12374 install_element (BGP_NODE
, &no_bgp_confederation_peers_cmd
);
12376 /* bgp max-med command */
12377 install_element (BGP_NODE
, &bgp_maxmed_admin_cmd
);
12378 install_element (BGP_NODE
, &no_bgp_maxmed_admin_cmd
);
12379 install_element (BGP_NODE
, &bgp_maxmed_admin_medv_cmd
);
12380 install_element (BGP_NODE
, &no_bgp_maxmed_admin_medv_cmd
);
12381 install_element (BGP_NODE
, &bgp_maxmed_onstartup_cmd
);
12382 install_element (BGP_NODE
, &no_bgp_maxmed_onstartup_cmd
);
12383 install_element (BGP_NODE
, &no_bgp_maxmed_onstartup_period_cmd
);
12384 install_element (BGP_NODE
, &bgp_maxmed_onstartup_medv_cmd
);
12385 install_element (BGP_NODE
, &no_bgp_maxmed_onstartup_period_medv_cmd
);
12387 /* bgp disable-ebgp-connected-nh-check */
12388 install_element (BGP_NODE
, &bgp_disable_connected_route_check_cmd
);
12389 install_element (BGP_NODE
, &no_bgp_disable_connected_route_check_cmd
);
12391 /* bgp update-delay command */
12392 install_element (BGP_NODE
, &bgp_update_delay_cmd
);
12393 install_element (BGP_NODE
, &no_bgp_update_delay_cmd
);
12394 install_element (BGP_NODE
, &bgp_update_delay_establish_wait_cmd
);
12395 install_element (BGP_NODE
, &no_bgp_update_delay_establish_wait_cmd
);
12397 install_element (BGP_NODE
, &bgp_wpkt_quanta_cmd
);
12398 install_element (BGP_NODE
, &no_bgp_wpkt_quanta_cmd
);
12400 install_element (BGP_NODE
, &bgp_coalesce_time_cmd
);
12401 install_element (BGP_NODE
, &no_bgp_coalesce_time_cmd
);
12403 /* "maximum-paths" commands. */
12404 install_element (BGP_NODE
, &bgp_maxpaths_cmd
);
12405 install_element (BGP_NODE
, &no_bgp_maxpaths_cmd
);
12406 install_element (BGP_NODE
, &no_bgp_maxpaths_arg_cmd
);
12407 install_element (BGP_IPV4_NODE
, &bgp_maxpaths_cmd
);
12408 install_element (BGP_IPV4_NODE
, &no_bgp_maxpaths_cmd
);
12409 install_element (BGP_IPV4_NODE
, &no_bgp_maxpaths_arg_cmd
);
12410 install_element (BGP_IPV6_NODE
, &bgp_maxpaths_cmd
);
12411 install_element (BGP_IPV6_NODE
, &no_bgp_maxpaths_cmd
);
12412 install_element (BGP_IPV6_NODE
, &no_bgp_maxpaths_arg_cmd
);
12413 install_element (BGP_NODE
, &bgp_maxpaths_ibgp_cmd
);
12414 install_element(BGP_NODE
, &bgp_maxpaths_ibgp_cluster_cmd
);
12415 install_element (BGP_NODE
, &no_bgp_maxpaths_ibgp_cmd
);
12416 install_element (BGP_NODE
, &no_bgp_maxpaths_ibgp_arg_cmd
);
12417 install_element (BGP_NODE
, &no_bgp_maxpaths_ibgp_cluster_cmd
);
12418 install_element (BGP_IPV4_NODE
, &bgp_maxpaths_ibgp_cmd
);
12419 install_element(BGP_IPV4_NODE
, &bgp_maxpaths_ibgp_cluster_cmd
);
12420 install_element (BGP_IPV4_NODE
, &no_bgp_maxpaths_ibgp_cmd
);
12421 install_element (BGP_IPV4_NODE
, &no_bgp_maxpaths_ibgp_cluster_cmd
);
12422 install_element (BGP_IPV4_NODE
, &no_bgp_maxpaths_ibgp_arg_cmd
);
12423 install_element (BGP_IPV6_NODE
, &bgp_maxpaths_ibgp_cmd
);
12424 install_element(BGP_IPV6_NODE
, &bgp_maxpaths_ibgp_cluster_cmd
);
12425 install_element (BGP_IPV6_NODE
, &no_bgp_maxpaths_ibgp_cmd
);
12426 install_element (BGP_IPV6_NODE
, &no_bgp_maxpaths_ibgp_arg_cmd
);
12427 install_element (BGP_IPV6_NODE
, &no_bgp_maxpaths_ibgp_cluster_cmd
);
12429 /* "timers bgp" commands. */
12430 install_element (BGP_NODE
, &bgp_timers_cmd
);
12431 install_element (BGP_NODE
, &no_bgp_timers_cmd
);
12432 install_element (BGP_NODE
, &no_bgp_timers_arg_cmd
);
12434 /* route-map delay-timer commands */
12435 install_element (BGP_NODE
, &bgp_set_route_map_delay_timer_cmd
);
12436 install_element (BGP_NODE
, &no_bgp_set_route_map_delay_timer_cmd
);
12437 install_element (BGP_NODE
, &no_bgp_set_route_map_delay_timer_val_cmd
);
12439 /* "bgp client-to-client reflection" commands */
12440 install_element (BGP_NODE
, &no_bgp_client_to_client_reflection_cmd
);
12441 install_element (BGP_NODE
, &bgp_client_to_client_reflection_cmd
);
12443 /* "bgp always-compare-med" commands */
12444 install_element (BGP_NODE
, &bgp_always_compare_med_cmd
);
12445 install_element (BGP_NODE
, &no_bgp_always_compare_med_cmd
);
12447 /* "bgp deterministic-med" commands */
12448 install_element (BGP_NODE
, &bgp_deterministic_med_cmd
);
12449 install_element (BGP_NODE
, &no_bgp_deterministic_med_cmd
);
12451 /* "bgp graceful-restart" commands */
12452 install_element (BGP_NODE
, &bgp_graceful_restart_cmd
);
12453 install_element (BGP_NODE
, &no_bgp_graceful_restart_cmd
);
12454 install_element (BGP_NODE
, &bgp_graceful_restart_stalepath_time_cmd
);
12455 install_element (BGP_NODE
, &no_bgp_graceful_restart_stalepath_time_cmd
);
12456 install_element (BGP_NODE
, &no_bgp_graceful_restart_stalepath_time_val_cmd
);
12458 /* "bgp fast-external-failover" commands */
12459 install_element (BGP_NODE
, &bgp_fast_external_failover_cmd
);
12460 install_element (BGP_NODE
, &no_bgp_fast_external_failover_cmd
);
12462 /* "bgp enforce-first-as" commands */
12463 install_element (BGP_NODE
, &bgp_enforce_first_as_cmd
);
12464 install_element (BGP_NODE
, &no_bgp_enforce_first_as_cmd
);
12466 /* "bgp bestpath compare-routerid" commands */
12467 install_element (BGP_NODE
, &bgp_bestpath_compare_router_id_cmd
);
12468 install_element (BGP_NODE
, &no_bgp_bestpath_compare_router_id_cmd
);
12470 /* "bgp bestpath as-path ignore" commands */
12471 install_element (BGP_NODE
, &bgp_bestpath_aspath_ignore_cmd
);
12472 install_element (BGP_NODE
, &no_bgp_bestpath_aspath_ignore_cmd
);
12474 /* "bgp bestpath as-path confed" commands */
12475 install_element (BGP_NODE
, &bgp_bestpath_aspath_confed_cmd
);
12476 install_element (BGP_NODE
, &no_bgp_bestpath_aspath_confed_cmd
);
12478 /* "bgp bestpath as-path multipath-relax" commands */
12479 install_element (BGP_NODE
, &bgp_bestpath_aspath_multipath_relax_cmd
);
12480 install_element (BGP_NODE
, &no_bgp_bestpath_aspath_multipath_relax_cmd
);
12482 /* "bgp log-neighbor-changes" commands */
12483 install_element (BGP_NODE
, &bgp_log_neighbor_changes_cmd
);
12484 install_element (BGP_NODE
, &no_bgp_log_neighbor_changes_cmd
);
12486 /* "bgp bestpath med" commands */
12487 install_element (BGP_NODE
, &bgp_bestpath_med_cmd
);
12488 install_element (BGP_NODE
, &bgp_bestpath_med2_cmd
);
12489 install_element (BGP_NODE
, &bgp_bestpath_med3_cmd
);
12490 install_element (BGP_NODE
, &no_bgp_bestpath_med_cmd
);
12491 install_element (BGP_NODE
, &no_bgp_bestpath_med2_cmd
);
12492 install_element (BGP_NODE
, &no_bgp_bestpath_med3_cmd
);
12494 /* "no bgp default ipv4-unicast" commands. */
12495 install_element (BGP_NODE
, &no_bgp_default_ipv4_unicast_cmd
);
12496 install_element (BGP_NODE
, &bgp_default_ipv4_unicast_cmd
);
12498 /* "bgp network import-check" commands. */
12499 install_element (BGP_NODE
, &bgp_network_import_check_cmd
);
12500 install_element (BGP_NODE
, &no_bgp_network_import_check_cmd
);
12502 /* "bgp default local-preference" commands. */
12503 install_element (BGP_NODE
, &bgp_default_local_preference_cmd
);
12504 install_element (BGP_NODE
, &no_bgp_default_local_preference_cmd
);
12505 install_element (BGP_NODE
, &no_bgp_default_local_preference_val_cmd
);
12507 /* bgp default show-hostname */
12508 install_element (BGP_NODE
, &bgp_default_show_hostname_cmd
);
12509 install_element (BGP_NODE
, &no_bgp_default_show_hostname_cmd
);
12511 /* "bgp default subgroup-pkt-queue-max" commands. */
12512 install_element (BGP_NODE
, &bgp_default_subgroup_pkt_queue_max_cmd
);
12513 install_element (BGP_NODE
, &no_bgp_default_subgroup_pkt_queue_max_cmd
);
12514 install_element (BGP_NODE
, &no_bgp_default_subgroup_pkt_queue_max_val_cmd
);
12516 /* bgp ibgp-allow-policy-mods command */
12517 install_element (BGP_NODE
, &bgp_rr_allow_outbound_policy_cmd
);
12518 install_element (BGP_NODE
, &no_bgp_rr_allow_outbound_policy_cmd
);
12520 /* "bgp listen limit" commands. */
12521 install_element (BGP_NODE
, &bgp_listen_limit_cmd
);
12522 install_element (BGP_NODE
, &no_bgp_listen_limit_cmd
);
12523 install_element (BGP_NODE
, &no_bgp_listen_limit_val_cmd
);
12525 /* "bgp listen range" commands. */
12526 install_element (BGP_NODE
, &bgp_listen_range_cmd
);
12527 install_element (BGP_NODE
, &no_bgp_listen_range_cmd
);
12529 /* "neighbor remote-as" commands. */
12530 install_element (BGP_NODE
, &neighbor_remote_as_cmd
);
12531 install_element (BGP_NODE
, &neighbor_interface_config_cmd
);
12532 install_element (BGP_NODE
, &neighbor_interface_config_v6only_cmd
);
12533 install_element (BGP_NODE
, &neighbor_interface_config_peergroup_cmd
);
12534 install_element (BGP_NODE
, &neighbor_interface_config_v6only_peergroup_cmd
);
12535 install_element (BGP_NODE
, &no_neighbor_cmd
);
12536 install_element (BGP_NODE
, &no_neighbor_remote_as_cmd
);
12537 install_element (BGP_NODE
, &no_neighbor_interface_config_cmd
);
12538 install_element (BGP_NODE
, &no_neighbor_interface_config_v6only_cmd
);
12539 install_element (BGP_NODE
, &no_neighbor_interface_config_peergroup_cmd
);
12540 install_element (BGP_NODE
, &no_neighbor_interface_config_v6only_peergroup_cmd
);
12542 /* "neighbor peer-group" commands. */
12543 install_element (BGP_NODE
, &neighbor_peer_group_cmd
);
12544 install_element (BGP_NODE
, &no_neighbor_peer_group_cmd
);
12545 install_element (BGP_NODE
, &no_neighbor_interface_peer_group_remote_as_cmd
);
12547 /* "neighbor local-as" commands. */
12548 install_element (BGP_NODE
, &neighbor_local_as_cmd
);
12549 install_element (BGP_NODE
, &neighbor_local_as_no_prepend_cmd
);
12550 install_element (BGP_NODE
, &neighbor_local_as_no_prepend_replace_as_cmd
);
12551 install_element (BGP_NODE
, &no_neighbor_local_as_cmd
);
12552 install_element (BGP_NODE
, &no_neighbor_local_as_val_cmd
);
12553 install_element (BGP_NODE
, &no_neighbor_local_as_val2_cmd
);
12554 install_element (BGP_NODE
, &no_neighbor_local_as_val3_cmd
);
12556 /* "neighbor solo" commands. */
12557 install_element (BGP_NODE
, &neighbor_solo_cmd
);
12558 install_element (BGP_NODE
, &no_neighbor_solo_cmd
);
12560 /* "neighbor password" commands. */
12561 install_element (BGP_NODE
, &neighbor_password_cmd
);
12562 install_element (BGP_NODE
, &no_neighbor_password_cmd
);
12563 install_element (BGP_NODE
, &no_neighbor_password_val_cmd
);
12565 /* "neighbor activate" commands. */
12566 install_element (BGP_NODE
, &neighbor_activate_cmd
);
12567 install_element (BGP_IPV4_NODE
, &neighbor_activate_cmd
);
12568 install_element (BGP_IPV4M_NODE
, &neighbor_activate_cmd
);
12569 install_element (BGP_IPV6_NODE
, &neighbor_activate_cmd
);
12570 install_element (BGP_IPV6M_NODE
, &neighbor_activate_cmd
);
12571 install_element (BGP_VPNV4_NODE
, &neighbor_activate_cmd
);
12573 /* "no neighbor activate" commands. */
12574 install_element (BGP_NODE
, &no_neighbor_activate_cmd
);
12575 install_element (BGP_IPV4_NODE
, &no_neighbor_activate_cmd
);
12576 install_element (BGP_IPV4M_NODE
, &no_neighbor_activate_cmd
);
12577 install_element (BGP_IPV6_NODE
, &no_neighbor_activate_cmd
);
12578 install_element (BGP_IPV6M_NODE
, &no_neighbor_activate_cmd
);
12579 install_element (BGP_VPNV4_NODE
, &no_neighbor_activate_cmd
);
12581 /* "neighbor peer-group" set commands.
12582 * Long term we should only accept this command under BGP_NODE and not all of
12583 * the afi/safi sub-contexts. For now though we need to accept it for backwards
12584 * compatibility. This changed when we stopped requiring that peers be assigned
12585 * to their peer-group under each address-family sub-context.
12587 install_element (BGP_NODE
, &neighbor_set_peer_group_cmd
);
12588 install_element (BGP_IPV4_NODE
, &neighbor_set_peer_group_cmd
);
12589 install_element (BGP_IPV4M_NODE
, &neighbor_set_peer_group_cmd
);
12590 install_element (BGP_IPV6_NODE
, &neighbor_set_peer_group_cmd
);
12591 install_element (BGP_IPV6M_NODE
, &neighbor_set_peer_group_cmd
);
12592 install_element (BGP_VPNV4_NODE
, &neighbor_set_peer_group_cmd
);
12594 /* "no neighbor peer-group unset" commands. */
12595 install_element (BGP_NODE
, &no_neighbor_set_peer_group_cmd
);
12596 install_element (BGP_IPV4_NODE
, &no_neighbor_set_peer_group_cmd
);
12597 install_element (BGP_IPV4M_NODE
, &no_neighbor_set_peer_group_cmd
);
12598 install_element (BGP_IPV6_NODE
, &no_neighbor_set_peer_group_cmd
);
12599 install_element (BGP_IPV6M_NODE
, &no_neighbor_set_peer_group_cmd
);
12600 install_element (BGP_VPNV4_NODE
, &no_neighbor_set_peer_group_cmd
);
12602 /* "neighbor softreconfiguration inbound" commands.*/
12603 install_element (BGP_NODE
, &neighbor_soft_reconfiguration_cmd
);
12604 install_element (BGP_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
12605 install_element (BGP_IPV4_NODE
, &neighbor_soft_reconfiguration_cmd
);
12606 install_element (BGP_IPV4_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
12607 install_element (BGP_IPV4M_NODE
, &neighbor_soft_reconfiguration_cmd
);
12608 install_element (BGP_IPV4M_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
12609 install_element (BGP_IPV6_NODE
, &neighbor_soft_reconfiguration_cmd
);
12610 install_element (BGP_IPV6_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
12611 install_element (BGP_IPV6M_NODE
, &neighbor_soft_reconfiguration_cmd
);
12612 install_element (BGP_IPV6M_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
12613 install_element (BGP_VPNV4_NODE
, &neighbor_soft_reconfiguration_cmd
);
12614 install_element (BGP_VPNV4_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
12616 /* "neighbor attribute-unchanged" commands. */
12617 install_element (BGP_NODE
, &neighbor_attr_unchanged_cmd
);
12618 install_element (BGP_NODE
, &neighbor_attr_unchanged1_cmd
);
12619 install_element (BGP_NODE
, &neighbor_attr_unchanged2_cmd
);
12620 install_element (BGP_NODE
, &neighbor_attr_unchanged3_cmd
);
12621 install_element (BGP_NODE
, &neighbor_attr_unchanged4_cmd
);
12622 install_element (BGP_NODE
, &neighbor_attr_unchanged5_cmd
);
12623 install_element (BGP_NODE
, &neighbor_attr_unchanged6_cmd
);
12624 install_element (BGP_NODE
, &neighbor_attr_unchanged7_cmd
);
12625 install_element (BGP_NODE
, &neighbor_attr_unchanged8_cmd
);
12626 install_element (BGP_NODE
, &neighbor_attr_unchanged9_cmd
);
12627 install_element (BGP_NODE
, &neighbor_attr_unchanged10_cmd
);
12628 install_element (BGP_NODE
, &no_neighbor_attr_unchanged_cmd
);
12629 install_element (BGP_NODE
, &no_neighbor_attr_unchanged1_cmd
);
12630 install_element (BGP_NODE
, &no_neighbor_attr_unchanged2_cmd
);
12631 install_element (BGP_NODE
, &no_neighbor_attr_unchanged3_cmd
);
12632 install_element (BGP_NODE
, &no_neighbor_attr_unchanged4_cmd
);
12633 install_element (BGP_NODE
, &no_neighbor_attr_unchanged5_cmd
);
12634 install_element (BGP_NODE
, &no_neighbor_attr_unchanged6_cmd
);
12635 install_element (BGP_NODE
, &no_neighbor_attr_unchanged7_cmd
);
12636 install_element (BGP_NODE
, &no_neighbor_attr_unchanged8_cmd
);
12637 install_element (BGP_NODE
, &no_neighbor_attr_unchanged9_cmd
);
12638 install_element (BGP_NODE
, &no_neighbor_attr_unchanged10_cmd
);
12639 install_element (BGP_IPV4_NODE
, &neighbor_attr_unchanged_cmd
);
12640 install_element (BGP_IPV4_NODE
, &neighbor_attr_unchanged1_cmd
);
12641 install_element (BGP_IPV4_NODE
, &neighbor_attr_unchanged2_cmd
);
12642 install_element (BGP_IPV4_NODE
, &neighbor_attr_unchanged3_cmd
);
12643 install_element (BGP_IPV4_NODE
, &neighbor_attr_unchanged4_cmd
);
12644 install_element (BGP_IPV4_NODE
, &neighbor_attr_unchanged5_cmd
);
12645 install_element (BGP_IPV4_NODE
, &neighbor_attr_unchanged6_cmd
);
12646 install_element (BGP_IPV4_NODE
, &neighbor_attr_unchanged7_cmd
);
12647 install_element (BGP_IPV4_NODE
, &neighbor_attr_unchanged8_cmd
);
12648 install_element (BGP_IPV4_NODE
, &neighbor_attr_unchanged9_cmd
);
12649 install_element (BGP_IPV4_NODE
, &neighbor_attr_unchanged10_cmd
);
12650 install_element (BGP_IPV4_NODE
, &no_neighbor_attr_unchanged_cmd
);
12651 install_element (BGP_IPV4_NODE
, &no_neighbor_attr_unchanged1_cmd
);
12652 install_element (BGP_IPV4_NODE
, &no_neighbor_attr_unchanged2_cmd
);
12653 install_element (BGP_IPV4_NODE
, &no_neighbor_attr_unchanged3_cmd
);
12654 install_element (BGP_IPV4_NODE
, &no_neighbor_attr_unchanged4_cmd
);
12655 install_element (BGP_IPV4_NODE
, &no_neighbor_attr_unchanged5_cmd
);
12656 install_element (BGP_IPV4_NODE
, &no_neighbor_attr_unchanged6_cmd
);
12657 install_element (BGP_IPV4_NODE
, &no_neighbor_attr_unchanged7_cmd
);
12658 install_element (BGP_IPV4_NODE
, &no_neighbor_attr_unchanged8_cmd
);
12659 install_element (BGP_IPV4_NODE
, &no_neighbor_attr_unchanged9_cmd
);
12660 install_element (BGP_IPV4_NODE
, &no_neighbor_attr_unchanged10_cmd
);
12661 install_element (BGP_IPV4M_NODE
, &neighbor_attr_unchanged_cmd
);
12662 install_element (BGP_IPV4M_NODE
, &neighbor_attr_unchanged1_cmd
);
12663 install_element (BGP_IPV4M_NODE
, &neighbor_attr_unchanged2_cmd
);
12664 install_element (BGP_IPV4M_NODE
, &neighbor_attr_unchanged3_cmd
);
12665 install_element (BGP_IPV4M_NODE
, &neighbor_attr_unchanged4_cmd
);
12666 install_element (BGP_IPV4M_NODE
, &neighbor_attr_unchanged5_cmd
);
12667 install_element (BGP_IPV4M_NODE
, &neighbor_attr_unchanged6_cmd
);
12668 install_element (BGP_IPV4M_NODE
, &neighbor_attr_unchanged7_cmd
);
12669 install_element (BGP_IPV4M_NODE
, &neighbor_attr_unchanged8_cmd
);
12670 install_element (BGP_IPV4M_NODE
, &neighbor_attr_unchanged9_cmd
);
12671 install_element (BGP_IPV4M_NODE
, &neighbor_attr_unchanged10_cmd
);
12672 install_element (BGP_IPV4M_NODE
, &no_neighbor_attr_unchanged_cmd
);
12673 install_element (BGP_IPV4M_NODE
, &no_neighbor_attr_unchanged1_cmd
);
12674 install_element (BGP_IPV4M_NODE
, &no_neighbor_attr_unchanged2_cmd
);
12675 install_element (BGP_IPV4M_NODE
, &no_neighbor_attr_unchanged3_cmd
);
12676 install_element (BGP_IPV4M_NODE
, &no_neighbor_attr_unchanged4_cmd
);
12677 install_element (BGP_IPV4M_NODE
, &no_neighbor_attr_unchanged5_cmd
);
12678 install_element (BGP_IPV4M_NODE
, &no_neighbor_attr_unchanged6_cmd
);
12679 install_element (BGP_IPV4M_NODE
, &no_neighbor_attr_unchanged7_cmd
);
12680 install_element (BGP_IPV4M_NODE
, &no_neighbor_attr_unchanged8_cmd
);
12681 install_element (BGP_IPV4M_NODE
, &no_neighbor_attr_unchanged9_cmd
);
12682 install_element (BGP_IPV4M_NODE
, &no_neighbor_attr_unchanged10_cmd
);
12683 install_element (BGP_IPV6_NODE
, &neighbor_attr_unchanged_cmd
);
12684 install_element (BGP_IPV6_NODE
, &neighbor_attr_unchanged1_cmd
);
12685 install_element (BGP_IPV6_NODE
, &neighbor_attr_unchanged2_cmd
);
12686 install_element (BGP_IPV6_NODE
, &neighbor_attr_unchanged3_cmd
);
12687 install_element (BGP_IPV6_NODE
, &neighbor_attr_unchanged4_cmd
);
12688 install_element (BGP_IPV6_NODE
, &neighbor_attr_unchanged5_cmd
);
12689 install_element (BGP_IPV6_NODE
, &neighbor_attr_unchanged6_cmd
);
12690 install_element (BGP_IPV6_NODE
, &neighbor_attr_unchanged7_cmd
);
12691 install_element (BGP_IPV6_NODE
, &neighbor_attr_unchanged8_cmd
);
12692 install_element (BGP_IPV6_NODE
, &neighbor_attr_unchanged9_cmd
);
12693 install_element (BGP_IPV6_NODE
, &neighbor_attr_unchanged10_cmd
);
12694 install_element (BGP_IPV6_NODE
, &no_neighbor_attr_unchanged_cmd
);
12695 install_element (BGP_IPV6_NODE
, &no_neighbor_attr_unchanged1_cmd
);
12696 install_element (BGP_IPV6_NODE
, &no_neighbor_attr_unchanged2_cmd
);
12697 install_element (BGP_IPV6_NODE
, &no_neighbor_attr_unchanged3_cmd
);
12698 install_element (BGP_IPV6_NODE
, &no_neighbor_attr_unchanged4_cmd
);
12699 install_element (BGP_IPV6_NODE
, &no_neighbor_attr_unchanged5_cmd
);
12700 install_element (BGP_IPV6_NODE
, &no_neighbor_attr_unchanged6_cmd
);
12701 install_element (BGP_IPV6_NODE
, &no_neighbor_attr_unchanged7_cmd
);
12702 install_element (BGP_IPV6_NODE
, &no_neighbor_attr_unchanged8_cmd
);
12703 install_element (BGP_IPV6_NODE
, &no_neighbor_attr_unchanged9_cmd
);
12704 install_element (BGP_IPV6_NODE
, &no_neighbor_attr_unchanged10_cmd
);
12705 install_element (BGP_IPV6M_NODE
, &neighbor_attr_unchanged_cmd
);
12706 install_element (BGP_IPV6M_NODE
, &neighbor_attr_unchanged1_cmd
);
12707 install_element (BGP_IPV6M_NODE
, &neighbor_attr_unchanged2_cmd
);
12708 install_element (BGP_IPV6M_NODE
, &neighbor_attr_unchanged3_cmd
);
12709 install_element (BGP_IPV6M_NODE
, &neighbor_attr_unchanged4_cmd
);
12710 install_element (BGP_IPV6M_NODE
, &neighbor_attr_unchanged5_cmd
);
12711 install_element (BGP_IPV6M_NODE
, &neighbor_attr_unchanged6_cmd
);
12712 install_element (BGP_IPV6M_NODE
, &neighbor_attr_unchanged7_cmd
);
12713 install_element (BGP_IPV6M_NODE
, &neighbor_attr_unchanged8_cmd
);
12714 install_element (BGP_IPV6M_NODE
, &neighbor_attr_unchanged9_cmd
);
12715 install_element (BGP_IPV6M_NODE
, &neighbor_attr_unchanged10_cmd
);
12716 install_element (BGP_IPV6M_NODE
, &no_neighbor_attr_unchanged_cmd
);
12717 install_element (BGP_IPV6M_NODE
, &no_neighbor_attr_unchanged1_cmd
);
12718 install_element (BGP_IPV6M_NODE
, &no_neighbor_attr_unchanged2_cmd
);
12719 install_element (BGP_IPV6M_NODE
, &no_neighbor_attr_unchanged3_cmd
);
12720 install_element (BGP_IPV6M_NODE
, &no_neighbor_attr_unchanged4_cmd
);
12721 install_element (BGP_IPV6M_NODE
, &no_neighbor_attr_unchanged5_cmd
);
12722 install_element (BGP_IPV6M_NODE
, &no_neighbor_attr_unchanged6_cmd
);
12723 install_element (BGP_IPV6M_NODE
, &no_neighbor_attr_unchanged7_cmd
);
12724 install_element (BGP_IPV6M_NODE
, &no_neighbor_attr_unchanged8_cmd
);
12725 install_element (BGP_IPV6M_NODE
, &no_neighbor_attr_unchanged9_cmd
);
12726 install_element (BGP_IPV6M_NODE
, &no_neighbor_attr_unchanged10_cmd
);
12727 install_element (BGP_VPNV4_NODE
, &neighbor_attr_unchanged_cmd
);
12728 install_element (BGP_VPNV4_NODE
, &neighbor_attr_unchanged1_cmd
);
12729 install_element (BGP_VPNV4_NODE
, &neighbor_attr_unchanged2_cmd
);
12730 install_element (BGP_VPNV4_NODE
, &neighbor_attr_unchanged3_cmd
);
12731 install_element (BGP_VPNV4_NODE
, &neighbor_attr_unchanged4_cmd
);
12732 install_element (BGP_VPNV4_NODE
, &neighbor_attr_unchanged5_cmd
);
12733 install_element (BGP_VPNV4_NODE
, &neighbor_attr_unchanged6_cmd
);
12734 install_element (BGP_VPNV4_NODE
, &neighbor_attr_unchanged7_cmd
);
12735 install_element (BGP_VPNV4_NODE
, &neighbor_attr_unchanged8_cmd
);
12736 install_element (BGP_VPNV4_NODE
, &neighbor_attr_unchanged9_cmd
);
12737 install_element (BGP_VPNV4_NODE
, &neighbor_attr_unchanged10_cmd
);
12738 install_element (BGP_VPNV4_NODE
, &no_neighbor_attr_unchanged_cmd
);
12739 install_element (BGP_VPNV4_NODE
, &no_neighbor_attr_unchanged1_cmd
);
12740 install_element (BGP_VPNV4_NODE
, &no_neighbor_attr_unchanged2_cmd
);
12741 install_element (BGP_VPNV4_NODE
, &no_neighbor_attr_unchanged3_cmd
);
12742 install_element (BGP_VPNV4_NODE
, &no_neighbor_attr_unchanged4_cmd
);
12743 install_element (BGP_VPNV4_NODE
, &no_neighbor_attr_unchanged5_cmd
);
12744 install_element (BGP_VPNV4_NODE
, &no_neighbor_attr_unchanged6_cmd
);
12745 install_element (BGP_VPNV4_NODE
, &no_neighbor_attr_unchanged7_cmd
);
12746 install_element (BGP_VPNV4_NODE
, &no_neighbor_attr_unchanged8_cmd
);
12747 install_element (BGP_VPNV4_NODE
, &no_neighbor_attr_unchanged9_cmd
);
12748 install_element (BGP_VPNV4_NODE
, &no_neighbor_attr_unchanged10_cmd
);
12750 /* "nexthop-local unchanged" commands */
12751 install_element (BGP_IPV6_NODE
, &neighbor_nexthop_local_unchanged_cmd
);
12752 install_element (BGP_IPV6_NODE
, &no_neighbor_nexthop_local_unchanged_cmd
);
12754 /* "neighbor next-hop-self" commands. */
12755 install_element (BGP_NODE
, &neighbor_nexthop_self_cmd
);
12756 install_element (BGP_NODE
, &no_neighbor_nexthop_self_cmd
);
12757 install_element (BGP_IPV4_NODE
, &neighbor_nexthop_self_cmd
);
12758 install_element (BGP_IPV4_NODE
, &no_neighbor_nexthop_self_cmd
);
12759 install_element (BGP_IPV4M_NODE
, &neighbor_nexthop_self_cmd
);
12760 install_element (BGP_IPV4M_NODE
, &no_neighbor_nexthop_self_cmd
);
12761 install_element (BGP_IPV6_NODE
, &neighbor_nexthop_self_cmd
);
12762 install_element (BGP_IPV6_NODE
, &no_neighbor_nexthop_self_cmd
);
12763 install_element (BGP_IPV6M_NODE
, &neighbor_nexthop_self_cmd
);
12764 install_element (BGP_IPV6M_NODE
, &no_neighbor_nexthop_self_cmd
);
12765 install_element (BGP_VPNV4_NODE
, &neighbor_nexthop_self_cmd
);
12766 install_element (BGP_VPNV4_NODE
, &no_neighbor_nexthop_self_cmd
);
12768 /* "neighbor next-hop-self force" commands. */
12769 install_element (BGP_NODE
, &neighbor_nexthop_self_force_cmd
);
12770 install_element (BGP_NODE
, &no_neighbor_nexthop_self_force_cmd
);
12771 install_element (BGP_IPV4_NODE
, &neighbor_nexthop_self_force_cmd
);
12772 install_element (BGP_IPV4_NODE
, &no_neighbor_nexthop_self_force_cmd
);
12773 install_element (BGP_IPV4M_NODE
, &neighbor_nexthop_self_force_cmd
);
12774 install_element (BGP_IPV4M_NODE
, &no_neighbor_nexthop_self_force_cmd
);
12775 install_element (BGP_IPV6_NODE
, &neighbor_nexthop_self_force_cmd
);
12776 install_element (BGP_IPV6_NODE
, &no_neighbor_nexthop_self_force_cmd
);
12777 install_element (BGP_IPV6M_NODE
, &neighbor_nexthop_self_force_cmd
);
12778 install_element (BGP_IPV6M_NODE
, &no_neighbor_nexthop_self_force_cmd
);
12779 install_element (BGP_VPNV4_NODE
, &neighbor_nexthop_self_force_cmd
);
12780 install_element (BGP_VPNV4_NODE
, &no_neighbor_nexthop_self_force_cmd
);
12782 /* "neighbor as-override" commands. */
12783 install_element (BGP_NODE
, &neighbor_as_override_cmd
);
12784 install_element (BGP_NODE
, &no_neighbor_as_override_cmd
);
12785 install_element (BGP_IPV4_NODE
, &neighbor_as_override_cmd
);
12786 install_element (BGP_IPV4_NODE
, &no_neighbor_as_override_cmd
);
12787 install_element (BGP_IPV4M_NODE
, &neighbor_as_override_cmd
);
12788 install_element (BGP_IPV4M_NODE
, &no_neighbor_as_override_cmd
);
12789 install_element (BGP_IPV6_NODE
, &neighbor_as_override_cmd
);
12790 install_element (BGP_IPV6_NODE
, &no_neighbor_as_override_cmd
);
12791 install_element (BGP_IPV6M_NODE
, &neighbor_as_override_cmd
);
12792 install_element (BGP_IPV6M_NODE
, &no_neighbor_as_override_cmd
);
12793 install_element (BGP_VPNV4_NODE
, &neighbor_as_override_cmd
);
12794 install_element (BGP_VPNV4_NODE
, &no_neighbor_as_override_cmd
);
12796 /* "neighbor remove-private-AS" commands. */
12797 install_element (BGP_NODE
, &neighbor_remove_private_as_cmd
);
12798 install_element (BGP_NODE
, &no_neighbor_remove_private_as_cmd
);
12799 install_element (BGP_NODE
, &neighbor_remove_private_as_all_cmd
);
12800 install_element (BGP_NODE
, &no_neighbor_remove_private_as_all_cmd
);
12801 install_element (BGP_NODE
, &neighbor_remove_private_as_replace_as_cmd
);
12802 install_element (BGP_NODE
, &no_neighbor_remove_private_as_replace_as_cmd
);
12803 install_element (BGP_NODE
, &neighbor_remove_private_as_all_replace_as_cmd
);
12804 install_element (BGP_NODE
, &no_neighbor_remove_private_as_all_replace_as_cmd
);
12805 install_element (BGP_IPV4_NODE
, &neighbor_remove_private_as_cmd
);
12806 install_element (BGP_IPV4_NODE
, &no_neighbor_remove_private_as_cmd
);
12807 install_element (BGP_IPV4_NODE
, &neighbor_remove_private_as_all_cmd
);
12808 install_element (BGP_IPV4_NODE
, &no_neighbor_remove_private_as_all_cmd
);
12809 install_element (BGP_IPV4_NODE
, &neighbor_remove_private_as_replace_as_cmd
);
12810 install_element (BGP_IPV4_NODE
, &no_neighbor_remove_private_as_replace_as_cmd
);
12811 install_element (BGP_IPV4_NODE
, &neighbor_remove_private_as_all_replace_as_cmd
);
12812 install_element (BGP_IPV4_NODE
, &no_neighbor_remove_private_as_all_replace_as_cmd
);
12813 install_element (BGP_IPV4M_NODE
, &neighbor_remove_private_as_cmd
);
12814 install_element (BGP_IPV4M_NODE
, &no_neighbor_remove_private_as_cmd
);
12815 install_element (BGP_IPV4M_NODE
, &neighbor_remove_private_as_all_cmd
);
12816 install_element (BGP_IPV4M_NODE
, &no_neighbor_remove_private_as_all_cmd
);
12817 install_element (BGP_IPV4M_NODE
, &neighbor_remove_private_as_replace_as_cmd
);
12818 install_element (BGP_IPV4M_NODE
, &no_neighbor_remove_private_as_replace_as_cmd
);
12819 install_element (BGP_IPV4M_NODE
, &neighbor_remove_private_as_all_replace_as_cmd
);
12820 install_element (BGP_IPV4M_NODE
, &no_neighbor_remove_private_as_all_replace_as_cmd
);
12821 install_element (BGP_IPV6_NODE
, &neighbor_remove_private_as_cmd
);
12822 install_element (BGP_IPV6_NODE
, &no_neighbor_remove_private_as_cmd
);
12823 install_element (BGP_IPV6_NODE
, &neighbor_remove_private_as_all_cmd
);
12824 install_element (BGP_IPV6_NODE
, &no_neighbor_remove_private_as_all_cmd
);
12825 install_element (BGP_IPV6_NODE
, &neighbor_remove_private_as_replace_as_cmd
);
12826 install_element (BGP_IPV6_NODE
, &no_neighbor_remove_private_as_replace_as_cmd
);
12827 install_element (BGP_IPV6_NODE
, &neighbor_remove_private_as_all_replace_as_cmd
);
12828 install_element (BGP_IPV6_NODE
, &no_neighbor_remove_private_as_all_replace_as_cmd
);
12829 install_element (BGP_IPV6M_NODE
, &neighbor_remove_private_as_cmd
);
12830 install_element (BGP_IPV6M_NODE
, &no_neighbor_remove_private_as_cmd
);
12831 install_element (BGP_IPV6M_NODE
, &neighbor_remove_private_as_all_cmd
);
12832 install_element (BGP_IPV6M_NODE
, &no_neighbor_remove_private_as_all_cmd
);
12833 install_element (BGP_IPV6M_NODE
, &neighbor_remove_private_as_replace_as_cmd
);
12834 install_element (BGP_IPV6M_NODE
, &no_neighbor_remove_private_as_replace_as_cmd
);
12835 install_element (BGP_IPV6M_NODE
, &neighbor_remove_private_as_all_replace_as_cmd
);
12836 install_element (BGP_IPV6M_NODE
, &no_neighbor_remove_private_as_all_replace_as_cmd
);
12837 install_element (BGP_VPNV4_NODE
, &neighbor_remove_private_as_cmd
);
12838 install_element (BGP_VPNV4_NODE
, &no_neighbor_remove_private_as_cmd
);
12839 install_element (BGP_VPNV4_NODE
, &neighbor_remove_private_as_all_cmd
);
12840 install_element (BGP_VPNV4_NODE
, &no_neighbor_remove_private_as_all_cmd
);
12841 install_element (BGP_VPNV4_NODE
, &neighbor_remove_private_as_replace_as_cmd
);
12842 install_element (BGP_VPNV4_NODE
, &no_neighbor_remove_private_as_replace_as_cmd
);
12843 install_element (BGP_VPNV4_NODE
, &neighbor_remove_private_as_all_replace_as_cmd
);
12844 install_element (BGP_VPNV4_NODE
, &no_neighbor_remove_private_as_all_replace_as_cmd
);
12846 /* "neighbor send-community" commands.*/
12847 install_element (BGP_NODE
, &neighbor_send_community_cmd
);
12848 install_element (BGP_NODE
, &neighbor_send_community_type_cmd
);
12849 install_element (BGP_NODE
, &no_neighbor_send_community_cmd
);
12850 install_element (BGP_NODE
, &no_neighbor_send_community_type_cmd
);
12851 install_element (BGP_IPV4_NODE
, &neighbor_send_community_cmd
);
12852 install_element (BGP_IPV4_NODE
, &neighbor_send_community_type_cmd
);
12853 install_element (BGP_IPV4_NODE
, &no_neighbor_send_community_cmd
);
12854 install_element (BGP_IPV4_NODE
, &no_neighbor_send_community_type_cmd
);
12855 install_element (BGP_IPV4M_NODE
, &neighbor_send_community_cmd
);
12856 install_element (BGP_IPV4M_NODE
, &neighbor_send_community_type_cmd
);
12857 install_element (BGP_IPV4M_NODE
, &no_neighbor_send_community_cmd
);
12858 install_element (BGP_IPV4M_NODE
, &no_neighbor_send_community_type_cmd
);
12859 install_element (BGP_IPV6_NODE
, &neighbor_send_community_cmd
);
12860 install_element (BGP_IPV6_NODE
, &neighbor_send_community_type_cmd
);
12861 install_element (BGP_IPV6_NODE
, &no_neighbor_send_community_cmd
);
12862 install_element (BGP_IPV6_NODE
, &no_neighbor_send_community_type_cmd
);
12863 install_element (BGP_IPV6M_NODE
, &neighbor_send_community_cmd
);
12864 install_element (BGP_IPV6M_NODE
, &neighbor_send_community_type_cmd
);
12865 install_element (BGP_IPV6M_NODE
, &no_neighbor_send_community_cmd
);
12866 install_element (BGP_IPV6M_NODE
, &no_neighbor_send_community_type_cmd
);
12867 install_element (BGP_VPNV4_NODE
, &neighbor_send_community_cmd
);
12868 install_element (BGP_VPNV4_NODE
, &neighbor_send_community_type_cmd
);
12869 install_element (BGP_VPNV4_NODE
, &no_neighbor_send_community_cmd
);
12870 install_element (BGP_VPNV4_NODE
, &no_neighbor_send_community_type_cmd
);
12872 /* "neighbor route-reflector" commands.*/
12873 install_element (BGP_NODE
, &neighbor_route_reflector_client_cmd
);
12874 install_element (BGP_NODE
, &no_neighbor_route_reflector_client_cmd
);
12875 install_element (BGP_IPV4_NODE
, &neighbor_route_reflector_client_cmd
);
12876 install_element (BGP_IPV4_NODE
, &no_neighbor_route_reflector_client_cmd
);
12877 install_element (BGP_IPV4M_NODE
, &neighbor_route_reflector_client_cmd
);
12878 install_element (BGP_IPV4M_NODE
, &no_neighbor_route_reflector_client_cmd
);
12879 install_element (BGP_IPV6_NODE
, &neighbor_route_reflector_client_cmd
);
12880 install_element (BGP_IPV6_NODE
, &no_neighbor_route_reflector_client_cmd
);
12881 install_element (BGP_IPV6M_NODE
, &neighbor_route_reflector_client_cmd
);
12882 install_element (BGP_IPV6M_NODE
, &no_neighbor_route_reflector_client_cmd
);
12883 install_element (BGP_VPNV4_NODE
, &neighbor_route_reflector_client_cmd
);
12884 install_element (BGP_VPNV4_NODE
, &no_neighbor_route_reflector_client_cmd
);
12886 /* "neighbor route-server" commands.*/
12887 install_element (BGP_NODE
, &neighbor_route_server_client_cmd
);
12888 install_element (BGP_NODE
, &no_neighbor_route_server_client_cmd
);
12889 install_element (BGP_IPV4_NODE
, &neighbor_route_server_client_cmd
);
12890 install_element (BGP_IPV4_NODE
, &no_neighbor_route_server_client_cmd
);
12891 install_element (BGP_IPV4M_NODE
, &neighbor_route_server_client_cmd
);
12892 install_element (BGP_IPV4M_NODE
, &no_neighbor_route_server_client_cmd
);
12893 install_element (BGP_IPV6_NODE
, &neighbor_route_server_client_cmd
);
12894 install_element (BGP_IPV6_NODE
, &no_neighbor_route_server_client_cmd
);
12895 install_element (BGP_IPV6M_NODE
, &neighbor_route_server_client_cmd
);
12896 install_element (BGP_IPV6M_NODE
, &no_neighbor_route_server_client_cmd
);
12897 install_element (BGP_VPNV4_NODE
, &neighbor_route_server_client_cmd
);
12898 install_element (BGP_VPNV4_NODE
, &no_neighbor_route_server_client_cmd
);
12900 /* "neighbor addpath-tx-all-paths" commands.*/
12901 install_element (BGP_NODE
, &neighbor_addpath_tx_all_paths_cmd
);
12902 install_element (BGP_NODE
, &no_neighbor_addpath_tx_all_paths_cmd
);
12903 install_element (BGP_IPV4_NODE
, &neighbor_addpath_tx_all_paths_cmd
);
12904 install_element (BGP_IPV4_NODE
, &no_neighbor_addpath_tx_all_paths_cmd
);
12905 install_element (BGP_IPV4M_NODE
, &neighbor_addpath_tx_all_paths_cmd
);
12906 install_element (BGP_IPV4M_NODE
, &no_neighbor_addpath_tx_all_paths_cmd
);
12907 install_element (BGP_IPV6_NODE
, &neighbor_addpath_tx_all_paths_cmd
);
12908 install_element (BGP_IPV6_NODE
, &no_neighbor_addpath_tx_all_paths_cmd
);
12909 install_element (BGP_IPV6M_NODE
, &neighbor_addpath_tx_all_paths_cmd
);
12910 install_element (BGP_IPV6M_NODE
, &no_neighbor_addpath_tx_all_paths_cmd
);
12911 install_element (BGP_VPNV4_NODE
, &neighbor_addpath_tx_all_paths_cmd
);
12912 install_element (BGP_VPNV4_NODE
, &no_neighbor_addpath_tx_all_paths_cmd
);
12914 /* "neighbor addpath-tx-bestpath-per-AS" commands.*/
12915 install_element (BGP_NODE
, &neighbor_addpath_tx_bestpath_per_as_cmd
);
12916 install_element (BGP_NODE
, &no_neighbor_addpath_tx_bestpath_per_as_cmd
);
12917 install_element (BGP_IPV4_NODE
, &neighbor_addpath_tx_bestpath_per_as_cmd
);
12918 install_element (BGP_IPV4_NODE
, &no_neighbor_addpath_tx_bestpath_per_as_cmd
);
12919 install_element (BGP_IPV4M_NODE
, &neighbor_addpath_tx_bestpath_per_as_cmd
);
12920 install_element (BGP_IPV4M_NODE
, &no_neighbor_addpath_tx_bestpath_per_as_cmd
);
12921 install_element (BGP_IPV6_NODE
, &neighbor_addpath_tx_bestpath_per_as_cmd
);
12922 install_element (BGP_IPV6_NODE
, &no_neighbor_addpath_tx_bestpath_per_as_cmd
);
12923 install_element (BGP_IPV6M_NODE
, &neighbor_addpath_tx_bestpath_per_as_cmd
);
12924 install_element (BGP_IPV6M_NODE
, &no_neighbor_addpath_tx_bestpath_per_as_cmd
);
12925 install_element (BGP_VPNV4_NODE
, &neighbor_addpath_tx_bestpath_per_as_cmd
);
12926 install_element (BGP_VPNV4_NODE
, &no_neighbor_addpath_tx_bestpath_per_as_cmd
);
12928 /* "neighbor passive" commands. */
12929 install_element (BGP_NODE
, &neighbor_passive_cmd
);
12930 install_element (BGP_NODE
, &no_neighbor_passive_cmd
);
12933 /* "neighbor shutdown" commands. */
12934 install_element (BGP_NODE
, &neighbor_shutdown_cmd
);
12935 install_element (BGP_NODE
, &no_neighbor_shutdown_cmd
);
12937 /* "neighbor capability extended-nexthop" commands.*/
12938 install_element (BGP_NODE
, &neighbor_capability_enhe_cmd
);
12939 install_element (BGP_NODE
, &no_neighbor_capability_enhe_cmd
);
12941 /* "neighbor capability orf prefix-list" commands.*/
12942 install_element (BGP_NODE
, &neighbor_capability_orf_prefix_cmd
);
12943 install_element (BGP_NODE
, &no_neighbor_capability_orf_prefix_cmd
);
12944 install_element (BGP_IPV4_NODE
, &neighbor_capability_orf_prefix_cmd
);
12945 install_element (BGP_IPV4_NODE
, &no_neighbor_capability_orf_prefix_cmd
);
12946 install_element (BGP_IPV4M_NODE
, &neighbor_capability_orf_prefix_cmd
);
12947 install_element (BGP_IPV4M_NODE
, &no_neighbor_capability_orf_prefix_cmd
);
12948 install_element (BGP_IPV6_NODE
, &neighbor_capability_orf_prefix_cmd
);
12949 install_element (BGP_IPV6_NODE
, &no_neighbor_capability_orf_prefix_cmd
);
12950 install_element (BGP_IPV6M_NODE
, &neighbor_capability_orf_prefix_cmd
);
12951 install_element (BGP_IPV6M_NODE
, &no_neighbor_capability_orf_prefix_cmd
);
12953 /* "neighbor capability dynamic" commands.*/
12954 install_element (BGP_NODE
, &neighbor_capability_dynamic_cmd
);
12955 install_element (BGP_NODE
, &no_neighbor_capability_dynamic_cmd
);
12957 /* "neighbor dont-capability-negotiate" commands. */
12958 install_element (BGP_NODE
, &neighbor_dont_capability_negotiate_cmd
);
12959 install_element (BGP_NODE
, &no_neighbor_dont_capability_negotiate_cmd
);
12961 /* "neighbor ebgp-multihop" commands. */
12962 install_element (BGP_NODE
, &neighbor_ebgp_multihop_cmd
);
12963 install_element (BGP_NODE
, &neighbor_ebgp_multihop_ttl_cmd
);
12964 install_element (BGP_NODE
, &no_neighbor_ebgp_multihop_cmd
);
12965 install_element (BGP_NODE
, &no_neighbor_ebgp_multihop_ttl_cmd
);
12967 /* "neighbor disable-connected-check" commands. */
12968 install_element (BGP_NODE
, &neighbor_disable_connected_check_cmd
);
12969 install_element (BGP_NODE
, &no_neighbor_disable_connected_check_cmd
);
12970 install_element (BGP_NODE
, &neighbor_enforce_multihop_cmd
);
12971 install_element (BGP_NODE
, &no_neighbor_enforce_multihop_cmd
);
12973 /* "neighbor description" commands. */
12974 install_element (BGP_NODE
, &neighbor_description_cmd
);
12975 install_element (BGP_NODE
, &no_neighbor_description_cmd
);
12976 install_element (BGP_NODE
, &no_neighbor_description_val_cmd
);
12978 /* "neighbor update-source" commands. "*/
12979 install_element (BGP_NODE
, &neighbor_update_source_cmd
);
12980 install_element (BGP_NODE
, &no_neighbor_update_source_cmd
);
12982 /* "neighbor default-originate" commands. */
12983 install_element (BGP_NODE
, &neighbor_default_originate_cmd
);
12984 install_element (BGP_NODE
, &neighbor_default_originate_rmap_cmd
);
12985 install_element (BGP_NODE
, &no_neighbor_default_originate_cmd
);
12986 install_element (BGP_NODE
, &no_neighbor_default_originate_rmap_cmd
);
12987 install_element (BGP_IPV4_NODE
, &neighbor_default_originate_cmd
);
12988 install_element (BGP_IPV4_NODE
, &neighbor_default_originate_rmap_cmd
);
12989 install_element (BGP_IPV4_NODE
, &no_neighbor_default_originate_cmd
);
12990 install_element (BGP_IPV4_NODE
, &no_neighbor_default_originate_rmap_cmd
);
12991 install_element (BGP_IPV4M_NODE
, &neighbor_default_originate_cmd
);
12992 install_element (BGP_IPV4M_NODE
, &neighbor_default_originate_rmap_cmd
);
12993 install_element (BGP_IPV4M_NODE
, &no_neighbor_default_originate_cmd
);
12994 install_element (BGP_IPV4M_NODE
, &no_neighbor_default_originate_rmap_cmd
);
12995 install_element (BGP_IPV6_NODE
, &neighbor_default_originate_cmd
);
12996 install_element (BGP_IPV6_NODE
, &neighbor_default_originate_rmap_cmd
);
12997 install_element (BGP_IPV6_NODE
, &no_neighbor_default_originate_cmd
);
12998 install_element (BGP_IPV6_NODE
, &no_neighbor_default_originate_rmap_cmd
);
12999 install_element (BGP_IPV6M_NODE
, &neighbor_default_originate_cmd
);
13000 install_element (BGP_IPV6M_NODE
, &neighbor_default_originate_rmap_cmd
);
13001 install_element (BGP_IPV6M_NODE
, &no_neighbor_default_originate_cmd
);
13002 install_element (BGP_IPV6M_NODE
, &no_neighbor_default_originate_rmap_cmd
);
13004 /* "neighbor port" commands. */
13005 install_element (BGP_NODE
, &neighbor_port_cmd
);
13006 install_element (BGP_NODE
, &no_neighbor_port_cmd
);
13007 install_element (BGP_NODE
, &no_neighbor_port_val_cmd
);
13009 /* "neighbor weight" commands. */
13010 install_element (BGP_NODE
, &neighbor_weight_cmd
);
13011 install_element (BGP_NODE
, &no_neighbor_weight_cmd
);
13012 install_element (BGP_NODE
, &no_neighbor_weight_val_cmd
);
13014 /* "neighbor override-capability" commands. */
13015 install_element (BGP_NODE
, &neighbor_override_capability_cmd
);
13016 install_element (BGP_NODE
, &no_neighbor_override_capability_cmd
);
13018 /* "neighbor strict-capability-match" commands. */
13019 install_element (BGP_NODE
, &neighbor_strict_capability_cmd
);
13020 install_element (BGP_NODE
, &no_neighbor_strict_capability_cmd
);
13022 /* "neighbor timers" commands. */
13023 install_element (BGP_NODE
, &neighbor_timers_cmd
);
13024 install_element (BGP_NODE
, &no_neighbor_timers_cmd
);
13025 install_element (BGP_NODE
, &no_neighbor_timers_val_cmd
);
13027 /* "neighbor timers connect" commands. */
13028 install_element (BGP_NODE
, &neighbor_timers_connect_cmd
);
13029 install_element (BGP_NODE
, &no_neighbor_timers_connect_cmd
);
13030 install_element (BGP_NODE
, &no_neighbor_timers_connect_val_cmd
);
13032 /* "neighbor advertisement-interval" commands. */
13033 install_element (BGP_NODE
, &neighbor_advertise_interval_cmd
);
13034 install_element (BGP_NODE
, &no_neighbor_advertise_interval_cmd
);
13035 install_element (BGP_NODE
, &no_neighbor_advertise_interval_val_cmd
);
13037 /* "neighbor interface" commands. */
13038 install_element (BGP_NODE
, &neighbor_interface_cmd
);
13039 install_element (BGP_NODE
, &no_neighbor_interface_cmd
);
13041 /* "neighbor distribute" commands. */
13042 install_element (BGP_NODE
, &neighbor_distribute_list_cmd
);
13043 install_element (BGP_NODE
, &no_neighbor_distribute_list_cmd
);
13044 install_element (BGP_IPV4_NODE
, &neighbor_distribute_list_cmd
);
13045 install_element (BGP_IPV4_NODE
, &no_neighbor_distribute_list_cmd
);
13046 install_element (BGP_IPV4M_NODE
, &neighbor_distribute_list_cmd
);
13047 install_element (BGP_IPV4M_NODE
, &no_neighbor_distribute_list_cmd
);
13048 install_element (BGP_IPV6_NODE
, &neighbor_distribute_list_cmd
);
13049 install_element (BGP_IPV6_NODE
, &no_neighbor_distribute_list_cmd
);
13050 install_element (BGP_IPV6M_NODE
, &neighbor_distribute_list_cmd
);
13051 install_element (BGP_IPV6M_NODE
, &no_neighbor_distribute_list_cmd
);
13052 install_element (BGP_VPNV4_NODE
, &neighbor_distribute_list_cmd
);
13053 install_element (BGP_VPNV4_NODE
, &no_neighbor_distribute_list_cmd
);
13055 /* "neighbor prefix-list" commands. */
13056 install_element (BGP_NODE
, &neighbor_prefix_list_cmd
);
13057 install_element (BGP_NODE
, &no_neighbor_prefix_list_cmd
);
13058 install_element (BGP_IPV4_NODE
, &neighbor_prefix_list_cmd
);
13059 install_element (BGP_IPV4_NODE
, &no_neighbor_prefix_list_cmd
);
13060 install_element (BGP_IPV4M_NODE
, &neighbor_prefix_list_cmd
);
13061 install_element (BGP_IPV4M_NODE
, &no_neighbor_prefix_list_cmd
);
13062 install_element (BGP_IPV6_NODE
, &neighbor_prefix_list_cmd
);
13063 install_element (BGP_IPV6_NODE
, &no_neighbor_prefix_list_cmd
);
13064 install_element (BGP_IPV6M_NODE
, &neighbor_prefix_list_cmd
);
13065 install_element (BGP_IPV6M_NODE
, &no_neighbor_prefix_list_cmd
);
13066 install_element (BGP_VPNV4_NODE
, &neighbor_prefix_list_cmd
);
13067 install_element (BGP_VPNV4_NODE
, &no_neighbor_prefix_list_cmd
);
13069 /* "neighbor filter-list" commands. */
13070 install_element (BGP_NODE
, &neighbor_filter_list_cmd
);
13071 install_element (BGP_NODE
, &no_neighbor_filter_list_cmd
);
13072 install_element (BGP_IPV4_NODE
, &neighbor_filter_list_cmd
);
13073 install_element (BGP_IPV4_NODE
, &no_neighbor_filter_list_cmd
);
13074 install_element (BGP_IPV4M_NODE
, &neighbor_filter_list_cmd
);
13075 install_element (BGP_IPV4M_NODE
, &no_neighbor_filter_list_cmd
);
13076 install_element (BGP_IPV6_NODE
, &neighbor_filter_list_cmd
);
13077 install_element (BGP_IPV6_NODE
, &no_neighbor_filter_list_cmd
);
13078 install_element (BGP_IPV6M_NODE
, &neighbor_filter_list_cmd
);
13079 install_element (BGP_IPV6M_NODE
, &no_neighbor_filter_list_cmd
);
13080 install_element (BGP_VPNV4_NODE
, &neighbor_filter_list_cmd
);
13081 install_element (BGP_VPNV4_NODE
, &no_neighbor_filter_list_cmd
);
13083 /* "neighbor route-map" commands. */
13084 install_element (BGP_NODE
, &neighbor_route_map_cmd
);
13085 install_element (BGP_NODE
, &no_neighbor_route_map_cmd
);
13086 install_element (BGP_IPV4_NODE
, &neighbor_route_map_cmd
);
13087 install_element (BGP_IPV4_NODE
, &no_neighbor_route_map_cmd
);
13088 install_element (BGP_IPV4M_NODE
, &neighbor_route_map_cmd
);
13089 install_element (BGP_IPV4M_NODE
, &no_neighbor_route_map_cmd
);
13090 install_element (BGP_IPV6_NODE
, &neighbor_route_map_cmd
);
13091 install_element (BGP_IPV6_NODE
, &no_neighbor_route_map_cmd
);
13092 install_element (BGP_IPV6M_NODE
, &neighbor_route_map_cmd
);
13093 install_element (BGP_IPV6M_NODE
, &no_neighbor_route_map_cmd
);
13094 install_element (BGP_VPNV4_NODE
, &neighbor_route_map_cmd
);
13095 install_element (BGP_VPNV4_NODE
, &no_neighbor_route_map_cmd
);
13097 /* "neighbor unsuppress-map" commands. */
13098 install_element (BGP_NODE
, &neighbor_unsuppress_map_cmd
);
13099 install_element (BGP_NODE
, &no_neighbor_unsuppress_map_cmd
);
13100 install_element (BGP_IPV4_NODE
, &neighbor_unsuppress_map_cmd
);
13101 install_element (BGP_IPV4_NODE
, &no_neighbor_unsuppress_map_cmd
);
13102 install_element (BGP_IPV4M_NODE
, &neighbor_unsuppress_map_cmd
);
13103 install_element (BGP_IPV4M_NODE
, &no_neighbor_unsuppress_map_cmd
);
13104 install_element (BGP_IPV6_NODE
, &neighbor_unsuppress_map_cmd
);
13105 install_element (BGP_IPV6_NODE
, &no_neighbor_unsuppress_map_cmd
);
13106 install_element (BGP_IPV6M_NODE
, &neighbor_unsuppress_map_cmd
);
13107 install_element (BGP_IPV6M_NODE
, &no_neighbor_unsuppress_map_cmd
);
13108 install_element (BGP_VPNV4_NODE
, &neighbor_unsuppress_map_cmd
);
13109 install_element (BGP_VPNV4_NODE
, &no_neighbor_unsuppress_map_cmd
);
13111 /* "neighbor maximum-prefix" commands. */
13112 install_element (BGP_NODE
, &neighbor_maximum_prefix_cmd
);
13113 install_element (BGP_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
13114 install_element (BGP_NODE
, &neighbor_maximum_prefix_warning_cmd
);
13115 install_element (BGP_NODE
, &neighbor_maximum_prefix_threshold_warning_cmd
);
13116 install_element (BGP_NODE
, &neighbor_maximum_prefix_restart_cmd
);
13117 install_element (BGP_NODE
, &neighbor_maximum_prefix_threshold_restart_cmd
);
13118 install_element (BGP_NODE
, &no_neighbor_maximum_prefix_cmd
);
13119 install_element (BGP_NODE
, &no_neighbor_maximum_prefix_val_cmd
);
13120 install_element (BGP_NODE
, &no_neighbor_maximum_prefix_threshold_cmd
);
13121 install_element (BGP_NODE
, &no_neighbor_maximum_prefix_warning_cmd
);
13122 install_element (BGP_NODE
, &no_neighbor_maximum_prefix_threshold_warning_cmd
);
13123 install_element (BGP_NODE
, &no_neighbor_maximum_prefix_restart_cmd
);
13124 install_element (BGP_NODE
, &no_neighbor_maximum_prefix_threshold_restart_cmd
);
13125 install_element (BGP_IPV4_NODE
, &neighbor_maximum_prefix_cmd
);
13126 install_element (BGP_IPV4_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
13127 install_element (BGP_IPV4_NODE
, &neighbor_maximum_prefix_warning_cmd
);
13128 install_element (BGP_IPV4_NODE
, &neighbor_maximum_prefix_threshold_warning_cmd
);
13129 install_element (BGP_IPV4_NODE
, &neighbor_maximum_prefix_restart_cmd
);
13130 install_element (BGP_IPV4_NODE
, &neighbor_maximum_prefix_threshold_restart_cmd
);
13131 install_element (BGP_IPV4_NODE
, &no_neighbor_maximum_prefix_cmd
);
13132 install_element (BGP_IPV4_NODE
, &no_neighbor_maximum_prefix_val_cmd
);
13133 install_element (BGP_IPV4_NODE
, &no_neighbor_maximum_prefix_threshold_cmd
);
13134 install_element (BGP_IPV4_NODE
, &no_neighbor_maximum_prefix_warning_cmd
);
13135 install_element (BGP_IPV4_NODE
, &no_neighbor_maximum_prefix_threshold_warning_cmd
);
13136 install_element (BGP_IPV4_NODE
, &no_neighbor_maximum_prefix_restart_cmd
);
13137 install_element (BGP_IPV4_NODE
, &no_neighbor_maximum_prefix_threshold_restart_cmd
);
13138 install_element (BGP_IPV4M_NODE
, &neighbor_maximum_prefix_cmd
);
13139 install_element (BGP_IPV4M_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
13140 install_element (BGP_IPV4M_NODE
, &neighbor_maximum_prefix_warning_cmd
);
13141 install_element (BGP_IPV4M_NODE
, &neighbor_maximum_prefix_threshold_warning_cmd
);
13142 install_element (BGP_IPV4M_NODE
, &neighbor_maximum_prefix_restart_cmd
);
13143 install_element (BGP_IPV4M_NODE
, &neighbor_maximum_prefix_threshold_restart_cmd
);
13144 install_element (BGP_IPV4M_NODE
, &no_neighbor_maximum_prefix_cmd
);
13145 install_element (BGP_IPV4M_NODE
, &no_neighbor_maximum_prefix_val_cmd
);
13146 install_element (BGP_IPV4M_NODE
, &no_neighbor_maximum_prefix_threshold_cmd
);
13147 install_element (BGP_IPV4M_NODE
, &no_neighbor_maximum_prefix_warning_cmd
);
13148 install_element (BGP_IPV4M_NODE
, &no_neighbor_maximum_prefix_threshold_warning_cmd
);
13149 install_element (BGP_IPV4M_NODE
, &no_neighbor_maximum_prefix_restart_cmd
);
13150 install_element (BGP_IPV4M_NODE
, &no_neighbor_maximum_prefix_threshold_restart_cmd
);
13151 install_element (BGP_IPV6_NODE
, &neighbor_maximum_prefix_cmd
);
13152 install_element (BGP_IPV6_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
13153 install_element (BGP_IPV6_NODE
, &neighbor_maximum_prefix_warning_cmd
);
13154 install_element (BGP_IPV6_NODE
, &neighbor_maximum_prefix_threshold_warning_cmd
);
13155 install_element (BGP_IPV6_NODE
, &neighbor_maximum_prefix_restart_cmd
);
13156 install_element (BGP_IPV6_NODE
, &neighbor_maximum_prefix_threshold_restart_cmd
);
13157 install_element (BGP_IPV6_NODE
, &no_neighbor_maximum_prefix_cmd
);
13158 install_element (BGP_IPV6_NODE
, &no_neighbor_maximum_prefix_val_cmd
);
13159 install_element (BGP_IPV6_NODE
, &no_neighbor_maximum_prefix_threshold_cmd
);
13160 install_element (BGP_IPV6_NODE
, &no_neighbor_maximum_prefix_warning_cmd
);
13161 install_element (BGP_IPV6_NODE
, &no_neighbor_maximum_prefix_threshold_warning_cmd
);
13162 install_element (BGP_IPV6_NODE
, &no_neighbor_maximum_prefix_restart_cmd
);
13163 install_element (BGP_IPV6_NODE
, &no_neighbor_maximum_prefix_threshold_restart_cmd
);
13164 install_element (BGP_IPV6M_NODE
, &neighbor_maximum_prefix_cmd
);
13165 install_element (BGP_IPV6M_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
13166 install_element (BGP_IPV6M_NODE
, &neighbor_maximum_prefix_warning_cmd
);
13167 install_element (BGP_IPV6M_NODE
, &neighbor_maximum_prefix_threshold_warning_cmd
);
13168 install_element (BGP_IPV6M_NODE
, &neighbor_maximum_prefix_restart_cmd
);
13169 install_element (BGP_IPV6M_NODE
, &neighbor_maximum_prefix_threshold_restart_cmd
);
13170 install_element (BGP_IPV6M_NODE
, &no_neighbor_maximum_prefix_cmd
);
13171 install_element (BGP_IPV6M_NODE
, &no_neighbor_maximum_prefix_val_cmd
);
13172 install_element (BGP_IPV6M_NODE
, &no_neighbor_maximum_prefix_threshold_cmd
);
13173 install_element (BGP_IPV6M_NODE
, &no_neighbor_maximum_prefix_warning_cmd
);
13174 install_element (BGP_IPV6M_NODE
, &no_neighbor_maximum_prefix_threshold_warning_cmd
);
13175 install_element (BGP_IPV6M_NODE
, &no_neighbor_maximum_prefix_restart_cmd
);
13176 install_element (BGP_IPV6M_NODE
, &no_neighbor_maximum_prefix_threshold_restart_cmd
);
13177 install_element (BGP_VPNV4_NODE
, &neighbor_maximum_prefix_cmd
);
13178 install_element (BGP_VPNV4_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
13179 install_element (BGP_VPNV4_NODE
, &neighbor_maximum_prefix_warning_cmd
);
13180 install_element (BGP_VPNV4_NODE
, &neighbor_maximum_prefix_threshold_warning_cmd
);
13181 install_element (BGP_VPNV4_NODE
, &neighbor_maximum_prefix_restart_cmd
);
13182 install_element (BGP_VPNV4_NODE
, &neighbor_maximum_prefix_threshold_restart_cmd
);
13183 install_element (BGP_VPNV4_NODE
, &no_neighbor_maximum_prefix_cmd
);
13184 install_element (BGP_VPNV4_NODE
, &no_neighbor_maximum_prefix_val_cmd
);
13185 install_element (BGP_VPNV4_NODE
, &no_neighbor_maximum_prefix_threshold_cmd
);
13186 install_element (BGP_VPNV4_NODE
, &no_neighbor_maximum_prefix_warning_cmd
);
13187 install_element (BGP_VPNV4_NODE
, &no_neighbor_maximum_prefix_threshold_warning_cmd
);
13188 install_element (BGP_VPNV4_NODE
, &no_neighbor_maximum_prefix_restart_cmd
);
13189 install_element (BGP_VPNV4_NODE
, &no_neighbor_maximum_prefix_threshold_restart_cmd
);
13191 /* "neighbor allowas-in" */
13192 install_element (BGP_NODE
, &neighbor_allowas_in_cmd
);
13193 install_element (BGP_NODE
, &neighbor_allowas_in_arg_cmd
);
13194 install_element (BGP_NODE
, &no_neighbor_allowas_in_cmd
);
13195 install_element (BGP_NODE
, &no_neighbor_allowas_in_val_cmd
);
13196 install_element (BGP_IPV4_NODE
, &neighbor_allowas_in_cmd
);
13197 install_element (BGP_IPV4_NODE
, &neighbor_allowas_in_arg_cmd
);
13198 install_element (BGP_IPV4_NODE
, &no_neighbor_allowas_in_cmd
);
13199 install_element (BGP_IPV4_NODE
, &no_neighbor_allowas_in_val_cmd
);
13200 install_element (BGP_IPV4M_NODE
, &neighbor_allowas_in_cmd
);
13201 install_element (BGP_IPV4M_NODE
, &neighbor_allowas_in_arg_cmd
);
13202 install_element (BGP_IPV4M_NODE
, &no_neighbor_allowas_in_cmd
);
13203 install_element (BGP_IPV4M_NODE
, &no_neighbor_allowas_in_val_cmd
);
13204 install_element (BGP_IPV6_NODE
, &neighbor_allowas_in_cmd
);
13205 install_element (BGP_IPV6_NODE
, &neighbor_allowas_in_arg_cmd
);
13206 install_element (BGP_IPV6_NODE
, &no_neighbor_allowas_in_cmd
);
13207 install_element (BGP_IPV6_NODE
, &no_neighbor_allowas_in_val_cmd
);
13208 install_element (BGP_IPV6M_NODE
, &neighbor_allowas_in_cmd
);
13209 install_element (BGP_IPV6M_NODE
, &neighbor_allowas_in_arg_cmd
);
13210 install_element (BGP_IPV6M_NODE
, &no_neighbor_allowas_in_cmd
);
13211 install_element (BGP_IPV6M_NODE
, &no_neighbor_allowas_in_val_cmd
);
13212 install_element (BGP_VPNV4_NODE
, &neighbor_allowas_in_cmd
);
13213 install_element (BGP_VPNV4_NODE
, &neighbor_allowas_in_arg_cmd
);
13214 install_element (BGP_VPNV4_NODE
, &no_neighbor_allowas_in_cmd
);
13215 install_element (BGP_VPNV4_NODE
, &no_neighbor_allowas_in_val_cmd
);
13217 /* address-family commands. */
13218 install_element (BGP_NODE
, &address_family_ipv4_cmd
);
13219 install_element (BGP_NODE
, &address_family_ipv4_safi_cmd
);
13221 install_element (BGP_NODE
, &address_family_ipv6_cmd
);
13222 install_element (BGP_NODE
, &address_family_ipv6_safi_cmd
);
13223 #endif /* HAVE_IPV6 */
13224 install_element (BGP_NODE
, &address_family_vpnv4_cmd
);
13225 install_element (BGP_NODE
, &address_family_vpnv4_unicast_cmd
);
13227 /* "exit-address-family" command. */
13228 install_element (BGP_IPV4_NODE
, &exit_address_family_cmd
);
13229 install_element (BGP_IPV4M_NODE
, &exit_address_family_cmd
);
13230 install_element (BGP_IPV6_NODE
, &exit_address_family_cmd
);
13231 install_element (BGP_IPV6M_NODE
, &exit_address_family_cmd
);
13232 install_element (BGP_VPNV4_NODE
, &exit_address_family_cmd
);
13234 /* "clear ip bgp commands" */
13235 install_element (ENABLE_NODE
, &clear_ip_bgp_all_cmd
);
13236 install_element (ENABLE_NODE
, &clear_ip_bgp_instance_all_cmd
);
13237 install_element (ENABLE_NODE
, &clear_ip_bgp_as_cmd
);
13238 install_element (ENABLE_NODE
, &clear_ip_bgp_peer_cmd
);
13239 install_element (ENABLE_NODE
, &clear_ip_bgp_peer_group_cmd
);
13240 install_element (ENABLE_NODE
, &clear_ip_bgp_external_cmd
);
13242 install_element (ENABLE_NODE
, &clear_bgp_all_cmd
);
13243 install_element (ENABLE_NODE
, &clear_bgp_instance_all_cmd
);
13244 install_element (ENABLE_NODE
, &clear_bgp_ipv6_all_cmd
);
13245 install_element (ENABLE_NODE
, &clear_bgp_peer_cmd
);
13246 install_element (ENABLE_NODE
, &clear_bgp_ipv6_peer_cmd
);
13247 install_element (ENABLE_NODE
, &clear_bgp_peer_group_cmd
);
13248 install_element (ENABLE_NODE
, &clear_bgp_ipv6_peer_group_cmd
);
13249 install_element (ENABLE_NODE
, &clear_bgp_external_cmd
);
13250 install_element (ENABLE_NODE
, &clear_bgp_ipv6_external_cmd
);
13251 install_element (ENABLE_NODE
, &clear_bgp_as_cmd
);
13252 install_element (ENABLE_NODE
, &clear_bgp_ipv6_as_cmd
);
13253 #endif /* HAVE_IPV6 */
13255 /* "clear ip bgp neighbor soft in" */
13256 install_element (ENABLE_NODE
, &clear_ip_bgp_all_soft_in_cmd
);
13257 install_element (ENABLE_NODE
, &clear_ip_bgp_instance_all_soft_in_cmd
);
13258 install_element (ENABLE_NODE
, &clear_ip_bgp_all_in_cmd
);
13259 install_element (ENABLE_NODE
, &clear_ip_bgp_all_in_prefix_filter_cmd
);
13260 install_element (ENABLE_NODE
, &clear_ip_bgp_instance_all_in_prefix_filter_cmd
);
13261 install_element (ENABLE_NODE
, &clear_ip_bgp_peer_soft_in_cmd
);
13262 install_element (ENABLE_NODE
, &clear_ip_bgp_peer_in_cmd
);
13263 install_element (ENABLE_NODE
, &clear_ip_bgp_peer_in_prefix_filter_cmd
);
13264 install_element (ENABLE_NODE
, &clear_ip_bgp_peer_group_soft_in_cmd
);
13265 install_element (ENABLE_NODE
, &clear_ip_bgp_peer_group_in_cmd
);
13266 install_element (ENABLE_NODE
, &clear_ip_bgp_peer_group_in_prefix_filter_cmd
);
13267 install_element (ENABLE_NODE
, &clear_ip_bgp_external_soft_in_cmd
);
13268 install_element (ENABLE_NODE
, &clear_ip_bgp_external_in_cmd
);
13269 install_element (ENABLE_NODE
, &clear_ip_bgp_external_in_prefix_filter_cmd
);
13270 install_element (ENABLE_NODE
, &clear_ip_bgp_as_soft_in_cmd
);
13271 install_element (ENABLE_NODE
, &clear_ip_bgp_as_in_cmd
);
13272 install_element (ENABLE_NODE
, &clear_ip_bgp_as_in_prefix_filter_cmd
);
13273 install_element (ENABLE_NODE
, &clear_ip_bgp_all_ipv4_soft_in_cmd
);
13274 install_element (ENABLE_NODE
, &clear_ip_bgp_instance_all_ipv4_soft_in_cmd
);
13275 install_element (ENABLE_NODE
, &clear_ip_bgp_all_ipv4_in_cmd
);
13276 install_element (ENABLE_NODE
, &clear_ip_bgp_all_ipv4_in_prefix_filter_cmd
);
13277 install_element (ENABLE_NODE
, &clear_ip_bgp_instance_all_ipv4_in_prefix_filter_cmd
);
13278 install_element (ENABLE_NODE
, &clear_ip_bgp_peer_ipv4_soft_in_cmd
);
13279 install_element (ENABLE_NODE
, &clear_ip_bgp_peer_ipv4_in_cmd
);
13280 install_element (ENABLE_NODE
, &clear_ip_bgp_peer_ipv4_in_prefix_filter_cmd
);
13281 install_element (ENABLE_NODE
, &clear_ip_bgp_peer_group_ipv4_soft_in_cmd
);
13282 install_element (ENABLE_NODE
, &clear_ip_bgp_peer_group_ipv4_in_cmd
);
13283 install_element (ENABLE_NODE
, &clear_ip_bgp_peer_group_ipv4_in_prefix_filter_cmd
);
13284 install_element (ENABLE_NODE
, &clear_ip_bgp_external_ipv4_soft_in_cmd
);
13285 install_element (ENABLE_NODE
, &clear_ip_bgp_external_ipv4_in_cmd
);
13286 install_element (ENABLE_NODE
, &clear_ip_bgp_external_ipv4_in_prefix_filter_cmd
);
13287 install_element (ENABLE_NODE
, &clear_ip_bgp_as_ipv4_soft_in_cmd
);
13288 install_element (ENABLE_NODE
, &clear_ip_bgp_as_ipv4_in_cmd
);
13289 install_element (ENABLE_NODE
, &clear_ip_bgp_as_ipv4_in_prefix_filter_cmd
);
13290 install_element (ENABLE_NODE
, &clear_ip_bgp_all_vpnv4_soft_in_cmd
);
13291 install_element (ENABLE_NODE
, &clear_ip_bgp_all_vpnv4_in_cmd
);
13292 install_element (ENABLE_NODE
, &clear_ip_bgp_peer_vpnv4_soft_in_cmd
);
13293 install_element (ENABLE_NODE
, &clear_ip_bgp_peer_vpnv4_in_cmd
);
13294 install_element (ENABLE_NODE
, &clear_ip_bgp_as_vpnv4_soft_in_cmd
);
13295 install_element (ENABLE_NODE
, &clear_ip_bgp_as_vpnv4_in_cmd
);
13297 install_element (ENABLE_NODE
, &clear_bgp_all_soft_in_cmd
);
13298 install_element (ENABLE_NODE
, &clear_bgp_instance_all_soft_in_cmd
);
13299 install_element (ENABLE_NODE
, &clear_bgp_all_in_cmd
);
13300 install_element (ENABLE_NODE
, &clear_bgp_all_in_prefix_filter_cmd
);
13301 install_element (ENABLE_NODE
, &clear_bgp_peer_soft_in_cmd
);
13302 install_element (ENABLE_NODE
, &clear_bgp_peer_in_cmd
);
13303 install_element (ENABLE_NODE
, &clear_bgp_peer_in_prefix_filter_cmd
);
13304 install_element (ENABLE_NODE
, &clear_bgp_peer_group_soft_in_cmd
);
13305 install_element (ENABLE_NODE
, &clear_bgp_peer_group_in_cmd
);
13306 install_element (ENABLE_NODE
, &clear_bgp_peer_group_in_prefix_filter_cmd
);
13307 install_element (ENABLE_NODE
, &clear_bgp_external_soft_in_cmd
);
13308 install_element (ENABLE_NODE
, &clear_bgp_external_in_cmd
);
13309 install_element (ENABLE_NODE
, &clear_bgp_external_in_prefix_filter_cmd
);
13310 install_element (ENABLE_NODE
, &clear_bgp_as_soft_in_cmd
);
13311 install_element (ENABLE_NODE
, &clear_bgp_as_in_cmd
);
13312 install_element (ENABLE_NODE
, &clear_bgp_as_in_prefix_filter_cmd
);
13313 install_element (ENABLE_NODE
, &clear_bgp_ipv6_all_soft_in_cmd
);
13314 install_element (ENABLE_NODE
, &clear_bgp_ipv6_all_in_cmd
);
13315 install_element (ENABLE_NODE
, &clear_bgp_ipv6_all_in_prefix_filter_cmd
);
13316 install_element (ENABLE_NODE
, &clear_bgp_ipv6_peer_soft_in_cmd
);
13317 install_element (ENABLE_NODE
, &clear_bgp_ipv6_peer_in_cmd
);
13318 install_element (ENABLE_NODE
, &clear_bgp_ipv6_peer_in_prefix_filter_cmd
);
13319 install_element (ENABLE_NODE
, &clear_bgp_ipv6_peer_group_soft_in_cmd
);
13320 install_element (ENABLE_NODE
, &clear_bgp_ipv6_peer_group_in_cmd
);
13321 install_element (ENABLE_NODE
, &clear_bgp_ipv6_peer_group_in_prefix_filter_cmd
);
13322 install_element (ENABLE_NODE
, &clear_bgp_ipv6_external_soft_in_cmd
);
13323 install_element (ENABLE_NODE
, &clear_bgp_ipv6_external_in_cmd
);
13324 install_element (ENABLE_NODE
, &clear_bgp_ipv6_external_in_prefix_filter_cmd
);
13325 install_element (ENABLE_NODE
, &clear_bgp_ipv6_as_soft_in_cmd
);
13326 install_element (ENABLE_NODE
, &clear_bgp_ipv6_as_in_cmd
);
13327 install_element (ENABLE_NODE
, &clear_bgp_ipv6_as_in_prefix_filter_cmd
);
13328 #endif /* HAVE_IPV6 */
13330 /* clear ip bgp prefix */
13331 install_element (ENABLE_NODE
, &clear_ip_bgp_prefix_cmd
);
13332 install_element (ENABLE_NODE
, &clear_bgp_ipv6_safi_prefix_cmd
);
13334 /* "clear ip bgp neighbor soft out" */
13335 install_element (ENABLE_NODE
, &clear_ip_bgp_all_soft_out_cmd
);
13336 install_element (ENABLE_NODE
, &clear_ip_bgp_instance_all_soft_out_cmd
);
13337 install_element (ENABLE_NODE
, &clear_ip_bgp_all_out_cmd
);
13338 install_element (ENABLE_NODE
, &clear_ip_bgp_peer_soft_out_cmd
);
13339 install_element (ENABLE_NODE
, &clear_ip_bgp_peer_out_cmd
);
13340 install_element (ENABLE_NODE
, &clear_ip_bgp_peer_group_soft_out_cmd
);
13341 install_element (ENABLE_NODE
, &clear_ip_bgp_peer_group_out_cmd
);
13342 install_element (ENABLE_NODE
, &clear_ip_bgp_external_soft_out_cmd
);
13343 install_element (ENABLE_NODE
, &clear_ip_bgp_external_out_cmd
);
13344 install_element (ENABLE_NODE
, &clear_ip_bgp_as_soft_out_cmd
);
13345 install_element (ENABLE_NODE
, &clear_ip_bgp_as_out_cmd
);
13346 install_element (ENABLE_NODE
, &clear_ip_bgp_all_ipv4_soft_out_cmd
);
13347 install_element (ENABLE_NODE
, &clear_ip_bgp_instance_all_ipv4_soft_out_cmd
);
13348 install_element (ENABLE_NODE
, &clear_ip_bgp_all_ipv4_out_cmd
);
13349 install_element (ENABLE_NODE
, &clear_ip_bgp_peer_ipv4_soft_out_cmd
);
13350 install_element (ENABLE_NODE
, &clear_ip_bgp_peer_ipv4_out_cmd
);
13351 install_element (ENABLE_NODE
, &clear_ip_bgp_peer_group_ipv4_soft_out_cmd
);
13352 install_element (ENABLE_NODE
, &clear_ip_bgp_peer_group_ipv4_out_cmd
);
13353 install_element (ENABLE_NODE
, &clear_ip_bgp_external_ipv4_soft_out_cmd
);
13354 install_element (ENABLE_NODE
, &clear_ip_bgp_external_ipv4_out_cmd
);
13355 install_element (ENABLE_NODE
, &clear_ip_bgp_as_ipv4_soft_out_cmd
);
13356 install_element (ENABLE_NODE
, &clear_ip_bgp_as_ipv4_out_cmd
);
13357 install_element (ENABLE_NODE
, &clear_ip_bgp_all_vpnv4_soft_out_cmd
);
13358 install_element (ENABLE_NODE
, &clear_ip_bgp_all_vpnv4_out_cmd
);
13359 install_element (ENABLE_NODE
, &clear_ip_bgp_peer_vpnv4_soft_out_cmd
);
13360 install_element (ENABLE_NODE
, &clear_ip_bgp_peer_vpnv4_out_cmd
);
13361 install_element (ENABLE_NODE
, &clear_ip_bgp_as_vpnv4_soft_out_cmd
);
13362 install_element (ENABLE_NODE
, &clear_ip_bgp_as_vpnv4_out_cmd
);
13364 install_element (ENABLE_NODE
, &clear_bgp_all_soft_out_cmd
);
13365 install_element (ENABLE_NODE
, &clear_bgp_instance_all_soft_out_cmd
);
13366 install_element (ENABLE_NODE
, &clear_bgp_all_out_cmd
);
13367 install_element (ENABLE_NODE
, &clear_bgp_peer_soft_out_cmd
);
13368 install_element (ENABLE_NODE
, &clear_bgp_peer_out_cmd
);
13369 install_element (ENABLE_NODE
, &clear_bgp_peer_group_soft_out_cmd
);
13370 install_element (ENABLE_NODE
, &clear_bgp_peer_group_out_cmd
);
13371 install_element (ENABLE_NODE
, &clear_bgp_external_soft_out_cmd
);
13372 install_element (ENABLE_NODE
, &clear_bgp_external_out_cmd
);
13373 install_element (ENABLE_NODE
, &clear_bgp_as_soft_out_cmd
);
13374 install_element (ENABLE_NODE
, &clear_bgp_as_out_cmd
);
13375 install_element (ENABLE_NODE
, &clear_bgp_ipv6_all_soft_out_cmd
);
13376 install_element (ENABLE_NODE
, &clear_bgp_ipv6_all_out_cmd
);
13377 install_element (ENABLE_NODE
, &clear_bgp_ipv6_peer_soft_out_cmd
);
13378 install_element (ENABLE_NODE
, &clear_bgp_ipv6_peer_out_cmd
);
13379 install_element (ENABLE_NODE
, &clear_bgp_ipv6_peer_group_soft_out_cmd
);
13380 install_element (ENABLE_NODE
, &clear_bgp_ipv6_peer_group_out_cmd
);
13381 install_element (ENABLE_NODE
, &clear_bgp_ipv6_external_soft_out_cmd
);
13382 install_element (ENABLE_NODE
, &clear_bgp_ipv6_external_out_cmd
);
13383 install_element (ENABLE_NODE
, &clear_bgp_ipv6_as_soft_out_cmd
);
13384 install_element (ENABLE_NODE
, &clear_bgp_ipv6_as_out_cmd
);
13385 #endif /* HAVE_IPV6 */
13387 /* "clear ip bgp neighbor soft" */
13388 install_element (ENABLE_NODE
, &clear_ip_bgp_all_soft_cmd
);
13389 install_element (ENABLE_NODE
, &clear_ip_bgp_instance_all_soft_cmd
);
13390 install_element (ENABLE_NODE
, &clear_ip_bgp_peer_soft_cmd
);
13391 install_element (ENABLE_NODE
, &clear_ip_bgp_peer_group_soft_cmd
);
13392 install_element (ENABLE_NODE
, &clear_ip_bgp_external_soft_cmd
);
13393 install_element (ENABLE_NODE
, &clear_ip_bgp_as_soft_cmd
);
13394 install_element (ENABLE_NODE
, &clear_ip_bgp_all_ipv4_soft_cmd
);
13395 install_element (ENABLE_NODE
, &clear_ip_bgp_instance_all_ipv4_soft_cmd
);
13396 install_element (ENABLE_NODE
, &clear_ip_bgp_peer_ipv4_soft_cmd
);
13397 install_element (ENABLE_NODE
, &clear_ip_bgp_peer_group_ipv4_soft_cmd
);
13398 install_element (ENABLE_NODE
, &clear_ip_bgp_external_ipv4_soft_cmd
);
13399 install_element (ENABLE_NODE
, &clear_ip_bgp_as_ipv4_soft_cmd
);
13400 install_element (ENABLE_NODE
, &clear_ip_bgp_all_vpnv4_soft_cmd
);
13401 install_element (ENABLE_NODE
, &clear_ip_bgp_peer_vpnv4_soft_cmd
);
13402 install_element (ENABLE_NODE
, &clear_ip_bgp_as_vpnv4_soft_cmd
);
13404 install_element (ENABLE_NODE
, &clear_bgp_all_soft_cmd
);
13405 install_element (ENABLE_NODE
, &clear_bgp_instance_all_soft_cmd
);
13406 install_element (ENABLE_NODE
, &clear_bgp_peer_soft_cmd
);
13407 install_element (ENABLE_NODE
, &clear_bgp_peer_group_soft_cmd
);
13408 install_element (ENABLE_NODE
, &clear_bgp_external_soft_cmd
);
13409 install_element (ENABLE_NODE
, &clear_bgp_as_soft_cmd
);
13410 install_element (ENABLE_NODE
, &clear_bgp_ipv6_all_soft_cmd
);
13411 install_element (ENABLE_NODE
, &clear_bgp_ipv6_peer_soft_cmd
);
13412 install_element (ENABLE_NODE
, &clear_bgp_ipv6_peer_group_soft_cmd
);
13413 install_element (ENABLE_NODE
, &clear_bgp_ipv6_external_soft_cmd
);
13414 install_element (ENABLE_NODE
, &clear_bgp_ipv6_as_soft_cmd
);
13415 #endif /* HAVE_IPV6 */
13417 /* "show ip bgp summary" commands. */
13418 install_element (VIEW_NODE
, &show_ip_bgp_summary_cmd
);
13419 install_element (VIEW_NODE
, &show_ip_bgp_updgrps_cmd
);
13420 install_element (VIEW_NODE
, &show_ip_bgp_instance_updgrps_cmd
);
13421 install_element (VIEW_NODE
, &show_bgp_updgrps_cmd
);
13422 install_element (VIEW_NODE
, &show_bgp_ipv6_updgrps_cmd
);
13423 install_element (VIEW_NODE
, &show_bgp_instance_ipv6_updgrps_cmd
);
13424 install_element (VIEW_NODE
, &show_ip_bgp_updgrps_s_cmd
);
13425 install_element (VIEW_NODE
, &show_ip_bgp_instance_updgrps_s_cmd
);
13426 install_element (VIEW_NODE
, &show_bgp_updgrps_s_cmd
);
13427 install_element (VIEW_NODE
, &show_bgp_ipv6_updgrps_s_cmd
);
13428 install_element (VIEW_NODE
, &show_bgp_instance_ipv6_updgrps_s_cmd
);
13429 install_element (VIEW_NODE
, &show_ip_bgp_updgrps_adj_cmd
);
13430 install_element (VIEW_NODE
, &show_ip_bgp_instance_updgrps_adj_cmd
);
13431 install_element (VIEW_NODE
, &show_bgp_updgrps_adj_cmd
);
13432 install_element (VIEW_NODE
, &show_bgp_instance_updgrps_adj_cmd
);
13433 install_element (VIEW_NODE
, &show_bgp_updgrps_afi_adj_cmd
);
13434 install_element (VIEW_NODE
, &show_ip_bgp_updgrps_adj_s_cmd
);
13435 install_element (VIEW_NODE
, &show_ip_bgp_instance_updgrps_adj_s_cmd
);
13436 install_element (VIEW_NODE
, &show_bgp_updgrps_adj_s_cmd
);
13437 install_element (VIEW_NODE
, &show_bgp_instance_updgrps_adj_s_cmd
);
13438 install_element (VIEW_NODE
, &show_bgp_updgrps_afi_adj_s_cmd
);
13439 install_element (VIEW_NODE
, &show_ip_bgp_instance_summary_cmd
);
13440 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_summary_cmd
);
13441 install_element (VIEW_NODE
, &show_bgp_ipv4_safi_summary_cmd
);
13442 install_element (VIEW_NODE
, &show_ip_bgp_instance_ipv4_summary_cmd
);
13443 install_element (VIEW_NODE
, &show_bgp_instance_ipv4_safi_summary_cmd
);
13444 install_element (VIEW_NODE
, &show_ip_bgp_vpnv4_all_summary_cmd
);
13445 install_element (VIEW_NODE
, &show_ip_bgp_vpnv4_rd_summary_cmd
);
13447 install_element (VIEW_NODE
, &show_bgp_summary_cmd
);
13448 install_element (VIEW_NODE
, &show_bgp_instance_summary_cmd
);
13449 install_element (VIEW_NODE
, &show_bgp_ipv6_summary_cmd
);
13450 install_element (VIEW_NODE
, &show_bgp_ipv6_safi_summary_cmd
);
13451 install_element (VIEW_NODE
, &show_bgp_instance_ipv6_summary_cmd
);
13452 install_element (VIEW_NODE
, &show_bgp_instance_ipv6_safi_summary_cmd
);
13453 #endif /* HAVE_IPV6 */
13454 install_element (RESTRICTED_NODE
, &show_ip_bgp_summary_cmd
);
13455 install_element (RESTRICTED_NODE
, &show_ip_bgp_updgrps_cmd
);
13456 install_element (RESTRICTED_NODE
, &show_ip_bgp_instance_updgrps_cmd
);
13457 install_element (RESTRICTED_NODE
, &show_bgp_updgrps_cmd
);
13458 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_updgrps_cmd
);
13459 install_element (RESTRICTED_NODE
, &show_bgp_instance_ipv6_updgrps_cmd
);
13460 install_element (RESTRICTED_NODE
, &show_ip_bgp_updgrps_s_cmd
);
13461 install_element (RESTRICTED_NODE
, &show_ip_bgp_instance_updgrps_s_cmd
);
13462 install_element (RESTRICTED_NODE
, &show_bgp_updgrps_s_cmd
);
13463 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_updgrps_s_cmd
);
13464 install_element (RESTRICTED_NODE
, &show_bgp_instance_ipv6_updgrps_s_cmd
);
13465 install_element (RESTRICTED_NODE
, &show_ip_bgp_updgrps_adj_cmd
);
13466 install_element (RESTRICTED_NODE
, &show_ip_bgp_instance_updgrps_adj_cmd
);
13467 install_element (RESTRICTED_NODE
, &show_bgp_updgrps_adj_cmd
);
13468 install_element (RESTRICTED_NODE
, &show_bgp_instance_updgrps_adj_cmd
);
13469 install_element (RESTRICTED_NODE
, &show_bgp_updgrps_afi_adj_cmd
);
13470 install_element (RESTRICTED_NODE
, &show_ip_bgp_updgrps_adj_s_cmd
);
13471 install_element (RESTRICTED_NODE
, &show_ip_bgp_instance_updgrps_adj_s_cmd
);
13472 install_element (RESTRICTED_NODE
, &show_bgp_updgrps_adj_s_cmd
);
13473 install_element (RESTRICTED_NODE
, &show_bgp_instance_updgrps_adj_s_cmd
);
13474 install_element (RESTRICTED_NODE
, &show_bgp_updgrps_afi_adj_s_cmd
);
13475 install_element (RESTRICTED_NODE
, &show_ip_bgp_instance_summary_cmd
);
13476 install_element (RESTRICTED_NODE
, &show_ip_bgp_ipv4_summary_cmd
);
13477 install_element (RESTRICTED_NODE
, &show_bgp_ipv4_safi_summary_cmd
);
13478 install_element (RESTRICTED_NODE
, &show_ip_bgp_instance_ipv4_summary_cmd
);
13479 install_element (RESTRICTED_NODE
, &show_bgp_instance_ipv4_safi_summary_cmd
);
13480 install_element (RESTRICTED_NODE
, &show_ip_bgp_vpnv4_all_summary_cmd
);
13481 install_element (RESTRICTED_NODE
, &show_ip_bgp_vpnv4_rd_summary_cmd
);
13483 install_element (RESTRICTED_NODE
, &show_bgp_summary_cmd
);
13484 install_element (RESTRICTED_NODE
, &show_bgp_instance_summary_cmd
);
13485 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_summary_cmd
);
13486 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_safi_summary_cmd
);
13487 install_element (RESTRICTED_NODE
, &show_bgp_instance_ipv6_summary_cmd
);
13488 install_element (RESTRICTED_NODE
, &show_bgp_instance_ipv6_safi_summary_cmd
);
13489 #endif /* HAVE_IPV6 */
13490 install_element (ENABLE_NODE
, &show_ip_bgp_summary_cmd
);
13491 install_element (ENABLE_NODE
, &show_ip_bgp_updgrps_cmd
);
13492 install_element (ENABLE_NODE
, &show_ip_bgp_instance_updgrps_cmd
);
13493 install_element (ENABLE_NODE
, &show_bgp_updgrps_cmd
);
13494 install_element (ENABLE_NODE
, &show_bgp_ipv6_updgrps_cmd
);
13495 install_element (ENABLE_NODE
, &show_bgp_instance_ipv6_updgrps_cmd
);
13496 install_element (ENABLE_NODE
, &show_ip_bgp_updgrps_s_cmd
);
13497 install_element (ENABLE_NODE
, &show_ip_bgp_instance_updgrps_s_cmd
);
13498 install_element (ENABLE_NODE
, &show_bgp_updgrps_s_cmd
);
13499 install_element (ENABLE_NODE
, &show_bgp_ipv6_updgrps_s_cmd
);
13500 install_element (ENABLE_NODE
, &show_bgp_instance_ipv6_updgrps_s_cmd
);
13501 install_element (ENABLE_NODE
, &show_ip_bgp_updgrps_adj_cmd
);
13502 install_element (ENABLE_NODE
, &show_ip_bgp_instance_updgrps_adj_cmd
);
13503 install_element (ENABLE_NODE
, &show_bgp_updgrps_adj_cmd
);
13504 install_element (ENABLE_NODE
, &show_bgp_instance_updgrps_adj_cmd
);
13505 install_element (ENABLE_NODE
, &show_bgp_updgrps_afi_adj_cmd
);
13506 install_element (ENABLE_NODE
, &show_ip_bgp_updgrps_adj_s_cmd
);
13507 install_element (ENABLE_NODE
, &show_ip_bgp_instance_updgrps_adj_s_cmd
);
13508 install_element (ENABLE_NODE
, &show_bgp_updgrps_adj_s_cmd
);
13509 install_element (ENABLE_NODE
, &show_bgp_instance_updgrps_adj_s_cmd
);
13510 install_element (ENABLE_NODE
, &show_bgp_updgrps_afi_adj_s_cmd
);
13511 install_element (ENABLE_NODE
, &show_ip_bgp_instance_summary_cmd
);
13512 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_summary_cmd
);
13513 install_element (ENABLE_NODE
, &show_bgp_ipv4_safi_summary_cmd
);
13514 install_element (ENABLE_NODE
, &show_ip_bgp_instance_ipv4_summary_cmd
);
13515 install_element (ENABLE_NODE
, &show_bgp_instance_ipv4_safi_summary_cmd
);
13516 install_element (ENABLE_NODE
, &show_ip_bgp_vpnv4_all_summary_cmd
);
13517 install_element (ENABLE_NODE
, &show_ip_bgp_vpnv4_rd_summary_cmd
);
13519 install_element (ENABLE_NODE
, &show_bgp_summary_cmd
);
13520 install_element (ENABLE_NODE
, &show_bgp_instance_summary_cmd
);
13521 install_element (ENABLE_NODE
, &show_bgp_ipv6_summary_cmd
);
13522 install_element (ENABLE_NODE
, &show_bgp_ipv6_safi_summary_cmd
);
13523 install_element (ENABLE_NODE
, &show_bgp_instance_ipv6_summary_cmd
);
13524 install_element (ENABLE_NODE
, &show_bgp_instance_ipv6_safi_summary_cmd
);
13525 #endif /* HAVE_IPV6 */
13527 /* "show ip bgp neighbors" commands. */
13528 install_element (VIEW_NODE
, &show_ip_bgp_neighbors_cmd
);
13529 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_neighbors_cmd
);
13530 install_element (VIEW_NODE
, &show_ip_bgp_neighbors_peer_cmd
);
13531 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_neighbors_peer_cmd
);
13532 install_element (VIEW_NODE
, &show_ip_bgp_vpnv4_all_neighbors_cmd
);
13533 install_element (VIEW_NODE
, &show_ip_bgp_vpnv4_rd_neighbors_cmd
);
13534 install_element (VIEW_NODE
, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd
);
13535 install_element (VIEW_NODE
, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd
);
13536 install_element (VIEW_NODE
, &show_ip_bgp_instance_neighbors_cmd
);
13537 install_element (VIEW_NODE
, &show_ip_bgp_instance_neighbors_peer_cmd
);
13538 install_element (RESTRICTED_NODE
, &show_ip_bgp_neighbors_peer_cmd
);
13539 install_element (RESTRICTED_NODE
, &show_ip_bgp_ipv4_neighbors_peer_cmd
);
13540 install_element (RESTRICTED_NODE
, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd
);
13541 install_element (RESTRICTED_NODE
, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd
);
13542 install_element (RESTRICTED_NODE
, &show_ip_bgp_instance_neighbors_peer_cmd
);
13543 install_element (ENABLE_NODE
, &show_ip_bgp_neighbors_cmd
);
13544 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_neighbors_cmd
);
13545 install_element (ENABLE_NODE
, &show_ip_bgp_neighbors_peer_cmd
);
13546 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_neighbors_peer_cmd
);
13547 install_element (ENABLE_NODE
, &show_ip_bgp_vpnv4_all_neighbors_cmd
);
13548 install_element (ENABLE_NODE
, &show_ip_bgp_vpnv4_rd_neighbors_cmd
);
13549 install_element (ENABLE_NODE
, &show_ip_bgp_vpnv4_all_neighbors_peer_cmd
);
13550 install_element (ENABLE_NODE
, &show_ip_bgp_vpnv4_rd_neighbors_peer_cmd
);
13551 install_element (ENABLE_NODE
, &show_ip_bgp_instance_neighbors_cmd
);
13552 install_element (ENABLE_NODE
, &show_ip_bgp_instance_neighbors_peer_cmd
);
13555 install_element (VIEW_NODE
, &show_bgp_neighbors_cmd
);
13556 install_element (VIEW_NODE
, &show_bgp_ipv6_neighbors_cmd
);
13557 install_element (VIEW_NODE
, &show_bgp_neighbors_peer_cmd
);
13558 install_element (VIEW_NODE
, &show_bgp_ipv6_neighbors_peer_cmd
);
13559 install_element (VIEW_NODE
, &show_bgp_instance_neighbors_cmd
);
13560 install_element (VIEW_NODE
, &show_bgp_instance_ipv6_neighbors_cmd
);
13561 install_element (VIEW_NODE
, &show_bgp_instance_neighbors_peer_cmd
);
13562 install_element (VIEW_NODE
, &show_bgp_instance_ipv6_neighbors_peer_cmd
);
13563 install_element (RESTRICTED_NODE
, &show_bgp_neighbors_peer_cmd
);
13564 install_element (RESTRICTED_NODE
, &show_bgp_ipv6_neighbors_peer_cmd
);
13565 install_element (RESTRICTED_NODE
, &show_bgp_instance_neighbors_peer_cmd
);
13566 install_element (RESTRICTED_NODE
, &show_bgp_instance_ipv6_neighbors_peer_cmd
);
13567 install_element (ENABLE_NODE
, &show_bgp_neighbors_cmd
);
13568 install_element (ENABLE_NODE
, &show_bgp_ipv6_neighbors_cmd
);
13569 install_element (ENABLE_NODE
, &show_bgp_neighbors_peer_cmd
);
13570 install_element (ENABLE_NODE
, &show_bgp_ipv6_neighbors_peer_cmd
);
13571 install_element (ENABLE_NODE
, &show_bgp_instance_neighbors_cmd
);
13572 install_element (ENABLE_NODE
, &show_bgp_instance_ipv6_neighbors_cmd
);
13573 install_element (ENABLE_NODE
, &show_bgp_instance_neighbors_peer_cmd
);
13574 install_element (ENABLE_NODE
, &show_bgp_instance_ipv6_neighbors_peer_cmd
);
13576 /* Old commands. */
13577 install_element (VIEW_NODE
, &show_ipv6_bgp_summary_cmd
);
13578 install_element (VIEW_NODE
, &show_ipv6_mbgp_summary_cmd
);
13579 install_element (ENABLE_NODE
, &show_ipv6_bgp_summary_cmd
);
13580 install_element (ENABLE_NODE
, &show_ipv6_mbgp_summary_cmd
);
13581 #endif /* HAVE_IPV6 */
13583 /* "show ip bgp peer-group" commands. */
13584 install_element (VIEW_NODE
, &show_ip_bgp_peer_groups_cmd
);
13585 install_element (VIEW_NODE
, &show_ip_bgp_instance_peer_groups_cmd
);
13586 install_element (VIEW_NODE
, &show_ip_bgp_peer_group_cmd
);
13587 install_element (VIEW_NODE
, &show_ip_bgp_instance_peer_group_cmd
);
13588 install_element (ENABLE_NODE
, &show_ip_bgp_peer_groups_cmd
);
13589 install_element (ENABLE_NODE
, &show_ip_bgp_instance_peer_groups_cmd
);
13590 install_element (ENABLE_NODE
, &show_ip_bgp_peer_group_cmd
);
13591 install_element (ENABLE_NODE
, &show_ip_bgp_instance_peer_group_cmd
);
13593 /* "show ip bgp paths" commands. */
13594 install_element (VIEW_NODE
, &show_ip_bgp_paths_cmd
);
13595 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_paths_cmd
);
13596 install_element (ENABLE_NODE
, &show_ip_bgp_paths_cmd
);
13597 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_paths_cmd
);
13599 /* "show ip bgp community" commands. */
13600 install_element (VIEW_NODE
, &show_ip_bgp_community_info_cmd
);
13601 install_element (ENABLE_NODE
, &show_ip_bgp_community_info_cmd
);
13603 /* "show ip bgp attribute-info" commands. */
13604 install_element (VIEW_NODE
, &show_ip_bgp_attr_info_cmd
);
13605 install_element (ENABLE_NODE
, &show_ip_bgp_attr_info_cmd
);
13607 /* "redistribute" commands. */
13608 install_element (BGP_NODE
, &bgp_redistribute_ipv4_cmd
);
13609 install_element (BGP_NODE
, &no_bgp_redistribute_ipv4_cmd
);
13610 install_element (BGP_NODE
, &bgp_redistribute_ipv4_rmap_cmd
);
13611 install_element (BGP_NODE
, &no_bgp_redistribute_ipv4_rmap_cmd
);
13612 install_element (BGP_NODE
, &bgp_redistribute_ipv4_metric_cmd
);
13613 install_element (BGP_NODE
, &no_bgp_redistribute_ipv4_metric_cmd
);
13614 install_element (BGP_NODE
, &bgp_redistribute_ipv4_rmap_metric_cmd
);
13615 install_element (BGP_NODE
, &bgp_redistribute_ipv4_metric_rmap_cmd
);
13616 install_element (BGP_NODE
, &no_bgp_redistribute_ipv4_rmap_metric_cmd
);
13617 install_element (BGP_NODE
, &no_bgp_redistribute_ipv4_metric_rmap_cmd
);
13618 install_element (BGP_NODE
, &bgp_redistribute_ipv4_ospf_cmd
);
13619 install_element (BGP_NODE
, &no_bgp_redistribute_ipv4_ospf_cmd
);
13620 install_element (BGP_NODE
, &bgp_redistribute_ipv4_ospf_rmap_cmd
);
13621 install_element (BGP_NODE
, &no_bgp_redistribute_ipv4_ospf_rmap_cmd
);
13622 install_element (BGP_NODE
, &bgp_redistribute_ipv4_ospf_metric_cmd
);
13623 install_element (BGP_NODE
, &no_bgp_redistribute_ipv4_ospf_metric_cmd
);
13624 install_element (BGP_NODE
, &bgp_redistribute_ipv4_ospf_rmap_metric_cmd
);
13625 install_element (BGP_NODE
, &no_bgp_redistribute_ipv4_ospf_rmap_metric_cmd
);
13626 install_element (BGP_NODE
, &bgp_redistribute_ipv4_ospf_metric_rmap_cmd
);
13627 install_element (BGP_NODE
, &no_bgp_redistribute_ipv4_ospf_metric_rmap_cmd
);
13628 install_element (BGP_IPV4_NODE
, &bgp_redistribute_ipv4_cmd
);
13629 install_element (BGP_IPV4_NODE
, &no_bgp_redistribute_ipv4_cmd
);
13630 install_element (BGP_IPV4_NODE
, &bgp_redistribute_ipv4_rmap_cmd
);
13631 install_element (BGP_IPV4_NODE
, &no_bgp_redistribute_ipv4_rmap_cmd
);
13632 install_element (BGP_IPV4_NODE
, &bgp_redistribute_ipv4_metric_cmd
);
13633 install_element (BGP_IPV4_NODE
, &no_bgp_redistribute_ipv4_metric_cmd
);
13634 install_element (BGP_IPV4_NODE
, &bgp_redistribute_ipv4_rmap_metric_cmd
);
13635 install_element (BGP_IPV4_NODE
, &bgp_redistribute_ipv4_metric_rmap_cmd
);
13636 install_element (BGP_IPV4_NODE
, &no_bgp_redistribute_ipv4_rmap_metric_cmd
);
13637 install_element (BGP_IPV4_NODE
, &no_bgp_redistribute_ipv4_metric_rmap_cmd
);
13638 install_element (BGP_IPV4_NODE
, &bgp_redistribute_ipv4_ospf_cmd
);
13639 install_element (BGP_IPV4_NODE
, &no_bgp_redistribute_ipv4_ospf_cmd
);
13640 install_element (BGP_IPV4_NODE
, &bgp_redistribute_ipv4_ospf_rmap_cmd
);
13641 install_element (BGP_IPV4_NODE
, &no_bgp_redistribute_ipv4_ospf_rmap_cmd
);
13642 install_element (BGP_IPV4_NODE
, &bgp_redistribute_ipv4_ospf_metric_cmd
);
13643 install_element (BGP_IPV4_NODE
, &no_bgp_redistribute_ipv4_ospf_metric_cmd
);
13644 install_element (BGP_IPV4_NODE
, &bgp_redistribute_ipv4_ospf_rmap_metric_cmd
);
13645 install_element (BGP_IPV4_NODE
, &no_bgp_redistribute_ipv4_ospf_rmap_metric_cmd
);
13646 install_element (BGP_IPV4_NODE
, &bgp_redistribute_ipv4_ospf_metric_rmap_cmd
);
13647 install_element (BGP_IPV4_NODE
, &no_bgp_redistribute_ipv4_ospf_metric_rmap_cmd
);
13649 install_element (BGP_IPV6_NODE
, &bgp_redistribute_ipv6_cmd
);
13650 install_element (BGP_IPV6_NODE
, &no_bgp_redistribute_ipv6_cmd
);
13651 install_element (BGP_IPV6_NODE
, &bgp_redistribute_ipv6_rmap_cmd
);
13652 install_element (BGP_IPV6_NODE
, &no_bgp_redistribute_ipv6_rmap_cmd
);
13653 install_element (BGP_IPV6_NODE
, &bgp_redistribute_ipv6_metric_cmd
);
13654 install_element (BGP_IPV6_NODE
, &no_bgp_redistribute_ipv6_metric_cmd
);
13655 install_element (BGP_IPV6_NODE
, &bgp_redistribute_ipv6_rmap_metric_cmd
);
13656 install_element (BGP_IPV6_NODE
, &bgp_redistribute_ipv6_metric_rmap_cmd
);
13657 install_element (BGP_IPV6_NODE
, &no_bgp_redistribute_ipv6_rmap_metric_cmd
);
13658 install_element (BGP_IPV6_NODE
, &no_bgp_redistribute_ipv6_metric_rmap_cmd
);
13659 #endif /* HAVE_IPV6 */
13661 /* ttl_security commands */
13662 install_element (BGP_NODE
, &neighbor_ttl_security_cmd
);
13663 install_element (BGP_NODE
, &no_neighbor_ttl_security_cmd
);
13665 /* "show bgp memory" commands. */
13666 install_element (VIEW_NODE
, &show_bgp_memory_cmd
);
13667 install_element (RESTRICTED_NODE
, &show_bgp_memory_cmd
);
13668 install_element (ENABLE_NODE
, &show_bgp_memory_cmd
);
13670 /* "show bgp views" commands. */
13671 install_element (VIEW_NODE
, &show_bgp_views_cmd
);
13672 install_element (RESTRICTED_NODE
, &show_bgp_views_cmd
);
13673 install_element (ENABLE_NODE
, &show_bgp_views_cmd
);
13675 /* "show bgp vrfs" commands. */
13676 install_element (VIEW_NODE
, &show_bgp_vrfs_cmd
);
13677 install_element (RESTRICTED_NODE
, &show_bgp_vrfs_cmd
);
13678 install_element (ENABLE_NODE
, &show_bgp_vrfs_cmd
);
13680 /* Community-list. */
13681 community_list_vty ();
13684 #include "memory.h"
13685 #include "bgp_regex.h"
13686 #include "bgp_clist.h"
13687 #include "bgp_ecommunity.h"
13689 /* VTY functions. */
13691 /* Direction value to string conversion. */
13692 static const char *
13693 community_direct_str (int direct
)
13697 case COMMUNITY_DENY
:
13699 case COMMUNITY_PERMIT
:
13706 /* Display error string. */
13708 community_list_perror (struct vty
*vty
, int ret
)
13712 case COMMUNITY_LIST_ERR_CANT_FIND_LIST
:
13713 vty_out (vty
, "%% Can't find community-list%s", VTY_NEWLINE
);
13715 case COMMUNITY_LIST_ERR_MALFORMED_VAL
:
13716 vty_out (vty
, "%% Malformed community-list value%s", VTY_NEWLINE
);
13718 case COMMUNITY_LIST_ERR_STANDARD_CONFLICT
:
13719 vty_out (vty
, "%% Community name conflict, previously defined as standard community%s", VTY_NEWLINE
);
13721 case COMMUNITY_LIST_ERR_EXPANDED_CONFLICT
:
13722 vty_out (vty
, "%% Community name conflict, previously defined as expanded community%s", VTY_NEWLINE
);
13727 /* VTY interface for community_set() function. */
13729 community_list_set_vty (struct vty
*vty
, int argc
, const char **argv
,
13730 int style
, int reject_all_digit_name
)
13736 /* Check the list type. */
13737 if (strncmp (argv
[1], "p", 1) == 0)
13738 direct
= COMMUNITY_PERMIT
;
13739 else if (strncmp (argv
[1], "d", 1) == 0)
13740 direct
= COMMUNITY_DENY
;
13743 vty_out (vty
, "%% Matching condition must be permit or deny%s",
13745 return CMD_WARNING
;
13748 /* All digit name check. */
13749 if (reject_all_digit_name
&& all_digit (argv
[0]))
13751 vty_out (vty
, "%% Community name cannot have all digits%s", VTY_NEWLINE
);
13752 return CMD_WARNING
;
13755 /* Concat community string argument. */
13757 str
= argv_concat (argv
, argc
, 2);
13761 /* When community_list_set() return nevetive value, it means
13762 malformed community string. */
13763 ret
= community_list_set (bgp_clist
, argv
[0], str
, direct
, style
);
13765 /* Free temporary community list string allocated by
13768 XFREE (MTYPE_TMP
, str
);
13772 /* Display error string. */
13773 community_list_perror (vty
, ret
);
13774 return CMD_WARNING
;
13777 return CMD_SUCCESS
;
13780 /* Communiyt-list entry delete. */
13782 community_list_unset_vty (struct vty
*vty
, int argc
, const char **argv
,
13783 int style
, int delete_all
)
13791 /* Check the list direct. */
13792 if (strncmp (argv
[1], "p", 1) == 0)
13793 direct
= COMMUNITY_PERMIT
;
13794 else if (strncmp (argv
[1], "d", 1) == 0)
13795 direct
= COMMUNITY_DENY
;
13798 vty_out (vty
, "%% Matching condition must be permit or deny%s",
13800 return CMD_WARNING
;
13803 /* Concat community string argument. */
13804 str
= argv_concat (argv
, argc
, 2);
13807 /* Unset community list. */
13808 ret
= community_list_unset (bgp_clist
, argv
[0], str
, direct
, style
, delete_all
);
13810 /* Free temporary community list string allocated by
13813 XFREE (MTYPE_TMP
, str
);
13817 community_list_perror (vty
, ret
);
13818 return CMD_WARNING
;
13821 return CMD_SUCCESS
;
13824 /* "community-list" keyword help string. */
13825 #define COMMUNITY_LIST_STR "Add a community list entry\n"
13826 #define COMMUNITY_VAL_STR "Community number in aa:nn format or internet|local-AS|no-advertise|no-export\n"
13828 DEFUN (ip_community_list_standard
,
13829 ip_community_list_standard_cmd
,
13830 "ip community-list <1-99> (deny|permit) .AA:NN",
13833 "Community list number (standard)\n"
13834 "Specify community to reject\n"
13835 "Specify community to accept\n"
13838 return community_list_set_vty (vty
, argc
, argv
, COMMUNITY_LIST_STANDARD
, 0);
13841 ALIAS (ip_community_list_standard
,
13842 ip_community_list_standard2_cmd
,
13843 "ip community-list <1-99> (deny|permit)",
13846 "Community list number (standard)\n"
13847 "Specify community to reject\n"
13848 "Specify community to accept\n")
13850 DEFUN (ip_community_list_expanded
,
13851 ip_community_list_expanded_cmd
,
13852 "ip community-list <100-500> (deny|permit) .LINE",
13855 "Community list number (expanded)\n"
13856 "Specify community to reject\n"
13857 "Specify community to accept\n"
13858 "An ordered list as a regular-expression\n")
13860 return community_list_set_vty (vty
, argc
, argv
, COMMUNITY_LIST_EXPANDED
, 0);
13863 DEFUN (ip_community_list_name_standard
,
13864 ip_community_list_name_standard_cmd
,
13865 "ip community-list standard WORD (deny|permit) .AA:NN",
13868 "Add a standard community-list entry\n"
13869 "Community list name\n"
13870 "Specify community to reject\n"
13871 "Specify community to accept\n"
13874 return community_list_set_vty (vty
, argc
, argv
, COMMUNITY_LIST_STANDARD
, 1);
13877 ALIAS (ip_community_list_name_standard
,
13878 ip_community_list_name_standard2_cmd
,
13879 "ip community-list standard WORD (deny|permit)",
13882 "Add a standard community-list entry\n"
13883 "Community list name\n"
13884 "Specify community to reject\n"
13885 "Specify community to accept\n")
13887 DEFUN (ip_community_list_name_expanded
,
13888 ip_community_list_name_expanded_cmd
,
13889 "ip community-list expanded WORD (deny|permit) .LINE",
13892 "Add an expanded community-list entry\n"
13893 "Community list name\n"
13894 "Specify community to reject\n"
13895 "Specify community to accept\n"
13896 "An ordered list as a regular-expression\n")
13898 return community_list_set_vty (vty
, argc
, argv
, COMMUNITY_LIST_EXPANDED
, 1);
13901 DEFUN (no_ip_community_list_standard_all
,
13902 no_ip_community_list_standard_all_cmd
,
13903 "no ip community-list <1-99>",
13907 "Community list number (standard)\n")
13909 return community_list_unset_vty (vty
, argc
, argv
, COMMUNITY_LIST_STANDARD
, 1);
13912 DEFUN (no_ip_community_list_standard_direction
,
13913 no_ip_community_list_standard_direction_cmd
,
13914 "no ip community-list <1-99> (deny|permit)",
13918 "Community list number (standard)\n"
13919 "Specify community to reject\n"
13920 "Specify community to accept\n")
13922 return community_list_unset_vty (vty
, argc
, argv
, COMMUNITY_LIST_STANDARD
, 0);
13926 DEFUN (no_ip_community_list_expanded_all
,
13927 no_ip_community_list_expanded_all_cmd
,
13928 "no ip community-list <100-500>",
13932 "Community list number (expanded)\n")
13934 return community_list_unset_vty (vty
, argc
, argv
, COMMUNITY_LIST_EXPANDED
, 1);
13937 DEFUN (no_ip_community_list_name_standard_all
,
13938 no_ip_community_list_name_standard_all_cmd
,
13939 "no ip community-list standard WORD",
13943 "Add a standard community-list entry\n"
13944 "Community list name\n")
13946 return community_list_unset_vty (vty
, argc
, argv
, COMMUNITY_LIST_STANDARD
, 1);
13949 DEFUN (no_ip_community_list_name_expanded_all
,
13950 no_ip_community_list_name_expanded_all_cmd
,
13951 "no ip community-list expanded WORD",
13955 "Add an expanded community-list entry\n"
13956 "Community list name\n")
13958 return community_list_unset_vty (vty
, argc
, argv
, COMMUNITY_LIST_EXPANDED
, 1);
13961 DEFUN (no_ip_community_list_standard
,
13962 no_ip_community_list_standard_cmd
,
13963 "no ip community-list <1-99> (deny|permit) .AA:NN",
13967 "Community list number (standard)\n"
13968 "Specify community to reject\n"
13969 "Specify community to accept\n"
13972 return community_list_unset_vty (vty
, argc
, argv
, COMMUNITY_LIST_STANDARD
, 0);
13975 DEFUN (no_ip_community_list_expanded
,
13976 no_ip_community_list_expanded_cmd
,
13977 "no ip community-list <100-500> (deny|permit) .LINE",
13981 "Community list number (expanded)\n"
13982 "Specify community to reject\n"
13983 "Specify community to accept\n"
13984 "An ordered list as a regular-expression\n")
13986 return community_list_unset_vty (vty
, argc
, argv
, COMMUNITY_LIST_EXPANDED
, 0);
13989 DEFUN (no_ip_community_list_name_standard
,
13990 no_ip_community_list_name_standard_cmd
,
13991 "no ip community-list standard WORD (deny|permit) .AA:NN",
13995 "Specify a standard community-list\n"
13996 "Community list name\n"
13997 "Specify community to reject\n"
13998 "Specify community to accept\n"
14001 return community_list_unset_vty (vty
, argc
, argv
, COMMUNITY_LIST_STANDARD
, 0);
14004 DEFUN (no_ip_community_list_name_standard_brief
,
14005 no_ip_community_list_name_standard_brief_cmd
,
14006 "no ip community-list standard WORD (deny|permit)",
14010 "Specify a standard community-list\n"
14011 "Community list name\n"
14012 "Specify community to reject\n"
14013 "Specify community to accept\n")
14015 return community_list_unset_vty (vty
, argc
, argv
, COMMUNITY_LIST_STANDARD
, 0);
14018 DEFUN (no_ip_community_list_name_expanded
,
14019 no_ip_community_list_name_expanded_cmd
,
14020 "no ip community-list expanded WORD (deny|permit) .LINE",
14024 "Specify an expanded community-list\n"
14025 "Community list name\n"
14026 "Specify community to reject\n"
14027 "Specify community to accept\n"
14028 "An ordered list as a regular-expression\n")
14030 return community_list_unset_vty (vty
, argc
, argv
, COMMUNITY_LIST_EXPANDED
, 0);
14034 community_list_show (struct vty
*vty
, struct community_list
*list
)
14036 struct community_entry
*entry
;
14038 for (entry
= list
->head
; entry
; entry
= entry
->next
)
14040 if (entry
== list
->head
)
14042 if (all_digit (list
->name
))
14043 vty_out (vty
, "Community %s list %s%s",
14044 entry
->style
== COMMUNITY_LIST_STANDARD
?
14045 "standard" : "(expanded) access",
14046 list
->name
, VTY_NEWLINE
);
14048 vty_out (vty
, "Named Community %s list %s%s",
14049 entry
->style
== COMMUNITY_LIST_STANDARD
?
14050 "standard" : "expanded",
14051 list
->name
, VTY_NEWLINE
);
14054 vty_out (vty
, " %s%s",
14055 community_direct_str (entry
->direct
), VTY_NEWLINE
);
14057 vty_out (vty
, " %s %s%s",
14058 community_direct_str (entry
->direct
),
14059 entry
->style
== COMMUNITY_LIST_STANDARD
14060 ? community_str (entry
->u
.com
) : entry
->config
,
14065 DEFUN (show_ip_community_list
,
14066 show_ip_community_list_cmd
,
14067 "show ip community-list",
14070 "List community-list\n")
14072 struct community_list
*list
;
14073 struct community_list_master
*cm
;
14075 cm
= community_list_master_lookup (bgp_clist
, COMMUNITY_LIST_MASTER
);
14077 return CMD_SUCCESS
;
14079 for (list
= cm
->num
.head
; list
; list
= list
->next
)
14080 community_list_show (vty
, list
);
14082 for (list
= cm
->str
.head
; list
; list
= list
->next
)
14083 community_list_show (vty
, list
);
14085 return CMD_SUCCESS
;
14088 DEFUN (show_ip_community_list_arg
,
14089 show_ip_community_list_arg_cmd
,
14090 "show ip community-list (<1-500>|WORD)",
14093 "List community-list\n"
14094 "Community-list number\n"
14095 "Community-list name\n")
14097 struct community_list
*list
;
14099 list
= community_list_lookup (bgp_clist
, argv
[0], COMMUNITY_LIST_MASTER
);
14102 vty_out (vty
, "%% Can't find community-list%s", VTY_NEWLINE
);
14103 return CMD_WARNING
;
14106 community_list_show (vty
, list
);
14108 return CMD_SUCCESS
;
14112 extcommunity_list_set_vty (struct vty
*vty
, int argc
, const char **argv
,
14113 int style
, int reject_all_digit_name
)
14119 /* Check the list type. */
14120 if (strncmp (argv
[1], "p", 1) == 0)
14121 direct
= COMMUNITY_PERMIT
;
14122 else if (strncmp (argv
[1], "d", 1) == 0)
14123 direct
= COMMUNITY_DENY
;
14126 vty_out (vty
, "%% Matching condition must be permit or deny%s",
14128 return CMD_WARNING
;
14131 /* All digit name check. */
14132 if (reject_all_digit_name
&& all_digit (argv
[0]))
14134 vty_out (vty
, "%% Community name cannot have all digits%s", VTY_NEWLINE
);
14135 return CMD_WARNING
;
14138 /* Concat community string argument. */
14140 str
= argv_concat (argv
, argc
, 2);
14144 ret
= extcommunity_list_set (bgp_clist
, argv
[0], str
, direct
, style
);
14146 /* Free temporary community list string allocated by
14149 XFREE (MTYPE_TMP
, str
);
14153 community_list_perror (vty
, ret
);
14154 return CMD_WARNING
;
14156 return CMD_SUCCESS
;
14160 extcommunity_list_unset_vty (struct vty
*vty
, int argc
, const char **argv
,
14161 int style
, int delete_all
)
14169 /* Check the list direct. */
14170 if (strncmp (argv
[1], "p", 1) == 0)
14171 direct
= COMMUNITY_PERMIT
;
14172 else if (strncmp (argv
[1], "d", 1) == 0)
14173 direct
= COMMUNITY_DENY
;
14176 vty_out (vty
, "%% Matching condition must be permit or deny%s",
14178 return CMD_WARNING
;
14181 /* Concat community string argument. */
14182 str
= argv_concat (argv
, argc
, 2);
14185 /* Unset community list. */
14186 ret
= extcommunity_list_unset (bgp_clist
, argv
[0], str
, direct
, style
, delete_all
);
14188 /* Free temporary community list string allocated by
14191 XFREE (MTYPE_TMP
, str
);
14195 community_list_perror (vty
, ret
);
14196 return CMD_WARNING
;
14199 return CMD_SUCCESS
;
14202 /* "extcommunity-list" keyword help string. */
14203 #define EXTCOMMUNITY_LIST_STR "Add a extended community list entry\n"
14204 #define EXTCOMMUNITY_VAL_STR "Extended community attribute in 'rt aa:nn_or_IPaddr:nn' OR 'soo aa:nn_or_IPaddr:nn' format\n"
14206 DEFUN (ip_extcommunity_list_standard
,
14207 ip_extcommunity_list_standard_cmd
,
14208 "ip extcommunity-list <1-99> (deny|permit) .AA:NN",
14210 EXTCOMMUNITY_LIST_STR
14211 "Extended Community list number (standard)\n"
14212 "Specify community to reject\n"
14213 "Specify community to accept\n"
14214 EXTCOMMUNITY_VAL_STR
)
14216 return extcommunity_list_set_vty (vty
, argc
, argv
, EXTCOMMUNITY_LIST_STANDARD
, 0);
14219 ALIAS (ip_extcommunity_list_standard
,
14220 ip_extcommunity_list_standard2_cmd
,
14221 "ip extcommunity-list <1-99> (deny|permit)",
14223 EXTCOMMUNITY_LIST_STR
14224 "Extended Community list number (standard)\n"
14225 "Specify community to reject\n"
14226 "Specify community to accept\n")
14228 DEFUN (ip_extcommunity_list_expanded
,
14229 ip_extcommunity_list_expanded_cmd
,
14230 "ip extcommunity-list <100-500> (deny|permit) .LINE",
14232 EXTCOMMUNITY_LIST_STR
14233 "Extended Community list number (expanded)\n"
14234 "Specify community to reject\n"
14235 "Specify community to accept\n"
14236 "An ordered list as a regular-expression\n")
14238 return extcommunity_list_set_vty (vty
, argc
, argv
, EXTCOMMUNITY_LIST_EXPANDED
, 0);
14241 DEFUN (ip_extcommunity_list_name_standard
,
14242 ip_extcommunity_list_name_standard_cmd
,
14243 "ip extcommunity-list standard WORD (deny|permit) .AA:NN",
14245 EXTCOMMUNITY_LIST_STR
14246 "Specify standard extcommunity-list\n"
14247 "Extended Community list name\n"
14248 "Specify community to reject\n"
14249 "Specify community to accept\n"
14250 EXTCOMMUNITY_VAL_STR
)
14252 return extcommunity_list_set_vty (vty
, argc
, argv
, EXTCOMMUNITY_LIST_STANDARD
, 1);
14255 ALIAS (ip_extcommunity_list_name_standard
,
14256 ip_extcommunity_list_name_standard2_cmd
,
14257 "ip extcommunity-list standard WORD (deny|permit)",
14259 EXTCOMMUNITY_LIST_STR
14260 "Specify standard extcommunity-list\n"
14261 "Extended Community list name\n"
14262 "Specify community to reject\n"
14263 "Specify community to accept\n")
14265 DEFUN (ip_extcommunity_list_name_expanded
,
14266 ip_extcommunity_list_name_expanded_cmd
,
14267 "ip extcommunity-list expanded WORD (deny|permit) .LINE",
14269 EXTCOMMUNITY_LIST_STR
14270 "Specify expanded extcommunity-list\n"
14271 "Extended Community list name\n"
14272 "Specify community to reject\n"
14273 "Specify community to accept\n"
14274 "An ordered list as a regular-expression\n")
14276 return extcommunity_list_set_vty (vty
, argc
, argv
, EXTCOMMUNITY_LIST_EXPANDED
, 1);
14279 DEFUN (no_ip_extcommunity_list_standard_all
,
14280 no_ip_extcommunity_list_standard_all_cmd
,
14281 "no ip extcommunity-list <1-99>",
14284 EXTCOMMUNITY_LIST_STR
14285 "Extended Community list number (standard)\n")
14287 return extcommunity_list_unset_vty (vty
, argc
, argv
, EXTCOMMUNITY_LIST_STANDARD
, 1);
14290 DEFUN (no_ip_extcommunity_list_standard_direction
,
14291 no_ip_extcommunity_list_standard_direction_cmd
,
14292 "no ip extcommunity-list <1-99> (deny|permit)",
14295 EXTCOMMUNITY_LIST_STR
14296 "Extended Community list number (standard)\n"
14297 "Specify community to reject\n"
14298 "Specify community to accept\n")
14300 return extcommunity_list_unset_vty (vty
, argc
, argv
, EXTCOMMUNITY_LIST_STANDARD
, 0);
14303 DEFUN (no_ip_extcommunity_list_expanded_all
,
14304 no_ip_extcommunity_list_expanded_all_cmd
,
14305 "no ip extcommunity-list <100-500>",
14308 EXTCOMMUNITY_LIST_STR
14309 "Extended Community list number (expanded)\n")
14311 return extcommunity_list_unset_vty (vty
, argc
, argv
, EXTCOMMUNITY_LIST_EXPANDED
, 1);
14314 DEFUN (no_ip_extcommunity_list_name_standard_all
,
14315 no_ip_extcommunity_list_name_standard_all_cmd
,
14316 "no ip extcommunity-list standard WORD",
14319 EXTCOMMUNITY_LIST_STR
14320 "Specify standard extcommunity-list\n"
14321 "Extended Community list name\n")
14323 return extcommunity_list_unset_vty (vty
, argc
, argv
, EXTCOMMUNITY_LIST_STANDARD
, 1);
14326 DEFUN (no_ip_extcommunity_list_name_expanded_all
,
14327 no_ip_extcommunity_list_name_expanded_all_cmd
,
14328 "no ip extcommunity-list expanded WORD",
14331 EXTCOMMUNITY_LIST_STR
14332 "Specify expanded extcommunity-list\n"
14333 "Extended Community list name\n")
14335 return extcommunity_list_unset_vty (vty
, argc
, argv
, EXTCOMMUNITY_LIST_EXPANDED
, 1);
14338 DEFUN (no_ip_extcommunity_list_standard
,
14339 no_ip_extcommunity_list_standard_cmd
,
14340 "no ip extcommunity-list <1-99> (deny|permit) .AA:NN",
14343 EXTCOMMUNITY_LIST_STR
14344 "Extended Community list number (standard)\n"
14345 "Specify community to reject\n"
14346 "Specify community to accept\n"
14347 EXTCOMMUNITY_VAL_STR
)
14349 return extcommunity_list_unset_vty (vty
, argc
, argv
, EXTCOMMUNITY_LIST_STANDARD
, 0);
14352 DEFUN (no_ip_extcommunity_list_expanded
,
14353 no_ip_extcommunity_list_expanded_cmd
,
14354 "no ip extcommunity-list <100-500> (deny|permit) .LINE",
14357 EXTCOMMUNITY_LIST_STR
14358 "Extended Community list number (expanded)\n"
14359 "Specify community to reject\n"
14360 "Specify community to accept\n"
14361 "An ordered list as a regular-expression\n")
14363 return extcommunity_list_unset_vty (vty
, argc
, argv
, EXTCOMMUNITY_LIST_EXPANDED
, 0);
14366 DEFUN (no_ip_extcommunity_list_name_standard
,
14367 no_ip_extcommunity_list_name_standard_cmd
,
14368 "no ip extcommunity-list standard WORD (deny|permit) .AA:NN",
14371 EXTCOMMUNITY_LIST_STR
14372 "Specify standard extcommunity-list\n"
14373 "Extended Community list name\n"
14374 "Specify community to reject\n"
14375 "Specify community to accept\n"
14376 EXTCOMMUNITY_VAL_STR
)
14378 return extcommunity_list_unset_vty (vty
, argc
, argv
, EXTCOMMUNITY_LIST_STANDARD
, 0);
14381 DEFUN (no_ip_extcommunity_list_name_standard_brief
,
14382 no_ip_extcommunity_list_name_standard_brief_cmd
,
14383 "no ip extcommunity-list standard WORD (deny|permit)",
14386 EXTCOMMUNITY_LIST_STR
14387 "Specify standard extcommunity-list\n"
14388 "Extended Community list name\n"
14389 "Specify community to reject\n"
14390 "Specify community to accept\n")
14392 return extcommunity_list_unset_vty (vty
, argc
, argv
, EXTCOMMUNITY_LIST_STANDARD
, 0);
14395 DEFUN (no_ip_extcommunity_list_name_expanded
,
14396 no_ip_extcommunity_list_name_expanded_cmd
,
14397 "no ip extcommunity-list expanded WORD (deny|permit) .LINE",
14400 EXTCOMMUNITY_LIST_STR
14401 "Specify expanded extcommunity-list\n"
14402 "Community list name\n"
14403 "Specify community to reject\n"
14404 "Specify community to accept\n"
14405 "An ordered list as a regular-expression\n")
14407 return extcommunity_list_unset_vty (vty
, argc
, argv
, EXTCOMMUNITY_LIST_EXPANDED
, 0);
14411 extcommunity_list_show (struct vty
*vty
, struct community_list
*list
)
14413 struct community_entry
*entry
;
14415 for (entry
= list
->head
; entry
; entry
= entry
->next
)
14417 if (entry
== list
->head
)
14419 if (all_digit (list
->name
))
14420 vty_out (vty
, "Extended community %s list %s%s",
14421 entry
->style
== EXTCOMMUNITY_LIST_STANDARD
?
14422 "standard" : "(expanded) access",
14423 list
->name
, VTY_NEWLINE
);
14425 vty_out (vty
, "Named extended community %s list %s%s",
14426 entry
->style
== EXTCOMMUNITY_LIST_STANDARD
?
14427 "standard" : "expanded",
14428 list
->name
, VTY_NEWLINE
);
14431 vty_out (vty
, " %s%s",
14432 community_direct_str (entry
->direct
), VTY_NEWLINE
);
14434 vty_out (vty
, " %s %s%s",
14435 community_direct_str (entry
->direct
),
14436 entry
->style
== EXTCOMMUNITY_LIST_STANDARD
?
14437 entry
->u
.ecom
->str
: entry
->config
,
14442 DEFUN (show_ip_extcommunity_list
,
14443 show_ip_extcommunity_list_cmd
,
14444 "show ip extcommunity-list",
14447 "List extended-community list\n")
14449 struct community_list
*list
;
14450 struct community_list_master
*cm
;
14452 cm
= community_list_master_lookup (bgp_clist
, EXTCOMMUNITY_LIST_MASTER
);
14454 return CMD_SUCCESS
;
14456 for (list
= cm
->num
.head
; list
; list
= list
->next
)
14457 extcommunity_list_show (vty
, list
);
14459 for (list
= cm
->str
.head
; list
; list
= list
->next
)
14460 extcommunity_list_show (vty
, list
);
14462 return CMD_SUCCESS
;
14465 DEFUN (show_ip_extcommunity_list_arg
,
14466 show_ip_extcommunity_list_arg_cmd
,
14467 "show ip extcommunity-list (<1-500>|WORD)",
14470 "List extended-community list\n"
14471 "Extcommunity-list number\n"
14472 "Extcommunity-list name\n")
14474 struct community_list
*list
;
14476 list
= community_list_lookup (bgp_clist
, argv
[0], EXTCOMMUNITY_LIST_MASTER
);
14479 vty_out (vty
, "%% Can't find extcommunity-list%s", VTY_NEWLINE
);
14480 return CMD_WARNING
;
14483 extcommunity_list_show (vty
, list
);
14485 return CMD_SUCCESS
;
14488 /* Return configuration string of community-list entry. */
14489 static const char *
14490 community_list_config_str (struct community_entry
*entry
)
14498 if (entry
->style
== COMMUNITY_LIST_STANDARD
)
14499 str
= community_str (entry
->u
.com
);
14501 str
= entry
->config
;
14506 /* Display community-list and extcommunity-list configuration. */
14508 community_list_config_write (struct vty
*vty
)
14510 struct community_list
*list
;
14511 struct community_entry
*entry
;
14512 struct community_list_master
*cm
;
14515 /* Community-list. */
14516 cm
= community_list_master_lookup (bgp_clist
, COMMUNITY_LIST_MASTER
);
14518 for (list
= cm
->num
.head
; list
; list
= list
->next
)
14519 for (entry
= list
->head
; entry
; entry
= entry
->next
)
14521 vty_out (vty
, "ip community-list %s %s %s%s",
14522 list
->name
, community_direct_str (entry
->direct
),
14523 community_list_config_str (entry
),
14527 for (list
= cm
->str
.head
; list
; list
= list
->next
)
14528 for (entry
= list
->head
; entry
; entry
= entry
->next
)
14530 vty_out (vty
, "ip community-list %s %s %s %s%s",
14531 entry
->style
== COMMUNITY_LIST_STANDARD
14532 ? "standard" : "expanded",
14533 list
->name
, community_direct_str (entry
->direct
),
14534 community_list_config_str (entry
),
14539 /* Extcommunity-list. */
14540 cm
= community_list_master_lookup (bgp_clist
, EXTCOMMUNITY_LIST_MASTER
);
14542 for (list
= cm
->num
.head
; list
; list
= list
->next
)
14543 for (entry
= list
->head
; entry
; entry
= entry
->next
)
14545 vty_out (vty
, "ip extcommunity-list %s %s %s%s",
14546 list
->name
, community_direct_str (entry
->direct
),
14547 community_list_config_str (entry
), VTY_NEWLINE
);
14550 for (list
= cm
->str
.head
; list
; list
= list
->next
)
14551 for (entry
= list
->head
; entry
; entry
= entry
->next
)
14553 vty_out (vty
, "ip extcommunity-list %s %s %s %s%s",
14554 entry
->style
== EXTCOMMUNITY_LIST_STANDARD
14555 ? "standard" : "expanded",
14556 list
->name
, community_direct_str (entry
->direct
),
14557 community_list_config_str (entry
), VTY_NEWLINE
);
14563 static struct cmd_node community_list_node
=
14565 COMMUNITY_LIST_NODE
,
14567 1 /* Export to vtysh. */
14571 community_list_vty (void)
14573 install_node (&community_list_node
, community_list_config_write
);
14575 /* Community-list. */
14576 install_element (CONFIG_NODE
, &ip_community_list_standard_cmd
);
14577 install_element (CONFIG_NODE
, &ip_community_list_standard2_cmd
);
14578 install_element (CONFIG_NODE
, &ip_community_list_expanded_cmd
);
14579 install_element (CONFIG_NODE
, &ip_community_list_name_standard_cmd
);
14580 install_element (CONFIG_NODE
, &ip_community_list_name_standard2_cmd
);
14581 install_element (CONFIG_NODE
, &ip_community_list_name_expanded_cmd
);
14582 install_element (CONFIG_NODE
, &no_ip_community_list_standard_all_cmd
);
14583 install_element (CONFIG_NODE
, &no_ip_community_list_standard_direction_cmd
);
14584 install_element (CONFIG_NODE
, &no_ip_community_list_expanded_all_cmd
);
14585 install_element (CONFIG_NODE
, &no_ip_community_list_name_standard_all_cmd
);
14586 install_element (CONFIG_NODE
, &no_ip_community_list_name_expanded_all_cmd
);
14587 install_element (CONFIG_NODE
, &no_ip_community_list_standard_cmd
);
14588 install_element (CONFIG_NODE
, &no_ip_community_list_expanded_cmd
);
14589 install_element (CONFIG_NODE
, &no_ip_community_list_name_standard_cmd
);
14590 install_element (CONFIG_NODE
, &no_ip_community_list_name_standard_brief_cmd
);
14591 install_element (CONFIG_NODE
, &no_ip_community_list_name_expanded_cmd
);
14592 install_element (VIEW_NODE
, &show_ip_community_list_cmd
);
14593 install_element (VIEW_NODE
, &show_ip_community_list_arg_cmd
);
14594 install_element (ENABLE_NODE
, &show_ip_community_list_cmd
);
14595 install_element (ENABLE_NODE
, &show_ip_community_list_arg_cmd
);
14597 /* Extcommunity-list. */
14598 install_element (CONFIG_NODE
, &ip_extcommunity_list_standard_cmd
);
14599 install_element (CONFIG_NODE
, &ip_extcommunity_list_standard2_cmd
);
14600 install_element (CONFIG_NODE
, &ip_extcommunity_list_expanded_cmd
);
14601 install_element (CONFIG_NODE
, &ip_extcommunity_list_name_standard_cmd
);
14602 install_element (CONFIG_NODE
, &ip_extcommunity_list_name_standard2_cmd
);
14603 install_element (CONFIG_NODE
, &ip_extcommunity_list_name_expanded_cmd
);
14604 install_element (CONFIG_NODE
, &no_ip_extcommunity_list_standard_all_cmd
);
14605 install_element (CONFIG_NODE
, &no_ip_extcommunity_list_standard_direction_cmd
);
14606 install_element (CONFIG_NODE
, &no_ip_extcommunity_list_expanded_all_cmd
);
14607 install_element (CONFIG_NODE
, &no_ip_extcommunity_list_name_standard_all_cmd
);
14608 install_element (CONFIG_NODE
, &no_ip_extcommunity_list_name_expanded_all_cmd
);
14609 install_element (CONFIG_NODE
, &no_ip_extcommunity_list_standard_cmd
);
14610 install_element (CONFIG_NODE
, &no_ip_extcommunity_list_expanded_cmd
);
14611 install_element (CONFIG_NODE
, &no_ip_extcommunity_list_name_standard_cmd
);
14612 install_element (CONFIG_NODE
, &no_ip_extcommunity_list_name_standard_brief_cmd
);
14613 install_element (CONFIG_NODE
, &no_ip_extcommunity_list_name_expanded_cmd
);
14614 install_element (VIEW_NODE
, &show_ip_extcommunity_list_cmd
);
14615 install_element (VIEW_NODE
, &show_ip_extcommunity_list_arg_cmd
);
14616 install_element (ENABLE_NODE
, &show_ip_extcommunity_list_cmd
);
14617 install_element (ENABLE_NODE
, &show_ip_extcommunity_list_arg_cmd
);