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
33 #include "memory_vty.h"
38 #include "bgpd/bgpd.h"
39 #include "bgpd/bgp_advertise.h"
40 #include "bgpd/bgp_attr.h"
41 #include "bgpd/bgp_aspath.h"
42 #include "bgpd/bgp_community.h"
43 #include "bgpd/bgp_ecommunity.h"
44 #include "bgpd/bgp_damp.h"
45 #include "bgpd/bgp_debug.h"
46 #include "bgpd/bgp_fsm.h"
47 #include "bgpd/bgp_mplsvpn.h"
48 #include "bgpd/bgp_nexthop.h"
49 #include "bgpd/bgp_open.h"
50 #include "bgpd/bgp_regex.h"
51 #include "bgpd/bgp_route.h"
52 #include "bgpd/bgp_zebra.h"
53 #include "bgpd/bgp_table.h"
54 #include "bgpd/bgp_vty.h"
55 #include "bgpd/bgp_mpath.h"
56 #include "bgpd/bgp_packet.h"
57 #include "bgpd/bgp_updgrp.h"
58 #include "bgpd/bgp_bfd.h"
60 static struct peer_group
*
61 listen_range_exists (struct bgp
*bgp
, struct prefix
*range
, int exact
);
63 /* Utility function to get address family from current node. */
65 bgp_node_afi (struct vty
*vty
)
73 case BGP_ENCAPV6_NODE
:
83 /* Utility function to get subsequent address family from current
86 bgp_node_safi (struct vty
*vty
)
92 case BGP_ENCAPV6_NODE
:
101 safi
= SAFI_MULTICAST
;
111 bgp_parse_afi(const char *str
, afi_t
*afi
)
113 if (!strcmp(str
, "ipv4")) {
118 if (!strcmp(str
, "ipv6")) {
122 #endif /* HAVE_IPV6 */
127 bgp_parse_safi(const char *str
, safi_t
*safi
)
129 if (!strcmp(str
, "encap")) {
133 if (!strcmp(str
, "multicast")) {
134 *safi
= SAFI_MULTICAST
;
137 if (!strcmp(str
, "unicast")) {
138 *safi
= SAFI_UNICAST
;
141 if (!strcmp(str
, "vpn")) {
142 *safi
= SAFI_MPLS_VPN
;
149 peer_address_self_check (struct bgp
*bgp
, union sockunion
*su
)
151 struct interface
*ifp
= NULL
;
153 if (su
->sa
.sa_family
== AF_INET
)
154 ifp
= if_lookup_by_ipv4_exact (&su
->sin
.sin_addr
, bgp
->vrf_id
);
156 else if (su
->sa
.sa_family
== AF_INET6
)
157 ifp
= if_lookup_by_ipv6_exact (&su
->sin6
.sin6_addr
,
158 su
->sin6
.sin6_scope_id
, bgp
->vrf_id
);
159 #endif /* HAVE IPV6 */
167 /* Utility function for looking up peer from VTY. */
168 /* This is used only for configuration, so disallow if attempted on
169 * a dynamic neighbor.
172 peer_lookup_vty (struct vty
*vty
, const char *ip_str
)
181 ret
= str2sockunion (ip_str
, &su
);
184 peer
= peer_lookup_by_conf_if (bgp
, ip_str
);
187 if ((peer
= peer_lookup_by_hostname(bgp
, ip_str
)) == NULL
)
189 vty_out (vty
, "%% Malformed address or name: %s%s", ip_str
, VTY_NEWLINE
);
196 peer
= peer_lookup (bgp
, &su
);
199 vty_out (vty
, "%% Specify remote-as or peer-group commands first%s",
203 if (peer_dynamic_neighbor (peer
))
205 vty_out (vty
, "%% Operation not allowed on a dynamic neighbor%s",
214 /* Utility function for looking up peer or peer group. */
215 /* This is used only for configuration, so disallow if attempted on
216 * a dynamic neighbor.
219 peer_and_group_lookup_vty (struct vty
*vty
, const char *peer_str
)
224 struct peer
*peer
= NULL
;
225 struct peer_group
*group
= NULL
;
229 ret
= str2sockunion (peer_str
, &su
);
232 /* IP address, locate peer. */
233 peer
= peer_lookup (bgp
, &su
);
237 /* Not IP, could match either peer configured on interface or a group. */
238 peer
= peer_lookup_by_conf_if (bgp
, peer_str
);
240 group
= peer_group_lookup (bgp
, peer_str
);
245 if (peer_dynamic_neighbor (peer
))
247 vty_out (vty
, "%% Operation not allowed on a dynamic neighbor%s",
258 vty_out (vty
, "%% Specify remote-as or peer-group commands first%s",
265 bgp_vty_return (struct vty
*vty
, int ret
)
267 const char *str
= NULL
;
271 case BGP_ERR_INVALID_VALUE
:
272 str
= "Invalid value";
274 case BGP_ERR_INVALID_FLAG
:
275 str
= "Invalid flag";
277 case BGP_ERR_PEER_GROUP_SHUTDOWN
:
278 str
= "Peer-group has been shutdown. Activate the peer-group first";
280 case BGP_ERR_PEER_FLAG_CONFLICT
:
281 str
= "Can't set override-capability and strict-capability-match at the same time";
283 case BGP_ERR_PEER_GROUP_NO_REMOTE_AS
:
284 str
= "Specify remote-as or peer-group remote AS first";
286 case BGP_ERR_PEER_GROUP_CANT_CHANGE
:
287 str
= "Cannot change the peer-group. Deconfigure first";
289 case BGP_ERR_PEER_GROUP_MISMATCH
:
290 str
= "Peer is not a member of this peer-group";
292 case BGP_ERR_PEER_FILTER_CONFLICT
:
293 str
= "Prefix/distribute list can not co-exist";
295 case BGP_ERR_NOT_INTERNAL_PEER
:
296 str
= "Invalid command. Not an internal neighbor";
298 case BGP_ERR_REMOVE_PRIVATE_AS
:
299 str
= "remove-private-AS cannot be configured for IBGP peers";
301 case BGP_ERR_LOCAL_AS_ALLOWED_ONLY_FOR_EBGP
:
302 str
= "Local-AS allowed only for EBGP peers";
304 case BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS
:
305 str
= "Cannot have local-as same as BGP AS number";
307 case BGP_ERR_TCPSIG_FAILED
:
308 str
= "Error while applying TCP-Sig to session(s)";
310 case BGP_ERR_NO_EBGP_MULTIHOP_WITH_TTLHACK
:
311 str
= "ebgp-multihop and ttl-security cannot be configured together";
313 case BGP_ERR_NO_IBGP_WITH_TTLHACK
:
314 str
= "ttl-security only allowed for EBGP peers";
316 case BGP_ERR_AS_OVERRIDE
:
317 str
= "as-override cannot be configured for IBGP peers";
319 case BGP_ERR_INVALID_DYNAMIC_NEIGHBORS_LIMIT
:
320 str
= "Invalid limit for number of dynamic neighbors";
322 case BGP_ERR_DYNAMIC_NEIGHBORS_RANGE_EXISTS
:
323 str
= "Dynamic neighbor listen range already exists";
325 case BGP_ERR_INVALID_FOR_DYNAMIC_PEER
:
326 str
= "Operation not allowed on a dynamic neighbor";
328 case BGP_ERR_INVALID_FOR_DIRECT_PEER
:
329 str
= "Operation not allowed on a directly connected neighbor";
334 vty_out (vty
, "%% %s%s", str
, VTY_NEWLINE
);
340 /* BGP clear sort. */
351 bgp_clear_vty_error (struct vty
*vty
, struct peer
*peer
, afi_t afi
,
352 safi_t safi
, int error
)
356 case BGP_ERR_AF_UNCONFIGURED
:
358 "%%BGP: Enable %s %s address family for the neighbor %s%s",
359 afi
== AFI_IP6
? "IPv6" : safi
== SAFI_MPLS_VPN
? "VPNv4" : "IPv4",
360 safi
== SAFI_MULTICAST
? "Multicast" : "Unicast",
361 peer
->host
, VTY_NEWLINE
);
363 case BGP_ERR_SOFT_RECONFIG_UNCONFIGURED
:
364 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
);
371 /* `clear ip bgp' functions. */
373 bgp_clear (struct vty
*vty
, struct bgp
*bgp
, afi_t afi
, safi_t safi
,
374 enum clear_sort sort
,enum bgp_clear_type stype
, const char *arg
)
378 struct listnode
*node
, *nnode
;
380 /* Clear all neighbors. */
382 * Pass along pointer to next node to peer_clear() when walking all nodes
383 * on the BGP instance as that may get freed if it is a doppelganger
385 if (sort
== clear_all
)
387 for (ALL_LIST_ELEMENTS (bgp
->peer
, node
, nnode
, peer
))
389 if (stype
== BGP_CLEAR_SOFT_NONE
)
390 ret
= peer_clear (peer
, &nnode
);
391 else if (peer
->afc
[afi
][safi
])
392 ret
= peer_clear_soft (peer
, afi
, safi
, stype
);
397 bgp_clear_vty_error (vty
, peer
, afi
, safi
, ret
);
400 /* This is to apply read-only mode on this clear. */
401 if (stype
== BGP_CLEAR_SOFT_NONE
)
402 bgp
->update_delay_over
= 0;
407 /* Clear specified neighbors. */
408 if (sort
== clear_peer
)
413 /* Make sockunion for lookup. */
414 ret
= str2sockunion (arg
, &su
);
417 peer
= peer_lookup_by_conf_if (bgp
, arg
);
420 peer
= peer_lookup_by_hostname(bgp
, arg
);
423 vty_out (vty
, "Malformed address or name: %s%s", arg
, VTY_NEWLINE
);
430 peer
= peer_lookup (bgp
, &su
);
433 vty_out (vty
, "%%BGP: Unknown neighbor - \"%s\"%s", arg
, VTY_NEWLINE
);
438 if (stype
== BGP_CLEAR_SOFT_NONE
)
439 ret
= peer_clear (peer
, NULL
);
441 ret
= peer_clear_soft (peer
, afi
, safi
, stype
);
444 bgp_clear_vty_error (vty
, peer
, afi
, safi
, ret
);
449 /* Clear all peer-group members. */
450 if (sort
== clear_group
)
452 struct peer_group
*group
;
454 group
= peer_group_lookup (bgp
, arg
);
457 vty_out (vty
, "%%BGP: No such peer-group %s%s", arg
, VTY_NEWLINE
);
461 for (ALL_LIST_ELEMENTS (group
->peer
, node
, nnode
, peer
))
463 if (stype
== BGP_CLEAR_SOFT_NONE
)
465 peer_clear (peer
, NULL
);
469 if (! peer
->afc
[afi
][safi
])
472 ret
= peer_clear_soft (peer
, afi
, safi
, stype
);
475 bgp_clear_vty_error (vty
, peer
, afi
, safi
, ret
);
480 if (sort
== clear_external
)
482 for (ALL_LIST_ELEMENTS (bgp
->peer
, node
, nnode
, peer
))
484 if (peer
->sort
== BGP_PEER_IBGP
)
487 if (stype
== BGP_CLEAR_SOFT_NONE
)
488 ret
= peer_clear (peer
, &nnode
);
490 ret
= peer_clear_soft (peer
, afi
, safi
, stype
);
493 bgp_clear_vty_error (vty
, peer
, afi
, safi
, ret
);
498 if (sort
== clear_as
)
503 VTY_GET_INTEGER_RANGE ("AS", as
, arg
, 1, BGP_AS4_MAX
);
505 for (ALL_LIST_ELEMENTS (bgp
->peer
, node
, nnode
, peer
))
511 if (stype
== BGP_CLEAR_SOFT_NONE
)
512 ret
= peer_clear (peer
, &nnode
);
514 ret
= peer_clear_soft (peer
, afi
, safi
, stype
);
517 bgp_clear_vty_error (vty
, peer
, afi
, safi
, ret
);
520 vty_out (vty
, "%%BGP: No peer is configured with AS %s%s", arg
,
529 bgp_clear_vty (struct vty
*vty
, const char *name
, afi_t afi
, safi_t safi
,
530 enum clear_sort sort
, enum bgp_clear_type stype
,
535 /* BGP structure lookup. */
538 bgp
= bgp_lookup_by_name (name
);
541 vty_out (vty
, "Can't find BGP instance %s%s", name
, VTY_NEWLINE
);
547 bgp
= bgp_get_default ();
550 vty_out (vty
, "No BGP process is configured%s", VTY_NEWLINE
);
555 return bgp_clear (vty
, bgp
, afi
, safi
, sort
, stype
, arg
);
558 /* clear soft inbound */
560 bgp_clear_star_soft_in (struct vty
*vty
, const char *name
)
562 bgp_clear_vty (vty
, name
, AFI_IP
, SAFI_UNICAST
, clear_all
,
563 BGP_CLEAR_SOFT_IN
, NULL
);
564 bgp_clear_vty (vty
, name
, AFI_IP6
, SAFI_UNICAST
, clear_all
,
565 BGP_CLEAR_SOFT_IN
, NULL
);
568 /* clear soft outbound */
570 bgp_clear_star_soft_out (struct vty
*vty
, const char *name
)
572 bgp_clear_vty (vty
, name
, AFI_IP
, SAFI_UNICAST
, clear_all
,
573 BGP_CLEAR_SOFT_OUT
, NULL
);
574 bgp_clear_vty (vty
, name
, AFI_IP6
, SAFI_UNICAST
, clear_all
,
575 BGP_CLEAR_SOFT_OUT
, NULL
);
579 /* BGP global configuration. */
581 DEFUN (bgp_multiple_instance_func
,
582 bgp_multiple_instance_cmd
,
583 "bgp multiple-instance",
585 "Enable bgp multiple instance\n")
587 bgp_option_set (BGP_OPT_MULTIPLE_INSTANCE
);
591 DEFUN (no_bgp_multiple_instance
,
592 no_bgp_multiple_instance_cmd
,
593 "no bgp multiple-instance",
596 "BGP multiple instance\n")
600 ret
= bgp_option_unset (BGP_OPT_MULTIPLE_INSTANCE
);
603 vty_out (vty
, "%% There are more than two BGP instances%s", VTY_NEWLINE
);
609 DEFUN (bgp_config_type
,
611 "bgp config-type <cisco|zebra>",
613 "Configuration type\n"
618 if (strncmp (argv
[idx_vendor
]->arg
, "c", 1) == 0)
619 bgp_option_set (BGP_OPT_CONFIG_CISCO
);
621 bgp_option_unset (BGP_OPT_CONFIG_CISCO
);
626 DEFUN (no_bgp_config_type
,
627 no_bgp_config_type_cmd
,
628 "no bgp config-type [<cisco|zebra>]",
631 "Display configuration type\n"
635 bgp_option_unset (BGP_OPT_CONFIG_CISCO
);
640 DEFUN (no_synchronization
,
641 no_synchronization_cmd
,
642 "no synchronization",
644 "Perform IGP synchronization\n")
649 DEFUN (no_auto_summary
,
653 "Enable automatic network number summarization\n")
658 /* "router bgp" commands. */
660 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
665 * "router bgp (1-4294967295) (view|vrf) WORD",
669 * "BGP view\nBGP VRF\n"
675 "router bgp (1-4294967295)",
684 const char *name
= NULL
;
685 enum bgp_instance_type inst_type
;
687 // "router bgp" without an ASN
690 //Pending: Make VRF option available for ASN less config
691 bgp
= bgp_get_default();
695 vty_out (vty
, "%% No BGP process is configured%s", VTY_NEWLINE
);
699 if (listcount(bm
->bgp
) > 1)
701 vty_out (vty
, "%% Multiple BGP processes are configured%s", VTY_NEWLINE
);
709 VTY_GET_INTEGER_RANGE ("AS", as
, argv
[idx_number
]->arg
, 1, BGP_AS4_MAX
);
711 inst_type
= BGP_INSTANCE_TYPE_DEFAULT
;
715 if (!strcmp(argv
[3]->arg
, "vrf"))
716 inst_type
= BGP_INSTANCE_TYPE_VRF
;
717 else if (!strcmp(argv
[3]->arg
, "view"))
718 inst_type
= BGP_INSTANCE_TYPE_VIEW
;
721 ret
= bgp_get (&bgp
, &as
, name
, inst_type
);
724 case BGP_ERR_MULTIPLE_INSTANCE_NOT_SET
:
725 vty_out (vty
, "Please specify 'bgp multiple-instance' first%s",
728 case BGP_ERR_AS_MISMATCH
:
729 vty_out (vty
, "BGP is already running; AS is %u%s", as
, VTY_NEWLINE
);
731 case BGP_ERR_INSTANCE_MISMATCH
:
732 vty_out (vty
, "BGP instance name and AS number mismatch%s", VTY_NEWLINE
);
733 vty_out (vty
, "BGP instance is already running; AS is %u%s",
738 /* Pending: handle when user tries to change a view to vrf n vv. */
741 vty
->node
= BGP_NODE
;
747 /* "no router bgp" commands. */
749 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
755 * "no router bgp (1-4294967295) (view|vrf) WORD",
760 * "BGP view\nBGP VRF\n"
764 DEFUN (no_router_bgp
,
766 "no router bgp (1-4294967295)",
775 const char *name
= NULL
;
778 // "no router bgp" without an ASN
781 //Pending: Make VRF option available for ASN less config
782 bgp
= bgp_get_default();
786 vty_out (vty
, "%% No BGP process is configured%s", VTY_NEWLINE
);
790 if (listcount(bm
->bgp
) > 1)
792 vty_out (vty
, "%% Multiple BGP processes are configured%s", VTY_NEWLINE
);
798 VTY_GET_INTEGER_RANGE ("AS", as
, argv
[idx_number
]->arg
, 1, BGP_AS4_MAX
);
803 /* Lookup bgp structure. */
804 bgp
= bgp_lookup (as
, name
);
807 vty_out (vty
, "%% Can't find BGP instance%s", VTY_NEWLINE
);
821 DEFUN (bgp_router_id
,
823 "bgp router-id A.B.C.D",
825 "Override configured router identifier\n"
826 "Manually configured router identifier\n")
835 ret
= inet_aton (argv
[idx_ipv4
]->arg
, &id
);
838 vty_out (vty
, "%% Malformed bgp router identifier%s", VTY_NEWLINE
);
842 bgp_router_id_static_set (bgp
, id
);
848 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
849 * "no bgp router-id A.B.C.D",
852 * "Override configured router identifier\n"
853 * "Manually configured router identifier\n"
856 DEFUN (no_bgp_router_id
,
857 no_bgp_router_id_cmd
,
861 "Override configured router identifier\n")
871 ret
= inet_aton (argv
[3]->arg
, &id
);
874 vty_out (vty
, "%% Malformed BGP router identifier%s", VTY_NEWLINE
);
878 if (! IPV4_ADDR_SAME (&bgp
->router_id_static
, &id
))
880 vty_out (vty
, "%% BGP router-id doesn't match%s", VTY_NEWLINE
);
886 bgp_router_id_static_set (bgp
, id
);
892 /* BGP Cluster ID. */
893 DEFUN (bgp_cluster_id
,
895 "bgp cluster-id <A.B.C.D|(1-4294967295)>",
897 "Configure Route-Reflector Cluster-id\n"
898 "Route-Reflector Cluster-id in IP address format\n"
899 "Route-Reflector Cluster-id as 32 bit quantity\n")
904 struct in_addr cluster
;
908 ret
= inet_aton (argv
[idx_ipv4
]->arg
, &cluster
);
911 vty_out (vty
, "%% Malformed bgp cluster identifier%s", VTY_NEWLINE
);
915 bgp_cluster_id_set (bgp
, &cluster
);
916 bgp_clear_star_soft_out (vty
, bgp
->name
);
921 DEFUN (no_bgp_cluster_id
,
922 no_bgp_cluster_id_cmd
,
923 "no bgp cluster-id [<A.B.C.D|(1-4294967295)>]",
926 "Configure Route-Reflector Cluster-id\n"
927 "Route-Reflector Cluster-id in IP address format\n"
928 "Route-Reflector Cluster-id as 32 bit quantity\n")
933 bgp_cluster_id_unset (bgp
);
934 bgp_clear_star_soft_out (vty
, bgp
->name
);
939 DEFUN (bgp_confederation_identifier
,
940 bgp_confederation_identifier_cmd
,
941 "bgp confederation identifier (1-4294967295)",
942 "BGP specific commands\n"
943 "AS confederation parameters\n"
945 "Set routing domain confederation AS\n")
953 VTY_GET_INTEGER_RANGE ("AS", as
, argv
[idx_number
]->arg
, 1, BGP_AS4_MAX
);
955 bgp_confederation_id_set (bgp
, as
);
960 DEFUN (no_bgp_confederation_identifier
,
961 no_bgp_confederation_identifier_cmd
,
962 "no bgp confederation identifier [(1-4294967295)]",
964 "BGP specific commands\n"
965 "AS confederation parameters\n"
971 bgp_confederation_id_unset (bgp
);
976 DEFUN (bgp_confederation_peers
,
977 bgp_confederation_peers_cmd
,
978 "bgp confederation peers . (1-4294967295)",
979 "BGP specific commands\n"
980 "AS confederation parameters\n"
981 "Peer ASs in BGP confederation\n"
990 for (i
= 0; i
< argc
; i
++)
992 VTY_GET_INTEGER_RANGE ("AS", as
, argv
[i
]->arg
, 1, BGP_AS4_MAX
);
996 vty_out (vty
, "%% Local member-AS not allowed in confed peer list%s",
1001 bgp_confederation_peers_add (bgp
, as
);
1006 DEFUN (no_bgp_confederation_peers
,
1007 no_bgp_confederation_peers_cmd
,
1008 "no bgp confederation peers . (1-4294967295)",
1010 "BGP specific commands\n"
1011 "AS confederation parameters\n"
1012 "Peer ASs in BGP confederation\n"
1021 for (i
= 0; i
< argc
; i
++)
1023 VTY_GET_INTEGER_RANGE ("AS", as
, argv
[i
]->arg
, 1, BGP_AS4_MAX
);
1025 bgp_confederation_peers_remove (bgp
, as
);
1031 * Central routine for maximum-paths configuration.
1032 * @peer_type: BGP_PEER_EBGP or BGP_PEER_IBGP
1033 * @set: 1 for setting values, 0 for removing the max-paths config.
1036 bgp_maxpaths_config_vty (struct vty
*vty
, int peer_type
, const char *mpaths
,
1037 u_int16_t options
, int set
)
1040 u_int16_t maxpaths
= 0;
1046 afi
= bgp_node_afi (vty
);
1047 safi
= bgp_node_safi (vty
);
1051 VTY_GET_INTEGER_RANGE ("maximum-paths", maxpaths
, mpaths
, 1,
1053 ret
= bgp_maximum_paths_set (bgp
, afi
, safi
, peer_type
, maxpaths
,
1057 ret
= bgp_maximum_paths_unset (bgp
, afi
, safi
, peer_type
);
1062 "%% Failed to %sset maximum-paths %s %u for afi %u, safi %u%s",
1063 (set
== 1) ? "" : "un",
1064 (peer_type
== BGP_PEER_EBGP
) ? "ebgp" : "ibgp",
1065 maxpaths
, afi
, safi
, VTY_NEWLINE
);
1069 bgp_recalculate_all_bestpaths (bgp
);
1074 DEFUN (bgp_maxmed_admin
,
1075 bgp_maxmed_admin_cmd
,
1076 "bgp max-med administrative ",
1078 "Advertise routes with max-med\n"
1079 "Administratively applied, for an indefinite period\n")
1085 bgp
->v_maxmed_admin
= 1;
1086 bgp
->maxmed_admin_value
= BGP_MAXMED_VALUE_DEFAULT
;
1088 bgp_maxmed_update(bgp
);
1093 DEFUN (bgp_maxmed_admin_medv
,
1094 bgp_maxmed_admin_medv_cmd
,
1095 "bgp max-med administrative (0-4294967294)",
1097 "Advertise routes with max-med\n"
1098 "Administratively applied, for an indefinite period\n"
1099 "Max MED value to be used\n")
1106 bgp
->v_maxmed_admin
= 1;
1107 VTY_GET_INTEGER ("max-med admin med-value", bgp
->maxmed_admin_value
, argv
[idx_number
]->arg
);
1109 bgp_maxmed_update(bgp
);
1114 DEFUN (no_bgp_maxmed_admin
,
1115 no_bgp_maxmed_admin_cmd
,
1116 "no bgp max-med administrative [(0-4294967294)]",
1119 "Advertise routes with max-med\n"
1120 "Administratively applied, for an indefinite period\n"
1121 "Max MED value to be used\n")
1126 bgp
->v_maxmed_admin
= BGP_MAXMED_ADMIN_UNCONFIGURED
;
1127 bgp
->maxmed_admin_value
= BGP_MAXMED_VALUE_DEFAULT
;
1128 bgp_maxmed_update(bgp
);
1133 DEFUN (bgp_maxmed_onstartup
,
1134 bgp_maxmed_onstartup_cmd
,
1135 "bgp max-med on-startup (5-86400)",
1137 "Advertise routes with max-med\n"
1138 "Effective on a startup\n"
1139 "Time (seconds) period for max-med\n")
1148 vty_out (vty
, "%% Must supply max-med on-startup period");
1152 VTY_GET_INTEGER ("max-med on-startup period", bgp
->v_maxmed_onstartup
, argv
[idx_number
]->arg
);
1153 bgp
->maxmed_onstartup_value
= BGP_MAXMED_VALUE_DEFAULT
;
1155 bgp_maxmed_update(bgp
);
1160 DEFUN (bgp_maxmed_onstartup_medv
,
1161 bgp_maxmed_onstartup_medv_cmd
,
1162 "bgp max-med on-startup (5-86400) (0-4294967294)",
1164 "Advertise routes with max-med\n"
1165 "Effective on a startup\n"
1166 "Time (seconds) period for max-med\n"
1167 "Max MED value to be used\n")
1170 int idx_number_2
= 4;
1177 vty_out (vty
, "%% Must supply max-med on-startup period and med value");
1181 VTY_GET_INTEGER ("max-med on-startup period", bgp
->v_maxmed_onstartup
, argv
[idx_number
]->arg
);
1182 VTY_GET_INTEGER ("max-med on-startup med-value", bgp
->maxmed_onstartup_value
, argv
[idx_number_2
]->arg
);
1184 bgp_maxmed_update(bgp
);
1189 DEFUN (no_bgp_maxmed_onstartup
,
1190 no_bgp_maxmed_onstartup_cmd
,
1191 "no bgp max-med on-startup [(5-86400) [(0-4294967294)]]",
1194 "Advertise routes with max-med\n"
1195 "Effective on a startup\n"
1196 "Time (seconds) period for max-med\n"
1197 "Max MED value to be used\n")
1203 /* Cancel max-med onstartup if its on */
1204 if (bgp
->t_maxmed_onstartup
)
1206 THREAD_TIMER_OFF (bgp
->t_maxmed_onstartup
);
1207 bgp
->maxmed_onstartup_over
= 1;
1210 bgp
->v_maxmed_onstartup
= BGP_MAXMED_ONSTARTUP_UNCONFIGURED
;
1211 bgp
->maxmed_onstartup_value
= BGP_MAXMED_VALUE_DEFAULT
;
1213 bgp_maxmed_update(bgp
);
1219 bgp_update_delay_config_vty (struct vty
*vty
, const char *delay
,
1223 u_int16_t update_delay
;
1224 u_int16_t establish_wait
;
1229 VTY_GET_INTEGER_RANGE ("update-delay", update_delay
, delay
,
1230 BGP_UPDATE_DELAY_MIN
, BGP_UPDATE_DELAY_MAX
);
1232 if (!wait
) /* update-delay <delay> */
1234 bgp
->v_update_delay
= update_delay
;
1235 bgp
->v_establish_wait
= bgp
->v_update_delay
;
1239 /* update-delay <delay> <establish-wait> */
1240 establish_wait
= atoi (wait
);
1241 if (update_delay
< establish_wait
)
1243 vty_out (vty
, "%%Failed: update-delay less than the establish-wait!%s",
1248 bgp
->v_update_delay
= update_delay
;
1249 bgp
->v_establish_wait
= establish_wait
;
1255 bgp_update_delay_deconfig_vty (struct vty
*vty
)
1261 bgp
->v_update_delay
= BGP_UPDATE_DELAY_DEF
;
1262 bgp
->v_establish_wait
= bgp
->v_update_delay
;
1268 bgp_config_write_update_delay (struct vty
*vty
, struct bgp
*bgp
)
1270 if (bgp
->v_update_delay
!= BGP_UPDATE_DELAY_DEF
)
1272 vty_out (vty
, " update-delay %d", bgp
->v_update_delay
);
1273 if (bgp
->v_update_delay
!= bgp
->v_establish_wait
)
1274 vty_out (vty
, " %d", bgp
->v_establish_wait
);
1275 vty_out (vty
, "%s", VTY_NEWLINE
);
1282 /* Update-delay configuration */
1283 DEFUN (bgp_update_delay
,
1284 bgp_update_delay_cmd
,
1285 "update-delay (0-3600)",
1286 "Force initial delay for best-path and updates\n"
1290 return bgp_update_delay_config_vty(vty
, argv
[idx_number
]->arg
, NULL
);
1293 DEFUN (bgp_update_delay_establish_wait
,
1294 bgp_update_delay_establish_wait_cmd
,
1295 "update-delay (0-3600) (1-3600)",
1296 "Force initial delay for best-path and updates\n"
1298 "Wait for peers to be established\n"
1302 int idx_number_2
= 2;
1303 return bgp_update_delay_config_vty(vty
, argv
[idx_number
]->arg
, argv
[idx_number_2
]->arg
);
1306 /* Update-delay deconfiguration */
1307 DEFUN (no_bgp_update_delay
,
1308 no_bgp_update_delay_cmd
,
1309 "no update-delay [(0-3600) [(1-3600)]]",
1311 "Force initial delay for best-path and updates\n"
1313 "Wait for peers to be established\n")
1315 return bgp_update_delay_deconfig_vty(vty
);
1320 bgp_wpkt_quanta_config_vty (struct vty
*vty
, const char *num
, char set
)
1327 VTY_GET_INTEGER_RANGE ("write-quanta", bgp
->wpkt_quanta
, num
,
1330 bgp
->wpkt_quanta
= BGP_WRITE_PACKET_MAX
;
1336 bgp_config_write_wpkt_quanta (struct vty
*vty
, struct bgp
*bgp
)
1338 if (bgp
->wpkt_quanta
!= BGP_WRITE_PACKET_MAX
)
1339 vty_out (vty
, " write-quanta %d%s",
1340 bgp
->wpkt_quanta
, VTY_NEWLINE
);
1346 /* Update-delay configuration */
1347 DEFUN (bgp_wpkt_quanta
,
1348 bgp_wpkt_quanta_cmd
,
1349 "write-quanta (1-10000)",
1350 "How many packets to write to peer socket per run\n"
1351 "Number of packets\n")
1354 return bgp_wpkt_quanta_config_vty(vty
, argv
[idx_number
]->arg
, 1);
1357 /* Update-delay deconfiguration */
1358 DEFUN (no_bgp_wpkt_quanta
,
1359 no_bgp_wpkt_quanta_cmd
,
1360 "no write-quanta (1-10000)",
1361 "How many packets to write to peer socket per run\n"
1362 "Number of packets\n")
1365 return bgp_wpkt_quanta_config_vty(vty
, argv
[idx_number
]->arg
, 0);
1369 bgp_coalesce_config_vty (struct vty
*vty
, const char *num
, char set
)
1376 VTY_GET_INTEGER_RANGE ("coalesce-time", bgp
->coalesce_time
, num
,
1379 bgp
->coalesce_time
= BGP_DEFAULT_SUBGROUP_COALESCE_TIME
;
1385 bgp_config_write_coalesce_time (struct vty
*vty
, struct bgp
*bgp
)
1387 if (bgp
->coalesce_time
!= BGP_DEFAULT_SUBGROUP_COALESCE_TIME
)
1388 vty_out (vty
, " coalesce-time %d%s",
1389 bgp
->coalesce_time
, VTY_NEWLINE
);
1395 DEFUN (bgp_coalesce_time
,
1396 bgp_coalesce_time_cmd
,
1397 "coalesce-time (0-4294967295)",
1398 "Subgroup coalesce timer\n"
1399 "Subgroup coalesce timer value (in ms)\n")
1402 return bgp_coalesce_config_vty(vty
, argv
[idx_number
]->arg
, 1);
1405 DEFUN (no_bgp_coalesce_time
,
1406 no_bgp_coalesce_time_cmd
,
1407 "no coalesce-time (0-4294967295)",
1408 "Subgroup coalesce timer\n"
1409 "Subgroup coalesce timer value (in ms)\n")
1412 return bgp_coalesce_config_vty(vty
, argv
[idx_number
]->arg
, 0);
1415 /* Maximum-paths configuration */
1416 DEFUN (bgp_maxpaths
,
1418 "maximum-paths (1-255)",
1419 "Forward packets over multiple paths\n"
1420 "Number of paths\n")
1423 return bgp_maxpaths_config_vty(vty
, BGP_PEER_EBGP
, argv
[idx_number
]->arg
, 0, 1);
1426 DEFUN (bgp_maxpaths_ibgp
,
1427 bgp_maxpaths_ibgp_cmd
,
1428 "maximum-paths ibgp (1-255)",
1429 "Forward packets over multiple paths\n"
1431 "Number of paths\n")
1434 return bgp_maxpaths_config_vty(vty
, BGP_PEER_IBGP
, argv
[idx_number
]->arg
, 0, 1);
1437 DEFUN (bgp_maxpaths_ibgp_cluster
,
1438 bgp_maxpaths_ibgp_cluster_cmd
,
1439 "maximum-paths ibgp (1-255) equal-cluster-length",
1440 "Forward packets over multiple paths\n"
1443 "Match the cluster length\n")
1446 return bgp_maxpaths_config_vty(vty
, BGP_PEER_IBGP
, argv
[idx_number
]->arg
,
1447 BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN
, 1);
1450 DEFUN (no_bgp_maxpaths
,
1451 no_bgp_maxpaths_cmd
,
1452 "no maximum-paths [(1-255)]",
1454 "Forward packets over multiple paths\n"
1455 "Number of paths\n")
1457 return bgp_maxpaths_config_vty(vty
, BGP_PEER_EBGP
, NULL
, 0, 0);
1460 DEFUN (no_bgp_maxpaths_ibgp
,
1461 no_bgp_maxpaths_ibgp_cmd
,
1462 "no maximum-paths ibgp [(1-255) [equal-cluster-length]]",
1464 "Forward packets over multiple paths\n"
1467 "Match the cluster length\n")
1469 return bgp_maxpaths_config_vty(vty
, BGP_PEER_IBGP
, NULL
, 0, 0);
1473 bgp_config_write_maxpaths (struct vty
*vty
, struct bgp
*bgp
, afi_t afi
,
1474 safi_t safi
, int *write
)
1476 if (bgp
->maxpaths
[afi
][safi
].maxpaths_ebgp
!= MULTIPATH_NUM
)
1478 bgp_config_write_family_header (vty
, afi
, safi
, write
);
1479 vty_out (vty
, " maximum-paths %d%s",
1480 bgp
->maxpaths
[afi
][safi
].maxpaths_ebgp
, VTY_NEWLINE
);
1483 if (bgp
->maxpaths
[afi
][safi
].maxpaths_ibgp
!= MULTIPATH_NUM
)
1485 bgp_config_write_family_header (vty
, afi
, safi
, write
);
1486 vty_out (vty
, " maximum-paths ibgp %d",
1487 bgp
->maxpaths
[afi
][safi
].maxpaths_ibgp
);
1488 if (CHECK_FLAG (bgp
->maxpaths
[afi
][safi
].ibgp_flags
,
1489 BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN
))
1490 vty_out (vty
, " equal-cluster-length");
1491 vty_out (vty
, "%s", VTY_NEWLINE
);
1501 "timers bgp (0-65535) (0-65535)",
1502 "Adjust routing timers\n"
1504 "Keepalive interval\n"
1508 int idx_number_2
= 3;
1510 unsigned long keepalive
= 0;
1511 unsigned long holdtime
= 0;
1515 VTY_GET_INTEGER ("keepalive", keepalive
, argv
[idx_number
]->arg
);
1516 VTY_GET_INTEGER ("holdtime", holdtime
, argv
[idx_number_2
]->arg
);
1518 /* Holdtime value check. */
1519 if (holdtime
< 3 && holdtime
!= 0)
1521 vty_out (vty
, "%% hold time value must be either 0 or greater than 3%s",
1526 bgp_timers_set (bgp
, keepalive
, holdtime
);
1531 DEFUN (no_bgp_timers
,
1533 "no timers bgp [(0-65535) (0-65535)]",
1535 "Adjust routing timers\n"
1537 "Keepalive interval\n"
1543 bgp_timers_unset (bgp
);
1549 DEFUN (bgp_client_to_client_reflection
,
1550 bgp_client_to_client_reflection_cmd
,
1551 "bgp client-to-client reflection",
1552 "BGP specific commands\n"
1553 "Configure client to client route reflection\n"
1554 "reflection of routes allowed\n")
1559 bgp_flag_unset (bgp
, BGP_FLAG_NO_CLIENT_TO_CLIENT
);
1560 bgp_clear_star_soft_out (vty
, bgp
->name
);
1565 DEFUN (no_bgp_client_to_client_reflection
,
1566 no_bgp_client_to_client_reflection_cmd
,
1567 "no bgp client-to-client reflection",
1569 "BGP specific commands\n"
1570 "Configure client to client route reflection\n"
1571 "reflection of routes allowed\n")
1576 bgp_flag_set (bgp
, BGP_FLAG_NO_CLIENT_TO_CLIENT
);
1577 bgp_clear_star_soft_out (vty
, bgp
->name
);
1582 /* "bgp always-compare-med" configuration. */
1583 DEFUN (bgp_always_compare_med
,
1584 bgp_always_compare_med_cmd
,
1585 "bgp always-compare-med",
1586 "BGP specific commands\n"
1587 "Allow comparing MED from different neighbors\n")
1592 bgp_flag_set (bgp
, BGP_FLAG_ALWAYS_COMPARE_MED
);
1593 bgp_recalculate_all_bestpaths (bgp
);
1598 DEFUN (no_bgp_always_compare_med
,
1599 no_bgp_always_compare_med_cmd
,
1600 "no bgp always-compare-med",
1602 "BGP specific commands\n"
1603 "Allow comparing MED from different neighbors\n")
1608 bgp_flag_unset (bgp
, BGP_FLAG_ALWAYS_COMPARE_MED
);
1609 bgp_recalculate_all_bestpaths (bgp
);
1614 /* "bgp deterministic-med" configuration. */
1615 DEFUN (bgp_deterministic_med
,
1616 bgp_deterministic_med_cmd
,
1617 "bgp deterministic-med",
1618 "BGP specific commands\n"
1619 "Pick the best-MED path among paths advertised from the neighboring AS\n")
1625 if (!bgp_flag_check(bgp
, BGP_FLAG_DETERMINISTIC_MED
))
1627 bgp_flag_set (bgp
, BGP_FLAG_DETERMINISTIC_MED
);
1628 bgp_recalculate_all_bestpaths (bgp
);
1634 DEFUN (no_bgp_deterministic_med
,
1635 no_bgp_deterministic_med_cmd
,
1636 "no bgp deterministic-med",
1638 "BGP specific commands\n"
1639 "Pick the best-MED path among paths advertised from the neighboring AS\n")
1642 int bestpath_per_as_used
;
1646 struct listnode
*node
, *nnode
;
1650 if (bgp_flag_check(bgp
, BGP_FLAG_DETERMINISTIC_MED
))
1652 bestpath_per_as_used
= 0;
1654 for (ALL_LIST_ELEMENTS (bgp
->peer
, node
, nnode
, peer
))
1656 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
1657 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
1658 if (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS
))
1660 bestpath_per_as_used
= 1;
1664 if (bestpath_per_as_used
)
1668 if (bestpath_per_as_used
)
1670 vty_out (vty
, "bgp deterministic-med cannot be disabled while addpath-tx-bestpath-per-AS is in use%s",
1676 bgp_flag_unset (bgp
, BGP_FLAG_DETERMINISTIC_MED
);
1677 bgp_recalculate_all_bestpaths (bgp
);
1684 /* "bgp graceful-restart" configuration. */
1685 DEFUN (bgp_graceful_restart
,
1686 bgp_graceful_restart_cmd
,
1687 "bgp graceful-restart",
1688 "BGP specific commands\n"
1689 "Graceful restart capability parameters\n")
1694 bgp_flag_set (bgp
, BGP_FLAG_GRACEFUL_RESTART
);
1698 DEFUN (no_bgp_graceful_restart
,
1699 no_bgp_graceful_restart_cmd
,
1700 "no bgp graceful-restart",
1702 "BGP specific commands\n"
1703 "Graceful restart capability parameters\n")
1708 bgp_flag_unset (bgp
, BGP_FLAG_GRACEFUL_RESTART
);
1712 DEFUN (bgp_graceful_restart_stalepath_time
,
1713 bgp_graceful_restart_stalepath_time_cmd
,
1714 "bgp graceful-restart stalepath-time (1-3600)",
1715 "BGP specific commands\n"
1716 "Graceful restart capability parameters\n"
1717 "Set the max time to hold onto restarting peer's stale paths\n"
1718 "Delay value (seconds)\n")
1722 u_int32_t stalepath
;
1728 VTY_GET_INTEGER_RANGE ("stalepath-time", stalepath
, argv
[idx_number
]->arg
, 1, 3600);
1729 bgp
->stalepath_time
= stalepath
;
1733 DEFUN (bgp_graceful_restart_restart_time
,
1734 bgp_graceful_restart_restart_time_cmd
,
1735 "bgp graceful-restart restart-time (1-3600)",
1736 "BGP specific commands\n"
1737 "Graceful restart capability parameters\n"
1738 "Set the time to wait to delete stale routes before a BGP open message is received\n"
1739 "Delay value (seconds)\n")
1749 VTY_GET_INTEGER_RANGE ("restart-time", restart
, argv
[idx_number
]->arg
, 1, 3600);
1750 bgp
->restart_time
= restart
;
1754 DEFUN (no_bgp_graceful_restart_stalepath_time
,
1755 no_bgp_graceful_restart_stalepath_time_cmd
,
1756 "no bgp graceful-restart stalepath-time [(1-3600)]",
1758 "BGP specific commands\n"
1759 "Graceful restart capability parameters\n"
1760 "Set the max time to hold onto restarting peer's stale paths\n"
1761 "Delay value (seconds)\n")
1769 bgp
->stalepath_time
= BGP_DEFAULT_STALEPATH_TIME
;
1773 DEFUN (no_bgp_graceful_restart_restart_time
,
1774 no_bgp_graceful_restart_restart_time_cmd
,
1775 "no bgp graceful-restart restart-time [(1-3600)]",
1777 "BGP specific commands\n"
1778 "Graceful restart capability parameters\n"
1779 "Set the time to wait to delete stale routes before a BGP open message is received\n"
1780 "Delay value (seconds)\n")
1788 bgp
->restart_time
= BGP_DEFAULT_RESTART_TIME
;
1792 /* "bgp fast-external-failover" configuration. */
1793 DEFUN (bgp_fast_external_failover
,
1794 bgp_fast_external_failover_cmd
,
1795 "bgp fast-external-failover",
1797 "Immediately reset session if a link to a directly connected external peer goes down\n")
1802 bgp_flag_unset (bgp
, BGP_FLAG_NO_FAST_EXT_FAILOVER
);
1806 DEFUN (no_bgp_fast_external_failover
,
1807 no_bgp_fast_external_failover_cmd
,
1808 "no bgp fast-external-failover",
1811 "Immediately reset session if a link to a directly connected external peer goes down\n")
1816 bgp_flag_set (bgp
, BGP_FLAG_NO_FAST_EXT_FAILOVER
);
1820 /* "bgp enforce-first-as" configuration. */
1821 DEFUN (bgp_enforce_first_as
,
1822 bgp_enforce_first_as_cmd
,
1823 "bgp enforce-first-as",
1825 "Enforce the first AS for EBGP routes\n")
1830 bgp_flag_set (bgp
, BGP_FLAG_ENFORCE_FIRST_AS
);
1831 bgp_clear_star_soft_in (vty
, bgp
->name
);
1836 DEFUN (no_bgp_enforce_first_as
,
1837 no_bgp_enforce_first_as_cmd
,
1838 "no bgp enforce-first-as",
1841 "Enforce the first AS for EBGP routes\n")
1846 bgp_flag_unset (bgp
, BGP_FLAG_ENFORCE_FIRST_AS
);
1847 bgp_clear_star_soft_in (vty
, bgp
->name
);
1852 /* "bgp bestpath compare-routerid" configuration. */
1853 DEFUN (bgp_bestpath_compare_router_id
,
1854 bgp_bestpath_compare_router_id_cmd
,
1855 "bgp bestpath compare-routerid",
1856 "BGP specific commands\n"
1857 "Change the default bestpath selection\n"
1858 "Compare router-id for identical EBGP paths\n")
1863 bgp_flag_set (bgp
, BGP_FLAG_COMPARE_ROUTER_ID
);
1864 bgp_recalculate_all_bestpaths (bgp
);
1869 DEFUN (no_bgp_bestpath_compare_router_id
,
1870 no_bgp_bestpath_compare_router_id_cmd
,
1871 "no bgp bestpath compare-routerid",
1873 "BGP specific commands\n"
1874 "Change the default bestpath selection\n"
1875 "Compare router-id for identical EBGP paths\n")
1880 bgp_flag_unset (bgp
, BGP_FLAG_COMPARE_ROUTER_ID
);
1881 bgp_recalculate_all_bestpaths (bgp
);
1886 /* "bgp bestpath as-path ignore" configuration. */
1887 DEFUN (bgp_bestpath_aspath_ignore
,
1888 bgp_bestpath_aspath_ignore_cmd
,
1889 "bgp bestpath as-path ignore",
1890 "BGP specific commands\n"
1891 "Change the default bestpath selection\n"
1892 "AS-path attribute\n"
1893 "Ignore as-path length in selecting a route\n")
1898 bgp_flag_set (bgp
, BGP_FLAG_ASPATH_IGNORE
);
1899 bgp_recalculate_all_bestpaths (bgp
);
1904 DEFUN (no_bgp_bestpath_aspath_ignore
,
1905 no_bgp_bestpath_aspath_ignore_cmd
,
1906 "no bgp bestpath as-path ignore",
1908 "BGP specific commands\n"
1909 "Change the default bestpath selection\n"
1910 "AS-path attribute\n"
1911 "Ignore as-path length in selecting a route\n")
1916 bgp_flag_unset (bgp
, BGP_FLAG_ASPATH_IGNORE
);
1917 bgp_recalculate_all_bestpaths (bgp
);
1922 /* "bgp bestpath as-path confed" configuration. */
1923 DEFUN (bgp_bestpath_aspath_confed
,
1924 bgp_bestpath_aspath_confed_cmd
,
1925 "bgp bestpath as-path confed",
1926 "BGP specific commands\n"
1927 "Change the default bestpath selection\n"
1928 "AS-path attribute\n"
1929 "Compare path lengths including confederation sets & sequences in selecting a route\n")
1934 bgp_flag_set (bgp
, BGP_FLAG_ASPATH_CONFED
);
1935 bgp_recalculate_all_bestpaths (bgp
);
1940 DEFUN (no_bgp_bestpath_aspath_confed
,
1941 no_bgp_bestpath_aspath_confed_cmd
,
1942 "no bgp bestpath as-path confed",
1944 "BGP specific commands\n"
1945 "Change the default bestpath selection\n"
1946 "AS-path attribute\n"
1947 "Compare path lengths including confederation sets & sequences in selecting a route\n")
1952 bgp_flag_unset (bgp
, BGP_FLAG_ASPATH_CONFED
);
1953 bgp_recalculate_all_bestpaths (bgp
);
1958 /* "bgp bestpath as-path multipath-relax" configuration. */
1959 DEFUN (bgp_bestpath_aspath_multipath_relax
,
1960 bgp_bestpath_aspath_multipath_relax_cmd
,
1961 "bgp bestpath as-path multipath-relax [<as-set|no-as-set>]",
1962 "BGP specific commands\n"
1963 "Change the default bestpath selection\n"
1964 "AS-path attribute\n"
1965 "Allow load sharing across routes that have different AS paths (but same length)\n"
1966 "Generate an AS_SET\n"
1967 "Do not generate an AS_SET\n")
1973 bgp_flag_set (bgp
, BGP_FLAG_ASPATH_MULTIPATH_RELAX
);
1975 /* no-as-set is now the default behavior so we can silently
1977 if (argv
[idx_as_set
]->arg
!= NULL
&& strncmp (argv
[idx_as_set
]->arg
, "a", 1) == 0)
1978 bgp_flag_set (bgp
, BGP_FLAG_MULTIPATH_RELAX_AS_SET
);
1980 bgp_flag_unset (bgp
, BGP_FLAG_MULTIPATH_RELAX_AS_SET
) ;
1982 bgp_recalculate_all_bestpaths (bgp
);
1987 DEFUN (no_bgp_bestpath_aspath_multipath_relax
,
1988 no_bgp_bestpath_aspath_multipath_relax_cmd
,
1989 "no bgp bestpath as-path multipath-relax [<as-set|no-as-set>]",
1991 "BGP specific commands\n"
1992 "Change the default bestpath selection\n"
1993 "AS-path attribute\n"
1994 "Allow load sharing across routes that have different AS paths (but same length)\n"
1995 "Generate an AS_SET\n"
1996 "Do not generate an AS_SET\n")
2001 bgp_flag_unset (bgp
, BGP_FLAG_ASPATH_MULTIPATH_RELAX
);
2002 bgp_flag_unset (bgp
, BGP_FLAG_MULTIPATH_RELAX_AS_SET
);
2003 bgp_recalculate_all_bestpaths (bgp
);
2008 /* "bgp log-neighbor-changes" configuration. */
2009 DEFUN (bgp_log_neighbor_changes
,
2010 bgp_log_neighbor_changes_cmd
,
2011 "bgp log-neighbor-changes",
2012 "BGP specific commands\n"
2013 "Log neighbor up/down and reset reason\n")
2018 bgp_flag_set (bgp
, BGP_FLAG_LOG_NEIGHBOR_CHANGES
);
2022 DEFUN (no_bgp_log_neighbor_changes
,
2023 no_bgp_log_neighbor_changes_cmd
,
2024 "no bgp log-neighbor-changes",
2026 "BGP specific commands\n"
2027 "Log neighbor up/down and reset reason\n")
2032 bgp_flag_unset (bgp
, BGP_FLAG_LOG_NEIGHBOR_CHANGES
);
2036 /* "bgp bestpath med" configuration. */
2037 DEFUN (bgp_bestpath_med
,
2038 bgp_bestpath_med_cmd
,
2039 "bgp bestpath med <confed|missing-as-worst>",
2040 "BGP specific commands\n"
2041 "Change the default bestpath selection\n"
2043 "Compare MED among confederation paths\n"
2044 "Treat missing MED as the least preferred one\n")
2046 int idx_med_knob
= 3;
2051 if (strncmp (argv
[idx_med_knob
]->arg
, "confed", 1) == 0)
2052 bgp_flag_set (bgp
, BGP_FLAG_MED_CONFED
);
2054 bgp_flag_set (bgp
, BGP_FLAG_MED_MISSING_AS_WORST
);
2056 bgp_recalculate_all_bestpaths (bgp
);
2061 DEFUN (bgp_bestpath_med2
,
2062 bgp_bestpath_med2_cmd
,
2063 "bgp bestpath med <confed missing-as-worst|missing-as-worst confed>",
2064 "BGP specific commands\n"
2065 "Change the default bestpath selection\n"
2067 "Compare MED among confederation paths\n"
2068 "Treat missing MED as the least preferred one\n"
2069 "Treat missing MED as the least preferred one\n"
2070 "Compare MED among confederation paths\n")
2075 bgp_flag_set (bgp
, BGP_FLAG_MED_CONFED
);
2076 bgp_flag_set (bgp
, BGP_FLAG_MED_MISSING_AS_WORST
);
2077 bgp_recalculate_all_bestpaths (bgp
);
2083 DEFUN (no_bgp_bestpath_med
,
2084 no_bgp_bestpath_med_cmd
,
2085 "no bgp bestpath med <confed|missing-as-worst>",
2087 "BGP specific commands\n"
2088 "Change the default bestpath selection\n"
2090 "Compare MED among confederation paths\n"
2091 "Treat missing MED as the least preferred one\n")
2093 int idx_med_knob
= 4;
2098 if (strncmp (argv
[idx_med_knob
]->arg
, "confed", 1) == 0)
2099 bgp_flag_unset (bgp
, BGP_FLAG_MED_CONFED
);
2101 bgp_flag_unset (bgp
, BGP_FLAG_MED_MISSING_AS_WORST
);
2103 bgp_recalculate_all_bestpaths (bgp
);
2108 DEFUN (no_bgp_bestpath_med2
,
2109 no_bgp_bestpath_med2_cmd
,
2110 "no bgp bestpath med [confed] missing-as-worst",
2112 "BGP specific commands\n"
2113 "Change the default bestpath selection\n"
2115 "Compare MED among confederation paths\n"
2116 "Treat missing MED as the least preferred one\n")
2121 bgp_flag_unset (bgp
, BGP_FLAG_MED_CONFED
);
2122 bgp_flag_unset (bgp
, BGP_FLAG_MED_MISSING_AS_WORST
);
2123 bgp_recalculate_all_bestpaths (bgp
);
2128 /* "no bgp default ipv4-unicast". */
2129 DEFUN (no_bgp_default_ipv4_unicast
,
2130 no_bgp_default_ipv4_unicast_cmd
,
2131 "no bgp default ipv4-unicast",
2133 "BGP specific commands\n"
2134 "Configure BGP defaults\n"
2135 "Activate ipv4-unicast for a peer by default\n")
2140 bgp_flag_set (bgp
, BGP_FLAG_NO_DEFAULT_IPV4
);
2144 DEFUN (bgp_default_ipv4_unicast
,
2145 bgp_default_ipv4_unicast_cmd
,
2146 "bgp default ipv4-unicast",
2147 "BGP specific commands\n"
2148 "Configure BGP defaults\n"
2149 "Activate ipv4-unicast for a peer by default\n")
2154 bgp_flag_unset (bgp
, BGP_FLAG_NO_DEFAULT_IPV4
);
2158 /* Display hostname in certain command outputs */
2159 DEFUN (bgp_default_show_hostname
,
2160 bgp_default_show_hostname_cmd
,
2161 "bgp default show-hostname",
2162 "BGP specific commands\n"
2163 "Configure BGP defaults\n"
2164 "Show hostname in certain command ouputs\n")
2169 bgp_flag_set (bgp
, BGP_FLAG_SHOW_HOSTNAME
);
2173 DEFUN (no_bgp_default_show_hostname
,
2174 no_bgp_default_show_hostname_cmd
,
2175 "no bgp default show-hostname",
2177 "BGP specific commands\n"
2178 "Configure BGP defaults\n"
2179 "Show hostname in certain command ouputs\n")
2184 bgp_flag_unset (bgp
, BGP_FLAG_SHOW_HOSTNAME
);
2188 /* "bgp network import-check" configuration. */
2189 DEFUN (bgp_network_import_check
,
2190 bgp_network_import_check_cmd
,
2191 "bgp network import-check",
2192 "BGP specific commands\n"
2193 "BGP network command\n"
2194 "Check BGP network route exists in IGP\n")
2199 if (!bgp_flag_check(bgp
, BGP_FLAG_IMPORT_CHECK
))
2201 bgp_flag_set (bgp
, BGP_FLAG_IMPORT_CHECK
);
2202 bgp_static_redo_import_check(bgp
);
2208 ALIAS_HIDDEN (bgp_network_import_check
,
2209 bgp_network_import_check_exact_cmd
,
2210 "bgp network import-check exact",
2211 "BGP specific commands\n"
2212 "BGP network command\n"
2213 "Check BGP network route exists in IGP\n"
2214 "Match route precisely\n")
2216 DEFUN (no_bgp_network_import_check
,
2217 no_bgp_network_import_check_cmd
,
2218 "no bgp network import-check",
2220 "BGP specific commands\n"
2221 "BGP network command\n"
2222 "Check BGP network route exists in IGP\n")
2227 if (bgp_flag_check(bgp
, BGP_FLAG_IMPORT_CHECK
))
2229 bgp_flag_unset (bgp
, BGP_FLAG_IMPORT_CHECK
);
2230 bgp_static_redo_import_check(bgp
);
2236 DEFUN (bgp_default_local_preference
,
2237 bgp_default_local_preference_cmd
,
2238 "bgp default local-preference (0-4294967295)",
2239 "BGP specific commands\n"
2240 "Configure BGP defaults\n"
2241 "local preference (higher=more preferred)\n"
2242 "Configure default local preference value\n")
2246 u_int32_t local_pref
;
2250 VTY_GET_INTEGER ("local preference", local_pref
, argv
[idx_number
]->arg
);
2252 bgp_default_local_preference_set (bgp
, local_pref
);
2253 bgp_clear_star_soft_in (vty
, bgp
->name
);
2258 DEFUN (no_bgp_default_local_preference
,
2259 no_bgp_default_local_preference_cmd
,
2260 "no bgp default local-preference [(0-4294967295)]",
2262 "BGP specific commands\n"
2263 "Configure BGP defaults\n"
2264 "local preference (higher=more preferred)\n"
2265 "Configure default local preference value\n")
2270 bgp_default_local_preference_unset (bgp
);
2271 bgp_clear_star_soft_in (vty
, bgp
->name
);
2277 DEFUN (bgp_default_subgroup_pkt_queue_max
,
2278 bgp_default_subgroup_pkt_queue_max_cmd
,
2279 "bgp default subgroup-pkt-queue-max (20-100)",
2280 "BGP specific commands\n"
2281 "Configure BGP defaults\n"
2282 "subgroup-pkt-queue-max\n"
2283 "Configure subgroup packet queue max\n")
2291 VTY_GET_INTEGER ("subgroup packet queue max", max_size
, argv
[idx_number
]->arg
);
2293 bgp_default_subgroup_pkt_queue_max_set (bgp
, max_size
);
2298 DEFUN (no_bgp_default_subgroup_pkt_queue_max
,
2299 no_bgp_default_subgroup_pkt_queue_max_cmd
,
2300 "no bgp default subgroup-pkt-queue-max [(20-100)]",
2302 "BGP specific commands\n"
2303 "Configure BGP defaults\n"
2304 "subgroup-pkt-queue-max\n"
2305 "Configure subgroup packet queue max\n")
2310 bgp_default_subgroup_pkt_queue_max_unset (bgp
);
2315 DEFUN (bgp_rr_allow_outbound_policy
,
2316 bgp_rr_allow_outbound_policy_cmd
,
2317 "bgp route-reflector allow-outbound-policy",
2318 "BGP specific commands\n"
2319 "Allow modifications made by out route-map\n"
2320 "on ibgp neighbors\n")
2326 if (!bgp_flag_check(bgp
, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY
))
2328 bgp_flag_set(bgp
, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY
);
2329 update_group_announce_rrclients(bgp
);
2330 bgp_clear_star_soft_out (vty
, bgp
->name
);
2336 DEFUN (no_bgp_rr_allow_outbound_policy
,
2337 no_bgp_rr_allow_outbound_policy_cmd
,
2338 "no bgp route-reflector allow-outbound-policy",
2340 "BGP specific commands\n"
2341 "Allow modifications made by out route-map\n"
2342 "on ibgp neighbors\n")
2348 if (bgp_flag_check(bgp
, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY
))
2350 bgp_flag_unset(bgp
, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY
);
2351 update_group_announce_rrclients(bgp
);
2352 bgp_clear_star_soft_out (vty
, bgp
->name
);
2358 DEFUN (bgp_listen_limit
,
2359 bgp_listen_limit_cmd
,
2360 "bgp listen limit (1-5000)",
2361 "BGP specific commands\n"
2362 "Configure BGP defaults\n"
2363 "maximum number of BGP Dynamic Neighbors that can be created\n"
2364 "Configure Dynamic Neighbors listen limit value\n")
2372 VTY_GET_INTEGER_RANGE ("listen limit", listen_limit
, argv
[idx_number
]->arg
,
2373 BGP_DYNAMIC_NEIGHBORS_LIMIT_MIN
,
2374 BGP_DYNAMIC_NEIGHBORS_LIMIT_MAX
);
2376 bgp_listen_limit_set (bgp
, listen_limit
);
2381 DEFUN (no_bgp_listen_limit
,
2382 no_bgp_listen_limit_cmd
,
2383 "no bgp listen limit [(1-5000)]",
2384 "BGP specific commands\n"
2385 "Configure BGP defaults\n"
2386 "unset maximum number of BGP Dynamic Neighbors that can be created\n"
2387 "Configure Dynamic Neighbors listen limit value to default\n"
2388 "Configure Dynamic Neighbors listen limit value\n")
2393 bgp_listen_limit_unset (bgp
);
2399 * Check if this listen range is already configured. Check for exact
2400 * match or overlap based on input.
2402 static struct peer_group
*
2403 listen_range_exists (struct bgp
*bgp
, struct prefix
*range
, int exact
)
2405 struct listnode
*node
, *nnode
;
2406 struct listnode
*node1
, *nnode1
;
2407 struct peer_group
*group
;
2412 afi
= family2afi(range
->family
);
2413 for (ALL_LIST_ELEMENTS (bgp
->group
, node
, nnode
, group
))
2415 for (ALL_LIST_ELEMENTS (group
->listen_range
[afi
], node1
,
2419 match
= prefix_same (range
, lr
);
2421 match
= (prefix_match (range
, lr
) || prefix_match (lr
, range
));
2430 DEFUN (bgp_listen_range
,
2431 bgp_listen_range_cmd
,
2432 "bgp listen range <A.B.C.D/M|X:X::X:X/M> peer-group WORD",
2433 "BGP specific commands\n"
2434 "Configure BGP Dynamic Neighbors\n"
2435 "add a listening range for Dynamic Neighbors\n"
2436 LISTEN_RANGE_ADDR_STR
)
2438 int idx_ipv4_ipv6_prefixlen
= 3;
2441 struct prefix range
;
2442 struct peer_group
*group
, *existing_group
;
2448 //VTY_GET_IPV4_PREFIX ("listen range", range, argv[idx_ipv4_ipv6_prefixlen]->arg);
2450 /* Convert IP prefix string to struct prefix. */
2451 ret
= str2prefix (argv
[idx_ipv4_ipv6_prefixlen
]->arg
, &range
);
2454 vty_out (vty
, "%% Malformed listen range%s", VTY_NEWLINE
);
2458 afi
= family2afi(range
.family
);
2461 if (afi
== AFI_IP6
&& IN6_IS_ADDR_LINKLOCAL (&range
.u
.prefix6
))
2463 vty_out (vty
, "%% Malformed listen range (link-local address)%s",
2467 #endif /* HAVE_IPV6 */
2469 apply_mask (&range
);
2471 /* Check if same listen range is already configured. */
2472 existing_group
= listen_range_exists (bgp
, &range
, 1);
2475 if (strcmp (existing_group
->name
, argv
[idx_word
]->arg
) == 0)
2479 vty_out (vty
, "%% Same listen range is attached to peer-group %s%s",
2480 existing_group
->name
, VTY_NEWLINE
);
2485 /* Check if an overlapping listen range exists. */
2486 if (listen_range_exists (bgp
, &range
, 0))
2488 vty_out (vty
, "%% Listen range overlaps with existing listen range%s",
2493 group
= peer_group_lookup (bgp
, argv
[idx_word
]->arg
);
2496 vty_out (vty
, "%% Configure the peer-group first%s", VTY_NEWLINE
);
2500 ret
= peer_group_listen_range_add(group
, &range
);
2501 return bgp_vty_return (vty
, ret
);
2504 DEFUN (no_bgp_listen_range
,
2505 no_bgp_listen_range_cmd
,
2506 "no bgp listen range A.B.C.D/M peer-group WORD",
2507 "BGP specific commands\n"
2508 "Configure BGP defaults\n"
2509 "delete a listening range for Dynamic Neighbors\n"
2510 "Remove Dynamic Neighbors listening range\n")
2512 int idx_ipv4_prefixlen
= 4;
2515 struct prefix range
;
2516 struct peer_group
*group
;
2522 // VTY_GET_IPV4_PREFIX ("listen range", range, argv[idx_ipv4_prefixlen]->arg);
2524 /* Convert IP prefix string to struct prefix. */
2525 ret
= str2prefix (argv
[idx_ipv4_prefixlen
]->arg
, &range
);
2528 vty_out (vty
, "%% Malformed listen range%s", VTY_NEWLINE
);
2532 afi
= family2afi(range
.family
);
2535 if (afi
== AFI_IP6
&& IN6_IS_ADDR_LINKLOCAL (&range
.u
.prefix6
))
2537 vty_out (vty
, "%% Malformed listen range (link-local address)%s",
2541 #endif /* HAVE_IPV6 */
2543 apply_mask (&range
);
2546 group
= peer_group_lookup (bgp
, argv
[idx_word
]->arg
);
2549 vty_out (vty
, "%% Peer-group does not exist%s", VTY_NEWLINE
);
2553 ret
= peer_group_listen_range_del(group
, &range
);
2554 return bgp_vty_return (vty
, ret
);
2558 bgp_config_write_listen (struct vty
*vty
, struct bgp
*bgp
)
2560 struct peer_group
*group
;
2561 struct listnode
*node
, *nnode
, *rnode
, *nrnode
;
2562 struct prefix
*range
;
2564 char buf
[PREFIX2STR_BUFFER
];
2566 if (bgp
->dynamic_neighbors_limit
!= BGP_DYNAMIC_NEIGHBORS_LIMIT_DEFAULT
)
2567 vty_out (vty
, " bgp listen limit %d%s",
2568 bgp
->dynamic_neighbors_limit
, VTY_NEWLINE
);
2570 for (ALL_LIST_ELEMENTS (bgp
->group
, node
, nnode
, group
))
2572 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
2574 for (ALL_LIST_ELEMENTS (group
->listen_range
[afi
], rnode
, nrnode
, range
))
2576 prefix2str(range
, buf
, sizeof(buf
));
2577 vty_out(vty
, " bgp listen range %s peer-group %s%s",
2578 buf
, group
->name
, VTY_NEWLINE
);
2587 DEFUN (bgp_disable_connected_route_check
,
2588 bgp_disable_connected_route_check_cmd
,
2589 "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_set (bgp
, BGP_FLAG_DISABLE_NH_CONNECTED_CHK
);
2597 bgp_clear_star_soft_in (vty
, bgp
->name
);
2602 DEFUN (no_bgp_disable_connected_route_check
,
2603 no_bgp_disable_connected_route_check_cmd
,
2604 "no bgp disable-ebgp-connected-route-check",
2606 "BGP specific commands\n"
2607 "Disable checking if nexthop is connected on ebgp sessions\n")
2612 bgp_flag_unset (bgp
, BGP_FLAG_DISABLE_NH_CONNECTED_CHK
);
2613 bgp_clear_star_soft_in (vty
, bgp
->name
);
2620 peer_remote_as_vty (struct vty
*vty
, const char *peer_str
,
2621 const char *as_str
, afi_t afi
, safi_t safi
)
2626 int as_type
= AS_SPECIFIED
;
2631 if (strncmp(as_str
, "internal", strlen("internal")) == 0)
2634 as_type
= AS_INTERNAL
;
2636 else if (strncmp(as_str
, "external", strlen("external")) == 0)
2639 as_type
= AS_EXTERNAL
;
2643 /* Get AS number. */
2644 VTY_GET_INTEGER_RANGE ("AS", as
, as_str
, 1, BGP_AS4_MAX
);
2647 /* If peer is peer group, call proper function. */
2648 ret
= str2sockunion (peer_str
, &su
);
2651 /* Check for peer by interface */
2652 ret
= peer_remote_as (bgp
, NULL
, peer_str
, &as
, as_type
, afi
, safi
);
2655 ret
= peer_group_remote_as (bgp
, peer_str
, &as
, as_type
);
2658 vty_out (vty
, "%% Create the peer-group or interface first%s",
2667 if (peer_address_self_check (bgp
, &su
))
2669 vty_out (vty
, "%% Can not configure the local system as neighbor%s",
2673 ret
= peer_remote_as (bgp
, &su
, NULL
, &as
, as_type
, afi
, safi
);
2676 /* This peer belongs to peer group. */
2679 case BGP_ERR_PEER_GROUP_MEMBER
:
2680 vty_out (vty
, "%% Peer-group AS %u. Cannot configure remote-as for member%s", as
, VTY_NEWLINE
);
2682 case BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT
:
2683 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
);
2686 return bgp_vty_return (vty
, ret
);
2689 DEFUN (neighbor_remote_as
,
2690 neighbor_remote_as_cmd
,
2691 "neighbor <A.B.C.D|X:X::X:X|WORD> remote-as <(1-4294967295)|external|internal>",
2694 "Specify a BGP neighbor\n"
2698 int idx_remote_as
= 3;
2699 return peer_remote_as_vty (vty
, argv
[idx_peer
]->arg
, argv
[idx_remote_as
]->arg
, AFI_IP
, SAFI_UNICAST
);
2703 peer_conf_interface_get (struct vty
*vty
, const char *conf_if
, afi_t afi
,
2704 safi_t safi
, int v6only
, const char *peer_group_name
,
2708 int as_type
= AS_UNSPECIFIED
;
2711 struct peer_group
*group
;
2716 group
= peer_group_lookup (bgp
, conf_if
);
2720 vty_out (vty
, "%% Name conflict with peer-group %s", VTY_NEWLINE
);
2726 if (strncmp(as_str
, "internal", strlen("internal")) == 0)
2728 as_type
= AS_INTERNAL
;
2730 else if (strncmp(as_str
, "external", strlen("external")) == 0)
2732 as_type
= AS_EXTERNAL
;
2736 /* Get AS number. */
2737 VTY_GET_INTEGER_RANGE ("AS", as
, as_str
, 1, BGP_AS4_MAX
);
2738 as_type
= AS_SPECIFIED
;
2742 peer
= peer_lookup_by_conf_if (bgp
, conf_if
);
2745 if (bgp_flag_check (bgp
, BGP_FLAG_NO_DEFAULT_IPV4
)
2746 && afi
== AFI_IP
&& safi
== SAFI_UNICAST
)
2747 peer
= peer_create (NULL
, conf_if
, bgp
, bgp
->as
, as
, as_type
, 0, 0,
2750 peer
= peer_create (NULL
, conf_if
, bgp
, bgp
->as
, as
, as_type
, afi
, safi
,
2754 SET_FLAG(peer
->flags
, PEER_FLAG_IFPEER_V6ONLY
);
2756 /* Request zebra to initiate IPv6 RAs on this interface. We do this
2757 * any unnumbered peer in order to not worry about run-time transitions
2758 * (e.g., peering is initially IPv4, but the IPv4 /30 or /31 address
2759 * gets deleted later etc.)
2763 bgp_zebra_initiate_radv (bgp
, peer
);
2765 peer_flag_set (peer
, PEER_FLAG_CAPABILITY_ENHE
);
2767 else if ((v6only
&& !CHECK_FLAG(peer
->flags
, PEER_FLAG_IFPEER_V6ONLY
)) ||
2768 (!v6only
&& CHECK_FLAG(peer
->flags
, PEER_FLAG_IFPEER_V6ONLY
)))
2771 SET_FLAG(peer
->flags
, PEER_FLAG_IFPEER_V6ONLY
);
2773 UNSET_FLAG(peer
->flags
, PEER_FLAG_IFPEER_V6ONLY
);
2775 /* v6only flag changed. Reset bgp seesion */
2776 if (BGP_IS_VALID_STATE_FOR_NOTIF(peer
->status
))
2778 peer
->last_reset
= PEER_DOWN_V6ONLY_CHANGE
;
2779 bgp_notify_send (peer
, BGP_NOTIFY_CEASE
,
2780 BGP_NOTIFY_CEASE_CONFIG_CHANGE
);
2783 bgp_session_reset(peer
);
2789 if (peer_group_name
)
2791 group
= peer_group_lookup (bgp
, peer_group_name
);
2794 vty_out (vty
, "%% Configure the peer-group first%s", VTY_NEWLINE
);
2798 ret
= peer_group_bind (bgp
, &su
, peer
, group
, &as
);
2801 return bgp_vty_return (vty
, ret
);
2805 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
2806 * "neighbor WORD interface peer-group WORD",
2808 * "Interface name or neighbor tag\n"
2809 * "Enable BGP on interface\n"
2810 * "Member of the peer-group\n"
2811 * "peer-group name\n"
2814 DEFUN (neighbor_interface_config
,
2815 neighbor_interface_config_cmd
,
2816 "neighbor WORD interface",
2818 "Interface name or neighbor tag\n"
2819 "Enable BGP on interface\n")
2823 return peer_conf_interface_get (vty
, argv
[idx_word
]->arg
, AFI_IP
, SAFI_UNICAST
, 0,
2824 argv
[3]->arg
, NULL
);
2826 return peer_conf_interface_get (vty
, argv
[idx_word
]->arg
, AFI_IP
, SAFI_UNICAST
, 0,
2832 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
2833 * "neighbor WORD interface v6only peer-group WORD",
2835 * "Interface name or neighbor tag\n"
2836 * "Enable BGP on interface\n"
2837 * "Enable BGP with v6 link-local only\n"
2838 * "Member of the peer-group\n"
2839 * "peer-group name\n"
2842 DEFUN (neighbor_interface_config_v6only
,
2843 neighbor_interface_config_v6only_cmd
,
2844 "neighbor WORD interface v6only",
2846 "Interface name or neighbor tag\n"
2847 "Enable BGP on interface\n"
2848 "Enable BGP with v6 link-local only\n")
2851 return peer_conf_interface_get (vty
, argv
[idx_word
]->arg
, AFI_IP
, SAFI_UNICAST
, 1,
2852 argv
[5]->arg
, NULL
);
2856 DEFUN (neighbor_interface_config_remote_as
,
2857 neighbor_interface_config_remote_as_cmd
,
2858 "neighbor WORD interface remote-as <(1-4294967295)|external|internal>",
2860 "Interface name or neighbor tag\n"
2861 "Enable BGP on interface\n"
2865 int idx_remote_as
= 4;
2866 return peer_conf_interface_get (vty
, argv
[idx_word
]->arg
, AFI_IP
, SAFI_UNICAST
, 0,
2867 NULL
, argv
[idx_remote_as
]->arg
);
2870 DEFUN (neighbor_interface_v6only_config_remote_as
,
2871 neighbor_interface_v6only_config_remote_as_cmd
,
2872 "neighbor WORD interface v6only remote-as <(1-4294967295)|external|internal>",
2874 "Interface name or neighbor tag\n"
2875 "Enable BGP on interface\n"
2879 int idx_remote_as
= 5;
2880 return peer_conf_interface_get (vty
, argv
[idx_word
]->arg
, AFI_IP
, SAFI_UNICAST
, 1,
2881 NULL
, argv
[idx_remote_as
]->arg
);
2884 DEFUN (neighbor_peer_group
,
2885 neighbor_peer_group_cmd
,
2886 "neighbor WORD peer-group",
2888 "Interface name or neighbor tag\n"
2889 "Configure peer-group\n")
2894 struct peer_group
*group
;
2897 peer
= peer_lookup_by_conf_if (bgp
, argv
[idx_word
]->arg
);
2900 vty_out (vty
, "%% Name conflict with interface: %s", VTY_NEWLINE
);
2904 group
= peer_group_get (bgp
, argv
[idx_word
]->arg
);
2912 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
2913 * "no neighbor <A.B.C.D|X:X::X:X> remote-as ((1-4294967295)|internal|external)",
2917 * "Specify a BGP neighbor\n"
2923 "no neighbor <A.B.C.D|X:X::X:X|WORD>",
2931 struct peer_group
*group
;
2935 ret
= str2sockunion (argv
[idx_peer
]->arg
, &su
);
2938 /* look up for neighbor by interface name config. */
2939 peer
= peer_lookup_by_conf_if (vty
->index
, argv
[idx_peer
]->arg
);
2942 /* Request zebra to terminate IPv6 RAs on this interface. */
2944 bgp_zebra_terminate_radv (peer
->bgp
, peer
);
2949 group
= peer_group_lookup (vty
->index
, argv
[idx_peer
]->arg
);
2951 peer_group_delete (group
);
2954 vty_out (vty
, "%% Create the peer-group first%s", VTY_NEWLINE
);
2960 peer
= peer_lookup (vty
->index
, &su
);
2963 if (peer_dynamic_neighbor (peer
))
2965 vty_out (vty
, "%% Operation not allowed on a dynamic neighbor%s",
2970 other
= peer
->doppelganger
;
2972 if (other
&& other
->status
!= Deleted
)
2982 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
2983 * "no neighbor WORD interface remote-as ((1-4294967295)|internal|external)",
2986 * "Interface name\n"
2987 * "Configure BGP on interface\n"
2990 * "no neighbor WORD interface v6only peer-group WORD",
2993 * "Interface name\n"
2994 * "Configure BGP on interface\n"
2995 * "Enable BGP with v6 link-local only\n"
2996 * "Member of the peer-group\n"
2997 * "peer-group name\n"
2999 * "no neighbor WORD interface v6only remote-as ((1-4294967295)|internal|external)",
3002 * "Interface name\n"
3003 * "Configure BGP on interface\n"
3004 * "Enable BGP with v6 link-local only\n"
3007 * "no neighbor WORD interface v6only",
3010 * "Interface name\n"
3011 * "Configure BGP on interface\n"
3012 * "Enable BGP with v6 link-local only\n"
3014 * "no neighbor WORD interface peer-group WORD",
3017 * "Interface name\n"
3018 * "Configure BGP on interface\n"
3019 * "Member of the peer-group\n"
3020 * "peer-group name\n"
3023 DEFUN (no_neighbor_interface_config
,
3024 no_neighbor_interface_config_cmd
,
3025 "no neighbor WORD interface",
3029 "Configure BGP on interface\n")
3034 /* look up for neighbor by interface name config. */
3035 peer
= peer_lookup_by_conf_if (vty
->index
, argv
[idx_word
]->arg
);
3038 /* Request zebra to terminate IPv6 RAs on this interface. */
3040 bgp_zebra_terminate_radv (peer
->bgp
, peer
);
3045 vty_out (vty
, "%% Create the bgp interface first%s", VTY_NEWLINE
);
3051 DEFUN (no_neighbor_peer_group
,
3052 no_neighbor_peer_group_cmd
,
3053 "no neighbor WORD peer-group",
3057 "Configure peer-group\n")
3060 struct peer_group
*group
;
3062 group
= peer_group_lookup (vty
->index
, argv
[idx_word
]->arg
);
3064 peer_group_delete (group
);
3067 vty_out (vty
, "%% Create the peer-group first%s", VTY_NEWLINE
);
3073 DEFUN (no_neighbor_interface_peer_group_remote_as
,
3074 no_neighbor_interface_peer_group_remote_as_cmd
,
3075 "no neighbor WORD remote-as <(1-4294967295)|internal|external>",
3078 "Interface name or neighbor tag\n"
3079 "Specify a BGP neighbor\n"
3083 struct peer_group
*group
;
3086 /* look up for neighbor by interface name config. */
3087 peer
= peer_lookup_by_conf_if (vty
->index
, argv
[idx_word
]->arg
);
3090 peer_as_change (peer
, 0, AS_SPECIFIED
);
3094 group
= peer_group_lookup (vty
->index
, argv
[idx_word
]->arg
);
3096 peer_group_remote_as_delete (group
);
3099 vty_out (vty
, "%% Create the peer-group or interface first%s", VTY_NEWLINE
);
3105 DEFUN (neighbor_local_as
,
3106 neighbor_local_as_cmd
,
3107 "neighbor <A.B.C.D|X:X::X:X|WORD> local-as (1-4294967295)",
3110 "Specify a local-as number\n"
3111 "AS number used as local AS\n")
3118 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3122 ret
= peer_local_as_set (peer
, atoi (argv
[idx_number
]->arg
), 0, 0);
3123 return bgp_vty_return (vty
, ret
);
3126 DEFUN (neighbor_local_as_no_prepend
,
3127 neighbor_local_as_no_prepend_cmd
,
3128 "neighbor <A.B.C.D|X:X::X:X|WORD> local-as (1-4294967295) no-prepend",
3131 "Specify a local-as number\n"
3132 "AS number used as local AS\n"
3133 "Do not prepend local-as to updates from ebgp peers\n")
3140 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3144 ret
= peer_local_as_set (peer
, atoi (argv
[idx_number
]->arg
), 1, 0);
3145 return bgp_vty_return (vty
, ret
);
3148 DEFUN (neighbor_local_as_no_prepend_replace_as
,
3149 neighbor_local_as_no_prepend_replace_as_cmd
,
3150 "neighbor <A.B.C.D|X:X::X:X|WORD> local-as (1-4294967295) no-prepend replace-as",
3153 "Specify a local-as number\n"
3154 "AS number used as local AS\n"
3155 "Do not prepend local-as to updates from ebgp peers\n"
3156 "Do not prepend local-as to updates from ibgp peers\n")
3163 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3167 ret
= peer_local_as_set (peer
, atoi (argv
[idx_number
]->arg
), 1, 1);
3168 return bgp_vty_return (vty
, ret
);
3173 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
3174 * "no neighbor <A.B.C.D|X:X::X:X|WORD> local-as (1-4294967295)",
3177 * NEIGHBOR_ADDR_STR2
3178 * "Specify a local-as number\n"
3179 * "AS number used as local AS\n"
3181 * "no neighbor <A.B.C.D|X:X::X:X|WORD> local-as (1-4294967295) no-prepend",
3184 * NEIGHBOR_ADDR_STR2
3185 * "Specify a local-as number\n"
3186 * "AS number used as local AS\n"
3187 * "Do not prepend local-as to updates from ebgp peers\n"
3189 * "no neighbor <A.B.C.D|X:X::X:X|WORD> local-as (1-4294967295) no-prepend replace-as",
3192 * NEIGHBOR_ADDR_STR2
3193 * "Specify a local-as number\n"
3194 * "AS number used as local AS\n"
3195 * "Do not prepend local-as to updates from ebgp peers\n"
3196 * "Do not prepend local-as to updates from ibgp peers\n"
3199 DEFUN (no_neighbor_local_as
,
3200 no_neighbor_local_as_cmd
,
3201 "no neighbor <A.B.C.D|X:X::X:X|WORD> local-as",
3205 "Specify a local-as number\n")
3211 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3215 ret
= peer_local_as_unset (peer
);
3216 return bgp_vty_return (vty
, ret
);
3222 DEFUN (neighbor_solo
,
3224 "neighbor <A.B.C.D|X:X::X:X|WORD> solo",
3227 "Solo peer - part of its own update group\n")
3233 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3237 ret
= update_group_adjust_soloness(peer
, 1);
3238 return bgp_vty_return (vty
, ret
);
3241 DEFUN (no_neighbor_solo
,
3242 no_neighbor_solo_cmd
,
3243 "no neighbor <A.B.C.D|X:X::X:X|WORD> solo",
3247 "Solo peer - part of its own update group\n")
3253 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3257 ret
= update_group_adjust_soloness(peer
, 0);
3258 return bgp_vty_return (vty
, ret
);
3261 DEFUN (neighbor_password
,
3262 neighbor_password_cmd
,
3263 "neighbor <A.B.C.D|X:X::X:X|WORD> password LINE",
3274 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3278 ret
= peer_password_set (peer
, argv
[idx_line
]->arg
);
3279 return bgp_vty_return (vty
, ret
);
3283 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
3284 * "no neighbor <A.B.C.D|X:X::X:X|WORD> password LINE",
3287 * NEIGHBOR_ADDR_STR2
3288 * "Set a password\n"
3292 DEFUN (no_neighbor_password
,
3293 no_neighbor_password_cmd
,
3294 "no neighbor <A.B.C.D|X:X::X:X|WORD> password",
3304 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3308 ret
= peer_password_unset (peer
);
3309 return bgp_vty_return (vty
, ret
);
3313 DEFUN (neighbor_activate
,
3314 neighbor_activate_cmd
,
3315 "neighbor <A.B.C.D|X:X::X:X|WORD> activate",
3318 "Enable the Address Family for this Neighbor\n")
3324 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3328 ret
= peer_activate (peer
, bgp_node_afi (vty
), bgp_node_safi (vty
));
3335 DEFUN (no_neighbor_activate
,
3336 no_neighbor_activate_cmd
,
3337 "no neighbor <A.B.C.D|X:X::X:X|WORD> activate",
3341 "Enable the Address Family for this Neighbor\n")
3348 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3352 ret
= peer_deactivate (peer
, bgp_node_afi (vty
), bgp_node_safi (vty
));
3359 DEFUN (neighbor_set_peer_group
,
3360 neighbor_set_peer_group_cmd
,
3361 "neighbor <A.B.C.D|X:X::X:X|WORD> peer-group WORD",
3364 "Member of the peer-group\n"
3365 "peer-group name\n")
3374 struct peer_group
*group
;
3379 ret
= str2sockunion (argv
[idx_peer
]->arg
, &su
);
3382 peer
= peer_lookup_by_conf_if (bgp
, argv
[idx_peer
]->arg
);
3385 vty_out (vty
, "%% Malformed address or name: %s%s", argv
[idx_peer
]->arg
, VTY_NEWLINE
);
3391 if (peer_address_self_check (bgp
, &su
))
3393 vty_out (vty
, "%% Can not configure the local system as neighbor%s",
3398 /* Disallow for dynamic neighbor. */
3399 peer
= peer_lookup (bgp
, &su
);
3400 if (peer
&& peer_dynamic_neighbor (peer
))
3402 vty_out (vty
, "%% Operation not allowed on a dynamic neighbor%s",
3408 group
= peer_group_lookup (bgp
, argv
[idx_word
]->arg
);
3411 vty_out (vty
, "%% Configure the peer-group first%s", VTY_NEWLINE
);
3415 ret
= peer_group_bind (bgp
, &su
, peer
, group
, &as
);
3417 if (ret
== BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT
)
3419 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
);
3423 return bgp_vty_return (vty
, ret
);
3426 DEFUN (no_neighbor_set_peer_group
,
3427 no_neighbor_set_peer_group_cmd
,
3428 "no neighbor <A.B.C.D|X:X::X:X|WORD> peer-group WORD",
3432 "Member of the peer-group\n"
3433 "peer-group name\n")
3440 struct peer_group
*group
;
3444 peer
= peer_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3448 group
= peer_group_lookup (bgp
, argv
[idx_word
]->arg
);
3451 vty_out (vty
, "%% Configure the peer-group first%s", VTY_NEWLINE
);
3455 ret
= peer_group_unbind (bgp
, peer
, group
);
3457 return bgp_vty_return (vty
, ret
);
3461 peer_flag_modify_vty (struct vty
*vty
, const char *ip_str
,
3462 u_int16_t flag
, int set
)
3467 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
3472 * If 'neighbor <interface>', then this is for directly connected peers,
3473 * we should not accept disable-connected-check.
3475 if (peer
->conf_if
&& (flag
== PEER_FLAG_DISABLE_CONNECTED_CHECK
)) {
3476 vty_out (vty
, "%s is directly connected peer, cannot accept disable-"
3477 "connected-check%s", ip_str
, VTY_NEWLINE
);
3482 ret
= peer_flag_set (peer
, flag
);
3484 ret
= peer_flag_unset (peer
, flag
);
3486 return bgp_vty_return (vty
, ret
);
3490 peer_flag_set_vty (struct vty
*vty
, const char *ip_str
, u_int16_t flag
)
3492 return peer_flag_modify_vty (vty
, ip_str
, flag
, 1);
3496 peer_flag_unset_vty (struct vty
*vty
, const char *ip_str
, u_int16_t flag
)
3498 return peer_flag_modify_vty (vty
, ip_str
, flag
, 0);
3501 /* neighbor passive. */
3502 DEFUN (neighbor_passive
,
3503 neighbor_passive_cmd
,
3504 "neighbor <A.B.C.D|X:X::X:X|WORD> passive",
3507 "Don't send open messages to this neighbor\n")
3510 return peer_flag_set_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_PASSIVE
);
3513 DEFUN (no_neighbor_passive
,
3514 no_neighbor_passive_cmd
,
3515 "no neighbor <A.B.C.D|X:X::X:X|WORD> passive",
3519 "Don't send open messages to this neighbor\n")
3522 return peer_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_PASSIVE
);
3525 /* neighbor shutdown. */
3526 DEFUN (neighbor_shutdown
,
3527 neighbor_shutdown_cmd
,
3528 "neighbor <A.B.C.D|X:X::X:X|WORD> shutdown",
3531 "Administratively shut down this neighbor\n")
3534 return peer_flag_set_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_SHUTDOWN
);
3537 DEFUN (no_neighbor_shutdown
,
3538 no_neighbor_shutdown_cmd
,
3539 "no neighbor <A.B.C.D|X:X::X:X|WORD> shutdown",
3543 "Administratively shut down this neighbor\n")
3546 return peer_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_SHUTDOWN
);
3549 /* neighbor capability dynamic. */
3550 DEFUN (neighbor_capability_dynamic
,
3551 neighbor_capability_dynamic_cmd
,
3552 "neighbor <A.B.C.D|X:X::X:X|WORD> capability dynamic",
3555 "Advertise capability to the peer\n"
3556 "Advertise dynamic capability to this neighbor\n")
3559 return peer_flag_set_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_DYNAMIC_CAPABILITY
);
3562 DEFUN (no_neighbor_capability_dynamic
,
3563 no_neighbor_capability_dynamic_cmd
,
3564 "no neighbor <A.B.C.D|X:X::X:X|WORD> capability dynamic",
3568 "Advertise capability to the peer\n"
3569 "Advertise dynamic capability to this neighbor\n")
3572 return peer_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_DYNAMIC_CAPABILITY
);
3575 /* neighbor dont-capability-negotiate */
3576 DEFUN (neighbor_dont_capability_negotiate
,
3577 neighbor_dont_capability_negotiate_cmd
,
3578 "neighbor <A.B.C.D|X:X::X:X|WORD> dont-capability-negotiate",
3581 "Do not perform capability negotiation\n")
3584 return peer_flag_set_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_DONT_CAPABILITY
);
3587 DEFUN (no_neighbor_dont_capability_negotiate
,
3588 no_neighbor_dont_capability_negotiate_cmd
,
3589 "no neighbor <A.B.C.D|X:X::X:X|WORD> dont-capability-negotiate",
3593 "Do not perform capability negotiation\n")
3596 return peer_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_DONT_CAPABILITY
);
3599 /* neighbor capability extended next hop encoding */
3600 DEFUN (neighbor_capability_enhe
,
3601 neighbor_capability_enhe_cmd
,
3602 "neighbor <A.B.C.D|X:X::X:X|WORD> capability extended-nexthop",
3605 "Advertise capability to the peer\n"
3606 "Advertise extended next-hop capability to the peer\n")
3609 return peer_flag_set_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_CAPABILITY_ENHE
);
3612 DEFUN (no_neighbor_capability_enhe
,
3613 no_neighbor_capability_enhe_cmd
,
3614 "no neighbor <A.B.C.D|X:X::X:X|WORD> capability extended-nexthop",
3618 "Advertise capability to the peer\n"
3619 "Advertise extended next-hop capability to the peer\n")
3622 return peer_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_CAPABILITY_ENHE
);
3626 peer_af_flag_modify_vty (struct vty
*vty
, const char *peer_str
, afi_t afi
,
3627 safi_t safi
, u_int32_t flag
, int set
)
3632 peer
= peer_and_group_lookup_vty (vty
, peer_str
);
3637 ret
= peer_af_flag_set (peer
, afi
, safi
, flag
);
3639 ret
= peer_af_flag_unset (peer
, afi
, safi
, flag
);
3641 return bgp_vty_return (vty
, ret
);
3645 peer_af_flag_set_vty (struct vty
*vty
, const char *peer_str
, afi_t afi
,
3646 safi_t safi
, u_int32_t flag
)
3648 return peer_af_flag_modify_vty (vty
, peer_str
, afi
, safi
, flag
, 1);
3652 peer_af_flag_unset_vty (struct vty
*vty
, const char *peer_str
, afi_t afi
,
3653 safi_t safi
, u_int32_t flag
)
3655 return peer_af_flag_modify_vty (vty
, peer_str
, afi
, safi
, flag
, 0);
3658 /* neighbor capability orf prefix-list. */
3659 DEFUN (neighbor_capability_orf_prefix
,
3660 neighbor_capability_orf_prefix_cmd
,
3661 "neighbor <A.B.C.D|X:X::X:X|WORD> capability orf prefix-list <both|send|receive>",
3664 "Advertise capability to the peer\n"
3665 "Advertise ORF capability to the peer\n"
3666 "Advertise prefixlist ORF capability to this neighbor\n"
3667 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
3668 "Capability to RECEIVE the ORF from this neighbor\n"
3669 "Capability to SEND the ORF to this neighbor\n")
3672 int idx_send_recv
= 5;
3675 if (strncmp (argv
[idx_send_recv
]->arg
, "s", 1) == 0)
3676 flag
= PEER_FLAG_ORF_PREFIX_SM
;
3677 else if (strncmp (argv
[idx_send_recv
]->arg
, "r", 1) == 0)
3678 flag
= PEER_FLAG_ORF_PREFIX_RM
;
3679 else if (strncmp (argv
[idx_send_recv
]->arg
, "b", 1) == 0)
3680 flag
= PEER_FLAG_ORF_PREFIX_SM
|PEER_FLAG_ORF_PREFIX_RM
;
3684 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3685 bgp_node_safi (vty
), flag
);
3688 DEFUN (no_neighbor_capability_orf_prefix
,
3689 no_neighbor_capability_orf_prefix_cmd
,
3690 "no neighbor <A.B.C.D|X:X::X:X|WORD> capability orf prefix-list <both|send|receive>",
3694 "Advertise capability to the peer\n"
3695 "Advertise ORF capability to the peer\n"
3696 "Advertise prefixlist ORF capability to this neighbor\n"
3697 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
3698 "Capability to RECEIVE the ORF from this neighbor\n"
3699 "Capability to SEND the ORF to this neighbor\n")
3702 int idx_send_recv
= 6;
3705 if (strncmp (argv
[idx_send_recv
]->arg
, "s", 1) == 0)
3706 flag
= PEER_FLAG_ORF_PREFIX_SM
;
3707 else if (strncmp (argv
[idx_send_recv
]->arg
, "r", 1) == 0)
3708 flag
= PEER_FLAG_ORF_PREFIX_RM
;
3709 else if (strncmp (argv
[idx_send_recv
]->arg
, "b", 1) == 0)
3710 flag
= PEER_FLAG_ORF_PREFIX_SM
|PEER_FLAG_ORF_PREFIX_RM
;
3714 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3715 bgp_node_safi (vty
), flag
);
3718 /* neighbor next-hop-self. */
3719 DEFUN (neighbor_nexthop_self
,
3720 neighbor_nexthop_self_cmd
,
3721 "neighbor <A.B.C.D|X:X::X:X|WORD> next-hop-self",
3724 "Disable the next hop calculation for this neighbor\n")
3727 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3728 bgp_node_safi (vty
), PEER_FLAG_NEXTHOP_SELF
);
3731 /* neighbor next-hop-self. */
3732 DEFUN (neighbor_nexthop_self_force
,
3733 neighbor_nexthop_self_force_cmd
,
3734 "neighbor <A.B.C.D|X:X::X:X|WORD> next-hop-self force",
3737 "Disable the next hop calculation for this neighbor\n"
3738 "Set the next hop to self for reflected routes\n")
3741 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3742 bgp_node_safi (vty
),
3743 PEER_FLAG_FORCE_NEXTHOP_SELF
);
3746 DEFUN (no_neighbor_nexthop_self
,
3747 no_neighbor_nexthop_self_cmd
,
3748 "no neighbor <A.B.C.D|X:X::X:X|WORD> next-hop-self",
3752 "Disable the next hop calculation for this neighbor\n")
3755 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3756 bgp_node_safi (vty
),
3757 PEER_FLAG_NEXTHOP_SELF
);
3760 DEFUN (no_neighbor_nexthop_self_force
,
3761 no_neighbor_nexthop_self_force_cmd
,
3762 "no neighbor <A.B.C.D|X:X::X:X|WORD> next-hop-self force",
3766 "Disable the next hop calculation for this neighbor\n"
3767 "Set the next hop to self for reflected routes\n")
3770 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3771 bgp_node_safi (vty
),
3772 PEER_FLAG_FORCE_NEXTHOP_SELF
);
3775 /* neighbor as-override */
3776 DEFUN (neighbor_as_override
,
3777 neighbor_as_override_cmd
,
3778 "neighbor <A.B.C.D|X:X::X:X|WORD> as-override",
3781 "Override ASNs in outbound updates if aspath equals remote-as\n")
3784 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3785 bgp_node_safi (vty
),
3786 PEER_FLAG_AS_OVERRIDE
);
3789 DEFUN (no_neighbor_as_override
,
3790 no_neighbor_as_override_cmd
,
3791 "no neighbor <A.B.C.D|X:X::X:X|WORD> as-override",
3795 "Override ASNs in outbound updates if aspath equals remote-as\n")
3798 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3799 bgp_node_safi (vty
),
3800 PEER_FLAG_AS_OVERRIDE
);
3803 /* neighbor remove-private-AS. */
3804 DEFUN (neighbor_remove_private_as
,
3805 neighbor_remove_private_as_cmd
,
3806 "neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS",
3809 "Remove private ASNs in outbound updates\n")
3812 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3813 bgp_node_safi (vty
),
3814 PEER_FLAG_REMOVE_PRIVATE_AS
);
3817 DEFUN (neighbor_remove_private_as_all
,
3818 neighbor_remove_private_as_all_cmd
,
3819 "neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS all",
3822 "Remove private ASNs in outbound updates\n"
3823 "Apply to all AS numbers")
3826 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3827 bgp_node_safi (vty
),
3828 PEER_FLAG_REMOVE_PRIVATE_AS_ALL
);
3831 DEFUN (neighbor_remove_private_as_replace_as
,
3832 neighbor_remove_private_as_replace_as_cmd
,
3833 "neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS replace-AS",
3836 "Remove private ASNs in outbound updates\n"
3837 "Replace private ASNs with our ASN in outbound updates\n")
3840 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3841 bgp_node_safi (vty
),
3842 PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE
);
3845 DEFUN (neighbor_remove_private_as_all_replace_as
,
3846 neighbor_remove_private_as_all_replace_as_cmd
,
3847 "neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS all replace-AS",
3850 "Remove private ASNs in outbound updates\n"
3851 "Apply to all AS numbers"
3852 "Replace private ASNs with our ASN in outbound updates\n")
3855 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3856 bgp_node_safi (vty
),
3857 PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE
);
3860 DEFUN (no_neighbor_remove_private_as
,
3861 no_neighbor_remove_private_as_cmd
,
3862 "no neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS",
3866 "Remove private ASNs in outbound updates\n")
3869 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3870 bgp_node_safi (vty
),
3871 PEER_FLAG_REMOVE_PRIVATE_AS
);
3874 DEFUN (no_neighbor_remove_private_as_all
,
3875 no_neighbor_remove_private_as_all_cmd
,
3876 "no neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS all",
3880 "Remove private ASNs in outbound updates\n"
3881 "Apply to all AS numbers")
3884 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3885 bgp_node_safi (vty
),
3886 PEER_FLAG_REMOVE_PRIVATE_AS_ALL
);
3889 DEFUN (no_neighbor_remove_private_as_replace_as
,
3890 no_neighbor_remove_private_as_replace_as_cmd
,
3891 "no neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS replace-AS",
3895 "Remove private ASNs in outbound updates\n"
3896 "Replace private ASNs with our ASN in outbound updates\n")
3899 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3900 bgp_node_safi (vty
),
3901 PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE
);
3904 DEFUN (no_neighbor_remove_private_as_all_replace_as
,
3905 no_neighbor_remove_private_as_all_replace_as_cmd
,
3906 "no neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS all replace-AS",
3910 "Remove private ASNs in outbound updates\n"
3911 "Apply to all AS numbers"
3912 "Replace private ASNs with our ASN in outbound updates\n")
3915 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3916 bgp_node_safi (vty
),
3917 PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE
);
3921 /* neighbor send-community. */
3922 DEFUN (neighbor_send_community
,
3923 neighbor_send_community_cmd
,
3924 "neighbor <A.B.C.D|X:X::X:X|WORD> send-community",
3927 "Send Community attribute to this neighbor\n")
3930 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3931 bgp_node_safi (vty
),
3932 PEER_FLAG_SEND_COMMUNITY
);
3935 DEFUN (no_neighbor_send_community
,
3936 no_neighbor_send_community_cmd
,
3937 "no neighbor <A.B.C.D|X:X::X:X|WORD> send-community",
3941 "Send Community attribute to this neighbor\n")
3944 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3945 bgp_node_safi (vty
),
3946 PEER_FLAG_SEND_COMMUNITY
);
3949 /* neighbor send-community extended. */
3950 DEFUN (neighbor_send_community_type
,
3951 neighbor_send_community_type_cmd
,
3952 "neighbor <A.B.C.D|X:X::X:X|WORD> send-community <both|extended|standard>",
3955 "Send Community attribute to this neighbor\n"
3956 "Send Standard and Extended Community attributes\n"
3957 "Send Extended Community attributes\n"
3958 "Send Standard Community attributes\n")
3962 if (strncmp (argv
[idx_type
]->arg
, "s", 1) == 0)
3963 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3964 bgp_node_safi (vty
),
3965 PEER_FLAG_SEND_COMMUNITY
);
3966 if (strncmp (argv
[idx_type
]->arg
, "e", 1) == 0)
3967 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3968 bgp_node_safi (vty
),
3969 PEER_FLAG_SEND_EXT_COMMUNITY
);
3971 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3972 bgp_node_safi (vty
),
3973 (PEER_FLAG_SEND_COMMUNITY
|
3974 PEER_FLAG_SEND_EXT_COMMUNITY
));
3977 DEFUN (no_neighbor_send_community_type
,
3978 no_neighbor_send_community_type_cmd
,
3979 "no neighbor <A.B.C.D|X:X::X:X|WORD> send-community <both|extended|standard>",
3983 "Send Community attribute to this neighbor\n"
3984 "Send Standard and Extended Community attributes\n"
3985 "Send Extended Community attributes\n"
3986 "Send Standard Community attributes\n")
3990 if (strncmp (argv
[idx_type
]->arg
, "s", 1) == 0)
3991 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3992 bgp_node_safi (vty
),
3993 PEER_FLAG_SEND_COMMUNITY
);
3994 if (strncmp (argv
[idx_type
]->arg
, "e", 1) == 0)
3995 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3996 bgp_node_safi (vty
),
3997 PEER_FLAG_SEND_EXT_COMMUNITY
);
3999 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4000 bgp_node_safi (vty
),
4001 (PEER_FLAG_SEND_COMMUNITY
|
4002 PEER_FLAG_SEND_EXT_COMMUNITY
));
4005 /* neighbor soft-reconfig. */
4006 DEFUN (neighbor_soft_reconfiguration
,
4007 neighbor_soft_reconfiguration_cmd
,
4008 "neighbor <A.B.C.D|X:X::X:X|WORD> soft-reconfiguration inbound",
4011 "Per neighbor soft reconfiguration\n"
4012 "Allow inbound soft reconfiguration for this neighbor\n")
4015 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
,
4016 bgp_node_afi (vty
), bgp_node_safi (vty
),
4017 PEER_FLAG_SOFT_RECONFIG
);
4020 DEFUN (no_neighbor_soft_reconfiguration
,
4021 no_neighbor_soft_reconfiguration_cmd
,
4022 "no neighbor <A.B.C.D|X:X::X:X|WORD> soft-reconfiguration inbound",
4026 "Per neighbor soft reconfiguration\n"
4027 "Allow inbound soft reconfiguration for this neighbor\n")
4030 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
,
4031 bgp_node_afi (vty
), bgp_node_safi (vty
),
4032 PEER_FLAG_SOFT_RECONFIG
);
4035 DEFUN (neighbor_route_reflector_client
,
4036 neighbor_route_reflector_client_cmd
,
4037 "neighbor <A.B.C.D|X:X::X:X|WORD> route-reflector-client",
4040 "Configure a neighbor as Route Reflector client\n")
4046 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
4050 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4051 bgp_node_safi (vty
),
4052 PEER_FLAG_REFLECTOR_CLIENT
);
4055 DEFUN (no_neighbor_route_reflector_client
,
4056 no_neighbor_route_reflector_client_cmd
,
4057 "no neighbor <A.B.C.D|X:X::X:X|WORD> route-reflector-client",
4061 "Configure a neighbor as Route Reflector client\n")
4064 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4065 bgp_node_safi (vty
),
4066 PEER_FLAG_REFLECTOR_CLIENT
);
4069 /* neighbor route-server-client. */
4070 DEFUN (neighbor_route_server_client
,
4071 neighbor_route_server_client_cmd
,
4072 "neighbor <A.B.C.D|X:X::X:X|WORD> route-server-client",
4075 "Configure a neighbor as Route Server client\n")
4080 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
4083 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4084 bgp_node_safi (vty
),
4085 PEER_FLAG_RSERVER_CLIENT
);
4088 DEFUN (no_neighbor_route_server_client
,
4089 no_neighbor_route_server_client_cmd
,
4090 "no neighbor <A.B.C.D|X:X::X:X|WORD> route-server-client",
4094 "Configure a neighbor as Route Server client\n")
4097 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4098 bgp_node_safi (vty
),
4099 PEER_FLAG_RSERVER_CLIENT
);
4102 DEFUN (neighbor_nexthop_local_unchanged
,
4103 neighbor_nexthop_local_unchanged_cmd
,
4104 "neighbor <A.B.C.D|X:X::X:X|WORD> nexthop-local unchanged",
4107 "Configure treatment of outgoing link-local nexthop attribute\n"
4108 "Leave link-local nexthop unchanged for this peer\n")
4111 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4112 bgp_node_safi (vty
),
4113 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED
);
4116 DEFUN (no_neighbor_nexthop_local_unchanged
,
4117 no_neighbor_nexthop_local_unchanged_cmd
,
4118 "no neighbor <A.B.C.D|X:X::X:X|WORD> nexthop-local unchanged",
4122 "Configure treatment of outgoing link-local-nexthop attribute\n"
4123 "Leave link-local nexthop unchanged for this peer\n")
4126 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4127 bgp_node_safi (vty
),
4128 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED
);
4132 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
4133 * "neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged med next-hop as-path",
4135 * NEIGHBOR_ADDR_STR2
4136 * "BGP attribute is propagated unchanged to this neighbor\n"
4138 * "Nexthop attribute\n"
4139 * "As-path attribute\n"
4141 * "neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged med as-path next-hop",
4143 * NEIGHBOR_ADDR_STR2
4144 * "BGP attribute is propagated unchanged to this neighbor\n"
4146 * "As-path attribute\n"
4147 * "Nexthop attribute\n"
4149 * "neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged as-path next-hop med",
4151 * NEIGHBOR_ADDR_STR2
4152 * "BGP attribute is propagated unchanged to this neighbor\n"
4153 * "As-path attribute\n"
4154 * "Nexthop attribute\n"
4157 * "neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged next-hop as-path med",
4159 * NEIGHBOR_ADDR_STR2
4160 * "BGP attribute is propagated unchanged to this neighbor\n"
4161 * "Nexthop attribute\n"
4162 * "As-path attribute\n"
4165 * "neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged as-path med next-hop",
4167 * NEIGHBOR_ADDR_STR2
4168 * "BGP attribute is propagated unchanged to this neighbor\n"
4169 * "As-path attribute\n"
4171 * "Nexthop attribute\n"
4173 * "neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged next-hop med as-path",
4175 * NEIGHBOR_ADDR_STR2
4176 * "BGP attribute is propagated unchanged to this neighbor\n"
4177 * "Nexthop attribute\n"
4179 * "As-path attribute\n"
4182 DEFUN (neighbor_attr_unchanged
,
4183 neighbor_attr_unchanged_cmd
,
4184 "neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged",
4187 "BGP attribute is propagated unchanged to this neighbor\n")
4190 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4191 bgp_node_safi (vty
),
4192 (PEER_FLAG_AS_PATH_UNCHANGED
|
4193 PEER_FLAG_NEXTHOP_UNCHANGED
|
4194 PEER_FLAG_MED_UNCHANGED
));
4197 DEFUN (neighbor_attr_unchanged1
,
4198 neighbor_attr_unchanged1_cmd
,
4199 "neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged <as-path|next-hop|med>",
4202 "BGP attribute is propagated unchanged to this neighbor\n"
4203 "As-path attribute\n"
4204 "Nexthop attribute\n"
4208 int idx_attribute
= 3;
4209 u_int16_t flags
= 0;
4211 if (strncmp (argv
[idx_attribute
]->arg
, "as-path", 1) == 0)
4212 SET_FLAG (flags
, PEER_FLAG_AS_PATH_UNCHANGED
);
4213 else if (strncmp (argv
[idx_attribute
]->arg
, "next-hop", 1) == 0)
4214 SET_FLAG (flags
, PEER_FLAG_NEXTHOP_UNCHANGED
);
4215 else if (strncmp (argv
[idx_attribute
]->arg
, "med", 1) == 0)
4216 SET_FLAG (flags
, PEER_FLAG_MED_UNCHANGED
);
4218 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4219 bgp_node_safi (vty
), flags
);
4222 DEFUN (neighbor_attr_unchanged2
,
4223 neighbor_attr_unchanged2_cmd
,
4224 "neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged as-path <next-hop|med>",
4227 "BGP attribute is propagated unchanged to this neighbor\n"
4228 "As-path attribute\n"
4229 "Nexthop attribute\n"
4233 int idx_attribute
= 4;
4234 u_int16_t flags
= PEER_FLAG_AS_PATH_UNCHANGED
;
4236 if (strncmp (argv
[idx_attribute
]->arg
, "next-hop", 1) == 0)
4237 SET_FLAG (flags
, PEER_FLAG_NEXTHOP_UNCHANGED
);
4238 else if (strncmp (argv
[idx_attribute
]->arg
, "med", 1) == 0)
4239 SET_FLAG (flags
, PEER_FLAG_MED_UNCHANGED
);
4241 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4242 bgp_node_safi (vty
), flags
);
4246 DEFUN (neighbor_attr_unchanged3
,
4247 neighbor_attr_unchanged3_cmd
,
4248 "neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged next-hop <as-path|med>",
4251 "BGP attribute is propagated unchanged to this neighbor\n"
4252 "Nexthop attribute\n"
4253 "As-path attribute\n"
4257 int idx_attribute
= 4;
4258 u_int16_t flags
= PEER_FLAG_NEXTHOP_UNCHANGED
;
4260 if (strncmp (argv
[idx_attribute
]->arg
, "as-path", 1) == 0)
4261 SET_FLAG (flags
, PEER_FLAG_AS_PATH_UNCHANGED
);
4262 else if (strncmp (argv
[idx_attribute
]->arg
, "med", 1) == 0)
4263 SET_FLAG (flags
, PEER_FLAG_MED_UNCHANGED
);
4265 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4266 bgp_node_safi (vty
), flags
);
4269 DEFUN (neighbor_attr_unchanged4
,
4270 neighbor_attr_unchanged4_cmd
,
4271 "neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged med <as-path|next-hop>",
4274 "BGP attribute is propagated unchanged to this neighbor\n"
4276 "As-path attribute\n"
4277 "Nexthop attribute\n")
4280 int idx_attribute
= 4;
4281 u_int16_t flags
= PEER_FLAG_MED_UNCHANGED
;
4283 if (strncmp (argv
[idx_attribute
]->arg
, "as-path", 1) == 0)
4284 SET_FLAG (flags
, PEER_FLAG_AS_PATH_UNCHANGED
);
4285 else if (strncmp (argv
[idx_attribute
]->arg
, "next-hop", 1) == 0)
4286 SET_FLAG (flags
, PEER_FLAG_NEXTHOP_UNCHANGED
);
4288 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4289 bgp_node_safi (vty
), flags
);
4299 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
4300 * "no neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged next-hop med as-path",
4303 * NEIGHBOR_ADDR_STR2
4304 * "BGP attribute is propagated unchanged to this neighbor\n"
4305 * "Nexthop attribute\n"
4307 * "As-path attribute\n"
4309 * "no neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged as-path med next-hop",
4312 * NEIGHBOR_ADDR_STR2
4313 * "BGP attribute is propagated unchanged to this neighbor\n"
4314 * "As-path attribute\n"
4316 * "Nexthop attribute\n"
4318 * "no neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged med as-path next-hop",
4321 * NEIGHBOR_ADDR_STR2
4322 * "BGP attribute is propagated unchanged to this neighbor\n"
4324 * "As-path attribute\n"
4325 * "Nexthop attribute\n"
4327 * "no neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged next-hop as-path med",
4330 * NEIGHBOR_ADDR_STR2
4331 * "BGP attribute is propagated unchanged to this neighbor\n"
4332 * "Nexthop attribute\n"
4333 * "As-path attribute\n"
4336 * "no neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged as-path next-hop med",
4339 * NEIGHBOR_ADDR_STR2
4340 * "BGP attribute is propagated unchanged to this neighbor\n"
4341 * "As-path attribute\n"
4342 * "Nexthop attribute\n"
4345 * "no neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged med next-hop as-path",
4348 * NEIGHBOR_ADDR_STR2
4349 * "BGP attribute is propagated unchanged to this neighbor\n"
4351 * "Nexthop attribute\n"
4352 * "As-path attribute\n"
4355 DEFUN (no_neighbor_attr_unchanged
,
4356 no_neighbor_attr_unchanged_cmd
,
4357 "no neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged",
4361 "BGP attribute is propagated unchanged to this neighbor\n")
4364 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4365 bgp_node_safi (vty
),
4366 (PEER_FLAG_AS_PATH_UNCHANGED
|
4367 PEER_FLAG_NEXTHOP_UNCHANGED
|
4368 PEER_FLAG_MED_UNCHANGED
));
4371 DEFUN (no_neighbor_attr_unchanged1
,
4372 no_neighbor_attr_unchanged1_cmd
,
4373 "no neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged <as-path|next-hop|med>",
4377 "BGP attribute is propagated unchanged to this neighbor\n"
4378 "As-path attribute\n"
4379 "Nexthop attribute\n"
4383 int idx_attribute
= 4;
4384 u_int16_t flags
= 0;
4386 if (strncmp (argv
[idx_attribute
]->arg
, "as-path", 1) == 0)
4387 SET_FLAG (flags
, PEER_FLAG_AS_PATH_UNCHANGED
);
4388 else if (strncmp (argv
[idx_attribute
]->arg
, "next-hop", 1) == 0)
4389 SET_FLAG (flags
, PEER_FLAG_NEXTHOP_UNCHANGED
);
4390 else if (strncmp (argv
[idx_attribute
]->arg
, "med", 1) == 0)
4391 SET_FLAG (flags
, PEER_FLAG_MED_UNCHANGED
);
4393 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4394 bgp_node_safi (vty
), flags
);
4397 DEFUN (no_neighbor_attr_unchanged2
,
4398 no_neighbor_attr_unchanged2_cmd
,
4399 "no neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged as-path <next-hop|med>",
4403 "BGP attribute is propagated unchanged to this neighbor\n"
4404 "As-path attribute\n"
4405 "Nexthop attribute\n"
4409 int idx_attribute
= 5;
4410 u_int16_t flags
= PEER_FLAG_AS_PATH_UNCHANGED
;
4412 if (strncmp (argv
[idx_attribute
]->arg
, "next-hop", 1) == 0)
4413 SET_FLAG (flags
, PEER_FLAG_NEXTHOP_UNCHANGED
);
4414 else if (strncmp (argv
[idx_attribute
]->arg
, "med", 1) == 0)
4415 SET_FLAG (flags
, PEER_FLAG_MED_UNCHANGED
);
4417 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4418 bgp_node_safi (vty
), flags
);
4421 DEFUN (no_neighbor_attr_unchanged3
,
4422 no_neighbor_attr_unchanged3_cmd
,
4423 "no neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged next-hop <as-path|med>",
4427 "BGP attribute is propagated unchanged to this neighbor\n"
4428 "Nexthop attribute\n"
4429 "As-path attribute\n"
4433 int idx_attribute
= 5;
4434 u_int16_t flags
= PEER_FLAG_NEXTHOP_UNCHANGED
;
4436 if (strncmp (argv
[idx_attribute
]->arg
, "as-path", 1) == 0)
4437 SET_FLAG (flags
, PEER_FLAG_AS_PATH_UNCHANGED
);
4438 else if (strncmp (argv
[idx_attribute
]->arg
, "med", 1) == 0)
4439 SET_FLAG (flags
, PEER_FLAG_MED_UNCHANGED
);
4441 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4442 bgp_node_safi (vty
), flags
);
4445 DEFUN (no_neighbor_attr_unchanged4
,
4446 no_neighbor_attr_unchanged4_cmd
,
4447 "no neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged med <as-path|next-hop>",
4451 "BGP attribute is propagated unchanged to this neighbor\n"
4453 "As-path attribute\n"
4454 "Nexthop attribute\n")
4457 int idx_attribute
= 5;
4458 u_int16_t flags
= PEER_FLAG_MED_UNCHANGED
;
4460 if (strncmp (argv
[idx_attribute
]->arg
, "as-path", 1) == 0)
4461 SET_FLAG (flags
, PEER_FLAG_AS_PATH_UNCHANGED
);
4462 else if (strncmp (argv
[idx_attribute
]->arg
, "next-hop", 1) == 0)
4463 SET_FLAG (flags
, PEER_FLAG_NEXTHOP_UNCHANGED
);
4465 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4466 bgp_node_safi (vty
), flags
);
4475 /* EBGP multihop configuration. */
4477 peer_ebgp_multihop_set_vty (struct vty
*vty
, const char *ip_str
,
4478 const char *ttl_str
)
4483 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
4488 return bgp_vty_return (vty
, BGP_ERR_INVALID_FOR_DIRECT_PEER
);
4493 VTY_GET_INTEGER_RANGE ("TTL", ttl
, ttl_str
, 1, MAXTTL
);
4495 return bgp_vty_return (vty
, peer_ebgp_multihop_set (peer
, ttl
));
4499 peer_ebgp_multihop_unset_vty (struct vty
*vty
, const char *ip_str
)
4503 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
4507 return bgp_vty_return (vty
, peer_ebgp_multihop_unset (peer
));
4510 /* neighbor ebgp-multihop. */
4511 DEFUN (neighbor_ebgp_multihop
,
4512 neighbor_ebgp_multihop_cmd
,
4513 "neighbor <A.B.C.D|X:X::X:X|WORD> ebgp-multihop",
4516 "Allow EBGP neighbors not on directly connected networks\n")
4519 return peer_ebgp_multihop_set_vty (vty
, argv
[idx_peer
]->arg
, NULL
);
4522 DEFUN (neighbor_ebgp_multihop_ttl
,
4523 neighbor_ebgp_multihop_ttl_cmd
,
4524 "neighbor <A.B.C.D|X:X::X:X|WORD> ebgp-multihop (1-255)",
4527 "Allow EBGP neighbors not on directly connected networks\n"
4528 "maximum hop count\n")
4532 return peer_ebgp_multihop_set_vty (vty
, argv
[idx_peer
]->arg
, argv
[idx_number
]->arg
);
4536 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
4537 * "no neighbor <A.B.C.D|X:X::X:X|WORD> ebgp-multihop (1-255)",
4540 * NEIGHBOR_ADDR_STR2
4541 * "Allow EBGP neighbors not on directly connected networks\n"
4542 * "maximum hop count\n"
4545 DEFUN (no_neighbor_ebgp_multihop
,
4546 no_neighbor_ebgp_multihop_cmd
,
4547 "no neighbor <A.B.C.D|X:X::X:X|WORD> ebgp-multihop",
4551 "Allow EBGP neighbors not on directly connected networks\n")
4554 return peer_ebgp_multihop_unset_vty (vty
, argv
[idx_peer
]->arg
);
4558 /* disable-connected-check */
4560 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
4561 * "neighbor <A.B.C.D|X:X::X:X|WORD> enforce-multihop",
4563 * NEIGHBOR_ADDR_STR2
4564 * "Enforce EBGP neighbors perform multihop\n"
4567 DEFUN (neighbor_disable_connected_check
,
4568 neighbor_disable_connected_check_cmd
,
4569 "neighbor <A.B.C.D|X:X::X:X|WORD> disable-connected-check",
4572 "one-hop away EBGP peer using loopback address\n")
4575 return peer_flag_set_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_DISABLE_CONNECTED_CHECK
);
4579 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
4580 * "no neighbor <A.B.C.D|X:X::X:X|WORD> enforce-multihop",
4583 * NEIGHBOR_ADDR_STR2
4584 * "Enforce EBGP neighbors perform multihop\n"
4587 DEFUN (no_neighbor_disable_connected_check
,
4588 no_neighbor_disable_connected_check_cmd
,
4589 "no neighbor <A.B.C.D|X:X::X:X|WORD> disable-connected-check",
4593 "one-hop away EBGP peer using loopback address\n")
4596 return peer_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_DISABLE_CONNECTED_CHECK
);
4599 /* Enforce multihop. */
4601 /* Enforce multihop. */
4603 DEFUN (neighbor_description
,
4604 neighbor_description_cmd
,
4605 "neighbor <A.B.C.D|X:X::X:X|WORD> description .LINE",
4608 "Neighbor specific description\n"
4609 "Up to 80 characters describing this neighbor\n")
4615 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
4622 str
= argv_concat(argv
, argc
, 1);
4624 peer_description_set (peer
, str
);
4626 XFREE (MTYPE_TMP
, str
);
4632 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
4633 * "no neighbor <A.B.C.D|X:X::X:X|WORD> description .LINE",
4636 * NEIGHBOR_ADDR_STR2
4637 * "Neighbor specific description\n"
4638 * "Up to 80 characters describing this neighbor\n"
4641 DEFUN (no_neighbor_description
,
4642 no_neighbor_description_cmd
,
4643 "no neighbor <A.B.C.D|X:X::X:X|WORD> description",
4647 "Neighbor specific description\n")
4652 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
4656 peer_description_unset (peer
);
4662 /* Neighbor update-source. */
4664 peer_update_source_vty (struct vty
*vty
, const char *peer_str
,
4665 const char *source_str
)
4669 peer
= peer_and_group_lookup_vty (vty
, peer_str
);
4679 int ret
= str2sockunion (source_str
, &su
);
4682 peer_update_source_addr_set (peer
, &su
);
4684 peer_update_source_if_set (peer
, source_str
);
4687 peer_update_source_unset (peer
);
4692 #define BGP_UPDATE_SOURCE_HELP_STR \
4695 "Interface name (requires zebra to be running)\n"
4697 DEFUN (neighbor_update_source
,
4698 neighbor_update_source_cmd
,
4699 "neighbor <A.B.C.D|X:X::X:X|WORD> update-source <A.B.C.D|X:X::X:X|WORD>",
4702 "Source of routing updates\n"
4703 BGP_UPDATE_SOURCE_HELP_STR
)
4707 return peer_update_source_vty (vty
, argv
[idx_peer
]->arg
, argv
[idx_peer_2
]->arg
);
4710 DEFUN (no_neighbor_update_source
,
4711 no_neighbor_update_source_cmd
,
4712 "no neighbor <A.B.C.D|X:X::X:X|WORD> update-source [<A.B.C.D|X:X::X:X|WORD>]",
4716 "Source of routing updates\n"
4717 BGP_UPDATE_SOURCE_HELP_STR
)
4720 return peer_update_source_vty (vty
, argv
[idx_peer
]->arg
, NULL
);
4724 peer_default_originate_set_vty (struct vty
*vty
, const char *peer_str
,
4725 afi_t afi
, safi_t safi
,
4726 const char *rmap
, int set
)
4731 peer
= peer_and_group_lookup_vty (vty
, peer_str
);
4736 ret
= peer_default_originate_set (peer
, afi
, safi
, rmap
);
4738 ret
= peer_default_originate_unset (peer
, afi
, safi
);
4740 return bgp_vty_return (vty
, ret
);
4743 /* neighbor default-originate. */
4744 DEFUN (neighbor_default_originate
,
4745 neighbor_default_originate_cmd
,
4746 "neighbor <A.B.C.D|X:X::X:X|WORD> default-originate",
4749 "Originate default route to this neighbor\n")
4752 return peer_default_originate_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4753 bgp_node_safi (vty
), NULL
, 1);
4756 DEFUN (neighbor_default_originate_rmap
,
4757 neighbor_default_originate_rmap_cmd
,
4758 "neighbor <A.B.C.D|X:X::X:X|WORD> default-originate route-map WORD",
4761 "Originate default route to this neighbor\n"
4762 "Route-map to specify criteria to originate default\n"
4767 return peer_default_originate_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4768 bgp_node_safi (vty
), argv
[idx_word
]->arg
, 1);
4772 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
4773 * "no neighbor <A.B.C.D|X:X::X:X|WORD> default-originate route-map WORD",
4776 * NEIGHBOR_ADDR_STR2
4777 * "Originate default route to this neighbor\n"
4778 * "Route-map to specify criteria to originate default\n"
4779 * "route-map name\n"
4782 DEFUN (no_neighbor_default_originate
,
4783 no_neighbor_default_originate_cmd
,
4784 "no neighbor <A.B.C.D|X:X::X:X|WORD> default-originate",
4788 "Originate default route to this neighbor\n")
4791 return peer_default_originate_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4792 bgp_node_safi (vty
), NULL
, 0);
4796 /* Set neighbor's BGP port. */
4798 peer_port_vty (struct vty
*vty
, const char *ip_str
, int afi
,
4799 const char *port_str
)
4805 peer
= peer_lookup_vty (vty
, ip_str
);
4811 sp
= getservbyname ("bgp", "tcp");
4812 port
= (sp
== NULL
) ? BGP_PORT_DEFAULT
: ntohs (sp
->s_port
);
4816 VTY_GET_INTEGER("port", port
, port_str
);
4819 peer_port_set (peer
, port
);
4824 /* Set specified peer's BGP port. */
4825 DEFUN (neighbor_port
,
4827 "neighbor <A.B.C.D|X:X::X:X> port (0-65535)",
4830 "Neighbor's BGP port\n"
4831 "TCP port number\n")
4835 return peer_port_vty (vty
, argv
[idx_ip
]->arg
, AFI_IP
, argv
[idx_number
]->arg
);
4838 DEFUN (no_neighbor_port
,
4839 no_neighbor_port_cmd
,
4840 "no neighbor <A.B.C.D|X:X::X:X> port [(0-65535)]",
4844 "Neighbor's BGP port\n"
4845 "TCP port number\n")
4848 return peer_port_vty (vty
, argv
[idx_ip
]->arg
, AFI_IP
, NULL
);
4852 /* neighbor weight. */
4854 peer_weight_set_vty (struct vty
*vty
, const char *ip_str
,
4855 const char *weight_str
)
4859 unsigned long weight
;
4861 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
4865 VTY_GET_INTEGER_RANGE("weight", weight
, weight_str
, 0, 65535);
4867 ret
= peer_weight_set (peer
, weight
);
4868 return bgp_vty_return (vty
, ret
);
4872 peer_weight_unset_vty (struct vty
*vty
, const char *ip_str
)
4877 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
4881 ret
= peer_weight_unset (peer
);
4882 return bgp_vty_return (vty
, ret
);
4885 DEFUN (neighbor_weight
,
4886 neighbor_weight_cmd
,
4887 "neighbor <A.B.C.D|X:X::X:X|WORD> weight (0-65535)",
4890 "Set default weight for routes from this neighbor\n"
4895 return peer_weight_set_vty (vty
, argv
[idx_peer
]->arg
, argv
[idx_number
]->arg
);
4898 DEFUN (no_neighbor_weight
,
4899 no_neighbor_weight_cmd
,
4900 "no neighbor <A.B.C.D|X:X::X:X|WORD> weight [(0-65535)]",
4904 "Set default weight for routes from this neighbor\n"
4908 return peer_weight_unset_vty (vty
, argv
[idx_peer
]->arg
);
4912 /* Override capability negotiation. */
4913 DEFUN (neighbor_override_capability
,
4914 neighbor_override_capability_cmd
,
4915 "neighbor <A.B.C.D|X:X::X:X|WORD> override-capability",
4918 "Override capability negotiation result\n")
4921 return peer_flag_set_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_OVERRIDE_CAPABILITY
);
4924 DEFUN (no_neighbor_override_capability
,
4925 no_neighbor_override_capability_cmd
,
4926 "no neighbor <A.B.C.D|X:X::X:X|WORD> override-capability",
4930 "Override capability negotiation result\n")
4933 return peer_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_OVERRIDE_CAPABILITY
);
4936 DEFUN (neighbor_strict_capability
,
4937 neighbor_strict_capability_cmd
,
4938 "neighbor <A.B.C.D|X:X::X:X> strict-capability-match",
4941 "Strict capability negotiation match\n")
4944 return peer_flag_set_vty (vty
, argv
[idx_ip
]->arg
, PEER_FLAG_STRICT_CAP_MATCH
);
4947 DEFUN (no_neighbor_strict_capability
,
4948 no_neighbor_strict_capability_cmd
,
4949 "no neighbor <A.B.C.D|X:X::X:X> strict-capability-match",
4953 "Strict capability negotiation match\n")
4956 return peer_flag_unset_vty (vty
, argv
[idx_ip
]->arg
, PEER_FLAG_STRICT_CAP_MATCH
);
4960 peer_timers_set_vty (struct vty
*vty
, const char *ip_str
,
4961 const char *keep_str
, const char *hold_str
)
4965 u_int32_t keepalive
;
4968 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
4972 VTY_GET_INTEGER_RANGE ("Keepalive", keepalive
, keep_str
, 0, 65535);
4973 VTY_GET_INTEGER_RANGE ("Holdtime", holdtime
, hold_str
, 0, 65535);
4975 ret
= peer_timers_set (peer
, keepalive
, holdtime
);
4977 return bgp_vty_return (vty
, ret
);
4981 peer_timers_unset_vty (struct vty
*vty
, const char *ip_str
)
4986 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
4990 ret
= peer_timers_unset (peer
);
4992 return bgp_vty_return (vty
, ret
);
4995 DEFUN (neighbor_timers
,
4996 neighbor_timers_cmd
,
4997 "neighbor <A.B.C.D|X:X::X:X|WORD> timers (0-65535) (0-65535)",
5000 "BGP per neighbor timers\n"
5001 "Keepalive interval\n"
5006 int idx_number_2
= 4;
5007 return peer_timers_set_vty (vty
, argv
[idx_peer
]->arg
, argv
[idx_number
]->arg
, argv
[idx_number_2
]->arg
);
5010 DEFUN (no_neighbor_timers
,
5011 no_neighbor_timers_cmd
,
5012 "no neighbor <A.B.C.D|X:X::X:X|WORD> timers [(0-65535) (0-65535)]",
5016 "BGP per neighbor timers\n"
5017 "Keepalive interval\n"
5021 return peer_timers_unset_vty (vty
, argv
[idx_peer
]->arg
);
5026 peer_timers_connect_set_vty (struct vty
*vty
, const char *ip_str
,
5027 const char *time_str
)
5033 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5037 VTY_GET_INTEGER_RANGE ("Connect time", connect
, time_str
, 0, 65535);
5039 ret
= peer_timers_connect_set (peer
, connect
);
5041 return bgp_vty_return (vty
, ret
);
5045 peer_timers_connect_unset_vty (struct vty
*vty
, const char *ip_str
)
5050 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5054 ret
= peer_timers_connect_unset (peer
);
5056 return bgp_vty_return (vty
, ret
);
5059 DEFUN (neighbor_timers_connect
,
5060 neighbor_timers_connect_cmd
,
5061 "neighbor <A.B.C.D|X:X::X:X|WORD> timers connect (1-65535)",
5064 "BGP per neighbor timers\n"
5065 "BGP connect timer\n"
5070 return peer_timers_connect_set_vty (vty
, argv
[idx_peer
]->arg
, argv
[idx_number
]->arg
);
5073 DEFUN (no_neighbor_timers_connect
,
5074 no_neighbor_timers_connect_cmd
,
5075 "no neighbor <A.B.C.D|X:X::X:X|WORD> timers connect [(1-65535)]",
5079 "BGP per neighbor timers\n"
5080 "BGP connect timer\n"
5084 return peer_timers_connect_unset_vty (vty
, argv
[idx_peer
]->arg
);
5089 peer_advertise_interval_vty (struct vty
*vty
, const char *ip_str
,
5090 const char *time_str
, int set
)
5094 u_int32_t routeadv
= 0;
5096 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5101 VTY_GET_INTEGER_RANGE ("advertise interval", routeadv
, time_str
, 0, 600);
5104 ret
= peer_advertise_interval_set (peer
, routeadv
);
5106 ret
= peer_advertise_interval_unset (peer
);
5108 return bgp_vty_return (vty
, ret
);
5111 DEFUN (neighbor_advertise_interval
,
5112 neighbor_advertise_interval_cmd
,
5113 "neighbor <A.B.C.D|X:X::X:X|WORD> advertisement-interval (0-600)",
5116 "Minimum interval between sending BGP routing updates\n"
5117 "time in seconds\n")
5121 return peer_advertise_interval_vty (vty
, argv
[idx_peer
]->arg
, argv
[idx_number
]->arg
, 1);
5124 DEFUN (no_neighbor_advertise_interval
,
5125 no_neighbor_advertise_interval_cmd
,
5126 "no neighbor <A.B.C.D|X:X::X:X|WORD> advertisement-interval [(0-600)]",
5130 "Minimum interval between sending BGP routing updates\n"
5131 "time in seconds\n")
5134 return peer_advertise_interval_vty (vty
, argv
[idx_peer
]->arg
, NULL
, 0);
5138 /* Time to wait before processing route-map updates */
5139 DEFUN (bgp_set_route_map_delay_timer
,
5140 bgp_set_route_map_delay_timer_cmd
,
5141 "bgp route-map delay-timer (0-600)",
5143 "BGP route-map delay timer\n"
5144 "Time in secs to wait before processing route-map changes\n"
5145 "0 disables the timer, no route updates happen when route-maps change\n")
5148 u_int32_t rmap_delay_timer
;
5150 if (argv
[idx_number
]->arg
)
5152 VTY_GET_INTEGER_RANGE ("delay-timer", rmap_delay_timer
, argv
[idx_number
]->arg
, 0, 600);
5153 bm
->rmap_update_timer
= rmap_delay_timer
;
5155 /* if the dynamic update handling is being disabled, and a timer is
5156 * running, stop the timer and act as if the timer has already fired.
5158 if (!rmap_delay_timer
&& bm
->t_rmap_update
)
5160 BGP_TIMER_OFF(bm
->t_rmap_update
);
5161 thread_execute (bm
->master
, bgp_route_map_update_timer
, NULL
, 0);
5169 DEFUN (no_bgp_set_route_map_delay_timer
,
5170 no_bgp_set_route_map_delay_timer_cmd
,
5171 "no bgp route-map delay-timer [(0-600)]",
5173 "Default BGP route-map delay timer\n"
5174 "Reset to default time to wait for processing route-map changes\n"
5175 "0 disables the timer, no route updates happen when route-maps change\n")
5178 bm
->rmap_update_timer
= RMAP_DEFAULT_UPDATE_TIMER
;
5184 /* neighbor interface */
5186 peer_interface_vty (struct vty
*vty
, const char *ip_str
, const char *str
)
5190 peer
= peer_lookup_vty (vty
, ip_str
);
5191 if (! peer
|| peer
->conf_if
)
5195 peer_interface_set (peer
, str
);
5197 peer_interface_unset (peer
);
5202 DEFUN (neighbor_interface
,
5203 neighbor_interface_cmd
,
5204 "neighbor <A.B.C.D|X:X::X:X> interface WORD",
5213 return peer_interface_vty (vty
, argv
[idx_ip
]->arg
, argv
[idx_word
]->arg
);
5215 return peer_interface_vty (vty
, argv
[idx_ip
]->arg
, argv
[idx_word
]->arg
);
5218 DEFUN (no_neighbor_interface
,
5219 no_neighbor_interface_cmd
,
5220 "no neighbor <A.B.C.D|X:X::X:X|WORD> interface WORD",
5228 return peer_interface_vty (vty
, argv
[idx_peer
]->arg
, NULL
);
5231 /* Set distribute list to the peer. */
5233 peer_distribute_set_vty (struct vty
*vty
, const char *ip_str
,
5234 afi_t afi
, safi_t safi
,
5235 const char *name_str
, const char *direct_str
)
5239 int direct
= FILTER_IN
;
5241 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5245 /* Check filter direction. */
5246 if (strncmp (direct_str
, "i", 1) == 0)
5248 else if (strncmp (direct_str
, "o", 1) == 0)
5249 direct
= FILTER_OUT
;
5251 ret
= peer_distribute_set (peer
, afi
, safi
, direct
, name_str
);
5253 return bgp_vty_return (vty
, ret
);
5257 peer_distribute_unset_vty (struct vty
*vty
, const char *ip_str
, afi_t afi
,
5258 safi_t safi
, const char *direct_str
)
5262 int direct
= FILTER_IN
;
5264 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5268 /* Check filter direction. */
5269 if (strncmp (direct_str
, "i", 1) == 0)
5271 else if (strncmp (direct_str
, "o", 1) == 0)
5272 direct
= FILTER_OUT
;
5274 ret
= peer_distribute_unset (peer
, afi
, safi
, direct
);
5276 return bgp_vty_return (vty
, ret
);
5279 DEFUN (neighbor_distribute_list
,
5280 neighbor_distribute_list_cmd
,
5281 "neighbor <A.B.C.D|X:X::X:X|WORD> distribute-list <(1-199)|(1300-2699)|WORD> <in|out>",
5284 "Filter updates to/from this neighbor\n"
5285 "IP access-list number\n"
5286 "IP access-list number (expanded range)\n"
5287 "IP Access-list name\n"
5288 "Filter incoming updates\n"
5289 "Filter outgoing updates\n")
5294 return peer_distribute_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5295 bgp_node_safi (vty
), argv
[idx_acl
]->arg
, argv
[idx_in_out
]->arg
);
5298 DEFUN (no_neighbor_distribute_list
,
5299 no_neighbor_distribute_list_cmd
,
5300 "no neighbor <A.B.C.D|X:X::X:X|WORD> distribute-list <(1-199)|(1300-2699)|WORD> <in|out>",
5304 "Filter updates to/from this neighbor\n"
5305 "IP access-list number\n"
5306 "IP access-list number (expanded range)\n"
5307 "IP Access-list name\n"
5308 "Filter incoming updates\n"
5309 "Filter outgoing updates\n")
5313 return peer_distribute_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5314 bgp_node_safi (vty
), argv
[idx_in_out
]->arg
);
5317 /* Set prefix list to the peer. */
5319 peer_prefix_list_set_vty (struct vty
*vty
, const char *ip_str
, afi_t afi
,
5320 safi_t safi
, const char *name_str
,
5321 const char *direct_str
)
5325 int direct
= FILTER_IN
;
5327 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5331 /* Check filter direction. */
5332 if (strncmp (direct_str
, "i", 1) == 0)
5334 else if (strncmp (direct_str
, "o", 1) == 0)
5335 direct
= FILTER_OUT
;
5337 ret
= peer_prefix_list_set (peer
, afi
, safi
, direct
, name_str
);
5339 return bgp_vty_return (vty
, ret
);
5343 peer_prefix_list_unset_vty (struct vty
*vty
, const char *ip_str
, afi_t afi
,
5344 safi_t safi
, const char *direct_str
)
5348 int direct
= FILTER_IN
;
5350 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5354 /* Check filter direction. */
5355 if (strncmp (direct_str
, "i", 1) == 0)
5357 else if (strncmp (direct_str
, "o", 1) == 0)
5358 direct
= FILTER_OUT
;
5360 ret
= peer_prefix_list_unset (peer
, afi
, safi
, direct
);
5362 return bgp_vty_return (vty
, ret
);
5365 DEFUN (neighbor_prefix_list
,
5366 neighbor_prefix_list_cmd
,
5367 "neighbor <A.B.C.D|X:X::X:X|WORD> prefix-list WORD <in|out>",
5370 "Filter updates to/from this neighbor\n"
5371 "Name of a prefix list\n"
5372 "Filter incoming updates\n"
5373 "Filter outgoing updates\n")
5378 return peer_prefix_list_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5379 bgp_node_safi (vty
), argv
[idx_word
]->arg
, argv
[idx_in_out
]->arg
);
5382 DEFUN (no_neighbor_prefix_list
,
5383 no_neighbor_prefix_list_cmd
,
5384 "no neighbor <A.B.C.D|X:X::X:X|WORD> prefix-list WORD <in|out>",
5388 "Filter updates to/from this neighbor\n"
5389 "Name of a prefix list\n"
5390 "Filter incoming updates\n"
5391 "Filter outgoing updates\n")
5395 return peer_prefix_list_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5396 bgp_node_safi (vty
), argv
[idx_in_out
]->arg
);
5400 peer_aslist_set_vty (struct vty
*vty
, const char *ip_str
,
5401 afi_t afi
, safi_t safi
,
5402 const char *name_str
, const char *direct_str
)
5406 int direct
= FILTER_IN
;
5408 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5412 /* Check filter direction. */
5413 if (strncmp (direct_str
, "i", 1) == 0)
5415 else if (strncmp (direct_str
, "o", 1) == 0)
5416 direct
= FILTER_OUT
;
5418 ret
= peer_aslist_set (peer
, afi
, safi
, direct
, name_str
);
5420 return bgp_vty_return (vty
, ret
);
5424 peer_aslist_unset_vty (struct vty
*vty
, const char *ip_str
,
5425 afi_t afi
, safi_t safi
,
5426 const char *direct_str
)
5430 int direct
= FILTER_IN
;
5432 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5436 /* Check filter direction. */
5437 if (strncmp (direct_str
, "i", 1) == 0)
5439 else if (strncmp (direct_str
, "o", 1) == 0)
5440 direct
= FILTER_OUT
;
5442 ret
= peer_aslist_unset (peer
, afi
, safi
, direct
);
5444 return bgp_vty_return (vty
, ret
);
5447 DEFUN (neighbor_filter_list
,
5448 neighbor_filter_list_cmd
,
5449 "neighbor <A.B.C.D|X:X::X:X|WORD> filter-list WORD <in|out>",
5452 "Establish BGP filters\n"
5453 "AS path access-list name\n"
5454 "Filter incoming routes\n"
5455 "Filter outgoing routes\n")
5460 return peer_aslist_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5461 bgp_node_safi (vty
), argv
[idx_word
]->arg
, argv
[idx_in_out
]->arg
);
5464 DEFUN (no_neighbor_filter_list
,
5465 no_neighbor_filter_list_cmd
,
5466 "no neighbor <A.B.C.D|X:X::X:X|WORD> filter-list WORD <in|out>",
5470 "Establish BGP filters\n"
5471 "AS path access-list name\n"
5472 "Filter incoming routes\n"
5473 "Filter outgoing routes\n")
5477 return peer_aslist_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5478 bgp_node_safi (vty
), argv
[idx_in_out
]->arg
);
5481 /* Set route-map to the peer. */
5483 peer_route_map_set_vty (struct vty
*vty
, const char *ip_str
,
5484 afi_t afi
, safi_t safi
,
5485 const char *name_str
, const char *direct_str
)
5489 int direct
= RMAP_IN
;
5491 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5495 /* Check filter direction. */
5496 if (strncmp (direct_str
, "in", 2) == 0)
5498 else if (strncmp (direct_str
, "o", 1) == 0)
5501 ret
= peer_route_map_set (peer
, afi
, safi
, direct
, name_str
);
5503 return bgp_vty_return (vty
, ret
);
5507 peer_route_map_unset_vty (struct vty
*vty
, const char *ip_str
, afi_t afi
,
5508 safi_t safi
, const char *direct_str
)
5512 int direct
= RMAP_IN
;
5514 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5518 /* Check filter direction. */
5519 if (strncmp (direct_str
, "in", 2) == 0)
5521 else if (strncmp (direct_str
, "o", 1) == 0)
5524 ret
= peer_route_map_unset (peer
, afi
, safi
, direct
);
5526 return bgp_vty_return (vty
, ret
);
5529 DEFUN (neighbor_route_map
,
5530 neighbor_route_map_cmd
,
5531 "neighbor <A.B.C.D|X:X::X:X|WORD> route-map WORD <in|out>",
5534 "Apply route map to neighbor\n"
5535 "Name of route map\n"
5536 "Apply map to incoming routes\n"
5537 "Apply map to outbound routes\n")
5542 return peer_route_map_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5543 bgp_node_safi (vty
), argv
[idx_word
]->arg
, argv
[idx_in_out
]->arg
);
5546 DEFUN (no_neighbor_route_map
,
5547 no_neighbor_route_map_cmd
,
5548 "no neighbor <A.B.C.D|X:X::X:X|WORD> route-map WORD <in|out>",
5552 "Apply route map to neighbor\n"
5553 "Name of route map\n"
5554 "Apply map to incoming routes\n"
5555 "Apply map to outbound routes\n")
5559 return peer_route_map_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5560 bgp_node_safi (vty
), argv
[idx_in_out
]->arg
);
5563 /* Set unsuppress-map to the peer. */
5565 peer_unsuppress_map_set_vty (struct vty
*vty
, const char *ip_str
, afi_t afi
,
5566 safi_t safi
, const char *name_str
)
5571 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5575 ret
= peer_unsuppress_map_set (peer
, afi
, safi
, name_str
);
5577 return bgp_vty_return (vty
, ret
);
5580 /* Unset route-map from the peer. */
5582 peer_unsuppress_map_unset_vty (struct vty
*vty
, const char *ip_str
, afi_t afi
,
5588 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5592 ret
= peer_unsuppress_map_unset (peer
, afi
, safi
);
5594 return bgp_vty_return (vty
, ret
);
5597 DEFUN (neighbor_unsuppress_map
,
5598 neighbor_unsuppress_map_cmd
,
5599 "neighbor <A.B.C.D|X:X::X:X|WORD> unsuppress-map WORD",
5602 "Route-map to selectively unsuppress suppressed routes\n"
5603 "Name of route map\n")
5607 return peer_unsuppress_map_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5608 bgp_node_safi (vty
), argv
[idx_word
]->arg
);
5611 DEFUN (no_neighbor_unsuppress_map
,
5612 no_neighbor_unsuppress_map_cmd
,
5613 "no neighbor <A.B.C.D|X:X::X:X|WORD> unsuppress-map WORD",
5617 "Route-map to selectively unsuppress suppressed routes\n"
5618 "Name of route map\n")
5621 return peer_unsuppress_map_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5622 bgp_node_safi (vty
));
5626 peer_maximum_prefix_set_vty (struct vty
*vty
, const char *ip_str
, afi_t afi
,
5627 safi_t safi
, const char *num_str
,
5628 const char *threshold_str
, int warning
,
5629 const char *restart_str
)
5637 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5641 VTY_GET_INTEGER ("maximum number", max
, num_str
);
5643 threshold
= atoi (threshold_str
);
5645 threshold
= MAXIMUM_PREFIX_THRESHOLD_DEFAULT
;
5648 restart
= atoi (restart_str
);
5652 ret
= peer_maximum_prefix_set (peer
, afi
, safi
, max
, threshold
, warning
, restart
);
5654 return bgp_vty_return (vty
, ret
);
5658 peer_maximum_prefix_unset_vty (struct vty
*vty
, const char *ip_str
, afi_t afi
,
5664 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5668 ret
= peer_maximum_prefix_unset (peer
, afi
, safi
);
5670 return bgp_vty_return (vty
, ret
);
5673 /* Maximum number of prefix configuration. prefix count is different
5674 for each peer configuration. So this configuration can be set for
5675 each peer configuration. */
5676 DEFUN (neighbor_maximum_prefix
,
5677 neighbor_maximum_prefix_cmd
,
5678 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295)",
5681 "Maximum number of prefix accept from this peer\n"
5682 "maximum no. of prefix limit\n")
5686 return peer_maximum_prefix_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5687 bgp_node_safi (vty
), argv
[idx_number
]->arg
, NULL
, 0,
5691 DEFUN (neighbor_maximum_prefix_threshold
,
5692 neighbor_maximum_prefix_threshold_cmd
,
5693 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) (1-100)",
5696 "Maximum number of prefix accept from this peer\n"
5697 "maximum no. of prefix limit\n"
5698 "Threshold value (%) at which to generate a warning msg\n")
5702 int idx_number_2
= 4;
5703 return peer_maximum_prefix_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5704 bgp_node_safi (vty
), argv
[idx_number
]->arg
, argv
[idx_number_2
]->arg
, 0,
5708 DEFUN (neighbor_maximum_prefix_warning
,
5709 neighbor_maximum_prefix_warning_cmd
,
5710 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) warning-only",
5713 "Maximum number of prefix accept from this peer\n"
5714 "maximum no. of prefix limit\n"
5715 "Only give warning message when limit is exceeded\n")
5719 return peer_maximum_prefix_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5720 bgp_node_safi (vty
), argv
[idx_number
]->arg
, NULL
, 1,
5724 DEFUN (neighbor_maximum_prefix_threshold_warning
,
5725 neighbor_maximum_prefix_threshold_warning_cmd
,
5726 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) (1-100) warning-only",
5729 "Maximum number of prefix accept from this peer\n"
5730 "maximum no. of prefix limit\n"
5731 "Threshold value (%) at which to generate a warning msg\n"
5732 "Only give warning message when limit is exceeded\n")
5736 int idx_number_2
= 4;
5737 return peer_maximum_prefix_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5738 bgp_node_safi (vty
), argv
[idx_number
]->arg
, argv
[idx_number_2
]->arg
, 1, NULL
);
5741 DEFUN (neighbor_maximum_prefix_restart
,
5742 neighbor_maximum_prefix_restart_cmd
,
5743 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) restart (1-65535)",
5746 "Maximum number of prefix accept from this peer\n"
5747 "maximum no. of prefix limit\n"
5748 "Restart bgp connection after limit is exceeded\n"
5749 "Restart interval in minutes")
5753 int idx_number_2
= 5;
5754 return peer_maximum_prefix_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5755 bgp_node_safi (vty
), argv
[idx_number
]->arg
, NULL
, 0, argv
[idx_number_2
]->arg
);
5758 DEFUN (neighbor_maximum_prefix_threshold_restart
,
5759 neighbor_maximum_prefix_threshold_restart_cmd
,
5760 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) (1-100) restart (1-65535)",
5763 "Maximum number of prefix accept from this peer\n"
5764 "maximum no. of prefix limit\n"
5765 "Threshold value (%) at which to generate a warning msg\n"
5766 "Restart bgp connection after limit is exceeded\n"
5767 "Restart interval in minutes")
5771 int idx_number_2
= 4;
5772 int idx_number_3
= 6;
5773 return peer_maximum_prefix_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5774 bgp_node_safi (vty
), argv
[idx_number
]->arg
, argv
[idx_number_2
]->arg
, 0, argv
[idx_number_3
]->arg
);
5778 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
5779 * "no neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix <1-4294967295>",
5782 * NEIGHBOR_ADDR_STR2
5783 * "Maximum number of prefix accept from this peer\n"
5784 * "maximum no. of prefix limit\n"
5786 * "no neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix <1-4294967295> <1-100> restart <1-65535>",
5789 * NEIGHBOR_ADDR_STR2
5790 * "Maximum number of prefix accept from this peer\n"
5791 * "maximum no. of prefix limit\n"
5792 * "Threshold value (%) at which to generate a warning msg\n"
5793 * "Restart bgp connection after limit is exceeded\n"
5794 * "Restart interval in minutes"
5796 * "no neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix <1-4294967295> warning-only",
5799 * NEIGHBOR_ADDR_STR2
5800 * "Maximum number of prefix accept from this peer\n"
5801 * "maximum no. of prefix limit\n"
5802 * "Only give warning message when limit is exceeded\n"
5804 * "no neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix <1-4294967295> restart <1-65535>",
5807 * NEIGHBOR_ADDR_STR2
5808 * "Maximum number of prefix accept from this peer\n"
5809 * "maximum no. of prefix limit\n"
5810 * "Restart bgp connection after limit is exceeded\n"
5811 * "Restart interval in minutes"
5813 * "no neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix <1-4294967295> <1-100> warning-only",
5816 * NEIGHBOR_ADDR_STR2
5817 * "Maximum number of prefix accept from this peer\n"
5818 * "maximum no. of prefix limit\n"
5819 * "Threshold value (%) at which to generate a warning msg\n"
5820 * "Only give warning message when limit is exceeded\n"
5822 * "no neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix <1-4294967295> <1-100>",
5825 * NEIGHBOR_ADDR_STR2
5826 * "Maximum number of prefix accept from this peer\n"
5827 * "maximum no. of prefix limit\n"
5828 * "Threshold value (%) at which to generate a warning msg\n"
5831 DEFUN (no_neighbor_maximum_prefix
,
5832 no_neighbor_maximum_prefix_cmd
,
5833 "no neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix",
5837 "Maximum number of prefix accept from this peer\n")
5840 return peer_maximum_prefix_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5841 bgp_node_safi (vty
));
5850 /* "neighbor allowas-in" */
5852 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
5853 * "neighbor <A.B.C.D|X:X::X:X|WORD> allowas-in <1-10>",
5855 * NEIGHBOR_ADDR_STR2
5856 * "Accept as-path with my AS present in it\n"
5857 * "Number of occurances of AS number\n"
5860 DEFUN (neighbor_allowas_in
,
5861 neighbor_allowas_in_cmd
,
5862 "neighbor <A.B.C.D|X:X::X:X|WORD> allowas-in",
5865 "Accept as-path with my AS present in it\n")
5870 unsigned int allow_num
;
5872 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
5879 VTY_GET_INTEGER_RANGE ("AS number", allow_num
, argv
[3]->arg
, 1, 10);
5881 ret
= peer_allowas_in_set (peer
, bgp_node_afi (vty
), bgp_node_safi (vty
),
5884 return bgp_vty_return (vty
, ret
);
5887 DEFUN (no_neighbor_allowas_in
,
5888 no_neighbor_allowas_in_cmd
,
5889 "no neighbor <A.B.C.D|X:X::X:X|WORD> allowas-in [(1-10)]",
5893 "allow local ASN appears in aspath attribute\n"
5894 "Number of occurances of AS number\n")
5900 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
5904 ret
= peer_allowas_in_unset (peer
, bgp_node_afi (vty
), bgp_node_safi (vty
));
5906 return bgp_vty_return (vty
, ret
);
5910 DEFUN (neighbor_ttl_security
,
5911 neighbor_ttl_security_cmd
,
5912 "neighbor <A.B.C.D|X:X::X:X|WORD> ttl-security hops (1-254)",
5915 "Specify the maximum number of hops to the BGP peer\n")
5922 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
5926 VTY_GET_INTEGER_RANGE ("", gtsm_hops
, argv
[idx_number
]->arg
, 1, 254);
5929 * If 'neighbor swpX', then this is for directly connected peers,
5930 * we should not accept a ttl-security hops value greater than 1.
5932 if (peer
->conf_if
&& (gtsm_hops
> 1)) {
5933 vty_out (vty
, "%s is directly connected peer, hops cannot exceed 1%s",
5934 argv
[idx_peer
]->arg
, VTY_NEWLINE
);
5938 return bgp_vty_return (vty
, peer_ttl_security_hops_set (peer
, gtsm_hops
));
5941 DEFUN (no_neighbor_ttl_security
,
5942 no_neighbor_ttl_security_cmd
,
5943 "no neighbor <A.B.C.D|X:X::X:X|WORD> ttl-security hops (1-254)",
5947 "Specify the maximum number of hops to the BGP peer\n")
5952 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
5956 return bgp_vty_return (vty
, peer_ttl_security_hops_unset (peer
));
5959 DEFUN (neighbor_addpath_tx_all_paths
,
5960 neighbor_addpath_tx_all_paths_cmd
,
5961 "neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-all-paths",
5964 "Use addpath to advertise all paths to a neighbor\n")
5969 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
5973 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5974 bgp_node_safi (vty
),
5975 PEER_FLAG_ADDPATH_TX_ALL_PATHS
);
5978 DEFUN (no_neighbor_addpath_tx_all_paths
,
5979 no_neighbor_addpath_tx_all_paths_cmd
,
5980 "no neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-all-paths",
5984 "Use addpath to advertise all paths to a neighbor\n")
5987 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5988 bgp_node_safi (vty
),
5989 PEER_FLAG_ADDPATH_TX_ALL_PATHS
);
5992 DEFUN (neighbor_addpath_tx_bestpath_per_as
,
5993 neighbor_addpath_tx_bestpath_per_as_cmd
,
5994 "neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-bestpath-per-AS",
5997 "Use addpath to advertise the bestpath per each neighboring AS\n")
6002 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
6006 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
6007 bgp_node_safi (vty
),
6008 PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS
);
6011 DEFUN (no_neighbor_addpath_tx_bestpath_per_as
,
6012 no_neighbor_addpath_tx_bestpath_per_as_cmd
,
6013 "no neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-bestpath-per-AS",
6017 "Use addpath to advertise the bestpath per each neighboring AS\n")
6020 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
6021 bgp_node_safi (vty
),
6022 PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS
);
6026 /* Address family configuration. */
6027 DEFUN (address_family_ipv4
,
6028 address_family_ipv4_cmd
,
6029 "address-family ipv4",
6030 "Enter Address Family command mode\n"
6033 vty
->node
= BGP_IPV4_NODE
;
6037 DEFUN (address_family_ipv4_safi
,
6038 address_family_ipv4_safi_cmd
,
6039 "address-family ipv4 <unicast|multicast>",
6040 "Enter Address Family command mode\n"
6042 "Address Family modifier\n"
6043 "Address Family modifier\n")
6046 if (strncmp (argv
[idx_safi
]->arg
, "m", 1) == 0)
6047 vty
->node
= BGP_IPV4M_NODE
;
6049 vty
->node
= BGP_IPV4_NODE
;
6054 DEFUN (address_family_ipv6
,
6055 address_family_ipv6_cmd
,
6056 "address-family ipv6",
6057 "Enter Address Family command mode\n"
6060 vty
->node
= BGP_IPV6_NODE
;
6064 DEFUN (address_family_ipv6_safi
,
6065 address_family_ipv6_safi_cmd
,
6066 "address-family ipv6 <unicast|multicast>",
6067 "Enter Address Family command mode\n"
6069 "Address Family modifier\n"
6070 "Address Family modifier\n")
6073 if (strncmp (argv
[idx_safi
]->arg
, "m", 1) == 0)
6074 vty
->node
= BGP_IPV6M_NODE
;
6076 vty
->node
= BGP_IPV6_NODE
;
6081 DEFUN (address_family_vpnv4
,
6082 address_family_vpnv4_cmd
,
6083 "address-family vpnv4 [unicast]",
6084 "Enter Address Family command mode\n"
6086 "Address Family Modifier\n")
6088 vty
->node
= BGP_VPNV4_NODE
;
6092 DEFUN (address_family_vpnv6
,
6093 address_family_vpnv6_cmd
,
6094 "address-family vpnv6 [unicast]",
6095 "Enter Address Family command mode\n"
6097 "Address Family Modifier\n")
6099 vty
->node
= BGP_VPNV6_NODE
;
6103 DEFUN (address_family_encap
,
6104 address_family_encap_cmd
,
6105 "address-family <encap|encapv4>",
6106 "Enter Address Family command mode\n"
6110 vty
->node
= BGP_ENCAP_NODE
;
6115 DEFUN (address_family_encapv6
,
6116 address_family_encapv6_cmd
,
6117 "address-family encapv6",
6118 "Enter Address Family command mode\n"
6121 vty
->node
= BGP_ENCAPV6_NODE
;
6125 DEFUN (exit_address_family
,
6126 exit_address_family_cmd
,
6127 "exit-address-family",
6128 "Exit from Address Family configuration mode\n")
6130 if (vty
->node
== BGP_IPV4_NODE
6131 || vty
->node
== BGP_IPV4M_NODE
6132 || vty
->node
== BGP_VPNV4_NODE
6133 || vty
->node
== BGP_IPV6_NODE
6134 || vty
->node
== BGP_IPV6M_NODE
6135 || vty
->node
== BGP_VPNV6_NODE
6136 || vty
->node
== BGP_ENCAP_NODE
6137 || vty
->node
== BGP_ENCAPV6_NODE
)
6138 vty
->node
= BGP_NODE
;
6142 /* Recalculate bestpath and re-advertise a prefix */
6144 bgp_clear_prefix (struct vty
*vty
, const char *view_name
, const char *ip_str
,
6145 afi_t afi
, safi_t safi
, struct prefix_rd
*prd
)
6148 struct prefix match
;
6149 struct bgp_node
*rn
;
6150 struct bgp_node
*rm
;
6152 struct bgp_table
*table
;
6153 struct bgp_table
*rib
;
6155 /* BGP structure lookup. */
6158 bgp
= bgp_lookup_by_name (view_name
);
6161 vty_out (vty
, "%% Can't find BGP instance %s%s", view_name
, VTY_NEWLINE
);
6167 bgp
= bgp_get_default ();
6170 vty_out (vty
, "%% No BGP process is configured%s", VTY_NEWLINE
);
6175 /* Check IP address argument. */
6176 ret
= str2prefix (ip_str
, &match
);
6179 vty_out (vty
, "%% address is malformed%s", VTY_NEWLINE
);
6183 match
.family
= afi2family (afi
);
6184 rib
= bgp
->rib
[afi
][safi
];
6186 if (safi
== SAFI_MPLS_VPN
)
6188 for (rn
= bgp_table_top (rib
); rn
; rn
= bgp_route_next (rn
))
6190 if (prd
&& memcmp (rn
->p
.u
.val
, prd
->val
, 8) != 0)
6193 if ((table
= rn
->info
) != NULL
)
6195 if ((rm
= bgp_node_match (table
, &match
)) != NULL
)
6197 if (rm
->p
.prefixlen
== match
.prefixlen
)
6199 SET_FLAG (rn
->flags
, BGP_NODE_USER_CLEAR
);
6200 bgp_process (bgp
, rm
, afi
, safi
);
6202 bgp_unlock_node (rm
);
6209 if ((rn
= bgp_node_match (rib
, &match
)) != NULL
)
6211 if (rn
->p
.prefixlen
== match
.prefixlen
)
6213 SET_FLAG (rn
->flags
, BGP_NODE_USER_CLEAR
);
6214 bgp_process (bgp
, rn
, afi
, safi
);
6216 bgp_unlock_node (rn
);
6224 bgp_get_argv_afi_safi (struct cmd_token
**argv
, int idx_afi
, int idx_safi
,
6225 afi_t
*afi
, safi_t
*safi
)
6227 if (strmatch(argv
[idx_afi
]->text
, "ipv4"))
6231 if (strmatch(argv
[idx_safi
]->text
, "unicast"))
6232 *safi
= SAFI_UNICAST
;
6233 else if (strmatch(argv
[idx_safi
]->text
, "multicast"))
6234 *safi
= SAFI_MULTICAST
;
6236 else if (strmatch(argv
[idx_afi
]->text
, "ipv6"))
6240 if (strmatch(argv
[idx_safi
]->text
, "unicast"))
6241 *safi
= SAFI_UNICAST
;
6242 else if (strmatch(argv
[idx_safi
]->text
, "multicast"))
6243 *safi
= SAFI_MULTICAST
;
6245 else if (strmatch(argv
[idx_afi
]->text
, "encap"))
6250 else if (strmatch(argv
[idx_afi
]->text
, "vpnv4"))
6253 *safi
= SAFI_MPLS_VPN
;
6257 /* one clear bgp command to rule them all */
6258 DEFUN (clear_ip_bgp_all
,
6259 clear_ip_bgp_all_cmd
,
6260 "clear [ip] bgp [<view|vrf> WORD] <*|A.B.C.D|X:X::X:X|WORD|(1-4294967295)|external|peer-group WORD> [<ipv4 unicast|ipv4 multicast|ipv6 unicast|vpnv4 unicast|encap unicast>] [<soft [<in|out>]|in [prefix-filter]|out>]",
6264 BGP_INSTANCE_HELP_STR
6266 "BGP neighbor address to clear\n"
6267 "BGP IPv6 neighbor to clear\n"
6268 "BGP neighbor on interface to clear\n"
6269 "Clear peers with the AS number\n"
6270 "Clear all external peers\n"
6271 "Clear all members of peer-group\n"
6272 "BGP peer-group name\n"
6274 "Address Family modifier\n"
6276 "Address Family modifier\n"
6278 "Address Family modifier\n"
6280 "Address Family modifier\n"
6282 "Address Family modifier\n"
6289 "Push out prefix-list ORF and do inbound soft reconfig\n"
6294 int idx_view_vrf
= 3;
6296 int idx_clr_sort
= 5;
6297 int idx_soft_in_out
= argc
- 1;
6303 enum clear_sort clr_sort
= clear_peer
;
6304 enum bgp_clear_type clr_type
;
6305 char *clr_arg
= NULL
;
6308 * If the user does "clear ip bgp" then we default the afi safi to ipv4 unicast.
6309 * If the user does "clear bgp" then we default the afi safi to ipv6 unicast.
6310 * This may be over-written later in the command if they explicitly
6311 * specify an afi safi.
6313 if (strmatch(argv
[idx_ip
]->text
, "ip"))
6316 safi
= SAFI_UNICAST
;
6321 safi
= SAFI_UNICAST
;
6327 if (strmatch(argv
[idx_view_vrf
]->text
, "view") || strmatch(argv
[idx_view_vrf
]->text
, "vrf"))
6328 vrf
= argv
[idx_vrf
]->arg
;
6332 /* <*|A.B.C.D|X:X::X:X|WORD|(1-4294967295)|external> */
6333 if (strmatch(argv
[idx_clr_sort
]->text
, "*"))
6335 clr_sort
= clear_all
;
6337 else if (argv
[idx_clr_sort
]->type
== IPV4_TKN
)
6339 clr_sort
= clear_peer
;
6340 clr_arg
= argv
[idx_clr_sort
]->arg
;
6342 else if (argv
[idx_clr_sort
]->type
== IPV6_TKN
)
6344 clr_sort
= clear_peer
;
6345 clr_arg
= argv
[idx_clr_sort
]->arg
;
6347 else if (argv
[idx_clr_sort
]->type
== RANGE_TKN
)
6349 clr_sort
= clear_as
;
6350 clr_arg
= argv
[idx_clr_sort
]->arg
;
6352 else if (strmatch(argv
[idx_clr_sort
]->text
, "external"))
6354 clr_sort
= clear_external
;
6356 else if (strmatch(argv
[idx_clr_sort
]->text
, "peer-group"))
6358 clr_sort
= clear_group
;
6359 clr_arg
= argv
[idx_clr_sort
+ 1]->arg
;
6361 if (! peer_group_lookup (vty
->index
, clr_arg
))
6363 vty_out (vty
, "%% No such peer-group%s", VTY_NEWLINE
);
6367 else if (argv
[idx_clr_sort
]->type
== WORD_TKN
)
6369 if (peer_lookup_by_conf_if (vty
->index
, argv
[idx_clr_sort
]->arg
))
6371 clr_sort
= clear_peer
;
6372 clr_arg
= argv
[idx_clr_sort
]->arg
;
6376 vty_out (vty
, "%% No such neighbor%s", VTY_NEWLINE
);
6381 /* soft, soft in, or soft out */
6382 if (strmatch(argv
[idx_soft_in_out
]->text
, "in"))
6384 clr_type
= BGP_CLEAR_SOFT_IN
;
6386 if (strmatch(argv
[idx_soft_in_out
-1]->text
, "soft"))
6388 idx_afi
= idx_soft_in_out
- 3;
6389 idx_safi
= idx_soft_in_out
- 2;
6393 idx_afi
= idx_soft_in_out
- 2;
6394 idx_safi
= idx_soft_in_out
- 1;
6397 else if (strmatch(argv
[idx_soft_in_out
]->text
, "out"))
6399 clr_type
= BGP_CLEAR_SOFT_OUT
;
6401 if (strmatch(argv
[idx_soft_in_out
-1]->text
, "soft"))
6403 idx_afi
= idx_soft_in_out
- 3;
6404 idx_safi
= idx_soft_in_out
- 2;
6408 idx_afi
= idx_soft_in_out
- 2;
6409 idx_safi
= idx_soft_in_out
- 1;
6412 else if (strmatch(argv
[idx_soft_in_out
]->text
, "soft"))
6414 clr_type
= BGP_CLEAR_SOFT_BOTH
;
6415 idx_afi
= idx_soft_in_out
- 2;
6416 idx_safi
= idx_soft_in_out
- 1;
6418 else if (strmatch(argv
[idx_soft_in_out
]->text
, "prefix-filter"))
6420 clr_type
= BGP_CLEAR_SOFT_IN_ORF_PREFIX
;
6421 idx_afi
= idx_soft_in_out
- 3;
6422 idx_safi
= idx_soft_in_out
- 2;
6426 clr_type
= BGP_CLEAR_SOFT_NONE
;
6427 idx_afi
= idx_soft_in_out
- 1;
6428 idx_safi
= idx_soft_in_out
;
6432 bgp_get_argv_afi_safi (argv
, idx_afi
, idx_safi
, &afi
, &safi
);
6434 return bgp_clear_vty (vty
, vrf
, afi
, safi
, clr_sort
, clr_type
, clr_arg
);
6437 DEFUN (clear_ip_bgp_prefix
,
6438 clear_ip_bgp_prefix_cmd
,
6439 "clear [ip] bgp [<view|vrf> WORD] prefix A.B.C.D/M",
6443 BGP_INSTANCE_HELP_STR
6444 "Clear bestpath and re-advertise\n"
6445 "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n")
6448 int idx_view_vrf
= 3;
6450 int idx_ipv4_prefixlen
= 6;
6453 if (!strmatch(argv
[idx_ip
]->text
, "ip"))
6457 idx_ipv4_prefixlen
--;
6460 if (strmatch(argv
[idx_view_vrf
]->text
, "view") || strmatch(argv
[idx_view_vrf
]->text
, "vrf"))
6461 vrf
= argv
[idx_vrf
]->arg
;
6463 idx_ipv4_prefixlen
-= 2;
6465 return bgp_clear_prefix (vty
, vrf
, argv
[idx_ipv4_prefixlen
]->arg
, AFI_IP
, SAFI_UNICAST
, NULL
);
6468 DEFUN (clear_bgp_ipv6_safi_prefix
,
6469 clear_bgp_ipv6_safi_prefix_cmd
,
6470 "clear bgp ipv6 <unicast|multicast> prefix X:X::X:X/M",
6474 "Address Family Modifier\n"
6475 "Clear bestpath and re-advertise\n"
6476 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
6479 int idx_ipv6_prefixlen
= 5;
6480 if (strncmp (argv
[idx_safi
]->arg
, "m", 1) == 0)
6481 return bgp_clear_prefix (vty
, NULL
, argv
[idx_ipv6_prefixlen
]->arg
, AFI_IP6
, SAFI_MULTICAST
, NULL
);
6483 return bgp_clear_prefix (vty
, NULL
, argv
[idx_ipv6_prefixlen
]->arg
, AFI_IP6
, SAFI_UNICAST
, NULL
);
6486 DEFUN (clear_bgp_instance_ipv6_safi_prefix
,
6487 clear_bgp_instance_ipv6_safi_prefix_cmd
,
6488 "clear bgp <view|vrf> WORD ipv6 <unicast|multicast> prefix X:X::X:X/M",
6491 BGP_INSTANCE_HELP_STR
6493 "Address Family Modifier\n"
6494 "Clear bestpath and re-advertise\n"
6495 "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n")
6499 int idx_ipv6_prefixlen
= 7;
6500 if (strncmp (argv
[idx_safi
]->arg
, "m", 1) == 0)
6501 return bgp_clear_prefix (vty
, argv
[idx_word
]->arg
, argv
[idx_ipv6_prefixlen
]->arg
, AFI_IP6
, SAFI_MULTICAST
, NULL
);
6503 return bgp_clear_prefix (vty
, argv
[idx_word
]->arg
, argv
[idx_ipv6_prefixlen
]->arg
, AFI_IP6
, SAFI_UNICAST
, NULL
);
6506 DEFUN (show_bgp_views
,
6511 "Show the defined BGP views\n")
6513 struct list
*inst
= bm
->bgp
;
6514 struct listnode
*node
;
6517 if (!bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE
))
6519 vty_out (vty
, "BGP Multiple Instance is not enabled%s", VTY_NEWLINE
);
6523 vty_out (vty
, "Defined BGP views:%s", VTY_NEWLINE
);
6524 for (ALL_LIST_ELEMENTS_RO(inst
, node
, bgp
))
6527 if (bgp
->inst_type
== BGP_INSTANCE_TYPE_VRF
)
6529 vty_out (vty
, "\t%s (AS%u)%s",
6530 bgp
->name
? bgp
->name
: "(null)",
6531 bgp
->as
, VTY_NEWLINE
);
6537 DEFUN (show_bgp_vrfs
,
6539 "show bgp vrfs [json]",
6543 "JavaScript Object Notation\n")
6545 struct list
*inst
= bm
->bgp
;
6546 struct listnode
*node
;
6548 u_char uj
= use_json(argc
, argv
);
6549 json_object
*json
= NULL
;
6550 json_object
*json_vrfs
= NULL
;
6552 static char header
[] = "Type Id RouterId #PeersCfg #PeersEstb Name";
6554 if (!bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE
))
6556 vty_out (vty
, "BGP Multiple Instance is not enabled%s", VTY_NEWLINE
);
6562 json
= json_object_new_object();
6563 json_vrfs
= json_object_new_object();
6566 for (ALL_LIST_ELEMENTS_RO(inst
, node
, bgp
))
6568 const char *name
, *type
;
6570 struct listnode
*node
, *nnode
;
6571 int peers_cfg
, peers_estb
;
6572 json_object
*json_vrf
= NULL
;
6576 if (bgp
->inst_type
== BGP_INSTANCE_TYPE_VIEW
)
6580 if (!uj
&& count
== 1)
6581 vty_out (vty
, "%s%s", header
, VTY_NEWLINE
);
6583 peers_cfg
= peers_estb
= 0;
6585 json_vrf
= json_object_new_object();
6588 for (ALL_LIST_ELEMENTS (bgp
->peer
, node
, nnode
, peer
))
6590 if (!CHECK_FLAG(peer
->flags
, PEER_FLAG_CONFIG_NODE
))
6593 if (peer
->status
== Established
)
6597 if (bgp
->inst_type
== BGP_INSTANCE_TYPE_DEFAULT
)
6608 vrf_id_ui
= (bgp
->vrf_id
== VRF_UNKNOWN
) ? -1 : bgp
->vrf_id
;
6611 json_object_string_add(json_vrf
, "type", type
);
6612 json_object_int_add(json_vrf
, "vrfId", vrf_id_ui
);
6613 json_object_string_add(json_vrf
, "routerId", inet_ntoa (bgp
->router_id
));
6614 json_object_int_add(json_vrf
, "numConfiguredPeers", peers_cfg
);
6615 json_object_int_add(json_vrf
, "numEstablishedPeers", peers_estb
);
6617 json_object_object_add(json_vrfs
, name
, json_vrf
);
6620 vty_out (vty
, "%4s %-5d %-16s %9u %10u %s%s",
6621 type
, vrf_id_ui
, inet_ntoa (bgp
->router_id
),
6622 peers_cfg
, peers_estb
, name
,
6628 json_object_object_add(json
, "vrfs", json_vrfs
);
6630 json_object_int_add(json
, "totalVrfs", count
);
6632 vty_out (vty
, "%s%s", json_object_to_json_string(json
), VTY_NEWLINE
);
6633 json_object_free(json
);
6638 vty_out (vty
, "%sTotal number of VRFs (including default): %d%s",
6639 VTY_NEWLINE
, count
, VTY_NEWLINE
);
6645 DEFUN (show_bgp_memory
,
6646 show_bgp_memory_cmd
,
6650 "Global BGP memory statistics\n")
6652 char memstrbuf
[MTYPE_MEMSTR_LEN
];
6653 unsigned long count
;
6655 /* RIB related usage stats */
6656 count
= mtype_stats_alloc (MTYPE_BGP_NODE
);
6657 vty_out (vty
, "%ld RIB nodes, using %s of memory%s", count
,
6658 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6659 count
* sizeof (struct bgp_node
)),
6662 count
= mtype_stats_alloc (MTYPE_BGP_ROUTE
);
6663 vty_out (vty
, "%ld BGP routes, using %s of memory%s", count
,
6664 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6665 count
* sizeof (struct bgp_info
)),
6667 if ((count
= mtype_stats_alloc (MTYPE_BGP_ROUTE_EXTRA
)))
6668 vty_out (vty
, "%ld BGP route ancillaries, using %s of memory%s", count
,
6669 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6670 count
* sizeof (struct bgp_info_extra
)),
6673 if ((count
= mtype_stats_alloc (MTYPE_BGP_STATIC
)))
6674 vty_out (vty
, "%ld Static routes, using %s of memory%s", count
,
6675 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6676 count
* sizeof (struct bgp_static
)),
6679 if ((count
= mtype_stats_alloc (MTYPE_BGP_PACKET
)))
6680 vty_out (vty
, "%ld Packets, using %s of memory%s", count
,
6681 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6682 count
* sizeof (struct bpacket
)),
6686 if ((count
= mtype_stats_alloc (MTYPE_BGP_ADJ_IN
)))
6687 vty_out (vty
, "%ld Adj-In entries, using %s of memory%s", count
,
6688 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6689 count
* sizeof (struct bgp_adj_in
)),
6691 if ((count
= mtype_stats_alloc (MTYPE_BGP_ADJ_OUT
)))
6692 vty_out (vty
, "%ld Adj-Out entries, using %s of memory%s", count
,
6693 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6694 count
* sizeof (struct bgp_adj_out
)),
6697 if ((count
= mtype_stats_alloc (MTYPE_BGP_NEXTHOP_CACHE
)))
6698 vty_out (vty
, "%ld Nexthop cache entries, using %s of memory%s", count
,
6699 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6700 count
* sizeof (struct bgp_nexthop_cache
)),
6703 if ((count
= mtype_stats_alloc (MTYPE_BGP_DAMP_INFO
)))
6704 vty_out (vty
, "%ld Dampening entries, using %s of memory%s", count
,
6705 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6706 count
* sizeof (struct bgp_damp_info
)),
6710 count
= attr_count();
6711 vty_out (vty
, "%ld BGP attributes, using %s of memory%s", count
,
6712 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6713 count
* sizeof(struct attr
)),
6715 if ((count
= mtype_stats_alloc (MTYPE_ATTR_EXTRA
)))
6716 vty_out (vty
, "%ld BGP extra attributes, using %s of memory%s", count
,
6717 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6718 count
* sizeof(struct attr_extra
)),
6721 if ((count
= attr_unknown_count()))
6722 vty_out (vty
, "%ld unknown attributes%s", count
, VTY_NEWLINE
);
6724 /* AS_PATH attributes */
6725 count
= aspath_count ();
6726 vty_out (vty
, "%ld BGP AS-PATH entries, using %s of memory%s", count
,
6727 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6728 count
* sizeof (struct aspath
)),
6731 count
= mtype_stats_alloc (MTYPE_AS_SEG
);
6732 vty_out (vty
, "%ld BGP AS-PATH segments, using %s of memory%s", count
,
6733 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6734 count
* sizeof (struct assegment
)),
6737 /* Other attributes */
6738 if ((count
= community_count ()))
6739 vty_out (vty
, "%ld BGP community entries, using %s of memory%s", count
,
6740 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6741 count
* sizeof (struct community
)),
6743 if ((count
= mtype_stats_alloc (MTYPE_ECOMMUNITY
)))
6744 vty_out (vty
, "%ld BGP community entries, using %s of memory%s", count
,
6745 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6746 count
* sizeof (struct ecommunity
)),
6749 if ((count
= mtype_stats_alloc (MTYPE_CLUSTER
)))
6750 vty_out (vty
, "%ld Cluster lists, using %s of memory%s", count
,
6751 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6752 count
* sizeof (struct cluster_list
)),
6755 /* Peer related usage */
6756 count
= mtype_stats_alloc (MTYPE_BGP_PEER
);
6757 vty_out (vty
, "%ld peers, using %s of memory%s", count
,
6758 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6759 count
* sizeof (struct peer
)),
6762 if ((count
= mtype_stats_alloc (MTYPE_PEER_GROUP
)))
6763 vty_out (vty
, "%ld peer groups, using %s of memory%s", count
,
6764 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6765 count
* sizeof (struct peer_group
)),
6769 if ((count
= mtype_stats_alloc (MTYPE_HASH
)))
6770 vty_out (vty
, "%ld hash tables, using %s of memory%s", count
,
6771 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6772 count
* sizeof (struct hash
)),
6774 if ((count
= mtype_stats_alloc (MTYPE_HASH_BACKET
)))
6775 vty_out (vty
, "%ld hash buckets, using %s of memory%s", count
,
6776 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6777 count
* sizeof (struct hash_backet
)),
6779 if ((count
= mtype_stats_alloc (MTYPE_BGP_REGEXP
)))
6780 vty_out (vty
, "%ld compiled regexes, using %s of memory%s", count
,
6781 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6782 count
* sizeof (regex_t
)),
6787 /* Show BGP peer's summary information. */
6789 bgp_show_summary (struct vty
*vty
, struct bgp
*bgp
, int afi
, int safi
,
6790 u_char use_json
, json_object
*json
)
6793 struct listnode
*node
, *nnode
;
6794 unsigned int count
= 0, dn_count
= 0;
6795 char timebuf
[BGP_UPTIME_LEN
], dn_flag
[2];
6797 json_object
*json_peer
= NULL
;
6798 json_object
*json_peers
= NULL
;
6800 /* Header string for each address family. */
6801 static char header
[] = "Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd";
6806 json
= json_object_new_object();
6808 json_peers
= json_object_new_object();
6811 for (ALL_LIST_ELEMENTS (bgp
->peer
, node
, nnode
, peer
))
6813 if (!CHECK_FLAG(peer
->flags
, PEER_FLAG_CONFIG_NODE
))
6816 if (peer
->afc
[afi
][safi
])
6821 char memstrbuf
[MTYPE_MEMSTR_LEN
];
6824 vrf_id_ui
= (bgp
->vrf_id
== VRF_UNKNOWN
) ? -1 : bgp
->vrf_id
;
6826 /* Usage summary and header */
6829 json_object_string_add(json
, "routerId", inet_ntoa (bgp
->router_id
));
6830 json_object_int_add(json
, "as", bgp
->as
);
6831 json_object_int_add(json
, "vrfId", vrf_id_ui
);
6832 json_object_string_add(json
, "vrfName",
6833 (bgp
->inst_type
== BGP_INSTANCE_TYPE_DEFAULT
)
6834 ? "Default" : bgp
->name
);
6839 "BGP router identifier %s, local AS number %u vrf-id %d",
6840 inet_ntoa (bgp
->router_id
), bgp
->as
, vrf_id_ui
);
6841 vty_out (vty
, "%s", VTY_NEWLINE
);
6844 if (bgp_update_delay_configured(bgp
))
6848 json_object_int_add(json
, "updateDelayLimit", bgp
->v_update_delay
);
6850 if (bgp
->v_update_delay
!= bgp
->v_establish_wait
)
6851 json_object_int_add(json
, "updateDelayEstablishWait", bgp
->v_establish_wait
);
6853 if (bgp_update_delay_active(bgp
))
6855 json_object_string_add(json
, "updateDelayFirstNeighbor", bgp
->update_delay_begin_time
);
6856 json_object_boolean_true_add(json
, "updateDelayInProgress");
6860 if (bgp
->update_delay_over
)
6862 json_object_string_add(json
, "updateDelayFirstNeighbor",
6863 bgp
->update_delay_begin_time
);
6864 json_object_string_add(json
, "updateDelayBestpathResumed",
6865 bgp
->update_delay_end_time
);
6866 json_object_string_add(json
, "updateDelayZebraUpdateResume",
6867 bgp
->update_delay_zebra_resume_time
);
6868 json_object_string_add(json
, "updateDelayPeerUpdateResume",
6869 bgp
->update_delay_peers_resume_time
);
6875 vty_out (vty
, "Read-only mode update-delay limit: %d seconds%s",
6876 bgp
->v_update_delay
, VTY_NEWLINE
);
6877 if (bgp
->v_update_delay
!= bgp
->v_establish_wait
)
6878 vty_out (vty
, " Establish wait: %d seconds%s",
6879 bgp
->v_establish_wait
, VTY_NEWLINE
);
6881 if (bgp_update_delay_active(bgp
))
6883 vty_out (vty
, " First neighbor established: %s%s",
6884 bgp
->update_delay_begin_time
, VTY_NEWLINE
);
6885 vty_out (vty
, " Delay in progress%s", VTY_NEWLINE
);
6889 if (bgp
->update_delay_over
)
6891 vty_out (vty
, " First neighbor established: %s%s",
6892 bgp
->update_delay_begin_time
, VTY_NEWLINE
);
6893 vty_out (vty
, " Best-paths resumed: %s%s",
6894 bgp
->update_delay_end_time
, VTY_NEWLINE
);
6895 vty_out (vty
, " zebra update resumed: %s%s",
6896 bgp
->update_delay_zebra_resume_time
, VTY_NEWLINE
);
6897 vty_out (vty
, " peers update resumed: %s%s",
6898 bgp
->update_delay_peers_resume_time
, VTY_NEWLINE
);
6906 if (bgp_maxmed_onstartup_configured(bgp
) && bgp
->maxmed_active
)
6907 json_object_boolean_true_add(json
, "maxMedOnStartup");
6908 if (bgp
->v_maxmed_admin
)
6909 json_object_boolean_true_add(json
, "maxMedAdministrative");
6911 json_object_int_add(json
, "tableVersion", bgp_table_version(bgp
->rib
[afi
][safi
]));
6913 ents
= bgp_table_count (bgp
->rib
[afi
][safi
]);
6914 json_object_int_add(json
, "ribCount", ents
);
6915 json_object_int_add(json
, "ribMemory", ents
* sizeof (struct bgp_node
));
6917 ents
= listcount (bgp
->peer
);
6918 json_object_int_add(json
, "peerCount", ents
);
6919 json_object_int_add(json
, "peerMemory", ents
* sizeof (struct peer
));
6921 if ((ents
= listcount (bgp
->group
)))
6923 json_object_int_add(json
, "peerGroupCount", ents
);
6924 json_object_int_add(json
, "peerGroupMemory", ents
* sizeof (struct peer_group
));
6927 if (CHECK_FLAG (bgp
->af_flags
[afi
][safi
], BGP_CONFIG_DAMPENING
))
6928 json_object_boolean_true_add(json
, "dampeningEnabled");
6932 if (bgp_maxmed_onstartup_configured(bgp
) && bgp
->maxmed_active
)
6933 vty_out (vty
, "Max-med on-startup active%s", VTY_NEWLINE
);
6934 if (bgp
->v_maxmed_admin
)
6935 vty_out (vty
, "Max-med administrative active%s", VTY_NEWLINE
);
6937 vty_out(vty
, "BGP table version %" PRIu64
"%s",
6938 bgp_table_version(bgp
->rib
[afi
][safi
]), VTY_NEWLINE
);
6940 ents
= bgp_table_count (bgp
->rib
[afi
][safi
]);
6941 vty_out (vty
, "RIB entries %ld, using %s of memory%s", ents
,
6942 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6943 ents
* sizeof (struct bgp_node
)),
6946 /* Peer related usage */
6947 ents
= listcount (bgp
->peer
);
6948 vty_out (vty
, "Peers %ld, using %s of memory%s",
6950 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6951 ents
* sizeof (struct peer
)),
6954 if ((ents
= listcount (bgp
->group
)))
6955 vty_out (vty
, "Peer groups %ld, using %s of memory%s", ents
,
6956 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6957 ents
* sizeof (struct peer_group
)),
6960 if (CHECK_FLAG (bgp
->af_flags
[afi
][safi
], BGP_CONFIG_DAMPENING
))
6961 vty_out (vty
, "Dampening enabled.%s", VTY_NEWLINE
);
6962 vty_out (vty
, "%s", VTY_NEWLINE
);
6963 vty_out (vty
, "%s%s", header
, VTY_NEWLINE
);
6971 json_peer
= json_object_new_object();
6973 if (peer_dynamic_neighbor(peer
))
6974 json_object_boolean_true_add(json_peer
, "dynamicPeer");
6977 json_object_string_add(json_peer
, "hostname", peer
->hostname
);
6979 if (peer
->domainname
)
6980 json_object_string_add(json_peer
, "domainname", peer
->domainname
);
6982 json_object_int_add(json_peer
, "remoteAs", peer
->as
);
6983 json_object_int_add(json_peer
, "version", 4);
6984 json_object_int_add(json_peer
, "msgRcvd",
6985 peer
->open_in
+ peer
->update_in
+ peer
->keepalive_in
6986 + peer
->notify_in
+ peer
->refresh_in
6987 + peer
->dynamic_cap_in
);
6988 json_object_int_add(json_peer
, "msgSent",
6989 peer
->open_out
+ peer
->update_out
+ peer
->keepalive_out
6990 + peer
->notify_out
+ peer
->refresh_out
6991 + peer
->dynamic_cap_out
);
6993 json_object_int_add(json_peer
, "tableVersion", peer
->version
[afi
][safi
]);
6994 json_object_int_add(json_peer
, "outq", peer
->obuf
->count
);
6995 json_object_int_add(json_peer
, "inq", 0);
6996 peer_uptime (peer
->uptime
, timebuf
, BGP_UPTIME_LEN
, use_json
, json_peer
);
6997 json_object_int_add(json_peer
, "prefixReceivedCount", peer
->pcount
[afi
][safi
]);
6999 if (CHECK_FLAG (peer
->flags
, PEER_FLAG_SHUTDOWN
))
7000 json_object_string_add(json_peer
, "state", "Idle (Admin)");
7001 else if (CHECK_FLAG (peer
->sflags
, PEER_STATUS_PREFIX_OVERFLOW
))
7002 json_object_string_add(json_peer
, "state", "Idle (PfxCt)");
7004 json_object_string_add(json_peer
, "state", LOOKUP(bgp_status_msg
, peer
->status
));
7007 json_object_string_add(json_peer
, "idType", "interface");
7008 else if (peer
->su
.sa
.sa_family
== AF_INET
)
7009 json_object_string_add(json_peer
, "idType", "ipv4");
7010 else if (peer
->su
.sa
.sa_family
== AF_INET6
)
7011 json_object_string_add(json_peer
, "idType", "ipv6");
7013 json_object_object_add(json_peers
, peer
->host
, json_peer
);
7017 memset(dn_flag
, '\0', sizeof(dn_flag
));
7018 if (peer_dynamic_neighbor(peer
))
7024 if (peer
->hostname
&& bgp_flag_check(bgp
, BGP_FLAG_SHOW_HOSTNAME
))
7025 len
= vty_out (vty
, "%s%s(%s)", dn_flag
, peer
->hostname
,
7028 len
= vty_out (vty
, "%s%s", dn_flag
, peer
->host
);
7032 vty_out (vty
, "%s%*s", VTY_NEWLINE
, 16, " ");
7034 vty_out (vty
, "%*s", len
, " ");
7036 vty_out (vty
, "4 ");
7038 vty_out (vty
, "%5u %7d %7d %8" PRIu64
" %4d %4zd ",
7040 peer
->open_in
+ peer
->update_in
+ peer
->keepalive_in
7041 + peer
->notify_in
+ peer
->refresh_in
7042 + peer
->dynamic_cap_in
,
7043 peer
->open_out
+ peer
->update_out
+ peer
->keepalive_out
7044 + peer
->notify_out
+ peer
->refresh_out
7045 + peer
->dynamic_cap_out
,
7046 peer
->version
[afi
][safi
],
7050 vty_out (vty
, "%-8s",
7051 peer_uptime (peer
->uptime
, timebuf
, BGP_UPTIME_LEN
, 0, NULL
));
7053 if (peer
->status
== Established
)
7054 vty_out (vty
, " %8ld", peer
->pcount
[afi
][safi
]);
7057 if (CHECK_FLAG (peer
->flags
, PEER_FLAG_SHUTDOWN
))
7058 vty_out (vty
, " Idle (Admin)");
7059 else if (CHECK_FLAG (peer
->sflags
, PEER_STATUS_PREFIX_OVERFLOW
))
7060 vty_out (vty
, " Idle (PfxCt)");
7062 vty_out (vty
, " %-11s", LOOKUP(bgp_status_msg
, peer
->status
));
7064 vty_out (vty
, "%s", VTY_NEWLINE
);
7071 json_object_object_add(json
, "peers", json_peers
);
7073 json_object_int_add(json
, "totalPeers", count
);
7074 json_object_int_add(json
, "dynamicPeers", dn_count
);
7076 vty_out (vty
, "%s%s", json_object_to_json_string(json
), VTY_NEWLINE
);
7077 json_object_free(json
);
7082 vty_out (vty
, "%sTotal number of neighbors %d%s", VTY_NEWLINE
,
7083 count
, VTY_NEWLINE
);
7087 vty_out(vty
, "{\"error\": {\"message\": \"No %s neighbor configured\"}}%s",
7088 afi
== AFI_IP
? "IPv4" : "IPv6", VTY_NEWLINE
);
7090 vty_out (vty
, "No %s neighbor is configured%s",
7091 afi
== AFI_IP
? "IPv4" : "IPv6", VTY_NEWLINE
);
7094 if (dn_count
&& ! use_json
)
7096 vty_out(vty
, "* - dynamic neighbor%s", VTY_NEWLINE
);
7098 "%d dynamic neighbor(s), limit %d%s",
7099 dn_count
, bgp
->dynamic_neighbors_limit
, VTY_NEWLINE
);
7107 bgp_show_summary_vty (struct vty
*vty
, const char *name
,
7108 afi_t afi
, safi_t safi
, u_char use_json
)
7114 bgp
= bgp_lookup_by_name (name
);
7118 vty_out (vty
, "%% No such BGP instance exist%s", VTY_NEWLINE
);
7122 bgp_show_summary (vty
, bgp
, afi
, safi
, use_json
, NULL
);
7126 bgp
= bgp_get_default ();
7129 bgp_show_summary (vty
, bgp
, afi
, safi
, use_json
, NULL
);
7135 bgp_show_all_instances_summary_vty (struct vty
*vty
, afi_t afi
, safi_t safi
,
7138 struct listnode
*node
, *nnode
;
7140 json_object
*json
= NULL
;
7144 vty_out (vty
, "{%s", VTY_NEWLINE
);
7146 for (ALL_LIST_ELEMENTS (bm
->bgp
, node
, nnode
, bgp
))
7150 if (!(json
= json_object_new_object()))
7152 zlog_err("Unable to allocate memory for JSON object");
7154 "{\"error\": {\"message:\": \"Unable to allocate memory for JSON object\"}}}%s",
7160 vty_out (vty
, ",%s", VTY_NEWLINE
);
7164 vty_out(vty
, "\"%s\":", (bgp
->inst_type
== BGP_INSTANCE_TYPE_DEFAULT
)
7165 ? "Default" : bgp
->name
);
7169 vty_out (vty
, "%sInstance %s:%s",
7171 (bgp
->inst_type
== BGP_INSTANCE_TYPE_DEFAULT
)
7172 ? "Default" : bgp
->name
, VTY_NEWLINE
);
7174 bgp_show_summary (vty
, bgp
, afi
, safi
, use_json
, json
);
7178 vty_out (vty
, "}%s", VTY_NEWLINE
);
7182 /* `show ip bgp summary' commands. */
7183 DEFUN (show_ip_bgp_summary
,
7184 show_ip_bgp_summary_cmd
,
7185 "show [ip] bgp [<view|vrf> WORD] [<ipv4 unicast|ipv4 multicast|ipv6 unicast|vpnv4 unicast|encap unicast>] summary [json]",
7189 BGP_INSTANCE_HELP_STR
7191 "Address Family modifier\n"
7193 "Address Family modifier\n"
7195 "Address Family modifier\n"
7197 "Address Family modifier\n"
7199 "Address Family modifier\n"
7200 "Summary of BGP neighbor status\n"
7201 "JavaScript Object Notation\n")
7204 int idx_view_vrf
= 3;
7211 u_char uj
= use_json(argc
, argv
);
7214 * If the user does "show ip bgp" then we default the afi safi to ipv4 unicast.
7215 * If the user does "show bgp" then we default the afi safi to ipv6 unicast.
7216 * This may be over-written later in the command if they explicitly
7217 * specify an afi safi.
7219 if (strmatch(argv
[idx_ip
]->text
, "ip"))
7222 safi
= SAFI_UNICAST
;
7227 safi
= SAFI_UNICAST
;
7232 if (strmatch(argv
[idx_view_vrf
]->text
, "view") || strmatch(argv
[idx_view_vrf
]->text
, "vrf"))
7233 vrf
= argv
[idx_vrf
]->arg
;
7238 idx_safi
= argc
- 2;
7243 idx_safi
= argc
- 1;
7247 bgp_get_argv_afi_safi (argv
, idx_afi
, idx_safi
, &afi
, &safi
);
7249 return bgp_show_summary_vty (vty
, vrf
, afi
, safi
, uj
);
7252 DEFUN (show_ip_bgp_instance_all_summary
,
7253 show_ip_bgp_instance_all_summary_cmd
,
7254 "show ip bgp <view|vrf> all summary [json]",
7258 BGP_INSTANCE_ALL_HELP_STR
7259 "Summary of BGP neighbor status\n"
7260 "JavaScript Object Notation\n")
7262 u_char uj
= use_json(argc
, argv
);
7264 bgp_show_all_instances_summary_vty (vty
, AFI_IP
, SAFI_UNICAST
, uj
);
7269 afi_safi_print (afi_t afi
, safi_t safi
)
7271 if (afi
== AFI_IP
&& safi
== SAFI_UNICAST
)
7272 return "IPv4 Unicast";
7273 else if (afi
== AFI_IP
&& safi
== SAFI_MULTICAST
)
7274 return "IPv4 Multicast";
7275 else if (afi
== AFI_IP
&& safi
== SAFI_MPLS_VPN
)
7276 return "VPN-IPv4 Unicast";
7277 else if (afi
== AFI_IP
&& safi
== SAFI_ENCAP
)
7278 return "ENCAP-IPv4 Unicast";
7279 else if (afi
== AFI_IP6
&& safi
== SAFI_UNICAST
)
7280 return "IPv6 Unicast";
7281 else if (afi
== AFI_IP6
&& safi
== SAFI_MULTICAST
)
7282 return "IPv6 Multicast";
7283 else if (afi
== AFI_IP6
&& safi
== SAFI_MPLS_VPN
)
7284 return "VPN-IPv6 Unicast";
7285 else if (afi
== AFI_IP6
&& safi
== SAFI_ENCAP
)
7286 return "ENCAP-IPv6 Unicast";
7291 /* Show BGP peer's information. */
7299 bgp_show_peer_afi_orf_cap (struct vty
*vty
, struct peer
*p
, afi_t afi
, safi_t safi
,
7300 u_int16_t adv_smcap
, u_int16_t adv_rmcap
, u_int16_t rcv_smcap
,
7301 u_int16_t rcv_rmcap
, u_char use_json
, json_object
*json_pref
)
7304 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], adv_smcap
)
7305 || CHECK_FLAG (p
->af_cap
[afi
][safi
], rcv_smcap
))
7309 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], adv_smcap
) && CHECK_FLAG (p
->af_cap
[afi
][safi
], rcv_smcap
))
7310 json_object_string_add(json_pref
, "sendMode", "advertisedAndReceived");
7311 else if (CHECK_FLAG (p
->af_cap
[afi
][safi
], adv_smcap
))
7312 json_object_string_add(json_pref
, "sendMode", "advertised");
7313 else if (CHECK_FLAG (p
->af_cap
[afi
][safi
], rcv_smcap
))
7314 json_object_string_add(json_pref
, "sendMode", "received");
7318 vty_out (vty
, " Send-mode: ");
7319 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], adv_smcap
))
7320 vty_out (vty
, "advertised");
7321 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], rcv_smcap
))
7322 vty_out (vty
, "%sreceived",
7323 CHECK_FLAG (p
->af_cap
[afi
][safi
], adv_smcap
) ?
7325 vty_out (vty
, "%s", VTY_NEWLINE
);
7330 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], adv_rmcap
)
7331 || CHECK_FLAG (p
->af_cap
[afi
][safi
], rcv_rmcap
))
7335 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], adv_rmcap
) && CHECK_FLAG (p
->af_cap
[afi
][safi
], rcv_rmcap
))
7336 json_object_string_add(json_pref
, "recvMode", "advertisedAndReceived");
7337 else if (CHECK_FLAG (p
->af_cap
[afi
][safi
], adv_rmcap
))
7338 json_object_string_add(json_pref
, "recvMode", "advertised");
7339 else if (CHECK_FLAG (p
->af_cap
[afi
][safi
], rcv_rmcap
))
7340 json_object_string_add(json_pref
, "recvMode", "received");
7344 vty_out (vty
, " Receive-mode: ");
7345 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], adv_rmcap
))
7346 vty_out (vty
, "advertised");
7347 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], rcv_rmcap
))
7348 vty_out (vty
, "%sreceived",
7349 CHECK_FLAG (p
->af_cap
[afi
][safi
], adv_rmcap
) ?
7351 vty_out (vty
, "%s", VTY_NEWLINE
);
7357 bgp_show_peer_afi (struct vty
*vty
, struct peer
*p
, afi_t afi
, safi_t safi
,
7358 u_char use_json
, json_object
*json_neigh
)
7360 struct bgp_filter
*filter
;
7361 struct peer_af
*paf
;
7362 char orf_pfx_name
[BUFSIZ
];
7364 json_object
*json_af
= NULL
;
7365 json_object
*json_prefA
= NULL
;
7366 json_object
*json_prefB
= NULL
;
7367 json_object
*json_addr
= NULL
;
7371 json_addr
= json_object_new_object();
7372 json_af
= json_object_new_object();
7373 json_prefA
= json_object_new_object();
7374 json_prefB
= json_object_new_object();
7375 filter
= &p
->filter
[afi
][safi
];
7377 if (peer_group_active(p
))
7378 json_object_string_add(json_addr
, "peerGroupMember", p
->group
->name
);
7380 paf
= peer_af_find(p
, afi
, safi
);
7381 if (paf
&& PAF_SUBGRP(paf
))
7383 json_object_int_add(json_addr
, "updateGroupId", PAF_UPDGRP(paf
)->id
);
7384 json_object_int_add(json_addr
, "subGroupId", PAF_SUBGRP(paf
)->id
);
7385 json_object_int_add(json_addr
, "packetQueueLength", bpacket_queue_virtual_length(paf
));
7388 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_ADV
)
7389 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_RCV
)
7390 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_ADV
)
7391 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_RCV
))
7393 json_object_int_add(json_af
, "orfType", ORF_TYPE_PREFIX
);
7394 bgp_show_peer_afi_orf_cap (vty
, p
, afi
, safi
,
7395 PEER_CAP_ORF_PREFIX_SM_ADV
,
7396 PEER_CAP_ORF_PREFIX_RM_ADV
,
7397 PEER_CAP_ORF_PREFIX_SM_RCV
,
7398 PEER_CAP_ORF_PREFIX_RM_RCV
, use_json
, json_prefA
);
7399 json_object_object_add(json_af
, "orfPrefixList", json_prefA
);
7402 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_ADV
)
7403 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_OLD_RCV
)
7404 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_ADV
)
7405 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_OLD_RCV
))
7407 json_object_int_add(json_af
, "orfOldType", ORF_TYPE_PREFIX_OLD
);
7408 bgp_show_peer_afi_orf_cap (vty
, p
, afi
, safi
,
7409 PEER_CAP_ORF_PREFIX_SM_ADV
,
7410 PEER_CAP_ORF_PREFIX_RM_ADV
,
7411 PEER_CAP_ORF_PREFIX_SM_OLD_RCV
,
7412 PEER_CAP_ORF_PREFIX_RM_OLD_RCV
, use_json
, json_prefB
);
7413 json_object_object_add(json_af
, "orfOldPrefixList", json_prefB
);
7416 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_ADV
)
7417 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_RCV
)
7418 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_OLD_RCV
)
7419 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_ADV
)
7420 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_RCV
)
7421 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_OLD_RCV
))
7422 json_object_object_add(json_addr
, "afDependentCap", json_af
);
7424 sprintf (orf_pfx_name
, "%s.%d.%d", p
->host
, afi
, safi
);
7425 orf_pfx_count
= prefix_bgp_show_prefix_list (NULL
, afi
, orf_pfx_name
, use_json
);
7427 if (CHECK_FLAG (p
->af_sflags
[afi
][safi
], PEER_STATUS_ORF_PREFIX_SEND
)
7430 if (CHECK_FLAG (p
->af_sflags
[afi
][safi
], PEER_STATUS_ORF_PREFIX_SEND
))
7431 json_object_boolean_true_add(json_neigh
, "orfSent");
7433 json_object_int_add(json_addr
, "orfRecvCounter", orf_pfx_count
);
7435 if (CHECK_FLAG (p
->af_sflags
[afi
][safi
], PEER_STATUS_ORF_WAIT_REFRESH
))
7436 json_object_string_add(json_addr
, "orfFirstUpdate", "deferredUntilORFOrRouteRefreshRecvd");
7438 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_REFLECTOR_CLIENT
))
7439 json_object_boolean_true_add(json_addr
, "routeReflectorClient");
7440 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
7441 json_object_boolean_true_add(json_addr
, "routeServerClient");
7442 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SOFT_RECONFIG
))
7443 json_object_boolean_true_add(json_addr
, "inboundSoftConfigPermit");
7445 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE
))
7446 json_object_boolean_true_add(json_addr
, "privateAsNumsAllReplacedInUpdatesToNbr");
7447 else if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE
))
7448 json_object_boolean_true_add(json_addr
, "privateAsNumsReplacedInUpdatesToNbr");
7449 else if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_REMOVE_PRIVATE_AS_ALL
))
7450 json_object_boolean_true_add(json_addr
, "privateAsNumsAllRemovedInUpdatesToNbr");
7451 else if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_REMOVE_PRIVATE_AS
))
7452 json_object_boolean_true_add(json_addr
, "privateAsNumsRemovedInUpdatesToNbr");
7454 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_ADDPATH_TX_ALL_PATHS
))
7455 json_object_boolean_true_add(json_addr
, "addpathTxAllPaths");
7457 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS
))
7458 json_object_boolean_true_add(json_addr
, "addpathTxBestpathPerAS");
7460 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_AS_OVERRIDE
))
7461 json_object_string_add(json_addr
, "overrideASNsInOutboundUpdates", "ifAspathEqualRemoteAs");
7463 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_NEXTHOP_SELF
) ||
7464 CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_FORCE_NEXTHOP_SELF
))
7465 json_object_boolean_true_add(json_addr
, "routerAlwaysNextHop");
7466 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_AS_PATH_UNCHANGED
))
7467 json_object_boolean_true_add(json_addr
, "unchangedAsPathPropogatedToNbr");
7468 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_NEXTHOP_UNCHANGED
))
7469 json_object_boolean_true_add(json_addr
, "unchangedNextHopPropogatedToNbr");
7470 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_MED_UNCHANGED
))
7471 json_object_boolean_true_add(json_addr
, "unchangedMedPropogatedToNbr");
7472 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_COMMUNITY
)
7473 || CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_EXT_COMMUNITY
))
7475 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_COMMUNITY
)
7476 && CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_EXT_COMMUNITY
))
7477 json_object_string_add(json_addr
, "commAttriSentToNbr", "extendedAndStandard");
7478 else if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_EXT_COMMUNITY
))
7479 json_object_string_add(json_addr
, "commAttriSentToNbr", "extended");
7481 json_object_string_add(json_addr
, "commAttriSentToNbr", "standard");
7483 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_DEFAULT_ORIGINATE
))
7485 if (p
->default_rmap
[afi
][safi
].name
)
7486 json_object_string_add(json_addr
, "defaultRouteMap", p
->default_rmap
[afi
][safi
].name
);
7488 if (paf
&& PAF_SUBGRP(paf
) && CHECK_FLAG(PAF_SUBGRP(paf
)->sflags
, SUBGRP_STATUS_DEFAULT_ORIGINATE
))
7489 json_object_boolean_true_add(json_addr
, "defaultSent");
7491 json_object_boolean_true_add(json_addr
, "defaultNotSent");
7494 if (filter
->plist
[FILTER_IN
].name
7495 || filter
->dlist
[FILTER_IN
].name
7496 || filter
->aslist
[FILTER_IN
].name
7497 || filter
->map
[RMAP_IN
].name
)
7498 json_object_boolean_true_add(json_addr
, "inboundPathPolicyConfig");
7499 if (filter
->plist
[FILTER_OUT
].name
7500 || filter
->dlist
[FILTER_OUT
].name
7501 || filter
->aslist
[FILTER_OUT
].name
7502 || filter
->map
[RMAP_OUT
].name
7503 || filter
->usmap
.name
)
7504 json_object_boolean_true_add(json_addr
, "outboundPathPolicyConfig");
7507 if (filter
->plist
[FILTER_IN
].name
)
7508 json_object_string_add(json_addr
, "incomingUpdatePrefixFilterList", filter
->plist
[FILTER_IN
].name
);
7509 if (filter
->plist
[FILTER_OUT
].name
)
7510 json_object_string_add(json_addr
, "outgoingUpdatePrefixFilterList", filter
->plist
[FILTER_OUT
].name
);
7512 /* distribute-list */
7513 if (filter
->dlist
[FILTER_IN
].name
)
7514 json_object_string_add(json_addr
, "incomingUpdateNetworkFilterList", filter
->dlist
[FILTER_IN
].name
);
7515 if (filter
->dlist
[FILTER_OUT
].name
)
7516 json_object_string_add(json_addr
, "outgoingUpdateNetworkFilterList", filter
->dlist
[FILTER_OUT
].name
);
7519 if (filter
->aslist
[FILTER_IN
].name
)
7520 json_object_string_add(json_addr
, "incomingUpdateAsPathFilterList", filter
->aslist
[FILTER_IN
].name
);
7521 if (filter
->aslist
[FILTER_OUT
].name
)
7522 json_object_string_add(json_addr
, "outgoingUpdateAsPathFilterList", filter
->aslist
[FILTER_OUT
].name
);
7525 if (filter
->map
[RMAP_IN
].name
)
7526 json_object_string_add(json_addr
, "routeMapForIncomingAdvertisements", filter
->map
[RMAP_IN
].name
);
7527 if (filter
->map
[RMAP_OUT
].name
)
7528 json_object_string_add(json_addr
, "routeMapForOutgoingAdvertisements", filter
->map
[RMAP_OUT
].name
);
7530 /* unsuppress-map */
7531 if (filter
->usmap
.name
)
7532 json_object_string_add(json_addr
, "selectiveUnsuppressRouteMap", filter
->usmap
.name
);
7534 /* Receive prefix count */
7535 json_object_int_add(json_addr
, "acceptedPrefixCounter", p
->pcount
[afi
][safi
]);
7537 /* Maximum prefix */
7538 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_MAX_PREFIX
))
7540 json_object_int_add(json_addr
, "prefixAllowedMax", p
->pmax
[afi
][safi
]);
7541 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_MAX_PREFIX_WARNING
))
7542 json_object_boolean_true_add(json_addr
, "prefixAllowedMaxWarning");
7543 json_object_int_add(json_addr
, "prefixAllowedWarningThresh", p
->pmax_threshold
[afi
][safi
]);
7544 if (p
->pmax_restart
[afi
][safi
])
7545 json_object_int_add(json_addr
, "prefixAllowedRestartIntervalMsecs", p
->pmax_restart
[afi
][safi
] * 60000);
7547 json_object_object_add(json_neigh
, afi_safi_print (afi
, safi
), json_addr
);
7552 filter
= &p
->filter
[afi
][safi
];
7554 vty_out (vty
, " For address family: %s%s", afi_safi_print (afi
, safi
),
7557 if (peer_group_active(p
))
7558 vty_out (vty
, " %s peer-group member%s", p
->group
->name
, VTY_NEWLINE
);
7560 paf
= peer_af_find(p
, afi
, safi
);
7561 if (paf
&& PAF_SUBGRP(paf
))
7563 vty_out (vty
, " Update group %" PRIu64
", subgroup %" PRIu64
"%s",
7564 PAF_UPDGRP(paf
)->id
, PAF_SUBGRP(paf
)->id
, VTY_NEWLINE
);
7565 vty_out (vty
, " Packet Queue length %d%s",
7566 bpacket_queue_virtual_length(paf
), VTY_NEWLINE
);
7570 vty_out(vty
, " Not part of any update group%s", VTY_NEWLINE
);
7572 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_ADV
)
7573 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_RCV
)
7574 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_OLD_RCV
)
7575 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_ADV
)
7576 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_RCV
)
7577 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_OLD_RCV
))
7578 vty_out (vty
, " AF-dependant capabilities:%s", VTY_NEWLINE
);
7580 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_ADV
)
7581 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_RCV
)
7582 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_ADV
)
7583 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_RCV
))
7585 vty_out (vty
, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
7586 ORF_TYPE_PREFIX
, VTY_NEWLINE
);
7587 bgp_show_peer_afi_orf_cap (vty
, p
, afi
, safi
,
7588 PEER_CAP_ORF_PREFIX_SM_ADV
,
7589 PEER_CAP_ORF_PREFIX_RM_ADV
,
7590 PEER_CAP_ORF_PREFIX_SM_RCV
,
7591 PEER_CAP_ORF_PREFIX_RM_RCV
, use_json
, NULL
);
7593 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_ADV
)
7594 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_OLD_RCV
)
7595 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_ADV
)
7596 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_OLD_RCV
))
7598 vty_out (vty
, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
7599 ORF_TYPE_PREFIX_OLD
, VTY_NEWLINE
);
7600 bgp_show_peer_afi_orf_cap (vty
, p
, afi
, safi
,
7601 PEER_CAP_ORF_PREFIX_SM_ADV
,
7602 PEER_CAP_ORF_PREFIX_RM_ADV
,
7603 PEER_CAP_ORF_PREFIX_SM_OLD_RCV
,
7604 PEER_CAP_ORF_PREFIX_RM_OLD_RCV
, use_json
, NULL
);
7607 sprintf (orf_pfx_name
, "%s.%d.%d", p
->host
, afi
, safi
);
7608 orf_pfx_count
= prefix_bgp_show_prefix_list (NULL
, afi
, orf_pfx_name
, use_json
);
7610 if (CHECK_FLAG (p
->af_sflags
[afi
][safi
], PEER_STATUS_ORF_PREFIX_SEND
)
7613 vty_out (vty
, " Outbound Route Filter (ORF):");
7614 if (CHECK_FLAG (p
->af_sflags
[afi
][safi
], PEER_STATUS_ORF_PREFIX_SEND
))
7615 vty_out (vty
, " sent;");
7617 vty_out (vty
, " received (%d entries)", orf_pfx_count
);
7618 vty_out (vty
, "%s", VTY_NEWLINE
);
7620 if (CHECK_FLAG (p
->af_sflags
[afi
][safi
], PEER_STATUS_ORF_WAIT_REFRESH
))
7621 vty_out (vty
, " First update is deferred until ORF or ROUTE-REFRESH is received%s", VTY_NEWLINE
);
7623 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_REFLECTOR_CLIENT
))
7624 vty_out (vty
, " Route-Reflector Client%s", VTY_NEWLINE
);
7625 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
7626 vty_out (vty
, " Route-Server Client%s", VTY_NEWLINE
);
7627 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SOFT_RECONFIG
))
7628 vty_out (vty
, " Inbound soft reconfiguration allowed%s", VTY_NEWLINE
);
7630 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE
))
7631 vty_out (vty
, " Private AS numbers (all) replaced in updates to this neighbor%s", VTY_NEWLINE
);
7632 else if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE
))
7633 vty_out (vty
, " Private AS numbers replaced in updates to this neighbor%s", VTY_NEWLINE
);
7634 else if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_REMOVE_PRIVATE_AS_ALL
))
7635 vty_out (vty
, " Private AS numbers (all) removed in updates to this neighbor%s", VTY_NEWLINE
);
7636 else if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_REMOVE_PRIVATE_AS
))
7637 vty_out (vty
, " Private AS numbers removed in updates to this neighbor%s", VTY_NEWLINE
);
7639 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_ADDPATH_TX_ALL_PATHS
))
7640 vty_out (vty
, " Advertise all paths via addpath%s", VTY_NEWLINE
);
7642 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS
))
7643 vty_out (vty
, " Advertise bestpath per AS via addpath%s", VTY_NEWLINE
);
7645 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_AS_OVERRIDE
))
7646 vty_out (vty
, " Override ASNs in outbound updates if aspath equals remote-as%s", VTY_NEWLINE
);
7648 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_NEXTHOP_SELF
) ||
7649 CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_FORCE_NEXTHOP_SELF
))
7650 vty_out (vty
, " NEXT_HOP is always this router%s", VTY_NEWLINE
);
7651 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_AS_PATH_UNCHANGED
))
7652 vty_out (vty
, " AS_PATH is propagated unchanged to this neighbor%s", VTY_NEWLINE
);
7653 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_NEXTHOP_UNCHANGED
))
7654 vty_out (vty
, " NEXT_HOP is propagated unchanged to this neighbor%s", VTY_NEWLINE
);
7655 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_MED_UNCHANGED
))
7656 vty_out (vty
, " MED is propagated unchanged to this neighbor%s", VTY_NEWLINE
);
7657 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_COMMUNITY
)
7658 || CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_EXT_COMMUNITY
))
7660 vty_out (vty
, " Community attribute sent to this neighbor");
7661 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_COMMUNITY
)
7662 && CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_EXT_COMMUNITY
))
7663 vty_out (vty
, "(both)%s", VTY_NEWLINE
);
7664 else if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_EXT_COMMUNITY
))
7665 vty_out (vty
, "(extended)%s", VTY_NEWLINE
);
7667 vty_out (vty
, "(standard)%s", VTY_NEWLINE
);
7669 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_DEFAULT_ORIGINATE
))
7671 vty_out (vty
, " Default information originate,");
7673 if (p
->default_rmap
[afi
][safi
].name
)
7674 vty_out (vty
, " default route-map %s%s,",
7675 p
->default_rmap
[afi
][safi
].map
? "*" : "",
7676 p
->default_rmap
[afi
][safi
].name
);
7677 if (paf
&& PAF_SUBGRP(paf
) && CHECK_FLAG(PAF_SUBGRP(paf
)->sflags
, SUBGRP_STATUS_DEFAULT_ORIGINATE
))
7678 vty_out (vty
, " default sent%s", VTY_NEWLINE
);
7680 vty_out (vty
, " default not sent%s", VTY_NEWLINE
);
7683 if (filter
->plist
[FILTER_IN
].name
7684 || filter
->dlist
[FILTER_IN
].name
7685 || filter
->aslist
[FILTER_IN
].name
7686 || filter
->map
[RMAP_IN
].name
)
7687 vty_out (vty
, " Inbound path policy configured%s", VTY_NEWLINE
);
7688 if (filter
->plist
[FILTER_OUT
].name
7689 || filter
->dlist
[FILTER_OUT
].name
7690 || filter
->aslist
[FILTER_OUT
].name
7691 || filter
->map
[RMAP_OUT
].name
7692 || filter
->usmap
.name
)
7693 vty_out (vty
, " Outbound path policy configured%s", VTY_NEWLINE
);
7696 if (filter
->plist
[FILTER_IN
].name
)
7697 vty_out (vty
, " Incoming update prefix filter list is %s%s%s",
7698 filter
->plist
[FILTER_IN
].plist
? "*" : "",
7699 filter
->plist
[FILTER_IN
].name
,
7701 if (filter
->plist
[FILTER_OUT
].name
)
7702 vty_out (vty
, " Outgoing update prefix filter list is %s%s%s",
7703 filter
->plist
[FILTER_OUT
].plist
? "*" : "",
7704 filter
->plist
[FILTER_OUT
].name
,
7707 /* distribute-list */
7708 if (filter
->dlist
[FILTER_IN
].name
)
7709 vty_out (vty
, " Incoming update network filter list is %s%s%s",
7710 filter
->dlist
[FILTER_IN
].alist
? "*" : "",
7711 filter
->dlist
[FILTER_IN
].name
,
7713 if (filter
->dlist
[FILTER_OUT
].name
)
7714 vty_out (vty
, " Outgoing update network filter list is %s%s%s",
7715 filter
->dlist
[FILTER_OUT
].alist
? "*" : "",
7716 filter
->dlist
[FILTER_OUT
].name
,
7720 if (filter
->aslist
[FILTER_IN
].name
)
7721 vty_out (vty
, " Incoming update AS path filter list is %s%s%s",
7722 filter
->aslist
[FILTER_IN
].aslist
? "*" : "",
7723 filter
->aslist
[FILTER_IN
].name
,
7725 if (filter
->aslist
[FILTER_OUT
].name
)
7726 vty_out (vty
, " Outgoing update AS path filter list is %s%s%s",
7727 filter
->aslist
[FILTER_OUT
].aslist
? "*" : "",
7728 filter
->aslist
[FILTER_OUT
].name
,
7732 if (filter
->map
[RMAP_IN
].name
)
7733 vty_out (vty
, " Route map for incoming advertisements is %s%s%s",
7734 filter
->map
[RMAP_IN
].map
? "*" : "",
7735 filter
->map
[RMAP_IN
].name
,
7737 if (filter
->map
[RMAP_OUT
].name
)
7738 vty_out (vty
, " Route map for outgoing advertisements is %s%s%s",
7739 filter
->map
[RMAP_OUT
].map
? "*" : "",
7740 filter
->map
[RMAP_OUT
].name
,
7743 /* unsuppress-map */
7744 if (filter
->usmap
.name
)
7745 vty_out (vty
, " Route map for selective unsuppress is %s%s%s",
7746 filter
->usmap
.map
? "*" : "",
7747 filter
->usmap
.name
, VTY_NEWLINE
);
7749 /* Receive prefix count */
7750 vty_out (vty
, " %ld accepted prefixes%s", p
->pcount
[afi
][safi
], VTY_NEWLINE
);
7752 /* Maximum prefix */
7753 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_MAX_PREFIX
))
7755 vty_out (vty
, " Maximum prefixes allowed %ld%s%s", p
->pmax
[afi
][safi
],
7756 CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_MAX_PREFIX_WARNING
)
7757 ? " (warning-only)" : "", VTY_NEWLINE
);
7758 vty_out (vty
, " Threshold for warning message %d%%",
7759 p
->pmax_threshold
[afi
][safi
]);
7760 if (p
->pmax_restart
[afi
][safi
])
7761 vty_out (vty
, ", restart interval %d min", p
->pmax_restart
[afi
][safi
]);
7762 vty_out (vty
, "%s", VTY_NEWLINE
);
7765 vty_out (vty
, "%s", VTY_NEWLINE
);
7770 bgp_show_peer (struct vty
*vty
, struct peer
*p
, u_char use_json
, json_object
*json
)
7773 char buf1
[PREFIX2STR_BUFFER
], buf
[SU_ADDRSTRLEN
];
7774 char timebuf
[BGP_UPTIME_LEN
];
7776 const char *subcode_str
;
7777 const char *code_str
;
7782 json_object
*json_neigh
= NULL
;
7787 json_neigh
= json_object_new_object();
7791 if (p
->conf_if
) /* Configured interface name. */
7792 vty_out (vty
, "BGP neighbor on %s: %s, ", p
->conf_if
,
7793 BGP_PEER_SU_UNSPEC(p
) ? "None" :
7794 sockunion2str (&p
->su
, buf
, SU_ADDRSTRLEN
));
7795 else /* Configured IP address. */
7797 memset(dn_flag
, '\0', sizeof(dn_flag
));
7798 if (peer_dynamic_neighbor(p
))
7801 vty_out (vty
, "BGP neighbor is %s%s, ", dn_flag
, p
->host
);
7807 if (p
->conf_if
&& BGP_PEER_SU_UNSPEC(p
))
7808 json_object_string_add(json_neigh
, "bgpNeighborAddr", "none");
7809 else if (p
->conf_if
&& !BGP_PEER_SU_UNSPEC(p
))
7810 json_object_string_add(json_neigh
, "bgpNeighborAddr", sockunion2str (&p
->su
, buf
, SU_ADDRSTRLEN
));
7812 json_object_int_add(json_neigh
, "remoteAs", p
->as
);
7814 if (p
->change_local_as
)
7815 json_object_int_add(json_neigh
, "localAs", p
->change_local_as
);
7817 json_object_int_add(json_neigh
, "localAs", p
->local_as
);
7819 if (CHECK_FLAG (p
->flags
, PEER_FLAG_LOCAL_AS_NO_PREPEND
))
7820 json_object_boolean_true_add(json_neigh
, "localAsNoPrepend");
7822 if (CHECK_FLAG (p
->flags
, PEER_FLAG_LOCAL_AS_REPLACE_AS
))
7823 json_object_boolean_true_add(json_neigh
, "localAsReplaceAs");
7827 if ((p
->as_type
== AS_SPECIFIED
) ||
7828 (p
->as_type
== AS_EXTERNAL
) ||
7829 (p
->as_type
== AS_INTERNAL
))
7830 vty_out (vty
, "remote AS %u, ", p
->as
);
7832 vty_out (vty
, "remote AS Unspecified, ");
7833 vty_out (vty
, "local AS %u%s%s, ",
7834 p
->change_local_as
? p
->change_local_as
: p
->local_as
,
7835 CHECK_FLAG (p
->flags
, PEER_FLAG_LOCAL_AS_NO_PREPEND
) ?
7837 CHECK_FLAG (p
->flags
, PEER_FLAG_LOCAL_AS_REPLACE_AS
) ?
7838 " replace-as" : "");
7840 /* peer type internal, external, confed-internal or confed-external */
7841 if (p
->as
== p
->local_as
)
7845 if (CHECK_FLAG(bgp
->config
, BGP_CONFIG_CONFEDERATION
))
7846 json_object_boolean_true_add(json_neigh
, "nbrConfedInternalLink");
7848 json_object_boolean_true_add(json_neigh
, "nbrInternalLink");
7852 if (CHECK_FLAG(bgp
->config
, BGP_CONFIG_CONFEDERATION
))
7853 vty_out (vty
, "confed-internal link%s", VTY_NEWLINE
);
7855 vty_out (vty
, "internal link%s", VTY_NEWLINE
);
7862 if (CHECK_FLAG(bgp
->config
, BGP_CONFIG_CONFEDERATION
))
7863 json_object_boolean_true_add(json_neigh
, "nbrConfedExternalLink");
7865 json_object_boolean_true_add(json_neigh
, "nbrExternalLink");
7869 if (bgp_confederation_peers_check(bgp
, p
->as
))
7870 vty_out (vty
, "confed-external link%s", VTY_NEWLINE
);
7872 vty_out (vty
, "external link%s", VTY_NEWLINE
);
7880 json_object_string_add(json_neigh
, "nbrDesc", p
->desc
);
7882 vty_out (vty
, " Description: %s%s", p
->desc
, VTY_NEWLINE
);
7890 json_object_string_add(json_neigh
, "hostname", p
->hostname
);
7893 json_object_string_add(json_neigh
, "domainname", p
->domainname
);
7897 if (p
->domainname
&& (p
->domainname
[0] != '\0'))
7898 vty_out(vty
, "Hostname: %s.%s%s", p
->hostname
, p
->domainname
,
7901 vty_out(vty
, "Hostname: %s%s", p
->hostname
, VTY_NEWLINE
);
7911 json_object_string_add(json_neigh
, "peerGroup", p
->group
->name
);
7915 struct prefix prefix
, *range
= NULL
;
7917 sockunion2hostprefix(&(p
->su
), &prefix
);
7918 range
= peer_group_lookup_dynamic_neighbor_range (p
->group
, &prefix
);
7922 prefix2str(range
, buf1
, sizeof(buf1
));
7923 json_object_string_add(json_neigh
, "peerSubnetRangeGroup", buf1
);
7929 vty_out (vty
, " Member of peer-group %s for session parameters%s",
7930 p
->group
->name
, VTY_NEWLINE
);
7934 struct prefix prefix
, *range
= NULL
;
7936 sockunion2hostprefix(&(p
->su
), &prefix
);
7937 range
= peer_group_lookup_dynamic_neighbor_range (p
->group
, &prefix
);
7941 prefix2str(range
, buf1
, sizeof(buf1
));
7942 vty_out (vty
, " Belongs to the subnet range group: %s%s", buf1
, VTY_NEWLINE
);
7950 /* Administrative shutdown. */
7951 if (CHECK_FLAG (p
->flags
, PEER_FLAG_SHUTDOWN
))
7952 json_object_boolean_true_add(json_neigh
, "adminShutDown");
7955 json_object_int_add(json_neigh
, "bgpVersion", 4);
7956 json_object_string_add(json_neigh
, "remoteRouterId", inet_ntop (AF_INET
, &p
->remote_id
, buf1
, BUFSIZ
));
7959 if (CHECK_FLAG (bgp
->config
, BGP_CONFIG_CONFEDERATION
) && bgp_confederation_peers_check (bgp
, p
->as
))
7960 json_object_boolean_true_add(json_neigh
, "nbrCommonAdmin");
7963 json_object_string_add(json_neigh
, "bgpState", LOOKUP (bgp_status_msg
, p
->status
));
7965 if (p
->status
== Established
)
7970 uptime
= bgp_clock();
7971 uptime
-= p
->uptime
;
7972 tm
= gmtime(&uptime
);
7974 json_object_int_add(json_neigh
, "bgpTimerUp", (tm
->tm_sec
* 1000) + (tm
->tm_min
* 60000) + (tm
->tm_hour
* 3600000));
7977 else if (p
->status
== Active
)
7979 if (CHECK_FLAG (p
->flags
, PEER_FLAG_PASSIVE
))
7980 json_object_string_add(json_neigh
, "bgpStateIs", "passive");
7981 else if (CHECK_FLAG (p
->sflags
, PEER_STATUS_NSF_WAIT
))
7982 json_object_string_add(json_neigh
, "bgpStateIs", "passiveNSF");
7989 uptime
= bgp_clock();
7990 uptime
-= p
->readtime
;
7991 tm
= gmtime(&uptime
);
7992 json_object_int_add(json_neigh
, "bgpTimerLastRead", (tm
->tm_sec
* 1000) + (tm
->tm_min
* 60000) + (tm
->tm_hour
* 3600000));
7994 uptime
= bgp_clock();
7995 uptime
-= p
->last_write
;
7996 tm
= gmtime(&uptime
);
7997 json_object_int_add(json_neigh
, "bgpTimerLastWrite", (tm
->tm_sec
* 1000) + (tm
->tm_min
* 60000) + (tm
->tm_hour
* 3600000));
7999 uptime
= bgp_clock();
8000 uptime
-= p
->update_time
;
8001 tm
= gmtime(&uptime
);
8002 json_object_int_add(json_neigh
, "bgpInUpdateElapsedTimeMsecs",
8003 (tm
->tm_sec
* 1000) + (tm
->tm_min
* 60000) + (tm
->tm_hour
* 3600000));
8005 /* Configured timer values. */
8006 json_object_int_add(json_neigh
, "bgpTimerHoldTimeMsecs", p
->v_holdtime
* 1000);
8007 json_object_int_add(json_neigh
, "bgpTimerKeepAliveIntervalMsecs", p
->v_keepalive
* 1000);
8009 if (CHECK_FLAG (p
->config
, PEER_CONFIG_TIMER
))
8011 json_object_int_add(json_neigh
, "bgpTimerConfiguredHoldTimeMsecs", p
->holdtime
* 1000);
8012 json_object_int_add(json_neigh
, "bgpTimerConfiguredKeepAliveIntervalMsecs", p
->keepalive
* 1000);
8017 /* Administrative shutdown. */
8018 if (CHECK_FLAG (p
->flags
, PEER_FLAG_SHUTDOWN
))
8019 vty_out (vty
, " Administratively shut down%s", VTY_NEWLINE
);
8022 vty_out (vty
, " BGP version 4");
8023 vty_out (vty
, ", remote router ID %s%s", inet_ntop (AF_INET
, &p
->remote_id
, buf1
, BUFSIZ
),
8027 if (CHECK_FLAG (bgp
->config
, BGP_CONFIG_CONFEDERATION
)
8028 && bgp_confederation_peers_check (bgp
, p
->as
))
8029 vty_out (vty
, " Neighbor under common administration%s", VTY_NEWLINE
);
8032 vty_out (vty
, " BGP state = %s", LOOKUP (bgp_status_msg
, p
->status
));
8034 if (p
->status
== Established
)
8035 vty_out (vty
, ", up for %8s", peer_uptime (p
->uptime
, timebuf
, BGP_UPTIME_LEN
, 0, NULL
));
8037 else if (p
->status
== Active
)
8039 if (CHECK_FLAG (p
->flags
, PEER_FLAG_PASSIVE
))
8040 vty_out (vty
, " (passive)");
8041 else if (CHECK_FLAG (p
->sflags
, PEER_STATUS_NSF_WAIT
))
8042 vty_out (vty
, " (NSF passive)");
8044 vty_out (vty
, "%s", VTY_NEWLINE
);
8047 vty_out (vty
, " Last read %s", peer_uptime (p
->readtime
, timebuf
, BGP_UPTIME_LEN
, 0, NULL
));
8048 vty_out (vty
, ", Last write %s%s",
8049 peer_uptime (p
->last_write
, timebuf
, BGP_UPTIME_LEN
, 0, NULL
), VTY_NEWLINE
);
8051 /* Configured timer values. */
8052 vty_out (vty
, " Hold time is %d, keepalive interval is %d seconds%s",
8053 p
->v_holdtime
, p
->v_keepalive
, VTY_NEWLINE
);
8054 if (CHECK_FLAG (p
->config
, PEER_CONFIG_TIMER
))
8056 vty_out (vty
, " Configured hold time is %d", p
->holdtime
);
8057 vty_out (vty
, ", keepalive interval is %d seconds%s",
8058 p
->keepalive
, VTY_NEWLINE
);
8062 if (p
->status
== Established
)
8065 || p
->afc_adv
[AFI_IP
][SAFI_UNICAST
]
8066 || p
->afc_recv
[AFI_IP
][SAFI_UNICAST
]
8067 || p
->afc_adv
[AFI_IP
][SAFI_MULTICAST
]
8068 || p
->afc_recv
[AFI_IP
][SAFI_MULTICAST
]
8070 || p
->afc_adv
[AFI_IP6
][SAFI_UNICAST
]
8071 || p
->afc_recv
[AFI_IP6
][SAFI_UNICAST
]
8072 || p
->afc_adv
[AFI_IP6
][SAFI_MULTICAST
]
8073 || p
->afc_recv
[AFI_IP6
][SAFI_MULTICAST
]
8074 || p
->afc_adv
[AFI_IP6
][SAFI_MPLS_VPN
]
8075 || p
->afc_recv
[AFI_IP6
][SAFI_MPLS_VPN
]
8076 || p
->afc_adv
[AFI_IP6
][SAFI_ENCAP
]
8077 || p
->afc_recv
[AFI_IP6
][SAFI_ENCAP
]
8078 #endif /* HAVE_IPV6 */
8079 || p
->afc_adv
[AFI_IP
][SAFI_ENCAP
]
8080 || p
->afc_recv
[AFI_IP
][SAFI_ENCAP
]
8081 || p
->afc_adv
[AFI_IP
][SAFI_MPLS_VPN
]
8082 || p
->afc_recv
[AFI_IP
][SAFI_MPLS_VPN
])
8086 json_object
*json_cap
= NULL
;
8088 json_cap
= json_object_new_object();
8091 if (CHECK_FLAG (p
->cap
, PEER_CAP_AS4_RCV
)
8092 || CHECK_FLAG (p
->cap
, PEER_CAP_AS4_ADV
))
8094 if (CHECK_FLAG (p
->cap
, PEER_CAP_AS4_ADV
) && CHECK_FLAG (p
->cap
, PEER_CAP_AS4_RCV
))
8095 json_object_string_add(json_cap
, "4byteAs", "advertisedAndReceived");
8096 else if (CHECK_FLAG (p
->cap
, PEER_CAP_AS4_ADV
))
8097 json_object_string_add(json_cap
, "4byteAs", "advertised");
8098 else if (CHECK_FLAG (p
->cap
, PEER_CAP_AS4_RCV
))
8099 json_object_string_add(json_cap
, "4byteAs", "received");
8103 if (CHECK_FLAG (p
->cap
, PEER_CAP_ADDPATH_RCV
)
8104 || CHECK_FLAG (p
->cap
, PEER_CAP_ADDPATH_ADV
))
8106 json_object
*json_add
= NULL
;
8107 const char *print_store
;
8109 json_add
= json_object_new_object();
8111 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
8112 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8114 json_object
*json_sub
= NULL
;
8115 json_sub
= json_object_new_object();
8116 print_store
= afi_safi_print (afi
, safi
);
8118 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_ADV
) ||
8119 CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_RCV
))
8121 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
))
8122 json_object_boolean_true_add(json_sub
, "txAdvertisedAndReceived");
8123 else if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_ADV
))
8124 json_object_boolean_true_add(json_sub
, "txAdvertised");
8125 else if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_RCV
))
8126 json_object_boolean_true_add(json_sub
, "txReceived");
8129 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_ADV
) ||
8130 CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_RCV
))
8132 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
))
8133 json_object_boolean_true_add(json_sub
, "rxAdvertisedAndReceived");
8134 else if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_ADV
))
8135 json_object_boolean_true_add(json_sub
, "rxAdvertised");
8136 else if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_RCV
))
8137 json_object_boolean_true_add(json_sub
, "rxReceived");
8140 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_ADV
) ||
8141 CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_RCV
) ||
8142 CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_ADV
) ||
8143 CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_RCV
))
8144 json_object_object_add(json_add
, print_store
, json_sub
);
8147 json_object_object_add(json_cap
, "addPath", json_add
);
8151 if (CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_RCV
)
8152 || CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_ADV
))
8154 if (CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_ADV
) && CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_RCV
))
8155 json_object_string_add(json_cap
, "dynamic", "advertisedAndReceived");
8156 else if (CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_ADV
))
8157 json_object_string_add(json_cap
, "dynamic", "advertised");
8158 else if (CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_RCV
))
8159 json_object_string_add(json_cap
, "dynamic", "received");
8162 /* Extended nexthop */
8163 if (CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_RCV
)
8164 || CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_ADV
))
8166 json_object
*json_nxt
= NULL
;
8167 const char *print_store
;
8169 json_nxt
= json_object_new_object();
8171 if (CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_ADV
) && CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_RCV
))
8172 json_object_string_add(json_cap
, "extendedNexthop", "advertisedAndReceived");
8173 else if (CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_ADV
))
8174 json_object_string_add(json_cap
, "extendedNexthop", "advertised");
8175 else if (CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_RCV
))
8176 json_object_string_add(json_cap
, "extendedNexthop", "received");
8178 if (CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_RCV
))
8180 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8182 if (CHECK_FLAG (p
->af_cap
[AFI_IP
][safi
], PEER_CAP_ENHE_AF_RCV
))
8184 print_store
= afi_safi_print (AFI_IP
, safi
);
8185 json_object_string_add(json_nxt
, print_store
, "recieved");
8188 json_object_object_add(json_cap
, "extendedNexthopFamililesByPeer", json_nxt
);
8193 if (CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_ADV
)
8194 || CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_NEW_RCV
)
8195 || CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_OLD_RCV
))
8197 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
)))
8199 if (CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_OLD_RCV
) && CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_NEW_RCV
))
8200 json_object_string_add(json_cap
, "routeRefresh", "advertisedAndReceivedOldNew");
8203 if (CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_OLD_RCV
))
8204 json_object_string_add(json_cap
, "routeRefresh", "advertisedAndReceivedOld");
8206 json_object_string_add(json_cap
, "routeRefresh", "advertisedAndReceivedNew");
8209 else if (CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_ADV
))
8210 json_object_string_add(json_cap
, "routeRefresh", "advertised");
8211 else if (CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_NEW_RCV
) || CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_OLD_RCV
))
8212 json_object_string_add(json_cap
, "routeRefresh", "received");
8215 /* Multiprotocol Extensions */
8216 json_object
*json_multi
= NULL
;
8217 json_multi
= json_object_new_object();
8219 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
8221 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8223 if (p
->afc_adv
[afi
][safi
] || p
->afc_recv
[afi
][safi
])
8225 json_object
*json_exten
= NULL
;
8226 json_exten
= json_object_new_object();
8228 if (p
->afc_adv
[afi
][safi
] && p
->afc_recv
[afi
][safi
])
8229 json_object_boolean_true_add(json_exten
, "advertisedAndReceived");
8230 else if (p
->afc_adv
[afi
][safi
])
8231 json_object_boolean_true_add(json_exten
, "advertised");
8232 else if (p
->afc_recv
[afi
][safi
])
8233 json_object_boolean_true_add(json_exten
, "received");
8235 json_object_object_add(json_multi
, afi_safi_print (afi
, safi
), json_exten
);
8239 json_object_object_add(json_cap
, "multiprotocolExtensions", json_multi
);
8241 /* Gracefull Restart */
8242 if (CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_RCV
)
8243 || CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_ADV
))
8245 if (CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_ADV
) && CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_RCV
))
8246 json_object_string_add(json_cap
, "gracefulRestart", "advertisedAndReceived");
8247 else if (CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_ADV
))
8248 json_object_string_add(json_cap
, "gracefulRestartCapability", "advertised");
8249 else if (CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_RCV
))
8250 json_object_string_add(json_cap
, "gracefulRestartCapability", "received");
8252 if (CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_RCV
))
8254 int restart_af_count
= 0;
8255 json_object
*json_restart
= NULL
;
8256 json_restart
= json_object_new_object();
8258 json_object_int_add(json_cap
, "gracefulRestartRemoteTimerMsecs", p
->v_gr_restart
* 1000);
8260 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
8262 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8264 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_RESTART_AF_RCV
))
8266 json_object
*json_sub
= NULL
;
8267 json_sub
= json_object_new_object();
8269 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_RESTART_AF_PRESERVE_RCV
))
8270 json_object_boolean_true_add(json_sub
, "preserved");
8272 json_object_object_add(json_restart
, afi_safi_print (afi
, safi
), json_sub
);
8276 if (! restart_af_count
)
8277 json_object_string_add(json_cap
, "addressFamiliesByPeer", "none");
8279 json_object_object_add(json_cap
, "addressFamiliesByPeer", json_restart
);
8282 json_object_object_add(json_neigh
, "neighborCapabilities", json_cap
);
8286 vty_out (vty
, " Neighbor capabilities:%s", VTY_NEWLINE
);
8289 if (CHECK_FLAG (p
->cap
, PEER_CAP_AS4_RCV
)
8290 || CHECK_FLAG (p
->cap
, PEER_CAP_AS4_ADV
))
8292 vty_out (vty
, " 4 Byte AS:");
8293 if (CHECK_FLAG (p
->cap
, PEER_CAP_AS4_ADV
))
8294 vty_out (vty
, " advertised");
8295 if (CHECK_FLAG (p
->cap
, PEER_CAP_AS4_RCV
))
8296 vty_out (vty
, " %sreceived",
8297 CHECK_FLAG (p
->cap
, PEER_CAP_AS4_ADV
) ? "and " : "");
8298 vty_out (vty
, "%s", VTY_NEWLINE
);
8302 if (CHECK_FLAG (p
->cap
, PEER_CAP_ADDPATH_RCV
)
8303 || CHECK_FLAG (p
->cap
, PEER_CAP_ADDPATH_ADV
))
8305 vty_out (vty
, " AddPath:%s", VTY_NEWLINE
);
8307 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
8308 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8310 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_ADV
) ||
8311 CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_RCV
))
8313 vty_out (vty
, " %s: TX ", afi_safi_print (afi
, safi
));
8315 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_ADV
))
8316 vty_out (vty
, "advertised %s", afi_safi_print (afi
, safi
));
8318 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_RCV
))
8319 vty_out (vty
, "%sreceived", CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_ADV
) ? " and " : "" );
8321 vty_out (vty
, "%s", VTY_NEWLINE
);
8324 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_ADV
) ||
8325 CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_RCV
))
8327 vty_out (vty
, " %s: RX ", afi_safi_print (afi
, safi
));
8329 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_ADV
))
8330 vty_out (vty
, "advertised %s", afi_safi_print (afi
, safi
));
8332 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_RCV
))
8333 vty_out (vty
, "%sreceived", CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_ADV
) ? " and " : "" );
8335 vty_out (vty
, "%s", VTY_NEWLINE
);
8341 if (CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_RCV
)
8342 || CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_ADV
))
8344 vty_out (vty
, " Dynamic:");
8345 if (CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_ADV
))
8346 vty_out (vty
, " advertised");
8347 if (CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_RCV
))
8348 vty_out (vty
, " %sreceived",
8349 CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_ADV
) ? "and " : "");
8350 vty_out (vty
, "%s", VTY_NEWLINE
);
8353 /* Extended nexthop */
8354 if (CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_RCV
)
8355 || CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_ADV
))
8357 vty_out (vty
, " Extended nexthop:");
8358 if (CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_ADV
))
8359 vty_out (vty
, " advertised");
8360 if (CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_RCV
))
8361 vty_out (vty
, " %sreceived",
8362 CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_ADV
) ? "and " : "");
8363 vty_out (vty
, "%s", VTY_NEWLINE
);
8365 if (CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_RCV
))
8367 vty_out (vty
, " Address families by peer:%s ", VTY_NEWLINE
);
8368 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8369 if (CHECK_FLAG (p
->af_cap
[AFI_IP
][safi
], PEER_CAP_ENHE_AF_RCV
))
8370 vty_out (vty
, " %s%s",
8371 afi_safi_print (AFI_IP
, safi
), VTY_NEWLINE
);
8376 if (CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_ADV
)
8377 || CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_NEW_RCV
)
8378 || CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_OLD_RCV
))
8380 vty_out (vty
, " Route refresh:");
8381 if (CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_ADV
))
8382 vty_out (vty
, " advertised");
8383 if (CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_NEW_RCV
)
8384 || CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_OLD_RCV
))
8385 vty_out (vty
, " %sreceived(%s)",
8386 CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_ADV
) ? "and " : "",
8387 (CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_OLD_RCV
)
8388 && CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_NEW_RCV
)) ?
8389 "old & new" : CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_OLD_RCV
) ? "old" : "new");
8391 vty_out (vty
, "%s", VTY_NEWLINE
);
8394 /* Multiprotocol Extensions */
8395 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
8396 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8397 if (p
->afc_adv
[afi
][safi
] || p
->afc_recv
[afi
][safi
])
8399 vty_out (vty
, " Address family %s:", afi_safi_print (afi
, safi
));
8400 if (p
->afc_adv
[afi
][safi
])
8401 vty_out (vty
, " advertised");
8402 if (p
->afc_recv
[afi
][safi
])
8403 vty_out (vty
, " %sreceived", p
->afc_adv
[afi
][safi
] ? "and " : "");
8404 vty_out (vty
, "%s", VTY_NEWLINE
);
8407 /* Hostname capability */
8408 if (CHECK_FLAG(p
->cap
, PEER_CAP_HOSTNAME_ADV
) ||
8409 CHECK_FLAG(p
->cap
, PEER_CAP_HOSTNAME_RCV
))
8411 vty_out (vty
, " Hostname Capability:");
8412 if (CHECK_FLAG (p
->cap
, PEER_CAP_HOSTNAME_ADV
))
8413 vty_out (vty
, " advertised");
8414 if (CHECK_FLAG (p
->cap
, PEER_CAP_HOSTNAME_RCV
))
8415 vty_out (vty
, " %sreceived",
8416 CHECK_FLAG (p
->cap
, PEER_CAP_HOSTNAME_ADV
) ? "and " : "");
8417 vty_out (vty
, "%s", VTY_NEWLINE
);
8420 /* Gracefull Restart */
8421 if (CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_RCV
)
8422 || CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_ADV
))
8424 vty_out (vty
, " Graceful Restart Capabilty:");
8425 if (CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_ADV
))
8426 vty_out (vty
, " advertised");
8427 if (CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_RCV
))
8428 vty_out (vty
, " %sreceived",
8429 CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_ADV
) ? "and " : "");
8430 vty_out (vty
, "%s", VTY_NEWLINE
);
8432 if (CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_RCV
))
8434 int restart_af_count
= 0;
8436 vty_out (vty
, " Remote Restart timer is %d seconds%s",
8437 p
->v_gr_restart
, VTY_NEWLINE
);
8438 vty_out (vty
, " Address families by peer:%s ", VTY_NEWLINE
);
8440 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
8441 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8442 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_RESTART_AF_RCV
))
8444 vty_out (vty
, "%s%s(%s)", restart_af_count
? ", " : "",
8445 afi_safi_print (afi
, safi
),
8446 CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_RESTART_AF_PRESERVE_RCV
) ?
8447 "preserved" : "not preserved");
8450 if (! restart_af_count
)
8451 vty_out (vty
, "none");
8452 vty_out (vty
, "%s", VTY_NEWLINE
);
8459 /* graceful restart information */
8460 if (CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_RCV
)
8464 json_object
*json_grace
= NULL
;
8465 json_object
*json_grace_send
= NULL
;
8466 json_object
*json_grace_recv
= NULL
;
8467 int eor_send_af_count
= 0;
8468 int eor_receive_af_count
= 0;
8472 json_grace
= json_object_new_object();
8473 json_grace_send
= json_object_new_object();
8474 json_grace_recv
= json_object_new_object();
8476 if (p
->status
== Established
)
8478 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
8480 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8482 if (CHECK_FLAG (p
->af_sflags
[afi
][safi
], PEER_STATUS_EOR_SEND
))
8484 json_object_boolean_true_add(json_grace_send
, afi_safi_print (afi
, safi
));
8485 eor_send_af_count
++;
8489 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
8491 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8493 if (CHECK_FLAG (p
->af_sflags
[afi
][safi
], PEER_STATUS_EOR_RECEIVED
))
8495 json_object_boolean_true_add(json_grace_recv
, afi_safi_print (afi
, safi
));
8496 eor_receive_af_count
++;
8502 json_object_object_add(json_grace
, "endOfRibSend", json_grace_send
);
8503 json_object_object_add(json_grace
, "endOfRibRecv", json_grace_recv
);
8505 if (p
->t_gr_restart
)
8506 json_object_int_add(json_grace
, "gracefulRestartTimerMsecs", thread_timer_remain_second (p
->t_gr_restart
) * 1000);
8509 json_object_int_add(json_grace
, "gracefulStalepathTimerMsecs", thread_timer_remain_second (p
->t_gr_stale
) * 1000);
8511 json_object_object_add(json_neigh
, "gracefulRestartInfo", json_grace
);
8515 vty_out (vty
, " Graceful restart informations:%s", VTY_NEWLINE
);
8516 if (p
->status
== Established
)
8518 vty_out (vty
, " End-of-RIB send: ");
8519 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
8521 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8523 if (CHECK_FLAG (p
->af_sflags
[afi
][safi
], PEER_STATUS_EOR_SEND
))
8525 vty_out (vty
, "%s%s", eor_send_af_count
? ", " : "",
8526 afi_safi_print (afi
, safi
));
8527 eor_send_af_count
++;
8531 vty_out (vty
, "%s", VTY_NEWLINE
);
8532 vty_out (vty
, " End-of-RIB received: ");
8533 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
8535 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8537 if (CHECK_FLAG (p
->af_sflags
[afi
][safi
], PEER_STATUS_EOR_RECEIVED
))
8539 vty_out (vty
, "%s%s", eor_receive_af_count
? ", " : "",
8540 afi_safi_print (afi
, safi
));
8541 eor_receive_af_count
++;
8545 vty_out (vty
, "%s", VTY_NEWLINE
);
8548 if (p
->t_gr_restart
)
8549 vty_out (vty
, " The remaining time of restart timer is %ld%s",
8550 thread_timer_remain_second (p
->t_gr_restart
), VTY_NEWLINE
);
8553 vty_out (vty
, " The remaining time of stalepath timer is %ld%s",
8554 thread_timer_remain_second (p
->t_gr_stale
), VTY_NEWLINE
);
8559 json_object
*json_stat
= NULL
;
8560 json_stat
= json_object_new_object();
8561 /* Packet counts. */
8562 json_object_int_add(json_stat
, "depthInq", 0);
8563 json_object_int_add(json_stat
, "depthOutq", (unsigned long) p
->obuf
->count
);
8564 json_object_int_add(json_stat
, "opensSent", p
->open_out
);
8565 json_object_int_add(json_stat
, "opensRecv", p
->open_in
);
8566 json_object_int_add(json_stat
, "notificationsSent", p
->notify_out
);
8567 json_object_int_add(json_stat
, "notificationsRecv", p
->notify_in
);
8568 json_object_int_add(json_stat
, "updatesSent", p
->update_out
);
8569 json_object_int_add(json_stat
, "updatesRecv", p
->update_in
);
8570 json_object_int_add(json_stat
, "keepalivesSent", p
->keepalive_out
);
8571 json_object_int_add(json_stat
, "keepalivesRecv", p
->keepalive_in
);
8572 json_object_int_add(json_stat
, "routeRefreshSent", p
->refresh_out
);
8573 json_object_int_add(json_stat
, "routeRefreshRecv", p
->refresh_in
);
8574 json_object_int_add(json_stat
, "capabilitySent", p
->dynamic_cap_out
);
8575 json_object_int_add(json_stat
, "capabilityRecv", p
->dynamic_cap_in
);
8576 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
);
8577 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
);
8578 json_object_object_add(json_neigh
, "messageStats", json_stat
);
8582 /* Packet counts. */
8583 vty_out (vty
, " Message statistics:%s", VTY_NEWLINE
);
8584 vty_out (vty
, " Inq depth is 0%s", VTY_NEWLINE
);
8585 vty_out (vty
, " Outq depth is %lu%s", (unsigned long) p
->obuf
->count
, VTY_NEWLINE
);
8586 vty_out (vty
, " Sent Rcvd%s", VTY_NEWLINE
);
8587 vty_out (vty
, " Opens: %10d %10d%s", p
->open_out
, p
->open_in
, VTY_NEWLINE
);
8588 vty_out (vty
, " Notifications: %10d %10d%s", p
->notify_out
, p
->notify_in
, VTY_NEWLINE
);
8589 vty_out (vty
, " Updates: %10d %10d%s", p
->update_out
, p
->update_in
, VTY_NEWLINE
);
8590 vty_out (vty
, " Keepalives: %10d %10d%s", p
->keepalive_out
, p
->keepalive_in
, VTY_NEWLINE
);
8591 vty_out (vty
, " Route Refresh: %10d %10d%s", p
->refresh_out
, p
->refresh_in
, VTY_NEWLINE
);
8592 vty_out (vty
, " Capability: %10d %10d%s", p
->dynamic_cap_out
, p
->dynamic_cap_in
, VTY_NEWLINE
);
8593 vty_out (vty
, " Total: %10d %10d%s", p
->open_out
+ p
->notify_out
+
8594 p
->update_out
+ p
->keepalive_out
+ p
->refresh_out
+ p
->dynamic_cap_out
,
8595 p
->open_in
+ p
->notify_in
+ p
->update_in
+ p
->keepalive_in
+ p
->refresh_in
+
8596 p
->dynamic_cap_in
, VTY_NEWLINE
);
8601 /* advertisement-interval */
8602 json_object_int_add(json_neigh
, "minBtwnAdvertisementRunsTimerMsecs", p
->v_routeadv
* 1000);
8604 /* Update-source. */
8605 if (p
->update_if
|| p
->update_source
)
8608 json_object_string_add(json_neigh
, "updateSource", p
->update_if
);
8609 else if (p
->update_source
)
8610 json_object_string_add(json_neigh
, "updateSource", sockunion2str (p
->update_source
, buf1
, SU_ADDRSTRLEN
));
8613 /* Default weight */
8614 if (CHECK_FLAG (p
->config
, PEER_CONFIG_WEIGHT
))
8615 json_object_int_add(json_neigh
, "defaultWeight", p
->weight
);
8620 /* advertisement-interval */
8621 vty_out (vty
, " Minimum time between advertisement runs is %d seconds%s",
8622 p
->v_routeadv
, VTY_NEWLINE
);
8624 /* Update-source. */
8625 if (p
->update_if
|| p
->update_source
)
8627 vty_out (vty
, " Update source is ");
8629 vty_out (vty
, "%s", p
->update_if
);
8630 else if (p
->update_source
)
8631 vty_out (vty
, "%s", sockunion2str (p
->update_source
, buf1
, SU_ADDRSTRLEN
));
8632 vty_out (vty
, "%s", VTY_NEWLINE
);
8635 /* Default weight */
8636 if (CHECK_FLAG (p
->config
, PEER_CONFIG_WEIGHT
))
8637 vty_out (vty
, " Default weight %d%s", p
->weight
, VTY_NEWLINE
);
8639 vty_out (vty
, "%s", VTY_NEWLINE
);
8642 /* Address Family Information */
8643 json_object
*json_hold
= NULL
;
8646 json_hold
= json_object_new_object();
8648 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
8649 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8650 if (p
->afc
[afi
][safi
])
8651 bgp_show_peer_afi (vty
, p
, afi
, safi
, use_json
, json_hold
);
8655 json_object_int_add(json_hold
, "connectionsEstablished", p
->established
);
8656 json_object_int_add(json_hold
, "connectionsDropped", p
->dropped
);
8659 vty_out (vty
, " Connections established %d; dropped %d%s", p
->established
, p
->dropped
,
8662 if (! p
->last_reset
)
8665 json_object_string_add(json_hold
, "lastReset", "never");
8667 vty_out (vty
, " Last reset never%s", VTY_NEWLINE
);
8676 uptime
= bgp_clock();
8677 uptime
-= p
->resettime
;
8678 tm
= gmtime(&uptime
);
8679 json_object_int_add(json_hold
, "lastResetTimerMsecs", (tm
->tm_sec
* 1000) + (tm
->tm_min
* 60000) + (tm
->tm_hour
* 3600000));
8680 json_object_string_add(json_hold
, "lastResetDueTo", peer_down_str
[(int) p
->last_reset
]);
8681 if (p
->last_reset_cause_size
)
8683 char errorcodesubcode_hexstr
[5];
8684 sprintf(errorcodesubcode_hexstr
, "%02X%02X", p
->notify
.code
, p
->notify
.subcode
);
8685 json_object_string_add(json_hold
, "lastErrorCodeSubcode", errorcodesubcode_hexstr
);
8690 vty_out (vty
, " Last reset %s, ",
8691 peer_uptime (p
->resettime
, timebuf
, BGP_UPTIME_LEN
, 0, NULL
));
8693 if (p
->last_reset
== PEER_DOWN_NOTIFY_SEND
||
8694 p
->last_reset
== PEER_DOWN_NOTIFY_RECEIVED
)
8696 code_str
= bgp_notify_code_str(p
->notify
.code
);
8697 subcode_str
= bgp_notify_subcode_str(p
->notify
.code
, p
->notify
.subcode
);
8698 vty_out (vty
, "due to NOTIFICATION %s (%s%s)%s",
8699 p
->last_reset
== PEER_DOWN_NOTIFY_SEND
? "sent" : "received",
8700 code_str
, subcode_str
, VTY_NEWLINE
);
8704 vty_out (vty
, "due to %s%s",
8705 peer_down_str
[(int) p
->last_reset
], VTY_NEWLINE
);
8708 if (p
->last_reset_cause_size
)
8710 msg
= p
->last_reset_cause
;
8711 vty_out(vty
, " Message received that caused BGP to send a NOTIFICATION:%s ", VTY_NEWLINE
);
8712 for (i
= 1; i
<= p
->last_reset_cause_size
; i
++)
8714 vty_out(vty
, "%02X", *msg
++);
8716 if (i
!= p
->last_reset_cause_size
)
8720 vty_out(vty
, "%s ", VTY_NEWLINE
);
8722 else if (i
% 4 == 0)
8728 vty_out(vty
, "%s", VTY_NEWLINE
);
8733 if (CHECK_FLAG (p
->sflags
, PEER_STATUS_PREFIX_OVERFLOW
))
8736 json_object_boolean_true_add(json_hold
, "prefixesConfigExceedMax");
8738 vty_out (vty
, " Peer had exceeded the max. no. of prefixes configured.%s", VTY_NEWLINE
);
8740 if (p
->t_pmax_restart
)
8744 json_object_boolean_true_add(json_hold
, "reducePrefixNumFrom");
8745 json_object_int_add(json_hold
, "restartInTimerMsec", thread_timer_remain_second (p
->t_pmax_restart
) * 1000);
8748 vty_out (vty
, " Reduce the no. of prefix from %s, will restart in %ld seconds%s",
8749 p
->host
, thread_timer_remain_second (p
->t_pmax_restart
),
8755 json_object_boolean_true_add(json_hold
, "reducePrefixNumAndClearIpBgp");
8757 vty_out (vty
, " Reduce the no. of prefix and clear ip bgp %s to restore peering%s",
8758 p
->host
, VTY_NEWLINE
);
8763 json_object_object_add(json_neigh
, "addressFamilyInfo", json_hold
);
8765 /* EBGP Multihop and GTSM */
8766 if (p
->sort
!= BGP_PEER_IBGP
)
8770 if (p
->gtsm_hops
> 0)
8771 json_object_int_add(json_neigh
, "externalBgpNbrMaxHopsAway", p
->gtsm_hops
);
8772 else if (p
->ttl
> 1)
8773 json_object_int_add(json_neigh
, "externalBgpNbrMaxHopsAway", p
->ttl
);
8777 if (p
->gtsm_hops
> 0)
8778 vty_out (vty
, " External BGP neighbor may be up to %d hops away.%s",
8779 p
->gtsm_hops
, VTY_NEWLINE
);
8780 else if (p
->ttl
> 1)
8781 vty_out (vty
, " External BGP neighbor may be up to %d hops away.%s",
8782 p
->ttl
, VTY_NEWLINE
);
8787 if (p
->gtsm_hops
> 0)
8790 json_object_int_add(json_neigh
, "internalBgpNbrMaxHopsAway", p
->gtsm_hops
);
8792 vty_out (vty
, " Internal BGP neighbor may be up to %d hops away.%s",
8793 p
->gtsm_hops
, VTY_NEWLINE
);
8797 /* Local address. */
8802 json_object_string_add(json_neigh
, "hostLocal", sockunion2str (p
->su_local
, buf1
, SU_ADDRSTRLEN
));
8803 json_object_int_add(json_neigh
, "portLocal", ntohs (p
->su_local
->sin
.sin_port
));
8806 vty_out (vty
, "Local host: %s, Local port: %d%s",
8807 sockunion2str (p
->su_local
, buf1
, SU_ADDRSTRLEN
),
8808 ntohs (p
->su_local
->sin
.sin_port
),
8812 /* Remote address. */
8817 json_object_string_add(json_neigh
, "hostForeign", sockunion2str (p
->su_remote
, buf1
, SU_ADDRSTRLEN
));
8818 json_object_int_add(json_neigh
, "portForeign", ntohs (p
->su_remote
->sin
.sin_port
));
8821 vty_out (vty
, "Foreign host: %s, Foreign port: %d%s",
8822 sockunion2str (p
->su_remote
, buf1
, SU_ADDRSTRLEN
),
8823 ntohs (p
->su_remote
->sin
.sin_port
),
8827 /* Nexthop display. */
8832 json_object_string_add(json_neigh
, "nexthop", inet_ntop (AF_INET
, &p
->nexthop
.v4
, buf1
, BUFSIZ
));
8834 json_object_string_add(json_neigh
, "nexthopGlobal", inet_ntop (AF_INET6
, &p
->nexthop
.v6_global
, buf1
, BUFSIZ
));
8835 json_object_string_add(json_neigh
, "nexthopLocal", inet_ntop (AF_INET6
, &p
->nexthop
.v6_local
, buf1
, BUFSIZ
));
8836 if (p
->shared_network
)
8837 json_object_string_add(json_neigh
, "bgpConnection", "sharedNetwork");
8839 json_object_string_add(json_neigh
, "bgpConnection", "nonSharedNetwork");
8840 #endif /* HAVE_IPV6 */
8844 vty_out (vty
, "Nexthop: %s%s",
8845 inet_ntop (AF_INET
, &p
->nexthop
.v4
, buf1
, BUFSIZ
),
8848 vty_out (vty
, "Nexthop global: %s%s",
8849 inet_ntop (AF_INET6
, &p
->nexthop
.v6_global
, buf1
, BUFSIZ
),
8851 vty_out (vty
, "Nexthop local: %s%s",
8852 inet_ntop (AF_INET6
, &p
->nexthop
.v6_local
, buf1
, BUFSIZ
),
8854 vty_out (vty
, "BGP connection: %s%s",
8855 p
->shared_network
? "shared network" : "non shared network",
8857 #endif /* HAVE_IPV6 */
8861 /* Timer information. */
8864 json_object_int_add(json_neigh
, "connectRetryTimer", p
->v_connect
);
8865 if (p
->status
== Established
&& p
->rtt
)
8866 json_object_int_add(json_neigh
, "estimatedRttInMsecs", p
->rtt
);
8868 json_object_int_add(json_neigh
, "nextStartTimerDueInMsecs", thread_timer_remain_second (p
->t_start
) * 1000);
8870 json_object_int_add(json_neigh
, "nextConnectTimerDueInMsecs", thread_timer_remain_second (p
->t_connect
) * 1000);
8873 json_object_int_add(json_neigh
, "mraiInterval", p
->v_routeadv
);
8874 json_object_int_add(json_neigh
, "mraiTimerExpireInMsecs", thread_timer_remain_second (p
->t_routeadv
) * 1000);
8878 json_object_string_add(json_neigh
, "readThread", "on");
8880 json_object_string_add(json_neigh
, "readThread", "off");
8882 json_object_string_add(json_neigh
, "writeThread", "on");
8884 json_object_string_add(json_neigh
, "writeThread", "off");
8888 vty_out (vty
, "BGP Connect Retry Timer in Seconds: %d%s",
8889 p
->v_connect
, VTY_NEWLINE
);
8890 if (p
->status
== Established
&& p
->rtt
)
8891 vty_out (vty
, "Estimated round trip time: %d ms%s",
8892 p
->rtt
, VTY_NEWLINE
);
8894 vty_out (vty
, "Next start timer due in %ld seconds%s",
8895 thread_timer_remain_second (p
->t_start
), VTY_NEWLINE
);
8897 vty_out (vty
, "Next connect timer due in %ld seconds%s",
8898 thread_timer_remain_second (p
->t_connect
), VTY_NEWLINE
);
8900 vty_out (vty
, "MRAI (interval %u) timer expires in %ld seconds%s",
8901 p
->v_routeadv
, thread_timer_remain_second (p
->t_routeadv
),
8904 vty_out (vty
, "Read thread: %s Write thread: %s%s",
8905 p
->t_read
? "on" : "off",
8906 p
->t_write
? "on" : "off",
8910 if (p
->notify
.code
== BGP_NOTIFY_OPEN_ERR
8911 && p
->notify
.subcode
== BGP_NOTIFY_OPEN_UNSUP_CAPBL
)
8912 bgp_capability_vty_out (vty
, p
, use_json
, json_neigh
);
8915 vty_out (vty
, "%s", VTY_NEWLINE
);
8917 /* BFD information. */
8918 bgp_bfd_show_info(vty
, p
, use_json
, json_neigh
);
8922 if (p
->conf_if
) /* Configured interface name. */
8923 json_object_object_add(json
, p
->conf_if
, json_neigh
);
8924 else /* Configured IP address. */
8925 json_object_object_add(json
, p
->host
, json_neigh
);
8930 bgp_show_neighbor (struct vty
*vty
, struct bgp
*bgp
, enum show_type type
,
8931 union sockunion
*su
, const char *conf_if
, u_char use_json
, json_object
*json
)
8933 struct listnode
*node
, *nnode
;
8937 for (ALL_LIST_ELEMENTS (bgp
->peer
, node
, nnode
, peer
))
8939 if (!CHECK_FLAG(peer
->flags
, PEER_FLAG_CONFIG_NODE
))
8945 bgp_show_peer (vty
, peer
, use_json
, json
);
8950 if ((peer
->conf_if
&& !strcmp(peer
->conf_if
, conf_if
)) ||
8951 (peer
->hostname
&& !strcmp(peer
->hostname
, conf_if
)))
8954 bgp_show_peer (vty
, peer
, use_json
, json
);
8959 if (sockunion_same (&peer
->su
, su
))
8962 bgp_show_peer (vty
, peer
, use_json
, json
);
8969 if (type
== show_peer
&& ! find
)
8972 json_object_boolean_true_add(json
, "bgpNoSuchNeighbor");
8974 vty_out (vty
, "%% No such neighbor%s", VTY_NEWLINE
);
8979 vty_out (vty
, "%s%s", json_object_to_json_string(json
), VTY_NEWLINE
);
8980 json_object_free(json
);
8984 vty_out (vty
, "%s", VTY_NEWLINE
);
8991 bgp_show_neighbor_vty (struct vty
*vty
, const char *name
,
8992 enum show_type type
, const char *ip_str
, u_char use_json
)
8997 json_object
*json
= NULL
;
9000 json
= json_object_new_object();
9004 bgp
= bgp_lookup_by_name (name
);
9009 json_object_boolean_true_add(json
, "bgpNoSuchInstance");
9010 vty_out (vty
, "%s%s", json_object_to_json_string(json
), VTY_NEWLINE
);
9011 json_object_free(json
);
9014 vty_out (vty
, "%% No such BGP instance exist%s", VTY_NEWLINE
);
9021 bgp
= bgp_get_default ();
9028 ret
= str2sockunion (ip_str
, &su
);
9030 bgp_show_neighbor (vty
, bgp
, type
, NULL
, ip_str
, use_json
, json
);
9032 bgp_show_neighbor (vty
, bgp
, type
, &su
, NULL
, use_json
, json
);
9036 bgp_show_neighbor (vty
, bgp
, type
, NULL
, NULL
, use_json
, json
);
9044 bgp_show_all_instances_neighbors_vty (struct vty
*vty
, u_char use_json
)
9046 struct listnode
*node
, *nnode
;
9048 json_object
*json
= NULL
;
9052 vty_out (vty
, "{%s", VTY_NEWLINE
);
9054 for (ALL_LIST_ELEMENTS (bm
->bgp
, node
, nnode
, bgp
))
9058 if (!(json
= json_object_new_object()))
9060 zlog_err("Unable to allocate memory for JSON object");
9062 "{\"error\": {\"message:\": \"Unable to allocate memory for JSON object\"}}}%s",
9067 json_object_int_add(json
, "vrfId",
9068 (bgp
->vrf_id
== VRF_UNKNOWN
)
9069 ? -1 : bgp
->vrf_id
);
9070 json_object_string_add(json
, "vrfName",
9071 (bgp
->inst_type
== BGP_INSTANCE_TYPE_DEFAULT
)
9072 ? "Default" : bgp
->name
);
9075 vty_out (vty
, ",%s", VTY_NEWLINE
);
9079 vty_out(vty
, "\"%s\":", (bgp
->inst_type
== BGP_INSTANCE_TYPE_DEFAULT
)
9080 ? "Default" : bgp
->name
);
9084 vty_out (vty
, "%sInstance %s:%s",
9086 (bgp
->inst_type
== BGP_INSTANCE_TYPE_DEFAULT
)
9087 ? "Default" : bgp
->name
,
9090 bgp_show_neighbor (vty
, bgp
, show_all
, NULL
, NULL
, use_json
, json
);
9094 vty_out (vty
, "}%s", VTY_NEWLINE
);
9097 /* "show ip bgp neighbors" commands. */
9098 DEFUN (show_ip_bgp_neighbors
,
9099 show_ip_bgp_neighbors_cmd
,
9100 "show [ip] bgp [<view|vrf> WORD] [<ipv4|ipv6>] neighbors [<A.B.C.D|X:X::X:X|WORD>] [json]",
9104 BGP_INSTANCE_ALL_HELP_STR
9107 "Detailed information on TCP and BGP neighbor connections\n"
9108 "Neighbor to display information about\n"
9109 "Neighbor to display information about\n"
9110 "Neighbor on bgp configured interface\n"
9111 "JavaScript Object Notation\n")
9114 int idx_view_vrf
= 3;
9118 char *sh_arg
= NULL
;
9119 enum show_type sh_type
;
9121 u_char uj
= use_json(argc
, argv
);
9123 if (!strmatch(argv
[idx_ip
]->text
, "ip"))
9129 if (strmatch(argv
[idx_view_vrf
]->text
, "view") || strmatch(argv
[idx_view_vrf
]->text
, "vrf"))
9130 vrf
= argv
[idx_vrf
]->arg
;
9133 idx_peer
= argc
- 2;
9135 idx_peer
= argc
- 1;
9137 if (strmatch(argv
[idx_peer
]->text
, "neighbors"))
9143 sh_type
= show_peer
;
9144 sh_arg
= argv
[idx_peer
]->arg
;
9147 return bgp_show_neighbor_vty (vty
, vrf
, sh_type
, sh_arg
, uj
);
9150 DEFUN (show_ip_bgp_instance_all_neighbors
,
9151 show_ip_bgp_instance_all_neighbors_cmd
,
9152 "show [ip] bgp <view|vrf> all neighbors [json]",
9156 BGP_INSTANCE_ALL_HELP_STR
9157 "Detailed information on TCP and BGP neighbor connections\n"
9158 "JavaScript Object Notation\n")
9160 u_char uj
= use_json(argc
, argv
);
9162 bgp_show_all_instances_neighbors_vty (vty
, uj
);
9166 /* Show BGP's AS paths internal data. There are both `show ip bgp
9167 paths' and `show ip mbgp paths'. Those functions results are the
9169 DEFUN (show_ip_bgp_paths
,
9170 show_ip_bgp_paths_cmd
,
9171 "show ip bgp paths",
9175 "Path information\n")
9177 vty_out (vty
, "Address Refcnt Path%s", VTY_NEWLINE
);
9178 aspath_print_all_vty (vty
);
9182 DEFUN (show_ip_bgp_ipv4_paths
,
9183 show_ip_bgp_ipv4_paths_cmd
,
9184 "show ip bgp ipv4 <unicast|multicast> paths",
9189 "Address Family modifier\n"
9190 "Address Family modifier\n"
9191 "Path information\n")
9193 vty_out (vty
, "Address Refcnt Path\r\n");
9194 aspath_print_all_vty (vty
);
9202 community_show_all_iterator (struct hash_backet
*backet
, struct vty
*vty
)
9204 struct community
*com
;
9206 com
= (struct community
*) backet
->data
;
9207 vty_out (vty
, "[%p] (%ld) %s%s", (void *)backet
, com
->refcnt
,
9208 community_str (com
), VTY_NEWLINE
);
9211 /* Show BGP's community internal data. */
9212 DEFUN (show_ip_bgp_community_info
,
9213 show_ip_bgp_community_info_cmd
,
9214 "show ip bgp community-info",
9218 "List all bgp community information\n")
9220 vty_out (vty
, "Address Refcnt Community%s", VTY_NEWLINE
);
9222 hash_iterate (community_hash (),
9223 (void (*) (struct hash_backet
*, void *))
9224 community_show_all_iterator
,
9230 DEFUN (show_ip_bgp_attr_info
,
9231 show_ip_bgp_attr_info_cmd
,
9232 "show ip bgp attribute-info",
9236 "List all bgp attribute information\n")
9238 attr_show_all (vty
);
9242 static int bgp_show_update_groups(struct vty
*vty
, const char *name
,
9249 bgp
= bgp_lookup_by_name (name
);
9251 bgp
= bgp_get_default ();
9254 update_group_show(bgp
, afi
, safi
, vty
, subgrp_id
);
9259 bgp_show_all_instances_updgrps_vty (struct vty
*vty
, afi_t afi
, safi_t safi
)
9261 struct listnode
*node
, *nnode
;
9264 for (ALL_LIST_ELEMENTS (bm
->bgp
, node
, nnode
, bgp
))
9266 vty_out (vty
, "%sInstance %s:%s",
9268 (bgp
->inst_type
== BGP_INSTANCE_TYPE_DEFAULT
) ? "Default" : bgp
->name
,
9270 update_group_show(bgp
, afi
, safi
, vty
, 0);
9274 DEFUN (show_ip_bgp_updgrps
,
9275 show_ip_bgp_updgrps_cmd
,
9276 "show [ip] bgp [<view|vrf> WORD] [<ipv4 unicast|ipv4 multicast|ipv6 unicast|vpnv4 unicast|encap unicast>] update-groups [SUBGROUP-ID]",
9280 BGP_INSTANCE_HELP_STR
9282 "Address Family modifier\n"
9284 "Address Family modifier\n"
9286 "Address Family modifier\n"
9288 "Address Family modifier\n"
9290 "Address Family modifier\n"
9291 "Detailed info about dynamic update groups\n"
9292 "Specific subgroup to display detailed info for\n")
9295 int idx_view_vrf
= 3;
9299 int idx_subgroup_id
= argc
- 1;
9303 uint64_t subgrp_id
= 0;
9306 * If the user does "show ip bgp" then we default the afi safi to ipv4 unicast.
9307 * If the user does "show bgp" then we default the afi safi to ipv6 unicast.
9308 * This may be over-written later in the command if they explicitly
9309 * specify an afi safi.
9311 if (strmatch(argv
[idx_ip
]->text
, "ip"))
9314 safi
= SAFI_UNICAST
;
9319 safi
= SAFI_UNICAST
;
9324 if (strmatch(argv
[idx_view_vrf
]->text
, "view") || strmatch(argv
[idx_view_vrf
]->text
, "vrf"))
9325 vrf
= argv
[idx_vrf
]->arg
;
9327 if (strmatch(argv
[idx_subgroup_id
]->text
, "update-groups"))
9329 idx_afi
= idx_subgroup_id
- 2;
9330 idx_safi
= idx_subgroup_id
- 1;
9334 VTY_GET_ULL("subgroup-id", subgrp_id
, argv
[idx_subgroup_id
]->arg
);
9335 idx_afi
= idx_subgroup_id
- 3;
9336 idx_safi
= idx_subgroup_id
- 2;
9339 bgp_get_argv_afi_safi (argv
, idx_afi
, idx_safi
, &afi
, &safi
);
9341 return (bgp_show_update_groups(vty
, vrf
, afi
, safi
, subgrp_id
));
9344 DEFUN (show_ip_bgp_instance_all_updgrps
,
9345 show_ip_bgp_instance_all_updgrps_cmd
,
9346 "show ip bgp <view|vrf> all update-groups",
9350 BGP_INSTANCE_ALL_HELP_STR
9351 "Detailed info about dynamic update groups\n")
9353 bgp_show_all_instances_updgrps_vty (vty
, AFI_IP
, SAFI_UNICAST
);
9357 DEFUN (show_bgp_instance_all_ipv6_updgrps
,
9358 show_bgp_instance_all_ipv6_updgrps_cmd
,
9359 "show bgp <view|vrf> all update-groups",
9362 BGP_INSTANCE_ALL_HELP_STR
9363 "Detailed info about v6 dynamic update groups\n")
9365 bgp_show_all_instances_updgrps_vty (vty
, AFI_IP6
, SAFI_UNICAST
);
9369 DEFUN (show_bgp_updgrps_stats
,
9370 show_bgp_updgrps_stats_cmd
,
9371 "show bgp update-groups statistics",
9374 "BGP update groups\n"
9379 bgp
= bgp_get_default();
9381 update_group_show_stats(bgp
, vty
);
9386 DEFUN (show_bgp_instance_updgrps_stats
,
9387 show_bgp_instance_updgrps_stats_cmd
,
9388 "show bgp <view|vrf> WORD update-groups statistics",
9391 BGP_INSTANCE_HELP_STR
9392 "BGP update groups\n"
9398 bgp
= bgp_lookup_by_name (argv
[idx_word
]->arg
);
9400 update_group_show_stats(bgp
, vty
);
9406 show_bgp_updgrps_adj_info_aux (struct vty
*vty
, const char *name
,
9407 afi_t afi
, safi_t safi
,
9408 const char *what
, uint64_t subgrp_id
)
9413 bgp
= bgp_lookup_by_name (name
);
9415 bgp
= bgp_get_default ();
9419 if (!strcmp(what
, "advertise-queue"))
9420 update_group_show_adj_queue(bgp
, afi
, safi
, vty
, subgrp_id
);
9421 else if (!strcmp(what
, "advertised-routes"))
9422 update_group_show_advertised(bgp
, afi
, safi
, vty
, subgrp_id
);
9423 else if (!strcmp(what
, "packet-queue"))
9424 update_group_show_packet_queue(bgp
, afi
, safi
, vty
, subgrp_id
);
9428 DEFUN (show_ip_bgp_updgrps_adj
,
9429 show_ip_bgp_updgrps_adj_cmd
,
9430 "show ip bgp update-groups <advertise-queue|advertised-routes|packet-queue>",
9434 "BGP update groups\n"
9435 "Advertisement queue\n"
9436 "Announced routes\n"
9441 show_bgp_updgrps_adj_info_aux(vty
, NULL
, AFI_IP
, SAFI_UNICAST
, argv
[idx_type
]->arg
, 0);
9445 DEFUN (show_ip_bgp_instance_updgrps_adj
,
9446 show_ip_bgp_instance_updgrps_adj_cmd
,
9447 "show ip bgp <view|vrf> WORD update-groups <advertise-queue|advertised-routes|packet-queue>",
9451 BGP_INSTANCE_HELP_STR
9452 "BGP update groups\n"
9453 "Advertisement queue\n"
9454 "Announced routes\n"
9460 show_bgp_updgrps_adj_info_aux(vty
, argv
[idx_word
]->arg
, AFI_IP
, SAFI_UNICAST
, argv
[idx_type
]->arg
, 0);
9464 DEFUN (show_bgp_updgrps_afi_adj
,
9465 show_bgp_updgrps_afi_adj_cmd
,
9466 "show bgp <ipv4|ipv6> <unicast|multicast> update-groups <advertise-queue|advertised-routes|packet-queue>",
9471 "Address Family modifier\n"
9472 "Address Family modifier\n"
9473 "BGP update groups\n"
9474 "Advertisement queue\n"
9475 "Announced routes\n"
9477 "Specific subgroup info wanted for\n")
9485 afi
= (strcmp(argv
[idx_afi
]->arg
, "ipv4") == 0) ? AFI_IP
: AFI_IP6
;
9486 safi
= (strncmp (argv
[idx_safi
]->arg
, "m", 1) == 0) ? SAFI_MULTICAST
: SAFI_UNICAST
;
9487 show_bgp_updgrps_adj_info_aux(vty
, NULL
, afi
, safi
, argv
[idx_type
]->arg
, 0);
9491 DEFUN (show_bgp_updgrps_adj
,
9492 show_bgp_updgrps_adj_cmd
,
9493 "show bgp update-groups <advertise-queue|advertised-routes|packet-queue>",
9496 "BGP update groups\n"
9497 "Advertisement queue\n"
9498 "Announced routes\n"
9502 show_bgp_updgrps_adj_info_aux(vty
, NULL
, AFI_IP6
, SAFI_UNICAST
, argv
[idx_type
]->arg
, 0);
9506 DEFUN (show_bgp_instance_updgrps_adj
,
9507 show_bgp_instance_updgrps_adj_cmd
,
9508 "show bgp <view|vrf> WORD update-groups <advertise-queue|advertised-routes|packet-queue>",
9511 BGP_INSTANCE_HELP_STR
9512 "BGP update groups\n"
9513 "Advertisement queue\n"
9514 "Announced routes\n"
9519 show_bgp_updgrps_adj_info_aux(vty
, argv
[idx_word
]->arg
, AFI_IP6
, SAFI_UNICAST
, argv
[idx_type
]->arg
, 0);
9523 DEFUN (show_ip_bgp_updgrps_adj_s
,
9524 show_ip_bgp_updgrps_adj_s_cmd
,
9525 "show ip bgp update-groups SUBGROUP-ID <advertise-queue|advertised-routes|packet-queue>",
9529 "BGP update groups\n"
9530 "Specific subgroup to display info for\n"
9531 "Advertisement queue\n"
9532 "Announced routes\n"
9536 int idx_subgroup_id
= 4;
9540 VTY_GET_ULL("subgroup-id", subgrp_id
, argv
[idx_subgroup_id
]->arg
);
9542 show_bgp_updgrps_adj_info_aux(vty
, NULL
, AFI_IP
, SAFI_UNICAST
, argv
[idx_type
]->arg
, subgrp_id
);
9546 DEFUN (show_ip_bgp_instance_updgrps_adj_s
,
9547 show_ip_bgp_instance_updgrps_adj_s_cmd
,
9548 "show ip bgp <view|vrf> WORD update-groups SUBGROUP-ID <advertise-queue|advertised-routes|packet-queue>",
9552 BGP_INSTANCE_HELP_STR
9553 "BGP update groups\n"
9554 "Specific subgroup to display info for\n"
9555 "Advertisement queue\n"
9556 "Announced routes\n"
9561 int idx_subgroup_id
= 6;
9565 VTY_GET_ULL("subgroup-id", subgrp_id
, argv
[idx_subgroup_id
]->arg
);
9567 show_bgp_updgrps_adj_info_aux(vty
, argv
[idx_vrf
]->arg
, AFI_IP
, SAFI_UNICAST
, argv
[idx_type
]->arg
, subgrp_id
);
9571 DEFUN (show_bgp_updgrps_afi_adj_s
,
9572 show_bgp_updgrps_afi_adj_s_cmd
,
9573 "show bgp <ipv4|ipv6> <unicast|multicast> update-groups SUBGROUP-ID <advertise-queue|advertised-routes|packet-queue>",
9578 "Address Family modifier\n"
9579 "Address Family modifier\n"
9580 "BGP update groups\n"
9581 "Specific subgroup to display info for\n"
9582 "Advertisement queue\n"
9583 "Announced routes\n"
9585 "Specific subgroup info wanted for\n")
9589 int idx_subgroup_id
= 5;
9595 afi
= (strmatch(argv
[idx_afi
]->text
, "ipv4")) ? AFI_IP
: AFI_IP6
;
9596 safi
= (strmatch(argv
[idx_safi
]->text
, "unicast")) ? SAFI_UNICAST
: SAFI_MULTICAST
;
9597 VTY_GET_ULL("subgroup-id", subgrp_id
, argv
[idx_subgroup_id
]->arg
);
9599 show_bgp_updgrps_adj_info_aux(vty
, NULL
, afi
, safi
, argv
[idx_type
]->arg
, subgrp_id
);
9603 DEFUN (show_bgp_updgrps_adj_s
,
9604 show_bgp_updgrps_adj_s_cmd
,
9605 "show bgp update-groups SUBGROUP-ID <advertise-queue|advertised-routes|packet-queue>",
9608 "BGP update groups\n"
9609 "Specific subgroup to display info for\n"
9610 "Advertisement queue\n"
9611 "Announced routes\n"
9614 int idx_subgroup_id
= 3;
9618 VTY_GET_ULL("subgroup-id", subgrp_id
, argv
[idx_subgroup_id
]->arg
);
9620 show_bgp_updgrps_adj_info_aux(vty
, NULL
, AFI_IP6
, SAFI_UNICAST
, argv
[idx_type
]->arg
, subgrp_id
);
9624 DEFUN (show_bgp_instance_updgrps_adj_s
,
9625 show_bgp_instance_updgrps_adj_s_cmd
,
9626 "show bgp <view|vrf> WORD update-groups SUBGROUP-ID <advertise-queue|advertised-routes|packet-queue>",
9629 BGP_INSTANCE_HELP_STR
9630 "BGP update groups\n"
9631 "Specific subgroup to display info for\n"
9632 "Advertisement queue\n"
9633 "Announced routes\n"
9637 int idx_subgroup_id
= 5;
9641 VTY_GET_ULL("subgroup-id", subgrp_id
, argv
[idx_subgroup_id
]->arg
);
9643 show_bgp_updgrps_adj_info_aux(vty
, argv
[idx_vrf
]->arg
, AFI_IP6
, SAFI_UNICAST
, argv
[idx_type
]->arg
, subgrp_id
);
9650 bgp_show_one_peer_group (struct vty
*vty
, struct peer_group
*group
)
9652 struct listnode
*node
, *nnode
;
9653 struct prefix
*range
;
9656 char buf
[PREFIX2STR_BUFFER
];
9659 const char *peer_status
;
9667 if (conf
->as_type
== AS_SPECIFIED
||
9668 conf
->as_type
== AS_EXTERNAL
) {
9669 vty_out (vty
, "%sBGP peer-group %s, remote AS %d%s",
9670 VTY_NEWLINE
, group
->name
, conf
->as
, VTY_NEWLINE
);
9671 } else if (conf
->as_type
== AS_INTERNAL
) {
9672 vty_out (vty
, "%sBGP peer-group %s, remote AS %d%s",
9673 VTY_NEWLINE
, group
->name
, group
->bgp
->as
, VTY_NEWLINE
);
9675 vty_out (vty
, "%sBGP peer-group %s%s",
9676 VTY_NEWLINE
, group
->name
, VTY_NEWLINE
);
9679 if ((group
->bgp
->as
== conf
->as
) || (conf
->as_type
== AS_INTERNAL
))
9680 vty_out (vty
, " Peer-group type is internal%s", VTY_NEWLINE
);
9682 vty_out (vty
, " Peer-group type is external%s", VTY_NEWLINE
);
9684 /* Display AFs configured. */
9685 vty_out (vty
, " Configured address-families:");
9686 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
9687 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
9689 if (conf
->afc
[afi
][safi
])
9692 vty_out (vty
, " %s;", afi_safi_print(afi
, safi
));
9696 vty_out (vty
, " none%s", VTY_NEWLINE
);
9698 vty_out (vty
, "%s", VTY_NEWLINE
);
9700 /* Display listen ranges (for dynamic neighbors), if any */
9701 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
9705 else if (afi
== AFI_IP6
)
9707 lr_count
= listcount(group
->listen_range
[afi
]);
9711 " %d %s listen range(s)%s",
9712 lr_count
, af_str
, VTY_NEWLINE
);
9715 for (ALL_LIST_ELEMENTS (group
->listen_range
[afi
], node
,
9718 prefix2str(range
, buf
, sizeof(buf
));
9719 vty_out(vty
, " %s%s", buf
, VTY_NEWLINE
);
9724 /* Display group members and their status */
9725 if (listcount(group
->peer
))
9727 vty_out (vty
, " Peer-group members:%s", VTY_NEWLINE
);
9728 for (ALL_LIST_ELEMENTS (group
->peer
, node
, nnode
, peer
))
9730 if (CHECK_FLAG (peer
->flags
, PEER_FLAG_SHUTDOWN
))
9731 peer_status
= "Idle (Admin)";
9732 else if (CHECK_FLAG (peer
->sflags
, PEER_STATUS_PREFIX_OVERFLOW
))
9733 peer_status
= "Idle (PfxCt)";
9735 peer_status
= LOOKUP(bgp_status_msg
, peer
->status
);
9737 dynamic
= peer_dynamic_neighbor(peer
);
9738 vty_out (vty
, " %s %s %s %s",
9739 peer
->host
, dynamic
? "(dynamic)" : "",
9740 peer_status
, VTY_NEWLINE
);
9747 /* Show BGP peer group's information. */
9748 enum show_group_type
9755 bgp_show_peer_group (struct vty
*vty
, struct bgp
*bgp
,
9756 enum show_group_type type
, const char *group_name
)
9758 struct listnode
*node
, *nnode
;
9759 struct peer_group
*group
;
9762 for (ALL_LIST_ELEMENTS (bgp
->group
, node
, nnode
, group
))
9766 case show_all_groups
:
9767 bgp_show_one_peer_group (vty
, group
);
9769 case show_peer_group
:
9770 if (group_name
&& (strcmp(group
->name
, group_name
) == 0))
9773 bgp_show_one_peer_group (vty
, group
);
9779 if (type
== show_peer_group
&& ! find
)
9780 vty_out (vty
, "%% No such peer-group%s", VTY_NEWLINE
);
9786 bgp_show_peer_group_vty (struct vty
*vty
, const char *name
,
9787 enum show_group_type type
, const char *group_name
)
9790 int ret
= CMD_SUCCESS
;
9793 bgp
= bgp_lookup_by_name (name
);
9795 bgp
= bgp_get_default ();
9799 vty_out (vty
, "%% No such BGP instance exist%s", VTY_NEWLINE
);
9803 ret
= bgp_show_peer_group (vty
, bgp
, type
, group_name
);
9808 DEFUN (show_ip_bgp_peer_groups
,
9809 show_ip_bgp_peer_groups_cmd
,
9810 "show ip bgp peer-group",
9814 "Detailed information on all BGP peer groups\n")
9816 return bgp_show_peer_group_vty (vty
, NULL
, show_all_groups
, NULL
);
9819 DEFUN (show_ip_bgp_instance_peer_groups
,
9820 show_ip_bgp_instance_peer_groups_cmd
,
9821 "show ip bgp <view|vrf> WORD peer-group",
9825 BGP_INSTANCE_HELP_STR
9826 "Detailed information on all BGP peer groups\n")
9829 return bgp_show_peer_group_vty (vty
, argv
[idx_word
]->arg
, show_all_groups
, NULL
);
9832 DEFUN (show_ip_bgp_peer_group
,
9833 show_ip_bgp_peer_group_cmd
,
9834 "show ip bgp peer-group WORD",
9838 "BGP peer-group name\n"
9839 "Detailed information on a BGP peer group\n")
9842 return bgp_show_peer_group_vty (vty
, NULL
, show_peer_group
, argv
[idx_word
]->arg
);
9845 DEFUN (show_ip_bgp_instance_peer_group
,
9846 show_ip_bgp_instance_peer_group_cmd
,
9847 "show ip bgp <view|vrf> WORD peer-group WORD",
9851 BGP_INSTANCE_HELP_STR
9852 "BGP peer-group name\n"
9853 "Detailed information on a BGP peer group\n")
9857 return bgp_show_peer_group_vty (vty
, argv
[idx_word
]->arg
, show_peer_group
, argv
[idx_word_2
]->arg
);
9860 /* Redistribute VTY commands. */
9862 DEFUN (bgp_redistribute_ipv4
,
9863 bgp_redistribute_ipv4_cmd
,
9864 "redistribute <kernel|connected|static|rip|ospf|isis|pim|table>",
9865 "Redistribute information from another routing protocol\n"
9866 QUAGGA_IP_REDIST_HELP_STR_BGPD
)
9868 int idx_protocol
= 1;
9871 type
= proto_redistnum (AFI_IP
, argv
[idx_protocol
]->arg
);
9872 if (type
< 0 || type
== ZEBRA_ROUTE_BGP
)
9874 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
9877 bgp_redist_add(vty
->index
, AFI_IP
, type
, 0);
9878 return bgp_redistribute_set (vty
->index
, AFI_IP
, type
, 0);
9881 DEFUN (bgp_redistribute_ipv4_rmap
,
9882 bgp_redistribute_ipv4_rmap_cmd
,
9883 "redistribute <kernel|connected|static|rip|ospf|isis|pim|table> route-map WORD",
9884 "Redistribute information from another routing protocol\n"
9885 QUAGGA_IP_REDIST_HELP_STR_BGPD
9886 "Route map reference\n"
9887 "Pointer to route-map entries\n")
9889 int idx_protocol
= 1;
9892 struct bgp_redist
*red
;
9894 type
= proto_redistnum (AFI_IP
, argv
[idx_protocol
]->arg
);
9895 if (type
< 0 || type
== ZEBRA_ROUTE_BGP
)
9897 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
9901 red
= bgp_redist_add(vty
->index
, AFI_IP
, type
, 0);
9902 bgp_redistribute_rmap_set (red
, argv
[idx_word
]->arg
);
9903 return bgp_redistribute_set (vty
->index
, AFI_IP
, type
, 0);
9906 DEFUN (bgp_redistribute_ipv4_metric
,
9907 bgp_redistribute_ipv4_metric_cmd
,
9908 "redistribute <kernel|connected|static|rip|ospf|isis|pim|table> metric (0-4294967295)",
9909 "Redistribute information from another routing protocol\n"
9910 QUAGGA_IP_REDIST_HELP_STR_BGPD
9911 "Metric for redistributed routes\n"
9914 int idx_protocol
= 1;
9918 struct bgp_redist
*red
;
9920 type
= proto_redistnum (AFI_IP
, argv
[idx_protocol
]->arg
);
9921 if (type
< 0 || type
== ZEBRA_ROUTE_BGP
)
9923 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
9926 VTY_GET_INTEGER ("metric", metric
, argv
[idx_number
]->arg
);
9928 red
= bgp_redist_add(vty
->index
, AFI_IP
, type
, 0);
9929 bgp_redistribute_metric_set(vty
->index
, red
, AFI_IP
, type
, metric
);
9930 return bgp_redistribute_set (vty
->index
, AFI_IP
, type
, 0);
9933 DEFUN (bgp_redistribute_ipv4_rmap_metric
,
9934 bgp_redistribute_ipv4_rmap_metric_cmd
,
9935 "redistribute <kernel|connected|static|rip|ospf|isis|pim|table> route-map WORD metric (0-4294967295)",
9936 "Redistribute information from another routing protocol\n"
9937 QUAGGA_IP_REDIST_HELP_STR_BGPD
9938 "Route map reference\n"
9939 "Pointer to route-map entries\n"
9940 "Metric for redistributed routes\n"
9943 int idx_protocol
= 1;
9948 struct bgp_redist
*red
;
9950 type
= proto_redistnum (AFI_IP
, argv
[idx_protocol
]->arg
);
9951 if (type
< 0 || type
== ZEBRA_ROUTE_BGP
)
9953 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
9956 VTY_GET_INTEGER ("metric", metric
, argv
[idx_number
]->arg
);
9958 red
= bgp_redist_add(vty
->index
, AFI_IP
, type
, 0);
9959 bgp_redistribute_rmap_set (red
, argv
[idx_word
]->arg
);
9960 bgp_redistribute_metric_set(vty
->index
, red
, AFI_IP
, type
, metric
);
9961 return bgp_redistribute_set (vty
->index
, AFI_IP
, type
, 0);
9964 DEFUN (bgp_redistribute_ipv4_metric_rmap
,
9965 bgp_redistribute_ipv4_metric_rmap_cmd
,
9966 "redistribute <kernel|connected|static|rip|ospf|isis|pim|table> metric (0-4294967295) route-map WORD",
9967 "Redistribute information from another routing protocol\n"
9968 QUAGGA_IP_REDIST_HELP_STR_BGPD
9969 "Metric for redistributed routes\n"
9971 "Route map reference\n"
9972 "Pointer to route-map entries\n")
9974 int idx_protocol
= 1;
9979 struct bgp_redist
*red
;
9981 type
= proto_redistnum (AFI_IP
, argv
[idx_protocol
]->arg
);
9982 if (type
< 0 || type
== ZEBRA_ROUTE_BGP
)
9984 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
9987 VTY_GET_INTEGER ("metric", metric
, argv
[idx_number
]->arg
);
9989 red
= bgp_redist_add(vty
->index
, AFI_IP
, type
, 0);
9990 bgp_redistribute_metric_set(vty
->index
, red
, AFI_IP
, type
, metric
);
9991 bgp_redistribute_rmap_set (red
, argv
[idx_word
]->arg
);
9992 return bgp_redistribute_set (vty
->index
, AFI_IP
, type
, 0);
9995 DEFUN (bgp_redistribute_ipv4_ospf
,
9996 bgp_redistribute_ipv4_ospf_cmd
,
9997 "redistribute <ospf|table> (1-65535)",
9998 "Redistribute information from another routing protocol\n"
9999 "Open Shortest Path First (OSPFv2)\n"
10000 "Non-main Kernel Routing Table\n"
10001 "Instance ID/Table ID\n")
10003 int idx_ospf_table
= 1;
10004 int idx_number
= 2;
10008 VTY_GET_INTEGER ("Instance ID", instance
, argv
[idx_number
]->arg
);
10010 if (strncmp(argv
[idx_ospf_table
]->arg
, "o", 1) == 0)
10011 protocol
= ZEBRA_ROUTE_OSPF
;
10013 protocol
= ZEBRA_ROUTE_TABLE
;
10015 bgp_redist_add(vty
->index
, AFI_IP
, protocol
, instance
);
10016 return bgp_redistribute_set (vty
->index
, AFI_IP
, protocol
, instance
);
10019 DEFUN (bgp_redistribute_ipv4_ospf_rmap
,
10020 bgp_redistribute_ipv4_ospf_rmap_cmd
,
10021 "redistribute <ospf|table> (1-65535) route-map WORD",
10022 "Redistribute information from another routing protocol\n"
10023 "Open Shortest Path First (OSPFv2)\n"
10024 "Non-main Kernel Routing Table\n"
10025 "Instance ID/Table ID\n"
10026 "Route map reference\n"
10027 "Pointer to route-map entries\n")
10029 int idx_ospf_table
= 1;
10030 int idx_number
= 2;
10032 struct bgp_redist
*red
;
10036 if (strncmp(argv
[idx_ospf_table
]->arg
, "o", 1) == 0)
10037 protocol
= ZEBRA_ROUTE_OSPF
;
10039 protocol
= ZEBRA_ROUTE_TABLE
;
10041 VTY_GET_INTEGER ("Instance ID", instance
, argv
[idx_number
]->arg
);
10042 red
= bgp_redist_add(vty
->index
, AFI_IP
, protocol
, instance
);
10043 bgp_redistribute_rmap_set (red
, argv
[idx_word
]->arg
);
10044 return bgp_redistribute_set (vty
->index
, AFI_IP
, protocol
, instance
);
10047 DEFUN (bgp_redistribute_ipv4_ospf_metric
,
10048 bgp_redistribute_ipv4_ospf_metric_cmd
,
10049 "redistribute <ospf|table> (1-65535) metric (0-4294967295)",
10050 "Redistribute information from another routing protocol\n"
10051 "Open Shortest Path First (OSPFv2)\n"
10052 "Non-main Kernel Routing Table\n"
10053 "Instance ID/Table ID\n"
10054 "Metric for redistributed routes\n"
10055 "Default metric\n")
10057 int idx_ospf_table
= 1;
10058 int idx_number
= 2;
10059 int idx_number_2
= 4;
10061 struct bgp_redist
*red
;
10065 if (strncmp(argv
[idx_ospf_table
]->arg
, "o", 1) == 0)
10066 protocol
= ZEBRA_ROUTE_OSPF
;
10068 protocol
= ZEBRA_ROUTE_TABLE
;
10070 VTY_GET_INTEGER ("Instance ID", instance
, argv
[idx_number
]->arg
);
10071 VTY_GET_INTEGER ("metric", metric
, argv
[idx_number_2
]->arg
);
10073 red
= bgp_redist_add(vty
->index
, AFI_IP
, protocol
, instance
);
10074 bgp_redistribute_metric_set(vty
->index
, red
, AFI_IP
, protocol
, metric
);
10075 return bgp_redistribute_set (vty
->index
, AFI_IP
, protocol
, instance
);
10078 DEFUN (bgp_redistribute_ipv4_ospf_rmap_metric
,
10079 bgp_redistribute_ipv4_ospf_rmap_metric_cmd
,
10080 "redistribute <ospf|table> (1-65535) route-map WORD metric (0-4294967295)",
10081 "Redistribute information from another routing protocol\n"
10082 "Open Shortest Path First (OSPFv2)\n"
10083 "Non-main Kernel Routing Table\n"
10084 "Instance ID/Table ID\n"
10085 "Route map reference\n"
10086 "Pointer to route-map entries\n"
10087 "Metric for redistributed routes\n"
10088 "Default metric\n")
10090 int idx_ospf_table
= 1;
10091 int idx_number
= 2;
10093 int idx_number_2
= 6;
10095 struct bgp_redist
*red
;
10099 if (strncmp(argv
[idx_ospf_table
]->arg
, "o", 1) == 0)
10100 protocol
= ZEBRA_ROUTE_OSPF
;
10102 protocol
= ZEBRA_ROUTE_TABLE
;
10104 VTY_GET_INTEGER ("Instance ID", instance
, argv
[idx_number
]->arg
);
10105 VTY_GET_INTEGER ("metric", metric
, argv
[idx_number_2
]->arg
);
10107 red
= bgp_redist_add(vty
->index
, AFI_IP
, protocol
, instance
);
10108 bgp_redistribute_rmap_set (red
, argv
[idx_word
]->arg
);
10109 bgp_redistribute_metric_set(vty
->index
, red
, AFI_IP
, protocol
, metric
);
10110 return bgp_redistribute_set (vty
->index
, AFI_IP
, protocol
, instance
);
10113 DEFUN (bgp_redistribute_ipv4_ospf_metric_rmap
,
10114 bgp_redistribute_ipv4_ospf_metric_rmap_cmd
,
10115 "redistribute <ospf|table> (1-65535) metric (0-4294967295) route-map WORD",
10116 "Redistribute information from another routing protocol\n"
10117 "Open Shortest Path First (OSPFv2)\n"
10118 "Non-main Kernel Routing Table\n"
10119 "Instance ID/Table ID\n"
10120 "Metric for redistributed routes\n"
10122 "Route map reference\n"
10123 "Pointer to route-map entries\n")
10125 int idx_ospf_table
= 1;
10126 int idx_number
= 2;
10127 int idx_number_2
= 4;
10130 struct bgp_redist
*red
;
10134 if (strncmp(argv
[idx_ospf_table
]->arg
, "o", 1) == 0)
10135 protocol
= ZEBRA_ROUTE_OSPF
;
10137 protocol
= ZEBRA_ROUTE_TABLE
;
10139 VTY_GET_INTEGER ("Instance ID", instance
, argv
[idx_number
]->arg
);
10140 VTY_GET_INTEGER ("metric", metric
, argv
[idx_number_2
]->arg
);
10142 red
= bgp_redist_add(vty
->index
, AFI_IP
, protocol
, instance
);
10143 bgp_redistribute_metric_set(vty
->index
, red
, AFI_IP
, protocol
, metric
);
10144 bgp_redistribute_rmap_set (red
, argv
[idx_word
]->arg
);
10145 return bgp_redistribute_set (vty
->index
, AFI_IP
, protocol
, instance
);
10149 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
10150 * "no redistribute (ospf|table) <1-65535> route-map WORD",
10152 * "Redistribute information from another routing protocol\n"
10153 * "Open Shortest Path First (OSPFv2)\n"
10154 * "Non-main Kernel Routing Table\n"
10155 * "Instance ID/Table ID\n"
10156 * "Route map reference\n"
10157 * "Pointer to route-map entries\n"
10159 * "no redistribute (ospf|table) <1-65535> metric <0-4294967295>",
10161 * "Redistribute information from another routing protocol\n"
10162 * "Open Shortest Path First (OSPFv2)\n"
10163 * "Non-main Kernel Routing Table\n"
10164 * "Instance ID/Table ID\n"
10165 * "Metric for redistributed routes\n"
10166 * "Default metric\n"
10168 * "no redistribute (ospf|table) <1-65535> route-map WORD metric <0-4294967295>",
10170 * "Redistribute information from another routing protocol\n"
10171 * "Open Shortest Path First (OSPFv2)\n"
10172 * "Non-main Kernel Routing Table\n"
10173 * "Instance ID/Table ID\n"
10174 * "Route map reference\n"
10175 * "Pointer to route-map entries\n"
10176 * "Metric for redistributed routes\n"
10177 * "Default metric\n"
10179 * "no redistribute (ospf|table) <1-65535> metric <0-4294967295> route-map WORD",
10181 * "Redistribute information from another routing protocol\n"
10182 * "Open Shortest Path First (OSPFv2)\n"
10183 * "Non-main Kernel Routing Table\n"
10184 * "Instance ID/Table ID\n"
10185 * "Metric for redistributed routes\n"
10186 * "Default metric\n"
10187 * "Route map reference\n"
10188 * "Pointer to route-map entries\n"
10191 DEFUN (no_bgp_redistribute_ipv4_ospf
,
10192 no_bgp_redistribute_ipv4_ospf_cmd
,
10193 "no redistribute <ospf|table> (1-65535)",
10195 "Redistribute information from another routing protocol\n"
10196 "Open Shortest Path First (OSPFv2)\n"
10197 "Non-main Kernel Routing Table\n"
10198 "Instance ID/Table ID\n")
10200 int idx_ospf_table
= 2;
10201 int idx_number
= 3;
10205 if (strncmp(argv
[idx_ospf_table
]->arg
, "o", 1) == 0)
10206 protocol
= ZEBRA_ROUTE_OSPF
;
10208 protocol
= ZEBRA_ROUTE_TABLE
;
10210 VTY_GET_INTEGER ("Instance ID", instance
, argv
[idx_number
]->arg
);
10211 return bgp_redistribute_unset (vty
->index
, AFI_IP
, protocol
, instance
);
10219 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
10220 * "no redistribute <kernel|connected|static|rip|ospf|isis|pim|table> metric <0-4294967295> route-map WORD",
10222 * "Redistribute information from another routing protocol\n"
10223 * QUAGGA_IP_REDIST_HELP_STR_BGPD
10224 * "Metric for redistributed routes\n"
10225 * "Default metric\n"
10226 * "Route map reference\n"
10227 * "Pointer to route-map entries\n"
10229 * "no redistribute <kernel|connected|static|rip|ospf|isis|pim|table> route-map WORD",
10231 * "Redistribute information from another routing protocol\n"
10232 * QUAGGA_IP_REDIST_HELP_STR_BGPD
10233 * "Route map reference\n"
10234 * "Pointer to route-map entries\n"
10236 * "no redistribute <kernel|connected|static|rip|ospf|isis|pim|table> route-map WORD metric <0-4294967295>",
10238 * "Redistribute information from another routing protocol\n"
10239 * QUAGGA_IP_REDIST_HELP_STR_BGPD
10240 * "Route map reference\n"
10241 * "Pointer to route-map entries\n"
10242 * "Metric for redistributed routes\n"
10243 * "Default metric\n"
10245 * "no redistribute <kernel|connected|static|rip|ospf|isis|pim|table> metric <0-4294967295>",
10247 * "Redistribute information from another routing protocol\n"
10248 * QUAGGA_IP_REDIST_HELP_STR_BGPD
10249 * "Metric for redistributed routes\n"
10250 * "Default metric\n"
10253 DEFUN (no_bgp_redistribute_ipv4
,
10254 no_bgp_redistribute_ipv4_cmd
,
10255 "no redistribute <kernel|connected|static|rip|ospf|isis|pim|table>",
10257 "Redistribute information from another routing protocol\n"
10258 QUAGGA_IP_REDIST_HELP_STR_BGPD
)
10260 int idx_protocol
= 2;
10263 type
= proto_redistnum (AFI_IP
, argv
[idx_protocol
]->arg
);
10264 if (type
< 0 || type
== ZEBRA_ROUTE_BGP
)
10266 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
10267 return CMD_WARNING
;
10269 return bgp_redistribute_unset (vty
->index
, AFI_IP
, type
, 0);
10277 DEFUN (bgp_redistribute_ipv6
,
10278 bgp_redistribute_ipv6_cmd
,
10279 "redistribute <kernel|connected|static|ripng|ospf6|isis|table>",
10280 "Redistribute information from another routing protocol\n"
10281 QUAGGA_IP6_REDIST_HELP_STR_BGPD
)
10283 int idx_protocol
= 1;
10286 type
= proto_redistnum (AFI_IP6
, argv
[idx_protocol
]->arg
);
10287 if (type
< 0 || type
== ZEBRA_ROUTE_BGP
)
10289 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
10290 return CMD_WARNING
;
10293 bgp_redist_add(vty
->index
, AFI_IP6
, type
, 0);
10294 return bgp_redistribute_set (vty
->index
, AFI_IP6
, type
, 0);
10297 DEFUN (bgp_redistribute_ipv6_rmap
,
10298 bgp_redistribute_ipv6_rmap_cmd
,
10299 "redistribute <kernel|connected|static|ripng|ospf6|isis|table> route-map WORD",
10300 "Redistribute information from another routing protocol\n"
10301 QUAGGA_IP6_REDIST_HELP_STR_BGPD
10302 "Route map reference\n"
10303 "Pointer to route-map entries\n")
10305 int idx_protocol
= 1;
10308 struct bgp_redist
*red
;
10310 type
= proto_redistnum (AFI_IP6
, argv
[idx_protocol
]->arg
);
10311 if (type
< 0 || type
== ZEBRA_ROUTE_BGP
)
10313 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
10314 return CMD_WARNING
;
10317 red
= bgp_redist_add(vty
->index
, AFI_IP6
, type
, 0);
10318 bgp_redistribute_rmap_set (red
, argv
[idx_word
]->arg
);
10319 return bgp_redistribute_set (vty
->index
, AFI_IP6
, type
, 0);
10322 DEFUN (bgp_redistribute_ipv6_metric
,
10323 bgp_redistribute_ipv6_metric_cmd
,
10324 "redistribute <kernel|connected|static|ripng|ospf6|isis|table> metric (0-4294967295)",
10325 "Redistribute information from another routing protocol\n"
10326 QUAGGA_IP6_REDIST_HELP_STR_BGPD
10327 "Metric for redistributed routes\n"
10328 "Default metric\n")
10330 int idx_protocol
= 1;
10331 int idx_number
= 3;
10334 struct bgp_redist
*red
;
10336 type
= proto_redistnum (AFI_IP6
, argv
[idx_protocol
]->arg
);
10337 if (type
< 0 || type
== ZEBRA_ROUTE_BGP
)
10339 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
10340 return CMD_WARNING
;
10342 VTY_GET_INTEGER ("metric", metric
, argv
[idx_number
]->arg
);
10344 red
= bgp_redist_add(vty
->index
, AFI_IP6
, type
, 0);
10345 bgp_redistribute_metric_set(vty
->index
, red
, AFI_IP6
, type
, metric
);
10346 return bgp_redistribute_set (vty
->index
, AFI_IP6
, type
, 0);
10349 DEFUN (bgp_redistribute_ipv6_rmap_metric
,
10350 bgp_redistribute_ipv6_rmap_metric_cmd
,
10351 "redistribute <kernel|connected|static|ripng|ospf6|isis|table> route-map WORD metric (0-4294967295)",
10352 "Redistribute information from another routing protocol\n"
10353 QUAGGA_IP6_REDIST_HELP_STR_BGPD
10354 "Route map reference\n"
10355 "Pointer to route-map entries\n"
10356 "Metric for redistributed routes\n"
10357 "Default metric\n")
10359 int idx_protocol
= 1;
10361 int idx_number
= 5;
10364 struct bgp_redist
*red
;
10366 type
= proto_redistnum (AFI_IP6
, argv
[idx_protocol
]->arg
);
10367 if (type
< 0 || type
== ZEBRA_ROUTE_BGP
)
10369 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
10370 return CMD_WARNING
;
10372 VTY_GET_INTEGER ("metric", metric
, argv
[idx_number
]->arg
);
10374 red
= bgp_redist_add(vty
->index
, AFI_IP6
, type
, 0);
10375 bgp_redistribute_rmap_set (red
, argv
[idx_word
]->arg
);
10376 bgp_redistribute_metric_set(vty
->index
, red
, AFI_IP6
, type
, metric
);
10377 return bgp_redistribute_set (vty
->index
, AFI_IP6
, type
, 0);
10380 DEFUN (bgp_redistribute_ipv6_metric_rmap
,
10381 bgp_redistribute_ipv6_metric_rmap_cmd
,
10382 "redistribute <kernel|connected|static|ripng|ospf6|isis|table> metric (0-4294967295) route-map WORD",
10383 "Redistribute information from another routing protocol\n"
10384 QUAGGA_IP6_REDIST_HELP_STR_BGPD
10385 "Metric for redistributed routes\n"
10387 "Route map reference\n"
10388 "Pointer to route-map entries\n")
10390 int idx_protocol
= 1;
10391 int idx_number
= 3;
10395 struct bgp_redist
*red
;
10397 type
= proto_redistnum (AFI_IP6
, argv
[idx_protocol
]->arg
);
10398 if (type
< 0 || type
== ZEBRA_ROUTE_BGP
)
10400 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
10401 return CMD_WARNING
;
10403 VTY_GET_INTEGER ("metric", metric
, argv
[idx_number
]->arg
);
10405 red
= bgp_redist_add(vty
->index
, AFI_IP6
, type
, 0);
10406 bgp_redistribute_metric_set(vty
->index
, red
, AFI_IP6
, SAFI_UNICAST
, metric
);
10407 bgp_redistribute_rmap_set (red
, argv
[idx_word
]->arg
);
10408 return bgp_redistribute_set (vty
->index
, AFI_IP6
, type
, 0);
10412 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
10413 * "no redistribute <kernel|connected|static|ripng|ospf6|isis|table> route-map WORD",
10415 * "Redistribute information from another routing protocol\n"
10416 * QUAGGA_IP6_REDIST_HELP_STR_BGPD
10417 * "Route map reference\n"
10418 * "Pointer to route-map entries\n"
10420 * "no redistribute <kernel|connected|static|ripng|ospf6|isis|table> route-map WORD metric <0-4294967295>",
10422 * "Redistribute information from another routing protocol\n"
10423 * QUAGGA_IP6_REDIST_HELP_STR_BGPD
10424 * "Route map reference\n"
10425 * "Pointer to route-map entries\n"
10426 * "Metric for redistributed routes\n"
10427 * "Default metric\n"
10429 * "no redistribute <kernel|connected|static|ripng|ospf6|isis|table> metric <0-4294967295> route-map WORD",
10431 * "Redistribute information from another routing protocol\n"
10432 * QUAGGA_IP6_REDIST_HELP_STR_BGPD
10433 * "Metric for redistributed routes\n"
10434 * "Default metric\n"
10435 * "Route map reference\n"
10436 * "Pointer to route-map entries\n"
10438 * "no redistribute <kernel|connected|static|ripng|ospf6|isis|table> metric <0-4294967295>",
10440 * "Redistribute information from another routing protocol\n"
10441 * QUAGGA_IP6_REDIST_HELP_STR_BGPD
10442 * "Metric for redistributed routes\n"
10443 * "Default metric\n"
10446 DEFUN (no_bgp_redistribute_ipv6
,
10447 no_bgp_redistribute_ipv6_cmd
,
10448 "no redistribute <kernel|connected|static|ripng|ospf6|isis|table>",
10450 "Redistribute information from another routing protocol\n"
10451 QUAGGA_IP6_REDIST_HELP_STR_BGPD
)
10453 int idx_protocol
= 2;
10456 type
= proto_redistnum (AFI_IP6
, argv
[idx_protocol
]->arg
);
10457 if (type
< 0 || type
== ZEBRA_ROUTE_BGP
)
10459 vty_out (vty
, "%% Invalid route type%s", VTY_NEWLINE
);
10460 return CMD_WARNING
;
10463 return bgp_redistribute_unset (vty
->index
, AFI_IP6
, type
, 0);
10469 #endif /* HAVE_IPV6 */
10472 bgp_config_write_redistribute (struct vty
*vty
, struct bgp
*bgp
, afi_t afi
,
10473 safi_t safi
, int *write
)
10477 /* Unicast redistribution only. */
10478 if (safi
!= SAFI_UNICAST
)
10481 for (i
= 0; i
< ZEBRA_ROUTE_MAX
; i
++)
10483 /* Redistribute BGP does not make sense. */
10484 if (i
!= ZEBRA_ROUTE_BGP
)
10486 struct list
*red_list
;
10487 struct listnode
*node
;
10488 struct bgp_redist
*red
;
10490 red_list
= bgp
->redist
[afi
][i
];
10494 for (ALL_LIST_ELEMENTS_RO(red_list
, node
, red
))
10496 /* Display "address-family" when it is not yet diplayed. */
10497 bgp_config_write_family_header (vty
, afi
, safi
, write
);
10499 /* "redistribute" configuration. */
10500 vty_out (vty
, " redistribute %s", zebra_route_string(i
));
10502 vty_out (vty
, " %d", red
->instance
);
10503 if (red
->redist_metric_flag
)
10504 vty_out (vty
, " metric %u", red
->redist_metric
);
10505 if (red
->rmap
.name
)
10506 vty_out (vty
, " route-map %s", red
->rmap
.name
);
10507 vty_out (vty
, "%s", VTY_NEWLINE
);
10514 /* BGP node structure. */
10515 static struct cmd_node bgp_node
=
10518 "%s(config-router)# ",
10522 static struct cmd_node bgp_ipv4_unicast_node
=
10525 "%s(config-router-af)# ",
10529 static struct cmd_node bgp_ipv4_multicast_node
=
10532 "%s(config-router-af)# ",
10536 static struct cmd_node bgp_ipv6_unicast_node
=
10539 "%s(config-router-af)# ",
10543 static struct cmd_node bgp_ipv6_multicast_node
=
10546 "%s(config-router-af)# ",
10550 static struct cmd_node bgp_vpnv4_node
=
10553 "%s(config-router-af)# ",
10557 static struct cmd_node bgp_vpnv6_node
=
10560 "%s(config-router-af-vpnv6)# ",
10564 static struct cmd_node bgp_encap_node
=
10567 "%s(config-router-af-encap)# ",
10571 static struct cmd_node bgp_encapv6_node
=
10574 "%s(config-router-af-encapv6)# ",
10578 static void community_list_vty (void);
10581 bgp_vty_init (void)
10583 /* Install bgp top node. */
10584 install_node (&bgp_node
, bgp_config_write
);
10585 install_node (&bgp_ipv4_unicast_node
, NULL
);
10586 install_node (&bgp_ipv4_multicast_node
, NULL
);
10587 install_node (&bgp_ipv6_unicast_node
, NULL
);
10588 install_node (&bgp_ipv6_multicast_node
, NULL
);
10589 install_node (&bgp_vpnv4_node
, NULL
);
10590 install_node (&bgp_vpnv6_node
, NULL
);
10591 install_node (&bgp_encap_node
, NULL
);
10592 install_node (&bgp_encapv6_node
, NULL
);
10594 /* Install default VTY commands to new nodes. */
10595 install_default (BGP_NODE
);
10596 install_default (BGP_IPV4_NODE
);
10597 install_default (BGP_IPV4M_NODE
);
10598 install_default (BGP_IPV6_NODE
);
10599 install_default (BGP_IPV6M_NODE
);
10600 install_default (BGP_VPNV4_NODE
);
10601 install_default (BGP_VPNV6_NODE
);
10602 install_default (BGP_ENCAP_NODE
);
10603 install_default (BGP_ENCAPV6_NODE
);
10605 /* "bgp multiple-instance" commands. */
10606 install_element (CONFIG_NODE
, &bgp_multiple_instance_cmd
);
10607 install_element (CONFIG_NODE
, &no_bgp_multiple_instance_cmd
);
10609 /* "bgp config-type" commands. */
10610 install_element (CONFIG_NODE
, &bgp_config_type_cmd
);
10612 /* bgp route-map delay-timer commands. */
10613 install_element (CONFIG_NODE
, &bgp_set_route_map_delay_timer_cmd
);
10614 install_element (CONFIG_NODE
, &no_bgp_set_route_map_delay_timer_cmd
);
10616 /* Dummy commands (Currently not supported) */
10617 install_element (BGP_NODE
, &no_synchronization_cmd
);
10618 install_element (BGP_NODE
, &no_auto_summary_cmd
);
10620 /* "router bgp" commands. */
10621 install_element (CONFIG_NODE
, &router_bgp_cmd
);
10623 /* "no router bgp" commands. */
10624 install_element (CONFIG_NODE
, &no_router_bgp_cmd
);
10626 /* "bgp router-id" commands. */
10627 install_element (BGP_NODE
, &bgp_router_id_cmd
);
10628 install_element (BGP_NODE
, &no_bgp_router_id_cmd
);
10630 /* "bgp cluster-id" commands. */
10631 install_element (BGP_NODE
, &bgp_cluster_id_cmd
);
10632 install_element (BGP_NODE
, &no_bgp_cluster_id_cmd
);
10634 /* "bgp confederation" commands. */
10635 install_element (BGP_NODE
, &bgp_confederation_identifier_cmd
);
10636 install_element (BGP_NODE
, &no_bgp_confederation_identifier_cmd
);
10638 /* "bgp confederation peers" commands. */
10639 install_element (BGP_NODE
, &bgp_confederation_peers_cmd
);
10640 install_element (BGP_NODE
, &no_bgp_confederation_peers_cmd
);
10642 /* bgp max-med command */
10643 install_element (BGP_NODE
, &bgp_maxmed_admin_cmd
);
10644 install_element (BGP_NODE
, &no_bgp_maxmed_admin_cmd
);
10645 install_element (BGP_NODE
, &bgp_maxmed_admin_medv_cmd
);
10646 install_element (BGP_NODE
, &bgp_maxmed_onstartup_cmd
);
10647 install_element (BGP_NODE
, &no_bgp_maxmed_onstartup_cmd
);
10648 install_element (BGP_NODE
, &bgp_maxmed_onstartup_medv_cmd
);
10650 /* bgp disable-ebgp-connected-nh-check */
10651 install_element (BGP_NODE
, &bgp_disable_connected_route_check_cmd
);
10652 install_element (BGP_NODE
, &no_bgp_disable_connected_route_check_cmd
);
10654 /* bgp update-delay command */
10655 install_element (BGP_NODE
, &bgp_update_delay_cmd
);
10656 install_element (BGP_NODE
, &no_bgp_update_delay_cmd
);
10657 install_element (BGP_NODE
, &bgp_update_delay_establish_wait_cmd
);
10659 install_element (BGP_NODE
, &bgp_wpkt_quanta_cmd
);
10660 install_element (BGP_NODE
, &no_bgp_wpkt_quanta_cmd
);
10662 install_element (BGP_NODE
, &bgp_coalesce_time_cmd
);
10663 install_element (BGP_NODE
, &no_bgp_coalesce_time_cmd
);
10665 /* "maximum-paths" commands. */
10666 install_element (BGP_NODE
, &bgp_maxpaths_cmd
);
10667 install_element (BGP_NODE
, &no_bgp_maxpaths_cmd
);
10668 install_element (BGP_IPV4_NODE
, &bgp_maxpaths_cmd
);
10669 install_element (BGP_IPV4_NODE
, &no_bgp_maxpaths_cmd
);
10670 install_element (BGP_IPV6_NODE
, &bgp_maxpaths_cmd
);
10671 install_element (BGP_IPV6_NODE
, &no_bgp_maxpaths_cmd
);
10672 install_element (BGP_NODE
, &bgp_maxpaths_ibgp_cmd
);
10673 install_element(BGP_NODE
, &bgp_maxpaths_ibgp_cluster_cmd
);
10674 install_element (BGP_NODE
, &no_bgp_maxpaths_ibgp_cmd
);
10675 install_element (BGP_IPV4_NODE
, &bgp_maxpaths_ibgp_cmd
);
10676 install_element(BGP_IPV4_NODE
, &bgp_maxpaths_ibgp_cluster_cmd
);
10677 install_element (BGP_IPV4_NODE
, &no_bgp_maxpaths_ibgp_cmd
);
10678 install_element (BGP_IPV6_NODE
, &bgp_maxpaths_ibgp_cmd
);
10679 install_element(BGP_IPV6_NODE
, &bgp_maxpaths_ibgp_cluster_cmd
);
10680 install_element (BGP_IPV6_NODE
, &no_bgp_maxpaths_ibgp_cmd
);
10682 /* "timers bgp" commands. */
10683 install_element (BGP_NODE
, &bgp_timers_cmd
);
10684 install_element (BGP_NODE
, &no_bgp_timers_cmd
);
10686 /* route-map delay-timer commands - per instance for backwards compat. */
10687 install_element (BGP_NODE
, &bgp_set_route_map_delay_timer_cmd
);
10688 install_element (BGP_NODE
, &no_bgp_set_route_map_delay_timer_cmd
);
10690 /* "bgp client-to-client reflection" commands */
10691 install_element (BGP_NODE
, &no_bgp_client_to_client_reflection_cmd
);
10692 install_element (BGP_NODE
, &bgp_client_to_client_reflection_cmd
);
10694 /* "bgp always-compare-med" commands */
10695 install_element (BGP_NODE
, &bgp_always_compare_med_cmd
);
10696 install_element (BGP_NODE
, &no_bgp_always_compare_med_cmd
);
10698 /* "bgp deterministic-med" commands */
10699 install_element (BGP_NODE
, &bgp_deterministic_med_cmd
);
10700 install_element (BGP_NODE
, &no_bgp_deterministic_med_cmd
);
10702 /* "bgp graceful-restart" commands */
10703 install_element (BGP_NODE
, &bgp_graceful_restart_cmd
);
10704 install_element (BGP_NODE
, &no_bgp_graceful_restart_cmd
);
10705 install_element (BGP_NODE
, &bgp_graceful_restart_stalepath_time_cmd
);
10706 install_element (BGP_NODE
, &no_bgp_graceful_restart_stalepath_time_cmd
);
10707 install_element (BGP_NODE
, &bgp_graceful_restart_restart_time_cmd
);
10708 install_element (BGP_NODE
, &no_bgp_graceful_restart_restart_time_cmd
);
10710 /* "bgp fast-external-failover" commands */
10711 install_element (BGP_NODE
, &bgp_fast_external_failover_cmd
);
10712 install_element (BGP_NODE
, &no_bgp_fast_external_failover_cmd
);
10714 /* "bgp enforce-first-as" commands */
10715 install_element (BGP_NODE
, &bgp_enforce_first_as_cmd
);
10716 install_element (BGP_NODE
, &no_bgp_enforce_first_as_cmd
);
10718 /* "bgp bestpath compare-routerid" commands */
10719 install_element (BGP_NODE
, &bgp_bestpath_compare_router_id_cmd
);
10720 install_element (BGP_NODE
, &no_bgp_bestpath_compare_router_id_cmd
);
10722 /* "bgp bestpath as-path ignore" commands */
10723 install_element (BGP_NODE
, &bgp_bestpath_aspath_ignore_cmd
);
10724 install_element (BGP_NODE
, &no_bgp_bestpath_aspath_ignore_cmd
);
10726 /* "bgp bestpath as-path confed" commands */
10727 install_element (BGP_NODE
, &bgp_bestpath_aspath_confed_cmd
);
10728 install_element (BGP_NODE
, &no_bgp_bestpath_aspath_confed_cmd
);
10730 /* "bgp bestpath as-path multipath-relax" commands */
10731 install_element (BGP_NODE
, &bgp_bestpath_aspath_multipath_relax_cmd
);
10732 install_element (BGP_NODE
, &no_bgp_bestpath_aspath_multipath_relax_cmd
);
10734 /* "bgp log-neighbor-changes" commands */
10735 install_element (BGP_NODE
, &bgp_log_neighbor_changes_cmd
);
10736 install_element (BGP_NODE
, &no_bgp_log_neighbor_changes_cmd
);
10738 /* "bgp bestpath med" commands */
10739 install_element (BGP_NODE
, &bgp_bestpath_med_cmd
);
10740 install_element (BGP_NODE
, &bgp_bestpath_med2_cmd
);
10741 install_element (BGP_NODE
, &no_bgp_bestpath_med_cmd
);
10742 install_element (BGP_NODE
, &no_bgp_bestpath_med2_cmd
);
10744 /* "no bgp default ipv4-unicast" commands. */
10745 install_element (BGP_NODE
, &no_bgp_default_ipv4_unicast_cmd
);
10746 install_element (BGP_NODE
, &bgp_default_ipv4_unicast_cmd
);
10748 /* "bgp network import-check" commands. */
10749 install_element (BGP_NODE
, &bgp_network_import_check_cmd
);
10750 install_element (BGP_NODE
, &bgp_network_import_check_exact_cmd
);
10751 install_element (BGP_NODE
, &no_bgp_network_import_check_cmd
);
10753 /* "bgp default local-preference" commands. */
10754 install_element (BGP_NODE
, &bgp_default_local_preference_cmd
);
10755 install_element (BGP_NODE
, &no_bgp_default_local_preference_cmd
);
10757 /* bgp default show-hostname */
10758 install_element (BGP_NODE
, &bgp_default_show_hostname_cmd
);
10759 install_element (BGP_NODE
, &no_bgp_default_show_hostname_cmd
);
10761 /* "bgp default subgroup-pkt-queue-max" commands. */
10762 install_element (BGP_NODE
, &bgp_default_subgroup_pkt_queue_max_cmd
);
10763 install_element (BGP_NODE
, &no_bgp_default_subgroup_pkt_queue_max_cmd
);
10765 /* bgp ibgp-allow-policy-mods command */
10766 install_element (BGP_NODE
, &bgp_rr_allow_outbound_policy_cmd
);
10767 install_element (BGP_NODE
, &no_bgp_rr_allow_outbound_policy_cmd
);
10769 /* "bgp listen limit" commands. */
10770 install_element (BGP_NODE
, &bgp_listen_limit_cmd
);
10771 install_element (BGP_NODE
, &no_bgp_listen_limit_cmd
);
10773 /* "bgp listen range" commands. */
10774 install_element (BGP_NODE
, &bgp_listen_range_cmd
);
10775 install_element (BGP_NODE
, &no_bgp_listen_range_cmd
);
10777 /* "neighbor remote-as" commands. */
10778 install_element (BGP_NODE
, &neighbor_remote_as_cmd
);
10779 install_element (BGP_NODE
, &neighbor_interface_config_cmd
);
10780 install_element (BGP_NODE
, &neighbor_interface_config_v6only_cmd
);
10781 install_element (BGP_NODE
, &neighbor_interface_config_remote_as_cmd
);
10782 install_element (BGP_NODE
, &neighbor_interface_v6only_config_remote_as_cmd
);
10783 install_element (BGP_NODE
, &no_neighbor_cmd
);
10784 install_element (BGP_NODE
, &no_neighbor_interface_config_cmd
);
10786 /* "neighbor peer-group" commands. */
10787 install_element (BGP_NODE
, &neighbor_peer_group_cmd
);
10788 install_element (BGP_NODE
, &no_neighbor_peer_group_cmd
);
10789 install_element (BGP_NODE
, &no_neighbor_interface_peer_group_remote_as_cmd
);
10791 /* "neighbor local-as" commands. */
10792 install_element (BGP_NODE
, &neighbor_local_as_cmd
);
10793 install_element (BGP_NODE
, &neighbor_local_as_no_prepend_cmd
);
10794 install_element (BGP_NODE
, &neighbor_local_as_no_prepend_replace_as_cmd
);
10795 install_element (BGP_NODE
, &no_neighbor_local_as_cmd
);
10797 /* "neighbor solo" commands. */
10798 install_element (BGP_NODE
, &neighbor_solo_cmd
);
10799 install_element (BGP_NODE
, &no_neighbor_solo_cmd
);
10801 /* "neighbor password" commands. */
10802 install_element (BGP_NODE
, &neighbor_password_cmd
);
10803 install_element (BGP_NODE
, &no_neighbor_password_cmd
);
10805 /* "neighbor activate" commands. */
10806 install_element (BGP_NODE
, &neighbor_activate_cmd
);
10807 install_element (BGP_IPV4_NODE
, &neighbor_activate_cmd
);
10808 install_element (BGP_IPV4M_NODE
, &neighbor_activate_cmd
);
10809 install_element (BGP_IPV6_NODE
, &neighbor_activate_cmd
);
10810 install_element (BGP_IPV6M_NODE
, &neighbor_activate_cmd
);
10811 install_element (BGP_VPNV4_NODE
, &neighbor_activate_cmd
);
10812 install_element (BGP_VPNV6_NODE
, &neighbor_activate_cmd
);
10813 install_element (BGP_ENCAP_NODE
, &neighbor_activate_cmd
);
10814 install_element (BGP_ENCAPV6_NODE
, &neighbor_activate_cmd
);
10816 /* "no neighbor activate" commands. */
10817 install_element (BGP_NODE
, &no_neighbor_activate_cmd
);
10818 install_element (BGP_IPV4_NODE
, &no_neighbor_activate_cmd
);
10819 install_element (BGP_IPV4M_NODE
, &no_neighbor_activate_cmd
);
10820 install_element (BGP_IPV6_NODE
, &no_neighbor_activate_cmd
);
10821 install_element (BGP_IPV6M_NODE
, &no_neighbor_activate_cmd
);
10822 install_element (BGP_VPNV4_NODE
, &no_neighbor_activate_cmd
);
10823 install_element (BGP_VPNV6_NODE
, &no_neighbor_activate_cmd
);
10824 install_element (BGP_ENCAP_NODE
, &no_neighbor_activate_cmd
);
10825 install_element (BGP_ENCAPV6_NODE
, &no_neighbor_activate_cmd
);
10827 /* "neighbor peer-group" set commands.
10828 * Long term we should only accept this command under BGP_NODE and not all of
10829 * the afi/safi sub-contexts. For now though we need to accept it for backwards
10830 * compatibility. This changed when we stopped requiring that peers be assigned
10831 * to their peer-group under each address-family sub-context.
10833 install_element (BGP_NODE
, &neighbor_set_peer_group_cmd
);
10834 install_element (BGP_IPV4_NODE
, &neighbor_set_peer_group_cmd
);
10835 install_element (BGP_IPV4M_NODE
, &neighbor_set_peer_group_cmd
);
10836 install_element (BGP_IPV6_NODE
, &neighbor_set_peer_group_cmd
);
10837 install_element (BGP_IPV6M_NODE
, &neighbor_set_peer_group_cmd
);
10838 install_element (BGP_VPNV4_NODE
, &neighbor_set_peer_group_cmd
);
10839 install_element (BGP_VPNV6_NODE
, &neighbor_set_peer_group_cmd
);
10840 install_element (BGP_ENCAP_NODE
, &neighbor_set_peer_group_cmd
);
10841 install_element (BGP_ENCAPV6_NODE
, &neighbor_set_peer_group_cmd
);
10843 /* "no neighbor peer-group unset" commands. */
10844 install_element (BGP_NODE
, &no_neighbor_set_peer_group_cmd
);
10845 install_element (BGP_IPV4_NODE
, &no_neighbor_set_peer_group_cmd
);
10846 install_element (BGP_IPV4M_NODE
, &no_neighbor_set_peer_group_cmd
);
10847 install_element (BGP_IPV6_NODE
, &no_neighbor_set_peer_group_cmd
);
10848 install_element (BGP_IPV6M_NODE
, &no_neighbor_set_peer_group_cmd
);
10849 install_element (BGP_VPNV4_NODE
, &no_neighbor_set_peer_group_cmd
);
10850 install_element (BGP_VPNV6_NODE
, &no_neighbor_set_peer_group_cmd
);
10851 install_element (BGP_ENCAP_NODE
, &no_neighbor_set_peer_group_cmd
);
10852 install_element (BGP_ENCAPV6_NODE
, &no_neighbor_set_peer_group_cmd
);
10854 /* "neighbor softreconfiguration inbound" commands.*/
10855 install_element (BGP_NODE
, &neighbor_soft_reconfiguration_cmd
);
10856 install_element (BGP_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
10857 install_element (BGP_IPV4_NODE
, &neighbor_soft_reconfiguration_cmd
);
10858 install_element (BGP_IPV4_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
10859 install_element (BGP_IPV4M_NODE
, &neighbor_soft_reconfiguration_cmd
);
10860 install_element (BGP_IPV4M_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
10861 install_element (BGP_IPV6_NODE
, &neighbor_soft_reconfiguration_cmd
);
10862 install_element (BGP_IPV6_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
10863 install_element (BGP_IPV6M_NODE
, &neighbor_soft_reconfiguration_cmd
);
10864 install_element (BGP_IPV6M_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
10865 install_element (BGP_VPNV4_NODE
, &neighbor_soft_reconfiguration_cmd
);
10866 install_element (BGP_VPNV4_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
10867 install_element (BGP_VPNV6_NODE
, &neighbor_soft_reconfiguration_cmd
);
10868 install_element (BGP_VPNV6_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
10869 install_element (BGP_ENCAP_NODE
, &neighbor_soft_reconfiguration_cmd
);
10870 install_element (BGP_ENCAP_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
10871 install_element (BGP_ENCAPV6_NODE
, &neighbor_soft_reconfiguration_cmd
);
10872 install_element (BGP_ENCAPV6_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
10874 /* "neighbor attribute-unchanged" commands. */
10875 install_element (BGP_NODE
, &neighbor_attr_unchanged_cmd
);
10876 install_element (BGP_NODE
, &neighbor_attr_unchanged1_cmd
);
10877 install_element (BGP_NODE
, &neighbor_attr_unchanged2_cmd
);
10878 install_element (BGP_NODE
, &neighbor_attr_unchanged3_cmd
);
10879 install_element (BGP_NODE
, &neighbor_attr_unchanged4_cmd
);
10880 install_element (BGP_NODE
, &no_neighbor_attr_unchanged_cmd
);
10881 install_element (BGP_NODE
, &no_neighbor_attr_unchanged1_cmd
);
10882 install_element (BGP_NODE
, &no_neighbor_attr_unchanged2_cmd
);
10883 install_element (BGP_NODE
, &no_neighbor_attr_unchanged3_cmd
);
10884 install_element (BGP_NODE
, &no_neighbor_attr_unchanged4_cmd
);
10885 install_element (BGP_IPV4_NODE
, &neighbor_attr_unchanged_cmd
);
10886 install_element (BGP_IPV4_NODE
, &neighbor_attr_unchanged1_cmd
);
10887 install_element (BGP_IPV4_NODE
, &neighbor_attr_unchanged2_cmd
);
10888 install_element (BGP_IPV4_NODE
, &neighbor_attr_unchanged3_cmd
);
10889 install_element (BGP_IPV4_NODE
, &neighbor_attr_unchanged4_cmd
);
10890 install_element (BGP_IPV4_NODE
, &no_neighbor_attr_unchanged_cmd
);
10891 install_element (BGP_IPV4_NODE
, &no_neighbor_attr_unchanged1_cmd
);
10892 install_element (BGP_IPV4_NODE
, &no_neighbor_attr_unchanged2_cmd
);
10893 install_element (BGP_IPV4_NODE
, &no_neighbor_attr_unchanged3_cmd
);
10894 install_element (BGP_IPV4_NODE
, &no_neighbor_attr_unchanged4_cmd
);
10895 install_element (BGP_IPV4M_NODE
, &neighbor_attr_unchanged_cmd
);
10896 install_element (BGP_IPV4M_NODE
, &neighbor_attr_unchanged1_cmd
);
10897 install_element (BGP_IPV4M_NODE
, &neighbor_attr_unchanged2_cmd
);
10898 install_element (BGP_IPV4M_NODE
, &neighbor_attr_unchanged3_cmd
);
10899 install_element (BGP_IPV4M_NODE
, &neighbor_attr_unchanged4_cmd
);
10900 install_element (BGP_IPV4M_NODE
, &no_neighbor_attr_unchanged_cmd
);
10901 install_element (BGP_IPV4M_NODE
, &no_neighbor_attr_unchanged1_cmd
);
10902 install_element (BGP_IPV4M_NODE
, &no_neighbor_attr_unchanged2_cmd
);
10903 install_element (BGP_IPV4M_NODE
, &no_neighbor_attr_unchanged3_cmd
);
10904 install_element (BGP_IPV4M_NODE
, &no_neighbor_attr_unchanged4_cmd
);
10905 install_element (BGP_IPV6_NODE
, &neighbor_attr_unchanged_cmd
);
10906 install_element (BGP_IPV6_NODE
, &neighbor_attr_unchanged1_cmd
);
10907 install_element (BGP_IPV6_NODE
, &neighbor_attr_unchanged2_cmd
);
10908 install_element (BGP_IPV6_NODE
, &neighbor_attr_unchanged3_cmd
);
10909 install_element (BGP_IPV6_NODE
, &neighbor_attr_unchanged4_cmd
);
10910 install_element (BGP_IPV6_NODE
, &no_neighbor_attr_unchanged_cmd
);
10911 install_element (BGP_IPV6_NODE
, &no_neighbor_attr_unchanged1_cmd
);
10912 install_element (BGP_IPV6_NODE
, &no_neighbor_attr_unchanged2_cmd
);
10913 install_element (BGP_IPV6_NODE
, &no_neighbor_attr_unchanged3_cmd
);
10914 install_element (BGP_IPV6_NODE
, &no_neighbor_attr_unchanged4_cmd
);
10915 install_element (BGP_IPV6M_NODE
, &neighbor_attr_unchanged_cmd
);
10916 install_element (BGP_IPV6M_NODE
, &neighbor_attr_unchanged1_cmd
);
10917 install_element (BGP_IPV6M_NODE
, &neighbor_attr_unchanged2_cmd
);
10918 install_element (BGP_IPV6M_NODE
, &neighbor_attr_unchanged3_cmd
);
10919 install_element (BGP_IPV6M_NODE
, &neighbor_attr_unchanged4_cmd
);
10920 install_element (BGP_IPV6M_NODE
, &no_neighbor_attr_unchanged_cmd
);
10921 install_element (BGP_IPV6M_NODE
, &no_neighbor_attr_unchanged1_cmd
);
10922 install_element (BGP_IPV6M_NODE
, &no_neighbor_attr_unchanged2_cmd
);
10923 install_element (BGP_IPV6M_NODE
, &no_neighbor_attr_unchanged3_cmd
);
10924 install_element (BGP_IPV6M_NODE
, &no_neighbor_attr_unchanged4_cmd
);
10925 install_element (BGP_VPNV4_NODE
, &neighbor_attr_unchanged_cmd
);
10926 install_element (BGP_VPNV4_NODE
, &neighbor_attr_unchanged1_cmd
);
10927 install_element (BGP_VPNV4_NODE
, &neighbor_attr_unchanged2_cmd
);
10928 install_element (BGP_VPNV4_NODE
, &neighbor_attr_unchanged3_cmd
);
10929 install_element (BGP_VPNV4_NODE
, &neighbor_attr_unchanged4_cmd
);
10930 install_element (BGP_VPNV4_NODE
, &no_neighbor_attr_unchanged_cmd
);
10931 install_element (BGP_VPNV4_NODE
, &no_neighbor_attr_unchanged1_cmd
);
10932 install_element (BGP_VPNV4_NODE
, &no_neighbor_attr_unchanged2_cmd
);
10933 install_element (BGP_VPNV4_NODE
, &no_neighbor_attr_unchanged3_cmd
);
10934 install_element (BGP_VPNV4_NODE
, &no_neighbor_attr_unchanged4_cmd
);
10935 install_element (BGP_VPNV6_NODE
, &neighbor_attr_unchanged_cmd
);
10936 install_element (BGP_VPNV6_NODE
, &neighbor_attr_unchanged1_cmd
);
10937 install_element (BGP_VPNV6_NODE
, &neighbor_attr_unchanged2_cmd
);
10938 install_element (BGP_VPNV6_NODE
, &neighbor_attr_unchanged3_cmd
);
10939 install_element (BGP_VPNV6_NODE
, &neighbor_attr_unchanged4_cmd
);
10940 install_element (BGP_VPNV6_NODE
, &no_neighbor_attr_unchanged_cmd
);
10941 install_element (BGP_VPNV6_NODE
, &no_neighbor_attr_unchanged1_cmd
);
10942 install_element (BGP_VPNV6_NODE
, &no_neighbor_attr_unchanged2_cmd
);
10943 install_element (BGP_VPNV6_NODE
, &no_neighbor_attr_unchanged3_cmd
);
10944 install_element (BGP_VPNV6_NODE
, &no_neighbor_attr_unchanged4_cmd
);
10946 install_element (BGP_ENCAP_NODE
, &neighbor_attr_unchanged_cmd
);
10947 install_element (BGP_ENCAP_NODE
, &neighbor_attr_unchanged1_cmd
);
10948 install_element (BGP_ENCAP_NODE
, &neighbor_attr_unchanged2_cmd
);
10949 install_element (BGP_ENCAP_NODE
, &neighbor_attr_unchanged3_cmd
);
10950 install_element (BGP_ENCAP_NODE
, &neighbor_attr_unchanged4_cmd
);
10951 install_element (BGP_ENCAP_NODE
, &no_neighbor_attr_unchanged_cmd
);
10952 install_element (BGP_ENCAP_NODE
, &no_neighbor_attr_unchanged1_cmd
);
10953 install_element (BGP_ENCAP_NODE
, &no_neighbor_attr_unchanged2_cmd
);
10954 install_element (BGP_ENCAP_NODE
, &no_neighbor_attr_unchanged3_cmd
);
10955 install_element (BGP_ENCAP_NODE
, &no_neighbor_attr_unchanged4_cmd
);
10957 install_element (BGP_ENCAPV6_NODE
, &neighbor_attr_unchanged_cmd
);
10958 install_element (BGP_ENCAPV6_NODE
, &neighbor_attr_unchanged1_cmd
);
10959 install_element (BGP_ENCAPV6_NODE
, &neighbor_attr_unchanged2_cmd
);
10960 install_element (BGP_ENCAPV6_NODE
, &neighbor_attr_unchanged3_cmd
);
10961 install_element (BGP_ENCAPV6_NODE
, &neighbor_attr_unchanged4_cmd
);
10962 install_element (BGP_ENCAPV6_NODE
, &no_neighbor_attr_unchanged_cmd
);
10963 install_element (BGP_ENCAPV6_NODE
, &no_neighbor_attr_unchanged1_cmd
);
10964 install_element (BGP_ENCAPV6_NODE
, &no_neighbor_attr_unchanged2_cmd
);
10965 install_element (BGP_ENCAPV6_NODE
, &no_neighbor_attr_unchanged3_cmd
);
10966 install_element (BGP_ENCAPV6_NODE
, &no_neighbor_attr_unchanged4_cmd
);
10968 /* "nexthop-local unchanged" commands */
10969 install_element (BGP_IPV6_NODE
, &neighbor_nexthop_local_unchanged_cmd
);
10970 install_element (BGP_IPV6_NODE
, &no_neighbor_nexthop_local_unchanged_cmd
);
10972 /* "neighbor next-hop-self" commands. */
10973 install_element (BGP_NODE
, &neighbor_nexthop_self_cmd
);
10974 install_element (BGP_NODE
, &no_neighbor_nexthop_self_cmd
);
10975 install_element (BGP_IPV4_NODE
, &neighbor_nexthop_self_cmd
);
10976 install_element (BGP_IPV4_NODE
, &no_neighbor_nexthop_self_cmd
);
10977 install_element (BGP_IPV4M_NODE
, &neighbor_nexthop_self_cmd
);
10978 install_element (BGP_IPV4M_NODE
, &no_neighbor_nexthop_self_cmd
);
10979 install_element (BGP_IPV6_NODE
, &neighbor_nexthop_self_cmd
);
10980 install_element (BGP_IPV6_NODE
, &no_neighbor_nexthop_self_cmd
);
10981 install_element (BGP_IPV6M_NODE
, &neighbor_nexthop_self_cmd
);
10982 install_element (BGP_IPV6M_NODE
, &no_neighbor_nexthop_self_cmd
);
10983 install_element (BGP_VPNV4_NODE
, &neighbor_nexthop_self_cmd
);
10984 install_element (BGP_VPNV4_NODE
, &no_neighbor_nexthop_self_cmd
);
10985 install_element (BGP_VPNV6_NODE
, &neighbor_nexthop_self_cmd
);
10986 install_element (BGP_VPNV6_NODE
, &no_neighbor_nexthop_self_cmd
);
10987 install_element (BGP_ENCAP_NODE
, &neighbor_nexthop_self_cmd
);
10988 install_element (BGP_ENCAP_NODE
, &no_neighbor_nexthop_self_cmd
);
10989 install_element (BGP_ENCAPV6_NODE
, &neighbor_nexthop_self_cmd
);
10990 install_element (BGP_ENCAPV6_NODE
, &no_neighbor_nexthop_self_cmd
);
10992 /* "neighbor next-hop-self force" commands. */
10993 install_element (BGP_NODE
, &neighbor_nexthop_self_force_cmd
);
10994 install_element (BGP_NODE
, &no_neighbor_nexthop_self_force_cmd
);
10995 install_element (BGP_IPV4_NODE
, &neighbor_nexthop_self_force_cmd
);
10996 install_element (BGP_IPV4_NODE
, &no_neighbor_nexthop_self_force_cmd
);
10997 install_element (BGP_IPV4M_NODE
, &neighbor_nexthop_self_force_cmd
);
10998 install_element (BGP_IPV4M_NODE
, &no_neighbor_nexthop_self_force_cmd
);
10999 install_element (BGP_IPV6_NODE
, &neighbor_nexthop_self_force_cmd
);
11000 install_element (BGP_IPV6_NODE
, &no_neighbor_nexthop_self_force_cmd
);
11001 install_element (BGP_IPV6M_NODE
, &neighbor_nexthop_self_force_cmd
);
11002 install_element (BGP_IPV6M_NODE
, &no_neighbor_nexthop_self_force_cmd
);
11003 install_element (BGP_VPNV4_NODE
, &neighbor_nexthop_self_force_cmd
);
11004 install_element (BGP_VPNV4_NODE
, &no_neighbor_nexthop_self_force_cmd
);
11005 install_element (BGP_VPNV6_NODE
, &neighbor_nexthop_self_force_cmd
);
11006 install_element (BGP_VPNV6_NODE
, &no_neighbor_nexthop_self_force_cmd
);
11008 /* "neighbor as-override" commands. */
11009 install_element (BGP_NODE
, &neighbor_as_override_cmd
);
11010 install_element (BGP_NODE
, &no_neighbor_as_override_cmd
);
11011 install_element (BGP_IPV4_NODE
, &neighbor_as_override_cmd
);
11012 install_element (BGP_IPV4_NODE
, &no_neighbor_as_override_cmd
);
11013 install_element (BGP_IPV4M_NODE
, &neighbor_as_override_cmd
);
11014 install_element (BGP_IPV4M_NODE
, &no_neighbor_as_override_cmd
);
11015 install_element (BGP_IPV6_NODE
, &neighbor_as_override_cmd
);
11016 install_element (BGP_IPV6_NODE
, &no_neighbor_as_override_cmd
);
11017 install_element (BGP_IPV6M_NODE
, &neighbor_as_override_cmd
);
11018 install_element (BGP_IPV6M_NODE
, &no_neighbor_as_override_cmd
);
11019 install_element (BGP_VPNV4_NODE
, &neighbor_as_override_cmd
);
11020 install_element (BGP_VPNV4_NODE
, &no_neighbor_as_override_cmd
);
11021 install_element (BGP_VPNV6_NODE
, &neighbor_as_override_cmd
);
11022 install_element (BGP_VPNV6_NODE
, &no_neighbor_as_override_cmd
);
11024 /* "neighbor remove-private-AS" commands. */
11025 install_element (BGP_NODE
, &neighbor_remove_private_as_cmd
);
11026 install_element (BGP_NODE
, &no_neighbor_remove_private_as_cmd
);
11027 install_element (BGP_NODE
, &neighbor_remove_private_as_all_cmd
);
11028 install_element (BGP_NODE
, &no_neighbor_remove_private_as_all_cmd
);
11029 install_element (BGP_NODE
, &neighbor_remove_private_as_replace_as_cmd
);
11030 install_element (BGP_NODE
, &no_neighbor_remove_private_as_replace_as_cmd
);
11031 install_element (BGP_NODE
, &neighbor_remove_private_as_all_replace_as_cmd
);
11032 install_element (BGP_NODE
, &no_neighbor_remove_private_as_all_replace_as_cmd
);
11033 install_element (BGP_IPV4_NODE
, &neighbor_remove_private_as_cmd
);
11034 install_element (BGP_IPV4_NODE
, &no_neighbor_remove_private_as_cmd
);
11035 install_element (BGP_IPV4_NODE
, &neighbor_remove_private_as_all_cmd
);
11036 install_element (BGP_IPV4_NODE
, &no_neighbor_remove_private_as_all_cmd
);
11037 install_element (BGP_IPV4_NODE
, &neighbor_remove_private_as_replace_as_cmd
);
11038 install_element (BGP_IPV4_NODE
, &no_neighbor_remove_private_as_replace_as_cmd
);
11039 install_element (BGP_IPV4_NODE
, &neighbor_remove_private_as_all_replace_as_cmd
);
11040 install_element (BGP_IPV4_NODE
, &no_neighbor_remove_private_as_all_replace_as_cmd
);
11041 install_element (BGP_IPV4M_NODE
, &neighbor_remove_private_as_cmd
);
11042 install_element (BGP_IPV4M_NODE
, &no_neighbor_remove_private_as_cmd
);
11043 install_element (BGP_IPV4M_NODE
, &neighbor_remove_private_as_all_cmd
);
11044 install_element (BGP_IPV4M_NODE
, &no_neighbor_remove_private_as_all_cmd
);
11045 install_element (BGP_IPV4M_NODE
, &neighbor_remove_private_as_replace_as_cmd
);
11046 install_element (BGP_IPV4M_NODE
, &no_neighbor_remove_private_as_replace_as_cmd
);
11047 install_element (BGP_IPV4M_NODE
, &neighbor_remove_private_as_all_replace_as_cmd
);
11048 install_element (BGP_IPV4M_NODE
, &no_neighbor_remove_private_as_all_replace_as_cmd
);
11049 install_element (BGP_IPV6_NODE
, &neighbor_remove_private_as_cmd
);
11050 install_element (BGP_IPV6_NODE
, &no_neighbor_remove_private_as_cmd
);
11051 install_element (BGP_IPV6_NODE
, &neighbor_remove_private_as_all_cmd
);
11052 install_element (BGP_IPV6_NODE
, &no_neighbor_remove_private_as_all_cmd
);
11053 install_element (BGP_IPV6_NODE
, &neighbor_remove_private_as_replace_as_cmd
);
11054 install_element (BGP_IPV6_NODE
, &no_neighbor_remove_private_as_replace_as_cmd
);
11055 install_element (BGP_IPV6_NODE
, &neighbor_remove_private_as_all_replace_as_cmd
);
11056 install_element (BGP_IPV6_NODE
, &no_neighbor_remove_private_as_all_replace_as_cmd
);
11057 install_element (BGP_IPV6M_NODE
, &neighbor_remove_private_as_cmd
);
11058 install_element (BGP_IPV6M_NODE
, &no_neighbor_remove_private_as_cmd
);
11059 install_element (BGP_IPV6M_NODE
, &neighbor_remove_private_as_all_cmd
);
11060 install_element (BGP_IPV6M_NODE
, &no_neighbor_remove_private_as_all_cmd
);
11061 install_element (BGP_IPV6M_NODE
, &neighbor_remove_private_as_replace_as_cmd
);
11062 install_element (BGP_IPV6M_NODE
, &no_neighbor_remove_private_as_replace_as_cmd
);
11063 install_element (BGP_IPV6M_NODE
, &neighbor_remove_private_as_all_replace_as_cmd
);
11064 install_element (BGP_IPV6M_NODE
, &no_neighbor_remove_private_as_all_replace_as_cmd
);
11065 install_element (BGP_VPNV4_NODE
, &neighbor_remove_private_as_cmd
);
11066 install_element (BGP_VPNV4_NODE
, &no_neighbor_remove_private_as_cmd
);
11067 install_element (BGP_VPNV4_NODE
, &neighbor_remove_private_as_all_cmd
);
11068 install_element (BGP_VPNV4_NODE
, &no_neighbor_remove_private_as_all_cmd
);
11069 install_element (BGP_VPNV4_NODE
, &neighbor_remove_private_as_replace_as_cmd
);
11070 install_element (BGP_VPNV4_NODE
, &no_neighbor_remove_private_as_replace_as_cmd
);
11071 install_element (BGP_VPNV4_NODE
, &neighbor_remove_private_as_all_replace_as_cmd
);
11072 install_element (BGP_VPNV4_NODE
, &no_neighbor_remove_private_as_all_replace_as_cmd
);
11073 install_element (BGP_VPNV6_NODE
, &neighbor_remove_private_as_cmd
);
11074 install_element (BGP_VPNV6_NODE
, &no_neighbor_remove_private_as_cmd
);
11075 install_element (BGP_VPNV6_NODE
, &neighbor_remove_private_as_all_cmd
);
11076 install_element (BGP_VPNV6_NODE
, &no_neighbor_remove_private_as_all_cmd
);
11077 install_element (BGP_VPNV6_NODE
, &neighbor_remove_private_as_replace_as_cmd
);
11078 install_element (BGP_VPNV6_NODE
, &no_neighbor_remove_private_as_replace_as_cmd
);
11079 install_element (BGP_VPNV6_NODE
, &neighbor_remove_private_as_all_replace_as_cmd
);
11080 install_element (BGP_VPNV6_NODE
, &no_neighbor_remove_private_as_all_replace_as_cmd
);
11081 install_element (BGP_ENCAP_NODE
, &neighbor_remove_private_as_cmd
);
11082 install_element (BGP_ENCAP_NODE
, &no_neighbor_remove_private_as_cmd
);
11083 install_element (BGP_ENCAPV6_NODE
, &neighbor_remove_private_as_cmd
);
11084 install_element (BGP_ENCAPV6_NODE
, &no_neighbor_remove_private_as_cmd
);
11086 /* "neighbor send-community" commands.*/
11087 install_element (BGP_NODE
, &neighbor_send_community_cmd
);
11088 install_element (BGP_NODE
, &neighbor_send_community_type_cmd
);
11089 install_element (BGP_NODE
, &no_neighbor_send_community_cmd
);
11090 install_element (BGP_NODE
, &no_neighbor_send_community_type_cmd
);
11091 install_element (BGP_IPV4_NODE
, &neighbor_send_community_cmd
);
11092 install_element (BGP_IPV4_NODE
, &neighbor_send_community_type_cmd
);
11093 install_element (BGP_IPV4_NODE
, &no_neighbor_send_community_cmd
);
11094 install_element (BGP_IPV4_NODE
, &no_neighbor_send_community_type_cmd
);
11095 install_element (BGP_IPV4M_NODE
, &neighbor_send_community_cmd
);
11096 install_element (BGP_IPV4M_NODE
, &neighbor_send_community_type_cmd
);
11097 install_element (BGP_IPV4M_NODE
, &no_neighbor_send_community_cmd
);
11098 install_element (BGP_IPV4M_NODE
, &no_neighbor_send_community_type_cmd
);
11099 install_element (BGP_IPV6_NODE
, &neighbor_send_community_cmd
);
11100 install_element (BGP_IPV6_NODE
, &neighbor_send_community_type_cmd
);
11101 install_element (BGP_IPV6_NODE
, &no_neighbor_send_community_cmd
);
11102 install_element (BGP_IPV6_NODE
, &no_neighbor_send_community_type_cmd
);
11103 install_element (BGP_IPV6M_NODE
, &neighbor_send_community_cmd
);
11104 install_element (BGP_IPV6M_NODE
, &neighbor_send_community_type_cmd
);
11105 install_element (BGP_IPV6M_NODE
, &no_neighbor_send_community_cmd
);
11106 install_element (BGP_IPV6M_NODE
, &no_neighbor_send_community_type_cmd
);
11107 install_element (BGP_VPNV4_NODE
, &neighbor_send_community_cmd
);
11108 install_element (BGP_VPNV4_NODE
, &neighbor_send_community_type_cmd
);
11109 install_element (BGP_VPNV4_NODE
, &no_neighbor_send_community_cmd
);
11110 install_element (BGP_VPNV4_NODE
, &no_neighbor_send_community_type_cmd
);
11111 install_element (BGP_VPNV6_NODE
, &neighbor_send_community_cmd
);
11112 install_element (BGP_VPNV6_NODE
, &neighbor_send_community_type_cmd
);
11113 install_element (BGP_VPNV6_NODE
, &no_neighbor_send_community_cmd
);
11114 install_element (BGP_VPNV6_NODE
, &no_neighbor_send_community_type_cmd
);
11115 install_element (BGP_ENCAP_NODE
, &neighbor_send_community_cmd
);
11116 install_element (BGP_ENCAP_NODE
, &neighbor_send_community_type_cmd
);
11117 install_element (BGP_ENCAP_NODE
, &no_neighbor_send_community_cmd
);
11118 install_element (BGP_ENCAP_NODE
, &no_neighbor_send_community_type_cmd
);
11119 install_element (BGP_ENCAPV6_NODE
, &neighbor_send_community_cmd
);
11120 install_element (BGP_ENCAPV6_NODE
, &neighbor_send_community_type_cmd
);
11121 install_element (BGP_ENCAPV6_NODE
, &no_neighbor_send_community_cmd
);
11122 install_element (BGP_ENCAPV6_NODE
, &no_neighbor_send_community_type_cmd
);
11124 /* "neighbor route-reflector" commands.*/
11125 install_element (BGP_NODE
, &neighbor_route_reflector_client_cmd
);
11126 install_element (BGP_NODE
, &no_neighbor_route_reflector_client_cmd
);
11127 install_element (BGP_IPV4_NODE
, &neighbor_route_reflector_client_cmd
);
11128 install_element (BGP_IPV4_NODE
, &no_neighbor_route_reflector_client_cmd
);
11129 install_element (BGP_IPV4M_NODE
, &neighbor_route_reflector_client_cmd
);
11130 install_element (BGP_IPV4M_NODE
, &no_neighbor_route_reflector_client_cmd
);
11131 install_element (BGP_IPV6_NODE
, &neighbor_route_reflector_client_cmd
);
11132 install_element (BGP_IPV6_NODE
, &no_neighbor_route_reflector_client_cmd
);
11133 install_element (BGP_IPV6M_NODE
, &neighbor_route_reflector_client_cmd
);
11134 install_element (BGP_IPV6M_NODE
, &no_neighbor_route_reflector_client_cmd
);
11135 install_element (BGP_VPNV4_NODE
, &neighbor_route_reflector_client_cmd
);
11136 install_element (BGP_VPNV4_NODE
, &no_neighbor_route_reflector_client_cmd
);
11137 install_element (BGP_VPNV6_NODE
, &neighbor_route_reflector_client_cmd
);
11138 install_element (BGP_VPNV6_NODE
, &no_neighbor_route_reflector_client_cmd
);
11139 install_element (BGP_ENCAP_NODE
, &neighbor_route_reflector_client_cmd
);
11140 install_element (BGP_ENCAP_NODE
, &no_neighbor_route_reflector_client_cmd
);
11141 install_element (BGP_ENCAPV6_NODE
, &neighbor_route_reflector_client_cmd
);
11142 install_element (BGP_ENCAPV6_NODE
, &no_neighbor_route_reflector_client_cmd
);
11144 /* "neighbor route-server" commands.*/
11145 install_element (BGP_NODE
, &neighbor_route_server_client_cmd
);
11146 install_element (BGP_NODE
, &no_neighbor_route_server_client_cmd
);
11147 install_element (BGP_IPV4_NODE
, &neighbor_route_server_client_cmd
);
11148 install_element (BGP_IPV4_NODE
, &no_neighbor_route_server_client_cmd
);
11149 install_element (BGP_IPV4M_NODE
, &neighbor_route_server_client_cmd
);
11150 install_element (BGP_IPV4M_NODE
, &no_neighbor_route_server_client_cmd
);
11151 install_element (BGP_IPV6_NODE
, &neighbor_route_server_client_cmd
);
11152 install_element (BGP_IPV6_NODE
, &no_neighbor_route_server_client_cmd
);
11153 install_element (BGP_IPV6M_NODE
, &neighbor_route_server_client_cmd
);
11154 install_element (BGP_IPV6M_NODE
, &no_neighbor_route_server_client_cmd
);
11155 install_element (BGP_VPNV4_NODE
, &neighbor_route_server_client_cmd
);
11156 install_element (BGP_VPNV4_NODE
, &no_neighbor_route_server_client_cmd
);
11157 install_element (BGP_VPNV6_NODE
, &neighbor_route_server_client_cmd
);
11158 install_element (BGP_VPNV6_NODE
, &no_neighbor_route_server_client_cmd
);
11159 install_element (BGP_ENCAP_NODE
, &neighbor_route_server_client_cmd
);
11160 install_element (BGP_ENCAP_NODE
, &no_neighbor_route_server_client_cmd
);
11161 install_element (BGP_ENCAPV6_NODE
, &neighbor_route_server_client_cmd
);
11162 install_element (BGP_ENCAPV6_NODE
, &no_neighbor_route_server_client_cmd
);
11164 /* "neighbor addpath-tx-all-paths" commands.*/
11165 install_element (BGP_NODE
, &neighbor_addpath_tx_all_paths_cmd
);
11166 install_element (BGP_NODE
, &no_neighbor_addpath_tx_all_paths_cmd
);
11167 install_element (BGP_IPV4_NODE
, &neighbor_addpath_tx_all_paths_cmd
);
11168 install_element (BGP_IPV4_NODE
, &no_neighbor_addpath_tx_all_paths_cmd
);
11169 install_element (BGP_IPV4M_NODE
, &neighbor_addpath_tx_all_paths_cmd
);
11170 install_element (BGP_IPV4M_NODE
, &no_neighbor_addpath_tx_all_paths_cmd
);
11171 install_element (BGP_IPV6_NODE
, &neighbor_addpath_tx_all_paths_cmd
);
11172 install_element (BGP_IPV6_NODE
, &no_neighbor_addpath_tx_all_paths_cmd
);
11173 install_element (BGP_IPV6M_NODE
, &neighbor_addpath_tx_all_paths_cmd
);
11174 install_element (BGP_IPV6M_NODE
, &no_neighbor_addpath_tx_all_paths_cmd
);
11175 install_element (BGP_VPNV4_NODE
, &neighbor_addpath_tx_all_paths_cmd
);
11176 install_element (BGP_VPNV4_NODE
, &no_neighbor_addpath_tx_all_paths_cmd
);
11177 install_element (BGP_VPNV6_NODE
, &neighbor_addpath_tx_all_paths_cmd
);
11178 install_element (BGP_VPNV6_NODE
, &no_neighbor_addpath_tx_all_paths_cmd
);
11180 /* "neighbor addpath-tx-bestpath-per-AS" commands.*/
11181 install_element (BGP_NODE
, &neighbor_addpath_tx_bestpath_per_as_cmd
);
11182 install_element (BGP_NODE
, &no_neighbor_addpath_tx_bestpath_per_as_cmd
);
11183 install_element (BGP_IPV4_NODE
, &neighbor_addpath_tx_bestpath_per_as_cmd
);
11184 install_element (BGP_IPV4_NODE
, &no_neighbor_addpath_tx_bestpath_per_as_cmd
);
11185 install_element (BGP_IPV4M_NODE
, &neighbor_addpath_tx_bestpath_per_as_cmd
);
11186 install_element (BGP_IPV4M_NODE
, &no_neighbor_addpath_tx_bestpath_per_as_cmd
);
11187 install_element (BGP_IPV6_NODE
, &neighbor_addpath_tx_bestpath_per_as_cmd
);
11188 install_element (BGP_IPV6_NODE
, &no_neighbor_addpath_tx_bestpath_per_as_cmd
);
11189 install_element (BGP_IPV6M_NODE
, &neighbor_addpath_tx_bestpath_per_as_cmd
);
11190 install_element (BGP_IPV6M_NODE
, &no_neighbor_addpath_tx_bestpath_per_as_cmd
);
11191 install_element (BGP_VPNV4_NODE
, &neighbor_addpath_tx_bestpath_per_as_cmd
);
11192 install_element (BGP_VPNV4_NODE
, &no_neighbor_addpath_tx_bestpath_per_as_cmd
);
11193 install_element (BGP_VPNV6_NODE
, &neighbor_addpath_tx_bestpath_per_as_cmd
);
11194 install_element (BGP_VPNV6_NODE
, &no_neighbor_addpath_tx_bestpath_per_as_cmd
);
11196 /* "neighbor passive" commands. */
11197 install_element (BGP_NODE
, &neighbor_passive_cmd
);
11198 install_element (BGP_NODE
, &no_neighbor_passive_cmd
);
11201 /* "neighbor shutdown" commands. */
11202 install_element (BGP_NODE
, &neighbor_shutdown_cmd
);
11203 install_element (BGP_NODE
, &no_neighbor_shutdown_cmd
);
11205 /* "neighbor capability extended-nexthop" commands.*/
11206 install_element (BGP_NODE
, &neighbor_capability_enhe_cmd
);
11207 install_element (BGP_NODE
, &no_neighbor_capability_enhe_cmd
);
11209 /* "neighbor capability orf prefix-list" commands.*/
11210 install_element (BGP_NODE
, &neighbor_capability_orf_prefix_cmd
);
11211 install_element (BGP_NODE
, &no_neighbor_capability_orf_prefix_cmd
);
11212 install_element (BGP_IPV4_NODE
, &neighbor_capability_orf_prefix_cmd
);
11213 install_element (BGP_IPV4_NODE
, &no_neighbor_capability_orf_prefix_cmd
);
11214 install_element (BGP_IPV4M_NODE
, &neighbor_capability_orf_prefix_cmd
);
11215 install_element (BGP_IPV4M_NODE
, &no_neighbor_capability_orf_prefix_cmd
);
11216 install_element (BGP_IPV6_NODE
, &neighbor_capability_orf_prefix_cmd
);
11217 install_element (BGP_IPV6_NODE
, &no_neighbor_capability_orf_prefix_cmd
);
11218 install_element (BGP_IPV6M_NODE
, &neighbor_capability_orf_prefix_cmd
);
11219 install_element (BGP_IPV6M_NODE
, &no_neighbor_capability_orf_prefix_cmd
);
11221 /* "neighbor capability dynamic" commands.*/
11222 install_element (BGP_NODE
, &neighbor_capability_dynamic_cmd
);
11223 install_element (BGP_NODE
, &no_neighbor_capability_dynamic_cmd
);
11225 /* "neighbor dont-capability-negotiate" commands. */
11226 install_element (BGP_NODE
, &neighbor_dont_capability_negotiate_cmd
);
11227 install_element (BGP_NODE
, &no_neighbor_dont_capability_negotiate_cmd
);
11229 /* "neighbor ebgp-multihop" commands. */
11230 install_element (BGP_NODE
, &neighbor_ebgp_multihop_cmd
);
11231 install_element (BGP_NODE
, &neighbor_ebgp_multihop_ttl_cmd
);
11232 install_element (BGP_NODE
, &no_neighbor_ebgp_multihop_cmd
);
11234 /* "neighbor disable-connected-check" commands. */
11235 install_element (BGP_NODE
, &neighbor_disable_connected_check_cmd
);
11236 install_element (BGP_NODE
, &no_neighbor_disable_connected_check_cmd
);
11238 /* "neighbor description" commands. */
11239 install_element (BGP_NODE
, &neighbor_description_cmd
);
11240 install_element (BGP_NODE
, &no_neighbor_description_cmd
);
11242 /* "neighbor update-source" commands. "*/
11243 install_element (BGP_NODE
, &neighbor_update_source_cmd
);
11244 install_element (BGP_NODE
, &no_neighbor_update_source_cmd
);
11246 /* "neighbor default-originate" commands. */
11247 install_element (BGP_NODE
, &neighbor_default_originate_cmd
);
11248 install_element (BGP_NODE
, &neighbor_default_originate_rmap_cmd
);
11249 install_element (BGP_NODE
, &no_neighbor_default_originate_cmd
);
11250 install_element (BGP_IPV4_NODE
, &neighbor_default_originate_cmd
);
11251 install_element (BGP_IPV4_NODE
, &neighbor_default_originate_rmap_cmd
);
11252 install_element (BGP_IPV4_NODE
, &no_neighbor_default_originate_cmd
);
11253 install_element (BGP_IPV4M_NODE
, &neighbor_default_originate_cmd
);
11254 install_element (BGP_IPV4M_NODE
, &neighbor_default_originate_rmap_cmd
);
11255 install_element (BGP_IPV4M_NODE
, &no_neighbor_default_originate_cmd
);
11256 install_element (BGP_IPV6_NODE
, &neighbor_default_originate_cmd
);
11257 install_element (BGP_IPV6_NODE
, &neighbor_default_originate_rmap_cmd
);
11258 install_element (BGP_IPV6_NODE
, &no_neighbor_default_originate_cmd
);
11259 install_element (BGP_IPV6M_NODE
, &neighbor_default_originate_cmd
);
11260 install_element (BGP_IPV6M_NODE
, &neighbor_default_originate_rmap_cmd
);
11261 install_element (BGP_IPV6M_NODE
, &no_neighbor_default_originate_cmd
);
11263 /* "neighbor port" commands. */
11264 install_element (BGP_NODE
, &neighbor_port_cmd
);
11265 install_element (BGP_NODE
, &no_neighbor_port_cmd
);
11267 /* "neighbor weight" commands. */
11268 install_element (BGP_NODE
, &neighbor_weight_cmd
);
11269 install_element (BGP_NODE
, &no_neighbor_weight_cmd
);
11271 /* "neighbor override-capability" commands. */
11272 install_element (BGP_NODE
, &neighbor_override_capability_cmd
);
11273 install_element (BGP_NODE
, &no_neighbor_override_capability_cmd
);
11275 /* "neighbor strict-capability-match" commands. */
11276 install_element (BGP_NODE
, &neighbor_strict_capability_cmd
);
11277 install_element (BGP_NODE
, &no_neighbor_strict_capability_cmd
);
11279 /* "neighbor timers" commands. */
11280 install_element (BGP_NODE
, &neighbor_timers_cmd
);
11281 install_element (BGP_NODE
, &no_neighbor_timers_cmd
);
11283 /* "neighbor timers connect" commands. */
11284 install_element (BGP_NODE
, &neighbor_timers_connect_cmd
);
11285 install_element (BGP_NODE
, &no_neighbor_timers_connect_cmd
);
11287 /* "neighbor advertisement-interval" commands. */
11288 install_element (BGP_NODE
, &neighbor_advertise_interval_cmd
);
11289 install_element (BGP_NODE
, &no_neighbor_advertise_interval_cmd
);
11291 /* "neighbor interface" commands. */
11292 install_element (BGP_NODE
, &neighbor_interface_cmd
);
11293 install_element (BGP_NODE
, &no_neighbor_interface_cmd
);
11295 /* "neighbor distribute" commands. */
11296 install_element (BGP_NODE
, &neighbor_distribute_list_cmd
);
11297 install_element (BGP_NODE
, &no_neighbor_distribute_list_cmd
);
11298 install_element (BGP_IPV4_NODE
, &neighbor_distribute_list_cmd
);
11299 install_element (BGP_IPV4_NODE
, &no_neighbor_distribute_list_cmd
);
11300 install_element (BGP_IPV4M_NODE
, &neighbor_distribute_list_cmd
);
11301 install_element (BGP_IPV4M_NODE
, &no_neighbor_distribute_list_cmd
);
11302 install_element (BGP_IPV6_NODE
, &neighbor_distribute_list_cmd
);
11303 install_element (BGP_IPV6_NODE
, &no_neighbor_distribute_list_cmd
);
11304 install_element (BGP_IPV6M_NODE
, &neighbor_distribute_list_cmd
);
11305 install_element (BGP_IPV6M_NODE
, &no_neighbor_distribute_list_cmd
);
11306 install_element (BGP_VPNV4_NODE
, &neighbor_distribute_list_cmd
);
11307 install_element (BGP_VPNV4_NODE
, &no_neighbor_distribute_list_cmd
);
11308 install_element (BGP_VPNV6_NODE
, &neighbor_distribute_list_cmd
);
11309 install_element (BGP_VPNV6_NODE
, &no_neighbor_distribute_list_cmd
);
11310 install_element (BGP_ENCAP_NODE
, &neighbor_distribute_list_cmd
);
11311 install_element (BGP_ENCAP_NODE
, &no_neighbor_distribute_list_cmd
);
11312 install_element (BGP_ENCAPV6_NODE
, &neighbor_distribute_list_cmd
);
11313 install_element (BGP_ENCAPV6_NODE
, &no_neighbor_distribute_list_cmd
);
11315 /* "neighbor prefix-list" commands. */
11316 install_element (BGP_NODE
, &neighbor_prefix_list_cmd
);
11317 install_element (BGP_NODE
, &no_neighbor_prefix_list_cmd
);
11318 install_element (BGP_IPV4_NODE
, &neighbor_prefix_list_cmd
);
11319 install_element (BGP_IPV4_NODE
, &no_neighbor_prefix_list_cmd
);
11320 install_element (BGP_IPV4M_NODE
, &neighbor_prefix_list_cmd
);
11321 install_element (BGP_IPV4M_NODE
, &no_neighbor_prefix_list_cmd
);
11322 install_element (BGP_IPV6_NODE
, &neighbor_prefix_list_cmd
);
11323 install_element (BGP_IPV6_NODE
, &no_neighbor_prefix_list_cmd
);
11324 install_element (BGP_IPV6M_NODE
, &neighbor_prefix_list_cmd
);
11325 install_element (BGP_IPV6M_NODE
, &no_neighbor_prefix_list_cmd
);
11326 install_element (BGP_VPNV4_NODE
, &neighbor_prefix_list_cmd
);
11327 install_element (BGP_VPNV4_NODE
, &no_neighbor_prefix_list_cmd
);
11328 install_element (BGP_VPNV6_NODE
, &neighbor_prefix_list_cmd
);
11329 install_element (BGP_VPNV6_NODE
, &no_neighbor_prefix_list_cmd
);
11330 install_element (BGP_ENCAP_NODE
, &neighbor_prefix_list_cmd
);
11331 install_element (BGP_ENCAP_NODE
, &no_neighbor_prefix_list_cmd
);
11332 install_element (BGP_ENCAPV6_NODE
, &neighbor_prefix_list_cmd
);
11333 install_element (BGP_ENCAPV6_NODE
, &no_neighbor_prefix_list_cmd
);
11335 /* "neighbor filter-list" commands. */
11336 install_element (BGP_NODE
, &neighbor_filter_list_cmd
);
11337 install_element (BGP_NODE
, &no_neighbor_filter_list_cmd
);
11338 install_element (BGP_IPV4_NODE
, &neighbor_filter_list_cmd
);
11339 install_element (BGP_IPV4_NODE
, &no_neighbor_filter_list_cmd
);
11340 install_element (BGP_IPV4M_NODE
, &neighbor_filter_list_cmd
);
11341 install_element (BGP_IPV4M_NODE
, &no_neighbor_filter_list_cmd
);
11342 install_element (BGP_IPV6_NODE
, &neighbor_filter_list_cmd
);
11343 install_element (BGP_IPV6_NODE
, &no_neighbor_filter_list_cmd
);
11344 install_element (BGP_IPV6M_NODE
, &neighbor_filter_list_cmd
);
11345 install_element (BGP_IPV6M_NODE
, &no_neighbor_filter_list_cmd
);
11346 install_element (BGP_VPNV4_NODE
, &neighbor_filter_list_cmd
);
11347 install_element (BGP_VPNV4_NODE
, &no_neighbor_filter_list_cmd
);
11348 install_element (BGP_VPNV6_NODE
, &neighbor_filter_list_cmd
);
11349 install_element (BGP_VPNV6_NODE
, &no_neighbor_filter_list_cmd
);
11350 install_element (BGP_ENCAP_NODE
, &neighbor_filter_list_cmd
);
11351 install_element (BGP_ENCAP_NODE
, &no_neighbor_filter_list_cmd
);
11352 install_element (BGP_ENCAPV6_NODE
, &neighbor_filter_list_cmd
);
11353 install_element (BGP_ENCAPV6_NODE
, &no_neighbor_filter_list_cmd
);
11355 /* "neighbor route-map" commands. */
11356 install_element (BGP_NODE
, &neighbor_route_map_cmd
);
11357 install_element (BGP_NODE
, &no_neighbor_route_map_cmd
);
11358 install_element (BGP_IPV4_NODE
, &neighbor_route_map_cmd
);
11359 install_element (BGP_IPV4_NODE
, &no_neighbor_route_map_cmd
);
11360 install_element (BGP_IPV4M_NODE
, &neighbor_route_map_cmd
);
11361 install_element (BGP_IPV4M_NODE
, &no_neighbor_route_map_cmd
);
11362 install_element (BGP_IPV6_NODE
, &neighbor_route_map_cmd
);
11363 install_element (BGP_IPV6_NODE
, &no_neighbor_route_map_cmd
);
11364 install_element (BGP_IPV6M_NODE
, &neighbor_route_map_cmd
);
11365 install_element (BGP_IPV6M_NODE
, &no_neighbor_route_map_cmd
);
11366 install_element (BGP_VPNV4_NODE
, &neighbor_route_map_cmd
);
11367 install_element (BGP_VPNV4_NODE
, &no_neighbor_route_map_cmd
);
11368 install_element (BGP_VPNV6_NODE
, &neighbor_route_map_cmd
);
11369 install_element (BGP_VPNV6_NODE
, &no_neighbor_route_map_cmd
);
11370 install_element (BGP_ENCAP_NODE
, &neighbor_route_map_cmd
);
11371 install_element (BGP_ENCAP_NODE
, &no_neighbor_route_map_cmd
);
11372 install_element (BGP_ENCAPV6_NODE
, &neighbor_route_map_cmd
);
11373 install_element (BGP_ENCAPV6_NODE
, &no_neighbor_route_map_cmd
);
11375 /* "neighbor unsuppress-map" commands. */
11376 install_element (BGP_NODE
, &neighbor_unsuppress_map_cmd
);
11377 install_element (BGP_NODE
, &no_neighbor_unsuppress_map_cmd
);
11378 install_element (BGP_IPV4_NODE
, &neighbor_unsuppress_map_cmd
);
11379 install_element (BGP_IPV4_NODE
, &no_neighbor_unsuppress_map_cmd
);
11380 install_element (BGP_IPV4M_NODE
, &neighbor_unsuppress_map_cmd
);
11381 install_element (BGP_IPV4M_NODE
, &no_neighbor_unsuppress_map_cmd
);
11382 install_element (BGP_IPV6_NODE
, &neighbor_unsuppress_map_cmd
);
11383 install_element (BGP_IPV6_NODE
, &no_neighbor_unsuppress_map_cmd
);
11384 install_element (BGP_IPV6M_NODE
, &neighbor_unsuppress_map_cmd
);
11385 install_element (BGP_IPV6M_NODE
, &no_neighbor_unsuppress_map_cmd
);
11386 install_element (BGP_VPNV4_NODE
, &neighbor_unsuppress_map_cmd
);
11387 install_element (BGP_VPNV4_NODE
, &no_neighbor_unsuppress_map_cmd
);
11388 install_element (BGP_VPNV6_NODE
, &neighbor_unsuppress_map_cmd
);
11389 install_element (BGP_VPNV6_NODE
, &no_neighbor_unsuppress_map_cmd
);
11390 install_element (BGP_ENCAP_NODE
, &neighbor_unsuppress_map_cmd
);
11391 install_element (BGP_ENCAP_NODE
, &no_neighbor_unsuppress_map_cmd
);
11392 install_element (BGP_ENCAPV6_NODE
, &neighbor_unsuppress_map_cmd
);
11393 install_element (BGP_ENCAPV6_NODE
, &no_neighbor_unsuppress_map_cmd
);
11395 /* "neighbor maximum-prefix" commands. */
11396 install_element (BGP_NODE
, &neighbor_maximum_prefix_cmd
);
11397 install_element (BGP_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
11398 install_element (BGP_NODE
, &neighbor_maximum_prefix_warning_cmd
);
11399 install_element (BGP_NODE
, &neighbor_maximum_prefix_threshold_warning_cmd
);
11400 install_element (BGP_NODE
, &neighbor_maximum_prefix_restart_cmd
);
11401 install_element (BGP_NODE
, &neighbor_maximum_prefix_threshold_restart_cmd
);
11402 install_element (BGP_NODE
, &no_neighbor_maximum_prefix_cmd
);
11403 install_element (BGP_IPV4_NODE
, &neighbor_maximum_prefix_cmd
);
11404 install_element (BGP_IPV4_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
11405 install_element (BGP_IPV4_NODE
, &neighbor_maximum_prefix_warning_cmd
);
11406 install_element (BGP_IPV4_NODE
, &neighbor_maximum_prefix_threshold_warning_cmd
);
11407 install_element (BGP_IPV4_NODE
, &neighbor_maximum_prefix_restart_cmd
);
11408 install_element (BGP_IPV4_NODE
, &neighbor_maximum_prefix_threshold_restart_cmd
);
11409 install_element (BGP_IPV4_NODE
, &no_neighbor_maximum_prefix_cmd
);
11410 install_element (BGP_IPV4M_NODE
, &neighbor_maximum_prefix_cmd
);
11411 install_element (BGP_IPV4M_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
11412 install_element (BGP_IPV4M_NODE
, &neighbor_maximum_prefix_warning_cmd
);
11413 install_element (BGP_IPV4M_NODE
, &neighbor_maximum_prefix_threshold_warning_cmd
);
11414 install_element (BGP_IPV4M_NODE
, &neighbor_maximum_prefix_restart_cmd
);
11415 install_element (BGP_IPV4M_NODE
, &neighbor_maximum_prefix_threshold_restart_cmd
);
11416 install_element (BGP_IPV4M_NODE
, &no_neighbor_maximum_prefix_cmd
);
11417 install_element (BGP_IPV6_NODE
, &neighbor_maximum_prefix_cmd
);
11418 install_element (BGP_IPV6_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
11419 install_element (BGP_IPV6_NODE
, &neighbor_maximum_prefix_warning_cmd
);
11420 install_element (BGP_IPV6_NODE
, &neighbor_maximum_prefix_threshold_warning_cmd
);
11421 install_element (BGP_IPV6_NODE
, &neighbor_maximum_prefix_restart_cmd
);
11422 install_element (BGP_IPV6_NODE
, &neighbor_maximum_prefix_threshold_restart_cmd
);
11423 install_element (BGP_IPV6_NODE
, &no_neighbor_maximum_prefix_cmd
);
11424 install_element (BGP_IPV6M_NODE
, &neighbor_maximum_prefix_cmd
);
11425 install_element (BGP_IPV6M_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
11426 install_element (BGP_IPV6M_NODE
, &neighbor_maximum_prefix_warning_cmd
);
11427 install_element (BGP_IPV6M_NODE
, &neighbor_maximum_prefix_threshold_warning_cmd
);
11428 install_element (BGP_IPV6M_NODE
, &neighbor_maximum_prefix_restart_cmd
);
11429 install_element (BGP_IPV6M_NODE
, &neighbor_maximum_prefix_threshold_restart_cmd
);
11430 install_element (BGP_IPV6M_NODE
, &no_neighbor_maximum_prefix_cmd
);
11431 install_element (BGP_VPNV4_NODE
, &neighbor_maximum_prefix_cmd
);
11432 install_element (BGP_VPNV4_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
11433 install_element (BGP_VPNV4_NODE
, &neighbor_maximum_prefix_warning_cmd
);
11434 install_element (BGP_VPNV4_NODE
, &neighbor_maximum_prefix_threshold_warning_cmd
);
11435 install_element (BGP_VPNV4_NODE
, &neighbor_maximum_prefix_restart_cmd
);
11436 install_element (BGP_VPNV4_NODE
, &neighbor_maximum_prefix_threshold_restart_cmd
);
11437 install_element (BGP_VPNV4_NODE
, &no_neighbor_maximum_prefix_cmd
);
11438 install_element (BGP_VPNV6_NODE
, &neighbor_maximum_prefix_cmd
);
11439 install_element (BGP_VPNV6_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
11440 install_element (BGP_VPNV6_NODE
, &neighbor_maximum_prefix_warning_cmd
);
11441 install_element (BGP_VPNV6_NODE
, &neighbor_maximum_prefix_threshold_warning_cmd
);
11442 install_element (BGP_VPNV6_NODE
, &neighbor_maximum_prefix_restart_cmd
);
11443 install_element (BGP_VPNV6_NODE
, &neighbor_maximum_prefix_threshold_restart_cmd
);
11444 install_element (BGP_VPNV6_NODE
, &no_neighbor_maximum_prefix_cmd
);
11446 install_element (BGP_ENCAP_NODE
, &neighbor_maximum_prefix_cmd
);
11447 install_element (BGP_ENCAP_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
11448 install_element (BGP_ENCAP_NODE
, &neighbor_maximum_prefix_warning_cmd
);
11449 install_element (BGP_ENCAP_NODE
, &neighbor_maximum_prefix_threshold_warning_cmd
);
11450 install_element (BGP_ENCAP_NODE
, &neighbor_maximum_prefix_restart_cmd
);
11451 install_element (BGP_ENCAP_NODE
, &neighbor_maximum_prefix_threshold_restart_cmd
);
11452 install_element (BGP_ENCAP_NODE
, &no_neighbor_maximum_prefix_cmd
);
11454 install_element (BGP_ENCAPV6_NODE
, &neighbor_maximum_prefix_cmd
);
11455 install_element (BGP_ENCAPV6_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
11456 install_element (BGP_ENCAPV6_NODE
, &neighbor_maximum_prefix_warning_cmd
);
11457 install_element (BGP_ENCAPV6_NODE
, &neighbor_maximum_prefix_threshold_warning_cmd
);
11458 install_element (BGP_ENCAPV6_NODE
, &neighbor_maximum_prefix_restart_cmd
);
11459 install_element (BGP_ENCAPV6_NODE
, &neighbor_maximum_prefix_threshold_restart_cmd
);
11460 install_element (BGP_ENCAPV6_NODE
, &no_neighbor_maximum_prefix_cmd
);
11462 /* "neighbor allowas-in" */
11463 install_element (BGP_NODE
, &neighbor_allowas_in_cmd
);
11464 install_element (BGP_NODE
, &no_neighbor_allowas_in_cmd
);
11465 install_element (BGP_IPV4_NODE
, &neighbor_allowas_in_cmd
);
11466 install_element (BGP_IPV4_NODE
, &no_neighbor_allowas_in_cmd
);
11467 install_element (BGP_IPV4M_NODE
, &neighbor_allowas_in_cmd
);
11468 install_element (BGP_IPV4M_NODE
, &no_neighbor_allowas_in_cmd
);
11469 install_element (BGP_IPV6_NODE
, &neighbor_allowas_in_cmd
);
11470 install_element (BGP_IPV6_NODE
, &no_neighbor_allowas_in_cmd
);
11471 install_element (BGP_IPV6M_NODE
, &neighbor_allowas_in_cmd
);
11472 install_element (BGP_IPV6M_NODE
, &no_neighbor_allowas_in_cmd
);
11473 install_element (BGP_VPNV4_NODE
, &neighbor_allowas_in_cmd
);
11474 install_element (BGP_VPNV4_NODE
, &no_neighbor_allowas_in_cmd
);
11475 install_element (BGP_VPNV6_NODE
, &neighbor_allowas_in_cmd
);
11476 install_element (BGP_VPNV6_NODE
, &no_neighbor_allowas_in_cmd
);
11477 install_element (BGP_ENCAP_NODE
, &neighbor_allowas_in_cmd
);
11478 install_element (BGP_ENCAP_NODE
, &no_neighbor_allowas_in_cmd
);
11479 install_element (BGP_ENCAPV6_NODE
, &neighbor_allowas_in_cmd
);
11480 install_element (BGP_ENCAPV6_NODE
, &no_neighbor_allowas_in_cmd
);
11482 /* address-family commands. */
11483 install_element (BGP_NODE
, &address_family_ipv4_cmd
);
11484 install_element (BGP_NODE
, &address_family_ipv4_safi_cmd
);
11486 install_element (BGP_NODE
, &address_family_ipv6_cmd
);
11487 install_element (BGP_NODE
, &address_family_ipv6_safi_cmd
);
11488 #endif /* HAVE_IPV6 */
11489 install_element (BGP_NODE
, &address_family_vpnv4_cmd
);
11491 install_element (BGP_NODE
, &address_family_vpnv6_cmd
);
11493 install_element (BGP_NODE
, &address_family_encap_cmd
);
11495 install_element (BGP_NODE
, &address_family_encapv6_cmd
);
11498 /* "exit-address-family" command. */
11499 install_element (BGP_IPV4_NODE
, &exit_address_family_cmd
);
11500 install_element (BGP_IPV4M_NODE
, &exit_address_family_cmd
);
11501 install_element (BGP_IPV6_NODE
, &exit_address_family_cmd
);
11502 install_element (BGP_IPV6M_NODE
, &exit_address_family_cmd
);
11503 install_element (BGP_VPNV4_NODE
, &exit_address_family_cmd
);
11504 install_element (BGP_VPNV6_NODE
, &exit_address_family_cmd
);
11505 install_element (BGP_ENCAP_NODE
, &exit_address_family_cmd
);
11506 install_element (BGP_ENCAPV6_NODE
, &exit_address_family_cmd
);
11508 /* "clear ip bgp commands" */
11509 install_element (ENABLE_NODE
, &clear_ip_bgp_all_cmd
);
11511 /* clear ip bgp prefix */
11512 install_element (ENABLE_NODE
, &clear_ip_bgp_prefix_cmd
);
11513 install_element (ENABLE_NODE
, &clear_bgp_ipv6_safi_prefix_cmd
);
11514 install_element (ENABLE_NODE
, &clear_bgp_instance_ipv6_safi_prefix_cmd
);
11516 /* "show ip bgp summary" commands. */
11517 install_element (VIEW_NODE
, &show_ip_bgp_summary_cmd
);
11518 install_element (VIEW_NODE
, &show_ip_bgp_updgrps_cmd
);
11519 install_element (VIEW_NODE
, &show_ip_bgp_instance_all_updgrps_cmd
);
11520 install_element (VIEW_NODE
, &show_bgp_instance_all_ipv6_updgrps_cmd
);
11521 install_element (VIEW_NODE
, &show_ip_bgp_updgrps_adj_cmd
);
11522 install_element (VIEW_NODE
, &show_ip_bgp_instance_updgrps_adj_cmd
);
11523 install_element (VIEW_NODE
, &show_bgp_updgrps_adj_cmd
);
11524 install_element (VIEW_NODE
, &show_bgp_instance_updgrps_adj_cmd
);
11525 install_element (VIEW_NODE
, &show_bgp_updgrps_afi_adj_cmd
);
11526 install_element (VIEW_NODE
, &show_ip_bgp_updgrps_adj_s_cmd
);
11527 install_element (VIEW_NODE
, &show_ip_bgp_instance_updgrps_adj_s_cmd
);
11528 install_element (VIEW_NODE
, &show_bgp_updgrps_adj_s_cmd
);
11529 install_element (VIEW_NODE
, &show_bgp_instance_updgrps_adj_s_cmd
);
11530 install_element (VIEW_NODE
, &show_bgp_updgrps_afi_adj_s_cmd
);
11531 install_element (VIEW_NODE
, &show_ip_bgp_instance_all_summary_cmd
);
11532 install_element (RESTRICTED_NODE
, &show_ip_bgp_summary_cmd
);
11533 install_element (RESTRICTED_NODE
, &show_ip_bgp_updgrps_cmd
);
11534 install_element (RESTRICTED_NODE
, &show_ip_bgp_instance_all_updgrps_cmd
);
11535 install_element (RESTRICTED_NODE
, &show_bgp_instance_all_ipv6_updgrps_cmd
);
11536 install_element (RESTRICTED_NODE
, &show_ip_bgp_updgrps_adj_cmd
);
11537 install_element (RESTRICTED_NODE
, &show_ip_bgp_instance_updgrps_adj_cmd
);
11538 install_element (RESTRICTED_NODE
, &show_bgp_updgrps_adj_cmd
);
11539 install_element (RESTRICTED_NODE
, &show_bgp_instance_updgrps_adj_cmd
);
11540 install_element (RESTRICTED_NODE
, &show_bgp_updgrps_afi_adj_cmd
);
11541 install_element (RESTRICTED_NODE
, &show_ip_bgp_updgrps_adj_s_cmd
);
11542 install_element (RESTRICTED_NODE
, &show_ip_bgp_instance_updgrps_adj_s_cmd
);
11543 install_element (RESTRICTED_NODE
, &show_bgp_updgrps_adj_s_cmd
);
11544 install_element (RESTRICTED_NODE
, &show_bgp_instance_updgrps_adj_s_cmd
);
11545 install_element (RESTRICTED_NODE
, &show_bgp_updgrps_afi_adj_s_cmd
);
11546 install_element (RESTRICTED_NODE
, &show_ip_bgp_instance_all_summary_cmd
);
11547 install_element (ENABLE_NODE
, &show_ip_bgp_summary_cmd
);
11548 install_element (ENABLE_NODE
, &show_ip_bgp_updgrps_cmd
);
11549 install_element (ENABLE_NODE
, &show_ip_bgp_instance_all_updgrps_cmd
);
11550 install_element (ENABLE_NODE
, &show_bgp_instance_all_ipv6_updgrps_cmd
);
11551 install_element (ENABLE_NODE
, &show_ip_bgp_updgrps_adj_cmd
);
11552 install_element (ENABLE_NODE
, &show_ip_bgp_instance_updgrps_adj_cmd
);
11553 install_element (ENABLE_NODE
, &show_bgp_updgrps_adj_cmd
);
11554 install_element (ENABLE_NODE
, &show_bgp_instance_updgrps_adj_cmd
);
11555 install_element (ENABLE_NODE
, &show_bgp_updgrps_afi_adj_cmd
);
11556 install_element (ENABLE_NODE
, &show_ip_bgp_updgrps_adj_s_cmd
);
11557 install_element (ENABLE_NODE
, &show_ip_bgp_instance_updgrps_adj_s_cmd
);
11558 install_element (ENABLE_NODE
, &show_bgp_updgrps_adj_s_cmd
);
11559 install_element (ENABLE_NODE
, &show_bgp_instance_updgrps_adj_s_cmd
);
11560 install_element (ENABLE_NODE
, &show_bgp_updgrps_afi_adj_s_cmd
);
11561 install_element (ENABLE_NODE
, &show_ip_bgp_instance_all_summary_cmd
);
11563 /* "show ip bgp neighbors" commands. */
11564 install_element (VIEW_NODE
, &show_ip_bgp_neighbors_cmd
);
11565 install_element (VIEW_NODE
, &show_ip_bgp_instance_all_neighbors_cmd
);
11566 install_element (ENABLE_NODE
, &show_ip_bgp_neighbors_cmd
);
11567 install_element (ENABLE_NODE
, &show_ip_bgp_instance_all_neighbors_cmd
);
11569 /* "show ip bgp peer-group" commands. */
11570 install_element (VIEW_NODE
, &show_ip_bgp_peer_groups_cmd
);
11571 install_element (VIEW_NODE
, &show_ip_bgp_instance_peer_groups_cmd
);
11572 install_element (VIEW_NODE
, &show_ip_bgp_peer_group_cmd
);
11573 install_element (VIEW_NODE
, &show_ip_bgp_instance_peer_group_cmd
);
11574 install_element (ENABLE_NODE
, &show_ip_bgp_peer_groups_cmd
);
11575 install_element (ENABLE_NODE
, &show_ip_bgp_instance_peer_groups_cmd
);
11576 install_element (ENABLE_NODE
, &show_ip_bgp_peer_group_cmd
);
11577 install_element (ENABLE_NODE
, &show_ip_bgp_instance_peer_group_cmd
);
11579 /* "show ip bgp paths" commands. */
11580 install_element (VIEW_NODE
, &show_ip_bgp_paths_cmd
);
11581 install_element (VIEW_NODE
, &show_ip_bgp_ipv4_paths_cmd
);
11582 install_element (ENABLE_NODE
, &show_ip_bgp_paths_cmd
);
11583 install_element (ENABLE_NODE
, &show_ip_bgp_ipv4_paths_cmd
);
11585 /* "show ip bgp community" commands. */
11586 install_element (VIEW_NODE
, &show_ip_bgp_community_info_cmd
);
11587 install_element (ENABLE_NODE
, &show_ip_bgp_community_info_cmd
);
11589 /* "show ip bgp attribute-info" commands. */
11590 install_element (VIEW_NODE
, &show_ip_bgp_attr_info_cmd
);
11591 install_element (ENABLE_NODE
, &show_ip_bgp_attr_info_cmd
);
11593 /* "redistribute" commands. */
11594 install_element (BGP_NODE
, &bgp_redistribute_ipv4_cmd
);
11595 install_element (BGP_NODE
, &no_bgp_redistribute_ipv4_cmd
);
11596 install_element (BGP_NODE
, &bgp_redistribute_ipv4_rmap_cmd
);
11597 install_element (BGP_NODE
, &bgp_redistribute_ipv4_metric_cmd
);
11598 install_element (BGP_NODE
, &bgp_redistribute_ipv4_rmap_metric_cmd
);
11599 install_element (BGP_NODE
, &bgp_redistribute_ipv4_metric_rmap_cmd
);
11600 install_element (BGP_NODE
, &bgp_redistribute_ipv4_ospf_cmd
);
11601 install_element (BGP_NODE
, &no_bgp_redistribute_ipv4_ospf_cmd
);
11602 install_element (BGP_NODE
, &bgp_redistribute_ipv4_ospf_rmap_cmd
);
11603 install_element (BGP_NODE
, &bgp_redistribute_ipv4_ospf_metric_cmd
);
11604 install_element (BGP_NODE
, &bgp_redistribute_ipv4_ospf_rmap_metric_cmd
);
11605 install_element (BGP_NODE
, &bgp_redistribute_ipv4_ospf_metric_rmap_cmd
);
11606 install_element (BGP_IPV4_NODE
, &bgp_redistribute_ipv4_cmd
);
11607 install_element (BGP_IPV4_NODE
, &no_bgp_redistribute_ipv4_cmd
);
11608 install_element (BGP_IPV4_NODE
, &bgp_redistribute_ipv4_rmap_cmd
);
11609 install_element (BGP_IPV4_NODE
, &bgp_redistribute_ipv4_metric_cmd
);
11610 install_element (BGP_IPV4_NODE
, &bgp_redistribute_ipv4_rmap_metric_cmd
);
11611 install_element (BGP_IPV4_NODE
, &bgp_redistribute_ipv4_metric_rmap_cmd
);
11612 install_element (BGP_IPV4_NODE
, &bgp_redistribute_ipv4_ospf_cmd
);
11613 install_element (BGP_IPV4_NODE
, &no_bgp_redistribute_ipv4_ospf_cmd
);
11614 install_element (BGP_IPV4_NODE
, &bgp_redistribute_ipv4_ospf_rmap_cmd
);
11615 install_element (BGP_IPV4_NODE
, &bgp_redistribute_ipv4_ospf_metric_cmd
);
11616 install_element (BGP_IPV4_NODE
, &bgp_redistribute_ipv4_ospf_rmap_metric_cmd
);
11617 install_element (BGP_IPV4_NODE
, &bgp_redistribute_ipv4_ospf_metric_rmap_cmd
);
11619 install_element (BGP_IPV6_NODE
, &bgp_redistribute_ipv6_cmd
);
11620 install_element (BGP_IPV6_NODE
, &no_bgp_redistribute_ipv6_cmd
);
11621 install_element (BGP_IPV6_NODE
, &bgp_redistribute_ipv6_rmap_cmd
);
11622 install_element (BGP_IPV6_NODE
, &bgp_redistribute_ipv6_metric_cmd
);
11623 install_element (BGP_IPV6_NODE
, &bgp_redistribute_ipv6_rmap_metric_cmd
);
11624 install_element (BGP_IPV6_NODE
, &bgp_redistribute_ipv6_metric_rmap_cmd
);
11625 #endif /* HAVE_IPV6 */
11627 /* ttl_security commands */
11628 install_element (BGP_NODE
, &neighbor_ttl_security_cmd
);
11629 install_element (BGP_NODE
, &no_neighbor_ttl_security_cmd
);
11631 /* "show bgp memory" commands. */
11632 install_element (VIEW_NODE
, &show_bgp_memory_cmd
);
11633 install_element (RESTRICTED_NODE
, &show_bgp_memory_cmd
);
11634 install_element (ENABLE_NODE
, &show_bgp_memory_cmd
);
11636 /* "show bgp views" commands. */
11637 install_element (VIEW_NODE
, &show_bgp_views_cmd
);
11638 install_element (RESTRICTED_NODE
, &show_bgp_views_cmd
);
11639 install_element (ENABLE_NODE
, &show_bgp_views_cmd
);
11641 /* "show bgp vrfs" commands. */
11642 install_element (VIEW_NODE
, &show_bgp_vrfs_cmd
);
11643 install_element (RESTRICTED_NODE
, &show_bgp_vrfs_cmd
);
11644 install_element (ENABLE_NODE
, &show_bgp_vrfs_cmd
);
11646 /* Community-list. */
11647 community_list_vty ();
11650 #include "memory.h"
11651 #include "bgp_regex.h"
11652 #include "bgp_clist.h"
11653 #include "bgp_ecommunity.h"
11655 /* VTY functions. */
11657 /* Direction value to string conversion. */
11658 static const char *
11659 community_direct_str (int direct
)
11663 case COMMUNITY_DENY
:
11665 case COMMUNITY_PERMIT
:
11672 /* Display error string. */
11674 community_list_perror (struct vty
*vty
, int ret
)
11678 case COMMUNITY_LIST_ERR_CANT_FIND_LIST
:
11679 vty_out (vty
, "%% Can't find community-list%s", VTY_NEWLINE
);
11681 case COMMUNITY_LIST_ERR_MALFORMED_VAL
:
11682 vty_out (vty
, "%% Malformed community-list value%s", VTY_NEWLINE
);
11684 case COMMUNITY_LIST_ERR_STANDARD_CONFLICT
:
11685 vty_out (vty
, "%% Community name conflict, previously defined as standard community%s", VTY_NEWLINE
);
11687 case COMMUNITY_LIST_ERR_EXPANDED_CONFLICT
:
11688 vty_out (vty
, "%% Community name conflict, previously defined as expanded community%s", VTY_NEWLINE
);
11693 /* "community-list" keyword help string. */
11694 #define COMMUNITY_LIST_STR "Add a community list entry\n"
11697 community_list_set_vty (struct vty
*vty
, int argc
, struct cmd_token
**argv
,
11700 int idx_number
= 2;
11702 int idx_permit_deny
= 4;
11709 /* Check the list type. */
11710 if (strmatch(argv
[idx_permit_deny
]->text
, "permit"))
11711 direct
= COMMUNITY_PERMIT
;
11713 direct
= COMMUNITY_DENY
;
11715 if (argv
[idx_number
]->type
== RANGE_TKN
)
11717 name
= argv
[idx_number
]->arg
;
11723 name
= argv
[idx_name
]->arg
;
11725 /* All digit name check. */
11726 if (all_digit (name
))
11728 vty_out (vty
, "%% Community name cannot have all digits%s", VTY_NEWLINE
);
11729 return CMD_WARNING
;
11733 /* Concat community string argument. */
11734 if (argc
> idx_aa_nn
)
11735 str
= argv_concat (argv
, argc
, idx_aa_nn
);
11739 /* When community_list_set() return nevetive value, it means
11740 malformed community string. */
11741 ret
= community_list_set (bgp_clist
, name
, str
, direct
, style
);
11743 /* Free temporary community list string allocated by
11746 XFREE (MTYPE_TMP
, str
);
11750 /* Display error string. */
11751 community_list_perror (vty
, ret
);
11752 return CMD_WARNING
;
11755 return CMD_SUCCESS
;
11759 community_list_unset_vty (struct vty
*vty
, int argc
, struct cmd_token
**argv
,
11762 /* CHECK ME dwalton finish this
11769 // Check the list direct.
11770 if (strncmp (argv[1], "p", 1) == 0)
11771 direct = COMMUNITY_PERMIT;
11772 else if (strncmp (argv[1], "d", 1) == 0)
11773 direct = COMMUNITY_DENY;
11776 vty_out (vty, "%% Matching condition must be permit or deny%s",
11778 return CMD_WARNING;
11781 // Concat community string argument.
11782 str = argv_concat (argv, argc, 2);
11785 // Unset community list
11786 ret = community_list_unset (bgp_clist, argv[0], str, direct, style, delete_all);
11788 // Free temporary community list string allocated by argv_concat().
11790 XFREE (MTYPE_TMP, str);
11794 community_list_perror (vty, ret);
11795 return CMD_WARNING;
11799 return CMD_SUCCESS
;
11802 /* ip community-list standard */
11803 DEFUN (ip_community_list_standard
,
11804 ip_community_list_standard_cmd
,
11805 "ip community-list <(1-99)|standard WORD> <deny|permit> [.AA:NN]",
11808 "Community list number (standard)\n"
11809 "Add an standard community-list entry\n"
11810 "Community list name\n"
11811 "Specify community to reject\n"
11812 "Specify community to accept\n"
11815 return community_list_set_vty (vty
, argc
, argv
, COMMUNITY_LIST_STANDARD
);
11818 DEFUN (no_ip_community_list_standard_all
,
11819 no_ip_community_list_standard_all_cmd
,
11820 "no ip community-list <(1-99)|standard WORD> [<deny|permit> [.AA:NN]]",
11824 "Community list number (standard)\n"
11825 "Add an standard community-list entry\n"
11826 "Community list name\n"
11827 "Specify community to reject\n"
11828 "Specify community to accept\n"
11831 return community_list_unset_vty (vty
, argc
, argv
, COMMUNITY_LIST_STANDARD
);
11834 /* ip community-list expanded */
11835 DEFUN (ip_community_list_expanded_all
,
11836 ip_community_list_expanded_all_cmd
,
11837 "ip community-list <(100-500)|expanded WORD> [<deny|permit> [.LINE]]",
11840 "Community list number (expanded)\n"
11841 "Add an expanded community-list entry\n"
11842 "Community list name\n"
11843 "Specify community to reject\n"
11844 "Specify community to accept\n"
11847 return community_list_set_vty (vty
, argc
, argv
, COMMUNITY_LIST_EXPANDED
);
11850 DEFUN (no_ip_community_list_expanded_all
,
11851 no_ip_community_list_expanded_all_cmd
,
11852 "no ip community-list <(100-500)|expanded WORD> [<deny|permit> [.LINE]]",
11856 "Community list number (expanded)\n"
11857 "Add an expanded community-list entry\n"
11858 "Community list name\n"
11859 "Specify community to reject\n"
11860 "Specify community to accept\n"
11863 return community_list_unset_vty (vty
, argc
, argv
, COMMUNITY_LIST_EXPANDED
);
11867 community_list_show (struct vty
*vty
, struct community_list
*list
)
11869 struct community_entry
*entry
;
11871 for (entry
= list
->head
; entry
; entry
= entry
->next
)
11873 if (entry
== list
->head
)
11875 if (all_digit (list
->name
))
11876 vty_out (vty
, "Community %s list %s%s",
11877 entry
->style
== COMMUNITY_LIST_STANDARD
?
11878 "standard" : "(expanded) access",
11879 list
->name
, VTY_NEWLINE
);
11881 vty_out (vty
, "Named Community %s list %s%s",
11882 entry
->style
== COMMUNITY_LIST_STANDARD
?
11883 "standard" : "expanded",
11884 list
->name
, VTY_NEWLINE
);
11887 vty_out (vty
, " %s%s",
11888 community_direct_str (entry
->direct
), VTY_NEWLINE
);
11890 vty_out (vty
, " %s %s%s",
11891 community_direct_str (entry
->direct
),
11892 entry
->style
== COMMUNITY_LIST_STANDARD
11893 ? community_str (entry
->u
.com
) : entry
->config
,
11898 DEFUN (show_ip_community_list
,
11899 show_ip_community_list_cmd
,
11900 "show ip community-list",
11903 "List community-list\n")
11905 struct community_list
*list
;
11906 struct community_list_master
*cm
;
11908 cm
= community_list_master_lookup (bgp_clist
, COMMUNITY_LIST_MASTER
);
11910 return CMD_SUCCESS
;
11912 for (list
= cm
->num
.head
; list
; list
= list
->next
)
11913 community_list_show (vty
, list
);
11915 for (list
= cm
->str
.head
; list
; list
= list
->next
)
11916 community_list_show (vty
, list
);
11918 return CMD_SUCCESS
;
11921 DEFUN (show_ip_community_list_arg
,
11922 show_ip_community_list_arg_cmd
,
11923 "show ip community-list <(1-500)|WORD>",
11926 "List community-list\n"
11927 "Community-list number\n"
11928 "Community-list name\n")
11930 int idx_comm_list
= 3;
11931 struct community_list
*list
;
11933 list
= community_list_lookup (bgp_clist
, argv
[idx_comm_list
]->arg
, COMMUNITY_LIST_MASTER
);
11936 vty_out (vty
, "%% Can't find community-list%s", VTY_NEWLINE
);
11937 return CMD_WARNING
;
11940 community_list_show (vty
, list
);
11942 return CMD_SUCCESS
;
11946 extcommunity_list_set_vty (struct vty
*vty
, int argc
, struct cmd_token
**argv
,
11949 /* CHECK ME dwalton finish this
11954 // Check the list type.
11955 if (strncmp (argv[1], "p", 1) == 0)
11956 direct = COMMUNITY_PERMIT;
11957 else if (strncmp (argv[1], "d", 1) == 0)
11958 direct = COMMUNITY_DENY;
11961 vty_out (vty, "%% Matching condition must be permit or deny%s",
11963 return CMD_WARNING;
11966 // All digit name check.
11967 if (reject_all_digit_name && all_digit (argv[0]))
11969 vty_out (vty, "%% Community name cannot have all digits%s", VTY_NEWLINE);
11970 return CMD_WARNING;
11973 // Concat community string argument.
11975 str = argv_concat (argv, argc, 2);
11979 ret = extcommunity_list_set (bgp_clist, argv[0], str, direct, style);
11981 // Free temporary community list string allocated by argv_concat().
11983 XFREE (MTYPE_TMP, str);
11987 community_list_perror (vty, ret);
11988 return CMD_WARNING;
11991 return CMD_SUCCESS
;
11995 extcommunity_list_unset_vty (struct vty
*vty
, int argc
, struct cmd_token
**argv
,
11998 /* CHECK ME dwalton finish this
12005 // Check the list direct
12006 if (strncmp (argv[1], "p", 1) == 0)
12007 direct = COMMUNITY_PERMIT;
12008 else if (strncmp (argv[1], "d", 1) == 0)
12009 direct = COMMUNITY_DENY;
12012 vty_out (vty, "%% Matching condition must be permit or deny%s",
12014 return CMD_WARNING;
12017 // Concat community string argument.
12018 str = argv_concat (argv, argc, 2);
12021 // Unset community list.
12022 ret = extcommunity_list_unset (bgp_clist, argv[0], str, direct, EXTCOMMUNITY_LIST_STANDARD, delete_all);
12024 // Free temporary community list string allocated by argv_concat().
12026 XFREE (MTYPE_TMP, str);
12030 community_list_perror (vty, ret);
12031 return CMD_WARNING;
12035 return CMD_SUCCESS
;
12038 /* "extcommunity-list" keyword help string. */
12039 #define EXTCOMMUNITY_LIST_STR "Add a extended community list entry\n"
12040 #define EXTCOMMUNITY_VAL_STR "Extended community attribute in 'rt aa:nn_or_IPaddr:nn' OR 'soo aa:nn_or_IPaddr:nn' format\n"
12042 DEFUN (ip_extcommunity_list_standard
,
12043 ip_extcommunity_list_standard_cmd
,
12044 "ip extcommunity-list <(1-99)|standard WORD> <deny|permit> [.AA:NN]",
12046 EXTCOMMUNITY_LIST_STR
12047 "Extended Community list number (standard)\n"
12048 "Specify standard extcommunity-list\n"
12049 "Community list name\n"
12050 "Specify community to reject\n"
12051 "Specify community to accept\n"
12052 EXTCOMMUNITY_VAL_STR
)
12054 return extcommunity_list_set_vty (vty
, argc
, argv
, EXTCOMMUNITY_LIST_STANDARD
);
12057 DEFUN (ip_extcommunity_list_name_expanded
,
12058 ip_extcommunity_list_name_expanded_cmd
,
12059 "ip extcommunity-list <(100-500)|expanded WORD> <deny|permit> [.LINE]",
12061 EXTCOMMUNITY_LIST_STR
12062 "Extended Community list number (expanded)\n"
12063 "Specify expanded extcommunity-list\n"
12064 "Extended Community list name\n"
12065 "Specify community to reject\n"
12066 "Specify community to accept\n"
12067 "An ordered list as a regular-expression\n")
12069 return extcommunity_list_set_vty (vty
, argc
, argv
, EXTCOMMUNITY_LIST_EXPANDED
);
12072 DEFUN (no_ip_extcommunity_list_standard_all
,
12073 no_ip_extcommunity_list_standard_all_cmd
,
12074 "no ip extcommunity-list <(1-99)|standard WORD> <deny|permit> [.AA:NN]",
12077 EXTCOMMUNITY_LIST_STR
12078 "Extended Community list number (standard)\n"
12079 "Specify standard extcommunity-list\n"
12080 "Community list name\n"
12081 "Specify community to reject\n"
12082 "Specify community to accept\n"
12083 EXTCOMMUNITY_VAL_STR
)
12085 return extcommunity_list_unset_vty (vty
, argc
, argv
, EXTCOMMUNITY_LIST_EXPANDED
);
12088 DEFUN (no_ip_extcommunity_list_expanded_all
,
12089 no_ip_extcommunity_list_expanded_all_cmd
,
12090 "no ip extcommunity-list <(100-500)|expanded WORD> <deny|permit> [.LINE]",
12093 EXTCOMMUNITY_LIST_STR
12094 "Extended Community list number (expanded)\n"
12095 "Specify expanded extcommunity-list\n"
12096 "Extended Community list name\n"
12097 "Specify community to reject\n"
12098 "Specify community to accept\n"
12099 "An ordered list as a regular-expression\n")
12101 return extcommunity_list_unset_vty (vty
, argc
, argv
, EXTCOMMUNITY_LIST_EXPANDED
);
12105 extcommunity_list_show (struct vty
*vty
, struct community_list
*list
)
12107 struct community_entry
*entry
;
12109 for (entry
= list
->head
; entry
; entry
= entry
->next
)
12111 if (entry
== list
->head
)
12113 if (all_digit (list
->name
))
12114 vty_out (vty
, "Extended community %s list %s%s",
12115 entry
->style
== EXTCOMMUNITY_LIST_STANDARD
?
12116 "standard" : "(expanded) access",
12117 list
->name
, VTY_NEWLINE
);
12119 vty_out (vty
, "Named extended community %s list %s%s",
12120 entry
->style
== EXTCOMMUNITY_LIST_STANDARD
?
12121 "standard" : "expanded",
12122 list
->name
, VTY_NEWLINE
);
12125 vty_out (vty
, " %s%s",
12126 community_direct_str (entry
->direct
), VTY_NEWLINE
);
12128 vty_out (vty
, " %s %s%s",
12129 community_direct_str (entry
->direct
),
12130 entry
->style
== EXTCOMMUNITY_LIST_STANDARD
?
12131 entry
->u
.ecom
->str
: entry
->config
,
12136 DEFUN (show_ip_extcommunity_list
,
12137 show_ip_extcommunity_list_cmd
,
12138 "show ip extcommunity-list",
12141 "List extended-community list\n")
12143 struct community_list
*list
;
12144 struct community_list_master
*cm
;
12146 cm
= community_list_master_lookup (bgp_clist
, EXTCOMMUNITY_LIST_MASTER
);
12148 return CMD_SUCCESS
;
12150 for (list
= cm
->num
.head
; list
; list
= list
->next
)
12151 extcommunity_list_show (vty
, list
);
12153 for (list
= cm
->str
.head
; list
; list
= list
->next
)
12154 extcommunity_list_show (vty
, list
);
12156 return CMD_SUCCESS
;
12159 DEFUN (show_ip_extcommunity_list_arg
,
12160 show_ip_extcommunity_list_arg_cmd
,
12161 "show ip extcommunity-list <(1-500)|WORD>",
12164 "List extended-community list\n"
12165 "Extcommunity-list number\n"
12166 "Extcommunity-list name\n")
12168 int idx_comm_list
= 3;
12169 struct community_list
*list
;
12171 list
= community_list_lookup (bgp_clist
, argv
[idx_comm_list
]->arg
, EXTCOMMUNITY_LIST_MASTER
);
12174 vty_out (vty
, "%% Can't find extcommunity-list%s", VTY_NEWLINE
);
12175 return CMD_WARNING
;
12178 extcommunity_list_show (vty
, list
);
12180 return CMD_SUCCESS
;
12183 /* Return configuration string of community-list entry. */
12184 static const char *
12185 community_list_config_str (struct community_entry
*entry
)
12193 if (entry
->style
== COMMUNITY_LIST_STANDARD
)
12194 str
= community_str (entry
->u
.com
);
12196 str
= entry
->config
;
12201 /* Display community-list and extcommunity-list configuration. */
12203 community_list_config_write (struct vty
*vty
)
12205 struct community_list
*list
;
12206 struct community_entry
*entry
;
12207 struct community_list_master
*cm
;
12210 /* Community-list. */
12211 cm
= community_list_master_lookup (bgp_clist
, COMMUNITY_LIST_MASTER
);
12213 for (list
= cm
->num
.head
; list
; list
= list
->next
)
12214 for (entry
= list
->head
; entry
; entry
= entry
->next
)
12216 vty_out (vty
, "ip community-list %s %s %s%s",
12217 list
->name
, community_direct_str (entry
->direct
),
12218 community_list_config_str (entry
),
12222 for (list
= cm
->str
.head
; list
; list
= list
->next
)
12223 for (entry
= list
->head
; entry
; entry
= entry
->next
)
12225 vty_out (vty
, "ip community-list %s %s %s %s%s",
12226 entry
->style
== COMMUNITY_LIST_STANDARD
12227 ? "standard" : "expanded",
12228 list
->name
, community_direct_str (entry
->direct
),
12229 community_list_config_str (entry
),
12234 /* Extcommunity-list. */
12235 cm
= community_list_master_lookup (bgp_clist
, EXTCOMMUNITY_LIST_MASTER
);
12237 for (list
= cm
->num
.head
; list
; list
= list
->next
)
12238 for (entry
= list
->head
; entry
; entry
= entry
->next
)
12240 vty_out (vty
, "ip extcommunity-list %s %s %s%s",
12241 list
->name
, community_direct_str (entry
->direct
),
12242 community_list_config_str (entry
), VTY_NEWLINE
);
12245 for (list
= cm
->str
.head
; list
; list
= list
->next
)
12246 for (entry
= list
->head
; entry
; entry
= entry
->next
)
12248 vty_out (vty
, "ip extcommunity-list %s %s %s %s%s",
12249 entry
->style
== EXTCOMMUNITY_LIST_STANDARD
12250 ? "standard" : "expanded",
12251 list
->name
, community_direct_str (entry
->direct
),
12252 community_list_config_str (entry
), VTY_NEWLINE
);
12258 static struct cmd_node community_list_node
=
12260 COMMUNITY_LIST_NODE
,
12262 1 /* Export to vtysh. */
12266 community_list_vty (void)
12268 install_node (&community_list_node
, community_list_config_write
);
12270 /* Community-list. */
12271 install_element (CONFIG_NODE
, &ip_community_list_standard_cmd
);
12272 install_element (CONFIG_NODE
, &no_ip_community_list_standard_all_cmd
);
12273 install_element (CONFIG_NODE
, &no_ip_community_list_expanded_all_cmd
);
12274 install_element (VIEW_NODE
, &show_ip_community_list_cmd
);
12275 install_element (VIEW_NODE
, &show_ip_community_list_arg_cmd
);
12276 install_element (ENABLE_NODE
, &show_ip_community_list_cmd
);
12277 install_element (ENABLE_NODE
, &show_ip_community_list_arg_cmd
);
12279 /* Extcommunity-list. */
12280 install_element (CONFIG_NODE
, &ip_extcommunity_list_standard_cmd
);
12281 install_element (CONFIG_NODE
, &ip_extcommunity_list_name_expanded_cmd
);
12282 install_element (CONFIG_NODE
, &no_ip_extcommunity_list_standard_all_cmd
);
12283 install_element (CONFIG_NODE
, &no_ip_extcommunity_list_expanded_all_cmd
);
12284 install_element (VIEW_NODE
, &show_ip_extcommunity_list_cmd
);
12285 install_element (VIEW_NODE
, &show_ip_extcommunity_list_arg_cmd
);
12286 install_element (ENABLE_NODE
, &show_ip_extcommunity_list_cmd
);
12287 install_element (ENABLE_NODE
, &show_ip_extcommunity_list_arg_cmd
);