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 along
17 * with this program; see the file COPYING; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
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_lcommunity.h"
45 #include "bgpd/bgp_damp.h"
46 #include "bgpd/bgp_debug.h"
47 #include "bgpd/bgp_fsm.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_mplsvpn.h"
53 #include "bgpd/bgp_zebra.h"
54 #include "bgpd/bgp_table.h"
55 #include "bgpd/bgp_vty.h"
56 #include "bgpd/bgp_mpath.h"
57 #include "bgpd/bgp_packet.h"
58 #include "bgpd/bgp_updgrp.h"
59 #include "bgpd/bgp_bfd.h"
61 static struct peer_group
*
62 listen_range_exists (struct bgp
*bgp
, struct prefix
*range
, int exact
);
65 bgp_node_type (afi_t afi
, safi_t safi
)
76 return BGP_IPV4M_NODE
;
78 case SAFI_LABELED_UNICAST
:
79 return BGP_IPV4L_NODE
;
82 return BGP_VPNV4_NODE
;
93 return BGP_IPV6M_NODE
;
95 case SAFI_LABELED_UNICAST
:
96 return BGP_IPV6L_NODE
;
99 return BGP_VPNV6_NODE
;
104 return BGP_EVPN_NODE
;
107 // We should never be here but to clarify the switch statement..
108 return BGP_IPV4_NODE
;
112 // Impossible to happen
113 return BGP_IPV4_NODE
;
116 /* Utility function to get address family from current node. */
118 bgp_node_afi (struct vty
*vty
)
139 /* Utility function to get subsequent address family from current
142 bgp_node_safi (struct vty
*vty
)
149 safi
= SAFI_MPLS_VPN
;
153 safi
= SAFI_MULTICAST
;
160 safi
= SAFI_LABELED_UNICAST
;
170 * Converts an AFI in string form to afi_t
172 * @param afi string, one of
175 * @return the corresponding afi_t
178 bgp_vty_afi_from_str(const char *afi_str
)
180 afi_t afi
= AFI_MAX
; /* unknown */
181 if (strmatch(afi_str
, "ipv4"))
183 else if (strmatch(afi_str
, "ipv6"))
189 argv_find_and_parse_afi(struct cmd_token
**argv
, int argc
, int *index
, afi_t
*afi
)
192 if (argv_find (argv
, argc
, "ipv4", index
))
198 else if (argv_find (argv
, argc
, "ipv6", index
))
207 /* supports <unicast|multicast|vpn|labeled-unicast> */
209 bgp_vty_safi_from_str(const char *safi_str
)
211 safi_t safi
= SAFI_MAX
; /* unknown */
212 if (strmatch (safi_str
, "multicast"))
213 safi
= SAFI_MULTICAST
;
214 else if (strmatch (safi_str
, "unicast"))
216 else if (strmatch (safi_str
, "vpn"))
217 safi
= SAFI_MPLS_VPN
;
218 else if (strmatch (safi_str
, "labeled-unicast"))
219 safi
= SAFI_LABELED_UNICAST
;
224 argv_find_and_parse_safi (struct cmd_token
**argv
, int argc
, int *index
, safi_t
*safi
)
227 if (argv_find (argv
, argc
, "unicast", index
))
231 *safi
= SAFI_UNICAST
;
233 else if (argv_find (argv
, argc
, "multicast", index
))
237 *safi
= SAFI_MULTICAST
;
239 else if (argv_find (argv
, argc
, "labeled-unicast", index
))
243 *safi
= SAFI_LABELED_UNICAST
;
245 else if (argv_find (argv
, argc
, "vpn", index
))
249 *safi
= SAFI_MPLS_VPN
;
255 * bgp_vty_find_and_parse_afi_safi_bgp
257 * For a given 'show ...' command, correctly parse the afi/safi/bgp out from it
258 * This function *assumes* that the calling function pre-sets the afi/safi/bgp
259 * to appropriate values for the calling function. This is to allow the
260 * calling function to make decisions appropriate for the show command
261 * that is being parsed.
263 * The show commands are generally of the form:
264 * "show [ip] bgp [<view|vrf> VIEWVRFNAME] [<ipv4|ipv6> [<unicast|multicast|vpn|labeled-unicast>]] ..."
266 * Since we use argv_find if the show command in particular doesn't have:
268 * [<view|vrf> VIEWVRFNAME]
269 * [<ipv4|ipv6> [<unicast|multicast|vpn|labeled-unicast>]]
270 * The command parsing should still be ok.
272 * vty -> The vty for the command so we can output some useful data in
273 * the event of a parse error in the vrf.
274 * argv -> The command tokens
275 * argc -> How many command tokens we have
276 * idx -> The current place in the command, generally should be 0 for this function
277 * afi -> The parsed afi if it was included in the show command, returned here
278 * safi -> The parsed safi if it was included in the show command, returned here
279 * bgp -> Pointer to the bgp data structure we need to fill in.
281 * The function returns the correct location in the parse tree for the
284 * Returns 0 for failure to parse correctly, else the idx position of where
285 * it found the last token.
288 bgp_vty_find_and_parse_afi_safi_bgp (struct vty
*vty
, struct cmd_token
**argv
, int argc
, int *idx
,
289 afi_t
*afi
, safi_t
*safi
, struct bgp
**bgp
)
291 char *vrf_name
= NULL
;
297 if (argv_find (argv
, argc
, "ip", idx
))
300 if (argv_find (argv
, argc
, "view", idx
) || argv_find (argv
, argc
, "vrf", idx
))
302 vrf_name
= argv
[*idx
+ 1]->arg
;
304 if (strmatch (vrf_name
, "all"))
308 *bgp
= bgp_lookup_by_name (vrf_name
);
311 vty_out (vty
, "View/Vrf specified is unknown: %s%s", vrf_name
, VTYNL
);
319 *bgp
= bgp_get_default ();
322 vty_out (vty
, "Unable to find default BGP instance%s", VTYNL
);
328 if (argv_find_and_parse_afi (argv
, argc
, idx
, afi
))
329 argv_find_and_parse_safi (argv
, argc
, idx
, safi
);
336 peer_address_self_check (struct bgp
*bgp
, union sockunion
*su
)
338 struct interface
*ifp
= NULL
;
340 if (su
->sa
.sa_family
== AF_INET
)
341 ifp
= if_lookup_by_ipv4_exact (&su
->sin
.sin_addr
, bgp
->vrf_id
);
342 else if (su
->sa
.sa_family
== AF_INET6
)
343 ifp
= if_lookup_by_ipv6_exact (&su
->sin6
.sin6_addr
,
344 su
->sin6
.sin6_scope_id
, bgp
->vrf_id
);
352 /* Utility function for looking up peer from VTY. */
353 /* This is used only for configuration, so disallow if attempted on
354 * a dynamic neighbor.
357 peer_lookup_vty (struct vty
*vty
, const char *ip_str
)
359 struct bgp
*bgp
= VTY_GET_CONTEXT(bgp
);
368 ret
= str2sockunion (ip_str
, &su
);
371 peer
= peer_lookup_by_conf_if (bgp
, ip_str
);
374 if ((peer
= peer_lookup_by_hostname(bgp
, ip_str
)) == NULL
)
376 vty_out (vty
, "%% Malformed address or name: %s%s", ip_str
, VTYNL
);
383 peer
= peer_lookup (bgp
, &su
);
386 vty_out (vty
, "%% Specify remote-as or peer-group commands first%s",
390 if (peer_dynamic_neighbor (peer
))
392 vty_out (vty
, "%% Operation not allowed on a dynamic neighbor%s",
401 /* Utility function for looking up peer or peer group. */
402 /* This is used only for configuration, so disallow if attempted on
403 * a dynamic neighbor.
406 peer_and_group_lookup_vty (struct vty
*vty
, const char *peer_str
)
408 struct bgp
*bgp
= VTY_GET_CONTEXT(bgp
);
411 struct peer
*peer
= NULL
;
412 struct peer_group
*group
= NULL
;
418 ret
= str2sockunion (peer_str
, &su
);
421 /* IP address, locate peer. */
422 peer
= peer_lookup (bgp
, &su
);
426 /* Not IP, could match either peer configured on interface or a group. */
427 peer
= peer_lookup_by_conf_if (bgp
, peer_str
);
429 group
= peer_group_lookup (bgp
, peer_str
);
434 if (peer_dynamic_neighbor (peer
))
436 vty_out (vty
, "%% Operation not allowed on a dynamic neighbor%s",
447 vty_out (vty
, "%% Specify remote-as or peer-group commands first%s",
454 bgp_vty_return (struct vty
*vty
, int ret
)
456 const char *str
= NULL
;
460 case BGP_ERR_INVALID_VALUE
:
461 str
= "Invalid value";
463 case BGP_ERR_INVALID_FLAG
:
464 str
= "Invalid flag";
466 case BGP_ERR_PEER_GROUP_SHUTDOWN
:
467 str
= "Peer-group has been shutdown. Activate the peer-group first";
469 case BGP_ERR_PEER_FLAG_CONFLICT
:
470 str
= "Can't set override-capability and strict-capability-match at the same time";
472 case BGP_ERR_PEER_GROUP_NO_REMOTE_AS
:
473 str
= "Specify remote-as or peer-group remote AS first";
475 case BGP_ERR_PEER_GROUP_CANT_CHANGE
:
476 str
= "Cannot change the peer-group. Deconfigure first";
478 case BGP_ERR_PEER_GROUP_MISMATCH
:
479 str
= "Peer is not a member of this peer-group";
481 case BGP_ERR_PEER_FILTER_CONFLICT
:
482 str
= "Prefix/distribute list can not co-exist";
484 case BGP_ERR_NOT_INTERNAL_PEER
:
485 str
= "Invalid command. Not an internal neighbor";
487 case BGP_ERR_REMOVE_PRIVATE_AS
:
488 str
= "remove-private-AS cannot be configured for IBGP peers";
490 case BGP_ERR_LOCAL_AS_ALLOWED_ONLY_FOR_EBGP
:
491 str
= "Local-AS allowed only for EBGP peers";
493 case BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS
:
494 str
= "Cannot have local-as same as BGP AS number";
496 case BGP_ERR_TCPSIG_FAILED
:
497 str
= "Error while applying TCP-Sig to session(s)";
499 case BGP_ERR_NO_EBGP_MULTIHOP_WITH_TTLHACK
:
500 str
= "ebgp-multihop and ttl-security cannot be configured together";
502 case BGP_ERR_NO_IBGP_WITH_TTLHACK
:
503 str
= "ttl-security only allowed for EBGP peers";
505 case BGP_ERR_AS_OVERRIDE
:
506 str
= "as-override cannot be configured for IBGP peers";
508 case BGP_ERR_INVALID_DYNAMIC_NEIGHBORS_LIMIT
:
509 str
= "Invalid limit for number of dynamic neighbors";
511 case BGP_ERR_DYNAMIC_NEIGHBORS_RANGE_EXISTS
:
512 str
= "Dynamic neighbor listen range already exists";
514 case BGP_ERR_INVALID_FOR_DYNAMIC_PEER
:
515 str
= "Operation not allowed on a dynamic neighbor";
517 case BGP_ERR_INVALID_FOR_DIRECT_PEER
:
518 str
= "Operation not allowed on a directly connected neighbor";
520 case BGP_ERR_PEER_SAFI_CONFLICT
:
521 str
= "Cannot activate peer for both 'ipv4 unicast' and 'ipv4 labeled-unicast'";
526 vty_out (vty
, "%% %s%s", str
, VTYNL
);
527 return CMD_WARNING_CONFIG_FAILED
;
532 /* BGP clear sort. */
543 bgp_clear_vty_error (struct vty
*vty
, struct peer
*peer
, afi_t afi
,
544 safi_t safi
, int error
)
548 case BGP_ERR_AF_UNCONFIGURED
:
550 "%%BGP: Enable %s address family for the neighbor %s%s",
551 afi_safi_print(afi
, safi
), peer
->host
, VTYNL
);
553 case BGP_ERR_SOFT_RECONFIG_UNCONFIGURED
:
554 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
, VTYNL
, VTYNL
);
561 /* `clear ip bgp' functions. */
563 bgp_clear (struct vty
*vty
, struct bgp
*bgp
, afi_t afi
, safi_t safi
,
564 enum clear_sort sort
,enum bgp_clear_type stype
, const char *arg
)
568 struct listnode
*node
, *nnode
;
570 /* Clear all neighbors. */
572 * Pass along pointer to next node to peer_clear() when walking all nodes
573 * on the BGP instance as that may get freed if it is a doppelganger
575 if (sort
== clear_all
)
577 for (ALL_LIST_ELEMENTS (bgp
->peer
, node
, nnode
, peer
))
579 if (stype
== BGP_CLEAR_SOFT_NONE
)
580 ret
= peer_clear (peer
, &nnode
);
581 else if (peer
->afc
[afi
][safi
])
582 ret
= peer_clear_soft (peer
, afi
, safi
, stype
);
587 bgp_clear_vty_error (vty
, peer
, afi
, safi
, ret
);
590 /* This is to apply read-only mode on this clear. */
591 if (stype
== BGP_CLEAR_SOFT_NONE
)
592 bgp
->update_delay_over
= 0;
597 /* Clear specified neighbors. */
598 if (sort
== clear_peer
)
603 /* Make sockunion for lookup. */
604 ret
= str2sockunion (arg
, &su
);
607 peer
= peer_lookup_by_conf_if (bgp
, arg
);
610 peer
= peer_lookup_by_hostname(bgp
, arg
);
613 vty_out (vty
, "Malformed address or name: %s%s", arg
, VTYNL
);
620 peer
= peer_lookup (bgp
, &su
);
623 vty_out (vty
, "%%BGP: Unknown neighbor - \"%s\"%s", arg
, VTYNL
);
628 if (stype
== BGP_CLEAR_SOFT_NONE
)
629 ret
= peer_clear (peer
, NULL
);
631 ret
= peer_clear_soft (peer
, afi
, safi
, stype
);
634 bgp_clear_vty_error (vty
, peer
, afi
, safi
, ret
);
639 /* Clear all peer-group members. */
640 if (sort
== clear_group
)
642 struct peer_group
*group
;
644 group
= peer_group_lookup (bgp
, arg
);
647 vty_out (vty
, "%%BGP: No such peer-group %s%s", arg
, VTYNL
);
651 for (ALL_LIST_ELEMENTS (group
->peer
, node
, nnode
, peer
))
653 if (stype
== BGP_CLEAR_SOFT_NONE
)
655 peer_clear (peer
, NULL
);
659 if (! peer
->afc
[afi
][safi
])
662 ret
= peer_clear_soft (peer
, afi
, safi
, stype
);
665 bgp_clear_vty_error (vty
, peer
, afi
, safi
, ret
);
670 if (sort
== clear_external
)
672 for (ALL_LIST_ELEMENTS (bgp
->peer
, node
, nnode
, peer
))
674 if (peer
->sort
== BGP_PEER_IBGP
)
677 if (stype
== BGP_CLEAR_SOFT_NONE
)
678 ret
= peer_clear (peer
, &nnode
);
680 ret
= peer_clear_soft (peer
, afi
, safi
, stype
);
683 bgp_clear_vty_error (vty
, peer
, afi
, safi
, ret
);
688 if (sort
== clear_as
)
693 as
= strtoul(arg
, NULL
, 10);
695 for (ALL_LIST_ELEMENTS (bgp
->peer
, node
, nnode
, peer
))
701 if (stype
== BGP_CLEAR_SOFT_NONE
)
702 ret
= peer_clear (peer
, &nnode
);
704 ret
= peer_clear_soft (peer
, afi
, safi
, stype
);
707 bgp_clear_vty_error (vty
, peer
, afi
, safi
, ret
);
710 vty_out (vty
, "%%BGP: No peer is configured with AS %s%s", arg
,
719 bgp_clear_vty (struct vty
*vty
, const char *name
, afi_t afi
, safi_t safi
,
720 enum clear_sort sort
, enum bgp_clear_type stype
,
725 /* BGP structure lookup. */
728 bgp
= bgp_lookup_by_name (name
);
731 vty_out (vty
, "Can't find BGP instance %s%s", name
, VTYNL
);
737 bgp
= bgp_get_default ();
740 vty_out (vty
, "No BGP process is configured%s", VTYNL
);
745 return bgp_clear (vty
, bgp
, afi
, safi
, sort
, stype
, arg
);
748 /* clear soft inbound */
750 bgp_clear_star_soft_in (struct vty
*vty
, const char *name
)
752 bgp_clear_vty (vty
, name
, AFI_IP
, SAFI_UNICAST
, clear_all
,
753 BGP_CLEAR_SOFT_IN
, NULL
);
754 bgp_clear_vty (vty
, name
, AFI_IP6
, SAFI_UNICAST
, clear_all
,
755 BGP_CLEAR_SOFT_IN
, NULL
);
758 /* clear soft outbound */
760 bgp_clear_star_soft_out (struct vty
*vty
, const char *name
)
762 bgp_clear_vty (vty
, name
, AFI_IP
, SAFI_UNICAST
, clear_all
,
763 BGP_CLEAR_SOFT_OUT
, NULL
);
764 bgp_clear_vty (vty
, name
, AFI_IP6
, SAFI_UNICAST
, clear_all
,
765 BGP_CLEAR_SOFT_OUT
, NULL
);
769 #ifndef VTYSH_EXTRACT_PL
770 #include "bgp_vty_clippy.c"
773 /* BGP global configuration. */
775 DEFUN (bgp_multiple_instance_func
,
776 bgp_multiple_instance_cmd
,
777 "bgp multiple-instance",
779 "Enable bgp multiple instance\n")
781 bgp_option_set (BGP_OPT_MULTIPLE_INSTANCE
);
785 DEFUN (no_bgp_multiple_instance
,
786 no_bgp_multiple_instance_cmd
,
787 "no bgp multiple-instance",
790 "BGP multiple instance\n")
794 ret
= bgp_option_unset (BGP_OPT_MULTIPLE_INSTANCE
);
797 vty_out (vty
, "%% There are more than two BGP instances%s", VTYNL
);
798 return CMD_WARNING_CONFIG_FAILED
;
803 DEFUN (bgp_config_type
,
805 "bgp config-type <cisco|zebra>",
807 "Configuration type\n"
812 if (argv_find (argv
, argc
, "cisco", &idx
))
813 bgp_option_set (BGP_OPT_CONFIG_CISCO
);
815 bgp_option_unset (BGP_OPT_CONFIG_CISCO
);
820 DEFUN (no_bgp_config_type
,
821 no_bgp_config_type_cmd
,
822 "no bgp config-type [<cisco|zebra>]",
825 "Display configuration type\n"
829 bgp_option_unset (BGP_OPT_CONFIG_CISCO
);
834 DEFUN (no_synchronization
,
835 no_synchronization_cmd
,
836 "no synchronization",
838 "Perform IGP synchronization\n")
843 DEFUN (no_auto_summary
,
847 "Enable automatic network number summarization\n")
852 /* "router bgp" commands. */
853 DEFUN_NOSH (router_bgp
,
855 "router bgp [(1-4294967295) [<view|vrf> VIEWVRFNAME]]",
859 BGP_INSTANCE_HELP_STR
)
862 int idx_view_vrf
= 3;
867 const char *name
= NULL
;
868 enum bgp_instance_type inst_type
;
870 // "router bgp" without an ASN
873 //Pending: Make VRF option available for ASN less config
874 bgp
= bgp_get_default();
878 vty_out (vty
, "%% No BGP process is configured%s", VTYNL
);
879 return CMD_WARNING_CONFIG_FAILED
;
882 if (listcount(bm
->bgp
) > 1)
884 vty_out (vty
, "%% Multiple BGP processes are configured%s", VTYNL
);
885 return CMD_WARNING_CONFIG_FAILED
;
892 as
= strtoul (argv
[idx_asn
]->arg
, NULL
, 10);
894 inst_type
= BGP_INSTANCE_TYPE_DEFAULT
;
897 name
= argv
[idx_vrf
]->arg
;
899 if (!strcmp(argv
[idx_view_vrf
]->text
, "vrf"))
900 inst_type
= BGP_INSTANCE_TYPE_VRF
;
901 else if (!strcmp(argv
[idx_view_vrf
]->text
, "view"))
902 inst_type
= BGP_INSTANCE_TYPE_VIEW
;
905 ret
= bgp_get (&bgp
, &as
, name
, inst_type
);
908 case BGP_ERR_MULTIPLE_INSTANCE_NOT_SET
:
909 vty_out (vty
, "Please specify 'bgp multiple-instance' first%s",
911 return CMD_WARNING_CONFIG_FAILED
;
912 case BGP_ERR_AS_MISMATCH
:
913 vty_out (vty
, "BGP is already running; AS is %u%s", as
, VTYNL
);
914 return CMD_WARNING_CONFIG_FAILED
;
915 case BGP_ERR_INSTANCE_MISMATCH
:
916 vty_out (vty
, "BGP instance name and AS number mismatch%s", VTYNL
);
917 vty_out (vty
, "BGP instance is already running; AS is %u%s",
919 return CMD_WARNING_CONFIG_FAILED
;
922 /* Pending: handle when user tries to change a view to vrf n vv. */
925 VTY_PUSH_CONTEXT(BGP_NODE
, bgp
);
930 /* "no router bgp" commands. */
931 DEFUN (no_router_bgp
,
933 "no router bgp [(1-4294967295) [<view|vrf> VIEWVRFNAME]]",
938 BGP_INSTANCE_HELP_STR
)
944 const char *name
= NULL
;
946 // "no router bgp" without an ASN
949 //Pending: Make VRF option available for ASN less config
950 bgp
= bgp_get_default();
954 vty_out (vty
, "%% No BGP process is configured%s", VTYNL
);
955 return CMD_WARNING_CONFIG_FAILED
;
958 if (listcount(bm
->bgp
) > 1)
960 vty_out (vty
, "%% Multiple BGP processes are configured%s", VTYNL
);
961 return CMD_WARNING_CONFIG_FAILED
;
966 as
= strtoul(argv
[idx_asn
]->arg
, NULL
, 10);
969 name
= argv
[idx_vrf
]->arg
;
971 /* Lookup bgp structure. */
972 bgp
= bgp_lookup (as
, name
);
975 vty_out (vty
, "%% Can't find BGP instance%s", VTYNL
);
976 return CMD_WARNING_CONFIG_FAILED
;
989 DEFPY (bgp_router_id
,
991 "bgp router-id A.B.C.D",
993 "Override configured router identifier\n"
994 "Manually configured router identifier\n")
996 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
997 bgp_router_id_static_set (bgp
, router_id
);
1001 DEFPY (no_bgp_router_id
,
1002 no_bgp_router_id_cmd
,
1003 "no bgp router-id [A.B.C.D]",
1006 "Override configured router identifier\n"
1007 "Manually configured router identifier\n")
1009 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1013 if (! IPV4_ADDR_SAME (&bgp
->router_id_static
, &router_id
))
1015 vty_outln (vty
, "%% BGP router-id doesn't match");
1016 return CMD_WARNING_CONFIG_FAILED
;
1020 router_id
.s_addr
= 0;
1021 bgp_router_id_static_set (bgp
, router_id
);
1027 /* BGP Cluster ID. */
1028 DEFUN (bgp_cluster_id
,
1030 "bgp cluster-id <A.B.C.D|(1-4294967295)>",
1032 "Configure Route-Reflector Cluster-id\n"
1033 "Route-Reflector Cluster-id in IP address format\n"
1034 "Route-Reflector Cluster-id as 32 bit quantity\n")
1036 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1039 struct in_addr cluster
;
1041 ret
= inet_aton (argv
[idx_ipv4
]->arg
, &cluster
);
1044 vty_out (vty
, "%% Malformed bgp cluster identifier%s", VTYNL
);
1045 return CMD_WARNING_CONFIG_FAILED
;
1048 bgp_cluster_id_set (bgp
, &cluster
);
1049 bgp_clear_star_soft_out (vty
, bgp
->name
);
1054 DEFUN (no_bgp_cluster_id
,
1055 no_bgp_cluster_id_cmd
,
1056 "no bgp cluster-id [<A.B.C.D|(1-4294967295)>]",
1059 "Configure Route-Reflector Cluster-id\n"
1060 "Route-Reflector Cluster-id in IP address format\n"
1061 "Route-Reflector Cluster-id as 32 bit quantity\n")
1063 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1064 bgp_cluster_id_unset (bgp
);
1065 bgp_clear_star_soft_out (vty
, bgp
->name
);
1070 DEFUN (bgp_confederation_identifier
,
1071 bgp_confederation_identifier_cmd
,
1072 "bgp confederation identifier (1-4294967295)",
1073 "BGP specific commands\n"
1074 "AS confederation parameters\n"
1076 "Set routing domain confederation AS\n")
1078 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1082 as
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
1084 bgp_confederation_id_set (bgp
, as
);
1089 DEFUN (no_bgp_confederation_identifier
,
1090 no_bgp_confederation_identifier_cmd
,
1091 "no bgp confederation identifier [(1-4294967295)]",
1093 "BGP specific commands\n"
1094 "AS confederation parameters\n"
1096 "Set routing domain confederation AS\n")
1098 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1099 bgp_confederation_id_unset (bgp
);
1104 DEFUN (bgp_confederation_peers
,
1105 bgp_confederation_peers_cmd
,
1106 "bgp confederation peers (1-4294967295)...",
1107 "BGP specific commands\n"
1108 "AS confederation parameters\n"
1109 "Peer ASs in BGP confederation\n"
1112 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1117 for (i
= idx_asn
; i
< argc
; i
++)
1119 as
= strtoul(argv
[i
]->arg
, NULL
, 10);
1123 vty_out (vty
, "%% Local member-AS not allowed in confed peer list%s",
1128 bgp_confederation_peers_add (bgp
, as
);
1133 DEFUN (no_bgp_confederation_peers
,
1134 no_bgp_confederation_peers_cmd
,
1135 "no bgp confederation peers (1-4294967295)...",
1137 "BGP specific commands\n"
1138 "AS confederation parameters\n"
1139 "Peer ASs in BGP confederation\n"
1142 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1147 for (i
= idx_asn
; i
< argc
; i
++)
1149 as
= strtoul(argv
[i
]->arg
, NULL
, 10);
1151 bgp_confederation_peers_remove (bgp
, as
);
1157 * Central routine for maximum-paths configuration.
1158 * @peer_type: BGP_PEER_EBGP or BGP_PEER_IBGP
1159 * @set: 1 for setting values, 0 for removing the max-paths config.
1162 bgp_maxpaths_config_vty (struct vty
*vty
, int peer_type
, const char *mpaths
,
1163 u_int16_t options
, int set
)
1165 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1166 u_int16_t maxpaths
= 0;
1171 afi
= bgp_node_afi (vty
);
1172 safi
= bgp_node_safi (vty
);
1176 maxpaths
= strtol(mpaths
, NULL
, 10);
1177 if (maxpaths
> multipath_num
)
1180 "%% Maxpaths Specified: %d is > than multipath num specified on bgp command line %d",
1181 maxpaths
, multipath_num
);
1182 return CMD_WARNING_CONFIG_FAILED
;
1184 ret
= bgp_maximum_paths_set (bgp
, afi
, safi
, peer_type
, maxpaths
, options
);
1187 ret
= bgp_maximum_paths_unset (bgp
, afi
, safi
, peer_type
);
1192 "%% Failed to %sset maximum-paths %s %u for afi %u, safi %u%s",
1193 (set
== 1) ? "" : "un",
1194 (peer_type
== BGP_PEER_EBGP
) ? "ebgp" : "ibgp",
1195 maxpaths
, afi
, safi
, VTYNL
);
1196 return CMD_WARNING_CONFIG_FAILED
;
1199 bgp_recalculate_all_bestpaths (bgp
);
1204 DEFUN (bgp_maxmed_admin
,
1205 bgp_maxmed_admin_cmd
,
1206 "bgp max-med administrative ",
1208 "Advertise routes with max-med\n"
1209 "Administratively applied, for an indefinite period\n")
1211 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1213 bgp
->v_maxmed_admin
= 1;
1214 bgp
->maxmed_admin_value
= BGP_MAXMED_VALUE_DEFAULT
;
1216 bgp_maxmed_update(bgp
);
1221 DEFUN (bgp_maxmed_admin_medv
,
1222 bgp_maxmed_admin_medv_cmd
,
1223 "bgp max-med administrative (0-4294967295)",
1225 "Advertise routes with max-med\n"
1226 "Administratively applied, for an indefinite period\n"
1227 "Max MED value to be used\n")
1229 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1232 bgp
->v_maxmed_admin
= 1;
1233 bgp
->maxmed_admin_value
= strtoul (argv
[idx_number
]->arg
, NULL
, 10);
1235 bgp_maxmed_update(bgp
);
1240 DEFUN (no_bgp_maxmed_admin
,
1241 no_bgp_maxmed_admin_cmd
,
1242 "no bgp max-med administrative [(0-4294967295)]",
1245 "Advertise routes with max-med\n"
1246 "Administratively applied, for an indefinite period\n"
1247 "Max MED value to be used\n")
1249 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1250 bgp
->v_maxmed_admin
= BGP_MAXMED_ADMIN_UNCONFIGURED
;
1251 bgp
->maxmed_admin_value
= BGP_MAXMED_VALUE_DEFAULT
;
1252 bgp_maxmed_update(bgp
);
1257 DEFUN (bgp_maxmed_onstartup
,
1258 bgp_maxmed_onstartup_cmd
,
1259 "bgp max-med on-startup (5-86400) [(0-4294967295)]",
1261 "Advertise routes with max-med\n"
1262 "Effective on a startup\n"
1263 "Time (seconds) period for max-med\n"
1264 "Max MED value to be used\n")
1266 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1269 argv_find (argv
, argc
, "(5-86400)", &idx
);
1270 bgp
->v_maxmed_onstartup
= strtoul (argv
[idx
]->arg
, NULL
, 10);
1271 if (argv_find (argv
, argc
, "(0-4294967295)", &idx
))
1272 bgp
->maxmed_onstartup_value
= strtoul (argv
[idx
]->arg
, NULL
, 10);
1274 bgp
->maxmed_onstartup_value
= BGP_MAXMED_VALUE_DEFAULT
;
1276 bgp_maxmed_update(bgp
);
1281 DEFUN (no_bgp_maxmed_onstartup
,
1282 no_bgp_maxmed_onstartup_cmd
,
1283 "no bgp max-med on-startup [(5-86400) [(0-4294967295)]]",
1286 "Advertise routes with max-med\n"
1287 "Effective on a startup\n"
1288 "Time (seconds) period for max-med\n"
1289 "Max MED value to be used\n")
1291 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1293 /* Cancel max-med onstartup if its on */
1294 if (bgp
->t_maxmed_onstartup
)
1296 THREAD_TIMER_OFF (bgp
->t_maxmed_onstartup
);
1297 bgp
->maxmed_onstartup_over
= 1;
1300 bgp
->v_maxmed_onstartup
= BGP_MAXMED_ONSTARTUP_UNCONFIGURED
;
1301 bgp
->maxmed_onstartup_value
= BGP_MAXMED_VALUE_DEFAULT
;
1303 bgp_maxmed_update(bgp
);
1309 bgp_update_delay_config_vty (struct vty
*vty
, const char *delay
,
1312 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1313 u_int16_t update_delay
;
1314 u_int16_t establish_wait
;
1316 update_delay
= strtoul(delay
, NULL
, 10);
1318 if (!wait
) /* update-delay <delay> */
1320 bgp
->v_update_delay
= update_delay
;
1321 bgp
->v_establish_wait
= bgp
->v_update_delay
;
1325 /* update-delay <delay> <establish-wait> */
1326 establish_wait
= atoi (wait
);
1327 if (update_delay
< establish_wait
)
1329 vty_out (vty
, "%%Failed: update-delay less than the establish-wait!%s",
1331 return CMD_WARNING_CONFIG_FAILED
;
1334 bgp
->v_update_delay
= update_delay
;
1335 bgp
->v_establish_wait
= establish_wait
;
1341 bgp_update_delay_deconfig_vty (struct vty
*vty
)
1343 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1345 bgp
->v_update_delay
= BGP_UPDATE_DELAY_DEF
;
1346 bgp
->v_establish_wait
= bgp
->v_update_delay
;
1352 bgp_config_write_update_delay (struct vty
*vty
, struct bgp
*bgp
)
1354 if (bgp
->v_update_delay
!= BGP_UPDATE_DELAY_DEF
)
1356 vty_out (vty
, " update-delay %d", bgp
->v_update_delay
);
1357 if (bgp
->v_update_delay
!= bgp
->v_establish_wait
)
1358 vty_out (vty
, " %d", bgp
->v_establish_wait
);
1359 vty_out (vty
, "%s", VTYNL
);
1366 /* Update-delay configuration */
1367 DEFUN (bgp_update_delay
,
1368 bgp_update_delay_cmd
,
1369 "update-delay (0-3600)",
1370 "Force initial delay for best-path and updates\n"
1374 return bgp_update_delay_config_vty(vty
, argv
[idx_number
]->arg
, NULL
);
1377 DEFUN (bgp_update_delay_establish_wait
,
1378 bgp_update_delay_establish_wait_cmd
,
1379 "update-delay (0-3600) (1-3600)",
1380 "Force initial delay for best-path and updates\n"
1385 int idx_number_2
= 2;
1386 return bgp_update_delay_config_vty(vty
, argv
[idx_number
]->arg
, argv
[idx_number_2
]->arg
);
1389 /* Update-delay deconfiguration */
1390 DEFUN (no_bgp_update_delay
,
1391 no_bgp_update_delay_cmd
,
1392 "no update-delay [(0-3600) [(1-3600)]]",
1394 "Force initial delay for best-path and updates\n"
1398 return bgp_update_delay_deconfig_vty(vty
);
1403 bgp_wpkt_quanta_config_vty (struct vty
*vty
, const char *num
, char set
)
1405 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1408 bgp
->wpkt_quanta
= strtoul(num
, NULL
, 10);
1410 bgp
->wpkt_quanta
= BGP_WRITE_PACKET_MAX
;
1416 bgp_config_write_wpkt_quanta (struct vty
*vty
, struct bgp
*bgp
)
1418 if (bgp
->wpkt_quanta
!= BGP_WRITE_PACKET_MAX
)
1419 vty_out (vty
, " write-quanta %d%s",
1420 bgp
->wpkt_quanta
, VTYNL
);
1426 /* Update-delay configuration */
1427 DEFUN (bgp_wpkt_quanta
,
1428 bgp_wpkt_quanta_cmd
,
1429 "write-quanta (1-10000)",
1430 "How many packets to write to peer socket per run\n"
1431 "Number of packets\n")
1434 return bgp_wpkt_quanta_config_vty(vty
, argv
[idx_number
]->arg
, 1);
1437 /* Update-delay deconfiguration */
1438 DEFUN (no_bgp_wpkt_quanta
,
1439 no_bgp_wpkt_quanta_cmd
,
1440 "no write-quanta (1-10000)",
1442 "How many packets to write to peer socket per run\n"
1443 "Number of packets\n")
1446 return bgp_wpkt_quanta_config_vty(vty
, argv
[idx_number
]->arg
, 0);
1450 bgp_config_write_coalesce_time (struct vty
*vty
, struct bgp
*bgp
)
1452 if (bgp
->coalesce_time
!= BGP_DEFAULT_SUBGROUP_COALESCE_TIME
)
1453 vty_out (vty
, " coalesce-time %u%s",
1454 bgp
->coalesce_time
, VTYNL
);
1460 DEFUN (bgp_coalesce_time
,
1461 bgp_coalesce_time_cmd
,
1462 "coalesce-time (0-4294967295)",
1463 "Subgroup coalesce timer\n"
1464 "Subgroup coalesce timer value (in ms)\n")
1466 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1469 argv_find (argv
, argc
, "(0-4294967295)", &idx
);
1470 bgp
->coalesce_time
= strtoul (argv
[idx
]->arg
, NULL
, 10);
1474 DEFUN (no_bgp_coalesce_time
,
1475 no_bgp_coalesce_time_cmd
,
1476 "no coalesce-time (0-4294967295)",
1478 "Subgroup coalesce timer\n"
1479 "Subgroup coalesce timer value (in ms)\n")
1481 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1483 bgp
->coalesce_time
= BGP_DEFAULT_SUBGROUP_COALESCE_TIME
;
1487 /* Maximum-paths configuration */
1488 DEFUN (bgp_maxpaths
,
1490 "maximum-paths " CMD_RANGE_STR(1, MULTIPATH_NUM
),
1491 "Forward packets over multiple paths\n"
1492 "Number of paths\n")
1495 return bgp_maxpaths_config_vty(vty
, BGP_PEER_EBGP
, argv
[idx_number
]->arg
, 0, 1);
1498 ALIAS_HIDDEN (bgp_maxpaths
,
1499 bgp_maxpaths_hidden_cmd
,
1500 "maximum-paths " CMD_RANGE_STR(1, MULTIPATH_NUM
),
1501 "Forward packets over multiple paths\n"
1502 "Number of paths\n")
1504 DEFUN (bgp_maxpaths_ibgp
,
1505 bgp_maxpaths_ibgp_cmd
,
1506 "maximum-paths ibgp " CMD_RANGE_STR(1, MULTIPATH_NUM
),
1507 "Forward packets over multiple paths\n"
1509 "Number of paths\n")
1512 return bgp_maxpaths_config_vty(vty
, BGP_PEER_IBGP
, argv
[idx_number
]->arg
, 0, 1);
1515 ALIAS_HIDDEN (bgp_maxpaths_ibgp
,
1516 bgp_maxpaths_ibgp_hidden_cmd
,
1517 "maximum-paths ibgp " CMD_RANGE_STR(1, MULTIPATH_NUM
),
1518 "Forward packets over multiple paths\n"
1520 "Number of paths\n")
1522 DEFUN (bgp_maxpaths_ibgp_cluster
,
1523 bgp_maxpaths_ibgp_cluster_cmd
,
1524 "maximum-paths ibgp " CMD_RANGE_STR(1, MULTIPATH_NUM
) " equal-cluster-length",
1525 "Forward packets over multiple paths\n"
1528 "Match the cluster length\n")
1531 return bgp_maxpaths_config_vty(vty
, BGP_PEER_IBGP
, argv
[idx_number
]->arg
,
1532 BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN
, 1);
1535 ALIAS_HIDDEN (bgp_maxpaths_ibgp_cluster
,
1536 bgp_maxpaths_ibgp_cluster_hidden_cmd
,
1537 "maximum-paths ibgp " CMD_RANGE_STR(1, MULTIPATH_NUM
) " equal-cluster-length",
1538 "Forward packets over multiple paths\n"
1541 "Match the cluster length\n")
1543 DEFUN (no_bgp_maxpaths
,
1544 no_bgp_maxpaths_cmd
,
1545 "no maximum-paths [" CMD_RANGE_STR(1, MULTIPATH_NUM
) "]",
1547 "Forward packets over multiple paths\n"
1548 "Number of paths\n")
1550 return bgp_maxpaths_config_vty(vty
, BGP_PEER_EBGP
, NULL
, 0, 0);
1553 ALIAS_HIDDEN (no_bgp_maxpaths
,
1554 no_bgp_maxpaths_hidden_cmd
,
1555 "no maximum-paths [" CMD_RANGE_STR(1, MULTIPATH_NUM
) "]",
1557 "Forward packets over multiple paths\n"
1558 "Number of paths\n")
1560 DEFUN (no_bgp_maxpaths_ibgp
,
1561 no_bgp_maxpaths_ibgp_cmd
,
1562 "no maximum-paths ibgp [" CMD_RANGE_STR(1, MULTIPATH_NUM
) " [equal-cluster-length]]",
1564 "Forward packets over multiple paths\n"
1567 "Match the cluster length\n")
1569 return bgp_maxpaths_config_vty(vty
, BGP_PEER_IBGP
, NULL
, 0, 0);
1572 ALIAS_HIDDEN (no_bgp_maxpaths_ibgp
,
1573 no_bgp_maxpaths_ibgp_hidden_cmd
,
1574 "no maximum-paths ibgp [" CMD_RANGE_STR(1, MULTIPATH_NUM
) " [equal-cluster-length]]",
1576 "Forward packets over multiple paths\n"
1579 "Match the cluster length\n")
1582 bgp_config_write_maxpaths (struct vty
*vty
, struct bgp
*bgp
, afi_t afi
,
1583 safi_t safi
, int *write
)
1585 if (bgp
->maxpaths
[afi
][safi
].maxpaths_ebgp
!= MULTIPATH_NUM
)
1587 bgp_config_write_family_header (vty
, afi
, safi
, write
);
1588 vty_out (vty
, " maximum-paths %d%s",
1589 bgp
->maxpaths
[afi
][safi
].maxpaths_ebgp
, VTYNL
);
1592 if (bgp
->maxpaths
[afi
][safi
].maxpaths_ibgp
!= MULTIPATH_NUM
)
1594 bgp_config_write_family_header (vty
, afi
, safi
, write
);
1595 vty_out (vty
, " maximum-paths ibgp %d",
1596 bgp
->maxpaths
[afi
][safi
].maxpaths_ibgp
);
1597 if (CHECK_FLAG (bgp
->maxpaths
[afi
][safi
].ibgp_flags
,
1598 BGP_FLAG_IBGP_MULTIPATH_SAME_CLUSTERLEN
))
1599 vty_out (vty
, " equal-cluster-length");
1600 vty_out (vty
, "%s", VTYNL
);
1610 "timers bgp (0-65535) (0-65535)",
1611 "Adjust routing timers\n"
1613 "Keepalive interval\n"
1616 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1618 int idx_number_2
= 3;
1619 unsigned long keepalive
= 0;
1620 unsigned long holdtime
= 0;
1622 keepalive
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
1623 holdtime
= strtoul(argv
[idx_number_2
]->arg
, NULL
, 10);
1625 /* Holdtime value check. */
1626 if (holdtime
< 3 && holdtime
!= 0)
1628 vty_out (vty
, "%% hold time value must be either 0 or greater than 3%s",
1630 return CMD_WARNING_CONFIG_FAILED
;
1633 bgp_timers_set (bgp
, keepalive
, holdtime
);
1638 DEFUN (no_bgp_timers
,
1640 "no timers bgp [(0-65535) (0-65535)]",
1642 "Adjust routing timers\n"
1644 "Keepalive interval\n"
1647 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1648 bgp_timers_unset (bgp
);
1654 DEFUN (bgp_client_to_client_reflection
,
1655 bgp_client_to_client_reflection_cmd
,
1656 "bgp client-to-client reflection",
1657 "BGP specific commands\n"
1658 "Configure client to client route reflection\n"
1659 "reflection of routes allowed\n")
1661 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1662 bgp_flag_unset (bgp
, BGP_FLAG_NO_CLIENT_TO_CLIENT
);
1663 bgp_clear_star_soft_out (vty
, bgp
->name
);
1668 DEFUN (no_bgp_client_to_client_reflection
,
1669 no_bgp_client_to_client_reflection_cmd
,
1670 "no bgp client-to-client reflection",
1672 "BGP specific commands\n"
1673 "Configure client to client route reflection\n"
1674 "reflection of routes allowed\n")
1676 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1677 bgp_flag_set (bgp
, BGP_FLAG_NO_CLIENT_TO_CLIENT
);
1678 bgp_clear_star_soft_out (vty
, bgp
->name
);
1683 /* "bgp always-compare-med" configuration. */
1684 DEFUN (bgp_always_compare_med
,
1685 bgp_always_compare_med_cmd
,
1686 "bgp always-compare-med",
1687 "BGP specific commands\n"
1688 "Allow comparing MED from different neighbors\n")
1690 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1691 bgp_flag_set (bgp
, BGP_FLAG_ALWAYS_COMPARE_MED
);
1692 bgp_recalculate_all_bestpaths (bgp
);
1697 DEFUN (no_bgp_always_compare_med
,
1698 no_bgp_always_compare_med_cmd
,
1699 "no bgp always-compare-med",
1701 "BGP specific commands\n"
1702 "Allow comparing MED from different neighbors\n")
1704 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1705 bgp_flag_unset (bgp
, BGP_FLAG_ALWAYS_COMPARE_MED
);
1706 bgp_recalculate_all_bestpaths (bgp
);
1711 /* "bgp deterministic-med" configuration. */
1712 DEFUN (bgp_deterministic_med
,
1713 bgp_deterministic_med_cmd
,
1714 "bgp deterministic-med",
1715 "BGP specific commands\n"
1716 "Pick the best-MED path among paths advertised from the neighboring AS\n")
1718 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1720 if (!bgp_flag_check(bgp
, BGP_FLAG_DETERMINISTIC_MED
))
1722 bgp_flag_set (bgp
, BGP_FLAG_DETERMINISTIC_MED
);
1723 bgp_recalculate_all_bestpaths (bgp
);
1729 DEFUN (no_bgp_deterministic_med
,
1730 no_bgp_deterministic_med_cmd
,
1731 "no bgp deterministic-med",
1733 "BGP specific commands\n"
1734 "Pick the best-MED path among paths advertised from the neighboring AS\n")
1736 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1737 int bestpath_per_as_used
;
1741 struct listnode
*node
, *nnode
;
1743 if (bgp_flag_check(bgp
, BGP_FLAG_DETERMINISTIC_MED
))
1745 bestpath_per_as_used
= 0;
1747 for (ALL_LIST_ELEMENTS (bgp
->peer
, node
, nnode
, peer
))
1749 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
1750 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
1751 if (CHECK_FLAG (peer
->af_flags
[afi
][safi
], PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS
))
1753 bestpath_per_as_used
= 1;
1757 if (bestpath_per_as_used
)
1761 if (bestpath_per_as_used
)
1763 vty_out (vty
, "bgp deterministic-med cannot be disabled while addpath-tx-bestpath-per-AS is in use%s",
1765 return CMD_WARNING_CONFIG_FAILED
;
1769 bgp_flag_unset (bgp
, BGP_FLAG_DETERMINISTIC_MED
);
1770 bgp_recalculate_all_bestpaths (bgp
);
1777 /* "bgp graceful-restart" configuration. */
1778 DEFUN (bgp_graceful_restart
,
1779 bgp_graceful_restart_cmd
,
1780 "bgp graceful-restart",
1781 "BGP specific commands\n"
1782 "Graceful restart capability parameters\n")
1784 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1785 bgp_flag_set (bgp
, BGP_FLAG_GRACEFUL_RESTART
);
1789 DEFUN (no_bgp_graceful_restart
,
1790 no_bgp_graceful_restart_cmd
,
1791 "no bgp graceful-restart",
1793 "BGP specific commands\n"
1794 "Graceful restart capability parameters\n")
1796 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1797 bgp_flag_unset (bgp
, BGP_FLAG_GRACEFUL_RESTART
);
1801 DEFUN (bgp_graceful_restart_stalepath_time
,
1802 bgp_graceful_restart_stalepath_time_cmd
,
1803 "bgp graceful-restart stalepath-time (1-3600)",
1804 "BGP specific commands\n"
1805 "Graceful restart capability parameters\n"
1806 "Set the max time to hold onto restarting peer's stale paths\n"
1807 "Delay value (seconds)\n")
1809 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1811 u_int32_t stalepath
;
1813 stalepath
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
1814 bgp
->stalepath_time
= stalepath
;
1818 DEFUN (bgp_graceful_restart_restart_time
,
1819 bgp_graceful_restart_restart_time_cmd
,
1820 "bgp graceful-restart restart-time (1-3600)",
1821 "BGP specific commands\n"
1822 "Graceful restart capability parameters\n"
1823 "Set the time to wait to delete stale routes before a BGP open message is received\n"
1824 "Delay value (seconds)\n")
1826 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1830 restart
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
1831 bgp
->restart_time
= restart
;
1835 DEFUN (no_bgp_graceful_restart_stalepath_time
,
1836 no_bgp_graceful_restart_stalepath_time_cmd
,
1837 "no bgp graceful-restart stalepath-time [(1-3600)]",
1839 "BGP specific commands\n"
1840 "Graceful restart capability parameters\n"
1841 "Set the max time to hold onto restarting peer's stale paths\n"
1842 "Delay value (seconds)\n")
1844 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1846 bgp
->stalepath_time
= BGP_DEFAULT_STALEPATH_TIME
;
1850 DEFUN (no_bgp_graceful_restart_restart_time
,
1851 no_bgp_graceful_restart_restart_time_cmd
,
1852 "no bgp graceful-restart restart-time [(1-3600)]",
1854 "BGP specific commands\n"
1855 "Graceful restart capability parameters\n"
1856 "Set the time to wait to delete stale routes before a BGP open message is received\n"
1857 "Delay value (seconds)\n")
1859 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1861 bgp
->restart_time
= BGP_DEFAULT_RESTART_TIME
;
1865 DEFUN (bgp_graceful_restart_preserve_fw
,
1866 bgp_graceful_restart_preserve_fw_cmd
,
1867 "bgp graceful-restart preserve-fw-state",
1868 "BGP specific commands\n"
1869 "Graceful restart capability parameters\n"
1870 "Sets F-bit indication that fib is preserved while doing Graceful Restart\n")
1872 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1873 bgp_flag_set(bgp
, BGP_FLAG_GR_PRESERVE_FWD
);
1877 DEFUN (no_bgp_graceful_restart_preserve_fw
,
1878 no_bgp_graceful_restart_preserve_fw_cmd
,
1879 "no bgp graceful-restart preserve-fw-state",
1881 "BGP specific commands\n"
1882 "Graceful restart capability parameters\n"
1883 "Unsets F-bit indication that fib is preserved while doing Graceful Restart\n")
1885 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1886 bgp_flag_unset(bgp
, BGP_FLAG_GR_PRESERVE_FWD
);
1890 /* "bgp fast-external-failover" configuration. */
1891 DEFUN (bgp_fast_external_failover
,
1892 bgp_fast_external_failover_cmd
,
1893 "bgp fast-external-failover",
1895 "Immediately reset session if a link to a directly connected external peer goes down\n")
1897 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1898 bgp_flag_unset (bgp
, BGP_FLAG_NO_FAST_EXT_FAILOVER
);
1902 DEFUN (no_bgp_fast_external_failover
,
1903 no_bgp_fast_external_failover_cmd
,
1904 "no bgp fast-external-failover",
1907 "Immediately reset session if a link to a directly connected external peer goes down\n")
1909 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1910 bgp_flag_set (bgp
, BGP_FLAG_NO_FAST_EXT_FAILOVER
);
1914 /* "bgp enforce-first-as" configuration. */
1915 DEFUN (bgp_enforce_first_as
,
1916 bgp_enforce_first_as_cmd
,
1917 "bgp enforce-first-as",
1919 "Enforce the first AS for EBGP routes\n")
1921 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1922 bgp_flag_set (bgp
, BGP_FLAG_ENFORCE_FIRST_AS
);
1923 bgp_clear_star_soft_in (vty
, bgp
->name
);
1928 DEFUN (no_bgp_enforce_first_as
,
1929 no_bgp_enforce_first_as_cmd
,
1930 "no bgp enforce-first-as",
1933 "Enforce the first AS for EBGP routes\n")
1935 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1936 bgp_flag_unset (bgp
, BGP_FLAG_ENFORCE_FIRST_AS
);
1937 bgp_clear_star_soft_in (vty
, bgp
->name
);
1942 /* "bgp bestpath compare-routerid" configuration. */
1943 DEFUN (bgp_bestpath_compare_router_id
,
1944 bgp_bestpath_compare_router_id_cmd
,
1945 "bgp bestpath compare-routerid",
1946 "BGP specific commands\n"
1947 "Change the default bestpath selection\n"
1948 "Compare router-id for identical EBGP paths\n")
1950 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1951 bgp_flag_set (bgp
, BGP_FLAG_COMPARE_ROUTER_ID
);
1952 bgp_recalculate_all_bestpaths (bgp
);
1957 DEFUN (no_bgp_bestpath_compare_router_id
,
1958 no_bgp_bestpath_compare_router_id_cmd
,
1959 "no bgp bestpath compare-routerid",
1961 "BGP specific commands\n"
1962 "Change the default bestpath selection\n"
1963 "Compare router-id for identical EBGP paths\n")
1965 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1966 bgp_flag_unset (bgp
, BGP_FLAG_COMPARE_ROUTER_ID
);
1967 bgp_recalculate_all_bestpaths (bgp
);
1972 /* "bgp bestpath as-path ignore" configuration. */
1973 DEFUN (bgp_bestpath_aspath_ignore
,
1974 bgp_bestpath_aspath_ignore_cmd
,
1975 "bgp bestpath as-path ignore",
1976 "BGP specific commands\n"
1977 "Change the default bestpath selection\n"
1978 "AS-path attribute\n"
1979 "Ignore as-path length in selecting a route\n")
1981 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1982 bgp_flag_set (bgp
, BGP_FLAG_ASPATH_IGNORE
);
1983 bgp_recalculate_all_bestpaths (bgp
);
1988 DEFUN (no_bgp_bestpath_aspath_ignore
,
1989 no_bgp_bestpath_aspath_ignore_cmd
,
1990 "no bgp bestpath as-path ignore",
1992 "BGP specific commands\n"
1993 "Change the default bestpath selection\n"
1994 "AS-path attribute\n"
1995 "Ignore as-path length in selecting a route\n")
1997 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
1998 bgp_flag_unset (bgp
, BGP_FLAG_ASPATH_IGNORE
);
1999 bgp_recalculate_all_bestpaths (bgp
);
2004 /* "bgp bestpath as-path confed" configuration. */
2005 DEFUN (bgp_bestpath_aspath_confed
,
2006 bgp_bestpath_aspath_confed_cmd
,
2007 "bgp bestpath as-path confed",
2008 "BGP specific commands\n"
2009 "Change the default bestpath selection\n"
2010 "AS-path attribute\n"
2011 "Compare path lengths including confederation sets & sequences in selecting a route\n")
2013 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2014 bgp_flag_set (bgp
, BGP_FLAG_ASPATH_CONFED
);
2015 bgp_recalculate_all_bestpaths (bgp
);
2020 DEFUN (no_bgp_bestpath_aspath_confed
,
2021 no_bgp_bestpath_aspath_confed_cmd
,
2022 "no bgp bestpath as-path confed",
2024 "BGP specific commands\n"
2025 "Change the default bestpath selection\n"
2026 "AS-path attribute\n"
2027 "Compare path lengths including confederation sets & sequences in selecting a route\n")
2029 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2030 bgp_flag_unset (bgp
, BGP_FLAG_ASPATH_CONFED
);
2031 bgp_recalculate_all_bestpaths (bgp
);
2036 /* "bgp bestpath as-path multipath-relax" configuration. */
2037 DEFUN (bgp_bestpath_aspath_multipath_relax
,
2038 bgp_bestpath_aspath_multipath_relax_cmd
,
2039 "bgp bestpath as-path multipath-relax [<as-set|no-as-set>]",
2040 "BGP specific commands\n"
2041 "Change the default bestpath selection\n"
2042 "AS-path attribute\n"
2043 "Allow load sharing across routes that have different AS paths (but same length)\n"
2044 "Generate an AS_SET\n"
2045 "Do not generate an AS_SET\n")
2047 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2049 bgp_flag_set (bgp
, BGP_FLAG_ASPATH_MULTIPATH_RELAX
);
2051 /* no-as-set is now the default behavior so we can silently
2053 if (argv_find (argv
, argc
, "as-set", &idx
))
2054 bgp_flag_set (bgp
, BGP_FLAG_MULTIPATH_RELAX_AS_SET
);
2056 bgp_flag_unset (bgp
, BGP_FLAG_MULTIPATH_RELAX_AS_SET
) ;
2058 bgp_recalculate_all_bestpaths (bgp
);
2063 DEFUN (no_bgp_bestpath_aspath_multipath_relax
,
2064 no_bgp_bestpath_aspath_multipath_relax_cmd
,
2065 "no bgp bestpath as-path multipath-relax [<as-set|no-as-set>]",
2067 "BGP specific commands\n"
2068 "Change the default bestpath selection\n"
2069 "AS-path attribute\n"
2070 "Allow load sharing across routes that have different AS paths (but same length)\n"
2071 "Generate an AS_SET\n"
2072 "Do not generate an AS_SET\n")
2074 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2075 bgp_flag_unset (bgp
, BGP_FLAG_ASPATH_MULTIPATH_RELAX
);
2076 bgp_flag_unset (bgp
, BGP_FLAG_MULTIPATH_RELAX_AS_SET
);
2077 bgp_recalculate_all_bestpaths (bgp
);
2082 /* "bgp log-neighbor-changes" configuration. */
2083 DEFUN (bgp_log_neighbor_changes
,
2084 bgp_log_neighbor_changes_cmd
,
2085 "bgp log-neighbor-changes",
2086 "BGP specific commands\n"
2087 "Log neighbor up/down and reset reason\n")
2089 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2090 bgp_flag_set (bgp
, BGP_FLAG_LOG_NEIGHBOR_CHANGES
);
2094 DEFUN (no_bgp_log_neighbor_changes
,
2095 no_bgp_log_neighbor_changes_cmd
,
2096 "no bgp log-neighbor-changes",
2098 "BGP specific commands\n"
2099 "Log neighbor up/down and reset reason\n")
2101 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2102 bgp_flag_unset (bgp
, BGP_FLAG_LOG_NEIGHBOR_CHANGES
);
2106 /* "bgp bestpath med" configuration. */
2107 DEFUN (bgp_bestpath_med
,
2108 bgp_bestpath_med_cmd
,
2109 "bgp bestpath med <confed [missing-as-worst]|missing-as-worst [confed]>",
2110 "BGP specific commands\n"
2111 "Change the default bestpath selection\n"
2113 "Compare MED among confederation paths\n"
2114 "Treat missing MED as the least preferred one\n"
2115 "Treat missing MED as the least preferred one\n"
2116 "Compare MED among confederation paths\n")
2118 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2121 if (argv_find (argv
, argc
, "confed", &idx
))
2122 bgp_flag_set (bgp
, BGP_FLAG_MED_CONFED
);
2124 if (argv_find (argv
, argc
, "missing-as-worst", &idx
))
2125 bgp_flag_set (bgp
, BGP_FLAG_MED_MISSING_AS_WORST
);
2127 bgp_recalculate_all_bestpaths (bgp
);
2132 DEFUN (no_bgp_bestpath_med
,
2133 no_bgp_bestpath_med_cmd
,
2134 "no bgp bestpath med <confed [missing-as-worst]|missing-as-worst [confed]>",
2136 "BGP specific commands\n"
2137 "Change the default bestpath selection\n"
2139 "Compare MED among confederation paths\n"
2140 "Treat missing MED as the least preferred one\n"
2141 "Treat missing MED as the least preferred one\n"
2142 "Compare MED among confederation paths\n")
2144 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2147 if (argv_find (argv
, argc
, "confed", &idx
))
2148 bgp_flag_unset (bgp
, BGP_FLAG_MED_CONFED
);
2150 if (argv_find (argv
, argc
, "missing-as-worst", &idx
))
2151 bgp_flag_unset (bgp
, BGP_FLAG_MED_MISSING_AS_WORST
);
2153 bgp_recalculate_all_bestpaths (bgp
);
2158 /* "no bgp default ipv4-unicast". */
2159 DEFUN (no_bgp_default_ipv4_unicast
,
2160 no_bgp_default_ipv4_unicast_cmd
,
2161 "no bgp default ipv4-unicast",
2163 "BGP specific commands\n"
2164 "Configure BGP defaults\n"
2165 "Activate ipv4-unicast for a peer by default\n")
2167 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2168 bgp_flag_set (bgp
, BGP_FLAG_NO_DEFAULT_IPV4
);
2172 DEFUN (bgp_default_ipv4_unicast
,
2173 bgp_default_ipv4_unicast_cmd
,
2174 "bgp default ipv4-unicast",
2175 "BGP specific commands\n"
2176 "Configure BGP defaults\n"
2177 "Activate ipv4-unicast for a peer by default\n")
2179 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2180 bgp_flag_unset (bgp
, BGP_FLAG_NO_DEFAULT_IPV4
);
2184 /* Display hostname in certain command outputs */
2185 DEFUN (bgp_default_show_hostname
,
2186 bgp_default_show_hostname_cmd
,
2187 "bgp default show-hostname",
2188 "BGP specific commands\n"
2189 "Configure BGP defaults\n"
2190 "Show hostname in certain command ouputs\n")
2192 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2193 bgp_flag_set (bgp
, BGP_FLAG_SHOW_HOSTNAME
);
2197 DEFUN (no_bgp_default_show_hostname
,
2198 no_bgp_default_show_hostname_cmd
,
2199 "no bgp default show-hostname",
2201 "BGP specific commands\n"
2202 "Configure BGP defaults\n"
2203 "Show hostname in certain command ouputs\n")
2205 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2206 bgp_flag_unset (bgp
, BGP_FLAG_SHOW_HOSTNAME
);
2210 /* "bgp network import-check" configuration. */
2211 DEFUN (bgp_network_import_check
,
2212 bgp_network_import_check_cmd
,
2213 "bgp network import-check",
2214 "BGP specific commands\n"
2215 "BGP network command\n"
2216 "Check BGP network route exists in IGP\n")
2218 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2219 if (!bgp_flag_check(bgp
, BGP_FLAG_IMPORT_CHECK
))
2221 bgp_flag_set (bgp
, BGP_FLAG_IMPORT_CHECK
);
2222 bgp_static_redo_import_check(bgp
);
2228 ALIAS_HIDDEN (bgp_network_import_check
,
2229 bgp_network_import_check_exact_cmd
,
2230 "bgp network import-check exact",
2231 "BGP specific commands\n"
2232 "BGP network command\n"
2233 "Check BGP network route exists in IGP\n"
2234 "Match route precisely\n")
2236 DEFUN (no_bgp_network_import_check
,
2237 no_bgp_network_import_check_cmd
,
2238 "no bgp network import-check",
2240 "BGP specific commands\n"
2241 "BGP network command\n"
2242 "Check BGP network route exists in IGP\n")
2244 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2245 if (bgp_flag_check(bgp
, BGP_FLAG_IMPORT_CHECK
))
2247 bgp_flag_unset (bgp
, BGP_FLAG_IMPORT_CHECK
);
2248 bgp_static_redo_import_check(bgp
);
2254 DEFUN (bgp_default_local_preference
,
2255 bgp_default_local_preference_cmd
,
2256 "bgp default local-preference (0-4294967295)",
2257 "BGP specific commands\n"
2258 "Configure BGP defaults\n"
2259 "local preference (higher=more preferred)\n"
2260 "Configure default local preference value\n")
2262 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2264 u_int32_t local_pref
;
2266 local_pref
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
2268 bgp_default_local_preference_set (bgp
, local_pref
);
2269 bgp_clear_star_soft_in (vty
, bgp
->name
);
2274 DEFUN (no_bgp_default_local_preference
,
2275 no_bgp_default_local_preference_cmd
,
2276 "no bgp default local-preference [(0-4294967295)]",
2278 "BGP specific commands\n"
2279 "Configure BGP defaults\n"
2280 "local preference (higher=more preferred)\n"
2281 "Configure default local preference value\n")
2283 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2284 bgp_default_local_preference_unset (bgp
);
2285 bgp_clear_star_soft_in (vty
, bgp
->name
);
2291 DEFUN (bgp_default_subgroup_pkt_queue_max
,
2292 bgp_default_subgroup_pkt_queue_max_cmd
,
2293 "bgp default subgroup-pkt-queue-max (20-100)",
2294 "BGP specific commands\n"
2295 "Configure BGP defaults\n"
2296 "subgroup-pkt-queue-max\n"
2297 "Configure subgroup packet queue max\n")
2299 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2303 max_size
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
2305 bgp_default_subgroup_pkt_queue_max_set (bgp
, max_size
);
2310 DEFUN (no_bgp_default_subgroup_pkt_queue_max
,
2311 no_bgp_default_subgroup_pkt_queue_max_cmd
,
2312 "no bgp default subgroup-pkt-queue-max [(20-100)]",
2314 "BGP specific commands\n"
2315 "Configure BGP defaults\n"
2316 "subgroup-pkt-queue-max\n"
2317 "Configure subgroup packet queue max\n")
2319 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2320 bgp_default_subgroup_pkt_queue_max_unset (bgp
);
2325 DEFUN (bgp_rr_allow_outbound_policy
,
2326 bgp_rr_allow_outbound_policy_cmd
,
2327 "bgp route-reflector allow-outbound-policy",
2328 "BGP specific commands\n"
2329 "Allow modifications made by out route-map\n"
2330 "on ibgp neighbors\n")
2332 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2334 if (!bgp_flag_check(bgp
, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY
))
2336 bgp_flag_set(bgp
, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY
);
2337 update_group_announce_rrclients(bgp
);
2338 bgp_clear_star_soft_out (vty
, bgp
->name
);
2344 DEFUN (no_bgp_rr_allow_outbound_policy
,
2345 no_bgp_rr_allow_outbound_policy_cmd
,
2346 "no bgp route-reflector allow-outbound-policy",
2348 "BGP specific commands\n"
2349 "Allow modifications made by out route-map\n"
2350 "on ibgp neighbors\n")
2352 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2354 if (bgp_flag_check(bgp
, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY
))
2356 bgp_flag_unset(bgp
, BGP_FLAG_RR_ALLOW_OUTBOUND_POLICY
);
2357 update_group_announce_rrclients(bgp
);
2358 bgp_clear_star_soft_out (vty
, bgp
->name
);
2364 DEFUN (bgp_listen_limit
,
2365 bgp_listen_limit_cmd
,
2366 "bgp listen limit (1-5000)",
2367 "BGP specific commands\n"
2368 "Configure BGP defaults\n"
2369 "maximum number of BGP Dynamic Neighbors that can be created\n"
2370 "Configure Dynamic Neighbors listen limit value\n")
2372 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2376 listen_limit
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
2378 bgp_listen_limit_set (bgp
, listen_limit
);
2383 DEFUN (no_bgp_listen_limit
,
2384 no_bgp_listen_limit_cmd
,
2385 "no bgp listen limit [(1-5000)]",
2386 "BGP specific commands\n"
2387 "Configure BGP defaults\n"
2388 "unset maximum number of BGP Dynamic Neighbors that can be created\n"
2389 "Configure Dynamic Neighbors listen limit value to default\n"
2390 "Configure Dynamic Neighbors listen limit value\n")
2392 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
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 listen range\n"
2435 "Configure BGP dynamic neighbors listen range\n"
2437 "Member of the peer-group\n"
2438 "Peer-group name\n")
2440 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2441 struct prefix range
;
2442 struct peer_group
*group
, *existing_group
;
2447 argv_find (argv
, argc
, "A.B.C.D/M", &idx
);
2448 argv_find (argv
, argc
, "X:X::X:X/M", &idx
);
2449 char *prefix
= argv
[idx
]->arg
;
2450 argv_find (argv
, argc
, "WORD", &idx
);
2451 char *peergroup
= argv
[idx
]->arg
;
2453 /* Convert IP prefix string to struct prefix. */
2454 ret
= str2prefix (prefix
, &range
);
2457 vty_out (vty
, "%% Malformed listen range%s", VTYNL
);
2458 return CMD_WARNING_CONFIG_FAILED
;
2461 afi
= family2afi(range
.family
);
2463 if (afi
== AFI_IP6
&& IN6_IS_ADDR_LINKLOCAL (&range
.u
.prefix6
))
2465 vty_out (vty
, "%% Malformed listen range (link-local address)%s",
2467 return CMD_WARNING_CONFIG_FAILED
;
2470 apply_mask (&range
);
2472 /* Check if same listen range is already configured. */
2473 existing_group
= listen_range_exists (bgp
, &range
, 1);
2476 if (strcmp (existing_group
->name
, peergroup
) == 0)
2480 vty_out (vty
, "%% Same listen range is attached to peer-group %s%s",
2481 existing_group
->name
, VTYNL
);
2482 return CMD_WARNING_CONFIG_FAILED
;
2486 /* Check if an overlapping listen range exists. */
2487 if (listen_range_exists (bgp
, &range
, 0))
2489 vty_out (vty
, "%% Listen range overlaps with existing listen range%s",
2491 return CMD_WARNING_CONFIG_FAILED
;
2494 group
= peer_group_lookup (bgp
, peergroup
);
2497 vty_out (vty
, "%% Configure the peer-group first%s", VTYNL
);
2498 return CMD_WARNING_CONFIG_FAILED
;
2501 ret
= peer_group_listen_range_add(group
, &range
);
2502 return bgp_vty_return (vty
, ret
);
2505 DEFUN (no_bgp_listen_range
,
2506 no_bgp_listen_range_cmd
,
2507 "no bgp listen range <A.B.C.D/M|X:X::X:X/M> peer-group WORD",
2509 "BGP specific commands\n"
2510 "Unconfigure BGP dynamic neighbors listen range\n"
2511 "Unconfigure BGP dynamic neighbors listen range\n"
2513 "Member of the peer-group\n"
2514 "Peer-group name\n")
2516 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2517 struct prefix range
;
2518 struct peer_group
*group
;
2523 argv_find (argv
, argc
, "A.B.C.D/M", &idx
);
2524 argv_find (argv
, argc
, "X:X::X:X/M", &idx
);
2525 char *prefix
= argv
[idx
]->arg
;
2526 argv_find (argv
, argc
, "WORD", &idx
);
2527 char *peergroup
= argv
[idx
]->arg
;
2529 /* Convert IP prefix string to struct prefix. */
2530 ret
= str2prefix (prefix
, &range
);
2533 vty_out (vty
, "%% Malformed listen range%s", VTYNL
);
2534 return CMD_WARNING_CONFIG_FAILED
;
2537 afi
= family2afi(range
.family
);
2539 if (afi
== AFI_IP6
&& IN6_IS_ADDR_LINKLOCAL (&range
.u
.prefix6
))
2541 vty_out (vty
, "%% Malformed listen range (link-local address)%s",
2543 return CMD_WARNING_CONFIG_FAILED
;
2546 apply_mask (&range
);
2548 group
= peer_group_lookup (bgp
, peergroup
);
2551 vty_out (vty
, "%% Peer-group does not exist%s", VTYNL
);
2552 return CMD_WARNING_CONFIG_FAILED
;
2555 ret
= peer_group_listen_range_del(group
, &range
);
2556 return bgp_vty_return (vty
, ret
);
2560 bgp_config_write_listen (struct vty
*vty
, struct bgp
*bgp
)
2562 struct peer_group
*group
;
2563 struct listnode
*node
, *nnode
, *rnode
, *nrnode
;
2564 struct prefix
*range
;
2566 char buf
[PREFIX2STR_BUFFER
];
2568 if (bgp
->dynamic_neighbors_limit
!= BGP_DYNAMIC_NEIGHBORS_LIMIT_DEFAULT
)
2569 vty_out (vty
, " bgp listen limit %d%s",
2570 bgp
->dynamic_neighbors_limit
, VTYNL
);
2572 for (ALL_LIST_ELEMENTS (bgp
->group
, node
, nnode
, group
))
2574 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
2576 for (ALL_LIST_ELEMENTS (group
->listen_range
[afi
], rnode
, nrnode
, range
))
2578 prefix2str(range
, buf
, sizeof(buf
));
2579 vty_out(vty
, " bgp listen range %s peer-group %s%s",
2580 buf
, group
->name
, VTYNL
);
2589 DEFUN (bgp_disable_connected_route_check
,
2590 bgp_disable_connected_route_check_cmd
,
2591 "bgp disable-ebgp-connected-route-check",
2592 "BGP specific commands\n"
2593 "Disable checking if nexthop is connected on ebgp sessions\n")
2595 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
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")
2609 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2610 bgp_flag_unset (bgp
, BGP_FLAG_DISABLE_NH_CONNECTED_CHK
);
2611 bgp_clear_star_soft_in (vty
, bgp
->name
);
2618 peer_remote_as_vty (struct vty
*vty
, const char *peer_str
,
2619 const char *as_str
, afi_t afi
, safi_t safi
)
2621 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2624 int as_type
= AS_SPECIFIED
;
2627 if (as_str
[0] == 'i')
2630 as_type
= AS_INTERNAL
;
2632 else if (as_str
[0] == 'e')
2635 as_type
= AS_EXTERNAL
;
2639 /* Get AS number. */
2640 as
= strtoul(as_str
, NULL
, 10);
2643 /* If peer is peer group, call proper function. */
2644 ret
= str2sockunion (peer_str
, &su
);
2647 /* Check for peer by interface */
2648 ret
= peer_remote_as (bgp
, NULL
, peer_str
, &as
, as_type
, afi
, safi
);
2651 ret
= peer_group_remote_as (bgp
, peer_str
, &as
, as_type
);
2654 vty_out (vty
, "%% Create the peer-group or interface first%s",
2656 return CMD_WARNING_CONFIG_FAILED
;
2663 if (peer_address_self_check (bgp
, &su
))
2665 vty_out (vty
, "%% Can not configure the local system as neighbor%s",
2667 return CMD_WARNING_CONFIG_FAILED
;
2669 ret
= peer_remote_as (bgp
, &su
, NULL
, &as
, as_type
, afi
, safi
);
2672 /* This peer belongs to peer group. */
2675 case BGP_ERR_PEER_GROUP_MEMBER
:
2676 vty_out (vty
, "%% Peer-group AS %u. Cannot configure remote-as for member%s", as
, VTYNL
);
2677 return CMD_WARNING_CONFIG_FAILED
;
2678 case BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT
:
2679 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
, VTYNL
);
2680 return CMD_WARNING_CONFIG_FAILED
;
2682 return bgp_vty_return (vty
, ret
);
2685 DEFUN (neighbor_remote_as
,
2686 neighbor_remote_as_cmd
,
2687 "neighbor <A.B.C.D|X:X::X:X|WORD> remote-as <(1-4294967295)|internal|external>",
2690 "Specify a BGP neighbor\n"
2692 "Internal BGP peer\n"
2693 "External BGP peer\n")
2696 int idx_remote_as
= 3;
2697 return peer_remote_as_vty (vty
, argv
[idx_peer
]->arg
, argv
[idx_remote_as
]->arg
, AFI_IP
, SAFI_UNICAST
);
2701 peer_conf_interface_get (struct vty
*vty
, const char *conf_if
, afi_t afi
,
2702 safi_t safi
, int v6only
, const char *peer_group_name
,
2705 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2707 int as_type
= AS_UNSPECIFIED
;
2709 struct peer_group
*group
;
2713 group
= peer_group_lookup (bgp
, conf_if
);
2717 vty_out (vty
, "%% Name conflict with peer-group %s", VTYNL
);
2718 return CMD_WARNING_CONFIG_FAILED
;
2723 if (as_str
[0] == 'i')
2725 as_type
= AS_INTERNAL
;
2727 else if (as_str
[0] == 'e')
2729 as_type
= AS_EXTERNAL
;
2733 /* Get AS number. */
2734 as
= strtoul(as_str
, NULL
, 10);
2735 as_type
= AS_SPECIFIED
;
2739 peer
= peer_lookup_by_conf_if (bgp
, conf_if
);
2743 ret
= peer_remote_as (bgp
, &su
, conf_if
, &as
, as_type
, afi
, safi
);
2747 if (bgp_flag_check (bgp
, BGP_FLAG_NO_DEFAULT_IPV4
)
2748 && afi
== AFI_IP
&& safi
== SAFI_UNICAST
)
2749 peer
= peer_create (NULL
, conf_if
, bgp
, bgp
->as
, as
, as_type
, 0, 0,
2752 peer
= peer_create (NULL
, conf_if
, bgp
, bgp
->as
, as
, as_type
, afi
, safi
,
2757 vty_outln (vty
, "%% BGP failed to create peer");
2758 return CMD_WARNING_CONFIG_FAILED
;
2762 SET_FLAG(peer
->flags
, PEER_FLAG_IFPEER_V6ONLY
);
2764 /* Request zebra to initiate IPv6 RAs on this interface. We do this
2765 * any unnumbered peer in order to not worry about run-time transitions
2766 * (e.g., peering is initially IPv4, but the IPv4 /30 or /31 address
2767 * gets deleted later etc.)
2770 bgp_zebra_initiate_radv (bgp
, peer
);
2773 if ((v6only
&& !CHECK_FLAG(peer
->flags
, PEER_FLAG_IFPEER_V6ONLY
)) ||
2774 (!v6only
&& CHECK_FLAG(peer
->flags
, PEER_FLAG_IFPEER_V6ONLY
)))
2777 SET_FLAG(peer
->flags
, PEER_FLAG_IFPEER_V6ONLY
);
2779 UNSET_FLAG(peer
->flags
, PEER_FLAG_IFPEER_V6ONLY
);
2781 /* v6only flag changed. Reset bgp seesion */
2782 if (BGP_IS_VALID_STATE_FOR_NOTIF(peer
->status
))
2784 peer
->last_reset
= PEER_DOWN_V6ONLY_CHANGE
;
2785 bgp_notify_send (peer
, BGP_NOTIFY_CEASE
,
2786 BGP_NOTIFY_CEASE_CONFIG_CHANGE
);
2789 bgp_session_reset(peer
);
2792 if (!CHECK_FLAG (peer
->flags
, PEER_FLAG_CAPABILITY_ENHE
))
2793 peer_flag_set (peer
, PEER_FLAG_CAPABILITY_ENHE
);
2795 if (peer_group_name
)
2797 group
= peer_group_lookup (bgp
, peer_group_name
);
2800 vty_out (vty
, "%% Configure the peer-group first%s", VTYNL
);
2801 return CMD_WARNING_CONFIG_FAILED
;
2804 ret
= peer_group_bind (bgp
, &su
, peer
, group
, &as
);
2807 return bgp_vty_return (vty
, ret
);
2810 DEFUN (neighbor_interface_config
,
2811 neighbor_interface_config_cmd
,
2812 "neighbor WORD interface [peer-group WORD]",
2814 "Interface name or neighbor tag\n"
2815 "Enable BGP on interface\n"
2816 "Member of the peer-group\n"
2817 "Peer-group name\n")
2820 int idx_peer_group_word
= 4;
2822 if (argc
> idx_peer_group_word
)
2823 return peer_conf_interface_get (vty
, argv
[idx_word
]->arg
, AFI_IP
, SAFI_UNICAST
, 0,
2824 argv
[idx_peer_group_word
]->arg
, NULL
);
2826 return peer_conf_interface_get (vty
, argv
[idx_word
]->arg
, AFI_IP
, SAFI_UNICAST
, 0,
2830 DEFUN (neighbor_interface_config_v6only
,
2831 neighbor_interface_config_v6only_cmd
,
2832 "neighbor WORD interface v6only [peer-group WORD]",
2834 "Interface name or neighbor tag\n"
2835 "Enable BGP on interface\n"
2836 "Enable BGP with v6 link-local only\n"
2837 "Member of the peer-group\n"
2838 "Peer-group name\n")
2841 int idx_peer_group_word
= 5;
2843 if (argc
> idx_peer_group_word
)
2844 return peer_conf_interface_get (vty
, argv
[idx_word
]->arg
, AFI_IP
, SAFI_UNICAST
, 1,
2845 argv
[idx_peer_group_word
]->arg
, NULL
);
2847 return peer_conf_interface_get (vty
, argv
[idx_word
]->arg
, AFI_IP
, SAFI_UNICAST
, 1,
2852 DEFUN (neighbor_interface_config_remote_as
,
2853 neighbor_interface_config_remote_as_cmd
,
2854 "neighbor WORD interface remote-as <(1-4294967295)|internal|external>",
2856 "Interface name or neighbor tag\n"
2857 "Enable BGP on interface\n"
2858 "Specify a BGP neighbor\n"
2860 "Internal BGP peer\n"
2861 "External BGP peer\n")
2864 int idx_remote_as
= 4;
2865 return peer_conf_interface_get (vty
, argv
[idx_word
]->arg
, AFI_IP
, SAFI_UNICAST
, 0,
2866 NULL
, argv
[idx_remote_as
]->arg
);
2869 DEFUN (neighbor_interface_v6only_config_remote_as
,
2870 neighbor_interface_v6only_config_remote_as_cmd
,
2871 "neighbor WORD interface v6only remote-as <(1-4294967295)|internal|external>",
2873 "Interface name or neighbor tag\n"
2874 "Enable BGP with v6 link-local only\n"
2875 "Enable BGP on interface\n"
2876 "Specify a BGP neighbor\n"
2878 "Internal BGP peer\n"
2879 "External BGP peer\n")
2882 int idx_remote_as
= 5;
2883 return peer_conf_interface_get (vty
, argv
[idx_word
]->arg
, AFI_IP
, SAFI_UNICAST
, 1,
2884 NULL
, argv
[idx_remote_as
]->arg
);
2887 DEFUN (neighbor_peer_group
,
2888 neighbor_peer_group_cmd
,
2889 "neighbor WORD peer-group",
2891 "Interface name or neighbor tag\n"
2892 "Configure peer-group\n")
2894 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2897 struct peer_group
*group
;
2899 peer
= peer_lookup_by_conf_if (bgp
, argv
[idx_word
]->arg
);
2902 vty_out (vty
, "%% Name conflict with interface: %s", VTYNL
);
2903 return CMD_WARNING_CONFIG_FAILED
;
2906 group
= peer_group_get (bgp
, argv
[idx_word
]->arg
);
2909 vty_outln (vty
, "%% BGP failed to find or create peer-group");
2910 return CMD_WARNING_CONFIG_FAILED
;
2918 "no neighbor <WORD|<A.B.C.D|X:X::X:X> [remote-as <(1-4294967295)|internal|external>]>",
2922 "Specify a BGP neighbor\n"
2924 "Internal BGP peer\n"
2925 "External BGP peer\n")
2927 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
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 (bgp
, 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 (bgp
, argv
[idx_peer
]->arg
);
2951 peer_group_delete (group
);
2954 vty_out (vty
, "%% Create the peer-group first%s", VTYNL
);
2955 return CMD_WARNING_CONFIG_FAILED
;
2960 peer
= peer_lookup (bgp
, &su
);
2963 if (peer_dynamic_neighbor (peer
))
2965 vty_out (vty
, "%% Operation not allowed on a dynamic neighbor%s",
2967 return CMD_WARNING_CONFIG_FAILED
;
2970 other
= peer
->doppelganger
;
2972 if (other
&& other
->status
!= Deleted
)
2980 DEFUN (no_neighbor_interface_config
,
2981 no_neighbor_interface_config_cmd
,
2982 "no neighbor WORD interface [v6only] [peer-group WORD] [remote-as <(1-4294967295)|internal|external>]",
2986 "Configure BGP on interface\n"
2987 "Enable BGP with v6 link-local only\n"
2988 "Member of the peer-group\n"
2990 "Specify a BGP neighbor\n"
2992 "Internal BGP peer\n"
2993 "External BGP peer\n")
2995 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
2999 /* look up for neighbor by interface name config. */
3000 peer
= peer_lookup_by_conf_if (bgp
, argv
[idx_word
]->arg
);
3003 /* Request zebra to terminate IPv6 RAs on this interface. */
3005 bgp_zebra_terminate_radv (peer
->bgp
, peer
);
3010 vty_out (vty
, "%% Create the bgp interface first%s", VTYNL
);
3011 return CMD_WARNING_CONFIG_FAILED
;
3016 DEFUN (no_neighbor_peer_group
,
3017 no_neighbor_peer_group_cmd
,
3018 "no neighbor WORD peer-group",
3022 "Configure peer-group\n")
3024 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
3026 struct peer_group
*group
;
3028 group
= peer_group_lookup (bgp
, argv
[idx_word
]->arg
);
3030 peer_group_delete (group
);
3033 vty_out (vty
, "%% Create the peer-group first%s", VTYNL
);
3034 return CMD_WARNING_CONFIG_FAILED
;
3039 DEFUN (no_neighbor_interface_peer_group_remote_as
,
3040 no_neighbor_interface_peer_group_remote_as_cmd
,
3041 "no neighbor WORD remote-as <(1-4294967295)|internal|external>",
3044 "Interface name or neighbor tag\n"
3045 "Specify a BGP neighbor\n"
3047 "Internal BGP peer\n"
3048 "External BGP peer\n")
3050 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
3052 struct peer_group
*group
;
3055 /* look up for neighbor by interface name config. */
3056 peer
= peer_lookup_by_conf_if (bgp
, argv
[idx_word
]->arg
);
3059 peer_as_change (peer
, 0, AS_SPECIFIED
);
3063 group
= peer_group_lookup (bgp
, argv
[idx_word
]->arg
);
3065 peer_group_remote_as_delete (group
);
3068 vty_out (vty
, "%% Create the peer-group or interface first%s", VTYNL
);
3069 return CMD_WARNING_CONFIG_FAILED
;
3074 DEFUN (neighbor_local_as
,
3075 neighbor_local_as_cmd
,
3076 "neighbor <A.B.C.D|X:X::X:X|WORD> local-as (1-4294967295)",
3079 "Specify a local-as number\n"
3080 "AS number used as local AS\n")
3088 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3090 return CMD_WARNING_CONFIG_FAILED
;
3092 as
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
3093 ret
= peer_local_as_set (peer
, as
, 0, 0);
3094 return bgp_vty_return (vty
, ret
);
3097 DEFUN (neighbor_local_as_no_prepend
,
3098 neighbor_local_as_no_prepend_cmd
,
3099 "neighbor <A.B.C.D|X:X::X:X|WORD> local-as (1-4294967295) no-prepend",
3102 "Specify a local-as number\n"
3103 "AS number used as local AS\n"
3104 "Do not prepend local-as to updates from ebgp peers\n")
3112 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3114 return CMD_WARNING_CONFIG_FAILED
;
3116 as
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
3117 ret
= peer_local_as_set (peer
, as
, 1, 0);
3118 return bgp_vty_return (vty
, ret
);
3121 DEFUN (neighbor_local_as_no_prepend_replace_as
,
3122 neighbor_local_as_no_prepend_replace_as_cmd
,
3123 "neighbor <A.B.C.D|X:X::X:X|WORD> local-as (1-4294967295) no-prepend replace-as",
3126 "Specify a local-as number\n"
3127 "AS number used as local AS\n"
3128 "Do not prepend local-as to updates from ebgp peers\n"
3129 "Do not prepend local-as to updates from ibgp peers\n")
3137 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3139 return CMD_WARNING_CONFIG_FAILED
;
3141 as
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
3142 ret
= peer_local_as_set (peer
, as
, 1, 1);
3143 return bgp_vty_return (vty
, ret
);
3146 DEFUN (no_neighbor_local_as
,
3147 no_neighbor_local_as_cmd
,
3148 "no neighbor <A.B.C.D|X:X::X:X|WORD> local-as [(1-4294967295) [no-prepend [replace-as]]]",
3152 "Specify a local-as number\n"
3153 "AS number used as local AS\n"
3154 "Do not prepend local-as to updates from ebgp peers\n"
3155 "Do not prepend local-as to updates from ibgp peers\n")
3161 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3163 return CMD_WARNING_CONFIG_FAILED
;
3165 ret
= peer_local_as_unset (peer
);
3166 return bgp_vty_return (vty
, ret
);
3172 DEFUN (neighbor_solo
,
3174 "neighbor <A.B.C.D|X:X::X:X|WORD> solo",
3177 "Solo peer - part of its own update group\n")
3183 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3185 return CMD_WARNING_CONFIG_FAILED
;
3187 ret
= update_group_adjust_soloness(peer
, 1);
3188 return bgp_vty_return (vty
, ret
);
3191 DEFUN (no_neighbor_solo
,
3192 no_neighbor_solo_cmd
,
3193 "no neighbor <A.B.C.D|X:X::X:X|WORD> solo",
3197 "Solo peer - part of its own update group\n")
3203 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3205 return CMD_WARNING_CONFIG_FAILED
;
3207 ret
= update_group_adjust_soloness(peer
, 0);
3208 return bgp_vty_return (vty
, ret
);
3211 DEFUN (neighbor_password
,
3212 neighbor_password_cmd
,
3213 "neighbor <A.B.C.D|X:X::X:X|WORD> password LINE",
3224 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3226 return CMD_WARNING_CONFIG_FAILED
;
3228 ret
= peer_password_set (peer
, argv
[idx_line
]->arg
);
3229 return bgp_vty_return (vty
, ret
);
3232 DEFUN (no_neighbor_password
,
3233 no_neighbor_password_cmd
,
3234 "no neighbor <A.B.C.D|X:X::X:X|WORD> password [LINE]",
3245 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3247 return CMD_WARNING_CONFIG_FAILED
;
3249 ret
= peer_password_unset (peer
);
3250 return bgp_vty_return (vty
, ret
);
3254 DEFUN (neighbor_activate
,
3255 neighbor_activate_cmd
,
3256 "neighbor <A.B.C.D|X:X::X:X|WORD> activate",
3259 "Enable the Address Family for this Neighbor\n")
3265 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3267 return CMD_WARNING_CONFIG_FAILED
;
3269 ret
= peer_activate (peer
, bgp_node_afi (vty
), bgp_node_safi (vty
));
3270 return bgp_vty_return (vty
, ret
);
3273 ALIAS_HIDDEN (neighbor_activate
,
3274 neighbor_activate_hidden_cmd
,
3275 "neighbor <A.B.C.D|X:X::X:X|WORD> activate",
3278 "Enable the Address Family for this Neighbor\n")
3280 DEFUN (no_neighbor_activate
,
3281 no_neighbor_activate_cmd
,
3282 "no neighbor <A.B.C.D|X:X::X:X|WORD> activate",
3286 "Enable the Address Family for this Neighbor\n")
3293 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3295 return CMD_WARNING_CONFIG_FAILED
;
3297 ret
= peer_deactivate (peer
, bgp_node_afi (vty
), bgp_node_safi (vty
));
3298 return bgp_vty_return (vty
, ret
);
3301 ALIAS_HIDDEN (no_neighbor_activate
,
3302 no_neighbor_activate_hidden_cmd
,
3303 "no neighbor <A.B.C.D|X:X::X:X|WORD> activate",
3307 "Enable the Address Family for this Neighbor\n")
3309 DEFUN (neighbor_set_peer_group
,
3310 neighbor_set_peer_group_cmd
,
3311 "neighbor <A.B.C.D|X:X::X:X|WORD> peer-group WORD",
3314 "Member of the peer-group\n"
3315 "Peer-group name\n")
3317 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
3324 struct peer_group
*group
;
3328 ret
= str2sockunion (argv
[idx_peer
]->arg
, &su
);
3331 peer
= peer_lookup_by_conf_if (bgp
, argv
[idx_peer
]->arg
);
3334 vty_out (vty
, "%% Malformed address or name: %s%s", argv
[idx_peer
]->arg
, VTYNL
);
3335 return CMD_WARNING_CONFIG_FAILED
;
3340 if (peer_address_self_check (bgp
, &su
))
3342 vty_out (vty
, "%% Can not configure the local system as neighbor%s",
3344 return CMD_WARNING_CONFIG_FAILED
;
3347 /* Disallow for dynamic neighbor. */
3348 peer
= peer_lookup (bgp
, &su
);
3349 if (peer
&& peer_dynamic_neighbor (peer
))
3351 vty_out (vty
, "%% Operation not allowed on a dynamic neighbor%s",
3353 return CMD_WARNING_CONFIG_FAILED
;
3357 group
= peer_group_lookup (bgp
, argv
[idx_word
]->arg
);
3360 vty_out (vty
, "%% Configure the peer-group first%s", VTYNL
);
3361 return CMD_WARNING_CONFIG_FAILED
;
3364 ret
= peer_group_bind (bgp
, &su
, peer
, group
, &as
);
3366 if (ret
== BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT
)
3368 vty_out (vty
, "%% Peer with AS %u cannot be in this peer-group, members must be all internal or all external%s", as
, VTYNL
);
3369 return CMD_WARNING_CONFIG_FAILED
;
3372 return bgp_vty_return (vty
, ret
);
3375 ALIAS_HIDDEN (neighbor_set_peer_group
,
3376 neighbor_set_peer_group_hidden_cmd
,
3377 "neighbor <A.B.C.D|X:X::X:X|WORD> peer-group WORD",
3380 "Member of the peer-group\n"
3381 "Peer-group name\n")
3383 DEFUN (no_neighbor_set_peer_group
,
3384 no_neighbor_set_peer_group_cmd
,
3385 "no neighbor <A.B.C.D|X:X::X:X|WORD> peer-group WORD",
3389 "Member of the peer-group\n"
3390 "Peer-group name\n")
3392 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
3397 struct peer_group
*group
;
3399 peer
= peer_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3401 return CMD_WARNING_CONFIG_FAILED
;
3403 group
= peer_group_lookup (bgp
, argv
[idx_word
]->arg
);
3406 vty_out (vty
, "%% Configure the peer-group first%s", VTYNL
);
3407 return CMD_WARNING_CONFIG_FAILED
;
3410 ret
= peer_group_unbind (bgp
, peer
, group
);
3412 return bgp_vty_return (vty
, ret
);
3415 ALIAS_HIDDEN (no_neighbor_set_peer_group
,
3416 no_neighbor_set_peer_group_hidden_cmd
,
3417 "no neighbor <A.B.C.D|X:X::X:X|WORD> peer-group WORD",
3421 "Member of the peer-group\n"
3422 "Peer-group name\n")
3425 peer_flag_modify_vty (struct vty
*vty
, const char *ip_str
,
3426 u_int16_t flag
, int set
)
3431 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
3433 return CMD_WARNING_CONFIG_FAILED
;
3436 * If 'neighbor <interface>', then this is for directly connected peers,
3437 * we should not accept disable-connected-check.
3439 if (peer
->conf_if
&& (flag
== PEER_FLAG_DISABLE_CONNECTED_CHECK
)) {
3440 vty_out (vty
, "%s is directly connected peer, cannot accept disable-"
3441 "connected-check%s", ip_str
, VTYNL
);
3442 return CMD_WARNING_CONFIG_FAILED
;
3445 if (!set
&& flag
== PEER_FLAG_SHUTDOWN
)
3446 peer_tx_shutdown_message_unset (peer
);
3449 ret
= peer_flag_set (peer
, flag
);
3451 ret
= peer_flag_unset (peer
, flag
);
3453 return bgp_vty_return (vty
, ret
);
3457 peer_flag_set_vty (struct vty
*vty
, const char *ip_str
, u_int16_t flag
)
3459 return peer_flag_modify_vty (vty
, ip_str
, flag
, 1);
3463 peer_flag_unset_vty (struct vty
*vty
, const char *ip_str
, u_int16_t flag
)
3465 return peer_flag_modify_vty (vty
, ip_str
, flag
, 0);
3468 /* neighbor passive. */
3469 DEFUN (neighbor_passive
,
3470 neighbor_passive_cmd
,
3471 "neighbor <A.B.C.D|X:X::X:X|WORD> passive",
3474 "Don't send open messages to this neighbor\n")
3477 return peer_flag_set_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_PASSIVE
);
3480 DEFUN (no_neighbor_passive
,
3481 no_neighbor_passive_cmd
,
3482 "no neighbor <A.B.C.D|X:X::X:X|WORD> passive",
3486 "Don't send open messages to this neighbor\n")
3489 return peer_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_PASSIVE
);
3492 /* neighbor shutdown. */
3493 DEFUN (neighbor_shutdown_msg
,
3494 neighbor_shutdown_msg_cmd
,
3495 "neighbor <A.B.C.D|X:X::X:X|WORD> shutdown message MSG...",
3498 "Administratively shut down this neighbor\n"
3499 "Add a shutdown message (draft-ietf-idr-shutdown-06)\n"
3500 "Shutdown message\n")
3506 struct peer
*peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
3510 return CMD_WARNING_CONFIG_FAILED
;
3511 message
= argv_concat (argv
, argc
, 4);
3512 peer_tx_shutdown_message_set (peer
, message
);
3513 XFREE (MTYPE_TMP
, message
);
3516 return peer_flag_set_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_SHUTDOWN
);
3519 ALIAS (neighbor_shutdown_msg
,
3520 neighbor_shutdown_cmd
,
3521 "neighbor <A.B.C.D|X:X::X:X|WORD> shutdown",
3524 "Administratively shut down this neighbor\n")
3526 DEFUN (no_neighbor_shutdown_msg
,
3527 no_neighbor_shutdown_msg_cmd
,
3528 "no neighbor <A.B.C.D|X:X::X:X|WORD> shutdown message MSG...",
3532 "Administratively shut down this neighbor\n"
3533 "Remove a shutdown message (draft-ietf-idr-shutdown-06)\n"
3534 "Shutdown message\n")
3538 return peer_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_SHUTDOWN
);
3541 ALIAS (no_neighbor_shutdown_msg
,
3542 no_neighbor_shutdown_cmd
,
3543 "no neighbor <A.B.C.D|X:X::X:X|WORD> shutdown",
3547 "Administratively shut down this neighbor\n")
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
);
3634 return CMD_WARNING_CONFIG_FAILED
;
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 (strmatch (argv
[idx_send_recv
]->text
, "send"))
3676 flag
= PEER_FLAG_ORF_PREFIX_SM
;
3677 else if (strmatch (argv
[idx_send_recv
]->text
, "receive"))
3678 flag
= PEER_FLAG_ORF_PREFIX_RM
;
3679 else if (strmatch (argv
[idx_send_recv
]->text
, "both"))
3680 flag
= PEER_FLAG_ORF_PREFIX_SM
|PEER_FLAG_ORF_PREFIX_RM
;
3683 vty_outln (vty
, "%% BGP invalid orf prefix-list option");
3684 return CMD_WARNING_CONFIG_FAILED
;
3687 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3688 bgp_node_safi (vty
), flag
);
3691 ALIAS_HIDDEN (neighbor_capability_orf_prefix
,
3692 neighbor_capability_orf_prefix_hidden_cmd
,
3693 "neighbor <A.B.C.D|X:X::X:X|WORD> capability orf prefix-list <both|send|receive>",
3696 "Advertise capability to the peer\n"
3697 "Advertise ORF capability to the peer\n"
3698 "Advertise prefixlist ORF capability to this neighbor\n"
3699 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
3700 "Capability to RECEIVE the ORF from this neighbor\n"
3701 "Capability to SEND the ORF to this neighbor\n")
3703 DEFUN (no_neighbor_capability_orf_prefix
,
3704 no_neighbor_capability_orf_prefix_cmd
,
3705 "no neighbor <A.B.C.D|X:X::X:X|WORD> capability orf prefix-list <both|send|receive>",
3709 "Advertise capability to the peer\n"
3710 "Advertise ORF capability to the peer\n"
3711 "Advertise prefixlist ORF capability to this neighbor\n"
3712 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
3713 "Capability to RECEIVE the ORF from this neighbor\n"
3714 "Capability to SEND the ORF to this neighbor\n")
3717 int idx_send_recv
= 6;
3720 if (strmatch (argv
[idx_send_recv
]->text
, "send"))
3721 flag
= PEER_FLAG_ORF_PREFIX_SM
;
3722 else if (strmatch (argv
[idx_send_recv
]->text
, "receive"))
3723 flag
= PEER_FLAG_ORF_PREFIX_RM
;
3724 else if (strmatch (argv
[idx_send_recv
]->text
, "both"))
3725 flag
= PEER_FLAG_ORF_PREFIX_SM
|PEER_FLAG_ORF_PREFIX_RM
;
3728 vty_outln (vty
, "%% BGP invalid orf prefix-list option");
3729 return CMD_WARNING_CONFIG_FAILED
;
3732 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3733 bgp_node_safi (vty
), flag
);
3736 ALIAS_HIDDEN (no_neighbor_capability_orf_prefix
,
3737 no_neighbor_capability_orf_prefix_hidden_cmd
,
3738 "no neighbor <A.B.C.D|X:X::X:X|WORD> capability orf prefix-list <both|send|receive>",
3742 "Advertise capability to the peer\n"
3743 "Advertise ORF capability to the peer\n"
3744 "Advertise prefixlist ORF capability to this neighbor\n"
3745 "Capability to SEND and RECEIVE the ORF to/from this neighbor\n"
3746 "Capability to RECEIVE the ORF from this neighbor\n"
3747 "Capability to SEND the ORF to this neighbor\n")
3749 /* neighbor next-hop-self. */
3750 DEFUN (neighbor_nexthop_self
,
3751 neighbor_nexthop_self_cmd
,
3752 "neighbor <A.B.C.D|X:X::X:X|WORD> next-hop-self",
3755 "Disable the next hop calculation for this neighbor\n")
3758 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3759 bgp_node_safi (vty
), PEER_FLAG_NEXTHOP_SELF
);
3762 ALIAS_HIDDEN (neighbor_nexthop_self
,
3763 neighbor_nexthop_self_hidden_cmd
,
3764 "neighbor <A.B.C.D|X:X::X:X|WORD> next-hop-self",
3767 "Disable the next hop calculation for this neighbor\n")
3769 /* neighbor next-hop-self. */
3770 DEFUN (neighbor_nexthop_self_force
,
3771 neighbor_nexthop_self_force_cmd
,
3772 "neighbor <A.B.C.D|X:X::X:X|WORD> next-hop-self force",
3775 "Disable the next hop calculation for this neighbor\n"
3776 "Set the next hop to self for reflected routes\n")
3779 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3780 bgp_node_safi (vty
),
3781 PEER_FLAG_FORCE_NEXTHOP_SELF
);
3784 ALIAS_HIDDEN (neighbor_nexthop_self_force
,
3785 neighbor_nexthop_self_force_hidden_cmd
,
3786 "neighbor <A.B.C.D|X:X::X:X|WORD> next-hop-self force",
3789 "Disable the next hop calculation for this neighbor\n"
3790 "Set the next hop to self for reflected routes\n")
3792 DEFUN (no_neighbor_nexthop_self
,
3793 no_neighbor_nexthop_self_cmd
,
3794 "no neighbor <A.B.C.D|X:X::X:X|WORD> next-hop-self",
3798 "Disable the next hop calculation for this neighbor\n")
3801 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3802 bgp_node_safi (vty
),
3803 PEER_FLAG_NEXTHOP_SELF
);
3806 ALIAS_HIDDEN (no_neighbor_nexthop_self
,
3807 no_neighbor_nexthop_self_hidden_cmd
,
3808 "no neighbor <A.B.C.D|X:X::X:X|WORD> next-hop-self",
3812 "Disable the next hop calculation for this neighbor\n")
3814 DEFUN (no_neighbor_nexthop_self_force
,
3815 no_neighbor_nexthop_self_force_cmd
,
3816 "no neighbor <A.B.C.D|X:X::X:X|WORD> next-hop-self force",
3820 "Disable the next hop calculation for this neighbor\n"
3821 "Set the next hop to self for reflected routes\n")
3824 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3825 bgp_node_safi (vty
),
3826 PEER_FLAG_FORCE_NEXTHOP_SELF
);
3829 ALIAS_HIDDEN (no_neighbor_nexthop_self_force
,
3830 no_neighbor_nexthop_self_force_hidden_cmd
,
3831 "no neighbor <A.B.C.D|X:X::X:X|WORD> next-hop-self force",
3835 "Disable the next hop calculation for this neighbor\n"
3836 "Set the next hop to self for reflected routes\n")
3838 /* neighbor as-override */
3839 DEFUN (neighbor_as_override
,
3840 neighbor_as_override_cmd
,
3841 "neighbor <A.B.C.D|X:X::X:X|WORD> as-override",
3844 "Override ASNs in outbound updates if aspath equals remote-as\n")
3847 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3848 bgp_node_safi (vty
),
3849 PEER_FLAG_AS_OVERRIDE
);
3852 ALIAS_HIDDEN (neighbor_as_override
,
3853 neighbor_as_override_hidden_cmd
,
3854 "neighbor <A.B.C.D|X:X::X:X|WORD> as-override",
3857 "Override ASNs in outbound updates if aspath equals remote-as\n")
3859 DEFUN (no_neighbor_as_override
,
3860 no_neighbor_as_override_cmd
,
3861 "no neighbor <A.B.C.D|X:X::X:X|WORD> as-override",
3865 "Override ASNs in outbound updates if aspath equals remote-as\n")
3868 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3869 bgp_node_safi (vty
),
3870 PEER_FLAG_AS_OVERRIDE
);
3873 ALIAS_HIDDEN (no_neighbor_as_override
,
3874 no_neighbor_as_override_hidden_cmd
,
3875 "no neighbor <A.B.C.D|X:X::X:X|WORD> as-override",
3879 "Override ASNs in outbound updates if aspath equals remote-as\n")
3881 /* neighbor remove-private-AS. */
3882 DEFUN (neighbor_remove_private_as
,
3883 neighbor_remove_private_as_cmd
,
3884 "neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS",
3887 "Remove private ASNs in outbound updates\n")
3890 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3891 bgp_node_safi (vty
),
3892 PEER_FLAG_REMOVE_PRIVATE_AS
);
3895 ALIAS_HIDDEN (neighbor_remove_private_as
,
3896 neighbor_remove_private_as_hidden_cmd
,
3897 "neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS",
3900 "Remove private ASNs in outbound updates\n")
3902 DEFUN (neighbor_remove_private_as_all
,
3903 neighbor_remove_private_as_all_cmd
,
3904 "neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS all",
3907 "Remove private ASNs in outbound updates\n"
3908 "Apply to all AS numbers")
3911 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3912 bgp_node_safi (vty
),
3913 PEER_FLAG_REMOVE_PRIVATE_AS_ALL
);
3916 ALIAS_HIDDEN (neighbor_remove_private_as_all
,
3917 neighbor_remove_private_as_all_hidden_cmd
,
3918 "neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS all",
3921 "Remove private ASNs in outbound updates\n"
3922 "Apply to all AS numbers")
3924 DEFUN (neighbor_remove_private_as_replace_as
,
3925 neighbor_remove_private_as_replace_as_cmd
,
3926 "neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS replace-AS",
3929 "Remove private ASNs in outbound updates\n"
3930 "Replace private ASNs with our ASN in outbound updates\n")
3933 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3934 bgp_node_safi (vty
),
3935 PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE
);
3938 ALIAS_HIDDEN (neighbor_remove_private_as_replace_as
,
3939 neighbor_remove_private_as_replace_as_hidden_cmd
,
3940 "neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS replace-AS",
3943 "Remove private ASNs in outbound updates\n"
3944 "Replace private ASNs with our ASN in outbound updates\n")
3946 DEFUN (neighbor_remove_private_as_all_replace_as
,
3947 neighbor_remove_private_as_all_replace_as_cmd
,
3948 "neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS all replace-AS",
3951 "Remove private ASNs in outbound updates\n"
3952 "Apply to all AS numbers\n"
3953 "Replace private ASNs with our ASN in outbound updates\n")
3956 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3957 bgp_node_safi (vty
),
3958 PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE
);
3961 ALIAS_HIDDEN (neighbor_remove_private_as_all_replace_as
,
3962 neighbor_remove_private_as_all_replace_as_hidden_cmd
,
3963 "neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS all replace-AS",
3966 "Remove private ASNs in outbound updates\n"
3967 "Apply to all AS numbers\n"
3968 "Replace private ASNs with our ASN in outbound updates\n")
3970 DEFUN (no_neighbor_remove_private_as
,
3971 no_neighbor_remove_private_as_cmd
,
3972 "no neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS",
3976 "Remove private ASNs in outbound updates\n")
3979 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
3980 bgp_node_safi (vty
),
3981 PEER_FLAG_REMOVE_PRIVATE_AS
);
3984 ALIAS_HIDDEN (no_neighbor_remove_private_as
,
3985 no_neighbor_remove_private_as_hidden_cmd
,
3986 "no neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS",
3990 "Remove private ASNs in outbound updates\n")
3992 DEFUN (no_neighbor_remove_private_as_all
,
3993 no_neighbor_remove_private_as_all_cmd
,
3994 "no neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS all",
3998 "Remove private ASNs in outbound updates\n"
3999 "Apply to all AS numbers\n")
4002 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4003 bgp_node_safi (vty
),
4004 PEER_FLAG_REMOVE_PRIVATE_AS_ALL
);
4007 ALIAS_HIDDEN (no_neighbor_remove_private_as_all
,
4008 no_neighbor_remove_private_as_all_hidden_cmd
,
4009 "no neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS all",
4013 "Remove private ASNs in outbound updates\n"
4014 "Apply to all AS numbers\n")
4016 DEFUN (no_neighbor_remove_private_as_replace_as
,
4017 no_neighbor_remove_private_as_replace_as_cmd
,
4018 "no neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS replace-AS",
4022 "Remove private ASNs in outbound updates\n"
4023 "Replace private ASNs with our ASN in outbound updates\n")
4026 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4027 bgp_node_safi (vty
),
4028 PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE
);
4031 ALIAS_HIDDEN (no_neighbor_remove_private_as_replace_as
,
4032 no_neighbor_remove_private_as_replace_as_hidden_cmd
,
4033 "no neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS replace-AS",
4037 "Remove private ASNs in outbound updates\n"
4038 "Replace private ASNs with our ASN in outbound updates\n")
4040 DEFUN (no_neighbor_remove_private_as_all_replace_as
,
4041 no_neighbor_remove_private_as_all_replace_as_cmd
,
4042 "no neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS all replace-AS",
4046 "Remove private ASNs in outbound updates\n"
4047 "Apply to all AS numbers\n"
4048 "Replace private ASNs with our ASN in outbound updates\n")
4051 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4052 bgp_node_safi (vty
),
4053 PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE
);
4056 ALIAS_HIDDEN (no_neighbor_remove_private_as_all_replace_as
,
4057 no_neighbor_remove_private_as_all_replace_as_hidden_cmd
,
4058 "no neighbor <A.B.C.D|X:X::X:X|WORD> remove-private-AS all replace-AS",
4062 "Remove private ASNs in outbound updates\n"
4063 "Apply to all AS numbers\n"
4064 "Replace private ASNs with our ASN in outbound updates\n")
4067 /* neighbor send-community. */
4068 DEFUN (neighbor_send_community
,
4069 neighbor_send_community_cmd
,
4070 "neighbor <A.B.C.D|X:X::X:X|WORD> send-community",
4073 "Send Community attribute to this neighbor\n")
4076 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4077 bgp_node_safi (vty
),
4078 PEER_FLAG_SEND_COMMUNITY
);
4081 ALIAS_HIDDEN (neighbor_send_community
,
4082 neighbor_send_community_hidden_cmd
,
4083 "neighbor <A.B.C.D|X:X::X:X|WORD> send-community",
4086 "Send Community attribute to this neighbor\n")
4088 DEFUN (no_neighbor_send_community
,
4089 no_neighbor_send_community_cmd
,
4090 "no neighbor <A.B.C.D|X:X::X:X|WORD> send-community",
4094 "Send Community attribute to this neighbor\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_SEND_COMMUNITY
);
4102 ALIAS_HIDDEN (no_neighbor_send_community
,
4103 no_neighbor_send_community_hidden_cmd
,
4104 "no neighbor <A.B.C.D|X:X::X:X|WORD> send-community",
4108 "Send Community attribute to this neighbor\n")
4110 /* neighbor send-community extended. */
4111 DEFUN (neighbor_send_community_type
,
4112 neighbor_send_community_type_cmd
,
4113 "neighbor <A.B.C.D|X:X::X:X|WORD> send-community <both|all|extended|standard|large>",
4116 "Send Community attribute to this neighbor\n"
4117 "Send Standard and Extended Community attributes\n"
4118 "Send Standard, Large and Extended Community attributes\n"
4119 "Send Extended Community attributes\n"
4120 "Send Standard Community attributes\n"
4121 "Send Large Community attributes\n")
4126 char *peer
= argv
[1]->arg
;
4128 if (argv_find (argv
, argc
, "standard", &idx
))
4129 SET_FLAG (flag
, PEER_FLAG_SEND_COMMUNITY
);
4130 else if (argv_find (argv
, argc
, "extended", &idx
))
4131 SET_FLAG (flag
, PEER_FLAG_SEND_EXT_COMMUNITY
);
4132 else if (argv_find (argv
, argc
, "large", &idx
))
4133 SET_FLAG (flag
, PEER_FLAG_SEND_LARGE_COMMUNITY
);
4134 else if (argv_find (argv
, argc
, "both", &idx
))
4136 SET_FLAG (flag
, PEER_FLAG_SEND_COMMUNITY
);
4137 SET_FLAG (flag
, PEER_FLAG_SEND_EXT_COMMUNITY
);
4141 SET_FLAG (flag
, PEER_FLAG_SEND_COMMUNITY
);
4142 SET_FLAG (flag
, PEER_FLAG_SEND_EXT_COMMUNITY
);
4143 SET_FLAG (flag
, PEER_FLAG_SEND_LARGE_COMMUNITY
);
4146 return peer_af_flag_set_vty (vty
, peer
, bgp_node_afi (vty
), bgp_node_safi (vty
), flag
);
4149 ALIAS_HIDDEN (neighbor_send_community_type
,
4150 neighbor_send_community_type_hidden_cmd
,
4151 "neighbor <A.B.C.D|X:X::X:X|WORD> send-community <both|all|extended|standard|large>",
4154 "Send Community attribute to this neighbor\n"
4155 "Send Standard and Extended Community attributes\n"
4156 "Send Standard, Large and Extended Community attributes\n"
4157 "Send Extended Community attributes\n"
4158 "Send Standard Community attributes\n"
4159 "Send Large Community attributes\n")
4161 DEFUN (no_neighbor_send_community_type
,
4162 no_neighbor_send_community_type_cmd
,
4163 "no neighbor <A.B.C.D|X:X::X:X|WORD> send-community <both|all|extended|standard|large>",
4167 "Send Community attribute to this neighbor\n"
4168 "Send Standard and Extended Community attributes\n"
4169 "Send Standard, Large and Extended Community attributes\n"
4170 "Send Extended Community attributes\n"
4171 "Send Standard Community attributes\n"
4172 "Send Large Community attributes\n")
4176 const char *type
= argv
[argc
- 1]->text
;
4178 if (strmatch (type
, "standard"))
4179 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4180 bgp_node_safi (vty
),
4181 PEER_FLAG_SEND_COMMUNITY
);
4182 if (strmatch (type
, "extended"))
4183 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4184 bgp_node_safi (vty
),
4185 PEER_FLAG_SEND_EXT_COMMUNITY
);
4186 if (strmatch (type
, "large"))
4187 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4188 bgp_node_safi (vty
),
4189 PEER_FLAG_SEND_LARGE_COMMUNITY
);
4190 if (strmatch (type
, "both"))
4191 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4192 bgp_node_safi (vty
),
4193 PEER_FLAG_SEND_COMMUNITY
|
4194 PEER_FLAG_SEND_EXT_COMMUNITY
);
4196 /* if (strmatch (type, "all")) */
4197 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4198 bgp_node_safi (vty
),
4199 (PEER_FLAG_SEND_COMMUNITY
|
4200 PEER_FLAG_SEND_EXT_COMMUNITY
|
4201 PEER_FLAG_SEND_LARGE_COMMUNITY
));
4204 ALIAS_HIDDEN (no_neighbor_send_community_type
,
4205 no_neighbor_send_community_type_hidden_cmd
,
4206 "no neighbor <A.B.C.D|X:X::X:X|WORD> send-community <both|all|extended|standard|large>",
4210 "Send Community attribute to this neighbor\n"
4211 "Send Standard and Extended Community attributes\n"
4212 "Send Standard, Large and Extended Community attributes\n"
4213 "Send Extended Community attributes\n"
4214 "Send Standard Community attributes\n"
4215 "Send Large Community attributes\n")
4217 /* neighbor soft-reconfig. */
4218 DEFUN (neighbor_soft_reconfiguration
,
4219 neighbor_soft_reconfiguration_cmd
,
4220 "neighbor <A.B.C.D|X:X::X:X|WORD> soft-reconfiguration inbound",
4223 "Per neighbor soft reconfiguration\n"
4224 "Allow inbound soft reconfiguration for this neighbor\n")
4227 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
,
4228 bgp_node_afi (vty
), bgp_node_safi (vty
),
4229 PEER_FLAG_SOFT_RECONFIG
);
4232 ALIAS_HIDDEN (neighbor_soft_reconfiguration
,
4233 neighbor_soft_reconfiguration_hidden_cmd
,
4234 "neighbor <A.B.C.D|X:X::X:X|WORD> soft-reconfiguration inbound",
4237 "Per neighbor soft reconfiguration\n"
4238 "Allow inbound soft reconfiguration for this neighbor\n")
4240 DEFUN (no_neighbor_soft_reconfiguration
,
4241 no_neighbor_soft_reconfiguration_cmd
,
4242 "no neighbor <A.B.C.D|X:X::X:X|WORD> soft-reconfiguration inbound",
4246 "Per neighbor soft reconfiguration\n"
4247 "Allow inbound soft reconfiguration for this neighbor\n")
4250 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
,
4251 bgp_node_afi (vty
), bgp_node_safi (vty
),
4252 PEER_FLAG_SOFT_RECONFIG
);
4255 ALIAS_HIDDEN (no_neighbor_soft_reconfiguration
,
4256 no_neighbor_soft_reconfiguration_hidden_cmd
,
4257 "no neighbor <A.B.C.D|X:X::X:X|WORD> soft-reconfiguration inbound",
4261 "Per neighbor soft reconfiguration\n"
4262 "Allow inbound soft reconfiguration for this neighbor\n")
4264 DEFUN (neighbor_route_reflector_client
,
4265 neighbor_route_reflector_client_cmd
,
4266 "neighbor <A.B.C.D|X:X::X:X|WORD> route-reflector-client",
4269 "Configure a neighbor as Route Reflector client\n")
4275 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
4277 return CMD_WARNING_CONFIG_FAILED
;
4279 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4280 bgp_node_safi (vty
),
4281 PEER_FLAG_REFLECTOR_CLIENT
);
4284 ALIAS_HIDDEN (neighbor_route_reflector_client
,
4285 neighbor_route_reflector_client_hidden_cmd
,
4286 "neighbor <A.B.C.D|X:X::X:X|WORD> route-reflector-client",
4289 "Configure a neighbor as Route Reflector client\n")
4291 DEFUN (no_neighbor_route_reflector_client
,
4292 no_neighbor_route_reflector_client_cmd
,
4293 "no neighbor <A.B.C.D|X:X::X:X|WORD> route-reflector-client",
4297 "Configure a neighbor as Route Reflector client\n")
4300 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4301 bgp_node_safi (vty
),
4302 PEER_FLAG_REFLECTOR_CLIENT
);
4305 ALIAS_HIDDEN (no_neighbor_route_reflector_client
,
4306 no_neighbor_route_reflector_client_hidden_cmd
,
4307 "no neighbor <A.B.C.D|X:X::X:X|WORD> route-reflector-client",
4311 "Configure a neighbor as Route Reflector client\n")
4313 /* neighbor route-server-client. */
4314 DEFUN (neighbor_route_server_client
,
4315 neighbor_route_server_client_cmd
,
4316 "neighbor <A.B.C.D|X:X::X:X|WORD> route-server-client",
4319 "Configure a neighbor as Route Server client\n")
4324 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
4326 return CMD_WARNING_CONFIG_FAILED
;
4327 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4328 bgp_node_safi (vty
),
4329 PEER_FLAG_RSERVER_CLIENT
);
4332 ALIAS_HIDDEN (neighbor_route_server_client
,
4333 neighbor_route_server_client_hidden_cmd
,
4334 "neighbor <A.B.C.D|X:X::X:X|WORD> route-server-client",
4337 "Configure a neighbor as Route Server client\n")
4339 DEFUN (no_neighbor_route_server_client
,
4340 no_neighbor_route_server_client_cmd
,
4341 "no neighbor <A.B.C.D|X:X::X:X|WORD> route-server-client",
4345 "Configure a neighbor as Route Server client\n")
4348 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4349 bgp_node_safi (vty
),
4350 PEER_FLAG_RSERVER_CLIENT
);
4353 ALIAS_HIDDEN (no_neighbor_route_server_client
,
4354 no_neighbor_route_server_client_hidden_cmd
,
4355 "no neighbor <A.B.C.D|X:X::X:X|WORD> route-server-client",
4359 "Configure a neighbor as Route Server client\n")
4361 DEFUN (neighbor_nexthop_local_unchanged
,
4362 neighbor_nexthop_local_unchanged_cmd
,
4363 "neighbor <A.B.C.D|X:X::X:X|WORD> nexthop-local unchanged",
4366 "Configure treatment of outgoing link-local nexthop attribute\n"
4367 "Leave link-local nexthop unchanged for this peer\n")
4370 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4371 bgp_node_safi (vty
),
4372 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED
);
4375 DEFUN (no_neighbor_nexthop_local_unchanged
,
4376 no_neighbor_nexthop_local_unchanged_cmd
,
4377 "no neighbor <A.B.C.D|X:X::X:X|WORD> nexthop-local unchanged",
4381 "Configure treatment of outgoing link-local-nexthop attribute\n"
4382 "Leave link-local nexthop unchanged for this peer\n")
4385 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4386 bgp_node_safi (vty
),
4387 PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED
);
4390 DEFUN (neighbor_attr_unchanged
,
4391 neighbor_attr_unchanged_cmd
,
4392 "neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged [{as-path|next-hop|med}]",
4395 "BGP attribute is propagated unchanged to this neighbor\n"
4396 "As-path attribute\n"
4397 "Nexthop attribute\n"
4401 char *peer
= argv
[1]->arg
;
4402 u_int16_t flags
= 0;
4404 if (argv_find (argv
, argc
, "as-path", &idx
))
4405 SET_FLAG (flags
, PEER_FLAG_AS_PATH_UNCHANGED
);
4407 if (argv_find (argv
, argc
, "next-hop", &idx
))
4408 SET_FLAG (flags
, PEER_FLAG_NEXTHOP_UNCHANGED
);
4410 if (argv_find (argv
, argc
, "med", &idx
))
4411 SET_FLAG (flags
, PEER_FLAG_MED_UNCHANGED
);
4413 if (!flags
) // no flags means all of them!
4415 SET_FLAG (flags
, PEER_FLAG_AS_PATH_UNCHANGED
);
4416 SET_FLAG (flags
, PEER_FLAG_NEXTHOP_UNCHANGED
);
4417 SET_FLAG (flags
, PEER_FLAG_MED_UNCHANGED
);
4420 return peer_af_flag_set_vty (vty
, peer
, bgp_node_afi (vty
), bgp_node_safi (vty
), flags
);
4423 ALIAS_HIDDEN (neighbor_attr_unchanged
,
4424 neighbor_attr_unchanged_hidden_cmd
,
4425 "neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged [{as-path|next-hop|med}]",
4428 "BGP attribute is propagated unchanged to this neighbor\n"
4429 "As-path attribute\n"
4430 "Nexthop attribute\n"
4433 DEFUN (no_neighbor_attr_unchanged
,
4434 no_neighbor_attr_unchanged_cmd
,
4435 "no neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged [{as-path|next-hop|med}]",
4439 "BGP attribute is propagated unchanged to this neighbor\n"
4440 "As-path attribute\n"
4441 "Nexthop attribute\n"
4445 char *peer
= argv
[2]->arg
;
4446 u_int16_t flags
= 0;
4448 if (argv_find (argv
, argc
, "as-path", &idx
))
4449 SET_FLAG (flags
, PEER_FLAG_AS_PATH_UNCHANGED
);
4451 if (argv_find (argv
, argc
, "next-hop", &idx
))
4452 SET_FLAG (flags
, PEER_FLAG_NEXTHOP_UNCHANGED
);
4454 if (argv_find (argv
, argc
, "med", &idx
))
4455 SET_FLAG (flags
, PEER_FLAG_MED_UNCHANGED
);
4457 if (!flags
) // no flags means all of them!
4459 SET_FLAG (flags
, PEER_FLAG_AS_PATH_UNCHANGED
);
4460 SET_FLAG (flags
, PEER_FLAG_NEXTHOP_UNCHANGED
);
4461 SET_FLAG (flags
, PEER_FLAG_MED_UNCHANGED
);
4464 return peer_af_flag_unset_vty (vty
, peer
, bgp_node_afi (vty
), bgp_node_safi (vty
), flags
);
4467 ALIAS_HIDDEN (no_neighbor_attr_unchanged
,
4468 no_neighbor_attr_unchanged_hidden_cmd
,
4469 "no neighbor <A.B.C.D|X:X::X:X|WORD> attribute-unchanged [{as-path|next-hop|med}]",
4473 "BGP attribute is propagated unchanged to this neighbor\n"
4474 "As-path attribute\n"
4475 "Nexthop attribute\n"
4478 /* EBGP multihop configuration. */
4480 peer_ebgp_multihop_set_vty (struct vty
*vty
, const char *ip_str
,
4481 const char *ttl_str
)
4486 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
4488 return CMD_WARNING_CONFIG_FAILED
;
4491 return bgp_vty_return (vty
, BGP_ERR_INVALID_FOR_DIRECT_PEER
);
4496 ttl
= strtoul(ttl_str
, NULL
, 10);
4498 return bgp_vty_return (vty
, peer_ebgp_multihop_set (peer
, ttl
));
4502 peer_ebgp_multihop_unset_vty (struct vty
*vty
, const char *ip_str
)
4506 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
4508 return CMD_WARNING_CONFIG_FAILED
;
4510 return bgp_vty_return (vty
, peer_ebgp_multihop_unset (peer
));
4513 /* neighbor ebgp-multihop. */
4514 DEFUN (neighbor_ebgp_multihop
,
4515 neighbor_ebgp_multihop_cmd
,
4516 "neighbor <A.B.C.D|X:X::X:X|WORD> ebgp-multihop",
4519 "Allow EBGP neighbors not on directly connected networks\n")
4522 return peer_ebgp_multihop_set_vty (vty
, argv
[idx_peer
]->arg
, NULL
);
4525 DEFUN (neighbor_ebgp_multihop_ttl
,
4526 neighbor_ebgp_multihop_ttl_cmd
,
4527 "neighbor <A.B.C.D|X:X::X:X|WORD> ebgp-multihop (1-255)",
4530 "Allow EBGP neighbors not on directly connected networks\n"
4531 "maximum hop count\n")
4535 return peer_ebgp_multihop_set_vty (vty
, argv
[idx_peer
]->arg
, argv
[idx_number
]->arg
);
4538 DEFUN (no_neighbor_ebgp_multihop
,
4539 no_neighbor_ebgp_multihop_cmd
,
4540 "no neighbor <A.B.C.D|X:X::X:X|WORD> ebgp-multihop [(1-255)]",
4544 "Allow EBGP neighbors not on directly connected networks\n"
4545 "maximum hop count\n")
4548 return peer_ebgp_multihop_unset_vty (vty
, argv
[idx_peer
]->arg
);
4552 /* disable-connected-check */
4553 DEFUN (neighbor_disable_connected_check
,
4554 neighbor_disable_connected_check_cmd
,
4555 "neighbor <A.B.C.D|X:X::X:X|WORD> <disable-connected-check|enforce-multihop>",
4558 "one-hop away EBGP peer using loopback address\n"
4559 "Enforce EBGP neighbors perform multihop\n")
4562 return peer_flag_set_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_DISABLE_CONNECTED_CHECK
);
4565 DEFUN (no_neighbor_disable_connected_check
,
4566 no_neighbor_disable_connected_check_cmd
,
4567 "no neighbor <A.B.C.D|X:X::X:X|WORD> <disable-connected-check|enforce-multihop>",
4571 "one-hop away EBGP peer using loopback address\n"
4572 "Enforce EBGP neighbors perform multihop\n")
4575 return peer_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_DISABLE_CONNECTED_CHECK
);
4578 DEFUN (neighbor_description
,
4579 neighbor_description_cmd
,
4580 "neighbor <A.B.C.D|X:X::X:X|WORD> description LINE...",
4583 "Neighbor specific description\n"
4584 "Up to 80 characters describing this neighbor\n")
4591 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
4593 return CMD_WARNING_CONFIG_FAILED
;
4595 str
= argv_concat(argv
, argc
, idx_line
);
4597 peer_description_set (peer
, str
);
4599 XFREE (MTYPE_TMP
, str
);
4604 DEFUN (no_neighbor_description
,
4605 no_neighbor_description_cmd
,
4606 "no neighbor <A.B.C.D|X:X::X:X|WORD> description [LINE]",
4610 "Neighbor specific description\n"
4611 "Up to 80 characters describing this neighbor\n")
4616 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
4618 return CMD_WARNING_CONFIG_FAILED
;
4620 peer_description_unset (peer
);
4626 /* Neighbor update-source. */
4628 peer_update_source_vty (struct vty
*vty
, const char *peer_str
,
4629 const char *source_str
)
4634 peer
= peer_and_group_lookup_vty (vty
, peer_str
);
4636 return CMD_WARNING_CONFIG_FAILED
;
4644 int ret
= str2sockunion (source_str
, &su
);
4647 peer_update_source_addr_set (peer
, &su
);
4650 if (str2prefix (source_str
, &p
))
4652 vty_out (vty
, "%% Invalid update-source, remove prefix length %s",
4654 return CMD_WARNING_CONFIG_FAILED
;
4657 peer_update_source_if_set (peer
, source_str
);
4661 peer_update_source_unset (peer
);
4666 #define BGP_UPDATE_SOURCE_HELP_STR \
4669 "Interface name (requires zebra to be running)\n"
4671 DEFUN (neighbor_update_source
,
4672 neighbor_update_source_cmd
,
4673 "neighbor <A.B.C.D|X:X::X:X|WORD> update-source <A.B.C.D|X:X::X:X|WORD>",
4676 "Source of routing updates\n"
4677 BGP_UPDATE_SOURCE_HELP_STR
)
4681 return peer_update_source_vty (vty
, argv
[idx_peer
]->arg
, argv
[idx_peer_2
]->arg
);
4684 DEFUN (no_neighbor_update_source
,
4685 no_neighbor_update_source_cmd
,
4686 "no neighbor <A.B.C.D|X:X::X:X|WORD> update-source [<A.B.C.D|X:X::X:X|WORD>]",
4690 "Source of routing updates\n"
4691 BGP_UPDATE_SOURCE_HELP_STR
)
4694 return peer_update_source_vty (vty
, argv
[idx_peer
]->arg
, NULL
);
4698 peer_default_originate_set_vty (struct vty
*vty
, const char *peer_str
,
4699 afi_t afi
, safi_t safi
,
4700 const char *rmap
, int set
)
4705 peer
= peer_and_group_lookup_vty (vty
, peer_str
);
4707 return CMD_WARNING_CONFIG_FAILED
;
4710 ret
= peer_default_originate_set (peer
, afi
, safi
, rmap
);
4712 ret
= peer_default_originate_unset (peer
, afi
, safi
);
4714 return bgp_vty_return (vty
, ret
);
4717 /* neighbor default-originate. */
4718 DEFUN (neighbor_default_originate
,
4719 neighbor_default_originate_cmd
,
4720 "neighbor <A.B.C.D|X:X::X:X|WORD> default-originate",
4723 "Originate default route to this neighbor\n")
4726 return peer_default_originate_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4727 bgp_node_safi (vty
), NULL
, 1);
4730 ALIAS_HIDDEN (neighbor_default_originate
,
4731 neighbor_default_originate_hidden_cmd
,
4732 "neighbor <A.B.C.D|X:X::X:X|WORD> default-originate",
4735 "Originate default route to this neighbor\n")
4737 DEFUN (neighbor_default_originate_rmap
,
4738 neighbor_default_originate_rmap_cmd
,
4739 "neighbor <A.B.C.D|X:X::X:X|WORD> default-originate route-map WORD",
4742 "Originate default route to this neighbor\n"
4743 "Route-map to specify criteria to originate default\n"
4748 return peer_default_originate_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4749 bgp_node_safi (vty
), argv
[idx_word
]->arg
, 1);
4752 ALIAS_HIDDEN (neighbor_default_originate_rmap
,
4753 neighbor_default_originate_rmap_hidden_cmd
,
4754 "neighbor <A.B.C.D|X:X::X:X|WORD> default-originate route-map WORD",
4757 "Originate default route to this neighbor\n"
4758 "Route-map to specify criteria to originate default\n"
4761 DEFUN (no_neighbor_default_originate
,
4762 no_neighbor_default_originate_cmd
,
4763 "no neighbor <A.B.C.D|X:X::X:X|WORD> default-originate [route-map WORD]",
4767 "Originate default route to this neighbor\n"
4768 "Route-map to specify criteria to originate default\n"
4772 return peer_default_originate_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
4773 bgp_node_safi (vty
), NULL
, 0);
4776 ALIAS_HIDDEN (no_neighbor_default_originate
,
4777 no_neighbor_default_originate_hidden_cmd
,
4778 "no neighbor <A.B.C.D|X:X::X:X|WORD> default-originate [route-map WORD]",
4782 "Originate default route to this neighbor\n"
4783 "Route-map to specify criteria to originate default\n"
4787 /* Set neighbor's BGP port. */
4789 peer_port_vty (struct vty
*vty
, const char *ip_str
, int afi
,
4790 const char *port_str
)
4796 peer
= peer_lookup_vty (vty
, ip_str
);
4798 return CMD_WARNING_CONFIG_FAILED
;
4802 sp
= getservbyname ("bgp", "tcp");
4803 port
= (sp
== NULL
) ? BGP_PORT_DEFAULT
: ntohs (sp
->s_port
);
4807 port
= strtoul(port_str
, NULL
, 10);
4810 peer_port_set (peer
, port
);
4815 /* Set specified peer's BGP port. */
4816 DEFUN (neighbor_port
,
4818 "neighbor <A.B.C.D|X:X::X:X> port (0-65535)",
4821 "Neighbor's BGP port\n"
4822 "TCP port number\n")
4826 return peer_port_vty (vty
, argv
[idx_ip
]->arg
, AFI_IP
, argv
[idx_number
]->arg
);
4829 DEFUN (no_neighbor_port
,
4830 no_neighbor_port_cmd
,
4831 "no neighbor <A.B.C.D|X:X::X:X> port [(0-65535)]",
4835 "Neighbor's BGP port\n"
4836 "TCP port number\n")
4839 return peer_port_vty (vty
, argv
[idx_ip
]->arg
, AFI_IP
, NULL
);
4843 /* neighbor weight. */
4845 peer_weight_set_vty (struct vty
*vty
, const char *ip_str
,
4846 afi_t afi
, safi_t safi
,
4847 const char *weight_str
)
4851 unsigned long weight
;
4853 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
4855 return CMD_WARNING_CONFIG_FAILED
;
4857 weight
= strtoul(weight_str
, NULL
, 10);
4859 ret
= peer_weight_set (peer
, afi
, safi
, weight
);
4860 return bgp_vty_return (vty
, ret
);
4864 peer_weight_unset_vty (struct vty
*vty
, const char *ip_str
,
4865 afi_t afi
, safi_t safi
)
4870 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
4872 return CMD_WARNING_CONFIG_FAILED
;
4874 ret
= peer_weight_unset (peer
, afi
, safi
);
4875 return bgp_vty_return (vty
, ret
);
4878 DEFUN (neighbor_weight
,
4879 neighbor_weight_cmd
,
4880 "neighbor <A.B.C.D|X:X::X:X|WORD> weight (0-65535)",
4883 "Set default weight for routes from this neighbor\n"
4888 return peer_weight_set_vty (vty
,
4889 argv
[idx_peer
]->arg
,
4891 bgp_node_safi (vty
),
4892 argv
[idx_number
]->arg
);
4895 ALIAS_HIDDEN (neighbor_weight
,
4896 neighbor_weight_hidden_cmd
,
4897 "neighbor <A.B.C.D|X:X::X:X|WORD> weight (0-65535)",
4900 "Set default weight for routes from this neighbor\n"
4903 DEFUN (no_neighbor_weight
,
4904 no_neighbor_weight_cmd
,
4905 "no neighbor <A.B.C.D|X:X::X:X|WORD> weight [(0-65535)]",
4909 "Set default weight for routes from this neighbor\n"
4913 return peer_weight_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
), bgp_node_safi (vty
));
4916 ALIAS_HIDDEN (no_neighbor_weight
,
4917 no_neighbor_weight_hidden_cmd
,
4918 "no neighbor <A.B.C.D|X:X::X:X|WORD> weight [(0-65535)]",
4922 "Set default weight for routes from this neighbor\n"
4926 /* Override capability negotiation. */
4927 DEFUN (neighbor_override_capability
,
4928 neighbor_override_capability_cmd
,
4929 "neighbor <A.B.C.D|X:X::X:X|WORD> override-capability",
4932 "Override capability negotiation result\n")
4935 return peer_flag_set_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_OVERRIDE_CAPABILITY
);
4938 DEFUN (no_neighbor_override_capability
,
4939 no_neighbor_override_capability_cmd
,
4940 "no neighbor <A.B.C.D|X:X::X:X|WORD> override-capability",
4944 "Override capability negotiation result\n")
4947 return peer_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, PEER_FLAG_OVERRIDE_CAPABILITY
);
4950 DEFUN (neighbor_strict_capability
,
4951 neighbor_strict_capability_cmd
,
4952 "neighbor <A.B.C.D|X:X::X:X> strict-capability-match",
4955 "Strict capability negotiation match\n")
4958 return peer_flag_set_vty (vty
, argv
[idx_ip
]->arg
, PEER_FLAG_STRICT_CAP_MATCH
);
4961 DEFUN (no_neighbor_strict_capability
,
4962 no_neighbor_strict_capability_cmd
,
4963 "no neighbor <A.B.C.D|X:X::X:X> strict-capability-match",
4967 "Strict capability negotiation match\n")
4970 return peer_flag_unset_vty (vty
, argv
[idx_ip
]->arg
, PEER_FLAG_STRICT_CAP_MATCH
);
4974 peer_timers_set_vty (struct vty
*vty
, const char *ip_str
,
4975 const char *keep_str
, const char *hold_str
)
4979 u_int32_t keepalive
;
4982 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
4984 return CMD_WARNING_CONFIG_FAILED
;
4986 keepalive
= strtoul(keep_str
, NULL
, 10);
4987 holdtime
= strtoul(hold_str
, NULL
, 10);
4989 ret
= peer_timers_set (peer
, keepalive
, holdtime
);
4991 return bgp_vty_return (vty
, ret
);
4995 peer_timers_unset_vty (struct vty
*vty
, const char *ip_str
)
5000 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5002 return CMD_WARNING_CONFIG_FAILED
;
5004 ret
= peer_timers_unset (peer
);
5006 return bgp_vty_return (vty
, ret
);
5009 DEFUN (neighbor_timers
,
5010 neighbor_timers_cmd
,
5011 "neighbor <A.B.C.D|X:X::X:X|WORD> timers (0-65535) (0-65535)",
5014 "BGP per neighbor timers\n"
5015 "Keepalive interval\n"
5020 int idx_number_2
= 4;
5021 return peer_timers_set_vty (vty
, argv
[idx_peer
]->arg
, argv
[idx_number
]->arg
, argv
[idx_number_2
]->arg
);
5024 DEFUN (no_neighbor_timers
,
5025 no_neighbor_timers_cmd
,
5026 "no neighbor <A.B.C.D|X:X::X:X|WORD> timers [(0-65535) (0-65535)]",
5030 "BGP per neighbor timers\n"
5031 "Keepalive interval\n"
5035 return peer_timers_unset_vty (vty
, argv
[idx_peer
]->arg
);
5040 peer_timers_connect_set_vty (struct vty
*vty
, const char *ip_str
,
5041 const char *time_str
)
5047 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5049 return CMD_WARNING_CONFIG_FAILED
;
5051 connect
= strtoul(time_str
, NULL
, 10);
5053 ret
= peer_timers_connect_set (peer
, connect
);
5055 return bgp_vty_return (vty
, ret
);
5059 peer_timers_connect_unset_vty (struct vty
*vty
, const char *ip_str
)
5064 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5066 return CMD_WARNING_CONFIG_FAILED
;
5068 ret
= peer_timers_connect_unset (peer
);
5070 return bgp_vty_return (vty
, ret
);
5073 DEFUN (neighbor_timers_connect
,
5074 neighbor_timers_connect_cmd
,
5075 "neighbor <A.B.C.D|X:X::X:X|WORD> timers connect (1-65535)",
5078 "BGP per neighbor timers\n"
5079 "BGP connect timer\n"
5084 return peer_timers_connect_set_vty (vty
, argv
[idx_peer
]->arg
, argv
[idx_number
]->arg
);
5087 DEFUN (no_neighbor_timers_connect
,
5088 no_neighbor_timers_connect_cmd
,
5089 "no neighbor <A.B.C.D|X:X::X:X|WORD> timers connect [(1-65535)]",
5093 "BGP per neighbor timers\n"
5094 "BGP connect timer\n"
5098 return peer_timers_connect_unset_vty (vty
, argv
[idx_peer
]->arg
);
5103 peer_advertise_interval_vty (struct vty
*vty
, const char *ip_str
,
5104 const char *time_str
, int set
)
5108 u_int32_t routeadv
= 0;
5110 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5112 return CMD_WARNING_CONFIG_FAILED
;
5115 routeadv
= strtoul(time_str
, NULL
, 10);
5118 ret
= peer_advertise_interval_set (peer
, routeadv
);
5120 ret
= peer_advertise_interval_unset (peer
);
5122 return bgp_vty_return (vty
, ret
);
5125 DEFUN (neighbor_advertise_interval
,
5126 neighbor_advertise_interval_cmd
,
5127 "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")
5135 return peer_advertise_interval_vty (vty
, argv
[idx_peer
]->arg
, argv
[idx_number
]->arg
, 1);
5138 DEFUN (no_neighbor_advertise_interval
,
5139 no_neighbor_advertise_interval_cmd
,
5140 "no neighbor <A.B.C.D|X:X::X:X|WORD> advertisement-interval [(0-600)]",
5144 "Minimum interval between sending BGP routing updates\n"
5145 "time in seconds\n")
5148 return peer_advertise_interval_vty (vty
, argv
[idx_peer
]->arg
, NULL
, 0);
5152 /* Time to wait before processing route-map updates */
5153 DEFUN (bgp_set_route_map_delay_timer
,
5154 bgp_set_route_map_delay_timer_cmd
,
5155 "bgp route-map delay-timer (0-600)",
5157 "BGP route-map delay timer\n"
5158 "Time in secs to wait before processing route-map changes\n"
5159 "0 disables the timer, no route updates happen when route-maps change\n")
5162 u_int32_t rmap_delay_timer
;
5164 if (argv
[idx_number
]->arg
)
5166 rmap_delay_timer
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
5167 bm
->rmap_update_timer
= rmap_delay_timer
;
5169 /* if the dynamic update handling is being disabled, and a timer is
5170 * running, stop the timer and act as if the timer has already fired.
5172 if (!rmap_delay_timer
&& bm
->t_rmap_update
)
5174 BGP_TIMER_OFF(bm
->t_rmap_update
);
5175 thread_execute (bm
->master
, bgp_route_map_update_timer
, NULL
, 0);
5181 vty_outln (vty
, "%% BGP invalid route-map delay-timer");
5182 return CMD_WARNING_CONFIG_FAILED
;
5186 DEFUN (no_bgp_set_route_map_delay_timer
,
5187 no_bgp_set_route_map_delay_timer_cmd
,
5188 "no bgp route-map delay-timer [(0-600)]",
5191 "Default BGP route-map delay timer\n"
5192 "Reset to default time to wait for processing route-map changes\n"
5193 "0 disables the timer, no route updates happen when route-maps change\n")
5196 bm
->rmap_update_timer
= RMAP_DEFAULT_UPDATE_TIMER
;
5202 /* neighbor interface */
5204 peer_interface_vty (struct vty
*vty
, const char *ip_str
, const char *str
)
5208 peer
= peer_lookup_vty (vty
, ip_str
);
5209 if (! peer
|| peer
->conf_if
)
5211 vty_outln (vty
, "%% BGP invalid peer %s", ip_str
);
5212 return CMD_WARNING_CONFIG_FAILED
;
5216 peer_interface_set (peer
, str
);
5218 peer_interface_unset (peer
);
5223 DEFUN (neighbor_interface
,
5224 neighbor_interface_cmd
,
5225 "neighbor <A.B.C.D|X:X::X:X> interface WORD",
5233 return peer_interface_vty (vty
, argv
[idx_ip
]->arg
, argv
[idx_word
]->arg
);
5236 DEFUN (no_neighbor_interface
,
5237 no_neighbor_interface_cmd
,
5238 "no neighbor <A.B.C.D|X:X::X:X|WORD> interface WORD",
5246 return peer_interface_vty (vty
, argv
[idx_peer
]->arg
, NULL
);
5249 DEFUN (neighbor_distribute_list
,
5250 neighbor_distribute_list_cmd
,
5251 "neighbor <A.B.C.D|X:X::X:X|WORD> distribute-list <(1-199)|(1300-2699)|WORD> <in|out>",
5254 "Filter updates to/from this neighbor\n"
5255 "IP access-list number\n"
5256 "IP access-list number (expanded range)\n"
5257 "IP Access-list name\n"
5258 "Filter incoming updates\n"
5259 "Filter outgoing updates\n")
5266 const char *pstr
= argv
[idx_peer
]->arg
;
5267 const char *acl
= argv
[idx_acl
]->arg
;
5268 const char *inout
= argv
[argc
-1]->text
;
5270 peer
= peer_and_group_lookup_vty (vty
, pstr
);
5272 return CMD_WARNING_CONFIG_FAILED
;
5274 /* Check filter direction. */
5275 direct
= strmatch (inout
, "in") ? FILTER_IN
: FILTER_OUT
;
5276 ret
= peer_distribute_set (peer
, bgp_node_afi (vty
), bgp_node_safi (vty
), direct
, acl
);
5278 return bgp_vty_return (vty
, ret
);
5281 ALIAS_HIDDEN (neighbor_distribute_list
,
5282 neighbor_distribute_list_hidden_cmd
,
5283 "neighbor <A.B.C.D|X:X::X:X|WORD> distribute-list <(1-199)|(1300-2699)|WORD> <in|out>",
5286 "Filter updates to/from this neighbor\n"
5287 "IP access-list number\n"
5288 "IP access-list number (expanded range)\n"
5289 "IP Access-list name\n"
5290 "Filter incoming updates\n"
5291 "Filter outgoing updates\n")
5293 DEFUN (no_neighbor_distribute_list
,
5294 no_neighbor_distribute_list_cmd
,
5295 "no neighbor <A.B.C.D|X:X::X:X|WORD> distribute-list <(1-199)|(1300-2699)|WORD> <in|out>",
5299 "Filter updates to/from this neighbor\n"
5300 "IP access-list number\n"
5301 "IP access-list number (expanded range)\n"
5302 "IP Access-list name\n"
5303 "Filter incoming updates\n"
5304 "Filter outgoing updates\n")
5310 const char *pstr
= argv
[idx_peer
]->arg
;
5311 const char *inout
= argv
[argc
-1]->text
;
5313 peer
= peer_and_group_lookup_vty (vty
, pstr
);
5315 return CMD_WARNING_CONFIG_FAILED
;
5317 /* Check filter direction. */
5318 direct
= strmatch (inout
, "in") ? FILTER_IN
: FILTER_OUT
;
5319 ret
= peer_distribute_unset (peer
, bgp_node_afi (vty
), bgp_node_safi (vty
), direct
);
5321 return bgp_vty_return (vty
, ret
);
5324 ALIAS_HIDDEN (no_neighbor_distribute_list
,
5325 no_neighbor_distribute_list_hidden_cmd
,
5326 "no neighbor <A.B.C.D|X:X::X:X|WORD> distribute-list <(1-199)|(1300-2699)|WORD> <in|out>",
5330 "Filter updates to/from this neighbor\n"
5331 "IP access-list number\n"
5332 "IP access-list number (expanded range)\n"
5333 "IP Access-list name\n"
5334 "Filter incoming updates\n"
5335 "Filter outgoing updates\n")
5337 /* Set prefix list to the peer. */
5339 peer_prefix_list_set_vty (struct vty
*vty
, const char *ip_str
, afi_t afi
,
5340 safi_t safi
, const char *name_str
,
5341 const char *direct_str
)
5345 int direct
= FILTER_IN
;
5347 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5349 return CMD_WARNING_CONFIG_FAILED
;
5351 /* Check filter direction. */
5352 if (strncmp (direct_str
, "i", 1) == 0)
5354 else if (strncmp (direct_str
, "o", 1) == 0)
5355 direct
= FILTER_OUT
;
5357 ret
= peer_prefix_list_set (peer
, afi
, safi
, direct
, name_str
);
5359 return bgp_vty_return (vty
, ret
);
5363 peer_prefix_list_unset_vty (struct vty
*vty
, const char *ip_str
, afi_t afi
,
5364 safi_t safi
, const char *direct_str
)
5368 int direct
= FILTER_IN
;
5370 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5372 return CMD_WARNING_CONFIG_FAILED
;
5374 /* Check filter direction. */
5375 if (strncmp (direct_str
, "i", 1) == 0)
5377 else if (strncmp (direct_str
, "o", 1) == 0)
5378 direct
= FILTER_OUT
;
5380 ret
= peer_prefix_list_unset (peer
, afi
, safi
, direct
);
5382 return bgp_vty_return (vty
, ret
);
5385 DEFUN (neighbor_prefix_list
,
5386 neighbor_prefix_list_cmd
,
5387 "neighbor <A.B.C.D|X:X::X:X|WORD> prefix-list WORD <in|out>",
5390 "Filter updates to/from this neighbor\n"
5391 "Name of a prefix list\n"
5392 "Filter incoming updates\n"
5393 "Filter outgoing updates\n")
5398 return peer_prefix_list_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5399 bgp_node_safi (vty
), argv
[idx_word
]->arg
, argv
[idx_in_out
]->arg
);
5402 ALIAS_HIDDEN (neighbor_prefix_list
,
5403 neighbor_prefix_list_hidden_cmd
,
5404 "neighbor <A.B.C.D|X:X::X:X|WORD> prefix-list WORD <in|out>",
5407 "Filter updates to/from this neighbor\n"
5408 "Name of a prefix list\n"
5409 "Filter incoming updates\n"
5410 "Filter outgoing updates\n")
5412 DEFUN (no_neighbor_prefix_list
,
5413 no_neighbor_prefix_list_cmd
,
5414 "no neighbor <A.B.C.D|X:X::X:X|WORD> prefix-list WORD <in|out>",
5418 "Filter updates to/from this neighbor\n"
5419 "Name of a prefix list\n"
5420 "Filter incoming updates\n"
5421 "Filter outgoing updates\n")
5425 return peer_prefix_list_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5426 bgp_node_safi (vty
), argv
[idx_in_out
]->arg
);
5429 ALIAS_HIDDEN (no_neighbor_prefix_list
,
5430 no_neighbor_prefix_list_hidden_cmd
,
5431 "no neighbor <A.B.C.D|X:X::X:X|WORD> prefix-list WORD <in|out>",
5435 "Filter updates to/from this neighbor\n"
5436 "Name of a prefix list\n"
5437 "Filter incoming updates\n"
5438 "Filter outgoing updates\n")
5441 peer_aslist_set_vty (struct vty
*vty
, const char *ip_str
,
5442 afi_t afi
, safi_t safi
,
5443 const char *name_str
, const char *direct_str
)
5447 int direct
= FILTER_IN
;
5449 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5451 return CMD_WARNING_CONFIG_FAILED
;
5453 /* Check filter direction. */
5454 if (strncmp (direct_str
, "i", 1) == 0)
5456 else if (strncmp (direct_str
, "o", 1) == 0)
5457 direct
= FILTER_OUT
;
5459 ret
= peer_aslist_set (peer
, afi
, safi
, direct
, name_str
);
5461 return bgp_vty_return (vty
, ret
);
5465 peer_aslist_unset_vty (struct vty
*vty
, const char *ip_str
,
5466 afi_t afi
, safi_t safi
,
5467 const char *direct_str
)
5471 int direct
= FILTER_IN
;
5473 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5475 return CMD_WARNING_CONFIG_FAILED
;
5477 /* Check filter direction. */
5478 if (strncmp (direct_str
, "i", 1) == 0)
5480 else if (strncmp (direct_str
, "o", 1) == 0)
5481 direct
= FILTER_OUT
;
5483 ret
= peer_aslist_unset (peer
, afi
, safi
, direct
);
5485 return bgp_vty_return (vty
, ret
);
5488 DEFUN (neighbor_filter_list
,
5489 neighbor_filter_list_cmd
,
5490 "neighbor <A.B.C.D|X:X::X:X|WORD> filter-list WORD <in|out>",
5493 "Establish BGP filters\n"
5494 "AS path access-list name\n"
5495 "Filter incoming routes\n"
5496 "Filter outgoing routes\n")
5501 return peer_aslist_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5502 bgp_node_safi (vty
), argv
[idx_word
]->arg
, argv
[idx_in_out
]->arg
);
5505 ALIAS_HIDDEN (neighbor_filter_list
,
5506 neighbor_filter_list_hidden_cmd
,
5507 "neighbor <A.B.C.D|X:X::X:X|WORD> filter-list WORD <in|out>",
5510 "Establish BGP filters\n"
5511 "AS path access-list name\n"
5512 "Filter incoming routes\n"
5513 "Filter outgoing routes\n")
5515 DEFUN (no_neighbor_filter_list
,
5516 no_neighbor_filter_list_cmd
,
5517 "no neighbor <A.B.C.D|X:X::X:X|WORD> filter-list WORD <in|out>",
5521 "Establish BGP filters\n"
5522 "AS path access-list name\n"
5523 "Filter incoming routes\n"
5524 "Filter outgoing routes\n")
5528 return peer_aslist_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5529 bgp_node_safi (vty
), argv
[idx_in_out
]->arg
);
5532 ALIAS_HIDDEN (no_neighbor_filter_list
,
5533 no_neighbor_filter_list_hidden_cmd
,
5534 "no neighbor <A.B.C.D|X:X::X:X|WORD> filter-list WORD <in|out>",
5538 "Establish BGP filters\n"
5539 "AS path access-list name\n"
5540 "Filter incoming routes\n"
5541 "Filter outgoing routes\n")
5543 /* Set route-map to the peer. */
5545 peer_route_map_set_vty (struct vty
*vty
, const char *ip_str
,
5546 afi_t afi
, safi_t safi
,
5547 const char *name_str
, const char *direct_str
)
5551 int direct
= RMAP_IN
;
5553 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5555 return CMD_WARNING_CONFIG_FAILED
;
5557 /* Check filter direction. */
5558 if (strncmp (direct_str
, "in", 2) == 0)
5560 else if (strncmp (direct_str
, "o", 1) == 0)
5563 ret
= peer_route_map_set (peer
, afi
, safi
, direct
, name_str
);
5565 return bgp_vty_return (vty
, ret
);
5569 peer_route_map_unset_vty (struct vty
*vty
, const char *ip_str
, afi_t afi
,
5570 safi_t safi
, const char *direct_str
)
5574 int direct
= RMAP_IN
;
5576 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5578 return CMD_WARNING_CONFIG_FAILED
;
5580 /* Check filter direction. */
5581 if (strncmp (direct_str
, "in", 2) == 0)
5583 else if (strncmp (direct_str
, "o", 1) == 0)
5586 ret
= peer_route_map_unset (peer
, afi
, safi
, direct
);
5588 return bgp_vty_return (vty
, ret
);
5591 DEFUN (neighbor_route_map
,
5592 neighbor_route_map_cmd
,
5593 "neighbor <A.B.C.D|X:X::X:X|WORD> route-map WORD <in|out>",
5596 "Apply route map to neighbor\n"
5597 "Name of route map\n"
5598 "Apply map to incoming routes\n"
5599 "Apply map to outbound routes\n")
5604 return peer_route_map_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5605 bgp_node_safi (vty
), argv
[idx_word
]->arg
, argv
[idx_in_out
]->arg
);
5608 ALIAS_HIDDEN (neighbor_route_map
,
5609 neighbor_route_map_hidden_cmd
,
5610 "neighbor <A.B.C.D|X:X::X:X|WORD> route-map WORD <in|out>",
5613 "Apply route map to neighbor\n"
5614 "Name of route map\n"
5615 "Apply map to incoming routes\n"
5616 "Apply map to outbound routes\n")
5618 DEFUN (no_neighbor_route_map
,
5619 no_neighbor_route_map_cmd
,
5620 "no neighbor <A.B.C.D|X:X::X:X|WORD> route-map WORD <in|out>",
5624 "Apply route map to neighbor\n"
5625 "Name of route map\n"
5626 "Apply map to incoming routes\n"
5627 "Apply map to outbound routes\n")
5631 return peer_route_map_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5632 bgp_node_safi (vty
), argv
[idx_in_out
]->arg
);
5635 ALIAS_HIDDEN (no_neighbor_route_map
,
5636 no_neighbor_route_map_hidden_cmd
,
5637 "no neighbor <A.B.C.D|X:X::X:X|WORD> route-map WORD <in|out>",
5641 "Apply route map to neighbor\n"
5642 "Name of route map\n"
5643 "Apply map to incoming routes\n"
5644 "Apply map to outbound routes\n")
5646 /* Set unsuppress-map to the peer. */
5648 peer_unsuppress_map_set_vty (struct vty
*vty
, const char *ip_str
, afi_t afi
,
5649 safi_t safi
, const char *name_str
)
5654 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5656 return CMD_WARNING_CONFIG_FAILED
;
5658 ret
= peer_unsuppress_map_set (peer
, afi
, safi
, name_str
);
5660 return bgp_vty_return (vty
, ret
);
5663 /* Unset route-map from the peer. */
5665 peer_unsuppress_map_unset_vty (struct vty
*vty
, const char *ip_str
, afi_t afi
,
5671 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5673 return CMD_WARNING_CONFIG_FAILED
;
5675 ret
= peer_unsuppress_map_unset (peer
, afi
, safi
);
5677 return bgp_vty_return (vty
, ret
);
5680 DEFUN (neighbor_unsuppress_map
,
5681 neighbor_unsuppress_map_cmd
,
5682 "neighbor <A.B.C.D|X:X::X:X|WORD> unsuppress-map WORD",
5685 "Route-map to selectively unsuppress suppressed routes\n"
5686 "Name of route map\n")
5690 return peer_unsuppress_map_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5691 bgp_node_safi (vty
), argv
[idx_word
]->arg
);
5694 ALIAS_HIDDEN (neighbor_unsuppress_map
,
5695 neighbor_unsuppress_map_hidden_cmd
,
5696 "neighbor <A.B.C.D|X:X::X:X|WORD> unsuppress-map WORD",
5699 "Route-map to selectively unsuppress suppressed routes\n"
5700 "Name of route map\n")
5702 DEFUN (no_neighbor_unsuppress_map
,
5703 no_neighbor_unsuppress_map_cmd
,
5704 "no neighbor <A.B.C.D|X:X::X:X|WORD> unsuppress-map WORD",
5708 "Route-map to selectively unsuppress suppressed routes\n"
5709 "Name of route map\n")
5712 return peer_unsuppress_map_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5713 bgp_node_safi (vty
));
5716 ALIAS_HIDDEN (no_neighbor_unsuppress_map
,
5717 no_neighbor_unsuppress_map_hidden_cmd
,
5718 "no neighbor <A.B.C.D|X:X::X:X|WORD> unsuppress-map WORD",
5722 "Route-map to selectively unsuppress suppressed routes\n"
5723 "Name of route map\n")
5726 peer_maximum_prefix_set_vty (struct vty
*vty
, const char *ip_str
, afi_t afi
,
5727 safi_t safi
, const char *num_str
,
5728 const char *threshold_str
, int warning
,
5729 const char *restart_str
)
5737 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5739 return CMD_WARNING_CONFIG_FAILED
;
5741 max
= strtoul(num_str
, NULL
, 10);
5743 threshold
= atoi (threshold_str
);
5745 threshold
= MAXIMUM_PREFIX_THRESHOLD_DEFAULT
;
5748 restart
= atoi (restart_str
);
5752 ret
= peer_maximum_prefix_set (peer
, afi
, safi
, max
, threshold
, warning
, restart
);
5754 return bgp_vty_return (vty
, ret
);
5758 peer_maximum_prefix_unset_vty (struct vty
*vty
, const char *ip_str
, afi_t afi
,
5764 peer
= peer_and_group_lookup_vty (vty
, ip_str
);
5766 return CMD_WARNING_CONFIG_FAILED
;
5768 ret
= peer_maximum_prefix_unset (peer
, afi
, safi
);
5770 return bgp_vty_return (vty
, ret
);
5773 /* Maximum number of prefix configuration. prefix count is different
5774 for each peer configuration. So this configuration can be set for
5775 each peer configuration. */
5776 DEFUN (neighbor_maximum_prefix
,
5777 neighbor_maximum_prefix_cmd
,
5778 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295)",
5781 "Maximum number of prefix accept from this peer\n"
5782 "maximum no. of prefix limit\n")
5786 return peer_maximum_prefix_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5787 bgp_node_safi (vty
), argv
[idx_number
]->arg
, NULL
, 0,
5791 ALIAS_HIDDEN (neighbor_maximum_prefix
,
5792 neighbor_maximum_prefix_hidden_cmd
,
5793 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295)",
5796 "Maximum number of prefix accept from this peer\n"
5797 "maximum no. of prefix limit\n")
5799 DEFUN (neighbor_maximum_prefix_threshold
,
5800 neighbor_maximum_prefix_threshold_cmd
,
5801 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) (1-100)",
5804 "Maximum number of prefix accept from this peer\n"
5805 "maximum no. of prefix limit\n"
5806 "Threshold value (%) at which to generate a warning msg\n")
5810 int idx_number_2
= 4;
5811 return peer_maximum_prefix_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5812 bgp_node_safi (vty
), argv
[idx_number
]->arg
, argv
[idx_number_2
]->arg
, 0,
5816 ALIAS_HIDDEN (neighbor_maximum_prefix_threshold
,
5817 neighbor_maximum_prefix_threshold_hidden_cmd
,
5818 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) (1-100)",
5821 "Maximum number of prefix accept from this peer\n"
5822 "maximum no. of prefix limit\n"
5823 "Threshold value (%) at which to generate a warning msg\n")
5825 DEFUN (neighbor_maximum_prefix_warning
,
5826 neighbor_maximum_prefix_warning_cmd
,
5827 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) warning-only",
5830 "Maximum number of prefix accept from this peer\n"
5831 "maximum no. of prefix limit\n"
5832 "Only give warning message when limit is exceeded\n")
5836 return peer_maximum_prefix_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5837 bgp_node_safi (vty
), argv
[idx_number
]->arg
, NULL
, 1,
5841 ALIAS_HIDDEN (neighbor_maximum_prefix_warning
,
5842 neighbor_maximum_prefix_warning_hidden_cmd
,
5843 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) warning-only",
5846 "Maximum number of prefix accept from this peer\n"
5847 "maximum no. of prefix limit\n"
5848 "Only give warning message when limit is exceeded\n")
5850 DEFUN (neighbor_maximum_prefix_threshold_warning
,
5851 neighbor_maximum_prefix_threshold_warning_cmd
,
5852 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) (1-100) warning-only",
5855 "Maximum number of prefix accept from this peer\n"
5856 "maximum no. of prefix limit\n"
5857 "Threshold value (%) at which to generate a warning msg\n"
5858 "Only give warning message when limit is exceeded\n")
5862 int idx_number_2
= 4;
5863 return peer_maximum_prefix_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5864 bgp_node_safi (vty
), argv
[idx_number
]->arg
, argv
[idx_number_2
]->arg
, 1, NULL
);
5867 ALIAS_HIDDEN (neighbor_maximum_prefix_threshold_warning
,
5868 neighbor_maximum_prefix_threshold_warning_hidden_cmd
,
5869 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) (1-100) warning-only",
5872 "Maximum number of prefix accept from this peer\n"
5873 "maximum no. of prefix limit\n"
5874 "Threshold value (%) at which to generate a warning msg\n"
5875 "Only give warning message when limit is exceeded\n")
5877 DEFUN (neighbor_maximum_prefix_restart
,
5878 neighbor_maximum_prefix_restart_cmd
,
5879 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) restart (1-65535)",
5882 "Maximum number of prefix accept from this peer\n"
5883 "maximum no. of prefix limit\n"
5884 "Restart bgp connection after limit is exceeded\n"
5885 "Restart interval in minutes")
5889 int idx_number_2
= 5;
5890 return peer_maximum_prefix_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5891 bgp_node_safi (vty
), argv
[idx_number
]->arg
, NULL
, 0, argv
[idx_number_2
]->arg
);
5894 ALIAS_HIDDEN (neighbor_maximum_prefix_restart
,
5895 neighbor_maximum_prefix_restart_hidden_cmd
,
5896 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) restart (1-65535)",
5899 "Maximum number of prefix accept from this peer\n"
5900 "maximum no. of prefix limit\n"
5901 "Restart bgp connection after limit is exceeded\n"
5902 "Restart interval in minutes")
5904 DEFUN (neighbor_maximum_prefix_threshold_restart
,
5905 neighbor_maximum_prefix_threshold_restart_cmd
,
5906 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) (1-100) restart (1-65535)",
5909 "Maximum number of prefixes to accept from this peer\n"
5910 "maximum no. of prefix limit\n"
5911 "Threshold value (%) at which to generate a warning msg\n"
5912 "Restart bgp connection after limit is exceeded\n"
5913 "Restart interval in minutes\n")
5917 int idx_number_2
= 4;
5918 int idx_number_3
= 6;
5919 return peer_maximum_prefix_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5920 bgp_node_safi (vty
), argv
[idx_number
]->arg
, argv
[idx_number_2
]->arg
, 0, argv
[idx_number_3
]->arg
);
5923 ALIAS_HIDDEN (neighbor_maximum_prefix_threshold_restart
,
5924 neighbor_maximum_prefix_threshold_restart_hidden_cmd
,
5925 "neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix (1-4294967295) (1-100) restart (1-65535)",
5928 "Maximum number of prefixes to accept from this peer\n"
5929 "maximum no. of prefix limit\n"
5930 "Threshold value (%) at which to generate a warning msg\n"
5931 "Restart bgp connection after limit is exceeded\n"
5932 "Restart interval in minutes\n")
5934 DEFUN (no_neighbor_maximum_prefix
,
5935 no_neighbor_maximum_prefix_cmd
,
5936 "no neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix [(1-4294967295) [(1-100)] [restart (1-65535)] [warning-only]]",
5940 "Maximum number of prefixes to accept from this peer\n"
5941 "maximum no. of prefix limit\n"
5942 "Threshold value (%) at which to generate a warning msg\n"
5943 "Restart bgp connection after limit is exceeded\n"
5944 "Restart interval in minutes\n"
5945 "Only give warning message when limit is exceeded\n")
5948 return peer_maximum_prefix_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
5949 bgp_node_safi (vty
));
5952 ALIAS_HIDDEN (no_neighbor_maximum_prefix
,
5953 no_neighbor_maximum_prefix_hidden_cmd
,
5954 "no neighbor <A.B.C.D|X:X::X:X|WORD> maximum-prefix [(1-4294967295) [(1-100)] [restart (1-65535)] [warning-only]]",
5958 "Maximum number of prefixes to accept from this peer\n"
5959 "maximum no. of prefix limit\n"
5960 "Threshold value (%) at which to generate a warning msg\n"
5961 "Restart bgp connection after limit is exceeded\n"
5962 "Restart interval in minutes\n"
5963 "Only give warning message when limit is exceeded\n")
5966 /* "neighbor allowas-in" */
5967 DEFUN (neighbor_allowas_in
,
5968 neighbor_allowas_in_cmd
,
5969 "neighbor <A.B.C.D|X:X::X:X|WORD> allowas-in [<(1-10)|origin>]",
5972 "Accept as-path with my AS present in it\n"
5973 "Number of occurances of AS number\n"
5974 "Only accept my AS in the as-path if the route was originated in my AS\n")
5977 int idx_number_origin
= 3;
5983 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
5985 return CMD_WARNING_CONFIG_FAILED
;
5987 if (argc
<= idx_number_origin
)
5991 if (argv
[idx_number_origin
]->type
== WORD_TKN
)
5994 allow_num
= atoi (argv
[idx_number_origin
]->arg
);
5997 ret
= peer_allowas_in_set (peer
, bgp_node_afi (vty
), bgp_node_safi (vty
),
6000 return bgp_vty_return (vty
, ret
);
6003 ALIAS_HIDDEN (neighbor_allowas_in
,
6004 neighbor_allowas_in_hidden_cmd
,
6005 "neighbor <A.B.C.D|X:X::X:X|WORD> allowas-in [<(1-10)|origin>]",
6008 "Accept as-path with my AS present in it\n"
6009 "Number of occurances of AS number\n"
6010 "Only accept my AS in the as-path if the route was originated in my AS\n")
6012 DEFUN (no_neighbor_allowas_in
,
6013 no_neighbor_allowas_in_cmd
,
6014 "no neighbor <A.B.C.D|X:X::X:X|WORD> allowas-in [<(1-10)|origin>]",
6018 "allow local ASN appears in aspath attribute\n"
6019 "Number of occurances of AS number\n"
6020 "Only accept my AS in the as-path if the route was originated in my AS\n")
6026 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
6028 return CMD_WARNING_CONFIG_FAILED
;
6030 ret
= peer_allowas_in_unset (peer
, bgp_node_afi (vty
), bgp_node_safi (vty
));
6032 return bgp_vty_return (vty
, ret
);
6035 ALIAS_HIDDEN (no_neighbor_allowas_in
,
6036 no_neighbor_allowas_in_hidden_cmd
,
6037 "no neighbor <A.B.C.D|X:X::X:X|WORD> allowas-in [<(1-10)|origin>]",
6041 "allow local ASN appears in aspath attribute\n"
6042 "Number of occurances of AS number\n"
6043 "Only accept my AS in the as-path if the route was originated in my AS\n")
6045 DEFUN (neighbor_ttl_security
,
6046 neighbor_ttl_security_cmd
,
6047 "neighbor <A.B.C.D|X:X::X:X|WORD> ttl-security hops (1-254)",
6050 "BGP ttl-security parameters\n"
6051 "Specify the maximum number of hops to the BGP peer\n"
6052 "Number of hops to BGP peer\n")
6059 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
6061 return CMD_WARNING_CONFIG_FAILED
;
6063 gtsm_hops
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
6066 * If 'neighbor swpX', then this is for directly connected peers,
6067 * we should not accept a ttl-security hops value greater than 1.
6069 if (peer
->conf_if
&& (gtsm_hops
> 1)) {
6070 vty_out (vty
, "%s is directly connected peer, hops cannot exceed 1%s",
6071 argv
[idx_peer
]->arg
, VTYNL
);
6072 return CMD_WARNING_CONFIG_FAILED
;
6075 return bgp_vty_return (vty
, peer_ttl_security_hops_set (peer
, gtsm_hops
));
6078 DEFUN (no_neighbor_ttl_security
,
6079 no_neighbor_ttl_security_cmd
,
6080 "no neighbor <A.B.C.D|X:X::X:X|WORD> ttl-security hops (1-254)",
6084 "BGP ttl-security parameters\n"
6085 "Specify the maximum number of hops to the BGP peer\n"
6086 "Number of hops to BGP peer\n")
6091 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
6093 return CMD_WARNING_CONFIG_FAILED
;
6095 return bgp_vty_return (vty
, peer_ttl_security_hops_unset (peer
));
6098 DEFUN (neighbor_addpath_tx_all_paths
,
6099 neighbor_addpath_tx_all_paths_cmd
,
6100 "neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-all-paths",
6103 "Use addpath to advertise all paths to a neighbor\n")
6108 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
6110 return CMD_WARNING_CONFIG_FAILED
;
6112 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
6113 bgp_node_safi (vty
),
6114 PEER_FLAG_ADDPATH_TX_ALL_PATHS
);
6117 ALIAS_HIDDEN (neighbor_addpath_tx_all_paths
,
6118 neighbor_addpath_tx_all_paths_hidden_cmd
,
6119 "neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-all-paths",
6122 "Use addpath to advertise all paths to a neighbor\n")
6124 DEFUN (no_neighbor_addpath_tx_all_paths
,
6125 no_neighbor_addpath_tx_all_paths_cmd
,
6126 "no neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-all-paths",
6130 "Use addpath to advertise all paths to a neighbor\n")
6133 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
6134 bgp_node_safi (vty
),
6135 PEER_FLAG_ADDPATH_TX_ALL_PATHS
);
6138 ALIAS_HIDDEN (no_neighbor_addpath_tx_all_paths
,
6139 no_neighbor_addpath_tx_all_paths_hidden_cmd
,
6140 "no neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-all-paths",
6144 "Use addpath to advertise all paths to a neighbor\n")
6146 DEFUN (neighbor_addpath_tx_bestpath_per_as
,
6147 neighbor_addpath_tx_bestpath_per_as_cmd
,
6148 "neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-bestpath-per-AS",
6151 "Use addpath to advertise the bestpath per each neighboring AS\n")
6156 peer
= peer_and_group_lookup_vty (vty
, argv
[idx_peer
]->arg
);
6158 return CMD_WARNING_CONFIG_FAILED
;
6160 return peer_af_flag_set_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
6161 bgp_node_safi (vty
),
6162 PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS
);
6165 ALIAS_HIDDEN (neighbor_addpath_tx_bestpath_per_as
,
6166 neighbor_addpath_tx_bestpath_per_as_hidden_cmd
,
6167 "neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-bestpath-per-AS",
6170 "Use addpath to advertise the bestpath per each neighboring AS\n")
6172 DEFUN (no_neighbor_addpath_tx_bestpath_per_as
,
6173 no_neighbor_addpath_tx_bestpath_per_as_cmd
,
6174 "no neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-bestpath-per-AS",
6178 "Use addpath to advertise the bestpath per each neighboring AS\n")
6181 return peer_af_flag_unset_vty (vty
, argv
[idx_peer
]->arg
, bgp_node_afi (vty
),
6182 bgp_node_safi (vty
),
6183 PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS
);
6186 ALIAS_HIDDEN (no_neighbor_addpath_tx_bestpath_per_as
,
6187 no_neighbor_addpath_tx_bestpath_per_as_hidden_cmd
,
6188 "no neighbor <A.B.C.D|X:X::X:X|WORD> addpath-tx-bestpath-per-AS",
6192 "Use addpath to advertise the bestpath per each neighboring AS\n")
6194 DEFUN_NOSH (address_family_ipv4_safi
,
6195 address_family_ipv4_safi_cmd
,
6196 "address-family ipv4 [<unicast|multicast|vpn|labeled-unicast>]",
6197 "Enter Address Family command mode\n"
6199 BGP_SAFI_WITH_LABEL_HELP_STR
)
6204 safi_t safi
= bgp_vty_safi_from_str (argv
[2]->text
);
6205 vty
->node
= bgp_node_type(AFI_IP
, safi
);
6208 vty
->node
= BGP_IPV4_NODE
;
6213 DEFUN_NOSH (address_family_ipv6_safi
,
6214 address_family_ipv6_safi_cmd
,
6215 "address-family ipv6 [<unicast|multicast|vpn|labeled-unicast>]",
6216 "Enter Address Family command mode\n"
6218 BGP_SAFI_WITH_LABEL_HELP_STR
)
6222 safi_t safi
= bgp_vty_safi_from_str (argv
[2]->text
);
6223 vty
->node
= bgp_node_type(AFI_IP6
, safi
);
6226 vty
->node
= BGP_IPV6_NODE
;
6231 #ifdef KEEP_OLD_VPN_COMMANDS
6232 DEFUN_NOSH (address_family_vpnv4
,
6233 address_family_vpnv4_cmd
,
6234 "address-family vpnv4 [unicast]",
6235 "Enter Address Family command mode\n"
6237 "Address Family modifier\n")
6239 vty
->node
= BGP_VPNV4_NODE
;
6243 DEFUN_NOSH (address_family_vpnv6
,
6244 address_family_vpnv6_cmd
,
6245 "address-family vpnv6 [unicast]",
6246 "Enter Address Family command mode\n"
6248 "Address Family modifier\n")
6250 vty
->node
= BGP_VPNV6_NODE
;
6255 DEFUN_NOSH (address_family_evpn
,
6256 address_family_evpn_cmd
,
6257 "address-family l2vpn evpn",
6258 "Enter Address Family command mode\n"
6260 "Address Family modifier\n")
6262 vty
->node
= BGP_EVPN_NODE
;
6266 DEFUN_NOSH (exit_address_family
,
6267 exit_address_family_cmd
,
6268 "exit-address-family",
6269 "Exit from Address Family configuration mode\n")
6271 if (vty
->node
== BGP_IPV4_NODE
6272 || vty
->node
== BGP_IPV4M_NODE
6273 || vty
->node
== BGP_IPV4L_NODE
6274 || vty
->node
== BGP_VPNV4_NODE
6275 || vty
->node
== BGP_IPV6_NODE
6276 || vty
->node
== BGP_IPV6M_NODE
6277 || vty
->node
== BGP_IPV6L_NODE
6278 || vty
->node
== BGP_VPNV6_NODE
6279 || vty
->node
== BGP_EVPN_NODE
)
6280 vty
->node
= BGP_NODE
;
6284 /* Recalculate bestpath and re-advertise a prefix */
6286 bgp_clear_prefix (struct vty
*vty
, const char *view_name
, const char *ip_str
,
6287 afi_t afi
, safi_t safi
, struct prefix_rd
*prd
)
6290 struct prefix match
;
6291 struct bgp_node
*rn
;
6292 struct bgp_node
*rm
;
6294 struct bgp_table
*table
;
6295 struct bgp_table
*rib
;
6297 /* BGP structure lookup. */
6300 bgp
= bgp_lookup_by_name (view_name
);
6303 vty_out (vty
, "%% Can't find BGP instance %s%s", view_name
, VTYNL
);
6309 bgp
= bgp_get_default ();
6312 vty_out (vty
, "%% No BGP process is configured%s", VTYNL
);
6317 /* Check IP address argument. */
6318 ret
= str2prefix (ip_str
, &match
);
6321 vty_out (vty
, "%% address is malformed%s", VTYNL
);
6325 match
.family
= afi2family (afi
);
6326 rib
= bgp
->rib
[afi
][safi
];
6328 if (safi
== SAFI_MPLS_VPN
)
6330 for (rn
= bgp_table_top (rib
); rn
; rn
= bgp_route_next (rn
))
6332 if (prd
&& memcmp (rn
->p
.u
.val
, prd
->val
, 8) != 0)
6335 if ((table
= rn
->info
) != NULL
)
6337 if ((rm
= bgp_node_match (table
, &match
)) != NULL
)
6339 if (rm
->p
.prefixlen
== match
.prefixlen
)
6341 SET_FLAG (rn
->flags
, BGP_NODE_USER_CLEAR
);
6342 bgp_process (bgp
, rm
, afi
, safi
);
6344 bgp_unlock_node (rm
);
6351 if ((rn
= bgp_node_match (rib
, &match
)) != NULL
)
6353 if (rn
->p
.prefixlen
== match
.prefixlen
)
6355 SET_FLAG (rn
->flags
, BGP_NODE_USER_CLEAR
);
6356 bgp_process (bgp
, rn
, afi
, safi
);
6358 bgp_unlock_node (rn
);
6365 /* one clear bgp command to rule them all */
6366 DEFUN (clear_ip_bgp_all
,
6367 clear_ip_bgp_all_cmd
,
6368 "clear [ip] bgp [<view|vrf> VIEWVRFNAME] ["BGP_AFI_CMD_STR
" ["BGP_SAFI_WITH_LABEL_CMD_STR
"]] <*|A.B.C.D|X:X::X:X|WORD|(1-4294967295)|external|peer-group WORD> [<soft [<in|out>]|in [prefix-filter]|out>]",
6372 BGP_INSTANCE_HELP_STR
6374 "BGP neighbor address to clear\n"
6375 "BGP IPv6 neighbor to clear\n"
6376 "BGP neighbor on interface to clear\n"
6377 "Clear peers with the AS number\n"
6378 "Clear all external peers\n"
6379 "Clear all members of peer-group\n"
6380 "BGP peer-group name\n"
6382 BGP_SAFI_WITH_LABEL_HELP_STR
6387 "Push out prefix-list ORF and do inbound soft reconfig\n"
6392 afi_t afi
= AFI_IP6
;
6393 safi_t safi
= SAFI_UNICAST
;
6394 enum clear_sort clr_sort
= clear_peer
;
6395 enum bgp_clear_type clr_type
;
6396 char *clr_arg
= NULL
;
6400 /* clear [ip] bgp */
6401 if (argv_find (argv
, argc
, "ip", &idx
))
6404 /* [<view|vrf> VIEWVRFNAME] */
6405 if (argv_find (argv
, argc
, "view", &idx
) || argv_find (argv
, argc
, "vrf", &idx
))
6407 vrf
= argv
[idx
+ 1]->arg
;
6411 /* ["BGP_AFI_CMD_STR" ["BGP_SAFI_CMD_STR"]] */
6412 if (argv_find_and_parse_afi (argv
, argc
, &idx
, &afi
))
6413 argv_find_and_parse_safi (argv
, argc
, &idx
, &safi
);
6415 /* <*|A.B.C.D|X:X::X:X|WORD|(1-4294967295)|external|peer-group WORD> */
6416 if (argv_find (argv
, argc
, "*", &idx
))
6418 clr_sort
= clear_all
;
6420 else if (argv_find (argv
, argc
, "A.B.C.D", &idx
))
6422 clr_sort
= clear_peer
;
6423 clr_arg
= argv
[idx
]->arg
;
6425 else if (argv_find (argv
, argc
, "X:X::X:X", &idx
))
6427 clr_sort
= clear_peer
;
6428 clr_arg
= argv
[idx
]->arg
;
6430 else if (argv_find (argv
, argc
, "peer-group", &idx
))
6432 clr_sort
= clear_group
;
6434 clr_arg
= argv
[idx
]->arg
;
6436 else if (argv_find (argv
, argc
, "WORD", &idx
))
6438 clr_sort
= clear_peer
;
6439 clr_arg
= argv
[idx
]->arg
;
6441 else if (argv_find (argv
, argc
, "(1-4294967295)", &idx
))
6443 clr_sort
= clear_as
;
6444 clr_arg
= argv
[idx
]->arg
;
6446 else if (argv_find (argv
, argc
, "external", &idx
))
6448 clr_sort
= clear_external
;
6451 /* [<soft [<in|out>]|in [prefix-filter]|out>] */
6452 if (argv_find (argv
, argc
, "soft", &idx
))
6454 if (argv_find (argv
, argc
, "in", &idx
) || argv_find (argv
, argc
, "out", &idx
))
6455 clr_type
= strmatch (argv
[idx
]->text
, "in") ? BGP_CLEAR_SOFT_IN
: BGP_CLEAR_SOFT_OUT
;
6457 clr_type
= BGP_CLEAR_SOFT_BOTH
;
6459 else if (argv_find (argv
, argc
, "in", &idx
))
6461 clr_type
= argv_find (argv
, argc
, "prefix-filter", &idx
) ? BGP_CLEAR_SOFT_IN_ORF_PREFIX
: BGP_CLEAR_SOFT_IN
;
6463 else if (argv_find (argv
, argc
, "out", &idx
))
6465 clr_type
= BGP_CLEAR_SOFT_OUT
;
6468 clr_type
= BGP_CLEAR_SOFT_NONE
;
6470 return bgp_clear_vty (vty
, vrf
, afi
, safi
, clr_sort
, clr_type
, clr_arg
);
6473 DEFUN (clear_ip_bgp_prefix
,
6474 clear_ip_bgp_prefix_cmd
,
6475 "clear [ip] bgp [<view|vrf> VIEWVRFNAME] prefix A.B.C.D/M",
6479 BGP_INSTANCE_HELP_STR
6480 "Clear bestpath and re-advertise\n"
6484 char *prefix
= NULL
;
6488 /* [<view|vrf> VIEWVRFNAME] */
6489 if (argv_find (argv
, argc
, "WORD", &idx
))
6490 vrf
= argv
[idx
]->arg
;
6492 prefix
= argv
[argc
-1]->arg
;
6494 return bgp_clear_prefix (vty
, vrf
, prefix
, AFI_IP
, SAFI_UNICAST
, NULL
);
6497 DEFUN (clear_bgp_ipv6_safi_prefix
,
6498 clear_bgp_ipv6_safi_prefix_cmd
,
6499 "clear [ip] bgp ipv6 "BGP_SAFI_CMD_STR
" prefix X:X::X:X/M",
6505 "Clear bestpath and re-advertise\n"
6509 int idx_ipv6_prefixlen
= 5;
6510 return bgp_clear_prefix (vty
, NULL
, argv
[idx_ipv6_prefixlen
]->arg
, AFI_IP6
,
6511 bgp_vty_safi_from_str(argv
[idx_safi
]->text
), NULL
);
6514 DEFUN (clear_bgp_instance_ipv6_safi_prefix
,
6515 clear_bgp_instance_ipv6_safi_prefix_cmd
,
6516 "clear [ip] bgp <view|vrf> VIEWVRFNAME ipv6 "BGP_SAFI_CMD_STR
" prefix X:X::X:X/M",
6520 BGP_INSTANCE_HELP_STR
6523 "Clear bestpath and re-advertise\n"
6528 int idx_ipv6_prefixlen
= 7;
6529 return bgp_clear_prefix (vty
, argv
[idx_word
]->arg
, argv
[idx_ipv6_prefixlen
]->arg
, AFI_IP6
,
6530 bgp_vty_safi_from_str(argv
[idx_safi
]->text
), NULL
);
6533 DEFUN (show_bgp_views
,
6535 "show [ip] bgp views",
6539 "Show the defined BGP views\n")
6541 struct list
*inst
= bm
->bgp
;
6542 struct listnode
*node
;
6545 if (!bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE
))
6547 vty_out (vty
, "BGP Multiple Instance is not enabled%s", VTYNL
);
6551 vty_out (vty
, "Defined BGP views:%s", VTYNL
);
6552 for (ALL_LIST_ELEMENTS_RO(inst
, node
, bgp
))
6555 if (bgp
->inst_type
== BGP_INSTANCE_TYPE_VRF
)
6557 vty_out (vty
, "\t%s (AS%u)%s",
6558 bgp
->name
? bgp
->name
: "(null)",
6565 DEFUN (show_bgp_vrfs
,
6567 "show [ip] bgp vrfs [json]",
6574 struct list
*inst
= bm
->bgp
;
6575 struct listnode
*node
;
6577 u_char uj
= use_json(argc
, argv
);
6578 json_object
*json
= NULL
;
6579 json_object
*json_vrfs
= NULL
;
6581 static char header
[] = "Type Id RouterId #PeersCfg #PeersEstb Name";
6583 if (!bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE
))
6585 vty_out (vty
, "BGP Multiple Instance is not enabled%s", VTYNL
);
6591 json
= json_object_new_object();
6592 json_vrfs
= json_object_new_object();
6595 for (ALL_LIST_ELEMENTS_RO(inst
, node
, bgp
))
6597 const char *name
, *type
;
6599 struct listnode
*node
, *nnode
;
6600 int peers_cfg
, peers_estb
;
6601 json_object
*json_vrf
= NULL
;
6605 if (bgp
->inst_type
== BGP_INSTANCE_TYPE_VIEW
)
6609 if (!uj
&& count
== 1)
6610 vty_out (vty
, "%s%s", header
, VTYNL
);
6612 peers_cfg
= peers_estb
= 0;
6614 json_vrf
= json_object_new_object();
6617 for (ALL_LIST_ELEMENTS (bgp
->peer
, node
, nnode
, peer
))
6619 if (!CHECK_FLAG(peer
->flags
, PEER_FLAG_CONFIG_NODE
))
6622 if (peer
->status
== Established
)
6626 if (bgp
->inst_type
== BGP_INSTANCE_TYPE_DEFAULT
)
6637 vrf_id_ui
= (bgp
->vrf_id
== VRF_UNKNOWN
) ? -1 : bgp
->vrf_id
;
6640 json_object_string_add(json_vrf
, "type", type
);
6641 json_object_int_add(json_vrf
, "vrfId", vrf_id_ui
);
6642 json_object_string_add(json_vrf
, "routerId", inet_ntoa (bgp
->router_id
));
6643 json_object_int_add(json_vrf
, "numConfiguredPeers", peers_cfg
);
6644 json_object_int_add(json_vrf
, "numEstablishedPeers", peers_estb
);
6646 json_object_object_add(json_vrfs
, name
, json_vrf
);
6649 vty_out (vty
, "%4s %-5d %-16s %9u %10u %s%s",
6650 type
, vrf_id_ui
, inet_ntoa (bgp
->router_id
),
6651 peers_cfg
, peers_estb
, name
,
6657 json_object_object_add(json
, "vrfs", json_vrfs
);
6659 json_object_int_add(json
, "totalVrfs", count
);
6661 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTYNL
);
6662 json_object_free(json
);
6667 vty_out (vty
, "%sTotal number of VRFs (including default): %d%s",
6668 VTYNL
, count
, VTYNL
);
6674 DEFUN (show_bgp_memory
,
6675 show_bgp_memory_cmd
,
6676 "show [ip] bgp memory",
6680 "Global BGP memory statistics\n")
6682 char memstrbuf
[MTYPE_MEMSTR_LEN
];
6683 unsigned long count
;
6685 /* RIB related usage stats */
6686 count
= mtype_stats_alloc (MTYPE_BGP_NODE
);
6687 vty_out (vty
, "%ld RIB nodes, using %s of memory%s", count
,
6688 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6689 count
* sizeof (struct bgp_node
)),
6692 count
= mtype_stats_alloc (MTYPE_BGP_ROUTE
);
6693 vty_out (vty
, "%ld BGP routes, using %s of memory%s", count
,
6694 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6695 count
* sizeof (struct bgp_info
)),
6697 if ((count
= mtype_stats_alloc (MTYPE_BGP_ROUTE_EXTRA
)))
6698 vty_out (vty
, "%ld BGP route ancillaries, using %s of memory%s", count
,
6699 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6700 count
* sizeof (struct bgp_info_extra
)),
6703 if ((count
= mtype_stats_alloc (MTYPE_BGP_STATIC
)))
6704 vty_out (vty
, "%ld Static routes, using %s of memory%s", count
,
6705 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6706 count
* sizeof (struct bgp_static
)),
6709 if ((count
= mtype_stats_alloc (MTYPE_BGP_PACKET
)))
6710 vty_out (vty
, "%ld Packets, using %s of memory%s", count
,
6711 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6712 count
* sizeof (struct bpacket
)),
6716 if ((count
= mtype_stats_alloc (MTYPE_BGP_ADJ_IN
)))
6717 vty_out (vty
, "%ld Adj-In entries, using %s of memory%s", count
,
6718 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6719 count
* sizeof (struct bgp_adj_in
)),
6721 if ((count
= mtype_stats_alloc (MTYPE_BGP_ADJ_OUT
)))
6722 vty_out (vty
, "%ld Adj-Out entries, using %s of memory%s", count
,
6723 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6724 count
* sizeof (struct bgp_adj_out
)),
6727 if ((count
= mtype_stats_alloc (MTYPE_BGP_NEXTHOP_CACHE
)))
6728 vty_out (vty
, "%ld Nexthop cache entries, using %s of memory%s", count
,
6729 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6730 count
* sizeof (struct bgp_nexthop_cache
)),
6733 if ((count
= mtype_stats_alloc (MTYPE_BGP_DAMP_INFO
)))
6734 vty_out (vty
, "%ld Dampening entries, using %s of memory%s", count
,
6735 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6736 count
* sizeof (struct bgp_damp_info
)),
6740 count
= attr_count();
6741 vty_out (vty
, "%ld BGP attributes, using %s of memory%s", count
,
6742 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6743 count
* sizeof(struct attr
)),
6746 if ((count
= attr_unknown_count()))
6747 vty_out (vty
, "%ld unknown attributes%s", count
, VTYNL
);
6749 /* AS_PATH attributes */
6750 count
= aspath_count ();
6751 vty_out (vty
, "%ld BGP AS-PATH entries, using %s of memory%s", count
,
6752 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6753 count
* sizeof (struct aspath
)),
6756 count
= mtype_stats_alloc (MTYPE_AS_SEG
);
6757 vty_out (vty
, "%ld BGP AS-PATH segments, using %s of memory%s", count
,
6758 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6759 count
* sizeof (struct assegment
)),
6762 /* Other attributes */
6763 if ((count
= community_count ()))
6764 vty_out (vty
, "%ld BGP community entries, using %s of memory%s", count
,
6765 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6766 count
* sizeof (struct community
)),
6768 if ((count
= mtype_stats_alloc (MTYPE_ECOMMUNITY
)))
6769 vty_out (vty
, "%ld BGP community entries, using %s of memory%s", count
,
6770 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6771 count
* sizeof (struct ecommunity
)),
6773 if ((count
= mtype_stats_alloc (MTYPE_LCOMMUNITY
)))
6774 vty_out (vty
, "%ld BGP large-community entries, using %s of memory%s",
6776 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6777 count
* sizeof (struct lcommunity
)),
6780 if ((count
= mtype_stats_alloc (MTYPE_CLUSTER
)))
6781 vty_out (vty
, "%ld Cluster lists, using %s of memory%s", count
,
6782 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6783 count
* sizeof (struct cluster_list
)),
6786 /* Peer related usage */
6787 count
= mtype_stats_alloc (MTYPE_BGP_PEER
);
6788 vty_out (vty
, "%ld peers, using %s of memory%s", count
,
6789 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6790 count
* sizeof (struct peer
)),
6793 if ((count
= mtype_stats_alloc (MTYPE_PEER_GROUP
)))
6794 vty_out (vty
, "%ld peer groups, using %s of memory%s", count
,
6795 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6796 count
* sizeof (struct peer_group
)),
6800 if ((count
= mtype_stats_alloc (MTYPE_HASH
)))
6801 vty_out (vty
, "%ld hash tables, using %s of memory%s", count
,
6802 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6803 count
* sizeof (struct hash
)),
6805 if ((count
= mtype_stats_alloc (MTYPE_HASH_BACKET
)))
6806 vty_out (vty
, "%ld hash buckets, using %s of memory%s", count
,
6807 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6808 count
* sizeof (struct hash_backet
)),
6810 if ((count
= mtype_stats_alloc (MTYPE_BGP_REGEXP
)))
6811 vty_out (vty
, "%ld compiled regexes, using %s of memory%s", count
,
6812 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
6813 count
* sizeof (regex_t
)),
6818 /* Show BGP peer's summary information. */
6820 bgp_show_summary (struct vty
*vty
, struct bgp
*bgp
, int afi
, int safi
,
6821 u_char use_json
, json_object
*json
)
6824 struct listnode
*node
, *nnode
;
6825 unsigned int count
= 0, dn_count
= 0;
6826 char timebuf
[BGP_UPTIME_LEN
], dn_flag
[2];
6827 char neighbor_buf
[VTY_BUFSIZ
];
6828 int neighbor_col_default_width
= 16;
6830 int max_neighbor_width
= 0;
6832 json_object
*json_peer
= NULL
;
6833 json_object
*json_peers
= NULL
;
6835 /* labeled-unicast routes are installed in the unicast table so in order to
6836 * display the correct PfxRcd value we must look at SAFI_UNICAST
6838 if (safi
== SAFI_LABELED_UNICAST
)
6839 pfx_rcd_safi
= SAFI_UNICAST
;
6841 pfx_rcd_safi
= safi
;
6846 json
= json_object_new_object();
6848 json_peers
= json_object_new_object();
6852 /* Loop over all neighbors that will be displayed to determine how many
6853 * characters are needed for the Neighbor column
6855 for (ALL_LIST_ELEMENTS (bgp
->peer
, node
, nnode
, peer
))
6857 if (!CHECK_FLAG(peer
->flags
, PEER_FLAG_CONFIG_NODE
))
6860 if (peer
->afc
[afi
][safi
])
6862 memset(dn_flag
, '\0', sizeof(dn_flag
));
6863 if (peer_dynamic_neighbor(peer
))
6866 if (peer
->hostname
&& bgp_flag_check(bgp
, BGP_FLAG_SHOW_HOSTNAME
))
6867 sprintf(neighbor_buf
, "%s%s(%s) ", dn_flag
, peer
->hostname
, peer
->host
);
6869 sprintf(neighbor_buf
, "%s%s ", dn_flag
, peer
->host
);
6871 len
= strlen(neighbor_buf
);
6873 if (len
> max_neighbor_width
)
6874 max_neighbor_width
= len
;
6878 /* Originally we displayed the Neighbor column as 16
6879 * characters wide so make that the default
6881 if (max_neighbor_width
< neighbor_col_default_width
)
6882 max_neighbor_width
= neighbor_col_default_width
;
6885 for (ALL_LIST_ELEMENTS (bgp
->peer
, node
, nnode
, peer
))
6887 if (!CHECK_FLAG(peer
->flags
, PEER_FLAG_CONFIG_NODE
))
6890 if (peer
->afc
[afi
][safi
])
6895 char memstrbuf
[MTYPE_MEMSTR_LEN
];
6898 vrf_id_ui
= (bgp
->vrf_id
== VRF_UNKNOWN
) ? -1 : bgp
->vrf_id
;
6900 /* Usage summary and header */
6903 json_object_string_add(json
, "routerId", inet_ntoa (bgp
->router_id
));
6904 json_object_int_add(json
, "as", bgp
->as
);
6905 json_object_int_add(json
, "vrfId", vrf_id_ui
);
6906 json_object_string_add(json
, "vrfName",
6907 (bgp
->inst_type
== BGP_INSTANCE_TYPE_DEFAULT
)
6908 ? "Default" : bgp
->name
);
6913 "BGP router identifier %s, local AS number %u vrf-id %d",
6914 inet_ntoa (bgp
->router_id
), bgp
->as
, vrf_id_ui
);
6915 vty_out (vty
, "%s", VTYNL
);
6918 if (bgp_update_delay_configured(bgp
))
6922 json_object_int_add(json
, "updateDelayLimit", bgp
->v_update_delay
);
6924 if (bgp
->v_update_delay
!= bgp
->v_establish_wait
)
6925 json_object_int_add(json
, "updateDelayEstablishWait", bgp
->v_establish_wait
);
6927 if (bgp_update_delay_active(bgp
))
6929 json_object_string_add(json
, "updateDelayFirstNeighbor", bgp
->update_delay_begin_time
);
6930 json_object_boolean_true_add(json
, "updateDelayInProgress");
6934 if (bgp
->update_delay_over
)
6936 json_object_string_add(json
, "updateDelayFirstNeighbor",
6937 bgp
->update_delay_begin_time
);
6938 json_object_string_add(json
, "updateDelayBestpathResumed",
6939 bgp
->update_delay_end_time
);
6940 json_object_string_add(json
, "updateDelayZebraUpdateResume",
6941 bgp
->update_delay_zebra_resume_time
);
6942 json_object_string_add(json
, "updateDelayPeerUpdateResume",
6943 bgp
->update_delay_peers_resume_time
);
6949 vty_out (vty
, "Read-only mode update-delay limit: %d seconds%s",
6950 bgp
->v_update_delay
, VTYNL
);
6951 if (bgp
->v_update_delay
!= bgp
->v_establish_wait
)
6952 vty_out (vty
, " Establish wait: %d seconds%s",
6953 bgp
->v_establish_wait
, VTYNL
);
6955 if (bgp_update_delay_active(bgp
))
6957 vty_out (vty
, " First neighbor established: %s%s",
6958 bgp
->update_delay_begin_time
, VTYNL
);
6959 vty_out (vty
, " Delay in progress%s", VTYNL
);
6963 if (bgp
->update_delay_over
)
6965 vty_out (vty
, " First neighbor established: %s%s",
6966 bgp
->update_delay_begin_time
, VTYNL
);
6967 vty_out (vty
, " Best-paths resumed: %s%s",
6968 bgp
->update_delay_end_time
, VTYNL
);
6969 vty_out (vty
, " zebra update resumed: %s%s",
6970 bgp
->update_delay_zebra_resume_time
, VTYNL
);
6971 vty_out (vty
, " peers update resumed: %s%s",
6972 bgp
->update_delay_peers_resume_time
, VTYNL
);
6980 if (bgp_maxmed_onstartup_configured(bgp
) && bgp
->maxmed_active
)
6981 json_object_boolean_true_add(json
, "maxMedOnStartup");
6982 if (bgp
->v_maxmed_admin
)
6983 json_object_boolean_true_add(json
, "maxMedAdministrative");
6985 json_object_int_add(json
, "tableVersion", bgp_table_version(bgp
->rib
[afi
][safi
]));
6987 ents
= bgp_table_count (bgp
->rib
[afi
][safi
]);
6988 json_object_int_add(json
, "ribCount", ents
);
6989 json_object_int_add(json
, "ribMemory", ents
* sizeof (struct bgp_node
));
6991 ents
= listcount (bgp
->peer
);
6992 json_object_int_add(json
, "peerCount", ents
);
6993 json_object_int_add(json
, "peerMemory", ents
* sizeof (struct peer
));
6995 if ((ents
= listcount (bgp
->group
)))
6997 json_object_int_add(json
, "peerGroupCount", ents
);
6998 json_object_int_add(json
, "peerGroupMemory", ents
* sizeof (struct peer_group
));
7001 if (CHECK_FLAG (bgp
->af_flags
[afi
][safi
], BGP_CONFIG_DAMPENING
))
7002 json_object_boolean_true_add(json
, "dampeningEnabled");
7006 if (bgp_maxmed_onstartup_configured(bgp
) && bgp
->maxmed_active
)
7007 vty_out (vty
, "Max-med on-startup active%s", VTYNL
);
7008 if (bgp
->v_maxmed_admin
)
7009 vty_out (vty
, "Max-med administrative active%s", VTYNL
);
7011 vty_out(vty
, "BGP table version %" PRIu64
"%s",
7012 bgp_table_version(bgp
->rib
[afi
][safi
]), VTYNL
);
7014 ents
= bgp_table_count (bgp
->rib
[afi
][safi
]);
7015 vty_out (vty
, "RIB entries %ld, using %s of memory%s", ents
,
7016 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
7017 ents
* sizeof (struct bgp_node
)),
7020 /* Peer related usage */
7021 ents
= listcount (bgp
->peer
);
7022 vty_out (vty
, "Peers %ld, using %s of memory%s",
7024 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
7025 ents
* sizeof (struct peer
)),
7028 if ((ents
= listcount (bgp
->group
)))
7029 vty_out (vty
, "Peer groups %ld, using %s of memory%s", ents
,
7030 mtype_memstr (memstrbuf
, sizeof (memstrbuf
),
7031 ents
* sizeof (struct peer_group
)),
7034 if (CHECK_FLAG (bgp
->af_flags
[afi
][safi
], BGP_CONFIG_DAMPENING
))
7035 vty_out (vty
, "Dampening enabled.%s", VTYNL
);
7036 vty_out (vty
, "%s", VTYNL
);
7038 /* Subtract 8 here because 'Neighbor' is 8 characters */
7039 vty_out (vty
, "Neighbor");
7040 vty_out (vty
, "%*s", max_neighbor_width
- 8, " ");
7041 vty_out (vty
, "V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd%s", VTYNL
);
7049 json_peer
= json_object_new_object();
7051 if (peer_dynamic_neighbor(peer
))
7052 json_object_boolean_true_add(json_peer
, "dynamicPeer");
7055 json_object_string_add(json_peer
, "hostname", peer
->hostname
);
7057 if (peer
->domainname
)
7058 json_object_string_add(json_peer
, "domainname", peer
->domainname
);
7060 json_object_int_add(json_peer
, "remoteAs", peer
->as
);
7061 json_object_int_add(json_peer
, "version", 4);
7062 json_object_int_add(json_peer
, "msgRcvd",
7063 peer
->open_in
+ peer
->update_in
+ peer
->keepalive_in
7064 + peer
->notify_in
+ peer
->refresh_in
7065 + peer
->dynamic_cap_in
);
7066 json_object_int_add(json_peer
, "msgSent",
7067 peer
->open_out
+ peer
->update_out
+ peer
->keepalive_out
7068 + peer
->notify_out
+ peer
->refresh_out
7069 + peer
->dynamic_cap_out
);
7071 json_object_int_add(json_peer
, "tableVersion", peer
->version
[afi
][safi
]);
7072 json_object_int_add(json_peer
, "outq", peer
->obuf
->count
);
7073 json_object_int_add(json_peer
, "inq", 0);
7074 peer_uptime (peer
->uptime
, timebuf
, BGP_UPTIME_LEN
, use_json
, json_peer
);
7075 json_object_int_add(json_peer
, "prefixReceivedCount", peer
->pcount
[afi
][pfx_rcd_safi
]);
7077 if (CHECK_FLAG (peer
->flags
, PEER_FLAG_SHUTDOWN
))
7078 json_object_string_add(json_peer
, "state", "Idle (Admin)");
7079 else if (CHECK_FLAG (peer
->sflags
, PEER_STATUS_PREFIX_OVERFLOW
))
7080 json_object_string_add(json_peer
, "state", "Idle (PfxCt)");
7082 json_object_string_add(json_peer
, "state", lookup_msg(bgp_status_msg
, peer
->status
, NULL
));
7085 json_object_string_add(json_peer
, "idType", "interface");
7086 else if (peer
->su
.sa
.sa_family
== AF_INET
)
7087 json_object_string_add(json_peer
, "idType", "ipv4");
7088 else if (peer
->su
.sa
.sa_family
== AF_INET6
)
7089 json_object_string_add(json_peer
, "idType", "ipv6");
7091 json_object_object_add(json_peers
, peer
->host
, json_peer
);
7095 memset(dn_flag
, '\0', sizeof(dn_flag
));
7096 if (peer_dynamic_neighbor(peer
))
7102 if (peer
->hostname
&& bgp_flag_check(bgp
, BGP_FLAG_SHOW_HOSTNAME
))
7103 len
= vty_out (vty
, "%s%s(%s)", dn_flag
, peer
->hostname
,
7106 len
= vty_out (vty
, "%s%s", dn_flag
, peer
->host
);
7108 /* pad the neighbor column with spaces */
7109 if (len
< max_neighbor_width
)
7110 vty_out (vty
, "%*s", max_neighbor_width
- len
, " ");
7112 vty_out (vty
, "4 %10u %7d %7d %8" PRIu64
" %4d %4zd %8s",
7114 peer
->open_in
+ peer
->update_in
+ peer
->keepalive_in
7115 + peer
->notify_in
+ peer
->refresh_in
7116 + peer
->dynamic_cap_in
,
7117 peer
->open_out
+ peer
->update_out
+ peer
->keepalive_out
7118 + peer
->notify_out
+ peer
->refresh_out
7119 + peer
->dynamic_cap_out
,
7120 peer
->version
[afi
][safi
],
7123 peer_uptime (peer
->uptime
, timebuf
, BGP_UPTIME_LEN
, 0, NULL
));
7125 if (peer
->status
== Established
)
7126 vty_out (vty
, " %12ld", peer
->pcount
[afi
][pfx_rcd_safi
]);
7129 if (CHECK_FLAG (peer
->flags
, PEER_FLAG_SHUTDOWN
))
7130 vty_out (vty
, " Idle (Admin)");
7131 else if (CHECK_FLAG (peer
->sflags
, PEER_STATUS_PREFIX_OVERFLOW
))
7132 vty_out (vty
, " Idle (PfxCt)");
7134 vty_out (vty
, " %12s", lookup_msg(bgp_status_msg
, peer
->status
, NULL
));
7136 vty_out (vty
, "%s", VTYNL
);
7143 json_object_object_add(json
, "peers", json_peers
);
7145 json_object_int_add(json
, "totalPeers", count
);
7146 json_object_int_add(json
, "dynamicPeers", dn_count
);
7148 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTYNL
);
7149 json_object_free(json
);
7154 vty_out (vty
, "%sTotal number of neighbors %d%s", VTYNL
,
7159 vty_out(vty
, "{\"error\": {\"message\": \"No %s neighbor configured\"}}%s",
7160 afi_safi_print(afi
, safi
), VTYNL
);
7162 vty_out (vty
, "No %s neighbor is configured%s",
7163 afi_safi_print(afi
, safi
), VTYNL
);
7166 if (dn_count
&& ! use_json
)
7168 vty_out(vty
, "* - dynamic neighbor%s", VTYNL
);
7170 "%d dynamic neighbor(s), limit %d%s",
7171 dn_count
, bgp
->dynamic_neighbors_limit
, VTYNL
);
7179 * Return if we have a peer configured to use this afi/safi
7182 bgp_show_summary_afi_safi_peer_exists (struct bgp
*bgp
, int afi
, int safi
)
7184 struct listnode
*node
;
7187 for (ALL_LIST_ELEMENTS_RO (bgp
->peer
, node
, peer
))
7189 if (!CHECK_FLAG (peer
->flags
, PEER_FLAG_CONFIG_NODE
))
7192 if (peer
->afc
[afi
][safi
])
7200 bgp_show_summary_afi_safi (struct vty
*vty
, struct bgp
*bgp
, int afi
, int safi
,
7201 u_char use_json
, json_object
*json
)
7204 int afi_wildcard
= (afi
== AFI_MAX
);
7205 int safi_wildcard
= (safi
== SAFI_MAX
);
7206 int is_wildcard
= (afi_wildcard
|| safi_wildcard
);
7207 bool json_output
= false;
7209 if (use_json
&& is_wildcard
)
7210 vty_out (vty
, "{%s", VTYNL
);
7212 afi
= 1; /* AFI_IP */
7213 while (afi
< AFI_MAX
)
7216 safi
= 1; /* SAFI_UNICAST */
7217 while (safi
< SAFI_MAX
)
7219 if (bgp_show_summary_afi_safi_peer_exists (bgp
, afi
, safi
))
7225 * So limit output to those afi/safi pairs that
7226 * actualy have something interesting in them
7230 json
= json_object_new_object();
7233 vty_out (vty
, ",%s", VTYNL
);
7237 vty_out(vty
, "\"%s\":", afi_safi_json(afi
, safi
));
7241 vty_out (vty
, "%s%s Summary:%s",
7242 VTYNL
, afi_safi_print(afi
, safi
), VTYNL
);
7245 bgp_show_summary (vty
, bgp
, afi
, safi
, use_json
, json
);
7248 if (safi
== SAFI_RESERVED_4
||
7249 safi
== SAFI_RESERVED_5
) /* handle special cases to match zebra.h */
7251 if (! safi_wildcard
)
7255 if (! afi_wildcard
||
7256 afi
== AFI_L2VPN
) /* special case, not handled yet */
7260 if (use_json
&& is_wildcard
)
7261 vty_out (vty
, "}%s", VTYNL
);
7262 else if (use_json
&& !json_output
)
7263 vty_out (vty
, "{}%s", VTYNL
);
7267 bgp_show_all_instances_summary_vty (struct vty
*vty
, afi_t afi
, safi_t safi
,
7270 struct listnode
*node
, *nnode
;
7272 json_object
*json
= NULL
;
7276 vty_out (vty
, "{%s", VTYNL
);
7278 for (ALL_LIST_ELEMENTS (bm
->bgp
, node
, nnode
, bgp
))
7282 json
= json_object_new_object();
7285 vty_out (vty
, ",%s", VTYNL
);
7289 vty_out(vty
, "\"%s\":", (bgp
->inst_type
== BGP_INSTANCE_TYPE_DEFAULT
)
7290 ? "Default" : bgp
->name
);
7294 vty_out (vty
, "%sInstance %s:%s",
7296 (bgp
->inst_type
== BGP_INSTANCE_TYPE_DEFAULT
)
7297 ? "Default" : bgp
->name
, VTYNL
);
7299 bgp_show_summary_afi_safi (vty
, bgp
, afi
, safi
, use_json
, json
);
7303 vty_out (vty
, "}%s", VTYNL
);
7308 bgp_show_summary_vty (struct vty
*vty
, const char *name
,
7309 afi_t afi
, safi_t safi
, u_char use_json
)
7315 if (strmatch(name
, "all"))
7317 bgp_show_all_instances_summary_vty (vty
, afi
, safi
, use_json
);
7322 bgp
= bgp_lookup_by_name (name
);
7327 vty_out (vty
, "{}%s", VTYNL
);
7329 vty_out (vty
, "%% No such BGP instance exist%s", VTYNL
);
7333 bgp_show_summary_afi_safi (vty
, bgp
, afi
, safi
, use_json
, NULL
);
7338 bgp
= bgp_get_default ();
7341 bgp_show_summary_afi_safi (vty
, bgp
, afi
, safi
, use_json
, NULL
);
7346 /* `show [ip] bgp summary' commands. */
7347 DEFUN (show_ip_bgp_summary
,
7348 show_ip_bgp_summary_cmd
,
7349 "show [ip] bgp [<view|vrf> VIEWVRFNAME] ["BGP_AFI_CMD_STR
" ["BGP_SAFI_WITH_LABEL_CMD_STR
"]] summary [json]",
7353 BGP_INSTANCE_HELP_STR
7355 BGP_SAFI_WITH_LABEL_HELP_STR
7356 "Summary of BGP neighbor status\n"
7360 afi_t afi
= AFI_MAX
;
7361 safi_t safi
= SAFI_MAX
;
7366 if (argv_find (argv
, argc
, "ip", &idx
))
7368 /* [<view|vrf> VIEWVRFNAME] */
7369 if (argv_find (argv
, argc
, "view", &idx
) || argv_find (argv
, argc
, "vrf", &idx
))
7370 vrf
= argv
[++idx
]->arg
;
7371 /* ["BGP_AFI_CMD_STR" ["BGP_SAFI_CMD_STR"]] */
7372 if (argv_find_and_parse_afi (argv
, argc
, &idx
, &afi
))
7374 argv_find_and_parse_safi (argv
, argc
, &idx
, &safi
);
7377 int uj
= use_json (argc
, argv
);
7379 return bgp_show_summary_vty (vty
, vrf
, afi
, safi
, uj
);
7383 afi_safi_print (afi_t afi
, safi_t safi
)
7385 if (afi
== AFI_IP
&& safi
== SAFI_UNICAST
)
7386 return "IPv4 Unicast";
7387 else if (afi
== AFI_IP
&& safi
== SAFI_MULTICAST
)
7388 return "IPv4 Multicast";
7389 else if (afi
== AFI_IP
&& safi
== SAFI_LABELED_UNICAST
)
7390 return "IPv4 Labeled Unicast";
7391 else if (afi
== AFI_IP
&& safi
== SAFI_MPLS_VPN
)
7393 else if (afi
== AFI_IP
&& safi
== SAFI_ENCAP
)
7394 return "IPv4 Encap";
7395 else if (afi
== AFI_IP6
&& safi
== SAFI_UNICAST
)
7396 return "IPv6 Unicast";
7397 else if (afi
== AFI_IP6
&& safi
== SAFI_MULTICAST
)
7398 return "IPv6 Multicast";
7399 else if (afi
== AFI_IP6
&& safi
== SAFI_LABELED_UNICAST
)
7400 return "IPv6 Labeled Unicast";
7401 else if (afi
== AFI_IP6
&& safi
== SAFI_MPLS_VPN
)
7403 else if (afi
== AFI_IP6
&& safi
== SAFI_ENCAP
)
7404 return "IPv6 Encap";
7405 else if (afi
== AFI_L2VPN
&& safi
== SAFI_EVPN
)
7406 return "L2VPN EVPN";
7412 * Please note that we have intentionally camelCased
7413 * the return strings here. So if you want
7414 * to use this function, please ensure you
7415 * are doing this within json output
7418 afi_safi_json (afi_t afi
, safi_t safi
)
7420 if (afi
== AFI_IP
&& safi
== SAFI_UNICAST
)
7421 return "ipv4Unicast";
7422 else if (afi
== AFI_IP
&& safi
== SAFI_MULTICAST
)
7423 return "ipv4Multicast";
7424 else if (afi
== AFI_IP
&& safi
== SAFI_LABELED_UNICAST
)
7425 return "ipv4LabeledUnicast";
7426 else if (afi
== AFI_IP
&& safi
== SAFI_MPLS_VPN
)
7428 else if (afi
== AFI_IP
&& safi
== SAFI_ENCAP
)
7430 else if (afi
== AFI_IP6
&& safi
== SAFI_UNICAST
)
7431 return "ipv6Unicast";
7432 else if (afi
== AFI_IP6
&& safi
== SAFI_MULTICAST
)
7433 return "ipv6Multicast";
7434 else if (afi
== AFI_IP6
&& safi
== SAFI_LABELED_UNICAST
)
7435 return "ipv6LabeledUnicast";
7436 else if (afi
== AFI_IP6
&& safi
== SAFI_MPLS_VPN
)
7438 else if (afi
== AFI_IP6
&& safi
== SAFI_ENCAP
)
7440 else if (afi
== AFI_L2VPN
&& safi
== SAFI_EVPN
)
7446 /* Show BGP peer's information. */
7454 bgp_show_peer_afi_orf_cap (struct vty
*vty
, struct peer
*p
, afi_t afi
, safi_t safi
,
7455 u_int16_t adv_smcap
, u_int16_t adv_rmcap
, u_int16_t rcv_smcap
,
7456 u_int16_t rcv_rmcap
, u_char use_json
, json_object
*json_pref
)
7459 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], adv_smcap
)
7460 || CHECK_FLAG (p
->af_cap
[afi
][safi
], rcv_smcap
))
7464 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], adv_smcap
) && CHECK_FLAG (p
->af_cap
[afi
][safi
], rcv_smcap
))
7465 json_object_string_add(json_pref
, "sendMode", "advertisedAndReceived");
7466 else if (CHECK_FLAG (p
->af_cap
[afi
][safi
], adv_smcap
))
7467 json_object_string_add(json_pref
, "sendMode", "advertised");
7468 else if (CHECK_FLAG (p
->af_cap
[afi
][safi
], rcv_smcap
))
7469 json_object_string_add(json_pref
, "sendMode", "received");
7473 vty_out (vty
, " Send-mode: ");
7474 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], adv_smcap
))
7475 vty_out (vty
, "advertised");
7476 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], rcv_smcap
))
7477 vty_out (vty
, "%sreceived",
7478 CHECK_FLAG (p
->af_cap
[afi
][safi
], adv_smcap
) ?
7480 vty_out (vty
, "%s", VTYNL
);
7485 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], adv_rmcap
)
7486 || CHECK_FLAG (p
->af_cap
[afi
][safi
], rcv_rmcap
))
7490 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], adv_rmcap
) && CHECK_FLAG (p
->af_cap
[afi
][safi
], rcv_rmcap
))
7491 json_object_string_add(json_pref
, "recvMode", "advertisedAndReceived");
7492 else if (CHECK_FLAG (p
->af_cap
[afi
][safi
], adv_rmcap
))
7493 json_object_string_add(json_pref
, "recvMode", "advertised");
7494 else if (CHECK_FLAG (p
->af_cap
[afi
][safi
], rcv_rmcap
))
7495 json_object_string_add(json_pref
, "recvMode", "received");
7499 vty_out (vty
, " Receive-mode: ");
7500 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], adv_rmcap
))
7501 vty_out (vty
, "advertised");
7502 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], rcv_rmcap
))
7503 vty_out (vty
, "%sreceived",
7504 CHECK_FLAG (p
->af_cap
[afi
][safi
], adv_rmcap
) ?
7506 vty_out (vty
, "%s", VTYNL
);
7512 bgp_show_peer_afi (struct vty
*vty
, struct peer
*p
, afi_t afi
, safi_t safi
,
7513 u_char use_json
, json_object
*json_neigh
)
7515 struct bgp_filter
*filter
;
7516 struct peer_af
*paf
;
7517 char orf_pfx_name
[BUFSIZ
];
7519 json_object
*json_af
= NULL
;
7520 json_object
*json_prefA
= NULL
;
7521 json_object
*json_prefB
= NULL
;
7522 json_object
*json_addr
= NULL
;
7526 json_addr
= json_object_new_object();
7527 json_af
= json_object_new_object();
7528 filter
= &p
->filter
[afi
][safi
];
7530 if (peer_group_active(p
))
7531 json_object_string_add(json_addr
, "peerGroupMember", p
->group
->name
);
7533 paf
= peer_af_find(p
, afi
, safi
);
7534 if (paf
&& PAF_SUBGRP(paf
))
7536 json_object_int_add(json_addr
, "updateGroupId", PAF_UPDGRP(paf
)->id
);
7537 json_object_int_add(json_addr
, "subGroupId", PAF_SUBGRP(paf
)->id
);
7538 json_object_int_add(json_addr
, "packetQueueLength", bpacket_queue_virtual_length(paf
));
7541 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_ADV
)
7542 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_RCV
)
7543 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_ADV
)
7544 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_RCV
))
7546 json_object_int_add(json_af
, "orfType", ORF_TYPE_PREFIX
);
7547 json_prefA
= json_object_new_object();
7548 bgp_show_peer_afi_orf_cap (vty
, p
, afi
, safi
,
7549 PEER_CAP_ORF_PREFIX_SM_ADV
,
7550 PEER_CAP_ORF_PREFIX_RM_ADV
,
7551 PEER_CAP_ORF_PREFIX_SM_RCV
,
7552 PEER_CAP_ORF_PREFIX_RM_RCV
, use_json
, json_prefA
);
7553 json_object_object_add(json_af
, "orfPrefixList", json_prefA
);
7556 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_ADV
)
7557 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_OLD_RCV
)
7558 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_ADV
)
7559 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_OLD_RCV
))
7561 json_object_int_add(json_af
, "orfOldType", ORF_TYPE_PREFIX_OLD
);
7562 json_prefB
= json_object_new_object();
7563 bgp_show_peer_afi_orf_cap (vty
, p
, afi
, safi
,
7564 PEER_CAP_ORF_PREFIX_SM_ADV
,
7565 PEER_CAP_ORF_PREFIX_RM_ADV
,
7566 PEER_CAP_ORF_PREFIX_SM_OLD_RCV
,
7567 PEER_CAP_ORF_PREFIX_RM_OLD_RCV
, use_json
, json_prefB
);
7568 json_object_object_add(json_af
, "orfOldPrefixList", json_prefB
);
7571 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_ADV
)
7572 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_RCV
)
7573 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_OLD_RCV
)
7574 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_ADV
)
7575 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_RCV
)
7576 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_OLD_RCV
))
7577 json_object_object_add(json_addr
, "afDependentCap", json_af
);
7579 json_object_free(json_af
);
7581 sprintf (orf_pfx_name
, "%s.%d.%d", p
->host
, afi
, safi
);
7582 orf_pfx_count
= prefix_bgp_show_prefix_list (NULL
, afi
, orf_pfx_name
, use_json
);
7584 if (CHECK_FLAG (p
->af_sflags
[afi
][safi
], PEER_STATUS_ORF_PREFIX_SEND
)
7587 if (CHECK_FLAG (p
->af_sflags
[afi
][safi
], PEER_STATUS_ORF_PREFIX_SEND
))
7588 json_object_boolean_true_add(json_neigh
, "orfSent");
7590 json_object_int_add(json_addr
, "orfRecvCounter", orf_pfx_count
);
7592 if (CHECK_FLAG (p
->af_sflags
[afi
][safi
], PEER_STATUS_ORF_WAIT_REFRESH
))
7593 json_object_string_add(json_addr
, "orfFirstUpdate", "deferredUntilORFOrRouteRefreshRecvd");
7595 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_REFLECTOR_CLIENT
))
7596 json_object_boolean_true_add(json_addr
, "routeReflectorClient");
7597 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
7598 json_object_boolean_true_add(json_addr
, "routeServerClient");
7599 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SOFT_RECONFIG
))
7600 json_object_boolean_true_add(json_addr
, "inboundSoftConfigPermit");
7602 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE
))
7603 json_object_boolean_true_add(json_addr
, "privateAsNumsAllReplacedInUpdatesToNbr");
7604 else if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE
))
7605 json_object_boolean_true_add(json_addr
, "privateAsNumsReplacedInUpdatesToNbr");
7606 else if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_REMOVE_PRIVATE_AS_ALL
))
7607 json_object_boolean_true_add(json_addr
, "privateAsNumsAllRemovedInUpdatesToNbr");
7608 else if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_REMOVE_PRIVATE_AS
))
7609 json_object_boolean_true_add(json_addr
, "privateAsNumsRemovedInUpdatesToNbr");
7611 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_ADDPATH_TX_ALL_PATHS
))
7612 json_object_boolean_true_add(json_addr
, "addpathTxAllPaths");
7614 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS
))
7615 json_object_boolean_true_add(json_addr
, "addpathTxBestpathPerAS");
7617 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_AS_OVERRIDE
))
7618 json_object_string_add(json_addr
, "overrideASNsInOutboundUpdates", "ifAspathEqualRemoteAs");
7620 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_NEXTHOP_SELF
) ||
7621 CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_FORCE_NEXTHOP_SELF
))
7622 json_object_boolean_true_add(json_addr
, "routerAlwaysNextHop");
7623 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_AS_PATH_UNCHANGED
))
7624 json_object_boolean_true_add(json_addr
, "unchangedAsPathPropogatedToNbr");
7625 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_NEXTHOP_UNCHANGED
))
7626 json_object_boolean_true_add(json_addr
, "unchangedNextHopPropogatedToNbr");
7627 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_MED_UNCHANGED
))
7628 json_object_boolean_true_add(json_addr
, "unchangedMedPropogatedToNbr");
7629 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_COMMUNITY
)
7630 || CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_EXT_COMMUNITY
))
7632 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_COMMUNITY
)
7633 && CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_EXT_COMMUNITY
))
7634 json_object_string_add(json_addr
, "commAttriSentToNbr", "extendedAndStandard");
7635 else if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_EXT_COMMUNITY
))
7636 json_object_string_add(json_addr
, "commAttriSentToNbr", "extended");
7638 json_object_string_add(json_addr
, "commAttriSentToNbr", "standard");
7640 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_DEFAULT_ORIGINATE
))
7642 if (p
->default_rmap
[afi
][safi
].name
)
7643 json_object_string_add(json_addr
, "defaultRouteMap", p
->default_rmap
[afi
][safi
].name
);
7645 if (paf
&& PAF_SUBGRP(paf
) && CHECK_FLAG(PAF_SUBGRP(paf
)->sflags
, SUBGRP_STATUS_DEFAULT_ORIGINATE
))
7646 json_object_boolean_true_add(json_addr
, "defaultSent");
7648 json_object_boolean_true_add(json_addr
, "defaultNotSent");
7651 if (filter
->plist
[FILTER_IN
].name
7652 || filter
->dlist
[FILTER_IN
].name
7653 || filter
->aslist
[FILTER_IN
].name
7654 || filter
->map
[RMAP_IN
].name
)
7655 json_object_boolean_true_add(json_addr
, "inboundPathPolicyConfig");
7656 if (filter
->plist
[FILTER_OUT
].name
7657 || filter
->dlist
[FILTER_OUT
].name
7658 || filter
->aslist
[FILTER_OUT
].name
7659 || filter
->map
[RMAP_OUT
].name
7660 || filter
->usmap
.name
)
7661 json_object_boolean_true_add(json_addr
, "outboundPathPolicyConfig");
7664 if (filter
->plist
[FILTER_IN
].name
)
7665 json_object_string_add(json_addr
, "incomingUpdatePrefixFilterList", filter
->plist
[FILTER_IN
].name
);
7666 if (filter
->plist
[FILTER_OUT
].name
)
7667 json_object_string_add(json_addr
, "outgoingUpdatePrefixFilterList", filter
->plist
[FILTER_OUT
].name
);
7669 /* distribute-list */
7670 if (filter
->dlist
[FILTER_IN
].name
)
7671 json_object_string_add(json_addr
, "incomingUpdateNetworkFilterList", filter
->dlist
[FILTER_IN
].name
);
7672 if (filter
->dlist
[FILTER_OUT
].name
)
7673 json_object_string_add(json_addr
, "outgoingUpdateNetworkFilterList", filter
->dlist
[FILTER_OUT
].name
);
7676 if (filter
->aslist
[FILTER_IN
].name
)
7677 json_object_string_add(json_addr
, "incomingUpdateAsPathFilterList", filter
->aslist
[FILTER_IN
].name
);
7678 if (filter
->aslist
[FILTER_OUT
].name
)
7679 json_object_string_add(json_addr
, "outgoingUpdateAsPathFilterList", filter
->aslist
[FILTER_OUT
].name
);
7682 if (filter
->map
[RMAP_IN
].name
)
7683 json_object_string_add(json_addr
, "routeMapForIncomingAdvertisements", filter
->map
[RMAP_IN
].name
);
7684 if (filter
->map
[RMAP_OUT
].name
)
7685 json_object_string_add(json_addr
, "routeMapForOutgoingAdvertisements", filter
->map
[RMAP_OUT
].name
);
7687 /* unsuppress-map */
7688 if (filter
->usmap
.name
)
7689 json_object_string_add(json_addr
, "selectiveUnsuppressRouteMap", filter
->usmap
.name
);
7691 /* Receive prefix count */
7692 json_object_int_add(json_addr
, "acceptedPrefixCounter", p
->pcount
[afi
][safi
]);
7694 /* Maximum prefix */
7695 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_MAX_PREFIX
))
7697 json_object_int_add(json_addr
, "prefixAllowedMax", p
->pmax
[afi
][safi
]);
7698 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_MAX_PREFIX_WARNING
))
7699 json_object_boolean_true_add(json_addr
, "prefixAllowedMaxWarning");
7700 json_object_int_add(json_addr
, "prefixAllowedWarningThresh", p
->pmax_threshold
[afi
][safi
]);
7701 if (p
->pmax_restart
[afi
][safi
])
7702 json_object_int_add(json_addr
, "prefixAllowedRestartIntervalMsecs", p
->pmax_restart
[afi
][safi
] * 60000);
7704 json_object_object_add(json_neigh
, afi_safi_print (afi
, safi
), json_addr
);
7709 filter
= &p
->filter
[afi
][safi
];
7711 vty_out (vty
, " For address family: %s%s", afi_safi_print (afi
, safi
),
7714 if (peer_group_active(p
))
7715 vty_out (vty
, " %s peer-group member%s", p
->group
->name
, VTYNL
);
7717 paf
= peer_af_find(p
, afi
, safi
);
7718 if (paf
&& PAF_SUBGRP(paf
))
7720 vty_out (vty
, " Update group %" PRIu64
", subgroup %" PRIu64
"%s",
7721 PAF_UPDGRP(paf
)->id
, PAF_SUBGRP(paf
)->id
, VTYNL
);
7722 vty_out (vty
, " Packet Queue length %d%s",
7723 bpacket_queue_virtual_length(paf
), VTYNL
);
7727 vty_out(vty
, " Not part of any update group%s", VTYNL
);
7729 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_ADV
)
7730 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_RCV
)
7731 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_OLD_RCV
)
7732 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_ADV
)
7733 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_RCV
)
7734 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_OLD_RCV
))
7735 vty_out (vty
, " AF-dependant capabilities:%s", VTYNL
);
7737 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_ADV
)
7738 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_RCV
)
7739 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_ADV
)
7740 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_RCV
))
7742 vty_out (vty
, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
7743 ORF_TYPE_PREFIX
, VTYNL
);
7744 bgp_show_peer_afi_orf_cap (vty
, p
, afi
, safi
,
7745 PEER_CAP_ORF_PREFIX_SM_ADV
,
7746 PEER_CAP_ORF_PREFIX_RM_ADV
,
7747 PEER_CAP_ORF_PREFIX_SM_RCV
,
7748 PEER_CAP_ORF_PREFIX_RM_RCV
, use_json
, NULL
);
7750 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_ADV
)
7751 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_SM_OLD_RCV
)
7752 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_ADV
)
7753 || CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ORF_PREFIX_RM_OLD_RCV
))
7755 vty_out (vty
, " Outbound Route Filter (ORF) type (%d) Prefix-list:%s",
7756 ORF_TYPE_PREFIX_OLD
, VTYNL
);
7757 bgp_show_peer_afi_orf_cap (vty
, p
, afi
, safi
,
7758 PEER_CAP_ORF_PREFIX_SM_ADV
,
7759 PEER_CAP_ORF_PREFIX_RM_ADV
,
7760 PEER_CAP_ORF_PREFIX_SM_OLD_RCV
,
7761 PEER_CAP_ORF_PREFIX_RM_OLD_RCV
, use_json
, NULL
);
7764 sprintf (orf_pfx_name
, "%s.%d.%d", p
->host
, afi
, safi
);
7765 orf_pfx_count
= prefix_bgp_show_prefix_list (NULL
, afi
, orf_pfx_name
, use_json
);
7767 if (CHECK_FLAG (p
->af_sflags
[afi
][safi
], PEER_STATUS_ORF_PREFIX_SEND
)
7770 vty_out (vty
, " Outbound Route Filter (ORF):");
7771 if (CHECK_FLAG (p
->af_sflags
[afi
][safi
], PEER_STATUS_ORF_PREFIX_SEND
))
7772 vty_out (vty
, " sent;");
7774 vty_out (vty
, " received (%d entries)", orf_pfx_count
);
7775 vty_out (vty
, "%s", VTYNL
);
7777 if (CHECK_FLAG (p
->af_sflags
[afi
][safi
], PEER_STATUS_ORF_WAIT_REFRESH
))
7778 vty_out (vty
, " First update is deferred until ORF or ROUTE-REFRESH is received%s", VTYNL
);
7780 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_REFLECTOR_CLIENT
))
7781 vty_out (vty
, " Route-Reflector Client%s", VTYNL
);
7782 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_RSERVER_CLIENT
))
7783 vty_out (vty
, " Route-Server Client%s", VTYNL
);
7784 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SOFT_RECONFIG
))
7785 vty_out (vty
, " Inbound soft reconfiguration allowed%s", VTYNL
);
7787 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_REMOVE_PRIVATE_AS_ALL_REPLACE
))
7788 vty_out (vty
, " Private AS numbers (all) replaced in updates to this neighbor%s", VTYNL
);
7789 else if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_REMOVE_PRIVATE_AS_REPLACE
))
7790 vty_out (vty
, " Private AS numbers replaced in updates to this neighbor%s", VTYNL
);
7791 else if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_REMOVE_PRIVATE_AS_ALL
))
7792 vty_out (vty
, " Private AS numbers (all) removed in updates to this neighbor%s", VTYNL
);
7793 else if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_REMOVE_PRIVATE_AS
))
7794 vty_out (vty
, " Private AS numbers removed in updates to this neighbor%s", VTYNL
);
7796 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_ADDPATH_TX_ALL_PATHS
))
7797 vty_out (vty
, " Advertise all paths via addpath%s", VTYNL
);
7799 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_ADDPATH_TX_BESTPATH_PER_AS
))
7800 vty_out (vty
, " Advertise bestpath per AS via addpath%s", VTYNL
);
7802 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_AS_OVERRIDE
))
7803 vty_out (vty
, " Override ASNs in outbound updates if aspath equals remote-as%s", VTYNL
);
7805 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_NEXTHOP_SELF
) ||
7806 CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_FORCE_NEXTHOP_SELF
))
7807 vty_out (vty
, " NEXT_HOP is always this router%s", VTYNL
);
7808 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_AS_PATH_UNCHANGED
))
7809 vty_out (vty
, " AS_PATH is propagated unchanged to this neighbor%s", VTYNL
);
7810 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_NEXTHOP_UNCHANGED
))
7811 vty_out (vty
, " NEXT_HOP is propagated unchanged to this neighbor%s", VTYNL
);
7812 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_MED_UNCHANGED
))
7813 vty_out (vty
, " MED is propagated unchanged to this neighbor%s", VTYNL
);
7814 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_COMMUNITY
)
7815 || CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_EXT_COMMUNITY
)
7816 || CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_LARGE_COMMUNITY
))
7818 vty_out (vty
, " Community attribute sent to this neighbor");
7819 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_COMMUNITY
)
7820 && CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_EXT_COMMUNITY
)
7821 && CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_LARGE_COMMUNITY
))
7822 vty_out (vty
, "(all)%s", VTYNL
);
7823 else if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_LARGE_COMMUNITY
))
7824 vty_out (vty
, "(large)%s", VTYNL
);
7825 else if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_SEND_EXT_COMMUNITY
))
7826 vty_out (vty
, "(extended)%s", VTYNL
);
7828 vty_out (vty
, "(standard)%s", VTYNL
);
7830 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_DEFAULT_ORIGINATE
))
7832 vty_out (vty
, " Default information originate,");
7834 if (p
->default_rmap
[afi
][safi
].name
)
7835 vty_out (vty
, " default route-map %s%s,",
7836 p
->default_rmap
[afi
][safi
].map
? "*" : "",
7837 p
->default_rmap
[afi
][safi
].name
);
7838 if (paf
&& PAF_SUBGRP(paf
) && CHECK_FLAG(PAF_SUBGRP(paf
)->sflags
, SUBGRP_STATUS_DEFAULT_ORIGINATE
))
7839 vty_out (vty
, " default sent%s", VTYNL
);
7841 vty_out (vty
, " default not sent%s", VTYNL
);
7844 if (filter
->plist
[FILTER_IN
].name
7845 || filter
->dlist
[FILTER_IN
].name
7846 || filter
->aslist
[FILTER_IN
].name
7847 || filter
->map
[RMAP_IN
].name
)
7848 vty_out (vty
, " Inbound path policy configured%s", VTYNL
);
7849 if (filter
->plist
[FILTER_OUT
].name
7850 || filter
->dlist
[FILTER_OUT
].name
7851 || filter
->aslist
[FILTER_OUT
].name
7852 || filter
->map
[RMAP_OUT
].name
7853 || filter
->usmap
.name
)
7854 vty_out (vty
, " Outbound path policy configured%s", VTYNL
);
7857 if (filter
->plist
[FILTER_IN
].name
)
7858 vty_out (vty
, " Incoming update prefix filter list is %s%s%s",
7859 filter
->plist
[FILTER_IN
].plist
? "*" : "",
7860 filter
->plist
[FILTER_IN
].name
,
7862 if (filter
->plist
[FILTER_OUT
].name
)
7863 vty_out (vty
, " Outgoing update prefix filter list is %s%s%s",
7864 filter
->plist
[FILTER_OUT
].plist
? "*" : "",
7865 filter
->plist
[FILTER_OUT
].name
,
7868 /* distribute-list */
7869 if (filter
->dlist
[FILTER_IN
].name
)
7870 vty_out (vty
, " Incoming update network filter list is %s%s%s",
7871 filter
->dlist
[FILTER_IN
].alist
? "*" : "",
7872 filter
->dlist
[FILTER_IN
].name
,
7874 if (filter
->dlist
[FILTER_OUT
].name
)
7875 vty_out (vty
, " Outgoing update network filter list is %s%s%s",
7876 filter
->dlist
[FILTER_OUT
].alist
? "*" : "",
7877 filter
->dlist
[FILTER_OUT
].name
,
7881 if (filter
->aslist
[FILTER_IN
].name
)
7882 vty_out (vty
, " Incoming update AS path filter list is %s%s%s",
7883 filter
->aslist
[FILTER_IN
].aslist
? "*" : "",
7884 filter
->aslist
[FILTER_IN
].name
,
7886 if (filter
->aslist
[FILTER_OUT
].name
)
7887 vty_out (vty
, " Outgoing update AS path filter list is %s%s%s",
7888 filter
->aslist
[FILTER_OUT
].aslist
? "*" : "",
7889 filter
->aslist
[FILTER_OUT
].name
,
7893 if (filter
->map
[RMAP_IN
].name
)
7894 vty_out (vty
, " Route map for incoming advertisements is %s%s%s",
7895 filter
->map
[RMAP_IN
].map
? "*" : "",
7896 filter
->map
[RMAP_IN
].name
,
7898 if (filter
->map
[RMAP_OUT
].name
)
7899 vty_out (vty
, " Route map for outgoing advertisements is %s%s%s",
7900 filter
->map
[RMAP_OUT
].map
? "*" : "",
7901 filter
->map
[RMAP_OUT
].name
,
7904 /* unsuppress-map */
7905 if (filter
->usmap
.name
)
7906 vty_out (vty
, " Route map for selective unsuppress is %s%s%s",
7907 filter
->usmap
.map
? "*" : "",
7908 filter
->usmap
.name
, VTYNL
);
7910 /* Receive prefix count */
7911 vty_out (vty
, " %ld accepted prefixes%s", p
->pcount
[afi
][safi
], VTYNL
);
7913 /* Maximum prefix */
7914 if (CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_MAX_PREFIX
))
7916 vty_out (vty
, " Maximum prefixes allowed %ld%s%s", p
->pmax
[afi
][safi
],
7917 CHECK_FLAG (p
->af_flags
[afi
][safi
], PEER_FLAG_MAX_PREFIX_WARNING
)
7918 ? " (warning-only)" : "", VTYNL
);
7919 vty_out (vty
, " Threshold for warning message %d%%",
7920 p
->pmax_threshold
[afi
][safi
]);
7921 if (p
->pmax_restart
[afi
][safi
])
7922 vty_out (vty
, ", restart interval %d min", p
->pmax_restart
[afi
][safi
]);
7923 vty_out (vty
, "%s", VTYNL
);
7926 vty_out (vty
, "%s", VTYNL
);
7931 bgp_show_peer (struct vty
*vty
, struct peer
*p
, u_char use_json
, json_object
*json
)
7934 char buf1
[PREFIX2STR_BUFFER
], buf
[SU_ADDRSTRLEN
];
7935 char timebuf
[BGP_UPTIME_LEN
];
7937 const char *subcode_str
;
7938 const char *code_str
;
7943 json_object
*json_neigh
= NULL
;
7949 json_neigh
= json_object_new_object();
7951 memset (dn_flag
, '\0', sizeof (dn_flag
));
7952 if (!p
->conf_if
&& peer_dynamic_neighbor (p
))
7957 if (p
->conf_if
) /* Configured interface name. */
7958 vty_out (vty
, "BGP neighbor on %s: %s, ", p
->conf_if
,
7959 BGP_PEER_SU_UNSPEC(p
) ? "None" :
7960 sockunion2str (&p
->su
, buf
, SU_ADDRSTRLEN
));
7961 else /* Configured IP address. */
7962 vty_out (vty
, "BGP neighbor is %s%s, ", dn_flag
, p
->host
);
7967 if (p
->conf_if
&& BGP_PEER_SU_UNSPEC(p
))
7968 json_object_string_add(json_neigh
, "bgpNeighborAddr", "none");
7969 else if (p
->conf_if
&& !BGP_PEER_SU_UNSPEC(p
))
7970 json_object_string_add(json_neigh
, "bgpNeighborAddr", sockunion2str (&p
->su
, buf
, SU_ADDRSTRLEN
));
7972 json_object_int_add(json_neigh
, "remoteAs", p
->as
);
7974 if (p
->change_local_as
)
7975 json_object_int_add(json_neigh
, "localAs", p
->change_local_as
);
7977 json_object_int_add(json_neigh
, "localAs", p
->local_as
);
7979 if (CHECK_FLAG (p
->flags
, PEER_FLAG_LOCAL_AS_NO_PREPEND
))
7980 json_object_boolean_true_add(json_neigh
, "localAsNoPrepend");
7982 if (CHECK_FLAG (p
->flags
, PEER_FLAG_LOCAL_AS_REPLACE_AS
))
7983 json_object_boolean_true_add(json_neigh
, "localAsReplaceAs");
7987 if ((p
->as_type
== AS_SPECIFIED
) ||
7988 (p
->as_type
== AS_EXTERNAL
) ||
7989 (p
->as_type
== AS_INTERNAL
))
7990 vty_out (vty
, "remote AS %u, ", p
->as
);
7992 vty_out (vty
, "remote AS Unspecified, ");
7993 vty_out (vty
, "local AS %u%s%s, ",
7994 p
->change_local_as
? p
->change_local_as
: p
->local_as
,
7995 CHECK_FLAG (p
->flags
, PEER_FLAG_LOCAL_AS_NO_PREPEND
) ?
7997 CHECK_FLAG (p
->flags
, PEER_FLAG_LOCAL_AS_REPLACE_AS
) ?
7998 " replace-as" : "");
8000 /* peer type internal, external, confed-internal or confed-external */
8001 if (p
->as
== p
->local_as
)
8005 if (CHECK_FLAG(bgp
->config
, BGP_CONFIG_CONFEDERATION
))
8006 json_object_boolean_true_add(json_neigh
, "nbrConfedInternalLink");
8008 json_object_boolean_true_add(json_neigh
, "nbrInternalLink");
8012 if (CHECK_FLAG(bgp
->config
, BGP_CONFIG_CONFEDERATION
))
8013 vty_out (vty
, "confed-internal link%s", VTYNL
);
8015 vty_out (vty
, "internal link%s", VTYNL
);
8022 if (CHECK_FLAG(bgp
->config
, BGP_CONFIG_CONFEDERATION
))
8023 json_object_boolean_true_add(json_neigh
, "nbrConfedExternalLink");
8025 json_object_boolean_true_add(json_neigh
, "nbrExternalLink");
8029 if (bgp_confederation_peers_check(bgp
, p
->as
))
8030 vty_out (vty
, "confed-external link%s", VTYNL
);
8032 vty_out (vty
, "external link%s", VTYNL
);
8040 json_object_string_add(json_neigh
, "nbrDesc", p
->desc
);
8042 vty_out (vty
, " Description: %s%s", p
->desc
, VTYNL
);
8050 json_object_string_add(json_neigh
, "hostname", p
->hostname
);
8053 json_object_string_add(json_neigh
, "domainname", p
->domainname
);
8057 if (p
->domainname
&& (p
->domainname
[0] != '\0'))
8058 vty_out(vty
, "Hostname: %s.%s%s", p
->hostname
, p
->domainname
,
8061 vty_out(vty
, "Hostname: %s%s", p
->hostname
, VTYNL
);
8071 json_object_string_add(json_neigh
, "peerGroup", p
->group
->name
);
8075 struct prefix prefix
, *range
= NULL
;
8077 sockunion2hostprefix(&(p
->su
), &prefix
);
8078 range
= peer_group_lookup_dynamic_neighbor_range (p
->group
, &prefix
);
8082 prefix2str(range
, buf1
, sizeof(buf1
));
8083 json_object_string_add(json_neigh
, "peerSubnetRangeGroup", buf1
);
8089 vty_out (vty
, " Member of peer-group %s for session parameters%s",
8090 p
->group
->name
, VTYNL
);
8094 struct prefix prefix
, *range
= NULL
;
8096 sockunion2hostprefix(&(p
->su
), &prefix
);
8097 range
= peer_group_lookup_dynamic_neighbor_range (p
->group
, &prefix
);
8101 prefix2str(range
, buf1
, sizeof(buf1
));
8102 vty_out (vty
, " Belongs to the subnet range group: %s%s", buf1
, VTYNL
);
8110 /* Administrative shutdown. */
8111 if (CHECK_FLAG (p
->flags
, PEER_FLAG_SHUTDOWN
))
8112 json_object_boolean_true_add(json_neigh
, "adminShutDown");
8115 json_object_int_add(json_neigh
, "bgpVersion", 4);
8116 json_object_string_add(json_neigh
, "remoteRouterId",
8117 inet_ntop (AF_INET
, &p
->remote_id
, buf1
, sizeof(buf1
)));
8120 if (CHECK_FLAG (bgp
->config
, BGP_CONFIG_CONFEDERATION
) && bgp_confederation_peers_check (bgp
, p
->as
))
8121 json_object_boolean_true_add(json_neigh
, "nbrCommonAdmin");
8124 json_object_string_add(json_neigh
, "bgpState", lookup_msg(bgp_status_msg
, p
->status
, NULL
));
8126 if (p
->status
== Established
)
8131 uptime
= bgp_clock();
8132 uptime
-= p
->uptime
;
8133 tm
= gmtime(&uptime
);
8134 epoch_tbuf
= time(NULL
) - uptime
;
8136 json_object_int_add(json_neigh
, "bgpTimerUp", (tm
->tm_sec
* 1000) + (tm
->tm_min
* 60000) + (tm
->tm_hour
* 3600000));
8137 json_object_string_add(json_neigh
, "bgpTimerUpString", peer_uptime (p
->uptime
, timebuf
, BGP_UPTIME_LEN
, 0, NULL
));
8138 json_object_int_add(json_neigh
, "bgpTimerUpEstablishedEpoch", epoch_tbuf
);
8141 else if (p
->status
== Active
)
8143 if (CHECK_FLAG (p
->flags
, PEER_FLAG_PASSIVE
))
8144 json_object_string_add(json_neigh
, "bgpStateIs", "passive");
8145 else if (CHECK_FLAG (p
->sflags
, PEER_STATUS_NSF_WAIT
))
8146 json_object_string_add(json_neigh
, "bgpStateIs", "passiveNSF");
8153 uptime
= bgp_clock();
8154 uptime
-= p
->readtime
;
8155 tm
= gmtime(&uptime
);
8156 json_object_int_add(json_neigh
, "bgpTimerLastRead", (tm
->tm_sec
* 1000) + (tm
->tm_min
* 60000) + (tm
->tm_hour
* 3600000));
8158 uptime
= bgp_clock();
8159 uptime
-= p
->last_write
;
8160 tm
= gmtime(&uptime
);
8161 json_object_int_add(json_neigh
, "bgpTimerLastWrite", (tm
->tm_sec
* 1000) + (tm
->tm_min
* 60000) + (tm
->tm_hour
* 3600000));
8163 uptime
= bgp_clock();
8164 uptime
-= p
->update_time
;
8165 tm
= gmtime(&uptime
);
8166 json_object_int_add(json_neigh
, "bgpInUpdateElapsedTimeMsecs",
8167 (tm
->tm_sec
* 1000) + (tm
->tm_min
* 60000) + (tm
->tm_hour
* 3600000));
8169 /* Configured timer values. */
8170 json_object_int_add(json_neigh
, "bgpTimerHoldTimeMsecs", p
->v_holdtime
* 1000);
8171 json_object_int_add(json_neigh
, "bgpTimerKeepAliveIntervalMsecs", p
->v_keepalive
* 1000);
8173 if (CHECK_FLAG (p
->config
, PEER_CONFIG_TIMER
))
8175 json_object_int_add(json_neigh
, "bgpTimerConfiguredHoldTimeMsecs", p
->holdtime
* 1000);
8176 json_object_int_add(json_neigh
, "bgpTimerConfiguredKeepAliveIntervalMsecs", p
->keepalive
* 1000);
8181 /* Administrative shutdown. */
8182 if (CHECK_FLAG (p
->flags
, PEER_FLAG_SHUTDOWN
))
8183 vty_out (vty
, " Administratively shut down%s", VTYNL
);
8186 vty_out (vty
, " BGP version 4");
8187 vty_out (vty
, ", remote router ID %s%s",
8188 inet_ntop (AF_INET
, &p
->remote_id
, buf1
, sizeof(buf1
)),
8192 if (CHECK_FLAG (bgp
->config
, BGP_CONFIG_CONFEDERATION
)
8193 && bgp_confederation_peers_check (bgp
, p
->as
))
8194 vty_out (vty
, " Neighbor under common administration%s", VTYNL
);
8197 vty_out (vty
, " BGP state = %s", lookup_msg(bgp_status_msg
, p
->status
, NULL
));
8199 if (p
->status
== Established
)
8200 vty_out (vty
, ", up for %8s", peer_uptime (p
->uptime
, timebuf
, BGP_UPTIME_LEN
, 0, NULL
));
8202 else if (p
->status
== Active
)
8204 if (CHECK_FLAG (p
->flags
, PEER_FLAG_PASSIVE
))
8205 vty_out (vty
, " (passive)");
8206 else if (CHECK_FLAG (p
->sflags
, PEER_STATUS_NSF_WAIT
))
8207 vty_out (vty
, " (NSF passive)");
8209 vty_out (vty
, "%s", VTYNL
);
8212 vty_out (vty
, " Last read %s", peer_uptime (p
->readtime
, timebuf
, BGP_UPTIME_LEN
, 0, NULL
));
8213 vty_out (vty
, ", Last write %s%s",
8214 peer_uptime (p
->last_write
, timebuf
, BGP_UPTIME_LEN
, 0, NULL
), VTYNL
);
8216 /* Configured timer values. */
8217 vty_out (vty
, " Hold time is %d, keepalive interval is %d seconds%s",
8218 p
->v_holdtime
, p
->v_keepalive
, VTYNL
);
8219 if (CHECK_FLAG (p
->config
, PEER_CONFIG_TIMER
))
8221 vty_out (vty
, " Configured hold time is %d", p
->holdtime
);
8222 vty_out (vty
, ", keepalive interval is %d seconds%s",
8223 p
->keepalive
, VTYNL
);
8227 if (p
->status
== Established
)
8230 || p
->afc_adv
[AFI_IP
][SAFI_UNICAST
]
8231 || p
->afc_recv
[AFI_IP
][SAFI_UNICAST
]
8232 || p
->afc_adv
[AFI_IP
][SAFI_MULTICAST
]
8233 || p
->afc_recv
[AFI_IP
][SAFI_MULTICAST
]
8234 || p
->afc_adv
[AFI_IP6
][SAFI_UNICAST
]
8235 || p
->afc_recv
[AFI_IP6
][SAFI_UNICAST
]
8236 || p
->afc_adv
[AFI_IP6
][SAFI_MULTICAST
]
8237 || p
->afc_recv
[AFI_IP6
][SAFI_MULTICAST
]
8238 || p
->afc_adv
[AFI_IP6
][SAFI_MPLS_VPN
]
8239 || p
->afc_recv
[AFI_IP6
][SAFI_MPLS_VPN
]
8240 || p
->afc_adv
[AFI_IP6
][SAFI_ENCAP
]
8241 || p
->afc_recv
[AFI_IP6
][SAFI_ENCAP
]
8242 || p
->afc_adv
[AFI_IP
][SAFI_ENCAP
]
8243 || p
->afc_recv
[AFI_IP
][SAFI_ENCAP
]
8244 || p
->afc_adv
[AFI_IP
][SAFI_MPLS_VPN
]
8245 || p
->afc_recv
[AFI_IP
][SAFI_MPLS_VPN
])
8249 json_object
*json_cap
= NULL
;
8251 json_cap
= json_object_new_object();
8254 if (CHECK_FLAG (p
->cap
, PEER_CAP_AS4_RCV
)
8255 || CHECK_FLAG (p
->cap
, PEER_CAP_AS4_ADV
))
8257 if (CHECK_FLAG (p
->cap
, PEER_CAP_AS4_ADV
) && CHECK_FLAG (p
->cap
, PEER_CAP_AS4_RCV
))
8258 json_object_string_add(json_cap
, "4byteAs", "advertisedAndReceived");
8259 else if (CHECK_FLAG (p
->cap
, PEER_CAP_AS4_ADV
))
8260 json_object_string_add(json_cap
, "4byteAs", "advertised");
8261 else if (CHECK_FLAG (p
->cap
, PEER_CAP_AS4_RCV
))
8262 json_object_string_add(json_cap
, "4byteAs", "received");
8266 if (CHECK_FLAG (p
->cap
, PEER_CAP_ADDPATH_RCV
)
8267 || CHECK_FLAG (p
->cap
, PEER_CAP_ADDPATH_ADV
))
8269 json_object
*json_add
= NULL
;
8270 const char *print_store
;
8272 json_add
= json_object_new_object();
8274 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
8275 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8277 json_object
*json_sub
= NULL
;
8278 json_sub
= json_object_new_object();
8279 print_store
= afi_safi_print (afi
, safi
);
8281 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_ADV
) ||
8282 CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_RCV
))
8284 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
))
8285 json_object_boolean_true_add(json_sub
, "txAdvertisedAndReceived");
8286 else if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_ADV
))
8287 json_object_boolean_true_add(json_sub
, "txAdvertised");
8288 else if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_RCV
))
8289 json_object_boolean_true_add(json_sub
, "txReceived");
8292 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_ADV
) ||
8293 CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_RCV
))
8295 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
))
8296 json_object_boolean_true_add(json_sub
, "rxAdvertisedAndReceived");
8297 else if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_ADV
))
8298 json_object_boolean_true_add(json_sub
, "rxAdvertised");
8299 else if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_RCV
))
8300 json_object_boolean_true_add(json_sub
, "rxReceived");
8303 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_ADV
) ||
8304 CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_RCV
) ||
8305 CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_ADV
) ||
8306 CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_RCV
))
8307 json_object_object_add(json_add
, print_store
, json_sub
);
8309 json_object_free(json_sub
);
8312 json_object_object_add(json_cap
, "addPath", json_add
);
8316 if (CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_RCV
)
8317 || CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_ADV
))
8319 if (CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_ADV
) && CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_RCV
))
8320 json_object_string_add(json_cap
, "dynamic", "advertisedAndReceived");
8321 else if (CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_ADV
))
8322 json_object_string_add(json_cap
, "dynamic", "advertised");
8323 else if (CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_RCV
))
8324 json_object_string_add(json_cap
, "dynamic", "received");
8327 /* Extended nexthop */
8328 if (CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_RCV
)
8329 || CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_ADV
))
8331 json_object
*json_nxt
= NULL
;
8332 const char *print_store
;
8335 if (CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_ADV
) && CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_RCV
))
8336 json_object_string_add(json_cap
, "extendedNexthop", "advertisedAndReceived");
8337 else if (CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_ADV
))
8338 json_object_string_add(json_cap
, "extendedNexthop", "advertised");
8339 else if (CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_RCV
))
8340 json_object_string_add(json_cap
, "extendedNexthop", "received");
8342 if (CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_RCV
))
8344 json_nxt
= json_object_new_object();
8346 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8348 if (CHECK_FLAG (p
->af_cap
[AFI_IP
][safi
], PEER_CAP_ENHE_AF_RCV
))
8350 print_store
= afi_safi_print (AFI_IP
, safi
);
8351 json_object_string_add(json_nxt
, print_store
, "recieved");
8354 json_object_object_add(json_cap
, "extendedNexthopFamililesByPeer", json_nxt
);
8359 if (CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_ADV
)
8360 || CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_NEW_RCV
)
8361 || CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_OLD_RCV
))
8363 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
)))
8365 if (CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_OLD_RCV
) && CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_NEW_RCV
))
8366 json_object_string_add(json_cap
, "routeRefresh", "advertisedAndReceivedOldNew");
8369 if (CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_OLD_RCV
))
8370 json_object_string_add(json_cap
, "routeRefresh", "advertisedAndReceivedOld");
8372 json_object_string_add(json_cap
, "routeRefresh", "advertisedAndReceivedNew");
8375 else if (CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_ADV
))
8376 json_object_string_add(json_cap
, "routeRefresh", "advertised");
8377 else if (CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_NEW_RCV
) || CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_OLD_RCV
))
8378 json_object_string_add(json_cap
, "routeRefresh", "received");
8381 /* Multiprotocol Extensions */
8382 json_object
*json_multi
= NULL
;
8383 json_multi
= json_object_new_object();
8385 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
8387 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8389 if (p
->afc_adv
[afi
][safi
] || p
->afc_recv
[afi
][safi
])
8391 json_object
*json_exten
= NULL
;
8392 json_exten
= json_object_new_object();
8394 if (p
->afc_adv
[afi
][safi
] && p
->afc_recv
[afi
][safi
])
8395 json_object_boolean_true_add(json_exten
, "advertisedAndReceived");
8396 else if (p
->afc_adv
[afi
][safi
])
8397 json_object_boolean_true_add(json_exten
, "advertised");
8398 else if (p
->afc_recv
[afi
][safi
])
8399 json_object_boolean_true_add(json_exten
, "received");
8401 json_object_object_add(json_multi
, afi_safi_print (afi
, safi
), json_exten
);
8405 json_object_object_add(json_cap
, "multiprotocolExtensions", json_multi
);
8407 /* Gracefull Restart */
8408 if (CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_RCV
)
8409 || CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_ADV
))
8411 if (CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_ADV
) && CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_RCV
))
8412 json_object_string_add(json_cap
, "gracefulRestart", "advertisedAndReceived");
8413 else if (CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_ADV
))
8414 json_object_string_add(json_cap
, "gracefulRestartCapability", "advertised");
8415 else if (CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_RCV
))
8416 json_object_string_add(json_cap
, "gracefulRestartCapability", "received");
8418 if (CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_RCV
))
8420 int restart_af_count
= 0;
8421 json_object
*json_restart
= NULL
;
8422 json_restart
= json_object_new_object();
8424 json_object_int_add(json_cap
, "gracefulRestartRemoteTimerMsecs", p
->v_gr_restart
* 1000);
8426 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
8428 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8430 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_RESTART_AF_RCV
))
8432 json_object
*json_sub
= NULL
;
8433 json_sub
= json_object_new_object();
8435 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_RESTART_AF_PRESERVE_RCV
))
8436 json_object_boolean_true_add(json_sub
, "preserved");
8438 json_object_object_add(json_restart
, afi_safi_print (afi
, safi
), json_sub
);
8442 if (! restart_af_count
)
8444 json_object_string_add(json_cap
, "addressFamiliesByPeer", "none");
8445 json_object_free(json_restart
);
8448 json_object_object_add(json_cap
, "addressFamiliesByPeer", json_restart
);
8451 json_object_object_add(json_neigh
, "neighborCapabilities", json_cap
);
8455 vty_out (vty
, " Neighbor capabilities:%s", VTYNL
);
8458 if (CHECK_FLAG (p
->cap
, PEER_CAP_AS4_RCV
)
8459 || CHECK_FLAG (p
->cap
, PEER_CAP_AS4_ADV
))
8461 vty_out (vty
, " 4 Byte AS:");
8462 if (CHECK_FLAG (p
->cap
, PEER_CAP_AS4_ADV
))
8463 vty_out (vty
, " advertised");
8464 if (CHECK_FLAG (p
->cap
, PEER_CAP_AS4_RCV
))
8465 vty_out (vty
, " %sreceived",
8466 CHECK_FLAG (p
->cap
, PEER_CAP_AS4_ADV
) ? "and " : "");
8467 vty_out (vty
, "%s", VTYNL
);
8471 if (CHECK_FLAG (p
->cap
, PEER_CAP_ADDPATH_RCV
)
8472 || CHECK_FLAG (p
->cap
, PEER_CAP_ADDPATH_ADV
))
8474 vty_out (vty
, " AddPath:%s", VTYNL
);
8476 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
8477 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8479 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_ADV
) ||
8480 CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_RCV
))
8482 vty_out (vty
, " %s: TX ", afi_safi_print (afi
, safi
));
8484 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_ADV
))
8485 vty_out (vty
, "advertised %s", afi_safi_print (afi
, safi
));
8487 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_RCV
))
8488 vty_out (vty
, "%sreceived", CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_TX_ADV
) ? " and " : "" );
8490 vty_out (vty
, "%s", VTYNL
);
8493 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_ADV
) ||
8494 CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_RCV
))
8496 vty_out (vty
, " %s: RX ", afi_safi_print (afi
, safi
));
8498 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_ADV
))
8499 vty_out (vty
, "advertised %s", afi_safi_print (afi
, safi
));
8501 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_RCV
))
8502 vty_out (vty
, "%sreceived", CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_ADDPATH_AF_RX_ADV
) ? " and " : "" );
8504 vty_out (vty
, "%s", VTYNL
);
8510 if (CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_RCV
)
8511 || CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_ADV
))
8513 vty_out (vty
, " Dynamic:");
8514 if (CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_ADV
))
8515 vty_out (vty
, " advertised");
8516 if (CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_RCV
))
8517 vty_out (vty
, " %sreceived",
8518 CHECK_FLAG (p
->cap
, PEER_CAP_DYNAMIC_ADV
) ? "and " : "");
8519 vty_out (vty
, "%s", VTYNL
);
8522 /* Extended nexthop */
8523 if (CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_RCV
)
8524 || CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_ADV
))
8526 vty_out (vty
, " Extended nexthop:");
8527 if (CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_ADV
))
8528 vty_out (vty
, " advertised");
8529 if (CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_RCV
))
8530 vty_out (vty
, " %sreceived",
8531 CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_ADV
) ? "and " : "");
8532 vty_out (vty
, "%s", VTYNL
);
8534 if (CHECK_FLAG (p
->cap
, PEER_CAP_ENHE_RCV
))
8536 vty_out (vty
, " Address families by peer:%s ", VTYNL
);
8537 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8538 if (CHECK_FLAG (p
->af_cap
[AFI_IP
][safi
], PEER_CAP_ENHE_AF_RCV
))
8539 vty_out (vty
, " %s%s",
8540 afi_safi_print (AFI_IP
, safi
), VTYNL
);
8545 if (CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_ADV
)
8546 || CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_NEW_RCV
)
8547 || CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_OLD_RCV
))
8549 vty_out (vty
, " Route refresh:");
8550 if (CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_ADV
))
8551 vty_out (vty
, " advertised");
8552 if (CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_NEW_RCV
)
8553 || CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_OLD_RCV
))
8554 vty_out (vty
, " %sreceived(%s)",
8555 CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_ADV
) ? "and " : "",
8556 (CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_OLD_RCV
)
8557 && CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_NEW_RCV
)) ?
8558 "old & new" : CHECK_FLAG (p
->cap
, PEER_CAP_REFRESH_OLD_RCV
) ? "old" : "new");
8560 vty_out (vty
, "%s", VTYNL
);
8563 /* Multiprotocol Extensions */
8564 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
8565 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8566 if (p
->afc_adv
[afi
][safi
] || p
->afc_recv
[afi
][safi
])
8568 vty_out (vty
, " Address Family %s:", afi_safi_print (afi
, safi
));
8569 if (p
->afc_adv
[afi
][safi
])
8570 vty_out (vty
, " advertised");
8571 if (p
->afc_recv
[afi
][safi
])
8572 vty_out (vty
, " %sreceived", p
->afc_adv
[afi
][safi
] ? "and " : "");
8573 vty_out (vty
, "%s", VTYNL
);
8576 /* Hostname capability */
8577 if (CHECK_FLAG(p
->cap
, PEER_CAP_HOSTNAME_ADV
) ||
8578 CHECK_FLAG(p
->cap
, PEER_CAP_HOSTNAME_RCV
))
8580 vty_out (vty
, " Hostname Capability:");
8581 if (CHECK_FLAG (p
->cap
, PEER_CAP_HOSTNAME_ADV
))
8582 vty_out (vty
, " advertised");
8583 if (CHECK_FLAG (p
->cap
, PEER_CAP_HOSTNAME_RCV
))
8584 vty_out (vty
, " %sreceived",
8585 CHECK_FLAG (p
->cap
, PEER_CAP_HOSTNAME_ADV
) ? "and " : "");
8586 vty_out (vty
, "%s", VTYNL
);
8589 /* Gracefull Restart */
8590 if (CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_RCV
)
8591 || CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_ADV
))
8593 vty_out (vty
, " Graceful Restart Capabilty:");
8594 if (CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_ADV
))
8595 vty_out (vty
, " advertised");
8596 if (CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_RCV
))
8597 vty_out (vty
, " %sreceived",
8598 CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_ADV
) ? "and " : "");
8599 vty_out (vty
, "%s", VTYNL
);
8601 if (CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_RCV
))
8603 int restart_af_count
= 0;
8605 vty_out (vty
, " Remote Restart timer is %d seconds%s",
8606 p
->v_gr_restart
, VTYNL
);
8607 vty_out (vty
, " Address families by peer:%s ", VTYNL
);
8609 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
8610 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8611 if (CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_RESTART_AF_RCV
))
8613 vty_out (vty
, "%s%s(%s)", restart_af_count
? ", " : "",
8614 afi_safi_print (afi
, safi
),
8615 CHECK_FLAG (p
->af_cap
[afi
][safi
], PEER_CAP_RESTART_AF_PRESERVE_RCV
) ?
8616 "preserved" : "not preserved");
8619 if (! restart_af_count
)
8620 vty_out (vty
, "none");
8621 vty_out (vty
, "%s", VTYNL
);
8628 /* graceful restart information */
8629 if (CHECK_FLAG (p
->cap
, PEER_CAP_RESTART_RCV
)
8633 json_object
*json_grace
= NULL
;
8634 json_object
*json_grace_send
= NULL
;
8635 json_object
*json_grace_recv
= NULL
;
8636 int eor_send_af_count
= 0;
8637 int eor_receive_af_count
= 0;
8641 json_grace
= json_object_new_object();
8642 json_grace_send
= json_object_new_object();
8643 json_grace_recv
= json_object_new_object();
8645 if (p
->status
== Established
)
8647 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
8649 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8651 if (CHECK_FLAG (p
->af_sflags
[afi
][safi
], PEER_STATUS_EOR_SEND
))
8653 json_object_boolean_true_add(json_grace_send
, afi_safi_print (afi
, safi
));
8654 eor_send_af_count
++;
8658 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
8660 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8662 if (CHECK_FLAG (p
->af_sflags
[afi
][safi
], PEER_STATUS_EOR_RECEIVED
))
8664 json_object_boolean_true_add(json_grace_recv
, afi_safi_print (afi
, safi
));
8665 eor_receive_af_count
++;
8671 json_object_object_add(json_grace
, "endOfRibSend", json_grace_send
);
8672 json_object_object_add(json_grace
, "endOfRibRecv", json_grace_recv
);
8674 if (p
->t_gr_restart
)
8675 json_object_int_add(json_grace
, "gracefulRestartTimerMsecs", thread_timer_remain_second (p
->t_gr_restart
) * 1000);
8678 json_object_int_add(json_grace
, "gracefulStalepathTimerMsecs", thread_timer_remain_second (p
->t_gr_stale
) * 1000);
8680 json_object_object_add(json_neigh
, "gracefulRestartInfo", json_grace
);
8684 vty_out (vty
, " Graceful restart informations:%s", VTYNL
);
8685 if (p
->status
== Established
)
8687 vty_out (vty
, " End-of-RIB send: ");
8688 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
8690 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8692 if (CHECK_FLAG (p
->af_sflags
[afi
][safi
], PEER_STATUS_EOR_SEND
))
8694 vty_out (vty
, "%s%s", eor_send_af_count
? ", " : "",
8695 afi_safi_print (afi
, safi
));
8696 eor_send_af_count
++;
8700 vty_out (vty
, "%s", VTYNL
);
8701 vty_out (vty
, " End-of-RIB received: ");
8702 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
8704 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8706 if (CHECK_FLAG (p
->af_sflags
[afi
][safi
], PEER_STATUS_EOR_RECEIVED
))
8708 vty_out (vty
, "%s%s", eor_receive_af_count
? ", " : "",
8709 afi_safi_print (afi
, safi
));
8710 eor_receive_af_count
++;
8714 vty_out (vty
, "%s", VTYNL
);
8717 if (p
->t_gr_restart
)
8718 vty_out (vty
, " The remaining time of restart timer is %ld%s",
8719 thread_timer_remain_second (p
->t_gr_restart
), VTYNL
);
8722 vty_out (vty
, " The remaining time of stalepath timer is %ld%s",
8723 thread_timer_remain_second (p
->t_gr_stale
), VTYNL
);
8728 json_object
*json_stat
= NULL
;
8729 json_stat
= json_object_new_object();
8730 /* Packet counts. */
8731 json_object_int_add(json_stat
, "depthInq", 0);
8732 json_object_int_add(json_stat
, "depthOutq", (unsigned long) p
->obuf
->count
);
8733 json_object_int_add(json_stat
, "opensSent", p
->open_out
);
8734 json_object_int_add(json_stat
, "opensRecv", p
->open_in
);
8735 json_object_int_add(json_stat
, "notificationsSent", p
->notify_out
);
8736 json_object_int_add(json_stat
, "notificationsRecv", p
->notify_in
);
8737 json_object_int_add(json_stat
, "updatesSent", p
->update_out
);
8738 json_object_int_add(json_stat
, "updatesRecv", p
->update_in
);
8739 json_object_int_add(json_stat
, "keepalivesSent", p
->keepalive_out
);
8740 json_object_int_add(json_stat
, "keepalivesRecv", p
->keepalive_in
);
8741 json_object_int_add(json_stat
, "routeRefreshSent", p
->refresh_out
);
8742 json_object_int_add(json_stat
, "routeRefreshRecv", p
->refresh_in
);
8743 json_object_int_add(json_stat
, "capabilitySent", p
->dynamic_cap_out
);
8744 json_object_int_add(json_stat
, "capabilityRecv", p
->dynamic_cap_in
);
8745 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
);
8746 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
);
8747 json_object_object_add(json_neigh
, "messageStats", json_stat
);
8751 /* Packet counts. */
8752 vty_out (vty
, " Message statistics:%s", VTYNL
);
8753 vty_out (vty
, " Inq depth is 0%s", VTYNL
);
8754 vty_out (vty
, " Outq depth is %lu%s", (unsigned long) p
->obuf
->count
, VTYNL
);
8755 vty_out (vty
, " Sent Rcvd%s", VTYNL
);
8756 vty_out (vty
, " Opens: %10d %10d%s", p
->open_out
, p
->open_in
, VTYNL
);
8757 vty_out (vty
, " Notifications: %10d %10d%s", p
->notify_out
, p
->notify_in
, VTYNL
);
8758 vty_out (vty
, " Updates: %10d %10d%s", p
->update_out
, p
->update_in
, VTYNL
);
8759 vty_out (vty
, " Keepalives: %10d %10d%s", p
->keepalive_out
, p
->keepalive_in
, VTYNL
);
8760 vty_out (vty
, " Route Refresh: %10d %10d%s", p
->refresh_out
, p
->refresh_in
, VTYNL
);
8761 vty_out (vty
, " Capability: %10d %10d%s", p
->dynamic_cap_out
, p
->dynamic_cap_in
, VTYNL
);
8762 vty_out (vty
, " Total: %10d %10d%s", p
->open_out
+ p
->notify_out
+
8763 p
->update_out
+ p
->keepalive_out
+ p
->refresh_out
+ p
->dynamic_cap_out
,
8764 p
->open_in
+ p
->notify_in
+ p
->update_in
+ p
->keepalive_in
+ p
->refresh_in
+
8765 p
->dynamic_cap_in
, VTYNL
);
8770 /* advertisement-interval */
8771 json_object_int_add(json_neigh
, "minBtwnAdvertisementRunsTimerMsecs", p
->v_routeadv
* 1000);
8773 /* Update-source. */
8774 if (p
->update_if
|| p
->update_source
)
8777 json_object_string_add(json_neigh
, "updateSource", p
->update_if
);
8778 else if (p
->update_source
)
8779 json_object_string_add(json_neigh
, "updateSource", sockunion2str (p
->update_source
, buf1
, SU_ADDRSTRLEN
));
8784 /* advertisement-interval */
8785 vty_out (vty
, " Minimum time between advertisement runs is %d seconds%s",
8786 p
->v_routeadv
, VTYNL
);
8788 /* Update-source. */
8789 if (p
->update_if
|| p
->update_source
)
8791 vty_out (vty
, " Update source is ");
8793 vty_out (vty
, "%s", p
->update_if
);
8794 else if (p
->update_source
)
8795 vty_out (vty
, "%s", sockunion2str (p
->update_source
, buf1
, SU_ADDRSTRLEN
));
8796 vty_out (vty
, "%s", VTYNL
);
8799 vty_out (vty
, "%s", VTYNL
);
8802 /* Address Family Information */
8803 json_object
*json_hold
= NULL
;
8806 json_hold
= json_object_new_object();
8808 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
8809 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
8810 if (p
->afc
[afi
][safi
])
8811 bgp_show_peer_afi (vty
, p
, afi
, safi
, use_json
, json_hold
);
8815 json_object_object_add(json_neigh
, "addressFamilyInfo", json_hold
);
8816 json_object_int_add(json_neigh
, "connectionsEstablished", p
->established
);
8817 json_object_int_add(json_neigh
, "connectionsDropped", p
->dropped
);
8820 vty_out (vty
, " Connections established %d; dropped %d%s", p
->established
, p
->dropped
,
8823 if (! p
->last_reset
)
8826 json_object_string_add(json_neigh
, "lastReset", "never");
8828 vty_out (vty
, " Last reset never%s", VTYNL
);
8837 uptime
= bgp_clock();
8838 uptime
-= p
->resettime
;
8839 tm
= gmtime(&uptime
);
8840 json_object_int_add(json_neigh
, "lastResetTimerMsecs", (tm
->tm_sec
* 1000) + (tm
->tm_min
* 60000) + (tm
->tm_hour
* 3600000));
8841 json_object_string_add(json_neigh
, "lastResetDueTo", peer_down_str
[(int) p
->last_reset
]);
8842 if (p
->last_reset
== PEER_DOWN_NOTIFY_SEND
||
8843 p
->last_reset
== PEER_DOWN_NOTIFY_RECEIVED
)
8845 char errorcodesubcode_hexstr
[5];
8846 char errorcodesubcode_str
[256];
8848 code_str
= bgp_notify_code_str(p
->notify
.code
);
8849 subcode_str
= bgp_notify_subcode_str(p
->notify
.code
, p
->notify
.subcode
);
8851 sprintf(errorcodesubcode_hexstr
, "%02X%02X", p
->notify
.code
, p
->notify
.subcode
);
8852 json_object_string_add(json_neigh
, "lastErrorCodeSubcode", errorcodesubcode_hexstr
);
8853 snprintf(errorcodesubcode_str
, 255, "%s%s", code_str
, subcode_str
);
8854 json_object_string_add(json_neigh
, "lastNotificationReason", errorcodesubcode_str
);
8855 if (p
->last_reset
== PEER_DOWN_NOTIFY_RECEIVED
8856 && p
->notify
.code
== BGP_NOTIFY_CEASE
8857 && (p
->notify
.subcode
== BGP_NOTIFY_CEASE_ADMIN_SHUTDOWN
8858 || p
->notify
.subcode
== BGP_NOTIFY_CEASE_ADMIN_RESET
)
8859 && p
->notify
.length
)
8862 const char *msg_str
;
8864 msg_str
= bgp_notify_admin_message(msgbuf
, sizeof(msgbuf
),
8865 (u_char
*)p
->notify
.data
, p
->notify
.length
);
8867 json_object_string_add(json_neigh
, "lastShutdownDescription", msg_str
);
8873 vty_out (vty
, " Last reset %s, ",
8874 peer_uptime (p
->resettime
, timebuf
, BGP_UPTIME_LEN
, 0, NULL
));
8876 if (p
->last_reset
== PEER_DOWN_NOTIFY_SEND
||
8877 p
->last_reset
== PEER_DOWN_NOTIFY_RECEIVED
)
8879 code_str
= bgp_notify_code_str(p
->notify
.code
);
8880 subcode_str
= bgp_notify_subcode_str(p
->notify
.code
, p
->notify
.subcode
);
8881 vty_out (vty
, "due to NOTIFICATION %s (%s%s)%s",
8882 p
->last_reset
== PEER_DOWN_NOTIFY_SEND
? "sent" : "received",
8883 code_str
, subcode_str
, VTYNL
);
8884 if (p
->last_reset
== PEER_DOWN_NOTIFY_RECEIVED
8885 && p
->notify
.code
== BGP_NOTIFY_CEASE
8886 && (p
->notify
.subcode
== BGP_NOTIFY_CEASE_ADMIN_SHUTDOWN
8887 || p
->notify
.subcode
== BGP_NOTIFY_CEASE_ADMIN_RESET
)
8888 && p
->notify
.length
)
8891 const char *msg_str
;
8893 msg_str
= bgp_notify_admin_message(msgbuf
, sizeof(msgbuf
),
8894 (u_char
*)p
->notify
.data
, p
->notify
.length
);
8896 vty_out (vty
, " Message: \"%s\"%s", msg_str
, VTYNL
);
8901 vty_out (vty
, "due to %s%s",
8902 peer_down_str
[(int) p
->last_reset
], VTYNL
);
8905 if (p
->last_reset_cause_size
)
8907 msg
= p
->last_reset_cause
;
8908 vty_out(vty
, " Message received that caused BGP to send a NOTIFICATION:%s ", VTYNL
);
8909 for (i
= 1; i
<= p
->last_reset_cause_size
; i
++)
8911 vty_out(vty
, "%02X", *msg
++);
8913 if (i
!= p
->last_reset_cause_size
)
8917 vty_out(vty
, "%s ", VTYNL
);
8919 else if (i
% 4 == 0)
8925 vty_out(vty
, "%s", VTYNL
);
8930 if (CHECK_FLAG (p
->sflags
, PEER_STATUS_PREFIX_OVERFLOW
))
8933 json_object_boolean_true_add(json_neigh
, "prefixesConfigExceedMax");
8935 vty_out (vty
, " Peer had exceeded the max. no. of prefixes configured.%s", VTYNL
);
8937 if (p
->t_pmax_restart
)
8941 json_object_boolean_true_add(json_neigh
, "reducePrefixNumFrom");
8942 json_object_int_add(json_neigh
, "restartInTimerMsec", thread_timer_remain_second (p
->t_pmax_restart
) * 1000);
8945 vty_out (vty
, " Reduce the no. of prefix from %s, will restart in %ld seconds%s",
8946 p
->host
, thread_timer_remain_second (p
->t_pmax_restart
),
8952 json_object_boolean_true_add(json_neigh
, "reducePrefixNumAndClearIpBgp");
8954 vty_out (vty
, " Reduce the no. of prefix and clear ip bgp %s to restore peering%s",
8959 /* EBGP Multihop and GTSM */
8960 if (p
->sort
!= BGP_PEER_IBGP
)
8964 if (p
->gtsm_hops
> 0)
8965 json_object_int_add(json_neigh
, "externalBgpNbrMaxHopsAway", p
->gtsm_hops
);
8966 else if (p
->ttl
> 1)
8967 json_object_int_add(json_neigh
, "externalBgpNbrMaxHopsAway", p
->ttl
);
8971 if (p
->gtsm_hops
> 0)
8972 vty_out (vty
, " External BGP neighbor may be up to %d hops away.%s",
8973 p
->gtsm_hops
, VTYNL
);
8974 else if (p
->ttl
> 1)
8975 vty_out (vty
, " External BGP neighbor may be up to %d hops away.%s",
8981 if (p
->gtsm_hops
> 0)
8984 json_object_int_add(json_neigh
, "internalBgpNbrMaxHopsAway", p
->gtsm_hops
);
8986 vty_out (vty
, " Internal BGP neighbor may be up to %d hops away.%s",
8987 p
->gtsm_hops
, VTYNL
);
8991 /* Local address. */
8996 json_object_string_add(json_neigh
, "hostLocal", sockunion2str (p
->su_local
, buf1
, SU_ADDRSTRLEN
));
8997 json_object_int_add(json_neigh
, "portLocal", ntohs (p
->su_local
->sin
.sin_port
));
9000 vty_out (vty
, "Local host: %s, Local port: %d%s",
9001 sockunion2str (p
->su_local
, buf1
, SU_ADDRSTRLEN
),
9002 ntohs (p
->su_local
->sin
.sin_port
),
9006 /* Remote address. */
9011 json_object_string_add(json_neigh
, "hostForeign", sockunion2str (p
->su_remote
, buf1
, SU_ADDRSTRLEN
));
9012 json_object_int_add(json_neigh
, "portForeign", ntohs (p
->su_remote
->sin
.sin_port
));
9015 vty_out (vty
, "Foreign host: %s, Foreign port: %d%s",
9016 sockunion2str (p
->su_remote
, buf1
, SU_ADDRSTRLEN
),
9017 ntohs (p
->su_remote
->sin
.sin_port
),
9021 /* Nexthop display. */
9026 json_object_string_add(json_neigh
, "nexthop",
9027 inet_ntop (AF_INET
, &p
->nexthop
.v4
, buf1
, sizeof(buf1
)));
9028 json_object_string_add(json_neigh
, "nexthopGlobal",
9029 inet_ntop (AF_INET6
, &p
->nexthop
.v6_global
, buf1
, sizeof(buf1
)));
9030 json_object_string_add(json_neigh
, "nexthopLocal",
9031 inet_ntop (AF_INET6
, &p
->nexthop
.v6_local
, buf1
, sizeof(buf1
)));
9032 if (p
->shared_network
)
9033 json_object_string_add(json_neigh
, "bgpConnection", "sharedNetwork");
9035 json_object_string_add(json_neigh
, "bgpConnection", "nonSharedNetwork");
9039 vty_out (vty
, "Nexthop: %s%s",
9040 inet_ntop (AF_INET
, &p
->nexthop
.v4
, buf1
, sizeof(buf1
)),
9042 vty_out (vty
, "Nexthop global: %s%s",
9043 inet_ntop (AF_INET6
, &p
->nexthop
.v6_global
, buf1
, sizeof(buf1
)),
9045 vty_out (vty
, "Nexthop local: %s%s",
9046 inet_ntop (AF_INET6
, &p
->nexthop
.v6_local
, buf1
, sizeof(buf1
)),
9048 vty_out (vty
, "BGP connection: %s%s",
9049 p
->shared_network
? "shared network" : "non shared network",
9054 /* Timer information. */
9057 json_object_int_add(json_neigh
, "connectRetryTimer", p
->v_connect
);
9058 if (p
->status
== Established
&& p
->rtt
)
9059 json_object_int_add(json_neigh
, "estimatedRttInMsecs", p
->rtt
);
9061 json_object_int_add(json_neigh
, "nextStartTimerDueInMsecs", thread_timer_remain_second (p
->t_start
) * 1000);
9063 json_object_int_add(json_neigh
, "nextConnectTimerDueInMsecs", thread_timer_remain_second (p
->t_connect
) * 1000);
9066 json_object_int_add(json_neigh
, "mraiInterval", p
->v_routeadv
);
9067 json_object_int_add(json_neigh
, "mraiTimerExpireInMsecs", thread_timer_remain_second (p
->t_routeadv
) * 1000);
9070 json_object_int_add(json_neigh
, "authenticationEnabled", 1);
9073 json_object_string_add(json_neigh
, "readThread", "on");
9075 json_object_string_add(json_neigh
, "readThread", "off");
9077 json_object_string_add(json_neigh
, "writeThread", "on");
9079 json_object_string_add(json_neigh
, "writeThread", "off");
9083 vty_out (vty
, "BGP Connect Retry Timer in Seconds: %d%s",
9084 p
->v_connect
, VTYNL
);
9085 if (p
->status
== Established
&& p
->rtt
)
9086 vty_out (vty
, "Estimated round trip time: %d ms%s",
9089 vty_out (vty
, "Next start timer due in %ld seconds%s",
9090 thread_timer_remain_second (p
->t_start
), VTYNL
);
9092 vty_out (vty
, "Next connect timer due in %ld seconds%s",
9093 thread_timer_remain_second (p
->t_connect
), VTYNL
);
9095 vty_out (vty
, "MRAI (interval %u) timer expires in %ld seconds%s",
9096 p
->v_routeadv
, thread_timer_remain_second (p
->t_routeadv
),
9099 vty_out (vty
, "Peer Authentication Enabled%s", VTYNL
);
9101 vty_out (vty
, "Read thread: %s Write thread: %s%s",
9102 p
->t_read
? "on" : "off",
9103 p
->t_write
? "on" : "off",
9107 if (p
->notify
.code
== BGP_NOTIFY_OPEN_ERR
9108 && p
->notify
.subcode
== BGP_NOTIFY_OPEN_UNSUP_CAPBL
)
9109 bgp_capability_vty_out (vty
, p
, use_json
, json_neigh
);
9112 vty_out (vty
, "%s", VTYNL
);
9114 /* BFD information. */
9115 bgp_bfd_show_info(vty
, p
, use_json
, json_neigh
);
9119 if (p
->conf_if
) /* Configured interface name. */
9120 json_object_object_add(json
, p
->conf_if
, json_neigh
);
9121 else /* Configured IP address. */
9122 json_object_object_add(json
, p
->host
, json_neigh
);
9127 bgp_show_neighbor (struct vty
*vty
, struct bgp
*bgp
, enum show_type type
,
9128 union sockunion
*su
, const char *conf_if
, u_char use_json
, json_object
*json
)
9130 struct listnode
*node
, *nnode
;
9134 for (ALL_LIST_ELEMENTS (bgp
->peer
, node
, nnode
, peer
))
9136 if (!CHECK_FLAG(peer
->flags
, PEER_FLAG_CONFIG_NODE
))
9142 bgp_show_peer (vty
, peer
, use_json
, json
);
9147 if ((peer
->conf_if
&& !strcmp(peer
->conf_if
, conf_if
)) ||
9148 (peer
->hostname
&& !strcmp(peer
->hostname
, conf_if
)))
9151 bgp_show_peer (vty
, peer
, use_json
, json
);
9156 if (sockunion_same (&peer
->su
, su
))
9159 bgp_show_peer (vty
, peer
, use_json
, json
);
9166 if (type
== show_peer
&& ! find
)
9169 json_object_boolean_true_add(json
, "bgpNoSuchNeighbor");
9171 vty_out (vty
, "%% No such neighbor%s", VTYNL
);
9176 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTYNL
);
9177 json_object_free(json
);
9181 vty_out (vty
, "%s", VTYNL
);
9188 bgp_show_all_instances_neighbors_vty (struct vty
*vty
, u_char use_json
)
9190 struct listnode
*node
, *nnode
;
9192 json_object
*json
= NULL
;
9196 vty_out (vty
, "{%s", VTYNL
);
9198 for (ALL_LIST_ELEMENTS (bm
->bgp
, node
, nnode
, bgp
))
9202 if (!(json
= json_object_new_object()))
9204 zlog_err("Unable to allocate memory for JSON object");
9206 "{\"error\": {\"message:\": \"Unable to allocate memory for JSON object\"}}}%s",
9211 json_object_int_add(json
, "vrfId",
9212 (bgp
->vrf_id
== VRF_UNKNOWN
)
9213 ? -1 : bgp
->vrf_id
);
9214 json_object_string_add(json
, "vrfName",
9215 (bgp
->inst_type
== BGP_INSTANCE_TYPE_DEFAULT
)
9216 ? "Default" : bgp
->name
);
9219 vty_out (vty
, ",%s", VTYNL
);
9223 vty_out(vty
, "\"%s\":", (bgp
->inst_type
== BGP_INSTANCE_TYPE_DEFAULT
)
9224 ? "Default" : bgp
->name
);
9228 vty_out (vty
, "%sInstance %s:%s",
9230 (bgp
->inst_type
== BGP_INSTANCE_TYPE_DEFAULT
)
9231 ? "Default" : bgp
->name
,
9234 bgp_show_neighbor (vty
, bgp
, show_all
, NULL
, NULL
, use_json
, json
);
9238 vty_out (vty
, "}%s", VTYNL
);
9242 bgp_show_neighbor_vty (struct vty
*vty
, const char *name
,
9243 enum show_type type
, const char *ip_str
, u_char use_json
)
9248 json_object
*json
= NULL
;
9252 if (strmatch(name
, "all"))
9254 bgp_show_all_instances_neighbors_vty (vty
, use_json
);
9259 bgp
= bgp_lookup_by_name (name
);
9264 json
= json_object_new_object();
9265 json_object_boolean_true_add(json
, "bgpNoSuchInstance");
9266 vty_out (vty
, "%s%s", json_object_to_json_string_ext(json
, JSON_C_TO_STRING_PRETTY
), VTYNL
);
9267 json_object_free(json
);
9270 vty_out (vty
, "%% No such BGP instance exist%s", VTYNL
);
9278 bgp
= bgp_get_default ();
9283 json
= json_object_new_object();
9286 ret
= str2sockunion (ip_str
, &su
);
9288 bgp_show_neighbor (vty
, bgp
, type
, NULL
, ip_str
, use_json
, json
);
9290 bgp_show_neighbor (vty
, bgp
, type
, &su
, NULL
, use_json
, json
);
9294 bgp_show_neighbor (vty
, bgp
, type
, NULL
, NULL
, use_json
, json
);
9296 json_object_free (json
);
9302 /* "show [ip] bgp neighbors" commands. */
9303 DEFUN (show_ip_bgp_neighbors
,
9304 show_ip_bgp_neighbors_cmd
,
9305 "show [ip] bgp [<view|vrf> VIEWVRFNAME] [<ipv4|ipv6|vpnv4 <all|rd ASN:nn_or_IP-address:nn>>] neighbors [<A.B.C.D|X:X::X:X|WORD>] [json]",
9309 BGP_INSTANCE_HELP_STR
9313 "Display information about all VPNv4 NLRIs\n"
9314 "Display information for a route distinguisher\n"
9315 "VPN Route Distinguisher\n"
9316 "Detailed information on TCP and BGP neighbor connections\n"
9317 "Neighbor to display information about\n"
9318 "Neighbor to display information about\n"
9319 "Neighbor on BGP configured interface\n"
9323 char *sh_arg
= NULL
;
9324 enum show_type sh_type
;
9326 u_char uj
= use_json(argc
, argv
);
9330 if (argv_find (argv
, argc
, "view", &idx
) ||
9331 argv_find (argv
, argc
, "vrf", &idx
))
9332 vrf
= argv
[idx
+1]->arg
;
9335 if (argv_find (argv
, argc
, "A.B.C.D", &idx
) ||
9336 argv_find (argv
, argc
, "X:X::X:X", &idx
) ||
9337 argv_find (argv
, argc
, "WORD", &idx
))
9339 sh_type
= show_peer
;
9340 sh_arg
= argv
[idx
]->arg
;
9345 return bgp_show_neighbor_vty (vty
, vrf
, sh_type
, sh_arg
, uj
);
9348 /* Show BGP's AS paths internal data. There are both `show [ip] bgp
9349 paths' and `show ip mbgp paths'. Those functions results are the
9351 DEFUN (show_ip_bgp_paths
,
9352 show_ip_bgp_paths_cmd
,
9353 "show [ip] bgp ["BGP_SAFI_CMD_STR
"] paths",
9358 "Path information\n")
9360 vty_out (vty
, "Address Refcnt Path%s", VTYNL
);
9361 aspath_print_all_vty (vty
);
9368 community_show_all_iterator (struct hash_backet
*backet
, struct vty
*vty
)
9370 struct community
*com
;
9372 com
= (struct community
*) backet
->data
;
9373 vty_out (vty
, "[%p] (%ld) %s%s", (void *)backet
, com
->refcnt
,
9374 community_str (com
), VTYNL
);
9377 /* Show BGP's community internal data. */
9378 DEFUN (show_ip_bgp_community_info
,
9379 show_ip_bgp_community_info_cmd
,
9380 "show [ip] bgp community-info",
9384 "List all bgp community information\n")
9386 vty_out (vty
, "Address Refcnt Community%s", VTYNL
);
9388 hash_iterate (community_hash (),
9389 (void (*) (struct hash_backet
*, void *))
9390 community_show_all_iterator
,
9397 lcommunity_show_all_iterator (struct hash_backet
*backet
, struct vty
*vty
)
9399 struct lcommunity
*lcom
;
9401 lcom
= (struct lcommunity
*) backet
->data
;
9402 vty_out (vty
, "[%p] (%ld) %s%s", (void *)backet
, lcom
->refcnt
,
9403 lcommunity_str (lcom
), VTYNL
);
9406 /* Show BGP's community internal data. */
9407 DEFUN (show_ip_bgp_lcommunity_info
,
9408 show_ip_bgp_lcommunity_info_cmd
,
9409 "show ip bgp large-community-info",
9413 "List all bgp large-community information\n")
9415 vty_out (vty
, "Address Refcnt Large-community%s", VTYNL
);
9417 hash_iterate (lcommunity_hash (),
9418 (void (*) (struct hash_backet
*, void *))
9419 lcommunity_show_all_iterator
,
9426 DEFUN (show_ip_bgp_attr_info
,
9427 show_ip_bgp_attr_info_cmd
,
9428 "show [ip] bgp attribute-info",
9432 "List all bgp attribute information\n")
9434 attr_show_all (vty
);
9439 bgp_show_all_instances_updgrps_vty (struct vty
*vty
, afi_t afi
, safi_t safi
)
9441 struct listnode
*node
, *nnode
;
9444 for (ALL_LIST_ELEMENTS (bm
->bgp
, node
, nnode
, bgp
))
9446 vty_out (vty
, "%sInstance %s:%s",
9448 (bgp
->inst_type
== BGP_INSTANCE_TYPE_DEFAULT
) ? "Default" : bgp
->name
,
9450 update_group_show(bgp
, afi
, safi
, vty
, 0);
9455 bgp_show_update_groups(struct vty
*vty
, const char *name
,
9463 if (strmatch (name
, "all"))
9465 bgp_show_all_instances_updgrps_vty (vty
, afi
, safi
);
9470 bgp
= bgp_lookup_by_name (name
);
9475 bgp
= bgp_get_default ();
9479 update_group_show(bgp
, afi
, safi
, vty
, subgrp_id
);
9483 DEFUN (show_ip_bgp_updgrps
,
9484 show_ip_bgp_updgrps_cmd
,
9485 "show [ip] bgp [<view|vrf> VIEWVRFNAME] ["BGP_AFI_CMD_STR
" ["BGP_SAFI_WITH_LABEL_CMD_STR
"]] update-groups [SUBGROUP-ID]",
9489 BGP_INSTANCE_HELP_STR
9491 BGP_SAFI_WITH_LABEL_HELP_STR
9492 "Detailed info about dynamic update groups\n"
9493 "Specific subgroup to display detailed info for\n")
9496 afi_t afi
= AFI_IP6
;
9497 safi_t safi
= SAFI_UNICAST
;
9498 uint64_t subgrp_id
= 0;
9503 if (argv_find (argv
, argc
, "ip", &idx
))
9505 /* [<view|vrf> VIEWVRFNAME] */
9506 if (argv_find (argv
, argc
, "view", &idx
) || argv_find (argv
, argc
, "vrf", &idx
))
9507 vrf
= argv
[++idx
]->arg
;
9508 /* ["BGP_AFI_CMD_STR" ["BGP_SAFI_CMD_STR"]] */
9509 if (argv_find_and_parse_afi (argv
, argc
, &idx
, &afi
))
9511 argv_find_and_parse_safi (argv
, argc
, &idx
, &safi
);
9514 /* get subgroup id, if provided */
9516 if (argv
[idx
]->type
== VARIABLE_TKN
)
9517 subgrp_id
= strtoull(argv
[idx
]->arg
, NULL
, 10);
9519 return (bgp_show_update_groups(vty
, vrf
, afi
, safi
, subgrp_id
));
9522 DEFUN (show_bgp_instance_all_ipv6_updgrps
,
9523 show_bgp_instance_all_ipv6_updgrps_cmd
,
9524 "show [ip] bgp <view|vrf> all update-groups",
9528 BGP_INSTANCE_ALL_HELP_STR
9529 "Detailed info about dynamic update groups\n")
9531 bgp_show_all_instances_updgrps_vty (vty
, AFI_IP6
, SAFI_UNICAST
);
9535 DEFUN (show_bgp_updgrps_stats
,
9536 show_bgp_updgrps_stats_cmd
,
9537 "show [ip] bgp update-groups statistics",
9541 "Detailed info about dynamic update groups\n"
9546 bgp
= bgp_get_default();
9548 update_group_show_stats(bgp
, vty
);
9553 DEFUN (show_bgp_instance_updgrps_stats
,
9554 show_bgp_instance_updgrps_stats_cmd
,
9555 "show [ip] bgp <view|vrf> VIEWVRFNAME update-groups statistics",
9559 BGP_INSTANCE_HELP_STR
9560 "Detailed info about dynamic update groups\n"
9566 bgp
= bgp_lookup_by_name (argv
[idx_word
]->arg
);
9568 update_group_show_stats(bgp
, vty
);
9574 show_bgp_updgrps_adj_info_aux (struct vty
*vty
, const char *name
,
9575 afi_t afi
, safi_t safi
,
9576 const char *what
, uint64_t subgrp_id
)
9581 bgp
= bgp_lookup_by_name (name
);
9583 bgp
= bgp_get_default ();
9587 if (!strcmp(what
, "advertise-queue"))
9588 update_group_show_adj_queue(bgp
, afi
, safi
, vty
, subgrp_id
);
9589 else if (!strcmp(what
, "advertised-routes"))
9590 update_group_show_advertised(bgp
, afi
, safi
, vty
, subgrp_id
);
9591 else if (!strcmp(what
, "packet-queue"))
9592 update_group_show_packet_queue(bgp
, afi
, safi
, vty
, subgrp_id
);
9596 DEFUN (show_ip_bgp_updgrps_adj
,
9597 show_ip_bgp_updgrps_adj_cmd
,
9598 "show [ip] bgp update-groups <advertise-queue|advertised-routes|packet-queue>",
9602 "Detailed info about dynamic update groups\n"
9603 "Advertisement queue\n"
9604 "Announced routes\n"
9609 show_bgp_updgrps_adj_info_aux(vty
, NULL
, AFI_IP
, SAFI_UNICAST
, argv
[idx_type
]->arg
, 0);
9613 DEFUN (show_ip_bgp_instance_updgrps_adj
,
9614 show_ip_bgp_instance_updgrps_adj_cmd
,
9615 "show [ip] bgp <view|vrf> VIEWVRFNAME update-groups <advertise-queue|advertised-routes|packet-queue>",
9619 BGP_INSTANCE_HELP_STR
9620 "Detailed info about dynamic update groups\n"
9621 "Advertisement queue\n"
9622 "Announced routes\n"
9628 show_bgp_updgrps_adj_info_aux(vty
, argv
[idx_word
]->arg
, AFI_IP
, SAFI_UNICAST
, argv
[idx_type
]->arg
, 0);
9632 DEFUN (show_bgp_updgrps_afi_adj
,
9633 show_bgp_updgrps_afi_adj_cmd
,
9634 "show [ip] bgp "BGP_AFI_SAFI_CMD_STR
" update-groups <advertise-queue|advertised-routes|packet-queue>",
9638 BGP_AFI_SAFI_HELP_STR
9639 "Detailed info about dynamic update groups\n"
9640 "Advertisement queue\n"
9641 "Announced routes\n"
9647 show_bgp_updgrps_adj_info_aux(vty
, NULL
,
9648 bgp_vty_afi_from_str(argv
[idx_afi
]->text
),
9649 bgp_vty_safi_from_str(argv
[idx_safi
]->text
),
9650 argv
[idx_type
]->arg
, 0);
9654 DEFUN (show_bgp_updgrps_adj
,
9655 show_bgp_updgrps_adj_cmd
,
9656 "show [ip] bgp update-groups <advertise-queue|advertised-routes|packet-queue>",
9660 "Detailed info about dynamic update groups\n"
9661 "Advertisement queue\n"
9662 "Announced routes\n"
9666 show_bgp_updgrps_adj_info_aux(vty
, NULL
, AFI_IP6
, SAFI_UNICAST
, argv
[idx_type
]->arg
, 0);
9670 DEFUN (show_bgp_instance_updgrps_adj
,
9671 show_bgp_instance_updgrps_adj_cmd
,
9672 "show [ip] bgp <view|vrf> VIEWVRFNAME update-groups <advertise-queue|advertised-routes|packet-queue>",
9676 BGP_INSTANCE_HELP_STR
9677 "Detailed info about dynamic update groups\n"
9678 "Advertisement queue\n"
9679 "Announced routes\n"
9684 show_bgp_updgrps_adj_info_aux(vty
, argv
[idx_word
]->arg
, AFI_IP6
, SAFI_UNICAST
, argv
[idx_type
]->arg
, 0);
9688 DEFUN (show_ip_bgp_updgrps_adj_s
,
9689 show_ip_bgp_updgrps_adj_s_cmd
,
9690 "show [ip] bgp update-groups SUBGROUP-ID <advertise-queue|advertised-routes|packet-queue>",
9694 "Detailed info about dynamic update groups\n"
9695 "Specific subgroup to display info for\n"
9696 "Advertisement queue\n"
9697 "Announced routes\n"
9701 int idx_subgroup_id
= 4;
9705 subgrp_id
= strtoull(argv
[idx_subgroup_id
]->arg
, NULL
, 10);
9707 show_bgp_updgrps_adj_info_aux(vty
, NULL
, AFI_IP
, SAFI_UNICAST
, argv
[idx_type
]->arg
, subgrp_id
);
9711 DEFUN (show_ip_bgp_instance_updgrps_adj_s
,
9712 show_ip_bgp_instance_updgrps_adj_s_cmd
,
9713 "show [ip] bgp <view|vrf> VIEWVRFNAME update-groups SUBGROUP-ID <advertise-queue|advertised-routes|packet-queue>",
9717 BGP_INSTANCE_HELP_STR
9718 "Detailed info about dynamic update groups\n"
9719 "Specific subgroup to display info for\n"
9720 "Advertisement queue\n"
9721 "Announced routes\n"
9726 int idx_subgroup_id
= 6;
9730 subgrp_id
= strtoull(argv
[idx_subgroup_id
]->arg
, NULL
, 10);
9732 show_bgp_updgrps_adj_info_aux(vty
, argv
[idx_vrf
]->arg
, AFI_IP
, SAFI_UNICAST
, argv
[idx_type
]->arg
, subgrp_id
);
9736 DEFUN (show_bgp_updgrps_afi_adj_s
,
9737 show_bgp_updgrps_afi_adj_s_cmd
,
9738 "show [ip] bgp "BGP_AFI_SAFI_CMD_STR
" update-groups SUBGROUP-ID <advertise-queue|advertised-routes|packet-queue>",
9742 BGP_AFI_SAFI_HELP_STR
9743 "Detailed info about dynamic update groups\n"
9744 "Specific subgroup to display info for\n"
9745 "Advertisement queue\n"
9746 "Announced routes\n"
9751 int idx_subgroup_id
= 5;
9755 subgrp_id
= strtoull(argv
[idx_subgroup_id
]->arg
, NULL
, 10);
9757 show_bgp_updgrps_adj_info_aux(vty
, NULL
,
9758 bgp_vty_afi_from_str(argv
[idx_afi
]->text
),
9759 bgp_vty_safi_from_str(argv
[idx_safi
]->text
),
9760 argv
[idx_type
]->arg
, subgrp_id
);
9764 DEFUN (show_bgp_updgrps_adj_s
,
9765 show_bgp_updgrps_adj_s_cmd
,
9766 "show [ip] bgp update-groups SUBGROUP-ID <advertise-queue|advertised-routes|packet-queue>",
9770 "Detailed info about dynamic update groups\n"
9771 "Specific subgroup to display info for\n"
9772 "Advertisement queue\n"
9773 "Announced routes\n"
9776 int idx_subgroup_id
= 3;
9780 subgrp_id
= strtoull(argv
[idx_subgroup_id
]->arg
, NULL
, 10);
9782 show_bgp_updgrps_adj_info_aux(vty
, NULL
, AFI_IP6
, SAFI_UNICAST
, argv
[idx_type
]->arg
, subgrp_id
);
9786 DEFUN (show_bgp_instance_updgrps_adj_s
,
9787 show_bgp_instance_updgrps_adj_s_cmd
,
9788 "show [ip] bgp <view|vrf> VIEWVRFNAME update-groups SUBGROUP-ID <advertise-queue|advertised-routes|packet-queue>",
9792 BGP_INSTANCE_HELP_STR
9793 "Detailed info about dynamic update groups\n"
9794 "Specific subgroup to display info for\n"
9795 "Advertisement queue\n"
9796 "Announced routes\n"
9800 int idx_subgroup_id
= 5;
9804 subgrp_id
= strtoull(argv
[idx_subgroup_id
]->arg
, NULL
, 10);
9806 show_bgp_updgrps_adj_info_aux(vty
, argv
[idx_vrf
]->arg
, AFI_IP6
, SAFI_UNICAST
, argv
[idx_type
]->arg
, subgrp_id
);
9813 bgp_show_one_peer_group (struct vty
*vty
, struct peer_group
*group
)
9815 struct listnode
*node
, *nnode
;
9816 struct prefix
*range
;
9819 char buf
[PREFIX2STR_BUFFER
];
9822 const char *peer_status
;
9830 if (conf
->as_type
== AS_SPECIFIED
||
9831 conf
->as_type
== AS_EXTERNAL
) {
9832 vty_out (vty
, "%sBGP peer-group %s, remote AS %d%s",
9833 VTYNL
, group
->name
, conf
->as
, VTYNL
);
9834 } else if (conf
->as_type
== AS_INTERNAL
) {
9835 vty_out (vty
, "%sBGP peer-group %s, remote AS %d%s",
9836 VTYNL
, group
->name
, group
->bgp
->as
, VTYNL
);
9838 vty_out (vty
, "%sBGP peer-group %s%s",
9839 VTYNL
, group
->name
, VTYNL
);
9842 if ((group
->bgp
->as
== conf
->as
) || (conf
->as_type
== AS_INTERNAL
))
9843 vty_out (vty
, " Peer-group type is internal%s", VTYNL
);
9845 vty_out (vty
, " Peer-group type is external%s", VTYNL
);
9847 /* Display AFs configured. */
9848 vty_out (vty
, " Configured address-families:");
9849 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
9850 for (safi
= SAFI_UNICAST
; safi
< SAFI_MAX
; safi
++)
9852 if (conf
->afc
[afi
][safi
])
9855 vty_out (vty
, " %s;", afi_safi_print(afi
, safi
));
9859 vty_out (vty
, " none%s", VTYNL
);
9861 vty_out (vty
, "%s", VTYNL
);
9863 /* Display listen ranges (for dynamic neighbors), if any */
9864 for (afi
= AFI_IP
; afi
< AFI_MAX
; afi
++)
9868 else if (afi
== AFI_IP6
)
9872 lr_count
= listcount(group
->listen_range
[afi
]);
9876 " %d %s listen range(s)%s",
9877 lr_count
, af_str
, VTYNL
);
9880 for (ALL_LIST_ELEMENTS (group
->listen_range
[afi
], node
,
9883 prefix2str(range
, buf
, sizeof(buf
));
9884 vty_out(vty
, " %s%s", buf
, VTYNL
);
9889 /* Display group members and their status */
9890 if (listcount(group
->peer
))
9892 vty_out (vty
, " Peer-group members:%s", VTYNL
);
9893 for (ALL_LIST_ELEMENTS (group
->peer
, node
, nnode
, peer
))
9895 if (CHECK_FLAG (peer
->flags
, PEER_FLAG_SHUTDOWN
))
9896 peer_status
= "Idle (Admin)";
9897 else if (CHECK_FLAG (peer
->sflags
, PEER_STATUS_PREFIX_OVERFLOW
))
9898 peer_status
= "Idle (PfxCt)";
9900 peer_status
= lookup_msg(bgp_status_msg
, peer
->status
, NULL
);
9902 dynamic
= peer_dynamic_neighbor(peer
);
9903 vty_out (vty
, " %s %s %s %s",
9904 peer
->host
, dynamic
? "(dynamic)" : "",
9905 peer_status
, VTYNL
);
9912 /* Show BGP peer group's information. */
9913 enum show_group_type
9920 bgp_show_peer_group (struct vty
*vty
, struct bgp
*bgp
,
9921 enum show_group_type type
, const char *group_name
)
9923 struct listnode
*node
, *nnode
;
9924 struct peer_group
*group
;
9927 for (ALL_LIST_ELEMENTS (bgp
->group
, node
, nnode
, group
))
9931 case show_all_groups
:
9932 bgp_show_one_peer_group (vty
, group
);
9934 case show_peer_group
:
9935 if (group_name
&& (strcmp(group
->name
, group_name
) == 0))
9938 bgp_show_one_peer_group (vty
, group
);
9944 if (type
== show_peer_group
&& ! find
)
9945 vty_out (vty
, "%% No such peer-group%s", VTYNL
);
9951 bgp_show_peer_group_vty (struct vty
*vty
, const char *name
,
9952 enum show_group_type type
, const char *group_name
)
9955 int ret
= CMD_SUCCESS
;
9958 bgp
= bgp_lookup_by_name (name
);
9960 bgp
= bgp_get_default ();
9964 vty_out (vty
, "%% No such BGP instance exist%s", VTYNL
);
9968 ret
= bgp_show_peer_group (vty
, bgp
, type
, group_name
);
9973 DEFUN (show_ip_bgp_peer_groups
,
9974 show_ip_bgp_peer_groups_cmd
,
9975 "show [ip] bgp [<view|vrf> VIEWVRFNAME] peer-group [PGNAME]",
9979 BGP_INSTANCE_HELP_STR
9980 "Detailed information on BGP peer groups\n"
9981 "Peer group name\n")
9987 vrf
= argv_find (argv
, argc
, "WORD", &idx
) ? argv
[idx
]->arg
: NULL
;
9988 pg
= argv_find (argv
, argc
, "PGNAME", &idx
) ? argv
[idx
]->arg
: NULL
;
9990 return bgp_show_peer_group_vty (vty
, vrf
, show_all_groups
, pg
);
9994 /* Redistribute VTY commands. */
9996 DEFUN (bgp_redistribute_ipv4
,
9997 bgp_redistribute_ipv4_cmd
,
9998 "redistribute " FRR_IP_REDIST_STR_BGPD
,
9999 "Redistribute information from another routing protocol\n"
10000 FRR_IP_REDIST_HELP_STR_BGPD
)
10002 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10003 int idx_protocol
= 1;
10006 type
= proto_redistnum (AFI_IP
, argv
[idx_protocol
]->text
);
10009 vty_out (vty
, "%% Invalid route type%s", VTYNL
);
10010 return CMD_WARNING_CONFIG_FAILED
;
10012 bgp_redist_add(bgp
, AFI_IP
, type
, 0);
10013 return bgp_redistribute_set (bgp
, AFI_IP
, type
, 0);
10016 ALIAS_HIDDEN (bgp_redistribute_ipv4
,
10017 bgp_redistribute_ipv4_hidden_cmd
,
10018 "redistribute " FRR_IP_REDIST_STR_BGPD
,
10019 "Redistribute information from another routing protocol\n"
10020 FRR_IP_REDIST_HELP_STR_BGPD
)
10022 DEFUN (bgp_redistribute_ipv4_rmap
,
10023 bgp_redistribute_ipv4_rmap_cmd
,
10024 "redistribute " FRR_IP_REDIST_STR_BGPD
" route-map WORD",
10025 "Redistribute information from another routing protocol\n"
10026 FRR_IP_REDIST_HELP_STR_BGPD
10027 "Route map reference\n"
10028 "Pointer to route-map entries\n")
10030 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10031 int idx_protocol
= 1;
10034 struct bgp_redist
*red
;
10036 type
= proto_redistnum (AFI_IP
, argv
[idx_protocol
]->text
);
10039 vty_out (vty
, "%% Invalid route type%s", VTYNL
);
10040 return CMD_WARNING_CONFIG_FAILED
;
10043 red
= bgp_redist_add(bgp
, AFI_IP
, type
, 0);
10044 bgp_redistribute_rmap_set (red
, argv
[idx_word
]->arg
);
10045 return bgp_redistribute_set (bgp
, AFI_IP
, type
, 0);
10048 ALIAS_HIDDEN (bgp_redistribute_ipv4_rmap
,
10049 bgp_redistribute_ipv4_rmap_hidden_cmd
,
10050 "redistribute " FRR_IP_REDIST_STR_BGPD
" route-map WORD",
10051 "Redistribute information from another routing protocol\n"
10052 FRR_IP_REDIST_HELP_STR_BGPD
10053 "Route map reference\n"
10054 "Pointer to route-map entries\n")
10056 DEFUN (bgp_redistribute_ipv4_metric
,
10057 bgp_redistribute_ipv4_metric_cmd
,
10058 "redistribute " FRR_IP_REDIST_STR_BGPD
" metric (0-4294967295)",
10059 "Redistribute information from another routing protocol\n"
10060 FRR_IP_REDIST_HELP_STR_BGPD
10061 "Metric for redistributed routes\n"
10062 "Default metric\n")
10064 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10065 int idx_protocol
= 1;
10066 int idx_number
= 3;
10069 struct bgp_redist
*red
;
10071 type
= proto_redistnum (AFI_IP
, argv
[idx_protocol
]->text
);
10074 vty_out (vty
, "%% Invalid route type%s", VTYNL
);
10075 return CMD_WARNING_CONFIG_FAILED
;
10077 metric
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
10079 red
= bgp_redist_add(bgp
, AFI_IP
, type
, 0);
10080 bgp_redistribute_metric_set(bgp
, red
, AFI_IP
, type
, metric
);
10081 return bgp_redistribute_set (bgp
, AFI_IP
, type
, 0);
10084 ALIAS_HIDDEN (bgp_redistribute_ipv4_metric
,
10085 bgp_redistribute_ipv4_metric_hidden_cmd
,
10086 "redistribute " FRR_IP_REDIST_STR_BGPD
" metric (0-4294967295)",
10087 "Redistribute information from another routing protocol\n"
10088 FRR_IP_REDIST_HELP_STR_BGPD
10089 "Metric for redistributed routes\n"
10090 "Default metric\n")
10092 DEFUN (bgp_redistribute_ipv4_rmap_metric
,
10093 bgp_redistribute_ipv4_rmap_metric_cmd
,
10094 "redistribute " FRR_IP_REDIST_STR_BGPD
" route-map WORD metric (0-4294967295)",
10095 "Redistribute information from another routing protocol\n"
10096 FRR_IP_REDIST_HELP_STR_BGPD
10097 "Route map reference\n"
10098 "Pointer to route-map entries\n"
10099 "Metric for redistributed routes\n"
10100 "Default metric\n")
10102 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10103 int idx_protocol
= 1;
10105 int idx_number
= 5;
10108 struct bgp_redist
*red
;
10110 type
= proto_redistnum (AFI_IP
, argv
[idx_protocol
]->text
);
10113 vty_out (vty
, "%% Invalid route type%s", VTYNL
);
10114 return CMD_WARNING_CONFIG_FAILED
;
10116 metric
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
10118 red
= bgp_redist_add(bgp
, AFI_IP
, type
, 0);
10119 bgp_redistribute_rmap_set (red
, argv
[idx_word
]->arg
);
10120 bgp_redistribute_metric_set(bgp
, red
, AFI_IP
, type
, metric
);
10121 return bgp_redistribute_set (bgp
, AFI_IP
, type
, 0);
10124 ALIAS_HIDDEN (bgp_redistribute_ipv4_rmap_metric
,
10125 bgp_redistribute_ipv4_rmap_metric_hidden_cmd
,
10126 "redistribute " FRR_IP_REDIST_STR_BGPD
" route-map WORD metric (0-4294967295)",
10127 "Redistribute information from another routing protocol\n"
10128 FRR_IP_REDIST_HELP_STR_BGPD
10129 "Route map reference\n"
10130 "Pointer to route-map entries\n"
10131 "Metric for redistributed routes\n"
10132 "Default metric\n")
10134 DEFUN (bgp_redistribute_ipv4_metric_rmap
,
10135 bgp_redistribute_ipv4_metric_rmap_cmd
,
10136 "redistribute " FRR_IP_REDIST_STR_BGPD
" metric (0-4294967295) route-map WORD",
10137 "Redistribute information from another routing protocol\n"
10138 FRR_IP_REDIST_HELP_STR_BGPD
10139 "Metric for redistributed routes\n"
10141 "Route map reference\n"
10142 "Pointer to route-map entries\n")
10144 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10145 int idx_protocol
= 1;
10146 int idx_number
= 3;
10150 struct bgp_redist
*red
;
10152 type
= proto_redistnum (AFI_IP
, argv
[idx_protocol
]->text
);
10155 vty_out (vty
, "%% Invalid route type%s", VTYNL
);
10156 return CMD_WARNING_CONFIG_FAILED
;
10158 metric
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
10160 red
= bgp_redist_add(bgp
, AFI_IP
, type
, 0);
10161 bgp_redistribute_metric_set(bgp
, red
, AFI_IP
, type
, metric
);
10162 bgp_redistribute_rmap_set (red
, argv
[idx_word
]->arg
);
10163 return bgp_redistribute_set (bgp
, AFI_IP
, type
, 0);
10166 ALIAS_HIDDEN (bgp_redistribute_ipv4_metric_rmap
,
10167 bgp_redistribute_ipv4_metric_rmap_hidden_cmd
,
10168 "redistribute " FRR_IP_REDIST_STR_BGPD
" metric (0-4294967295) route-map WORD",
10169 "Redistribute information from another routing protocol\n"
10170 FRR_IP_REDIST_HELP_STR_BGPD
10171 "Metric for redistributed routes\n"
10173 "Route map reference\n"
10174 "Pointer to route-map entries\n")
10176 DEFUN (bgp_redistribute_ipv4_ospf
,
10177 bgp_redistribute_ipv4_ospf_cmd
,
10178 "redistribute <ospf|table> (1-65535)",
10179 "Redistribute information from another routing protocol\n"
10180 "Open Shortest Path First (OSPFv2)\n"
10181 "Non-main Kernel Routing Table\n"
10182 "Instance ID/Table ID\n")
10184 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10185 int idx_ospf_table
= 1;
10186 int idx_number
= 2;
10190 instance
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
10192 if (strncmp(argv
[idx_ospf_table
]->arg
, "o", 1) == 0)
10193 protocol
= ZEBRA_ROUTE_OSPF
;
10195 protocol
= ZEBRA_ROUTE_TABLE
;
10197 bgp_redist_add(bgp
, AFI_IP
, protocol
, instance
);
10198 return bgp_redistribute_set (bgp
, AFI_IP
, protocol
, instance
);
10201 ALIAS_HIDDEN (bgp_redistribute_ipv4_ospf
,
10202 bgp_redistribute_ipv4_ospf_hidden_cmd
,
10203 "redistribute <ospf|table> (1-65535)",
10204 "Redistribute information from another routing protocol\n"
10205 "Open Shortest Path First (OSPFv2)\n"
10206 "Non-main Kernel Routing Table\n"
10207 "Instance ID/Table ID\n")
10209 DEFUN (bgp_redistribute_ipv4_ospf_rmap
,
10210 bgp_redistribute_ipv4_ospf_rmap_cmd
,
10211 "redistribute <ospf|table> (1-65535) route-map WORD",
10212 "Redistribute information from another routing protocol\n"
10213 "Open Shortest Path First (OSPFv2)\n"
10214 "Non-main Kernel Routing Table\n"
10215 "Instance ID/Table ID\n"
10216 "Route map reference\n"
10217 "Pointer to route-map entries\n")
10219 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10220 int idx_ospf_table
= 1;
10221 int idx_number
= 2;
10223 struct bgp_redist
*red
;
10227 if (strncmp(argv
[idx_ospf_table
]->arg
, "o", 1) == 0)
10228 protocol
= ZEBRA_ROUTE_OSPF
;
10230 protocol
= ZEBRA_ROUTE_TABLE
;
10232 instance
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
10233 red
= bgp_redist_add(bgp
, AFI_IP
, protocol
, instance
);
10234 bgp_redistribute_rmap_set (red
, argv
[idx_word
]->arg
);
10235 return bgp_redistribute_set (bgp
, AFI_IP
, protocol
, instance
);
10238 ALIAS_HIDDEN (bgp_redistribute_ipv4_ospf_rmap
,
10239 bgp_redistribute_ipv4_ospf_rmap_hidden_cmd
,
10240 "redistribute <ospf|table> (1-65535) route-map WORD",
10241 "Redistribute information from another routing protocol\n"
10242 "Open Shortest Path First (OSPFv2)\n"
10243 "Non-main Kernel Routing Table\n"
10244 "Instance ID/Table ID\n"
10245 "Route map reference\n"
10246 "Pointer to route-map entries\n")
10248 DEFUN (bgp_redistribute_ipv4_ospf_metric
,
10249 bgp_redistribute_ipv4_ospf_metric_cmd
,
10250 "redistribute <ospf|table> (1-65535) metric (0-4294967295)",
10251 "Redistribute information from another routing protocol\n"
10252 "Open Shortest Path First (OSPFv2)\n"
10253 "Non-main Kernel Routing Table\n"
10254 "Instance ID/Table ID\n"
10255 "Metric for redistributed routes\n"
10256 "Default metric\n")
10258 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10259 int idx_ospf_table
= 1;
10260 int idx_number
= 2;
10261 int idx_number_2
= 4;
10263 struct bgp_redist
*red
;
10267 if (strncmp(argv
[idx_ospf_table
]->arg
, "o", 1) == 0)
10268 protocol
= ZEBRA_ROUTE_OSPF
;
10270 protocol
= ZEBRA_ROUTE_TABLE
;
10272 instance
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
10273 metric
= strtoul(argv
[idx_number_2
]->arg
, NULL
, 10);
10275 red
= bgp_redist_add(bgp
, AFI_IP
, protocol
, instance
);
10276 bgp_redistribute_metric_set(bgp
, red
, AFI_IP
, protocol
, metric
);
10277 return bgp_redistribute_set (bgp
, AFI_IP
, protocol
, instance
);
10280 ALIAS_HIDDEN (bgp_redistribute_ipv4_ospf_metric
,
10281 bgp_redistribute_ipv4_ospf_metric_hidden_cmd
,
10282 "redistribute <ospf|table> (1-65535) metric (0-4294967295)",
10283 "Redistribute information from another routing protocol\n"
10284 "Open Shortest Path First (OSPFv2)\n"
10285 "Non-main Kernel Routing Table\n"
10286 "Instance ID/Table ID\n"
10287 "Metric for redistributed routes\n"
10288 "Default metric\n")
10290 DEFUN (bgp_redistribute_ipv4_ospf_rmap_metric
,
10291 bgp_redistribute_ipv4_ospf_rmap_metric_cmd
,
10292 "redistribute <ospf|table> (1-65535) route-map WORD metric (0-4294967295)",
10293 "Redistribute information from another routing protocol\n"
10294 "Open Shortest Path First (OSPFv2)\n"
10295 "Non-main Kernel Routing Table\n"
10296 "Instance ID/Table ID\n"
10297 "Route map reference\n"
10298 "Pointer to route-map entries\n"
10299 "Metric for redistributed routes\n"
10300 "Default metric\n")
10302 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10303 int idx_ospf_table
= 1;
10304 int idx_number
= 2;
10306 int idx_number_2
= 6;
10308 struct bgp_redist
*red
;
10312 if (strncmp(argv
[idx_ospf_table
]->arg
, "o", 1) == 0)
10313 protocol
= ZEBRA_ROUTE_OSPF
;
10315 protocol
= ZEBRA_ROUTE_TABLE
;
10317 instance
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
10318 metric
= strtoul(argv
[idx_number_2
]->arg
, NULL
, 10);
10320 red
= bgp_redist_add(bgp
, AFI_IP
, protocol
, instance
);
10321 bgp_redistribute_rmap_set (red
, argv
[idx_word
]->arg
);
10322 bgp_redistribute_metric_set(bgp
, red
, AFI_IP
, protocol
, metric
);
10323 return bgp_redistribute_set (bgp
, AFI_IP
, protocol
, instance
);
10326 ALIAS_HIDDEN (bgp_redistribute_ipv4_ospf_rmap_metric
,
10327 bgp_redistribute_ipv4_ospf_rmap_metric_hidden_cmd
,
10328 "redistribute <ospf|table> (1-65535) route-map WORD metric (0-4294967295)",
10329 "Redistribute information from another routing protocol\n"
10330 "Open Shortest Path First (OSPFv2)\n"
10331 "Non-main Kernel Routing Table\n"
10332 "Instance ID/Table ID\n"
10333 "Route map reference\n"
10334 "Pointer to route-map entries\n"
10335 "Metric for redistributed routes\n"
10336 "Default metric\n")
10338 DEFUN (bgp_redistribute_ipv4_ospf_metric_rmap
,
10339 bgp_redistribute_ipv4_ospf_metric_rmap_cmd
,
10340 "redistribute <ospf|table> (1-65535) metric (0-4294967295) route-map WORD",
10341 "Redistribute information from another routing protocol\n"
10342 "Open Shortest Path First (OSPFv2)\n"
10343 "Non-main Kernel Routing Table\n"
10344 "Instance ID/Table ID\n"
10345 "Metric for redistributed routes\n"
10347 "Route map reference\n"
10348 "Pointer to route-map entries\n")
10350 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10351 int idx_ospf_table
= 1;
10352 int idx_number
= 2;
10353 int idx_number_2
= 4;
10356 struct bgp_redist
*red
;
10360 if (strncmp(argv
[idx_ospf_table
]->arg
, "o", 1) == 0)
10361 protocol
= ZEBRA_ROUTE_OSPF
;
10363 protocol
= ZEBRA_ROUTE_TABLE
;
10365 instance
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
10366 metric
= strtoul(argv
[idx_number_2
]->arg
, NULL
, 10);
10368 red
= bgp_redist_add(bgp
, AFI_IP
, protocol
, instance
);
10369 bgp_redistribute_metric_set(bgp
, red
, AFI_IP
, protocol
, metric
);
10370 bgp_redistribute_rmap_set (red
, argv
[idx_word
]->arg
);
10371 return bgp_redistribute_set (bgp
, AFI_IP
, protocol
, instance
);
10374 ALIAS_HIDDEN (bgp_redistribute_ipv4_ospf_metric_rmap
,
10375 bgp_redistribute_ipv4_ospf_metric_rmap_hidden_cmd
,
10376 "redistribute <ospf|table> (1-65535) metric (0-4294967295) route-map WORD",
10377 "Redistribute information from another routing protocol\n"
10378 "Open Shortest Path First (OSPFv2)\n"
10379 "Non-main Kernel Routing Table\n"
10380 "Instance ID/Table ID\n"
10381 "Metric for redistributed routes\n"
10383 "Route map reference\n"
10384 "Pointer to route-map entries\n")
10386 DEFUN (no_bgp_redistribute_ipv4_ospf
,
10387 no_bgp_redistribute_ipv4_ospf_cmd
,
10388 "no redistribute <ospf|table> (1-65535) [metric (0-4294967295)] [route-map WORD]",
10390 "Redistribute information from another routing protocol\n"
10391 "Open Shortest Path First (OSPFv2)\n"
10392 "Non-main Kernel Routing Table\n"
10393 "Instance ID/Table ID\n"
10394 "Metric for redistributed routes\n"
10396 "Route map reference\n"
10397 "Pointer to route-map entries\n")
10399 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10400 int idx_ospf_table
= 2;
10401 int idx_number
= 3;
10405 if (strncmp(argv
[idx_ospf_table
]->arg
, "o", 1) == 0)
10406 protocol
= ZEBRA_ROUTE_OSPF
;
10408 protocol
= ZEBRA_ROUTE_TABLE
;
10410 instance
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
10411 return bgp_redistribute_unset (bgp
, AFI_IP
, protocol
, instance
);
10414 ALIAS_HIDDEN (no_bgp_redistribute_ipv4_ospf
,
10415 no_bgp_redistribute_ipv4_ospf_hidden_cmd
,
10416 "no redistribute <ospf|table> (1-65535) [metric (0-4294967295)] [route-map WORD]",
10418 "Redistribute information from another routing protocol\n"
10419 "Open Shortest Path First (OSPFv2)\n"
10420 "Non-main Kernel Routing Table\n"
10421 "Instance ID/Table ID\n"
10422 "Metric for redistributed routes\n"
10424 "Route map reference\n"
10425 "Pointer to route-map entries\n")
10427 DEFUN (no_bgp_redistribute_ipv4
,
10428 no_bgp_redistribute_ipv4_cmd
,
10429 "no redistribute " FRR_IP_REDIST_STR_BGPD
" [metric (0-4294967295)] [route-map WORD]",
10431 "Redistribute information from another routing protocol\n"
10432 FRR_IP_REDIST_HELP_STR_BGPD
10433 "Metric for redistributed routes\n"
10435 "Route map reference\n"
10436 "Pointer to route-map entries\n")
10438 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10439 int idx_protocol
= 2;
10442 type
= proto_redistnum (AFI_IP
, argv
[idx_protocol
]->text
);
10445 vty_out (vty
, "%% Invalid route type%s", VTYNL
);
10446 return CMD_WARNING_CONFIG_FAILED
;
10448 return bgp_redistribute_unset (bgp
, AFI_IP
, type
, 0);
10451 ALIAS_HIDDEN (no_bgp_redistribute_ipv4
,
10452 no_bgp_redistribute_ipv4_hidden_cmd
,
10453 "no redistribute " FRR_IP_REDIST_STR_BGPD
" [metric (0-4294967295)] [route-map WORD]",
10455 "Redistribute information from another routing protocol\n"
10456 FRR_IP_REDIST_HELP_STR_BGPD
10457 "Metric for redistributed routes\n"
10459 "Route map reference\n"
10460 "Pointer to route-map entries\n")
10462 DEFUN (bgp_redistribute_ipv6
,
10463 bgp_redistribute_ipv6_cmd
,
10464 "redistribute " FRR_IP6_REDIST_STR_BGPD
,
10465 "Redistribute information from another routing protocol\n"
10466 FRR_IP6_REDIST_HELP_STR_BGPD
)
10468 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10469 int idx_protocol
= 1;
10472 type
= proto_redistnum (AFI_IP6
, argv
[idx_protocol
]->text
);
10475 vty_out (vty
, "%% Invalid route type%s", VTYNL
);
10476 return CMD_WARNING_CONFIG_FAILED
;
10479 bgp_redist_add(bgp
, AFI_IP6
, type
, 0);
10480 return bgp_redistribute_set (bgp
, AFI_IP6
, type
, 0);
10483 DEFUN (bgp_redistribute_ipv6_rmap
,
10484 bgp_redistribute_ipv6_rmap_cmd
,
10485 "redistribute " FRR_IP6_REDIST_STR_BGPD
" route-map WORD",
10486 "Redistribute information from another routing protocol\n"
10487 FRR_IP6_REDIST_HELP_STR_BGPD
10488 "Route map reference\n"
10489 "Pointer to route-map entries\n")
10491 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10492 int idx_protocol
= 1;
10495 struct bgp_redist
*red
;
10497 type
= proto_redistnum (AFI_IP6
, argv
[idx_protocol
]->text
);
10500 vty_out (vty
, "%% Invalid route type%s", VTYNL
);
10501 return CMD_WARNING_CONFIG_FAILED
;
10504 red
= bgp_redist_add(bgp
, AFI_IP6
, type
, 0);
10505 bgp_redistribute_rmap_set (red
, argv
[idx_word
]->arg
);
10506 return bgp_redistribute_set (bgp
, AFI_IP6
, type
, 0);
10509 DEFUN (bgp_redistribute_ipv6_metric
,
10510 bgp_redistribute_ipv6_metric_cmd
,
10511 "redistribute " FRR_IP6_REDIST_STR_BGPD
" metric (0-4294967295)",
10512 "Redistribute information from another routing protocol\n"
10513 FRR_IP6_REDIST_HELP_STR_BGPD
10514 "Metric for redistributed routes\n"
10515 "Default metric\n")
10517 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10518 int idx_protocol
= 1;
10519 int idx_number
= 3;
10522 struct bgp_redist
*red
;
10524 type
= proto_redistnum (AFI_IP6
, argv
[idx_protocol
]->text
);
10527 vty_out (vty
, "%% Invalid route type%s", VTYNL
);
10528 return CMD_WARNING_CONFIG_FAILED
;
10530 metric
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
10532 red
= bgp_redist_add(bgp
, AFI_IP6
, type
, 0);
10533 bgp_redistribute_metric_set(bgp
, red
, AFI_IP6
, type
, metric
);
10534 return bgp_redistribute_set (bgp
, AFI_IP6
, type
, 0);
10537 DEFUN (bgp_redistribute_ipv6_rmap_metric
,
10538 bgp_redistribute_ipv6_rmap_metric_cmd
,
10539 "redistribute " FRR_IP6_REDIST_STR_BGPD
" route-map WORD metric (0-4294967295)",
10540 "Redistribute information from another routing protocol\n"
10541 FRR_IP6_REDIST_HELP_STR_BGPD
10542 "Route map reference\n"
10543 "Pointer to route-map entries\n"
10544 "Metric for redistributed routes\n"
10545 "Default metric\n")
10547 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10548 int idx_protocol
= 1;
10550 int idx_number
= 5;
10553 struct bgp_redist
*red
;
10555 type
= proto_redistnum (AFI_IP6
, argv
[idx_protocol
]->text
);
10558 vty_out (vty
, "%% Invalid route type%s", VTYNL
);
10559 return CMD_WARNING_CONFIG_FAILED
;
10561 metric
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
10563 red
= bgp_redist_add(bgp
, AFI_IP6
, type
, 0);
10564 bgp_redistribute_rmap_set (red
, argv
[idx_word
]->arg
);
10565 bgp_redistribute_metric_set(bgp
, red
, AFI_IP6
, type
, metric
);
10566 return bgp_redistribute_set (bgp
, AFI_IP6
, type
, 0);
10569 DEFUN (bgp_redistribute_ipv6_metric_rmap
,
10570 bgp_redistribute_ipv6_metric_rmap_cmd
,
10571 "redistribute " FRR_IP6_REDIST_STR_BGPD
" metric (0-4294967295) route-map WORD",
10572 "Redistribute information from another routing protocol\n"
10573 FRR_IP6_REDIST_HELP_STR_BGPD
10574 "Metric for redistributed routes\n"
10576 "Route map reference\n"
10577 "Pointer to route-map entries\n")
10579 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10580 int idx_protocol
= 1;
10581 int idx_number
= 3;
10585 struct bgp_redist
*red
;
10587 type
= proto_redistnum (AFI_IP6
, argv
[idx_protocol
]->text
);
10590 vty_out (vty
, "%% Invalid route type%s", VTYNL
);
10591 return CMD_WARNING_CONFIG_FAILED
;
10593 metric
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
10595 red
= bgp_redist_add(bgp
, AFI_IP6
, type
, 0);
10596 bgp_redistribute_metric_set(bgp
, red
, AFI_IP6
, SAFI_UNICAST
, metric
);
10597 bgp_redistribute_rmap_set (red
, argv
[idx_word
]->arg
);
10598 return bgp_redistribute_set (bgp
, AFI_IP6
, type
, 0);
10601 DEFUN (no_bgp_redistribute_ipv6
,
10602 no_bgp_redistribute_ipv6_cmd
,
10603 "no redistribute " FRR_IP6_REDIST_STR_BGPD
" [metric (0-4294967295)] [route-map WORD]",
10605 "Redistribute information from another routing protocol\n"
10606 FRR_IP6_REDIST_HELP_STR_BGPD
10607 "Metric for redistributed routes\n"
10609 "Route map reference\n"
10610 "Pointer to route-map entries\n")
10612 VTY_DECLVAR_CONTEXT(bgp
, bgp
);
10613 int idx_protocol
= 2;
10616 type
= proto_redistnum (AFI_IP6
, argv
[idx_protocol
]->text
);
10619 vty_out (vty
, "%% Invalid route type%s", VTYNL
);
10620 return CMD_WARNING_CONFIG_FAILED
;
10623 return bgp_redistribute_unset (bgp
, AFI_IP6
, type
, 0);
10627 bgp_config_write_redistribute (struct vty
*vty
, struct bgp
*bgp
, afi_t afi
,
10628 safi_t safi
, int *write
)
10632 /* Unicast redistribution only. */
10633 if (safi
!= SAFI_UNICAST
)
10636 for (i
= 0; i
< ZEBRA_ROUTE_MAX
; i
++)
10638 /* Redistribute BGP does not make sense. */
10639 if (i
!= ZEBRA_ROUTE_BGP
)
10641 struct list
*red_list
;
10642 struct listnode
*node
;
10643 struct bgp_redist
*red
;
10645 red_list
= bgp
->redist
[afi
][i
];
10649 for (ALL_LIST_ELEMENTS_RO(red_list
, node
, red
))
10651 /* Display "address-family" when it is not yet diplayed. */
10652 bgp_config_write_family_header (vty
, afi
, safi
, write
);
10654 /* "redistribute" configuration. */
10655 vty_out (vty
, " redistribute %s", zebra_route_string(i
));
10657 vty_out (vty
, " %d", red
->instance
);
10658 if (red
->redist_metric_flag
)
10659 vty_out (vty
, " metric %u", red
->redist_metric
);
10660 if (red
->rmap
.name
)
10661 vty_out (vty
, " route-map %s", red
->rmap
.name
);
10662 vty_out (vty
, "%s", VTYNL
);
10669 /* BGP node structure. */
10670 static struct cmd_node bgp_node
=
10673 "%s(config-router)# ",
10677 static struct cmd_node bgp_ipv4_unicast_node
=
10680 "%s(config-router-af)# ",
10684 static struct cmd_node bgp_ipv4_multicast_node
=
10687 "%s(config-router-af)# ",
10691 static struct cmd_node bgp_ipv4_labeled_unicast_node
=
10694 "%s(config-router-af)# ",
10698 static struct cmd_node bgp_ipv6_unicast_node
=
10701 "%s(config-router-af)# ",
10705 static struct cmd_node bgp_ipv6_multicast_node
=
10708 "%s(config-router-af)# ",
10712 static struct cmd_node bgp_ipv6_labeled_unicast_node
=
10715 "%s(config-router-af)# ",
10719 static struct cmd_node bgp_vpnv4_node
=
10722 "%s(config-router-af)# ",
10726 static struct cmd_node bgp_vpnv6_node
=
10729 "%s(config-router-af-vpnv6)# ",
10733 static struct cmd_node bgp_evpn_node
=
10736 "%s(config-router-evpn)# ",
10740 static struct cmd_node bgp_evpn_vni_node
=
10743 "%s(config-router-af-vni)# ",
10747 static void community_list_vty (void);
10750 bgp_ac_neighbor (vector comps
, struct cmd_token
*token
)
10754 struct peer_group
*group
;
10755 struct listnode
*lnbgp
, *lnpeer
;
10757 for (ALL_LIST_ELEMENTS_RO (bm
->bgp
, lnbgp
, bgp
))
10759 for (ALL_LIST_ELEMENTS_RO (bgp
->peer
, lnpeer
, peer
))
10761 /* only provide suggestions on the appropriate input token type,
10762 * they'll otherwise show up multiple times */
10763 enum cmd_token_type match_type
;
10764 char *name
= peer
->host
;
10768 match_type
= VARIABLE_TKN
;
10769 name
= peer
->conf_if
;
10771 else if (strchr(peer
->host
, ':'))
10772 match_type
= IPV6_TKN
;
10774 match_type
= IPV4_TKN
;
10776 if (token
->type
!= match_type
)
10779 vector_set(comps
, XSTRDUP(MTYPE_COMPLETION
, name
));
10782 if (token
->type
== VARIABLE_TKN
)
10783 for (ALL_LIST_ELEMENTS_RO (bgp
->group
, lnpeer
, group
))
10784 vector_set(comps
, XSTRDUP(MTYPE_COMPLETION
, group
->name
));
10788 static const struct cmd_variable_handler bgp_var_neighbor
[] = {
10790 .varname
= "neighbor",
10791 .completions
= bgp_ac_neighbor
10793 .varname
= "neighbors",
10794 .completions
= bgp_ac_neighbor
10796 .completions
= NULL
10801 bgp_vty_init (void)
10803 cmd_variable_handler_register(bgp_var_neighbor
);
10805 /* Install bgp top node. */
10806 install_node (&bgp_node
, bgp_config_write
);
10807 install_node (&bgp_ipv4_unicast_node
, NULL
);
10808 install_node (&bgp_ipv4_multicast_node
, NULL
);
10809 install_node (&bgp_ipv4_labeled_unicast_node
, NULL
);
10810 install_node (&bgp_ipv6_unicast_node
, NULL
);
10811 install_node (&bgp_ipv6_multicast_node
, NULL
);
10812 install_node (&bgp_ipv6_labeled_unicast_node
, NULL
);
10813 install_node (&bgp_vpnv4_node
, NULL
);
10814 install_node (&bgp_vpnv6_node
, NULL
);
10815 install_node (&bgp_evpn_node
, NULL
);
10816 install_node (&bgp_evpn_vni_node
, NULL
);
10818 /* Install default VTY commands to new nodes. */
10819 install_default (BGP_NODE
);
10820 install_default (BGP_IPV4_NODE
);
10821 install_default (BGP_IPV4M_NODE
);
10822 install_default (BGP_IPV4L_NODE
);
10823 install_default (BGP_IPV6_NODE
);
10824 install_default (BGP_IPV6M_NODE
);
10825 install_default (BGP_IPV6L_NODE
);
10826 install_default (BGP_VPNV4_NODE
);
10827 install_default (BGP_VPNV6_NODE
);
10828 install_default (BGP_EVPN_NODE
);
10829 install_default (BGP_EVPN_VNI_NODE
);
10831 /* "bgp multiple-instance" commands. */
10832 install_element (CONFIG_NODE
, &bgp_multiple_instance_cmd
);
10833 install_element (CONFIG_NODE
, &no_bgp_multiple_instance_cmd
);
10835 /* "bgp config-type" commands. */
10836 install_element (CONFIG_NODE
, &bgp_config_type_cmd
);
10837 install_element (CONFIG_NODE
, &no_bgp_config_type_cmd
);
10839 /* bgp route-map delay-timer commands. */
10840 install_element (CONFIG_NODE
, &bgp_set_route_map_delay_timer_cmd
);
10841 install_element (CONFIG_NODE
, &no_bgp_set_route_map_delay_timer_cmd
);
10843 /* Dummy commands (Currently not supported) */
10844 install_element (BGP_NODE
, &no_synchronization_cmd
);
10845 install_element (BGP_NODE
, &no_auto_summary_cmd
);
10847 /* "router bgp" commands. */
10848 install_element (CONFIG_NODE
, &router_bgp_cmd
);
10850 /* "no router bgp" commands. */
10851 install_element (CONFIG_NODE
, &no_router_bgp_cmd
);
10853 /* "bgp router-id" commands. */
10854 install_element (BGP_NODE
, &bgp_router_id_cmd
);
10855 install_element (BGP_NODE
, &no_bgp_router_id_cmd
);
10857 /* "bgp cluster-id" commands. */
10858 install_element (BGP_NODE
, &bgp_cluster_id_cmd
);
10859 install_element (BGP_NODE
, &no_bgp_cluster_id_cmd
);
10861 /* "bgp confederation" commands. */
10862 install_element (BGP_NODE
, &bgp_confederation_identifier_cmd
);
10863 install_element (BGP_NODE
, &no_bgp_confederation_identifier_cmd
);
10865 /* "bgp confederation peers" commands. */
10866 install_element (BGP_NODE
, &bgp_confederation_peers_cmd
);
10867 install_element (BGP_NODE
, &no_bgp_confederation_peers_cmd
);
10869 /* bgp max-med command */
10870 install_element (BGP_NODE
, &bgp_maxmed_admin_cmd
);
10871 install_element (BGP_NODE
, &no_bgp_maxmed_admin_cmd
);
10872 install_element (BGP_NODE
, &bgp_maxmed_admin_medv_cmd
);
10873 install_element (BGP_NODE
, &bgp_maxmed_onstartup_cmd
);
10874 install_element (BGP_NODE
, &no_bgp_maxmed_onstartup_cmd
);
10876 /* bgp disable-ebgp-connected-nh-check */
10877 install_element (BGP_NODE
, &bgp_disable_connected_route_check_cmd
);
10878 install_element (BGP_NODE
, &no_bgp_disable_connected_route_check_cmd
);
10880 /* bgp update-delay command */
10881 install_element (BGP_NODE
, &bgp_update_delay_cmd
);
10882 install_element (BGP_NODE
, &no_bgp_update_delay_cmd
);
10883 install_element (BGP_NODE
, &bgp_update_delay_establish_wait_cmd
);
10885 install_element (BGP_NODE
, &bgp_wpkt_quanta_cmd
);
10886 install_element (BGP_NODE
, &no_bgp_wpkt_quanta_cmd
);
10888 install_element (BGP_NODE
, &bgp_coalesce_time_cmd
);
10889 install_element (BGP_NODE
, &no_bgp_coalesce_time_cmd
);
10891 /* "maximum-paths" commands. */
10892 install_element (BGP_NODE
, &bgp_maxpaths_hidden_cmd
);
10893 install_element (BGP_NODE
, &no_bgp_maxpaths_hidden_cmd
);
10894 install_element (BGP_IPV4_NODE
, &bgp_maxpaths_cmd
);
10895 install_element (BGP_IPV4_NODE
, &no_bgp_maxpaths_cmd
);
10896 install_element (BGP_IPV6_NODE
, &bgp_maxpaths_cmd
);
10897 install_element (BGP_IPV6_NODE
, &no_bgp_maxpaths_cmd
);
10898 install_element (BGP_NODE
, &bgp_maxpaths_ibgp_hidden_cmd
);
10899 install_element (BGP_NODE
, &bgp_maxpaths_ibgp_cluster_hidden_cmd
);
10900 install_element (BGP_NODE
, &no_bgp_maxpaths_ibgp_hidden_cmd
);
10901 install_element (BGP_IPV4_NODE
, &bgp_maxpaths_ibgp_cmd
);
10902 install_element (BGP_IPV4_NODE
, &bgp_maxpaths_ibgp_cluster_cmd
);
10903 install_element (BGP_IPV4_NODE
, &no_bgp_maxpaths_ibgp_cmd
);
10904 install_element (BGP_IPV6_NODE
, &bgp_maxpaths_ibgp_cmd
);
10905 install_element (BGP_IPV6_NODE
, &bgp_maxpaths_ibgp_cluster_cmd
);
10906 install_element (BGP_IPV6_NODE
, &no_bgp_maxpaths_ibgp_cmd
);
10908 install_element (BGP_IPV6L_NODE
, &bgp_maxpaths_cmd
);
10909 install_element (BGP_IPV6L_NODE
, &no_bgp_maxpaths_cmd
);
10910 install_element (BGP_IPV6L_NODE
, &bgp_maxpaths_ibgp_cmd
);
10911 install_element (BGP_IPV6L_NODE
, &bgp_maxpaths_ibgp_cluster_cmd
);
10912 install_element (BGP_IPV6L_NODE
, &no_bgp_maxpaths_ibgp_cmd
);
10914 /* "timers bgp" commands. */
10915 install_element (BGP_NODE
, &bgp_timers_cmd
);
10916 install_element (BGP_NODE
, &no_bgp_timers_cmd
);
10918 /* route-map delay-timer commands - per instance for backwards compat. */
10919 install_element (BGP_NODE
, &bgp_set_route_map_delay_timer_cmd
);
10920 install_element (BGP_NODE
, &no_bgp_set_route_map_delay_timer_cmd
);
10922 /* "bgp client-to-client reflection" commands */
10923 install_element (BGP_NODE
, &no_bgp_client_to_client_reflection_cmd
);
10924 install_element (BGP_NODE
, &bgp_client_to_client_reflection_cmd
);
10926 /* "bgp always-compare-med" commands */
10927 install_element (BGP_NODE
, &bgp_always_compare_med_cmd
);
10928 install_element (BGP_NODE
, &no_bgp_always_compare_med_cmd
);
10930 /* "bgp deterministic-med" commands */
10931 install_element (BGP_NODE
, &bgp_deterministic_med_cmd
);
10932 install_element (BGP_NODE
, &no_bgp_deterministic_med_cmd
);
10934 /* "bgp graceful-restart" commands */
10935 install_element (BGP_NODE
, &bgp_graceful_restart_cmd
);
10936 install_element (BGP_NODE
, &no_bgp_graceful_restart_cmd
);
10937 install_element (BGP_NODE
, &bgp_graceful_restart_stalepath_time_cmd
);
10938 install_element (BGP_NODE
, &no_bgp_graceful_restart_stalepath_time_cmd
);
10939 install_element (BGP_NODE
, &bgp_graceful_restart_restart_time_cmd
);
10940 install_element (BGP_NODE
, &no_bgp_graceful_restart_restart_time_cmd
);
10942 install_element (BGP_NODE
, &bgp_graceful_restart_preserve_fw_cmd
);
10943 install_element (BGP_NODE
, &no_bgp_graceful_restart_preserve_fw_cmd
);
10945 /* "bgp fast-external-failover" commands */
10946 install_element (BGP_NODE
, &bgp_fast_external_failover_cmd
);
10947 install_element (BGP_NODE
, &no_bgp_fast_external_failover_cmd
);
10949 /* "bgp enforce-first-as" commands */
10950 install_element (BGP_NODE
, &bgp_enforce_first_as_cmd
);
10951 install_element (BGP_NODE
, &no_bgp_enforce_first_as_cmd
);
10953 /* "bgp bestpath compare-routerid" commands */
10954 install_element (BGP_NODE
, &bgp_bestpath_compare_router_id_cmd
);
10955 install_element (BGP_NODE
, &no_bgp_bestpath_compare_router_id_cmd
);
10957 /* "bgp bestpath as-path ignore" commands */
10958 install_element (BGP_NODE
, &bgp_bestpath_aspath_ignore_cmd
);
10959 install_element (BGP_NODE
, &no_bgp_bestpath_aspath_ignore_cmd
);
10961 /* "bgp bestpath as-path confed" commands */
10962 install_element (BGP_NODE
, &bgp_bestpath_aspath_confed_cmd
);
10963 install_element (BGP_NODE
, &no_bgp_bestpath_aspath_confed_cmd
);
10965 /* "bgp bestpath as-path multipath-relax" commands */
10966 install_element (BGP_NODE
, &bgp_bestpath_aspath_multipath_relax_cmd
);
10967 install_element (BGP_NODE
, &no_bgp_bestpath_aspath_multipath_relax_cmd
);
10969 /* "bgp log-neighbor-changes" commands */
10970 install_element (BGP_NODE
, &bgp_log_neighbor_changes_cmd
);
10971 install_element (BGP_NODE
, &no_bgp_log_neighbor_changes_cmd
);
10973 /* "bgp bestpath med" commands */
10974 install_element (BGP_NODE
, &bgp_bestpath_med_cmd
);
10975 install_element (BGP_NODE
, &no_bgp_bestpath_med_cmd
);
10977 /* "no bgp default ipv4-unicast" commands. */
10978 install_element (BGP_NODE
, &no_bgp_default_ipv4_unicast_cmd
);
10979 install_element (BGP_NODE
, &bgp_default_ipv4_unicast_cmd
);
10981 /* "bgp network import-check" commands. */
10982 install_element (BGP_NODE
, &bgp_network_import_check_cmd
);
10983 install_element (BGP_NODE
, &bgp_network_import_check_exact_cmd
);
10984 install_element (BGP_NODE
, &no_bgp_network_import_check_cmd
);
10986 /* "bgp default local-preference" commands. */
10987 install_element (BGP_NODE
, &bgp_default_local_preference_cmd
);
10988 install_element (BGP_NODE
, &no_bgp_default_local_preference_cmd
);
10990 /* bgp default show-hostname */
10991 install_element (BGP_NODE
, &bgp_default_show_hostname_cmd
);
10992 install_element (BGP_NODE
, &no_bgp_default_show_hostname_cmd
);
10994 /* "bgp default subgroup-pkt-queue-max" commands. */
10995 install_element (BGP_NODE
, &bgp_default_subgroup_pkt_queue_max_cmd
);
10996 install_element (BGP_NODE
, &no_bgp_default_subgroup_pkt_queue_max_cmd
);
10998 /* bgp ibgp-allow-policy-mods command */
10999 install_element (BGP_NODE
, &bgp_rr_allow_outbound_policy_cmd
);
11000 install_element (BGP_NODE
, &no_bgp_rr_allow_outbound_policy_cmd
);
11002 /* "bgp listen limit" commands. */
11003 install_element (BGP_NODE
, &bgp_listen_limit_cmd
);
11004 install_element (BGP_NODE
, &no_bgp_listen_limit_cmd
);
11006 /* "bgp listen range" commands. */
11007 install_element (BGP_NODE
, &bgp_listen_range_cmd
);
11008 install_element (BGP_NODE
, &no_bgp_listen_range_cmd
);
11010 /* "neighbor remote-as" commands. */
11011 install_element (BGP_NODE
, &neighbor_remote_as_cmd
);
11012 install_element (BGP_NODE
, &neighbor_interface_config_cmd
);
11013 install_element (BGP_NODE
, &neighbor_interface_config_v6only_cmd
);
11014 install_element (BGP_NODE
, &neighbor_interface_config_remote_as_cmd
);
11015 install_element (BGP_NODE
, &neighbor_interface_v6only_config_remote_as_cmd
);
11016 install_element (BGP_NODE
, &no_neighbor_cmd
);
11017 install_element (BGP_NODE
, &no_neighbor_interface_config_cmd
);
11019 /* "neighbor peer-group" commands. */
11020 install_element (BGP_NODE
, &neighbor_peer_group_cmd
);
11021 install_element (BGP_NODE
, &no_neighbor_peer_group_cmd
);
11022 install_element (BGP_NODE
, &no_neighbor_interface_peer_group_remote_as_cmd
);
11024 /* "neighbor local-as" commands. */
11025 install_element (BGP_NODE
, &neighbor_local_as_cmd
);
11026 install_element (BGP_NODE
, &neighbor_local_as_no_prepend_cmd
);
11027 install_element (BGP_NODE
, &neighbor_local_as_no_prepend_replace_as_cmd
);
11028 install_element (BGP_NODE
, &no_neighbor_local_as_cmd
);
11030 /* "neighbor solo" commands. */
11031 install_element (BGP_NODE
, &neighbor_solo_cmd
);
11032 install_element (BGP_NODE
, &no_neighbor_solo_cmd
);
11034 /* "neighbor password" commands. */
11035 install_element (BGP_NODE
, &neighbor_password_cmd
);
11036 install_element (BGP_NODE
, &no_neighbor_password_cmd
);
11038 /* "neighbor activate" commands. */
11039 install_element (BGP_NODE
, &neighbor_activate_hidden_cmd
);
11040 install_element (BGP_IPV4_NODE
, &neighbor_activate_cmd
);
11041 install_element (BGP_IPV4M_NODE
, &neighbor_activate_cmd
);
11042 install_element (BGP_IPV4L_NODE
, &neighbor_activate_cmd
);
11043 install_element (BGP_IPV6_NODE
, &neighbor_activate_cmd
);
11044 install_element (BGP_IPV6M_NODE
, &neighbor_activate_cmd
);
11045 install_element (BGP_IPV6L_NODE
, &neighbor_activate_cmd
);
11046 install_element (BGP_VPNV4_NODE
, &neighbor_activate_cmd
);
11047 install_element (BGP_VPNV6_NODE
, &neighbor_activate_cmd
);
11048 install_element (BGP_EVPN_NODE
, &neighbor_activate_cmd
);
11050 /* "no neighbor activate" commands. */
11051 install_element (BGP_NODE
, &no_neighbor_activate_hidden_cmd
);
11052 install_element (BGP_IPV4_NODE
, &no_neighbor_activate_cmd
);
11053 install_element (BGP_IPV4M_NODE
, &no_neighbor_activate_cmd
);
11054 install_element (BGP_IPV4L_NODE
, &no_neighbor_activate_cmd
);
11055 install_element (BGP_IPV6_NODE
, &no_neighbor_activate_cmd
);
11056 install_element (BGP_IPV6M_NODE
, &no_neighbor_activate_cmd
);
11057 install_element (BGP_IPV6L_NODE
, &no_neighbor_activate_cmd
);
11058 install_element (BGP_VPNV4_NODE
, &no_neighbor_activate_cmd
);
11059 install_element (BGP_VPNV6_NODE
, &no_neighbor_activate_cmd
);
11060 install_element (BGP_EVPN_NODE
, &no_neighbor_activate_cmd
);
11062 /* "neighbor peer-group" set commands. */
11063 install_element (BGP_NODE
, &neighbor_set_peer_group_cmd
);
11064 install_element (BGP_IPV4_NODE
, &neighbor_set_peer_group_hidden_cmd
);
11065 install_element (BGP_IPV4M_NODE
, &neighbor_set_peer_group_hidden_cmd
);
11066 install_element (BGP_IPV6_NODE
, &neighbor_set_peer_group_hidden_cmd
);
11067 install_element (BGP_IPV6M_NODE
, &neighbor_set_peer_group_hidden_cmd
);
11068 install_element (BGP_IPV6L_NODE
, &neighbor_set_peer_group_hidden_cmd
);
11069 install_element (BGP_VPNV4_NODE
, &neighbor_set_peer_group_hidden_cmd
);
11070 install_element (BGP_VPNV6_NODE
, &neighbor_set_peer_group_hidden_cmd
);
11072 /* "no neighbor peer-group unset" commands. */
11073 install_element (BGP_NODE
, &no_neighbor_set_peer_group_cmd
);
11074 install_element (BGP_IPV4_NODE
, &no_neighbor_set_peer_group_hidden_cmd
);
11075 install_element (BGP_IPV4M_NODE
, &no_neighbor_set_peer_group_hidden_cmd
);
11076 install_element (BGP_IPV6_NODE
, &no_neighbor_set_peer_group_hidden_cmd
);
11077 install_element (BGP_IPV6M_NODE
, &no_neighbor_set_peer_group_hidden_cmd
);
11078 install_element (BGP_IPV6L_NODE
, &no_neighbor_set_peer_group_hidden_cmd
);
11079 install_element (BGP_VPNV4_NODE
, &no_neighbor_set_peer_group_hidden_cmd
);
11080 install_element (BGP_VPNV6_NODE
, &no_neighbor_set_peer_group_hidden_cmd
);
11082 /* "neighbor softreconfiguration inbound" commands.*/
11083 install_element (BGP_NODE
, &neighbor_soft_reconfiguration_hidden_cmd
);
11084 install_element (BGP_NODE
, &no_neighbor_soft_reconfiguration_hidden_cmd
);
11085 install_element (BGP_IPV4_NODE
, &neighbor_soft_reconfiguration_cmd
);
11086 install_element (BGP_IPV4_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
11087 install_element (BGP_IPV4L_NODE
, &neighbor_soft_reconfiguration_cmd
);
11088 install_element (BGP_IPV4L_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
11089 install_element (BGP_IPV4M_NODE
, &neighbor_soft_reconfiguration_cmd
);
11090 install_element (BGP_IPV4M_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
11091 install_element (BGP_IPV6_NODE
, &neighbor_soft_reconfiguration_cmd
);
11092 install_element (BGP_IPV6_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
11093 install_element (BGP_IPV6M_NODE
, &neighbor_soft_reconfiguration_cmd
);
11094 install_element (BGP_IPV6M_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
11095 install_element (BGP_IPV6L_NODE
, &neighbor_soft_reconfiguration_cmd
);
11096 install_element (BGP_IPV6L_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
11097 install_element (BGP_VPNV4_NODE
, &neighbor_soft_reconfiguration_cmd
);
11098 install_element (BGP_VPNV4_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
11099 install_element (BGP_VPNV6_NODE
, &neighbor_soft_reconfiguration_cmd
);
11100 install_element (BGP_VPNV6_NODE
, &no_neighbor_soft_reconfiguration_cmd
);
11102 /* "neighbor attribute-unchanged" commands. */
11103 install_element (BGP_NODE
, &neighbor_attr_unchanged_hidden_cmd
);
11104 install_element (BGP_NODE
, &no_neighbor_attr_unchanged_hidden_cmd
);
11105 install_element (BGP_IPV4_NODE
, &neighbor_attr_unchanged_cmd
);
11106 install_element (BGP_IPV4_NODE
, &no_neighbor_attr_unchanged_cmd
);
11107 install_element (BGP_IPV4M_NODE
, &neighbor_attr_unchanged_cmd
);
11108 install_element (BGP_IPV4M_NODE
, &no_neighbor_attr_unchanged_cmd
);
11109 install_element (BGP_IPV4L_NODE
, &neighbor_attr_unchanged_cmd
);
11110 install_element (BGP_IPV4L_NODE
, &no_neighbor_attr_unchanged_cmd
);
11111 install_element (BGP_IPV6_NODE
, &neighbor_attr_unchanged_cmd
);
11112 install_element (BGP_IPV6_NODE
, &no_neighbor_attr_unchanged_cmd
);
11113 install_element (BGP_IPV6M_NODE
, &neighbor_attr_unchanged_cmd
);
11114 install_element (BGP_IPV6M_NODE
, &no_neighbor_attr_unchanged_cmd
);
11115 install_element (BGP_IPV6L_NODE
, &neighbor_attr_unchanged_cmd
);
11116 install_element (BGP_IPV6L_NODE
, &no_neighbor_attr_unchanged_cmd
);
11117 install_element (BGP_VPNV4_NODE
, &neighbor_attr_unchanged_cmd
);
11118 install_element (BGP_VPNV4_NODE
, &no_neighbor_attr_unchanged_cmd
);
11119 install_element (BGP_VPNV6_NODE
, &neighbor_attr_unchanged_cmd
);
11120 install_element (BGP_VPNV6_NODE
, &no_neighbor_attr_unchanged_cmd
);
11122 install_element (BGP_EVPN_NODE
, &neighbor_attr_unchanged_cmd
);
11123 install_element (BGP_EVPN_NODE
, &no_neighbor_attr_unchanged_cmd
);
11125 /* "nexthop-local unchanged" commands */
11126 install_element (BGP_IPV6_NODE
, &neighbor_nexthop_local_unchanged_cmd
);
11127 install_element (BGP_IPV6_NODE
, &no_neighbor_nexthop_local_unchanged_cmd
);
11129 /* "neighbor next-hop-self" commands. */
11130 install_element (BGP_NODE
, &neighbor_nexthop_self_hidden_cmd
);
11131 install_element (BGP_NODE
, &no_neighbor_nexthop_self_hidden_cmd
);
11132 install_element (BGP_IPV4_NODE
, &neighbor_nexthop_self_cmd
);
11133 install_element (BGP_IPV4_NODE
, &no_neighbor_nexthop_self_cmd
);
11134 install_element (BGP_IPV4M_NODE
, &neighbor_nexthop_self_cmd
);
11135 install_element (BGP_IPV4M_NODE
, &no_neighbor_nexthop_self_cmd
);
11136 install_element (BGP_IPV4L_NODE
, &neighbor_nexthop_self_cmd
);
11137 install_element (BGP_IPV4L_NODE
, &no_neighbor_nexthop_self_cmd
);
11138 install_element (BGP_IPV6_NODE
, &neighbor_nexthop_self_cmd
);
11139 install_element (BGP_IPV6_NODE
, &no_neighbor_nexthop_self_cmd
);
11140 install_element (BGP_IPV6M_NODE
, &neighbor_nexthop_self_cmd
);
11141 install_element (BGP_IPV6M_NODE
, &no_neighbor_nexthop_self_cmd
);
11142 install_element (BGP_IPV6L_NODE
, &neighbor_nexthop_self_cmd
);
11143 install_element (BGP_IPV6L_NODE
, &no_neighbor_nexthop_self_cmd
);
11144 install_element (BGP_VPNV4_NODE
, &neighbor_nexthop_self_cmd
);
11145 install_element (BGP_VPNV4_NODE
, &no_neighbor_nexthop_self_cmd
);
11146 install_element (BGP_VPNV6_NODE
, &neighbor_nexthop_self_cmd
);
11147 install_element (BGP_VPNV6_NODE
, &no_neighbor_nexthop_self_cmd
);
11149 /* "neighbor next-hop-self force" commands. */
11150 install_element (BGP_NODE
, &neighbor_nexthop_self_force_hidden_cmd
);
11151 install_element (BGP_NODE
, &no_neighbor_nexthop_self_force_hidden_cmd
);
11152 install_element (BGP_IPV4_NODE
, &neighbor_nexthop_self_force_cmd
);
11153 install_element (BGP_IPV4_NODE
, &no_neighbor_nexthop_self_force_cmd
);
11154 install_element (BGP_IPV4M_NODE
, &neighbor_nexthop_self_force_cmd
);
11155 install_element (BGP_IPV4M_NODE
, &no_neighbor_nexthop_self_force_cmd
);
11156 install_element (BGP_IPV4L_NODE
, &neighbor_nexthop_self_force_cmd
);
11157 install_element (BGP_IPV4L_NODE
, &no_neighbor_nexthop_self_force_cmd
);
11158 install_element (BGP_IPV6_NODE
, &neighbor_nexthop_self_force_cmd
);
11159 install_element (BGP_IPV6_NODE
, &no_neighbor_nexthop_self_force_cmd
);
11160 install_element (BGP_IPV6M_NODE
, &neighbor_nexthop_self_force_cmd
);
11161 install_element (BGP_IPV6M_NODE
, &no_neighbor_nexthop_self_force_cmd
);
11162 install_element (BGP_IPV6L_NODE
, &neighbor_nexthop_self_force_cmd
);
11163 install_element (BGP_IPV6L_NODE
, &no_neighbor_nexthop_self_force_cmd
);
11164 install_element (BGP_VPNV4_NODE
, &neighbor_nexthop_self_force_cmd
);
11165 install_element (BGP_VPNV4_NODE
, &no_neighbor_nexthop_self_force_cmd
);
11166 install_element (BGP_VPNV6_NODE
, &neighbor_nexthop_self_force_cmd
);
11167 install_element (BGP_VPNV6_NODE
, &no_neighbor_nexthop_self_force_cmd
);
11169 /* "neighbor as-override" commands. */
11170 install_element (BGP_NODE
, &neighbor_as_override_hidden_cmd
);
11171 install_element (BGP_NODE
, &no_neighbor_as_override_hidden_cmd
);
11172 install_element (BGP_IPV4_NODE
, &neighbor_as_override_cmd
);
11173 install_element (BGP_IPV4_NODE
, &no_neighbor_as_override_cmd
);
11174 install_element (BGP_IPV4M_NODE
, &neighbor_as_override_cmd
);
11175 install_element (BGP_IPV4M_NODE
, &no_neighbor_as_override_cmd
);
11176 install_element (BGP_IPV4L_NODE
, &neighbor_as_override_cmd
);
11177 install_element (BGP_IPV4L_NODE
, &no_neighbor_as_override_cmd
);
11178 install_element (BGP_IPV6_NODE
, &neighbor_as_override_cmd
);
11179 install_element (BGP_IPV6_NODE
, &no_neighbor_as_override_cmd
);
11180 install_element (BGP_IPV6M_NODE
, &neighbor_as_override_cmd
);
11181 install_element (BGP_IPV6M_NODE
, &no_neighbor_as_override_cmd
);
11182 install_element (BGP_IPV6L_NODE
, &neighbor_as_override_cmd
);
11183 install_element (BGP_IPV6L_NODE
, &no_neighbor_as_override_cmd
);
11184 install_element (BGP_VPNV4_NODE
, &neighbor_as_override_cmd
);
11185 install_element (BGP_VPNV4_NODE
, &no_neighbor_as_override_cmd
);
11186 install_element (BGP_VPNV6_NODE
, &neighbor_as_override_cmd
);
11187 install_element (BGP_VPNV6_NODE
, &no_neighbor_as_override_cmd
);
11189 /* "neighbor remove-private-AS" commands. */
11190 install_element (BGP_NODE
, &neighbor_remove_private_as_hidden_cmd
);
11191 install_element (BGP_NODE
, &no_neighbor_remove_private_as_hidden_cmd
);
11192 install_element (BGP_NODE
, &neighbor_remove_private_as_all_hidden_cmd
);
11193 install_element (BGP_NODE
, &no_neighbor_remove_private_as_all_hidden_cmd
);
11194 install_element (BGP_NODE
, &neighbor_remove_private_as_replace_as_hidden_cmd
);
11195 install_element (BGP_NODE
, &no_neighbor_remove_private_as_replace_as_hidden_cmd
);
11196 install_element (BGP_NODE
, &neighbor_remove_private_as_all_replace_as_hidden_cmd
);
11197 install_element (BGP_NODE
, &no_neighbor_remove_private_as_all_replace_as_hidden_cmd
);
11198 install_element (BGP_IPV4_NODE
, &neighbor_remove_private_as_cmd
);
11199 install_element (BGP_IPV4_NODE
, &no_neighbor_remove_private_as_cmd
);
11200 install_element (BGP_IPV4_NODE
, &neighbor_remove_private_as_all_cmd
);
11201 install_element (BGP_IPV4_NODE
, &no_neighbor_remove_private_as_all_cmd
);
11202 install_element (BGP_IPV4_NODE
, &neighbor_remove_private_as_replace_as_cmd
);
11203 install_element (BGP_IPV4_NODE
, &no_neighbor_remove_private_as_replace_as_cmd
);
11204 install_element (BGP_IPV4_NODE
, &neighbor_remove_private_as_all_replace_as_cmd
);
11205 install_element (BGP_IPV4_NODE
, &no_neighbor_remove_private_as_all_replace_as_cmd
);
11206 install_element (BGP_IPV4M_NODE
, &neighbor_remove_private_as_cmd
);
11207 install_element (BGP_IPV4M_NODE
, &no_neighbor_remove_private_as_cmd
);
11208 install_element (BGP_IPV4M_NODE
, &neighbor_remove_private_as_all_cmd
);
11209 install_element (BGP_IPV4M_NODE
, &no_neighbor_remove_private_as_all_cmd
);
11210 install_element (BGP_IPV4M_NODE
, &neighbor_remove_private_as_replace_as_cmd
);
11211 install_element (BGP_IPV4M_NODE
, &no_neighbor_remove_private_as_replace_as_cmd
);
11212 install_element (BGP_IPV4M_NODE
, &neighbor_remove_private_as_all_replace_as_cmd
);
11213 install_element (BGP_IPV4M_NODE
, &no_neighbor_remove_private_as_all_replace_as_cmd
);
11214 install_element (BGP_IPV4L_NODE
, &neighbor_remove_private_as_cmd
);
11215 install_element (BGP_IPV4L_NODE
, &no_neighbor_remove_private_as_cmd
);
11216 install_element (BGP_IPV4L_NODE
, &neighbor_remove_private_as_all_cmd
);
11217 install_element (BGP_IPV4L_NODE
, &no_neighbor_remove_private_as_all_cmd
);
11218 install_element (BGP_IPV4L_NODE
, &neighbor_remove_private_as_replace_as_cmd
);
11219 install_element (BGP_IPV4L_NODE
, &no_neighbor_remove_private_as_replace_as_cmd
);
11220 install_element (BGP_IPV4L_NODE
, &neighbor_remove_private_as_all_replace_as_cmd
);
11221 install_element (BGP_IPV4L_NODE
, &no_neighbor_remove_private_as_all_replace_as_cmd
);
11222 install_element (BGP_IPV6_NODE
, &neighbor_remove_private_as_cmd
);
11223 install_element (BGP_IPV6_NODE
, &no_neighbor_remove_private_as_cmd
);
11224 install_element (BGP_IPV6_NODE
, &neighbor_remove_private_as_all_cmd
);
11225 install_element (BGP_IPV6_NODE
, &no_neighbor_remove_private_as_all_cmd
);
11226 install_element (BGP_IPV6_NODE
, &neighbor_remove_private_as_replace_as_cmd
);
11227 install_element (BGP_IPV6_NODE
, &no_neighbor_remove_private_as_replace_as_cmd
);
11228 install_element (BGP_IPV6_NODE
, &neighbor_remove_private_as_all_replace_as_cmd
);
11229 install_element (BGP_IPV6_NODE
, &no_neighbor_remove_private_as_all_replace_as_cmd
);
11230 install_element (BGP_IPV6M_NODE
, &neighbor_remove_private_as_cmd
);
11231 install_element (BGP_IPV6M_NODE
, &no_neighbor_remove_private_as_cmd
);
11232 install_element (BGP_IPV6M_NODE
, &neighbor_remove_private_as_all_cmd
);
11233 install_element (BGP_IPV6M_NODE
, &no_neighbor_remove_private_as_all_cmd
);
11234 install_element (BGP_IPV6M_NODE
, &neighbor_remove_private_as_replace_as_cmd
);
11235 install_element (BGP_IPV6M_NODE
, &no_neighbor_remove_private_as_replace_as_cmd
);
11236 install_element (BGP_IPV6M_NODE
, &neighbor_remove_private_as_all_replace_as_cmd
);
11237 install_element (BGP_IPV6M_NODE
, &no_neighbor_remove_private_as_all_replace_as_cmd
);
11238 install_element (BGP_IPV6L_NODE
, &neighbor_remove_private_as_cmd
);
11239 install_element (BGP_IPV6L_NODE
, &no_neighbor_remove_private_as_cmd
);
11240 install_element (BGP_IPV6L_NODE
, &neighbor_remove_private_as_all_cmd
);
11241 install_element (BGP_IPV6L_NODE
, &no_neighbor_remove_private_as_all_cmd
);
11242 install_element (BGP_IPV6L_NODE
, &neighbor_remove_private_as_replace_as_cmd
);
11243 install_element (BGP_IPV6L_NODE
, &no_neighbor_remove_private_as_replace_as_cmd
);
11244 install_element (BGP_IPV6L_NODE
, &neighbor_remove_private_as_all_replace_as_cmd
);
11245 install_element (BGP_IPV6L_NODE
, &no_neighbor_remove_private_as_all_replace_as_cmd
);
11246 install_element (BGP_VPNV4_NODE
, &neighbor_remove_private_as_cmd
);
11247 install_element (BGP_VPNV4_NODE
, &no_neighbor_remove_private_as_cmd
);
11248 install_element (BGP_VPNV4_NODE
, &neighbor_remove_private_as_all_cmd
);
11249 install_element (BGP_VPNV4_NODE
, &no_neighbor_remove_private_as_all_cmd
);
11250 install_element (BGP_VPNV4_NODE
, &neighbor_remove_private_as_replace_as_cmd
);
11251 install_element (BGP_VPNV4_NODE
, &no_neighbor_remove_private_as_replace_as_cmd
);
11252 install_element (BGP_VPNV4_NODE
, &neighbor_remove_private_as_all_replace_as_cmd
);
11253 install_element (BGP_VPNV4_NODE
, &no_neighbor_remove_private_as_all_replace_as_cmd
);
11254 install_element (BGP_VPNV6_NODE
, &neighbor_remove_private_as_cmd
);
11255 install_element (BGP_VPNV6_NODE
, &no_neighbor_remove_private_as_cmd
);
11256 install_element (BGP_VPNV6_NODE
, &neighbor_remove_private_as_all_cmd
);
11257 install_element (BGP_VPNV6_NODE
, &no_neighbor_remove_private_as_all_cmd
);
11258 install_element (BGP_VPNV6_NODE
, &neighbor_remove_private_as_replace_as_cmd
);
11259 install_element (BGP_VPNV6_NODE
, &no_neighbor_remove_private_as_replace_as_cmd
);
11260 install_element (BGP_VPNV6_NODE
, &neighbor_remove_private_as_all_replace_as_cmd
);
11261 install_element (BGP_VPNV6_NODE
, &no_neighbor_remove_private_as_all_replace_as_cmd
);
11263 /* "neighbor send-community" commands.*/
11264 install_element (BGP_NODE
, &neighbor_send_community_hidden_cmd
);
11265 install_element (BGP_NODE
, &neighbor_send_community_type_hidden_cmd
);
11266 install_element (BGP_NODE
, &no_neighbor_send_community_hidden_cmd
);
11267 install_element (BGP_NODE
, &no_neighbor_send_community_type_hidden_cmd
);
11268 install_element (BGP_IPV4_NODE
, &neighbor_send_community_cmd
);
11269 install_element (BGP_IPV4_NODE
, &neighbor_send_community_type_cmd
);
11270 install_element (BGP_IPV4_NODE
, &no_neighbor_send_community_cmd
);
11271 install_element (BGP_IPV4_NODE
, &no_neighbor_send_community_type_cmd
);
11272 install_element (BGP_IPV4M_NODE
, &neighbor_send_community_cmd
);
11273 install_element (BGP_IPV4M_NODE
, &neighbor_send_community_type_cmd
);
11274 install_element (BGP_IPV4M_NODE
, &no_neighbor_send_community_cmd
);
11275 install_element (BGP_IPV4M_NODE
, &no_neighbor_send_community_type_cmd
);
11276 install_element (BGP_IPV4L_NODE
, &neighbor_send_community_cmd
);
11277 install_element (BGP_IPV4L_NODE
, &neighbor_send_community_type_cmd
);
11278 install_element (BGP_IPV4L_NODE
, &no_neighbor_send_community_cmd
);
11279 install_element (BGP_IPV4L_NODE
, &no_neighbor_send_community_type_cmd
);
11280 install_element (BGP_IPV6_NODE
, &neighbor_send_community_cmd
);
11281 install_element (BGP_IPV6_NODE
, &neighbor_send_community_type_cmd
);
11282 install_element (BGP_IPV6_NODE
, &no_neighbor_send_community_cmd
);
11283 install_element (BGP_IPV6_NODE
, &no_neighbor_send_community_type_cmd
);
11284 install_element (BGP_IPV6M_NODE
, &neighbor_send_community_cmd
);
11285 install_element (BGP_IPV6M_NODE
, &neighbor_send_community_type_cmd
);
11286 install_element (BGP_IPV6M_NODE
, &no_neighbor_send_community_cmd
);
11287 install_element (BGP_IPV6M_NODE
, &no_neighbor_send_community_type_cmd
);
11288 install_element (BGP_IPV6L_NODE
, &neighbor_send_community_cmd
);
11289 install_element (BGP_IPV6L_NODE
, &neighbor_send_community_type_cmd
);
11290 install_element (BGP_IPV6L_NODE
, &no_neighbor_send_community_cmd
);
11291 install_element (BGP_IPV6L_NODE
, &no_neighbor_send_community_type_cmd
);
11292 install_element (BGP_VPNV4_NODE
, &neighbor_send_community_cmd
);
11293 install_element (BGP_VPNV4_NODE
, &neighbor_send_community_type_cmd
);
11294 install_element (BGP_VPNV4_NODE
, &no_neighbor_send_community_cmd
);
11295 install_element (BGP_VPNV4_NODE
, &no_neighbor_send_community_type_cmd
);
11296 install_element (BGP_VPNV6_NODE
, &neighbor_send_community_cmd
);
11297 install_element (BGP_VPNV6_NODE
, &neighbor_send_community_type_cmd
);
11298 install_element (BGP_VPNV6_NODE
, &no_neighbor_send_community_cmd
);
11299 install_element (BGP_VPNV6_NODE
, &no_neighbor_send_community_type_cmd
);
11301 /* "neighbor route-reflector" commands.*/
11302 install_element (BGP_NODE
, &neighbor_route_reflector_client_hidden_cmd
);
11303 install_element (BGP_NODE
, &no_neighbor_route_reflector_client_hidden_cmd
);
11304 install_element (BGP_IPV4_NODE
, &neighbor_route_reflector_client_cmd
);
11305 install_element (BGP_IPV4_NODE
, &no_neighbor_route_reflector_client_cmd
);
11306 install_element (BGP_IPV4M_NODE
, &neighbor_route_reflector_client_cmd
);
11307 install_element (BGP_IPV4M_NODE
, &no_neighbor_route_reflector_client_cmd
);
11308 install_element (BGP_IPV4L_NODE
, &neighbor_route_reflector_client_cmd
);
11309 install_element (BGP_IPV4L_NODE
, &no_neighbor_route_reflector_client_cmd
);
11310 install_element (BGP_IPV6_NODE
, &neighbor_route_reflector_client_cmd
);
11311 install_element (BGP_IPV6_NODE
, &no_neighbor_route_reflector_client_cmd
);
11312 install_element (BGP_IPV6M_NODE
, &neighbor_route_reflector_client_cmd
);
11313 install_element (BGP_IPV6M_NODE
, &no_neighbor_route_reflector_client_cmd
);
11314 install_element (BGP_IPV6L_NODE
, &neighbor_route_reflector_client_cmd
);
11315 install_element (BGP_IPV6L_NODE
, &no_neighbor_route_reflector_client_cmd
);
11316 install_element (BGP_VPNV4_NODE
, &neighbor_route_reflector_client_cmd
);
11317 install_element (BGP_VPNV4_NODE
, &no_neighbor_route_reflector_client_cmd
);
11318 install_element (BGP_VPNV6_NODE
, &neighbor_route_reflector_client_cmd
);
11319 install_element (BGP_VPNV6_NODE
, &no_neighbor_route_reflector_client_cmd
);
11320 install_element (BGP_EVPN_NODE
, &neighbor_route_reflector_client_cmd
);
11321 install_element (BGP_EVPN_NODE
, &no_neighbor_route_reflector_client_cmd
);
11323 /* "neighbor route-server" commands.*/
11324 install_element (BGP_NODE
, &neighbor_route_server_client_hidden_cmd
);
11325 install_element (BGP_NODE
, &no_neighbor_route_server_client_hidden_cmd
);
11326 install_element (BGP_IPV4_NODE
, &neighbor_route_server_client_cmd
);
11327 install_element (BGP_IPV4_NODE
, &no_neighbor_route_server_client_cmd
);
11328 install_element (BGP_IPV4M_NODE
, &neighbor_route_server_client_cmd
);
11329 install_element (BGP_IPV4M_NODE
, &no_neighbor_route_server_client_cmd
);
11330 install_element (BGP_IPV4L_NODE
, &neighbor_route_server_client_cmd
);
11331 install_element (BGP_IPV4L_NODE
, &no_neighbor_route_server_client_cmd
);
11332 install_element (BGP_IPV6_NODE
, &neighbor_route_server_client_cmd
);
11333 install_element (BGP_IPV6_NODE
, &no_neighbor_route_server_client_cmd
);
11334 install_element (BGP_IPV6M_NODE
, &neighbor_route_server_client_cmd
);
11335 install_element (BGP_IPV6M_NODE
, &no_neighbor_route_server_client_cmd
);
11336 install_element (BGP_IPV6L_NODE
, &neighbor_route_server_client_cmd
);
11337 install_element (BGP_IPV6L_NODE
, &no_neighbor_route_server_client_cmd
);
11338 install_element (BGP_VPNV4_NODE
, &neighbor_route_server_client_cmd
);
11339 install_element (BGP_VPNV4_NODE
, &no_neighbor_route_server_client_cmd
);
11340 install_element (BGP_VPNV6_NODE
, &neighbor_route_server_client_cmd
);
11341 install_element (BGP_VPNV6_NODE
, &no_neighbor_route_server_client_cmd
);
11343 /* "neighbor addpath-tx-all-paths" commands.*/
11344 install_element (BGP_NODE
, &neighbor_addpath_tx_all_paths_hidden_cmd
);
11345 install_element (BGP_NODE
, &no_neighbor_addpath_tx_all_paths_hidden_cmd
);
11346 install_element (BGP_IPV4_NODE
, &neighbor_addpath_tx_all_paths_cmd
);
11347 install_element (BGP_IPV4_NODE
, &no_neighbor_addpath_tx_all_paths_cmd
);
11348 install_element (BGP_IPV4M_NODE
, &neighbor_addpath_tx_all_paths_cmd
);
11349 install_element (BGP_IPV4M_NODE
, &no_neighbor_addpath_tx_all_paths_cmd
);
11350 install_element (BGP_IPV4L_NODE
, &neighbor_addpath_tx_all_paths_cmd
);
11351 install_element (BGP_IPV4L_NODE
, &no_neighbor_addpath_tx_all_paths_cmd
);
11352 install_element (BGP_IPV6_NODE
, &neighbor_addpath_tx_all_paths_cmd
);
11353 install_element (BGP_IPV6_NODE
, &no_neighbor_addpath_tx_all_paths_cmd
);
11354 install_element (BGP_IPV6M_NODE
, &neighbor_addpath_tx_all_paths_cmd
);
11355 install_element (BGP_IPV6M_NODE
, &no_neighbor_addpath_tx_all_paths_cmd
);
11356 install_element (BGP_IPV6L_NODE
, &neighbor_addpath_tx_all_paths_cmd
);
11357 install_element (BGP_IPV6L_NODE
, &no_neighbor_addpath_tx_all_paths_cmd
);
11358 install_element (BGP_VPNV4_NODE
, &neighbor_addpath_tx_all_paths_cmd
);
11359 install_element (BGP_VPNV4_NODE
, &no_neighbor_addpath_tx_all_paths_cmd
);
11360 install_element (BGP_VPNV6_NODE
, &neighbor_addpath_tx_all_paths_cmd
);
11361 install_element (BGP_VPNV6_NODE
, &no_neighbor_addpath_tx_all_paths_cmd
);
11363 /* "neighbor addpath-tx-bestpath-per-AS" commands.*/
11364 install_element (BGP_NODE
, &neighbor_addpath_tx_bestpath_per_as_hidden_cmd
);
11365 install_element (BGP_NODE
, &no_neighbor_addpath_tx_bestpath_per_as_hidden_cmd
);
11366 install_element (BGP_IPV4_NODE
, &neighbor_addpath_tx_bestpath_per_as_cmd
);
11367 install_element (BGP_IPV4_NODE
, &no_neighbor_addpath_tx_bestpath_per_as_cmd
);
11368 install_element (BGP_IPV4M_NODE
, &neighbor_addpath_tx_bestpath_per_as_cmd
);
11369 install_element (BGP_IPV4M_NODE
, &no_neighbor_addpath_tx_bestpath_per_as_cmd
);
11370 install_element (BGP_IPV4L_NODE
, &neighbor_addpath_tx_bestpath_per_as_cmd
);
11371 install_element (BGP_IPV4L_NODE
, &no_neighbor_addpath_tx_bestpath_per_as_cmd
);
11372 install_element (BGP_IPV6_NODE
, &neighbor_addpath_tx_bestpath_per_as_cmd
);
11373 install_element (BGP_IPV6_NODE
, &no_neighbor_addpath_tx_bestpath_per_as_cmd
);
11374 install_element (BGP_IPV6M_NODE
, &neighbor_addpath_tx_bestpath_per_as_cmd
);
11375 install_element (BGP_IPV6M_NODE
, &no_neighbor_addpath_tx_bestpath_per_as_cmd
);
11376 install_element (BGP_IPV6L_NODE
, &neighbor_addpath_tx_bestpath_per_as_cmd
);
11377 install_element (BGP_IPV6L_NODE
, &no_neighbor_addpath_tx_bestpath_per_as_cmd
);
11378 install_element (BGP_VPNV4_NODE
, &neighbor_addpath_tx_bestpath_per_as_cmd
);
11379 install_element (BGP_VPNV4_NODE
, &no_neighbor_addpath_tx_bestpath_per_as_cmd
);
11380 install_element (BGP_VPNV6_NODE
, &neighbor_addpath_tx_bestpath_per_as_cmd
);
11381 install_element (BGP_VPNV6_NODE
, &no_neighbor_addpath_tx_bestpath_per_as_cmd
);
11383 /* "neighbor passive" commands. */
11384 install_element (BGP_NODE
, &neighbor_passive_cmd
);
11385 install_element (BGP_NODE
, &no_neighbor_passive_cmd
);
11388 /* "neighbor shutdown" commands. */
11389 install_element (BGP_NODE
, &neighbor_shutdown_cmd
);
11390 install_element (BGP_NODE
, &no_neighbor_shutdown_cmd
);
11391 install_element (BGP_NODE
, &neighbor_shutdown_msg_cmd
);
11392 install_element (BGP_NODE
, &no_neighbor_shutdown_msg_cmd
);
11394 /* "neighbor capability extended-nexthop" commands.*/
11395 install_element (BGP_NODE
, &neighbor_capability_enhe_cmd
);
11396 install_element (BGP_NODE
, &no_neighbor_capability_enhe_cmd
);
11398 /* "neighbor capability orf prefix-list" commands.*/
11399 install_element (BGP_NODE
, &neighbor_capability_orf_prefix_hidden_cmd
);
11400 install_element (BGP_NODE
, &no_neighbor_capability_orf_prefix_hidden_cmd
);
11401 install_element (BGP_IPV4_NODE
, &neighbor_capability_orf_prefix_cmd
);
11402 install_element (BGP_IPV4_NODE
, &no_neighbor_capability_orf_prefix_cmd
);
11403 install_element (BGP_IPV4M_NODE
, &neighbor_capability_orf_prefix_cmd
);
11404 install_element (BGP_IPV4M_NODE
, &no_neighbor_capability_orf_prefix_cmd
);
11405 install_element (BGP_IPV4L_NODE
, &neighbor_capability_orf_prefix_cmd
);
11406 install_element (BGP_IPV4L_NODE
, &no_neighbor_capability_orf_prefix_cmd
);
11407 install_element (BGP_IPV6_NODE
, &neighbor_capability_orf_prefix_cmd
);
11408 install_element (BGP_IPV6_NODE
, &no_neighbor_capability_orf_prefix_cmd
);
11409 install_element (BGP_IPV6M_NODE
, &neighbor_capability_orf_prefix_cmd
);
11410 install_element (BGP_IPV6M_NODE
, &no_neighbor_capability_orf_prefix_cmd
);
11411 install_element (BGP_IPV6L_NODE
, &neighbor_capability_orf_prefix_cmd
);
11412 install_element (BGP_IPV6L_NODE
, &no_neighbor_capability_orf_prefix_cmd
);
11414 /* "neighbor capability dynamic" commands.*/
11415 install_element (BGP_NODE
, &neighbor_capability_dynamic_cmd
);
11416 install_element (BGP_NODE
, &no_neighbor_capability_dynamic_cmd
);
11418 /* "neighbor dont-capability-negotiate" commands. */
11419 install_element (BGP_NODE
, &neighbor_dont_capability_negotiate_cmd
);
11420 install_element (BGP_NODE
, &no_neighbor_dont_capability_negotiate_cmd
);
11422 /* "neighbor ebgp-multihop" commands. */
11423 install_element (BGP_NODE
, &neighbor_ebgp_multihop_cmd
);
11424 install_element (BGP_NODE
, &neighbor_ebgp_multihop_ttl_cmd
);
11425 install_element (BGP_NODE
, &no_neighbor_ebgp_multihop_cmd
);
11427 /* "neighbor disable-connected-check" commands. */
11428 install_element (BGP_NODE
, &neighbor_disable_connected_check_cmd
);
11429 install_element (BGP_NODE
, &no_neighbor_disable_connected_check_cmd
);
11431 /* "neighbor description" commands. */
11432 install_element (BGP_NODE
, &neighbor_description_cmd
);
11433 install_element (BGP_NODE
, &no_neighbor_description_cmd
);
11435 /* "neighbor update-source" commands. "*/
11436 install_element (BGP_NODE
, &neighbor_update_source_cmd
);
11437 install_element (BGP_NODE
, &no_neighbor_update_source_cmd
);
11439 /* "neighbor default-originate" commands. */
11440 install_element (BGP_NODE
, &neighbor_default_originate_hidden_cmd
);
11441 install_element (BGP_NODE
, &neighbor_default_originate_rmap_hidden_cmd
);
11442 install_element (BGP_NODE
, &no_neighbor_default_originate_hidden_cmd
);
11443 install_element (BGP_IPV4_NODE
, &neighbor_default_originate_cmd
);
11444 install_element (BGP_IPV4_NODE
, &neighbor_default_originate_rmap_cmd
);
11445 install_element (BGP_IPV4_NODE
, &no_neighbor_default_originate_cmd
);
11446 install_element (BGP_IPV4M_NODE
, &neighbor_default_originate_cmd
);
11447 install_element (BGP_IPV4M_NODE
, &neighbor_default_originate_rmap_cmd
);
11448 install_element (BGP_IPV4M_NODE
, &no_neighbor_default_originate_cmd
);
11449 install_element (BGP_IPV4L_NODE
, &neighbor_default_originate_cmd
);
11450 install_element (BGP_IPV4L_NODE
, &neighbor_default_originate_rmap_cmd
);
11451 install_element (BGP_IPV4L_NODE
, &no_neighbor_default_originate_cmd
);
11452 install_element (BGP_IPV6_NODE
, &neighbor_default_originate_cmd
);
11453 install_element (BGP_IPV6_NODE
, &neighbor_default_originate_rmap_cmd
);
11454 install_element (BGP_IPV6_NODE
, &no_neighbor_default_originate_cmd
);
11455 install_element (BGP_IPV6M_NODE
, &neighbor_default_originate_cmd
);
11456 install_element (BGP_IPV6M_NODE
, &neighbor_default_originate_rmap_cmd
);
11457 install_element (BGP_IPV6M_NODE
, &no_neighbor_default_originate_cmd
);
11458 install_element (BGP_IPV6L_NODE
, &neighbor_default_originate_cmd
);
11459 install_element (BGP_IPV6L_NODE
, &neighbor_default_originate_rmap_cmd
);
11460 install_element (BGP_IPV6L_NODE
, &no_neighbor_default_originate_cmd
);
11462 /* "neighbor port" commands. */
11463 install_element (BGP_NODE
, &neighbor_port_cmd
);
11464 install_element (BGP_NODE
, &no_neighbor_port_cmd
);
11466 /* "neighbor weight" commands. */
11467 install_element (BGP_NODE
, &neighbor_weight_hidden_cmd
);
11468 install_element (BGP_NODE
, &no_neighbor_weight_hidden_cmd
);
11470 install_element (BGP_IPV4_NODE
, &neighbor_weight_cmd
);
11471 install_element (BGP_IPV4_NODE
, &no_neighbor_weight_cmd
);
11472 install_element (BGP_IPV4M_NODE
, &neighbor_weight_cmd
);
11473 install_element (BGP_IPV4M_NODE
, &no_neighbor_weight_cmd
);
11474 install_element (BGP_IPV4L_NODE
, &neighbor_weight_cmd
);
11475 install_element (BGP_IPV4L_NODE
, &no_neighbor_weight_cmd
);
11476 install_element (BGP_IPV6_NODE
, &neighbor_weight_cmd
);
11477 install_element (BGP_IPV6_NODE
, &no_neighbor_weight_cmd
);
11478 install_element (BGP_IPV6M_NODE
, &neighbor_weight_cmd
);
11479 install_element (BGP_IPV6M_NODE
, &no_neighbor_weight_cmd
);
11480 install_element (BGP_IPV6L_NODE
, &neighbor_weight_cmd
);
11481 install_element (BGP_IPV6L_NODE
, &no_neighbor_weight_cmd
);
11482 install_element (BGP_VPNV4_NODE
, &neighbor_weight_cmd
);
11483 install_element (BGP_VPNV4_NODE
, &no_neighbor_weight_cmd
);
11484 install_element (BGP_VPNV6_NODE
, &neighbor_weight_cmd
);
11485 install_element (BGP_VPNV6_NODE
, &no_neighbor_weight_cmd
);
11487 /* "neighbor override-capability" commands. */
11488 install_element (BGP_NODE
, &neighbor_override_capability_cmd
);
11489 install_element (BGP_NODE
, &no_neighbor_override_capability_cmd
);
11491 /* "neighbor strict-capability-match" commands. */
11492 install_element (BGP_NODE
, &neighbor_strict_capability_cmd
);
11493 install_element (BGP_NODE
, &no_neighbor_strict_capability_cmd
);
11495 /* "neighbor timers" commands. */
11496 install_element (BGP_NODE
, &neighbor_timers_cmd
);
11497 install_element (BGP_NODE
, &no_neighbor_timers_cmd
);
11499 /* "neighbor timers connect" commands. */
11500 install_element (BGP_NODE
, &neighbor_timers_connect_cmd
);
11501 install_element (BGP_NODE
, &no_neighbor_timers_connect_cmd
);
11503 /* "neighbor advertisement-interval" commands. */
11504 install_element (BGP_NODE
, &neighbor_advertise_interval_cmd
);
11505 install_element (BGP_NODE
, &no_neighbor_advertise_interval_cmd
);
11507 /* "neighbor interface" commands. */
11508 install_element (BGP_NODE
, &neighbor_interface_cmd
);
11509 install_element (BGP_NODE
, &no_neighbor_interface_cmd
);
11511 /* "neighbor distribute" commands. */
11512 install_element (BGP_NODE
, &neighbor_distribute_list_hidden_cmd
);
11513 install_element (BGP_NODE
, &no_neighbor_distribute_list_hidden_cmd
);
11514 install_element (BGP_IPV4_NODE
, &neighbor_distribute_list_cmd
);
11515 install_element (BGP_IPV4_NODE
, &no_neighbor_distribute_list_cmd
);
11516 install_element (BGP_IPV4M_NODE
, &neighbor_distribute_list_cmd
);
11517 install_element (BGP_IPV4M_NODE
, &no_neighbor_distribute_list_cmd
);
11518 install_element (BGP_IPV4L_NODE
, &neighbor_distribute_list_cmd
);
11519 install_element (BGP_IPV4L_NODE
, &no_neighbor_distribute_list_cmd
);
11520 install_element (BGP_IPV6_NODE
, &neighbor_distribute_list_cmd
);
11521 install_element (BGP_IPV6_NODE
, &no_neighbor_distribute_list_cmd
);
11522 install_element (BGP_IPV6M_NODE
, &neighbor_distribute_list_cmd
);
11523 install_element (BGP_IPV6M_NODE
, &no_neighbor_distribute_list_cmd
);
11524 install_element (BGP_IPV6L_NODE
, &neighbor_distribute_list_cmd
);
11525 install_element (BGP_IPV6L_NODE
, &no_neighbor_distribute_list_cmd
);
11526 install_element (BGP_VPNV4_NODE
, &neighbor_distribute_list_cmd
);
11527 install_element (BGP_VPNV4_NODE
, &no_neighbor_distribute_list_cmd
);
11528 install_element (BGP_VPNV6_NODE
, &neighbor_distribute_list_cmd
);
11529 install_element (BGP_VPNV6_NODE
, &no_neighbor_distribute_list_cmd
);
11531 /* "neighbor prefix-list" commands. */
11532 install_element (BGP_NODE
, &neighbor_prefix_list_hidden_cmd
);
11533 install_element (BGP_NODE
, &no_neighbor_prefix_list_hidden_cmd
);
11534 install_element (BGP_IPV4_NODE
, &neighbor_prefix_list_cmd
);
11535 install_element (BGP_IPV4_NODE
, &no_neighbor_prefix_list_cmd
);
11536 install_element (BGP_IPV4M_NODE
, &neighbor_prefix_list_cmd
);
11537 install_element (BGP_IPV4M_NODE
, &no_neighbor_prefix_list_cmd
);
11538 install_element (BGP_IPV4L_NODE
, &neighbor_prefix_list_cmd
);
11539 install_element (BGP_IPV4L_NODE
, &no_neighbor_prefix_list_cmd
);
11540 install_element (BGP_IPV6_NODE
, &neighbor_prefix_list_cmd
);
11541 install_element (BGP_IPV6_NODE
, &no_neighbor_prefix_list_cmd
);
11542 install_element (BGP_IPV6M_NODE
, &neighbor_prefix_list_cmd
);
11543 install_element (BGP_IPV6M_NODE
, &no_neighbor_prefix_list_cmd
);
11544 install_element (BGP_IPV6L_NODE
, &neighbor_prefix_list_cmd
);
11545 install_element (BGP_IPV6L_NODE
, &no_neighbor_prefix_list_cmd
);
11546 install_element (BGP_VPNV4_NODE
, &neighbor_prefix_list_cmd
);
11547 install_element (BGP_VPNV4_NODE
, &no_neighbor_prefix_list_cmd
);
11548 install_element (BGP_VPNV6_NODE
, &neighbor_prefix_list_cmd
);
11549 install_element (BGP_VPNV6_NODE
, &no_neighbor_prefix_list_cmd
);
11551 /* "neighbor filter-list" commands. */
11552 install_element (BGP_NODE
, &neighbor_filter_list_hidden_cmd
);
11553 install_element (BGP_NODE
, &no_neighbor_filter_list_hidden_cmd
);
11554 install_element (BGP_IPV4_NODE
, &neighbor_filter_list_cmd
);
11555 install_element (BGP_IPV4_NODE
, &no_neighbor_filter_list_cmd
);
11556 install_element (BGP_IPV4M_NODE
, &neighbor_filter_list_cmd
);
11557 install_element (BGP_IPV4M_NODE
, &no_neighbor_filter_list_cmd
);
11558 install_element (BGP_IPV4L_NODE
, &neighbor_filter_list_cmd
);
11559 install_element (BGP_IPV4L_NODE
, &no_neighbor_filter_list_cmd
);
11560 install_element (BGP_IPV6_NODE
, &neighbor_filter_list_cmd
);
11561 install_element (BGP_IPV6_NODE
, &no_neighbor_filter_list_cmd
);
11562 install_element (BGP_IPV6M_NODE
, &neighbor_filter_list_cmd
);
11563 install_element (BGP_IPV6M_NODE
, &no_neighbor_filter_list_cmd
);
11564 install_element (BGP_IPV6L_NODE
, &neighbor_filter_list_cmd
);
11565 install_element (BGP_IPV6L_NODE
, &no_neighbor_filter_list_cmd
);
11566 install_element (BGP_VPNV4_NODE
, &neighbor_filter_list_cmd
);
11567 install_element (BGP_VPNV4_NODE
, &no_neighbor_filter_list_cmd
);
11568 install_element (BGP_VPNV6_NODE
, &neighbor_filter_list_cmd
);
11569 install_element (BGP_VPNV6_NODE
, &no_neighbor_filter_list_cmd
);
11571 /* "neighbor route-map" commands. */
11572 install_element (BGP_NODE
, &neighbor_route_map_hidden_cmd
);
11573 install_element (BGP_NODE
, &no_neighbor_route_map_hidden_cmd
);
11574 install_element (BGP_IPV4_NODE
, &neighbor_route_map_cmd
);
11575 install_element (BGP_IPV4_NODE
, &no_neighbor_route_map_cmd
);
11576 install_element (BGP_IPV4M_NODE
, &neighbor_route_map_cmd
);
11577 install_element (BGP_IPV4M_NODE
, &no_neighbor_route_map_cmd
);
11578 install_element (BGP_IPV4L_NODE
, &neighbor_route_map_cmd
);
11579 install_element (BGP_IPV4L_NODE
, &no_neighbor_route_map_cmd
);
11580 install_element (BGP_IPV6_NODE
, &neighbor_route_map_cmd
);
11581 install_element (BGP_IPV6_NODE
, &no_neighbor_route_map_cmd
);
11582 install_element (BGP_IPV6M_NODE
, &neighbor_route_map_cmd
);
11583 install_element (BGP_IPV6M_NODE
, &no_neighbor_route_map_cmd
);
11584 install_element (BGP_IPV6L_NODE
, &neighbor_route_map_cmd
);
11585 install_element (BGP_IPV6L_NODE
, &no_neighbor_route_map_cmd
);
11586 install_element (BGP_VPNV4_NODE
, &neighbor_route_map_cmd
);
11587 install_element (BGP_VPNV4_NODE
, &no_neighbor_route_map_cmd
);
11588 install_element (BGP_VPNV6_NODE
, &neighbor_route_map_cmd
);
11589 install_element (BGP_VPNV6_NODE
, &no_neighbor_route_map_cmd
);
11591 /* "neighbor unsuppress-map" commands. */
11592 install_element (BGP_NODE
, &neighbor_unsuppress_map_hidden_cmd
);
11593 install_element (BGP_NODE
, &no_neighbor_unsuppress_map_hidden_cmd
);
11594 install_element (BGP_IPV4_NODE
, &neighbor_unsuppress_map_cmd
);
11595 install_element (BGP_IPV4_NODE
, &no_neighbor_unsuppress_map_cmd
);
11596 install_element (BGP_IPV4M_NODE
, &neighbor_unsuppress_map_cmd
);
11597 install_element (BGP_IPV4M_NODE
, &no_neighbor_unsuppress_map_cmd
);
11598 install_element (BGP_IPV4L_NODE
, &neighbor_unsuppress_map_cmd
);
11599 install_element (BGP_IPV4L_NODE
, &no_neighbor_unsuppress_map_cmd
);
11600 install_element (BGP_IPV6_NODE
, &neighbor_unsuppress_map_cmd
);
11601 install_element (BGP_IPV6_NODE
, &no_neighbor_unsuppress_map_cmd
);
11602 install_element (BGP_IPV6M_NODE
, &neighbor_unsuppress_map_cmd
);
11603 install_element (BGP_IPV6M_NODE
, &no_neighbor_unsuppress_map_cmd
);
11604 install_element (BGP_IPV6L_NODE
, &neighbor_unsuppress_map_cmd
);
11605 install_element (BGP_IPV6L_NODE
, &no_neighbor_unsuppress_map_cmd
);
11606 install_element (BGP_VPNV4_NODE
, &neighbor_unsuppress_map_cmd
);
11607 install_element (BGP_VPNV4_NODE
, &no_neighbor_unsuppress_map_cmd
);
11608 install_element (BGP_VPNV6_NODE
, &neighbor_unsuppress_map_cmd
);
11609 install_element (BGP_VPNV6_NODE
, &no_neighbor_unsuppress_map_cmd
);
11611 /* "neighbor maximum-prefix" commands. */
11612 install_element (BGP_NODE
, &neighbor_maximum_prefix_hidden_cmd
);
11613 install_element (BGP_NODE
, &neighbor_maximum_prefix_threshold_hidden_cmd
);
11614 install_element (BGP_NODE
, &neighbor_maximum_prefix_warning_hidden_cmd
);
11615 install_element (BGP_NODE
, &neighbor_maximum_prefix_threshold_warning_hidden_cmd
);
11616 install_element (BGP_NODE
, &neighbor_maximum_prefix_restart_hidden_cmd
);
11617 install_element (BGP_NODE
, &neighbor_maximum_prefix_threshold_restart_hidden_cmd
);
11618 install_element (BGP_NODE
, &no_neighbor_maximum_prefix_hidden_cmd
);
11619 install_element (BGP_IPV4_NODE
, &neighbor_maximum_prefix_cmd
);
11620 install_element (BGP_IPV4_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
11621 install_element (BGP_IPV4_NODE
, &neighbor_maximum_prefix_warning_cmd
);
11622 install_element (BGP_IPV4_NODE
, &neighbor_maximum_prefix_threshold_warning_cmd
);
11623 install_element (BGP_IPV4_NODE
, &neighbor_maximum_prefix_restart_cmd
);
11624 install_element (BGP_IPV4_NODE
, &neighbor_maximum_prefix_threshold_restart_cmd
);
11625 install_element (BGP_IPV4_NODE
, &no_neighbor_maximum_prefix_cmd
);
11626 install_element (BGP_IPV4M_NODE
, &neighbor_maximum_prefix_cmd
);
11627 install_element (BGP_IPV4M_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
11628 install_element (BGP_IPV4M_NODE
, &neighbor_maximum_prefix_warning_cmd
);
11629 install_element (BGP_IPV4M_NODE
, &neighbor_maximum_prefix_threshold_warning_cmd
);
11630 install_element (BGP_IPV4M_NODE
, &neighbor_maximum_prefix_restart_cmd
);
11631 install_element (BGP_IPV4M_NODE
, &neighbor_maximum_prefix_threshold_restart_cmd
);
11632 install_element (BGP_IPV4M_NODE
, &no_neighbor_maximum_prefix_cmd
);
11633 install_element (BGP_IPV4L_NODE
, &neighbor_maximum_prefix_cmd
);
11634 install_element (BGP_IPV4L_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
11635 install_element (BGP_IPV4L_NODE
, &neighbor_maximum_prefix_warning_cmd
);
11636 install_element (BGP_IPV4L_NODE
, &neighbor_maximum_prefix_threshold_warning_cmd
);
11637 install_element (BGP_IPV4L_NODE
, &neighbor_maximum_prefix_restart_cmd
);
11638 install_element (BGP_IPV4L_NODE
, &neighbor_maximum_prefix_threshold_restart_cmd
);
11639 install_element (BGP_IPV4L_NODE
, &no_neighbor_maximum_prefix_cmd
);
11640 install_element (BGP_IPV6_NODE
, &neighbor_maximum_prefix_cmd
);
11641 install_element (BGP_IPV6_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
11642 install_element (BGP_IPV6_NODE
, &neighbor_maximum_prefix_warning_cmd
);
11643 install_element (BGP_IPV6_NODE
, &neighbor_maximum_prefix_threshold_warning_cmd
);
11644 install_element (BGP_IPV6_NODE
, &neighbor_maximum_prefix_restart_cmd
);
11645 install_element (BGP_IPV6_NODE
, &neighbor_maximum_prefix_threshold_restart_cmd
);
11646 install_element (BGP_IPV6_NODE
, &no_neighbor_maximum_prefix_cmd
);
11647 install_element (BGP_IPV6M_NODE
, &neighbor_maximum_prefix_cmd
);
11648 install_element (BGP_IPV6M_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
11649 install_element (BGP_IPV6M_NODE
, &neighbor_maximum_prefix_warning_cmd
);
11650 install_element (BGP_IPV6M_NODE
, &neighbor_maximum_prefix_threshold_warning_cmd
);
11651 install_element (BGP_IPV6M_NODE
, &neighbor_maximum_prefix_restart_cmd
);
11652 install_element (BGP_IPV6M_NODE
, &neighbor_maximum_prefix_threshold_restart_cmd
);
11653 install_element (BGP_IPV6M_NODE
, &no_neighbor_maximum_prefix_cmd
);
11654 install_element (BGP_IPV6L_NODE
, &neighbor_maximum_prefix_cmd
);
11655 install_element (BGP_IPV6L_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
11656 install_element (BGP_IPV6L_NODE
, &neighbor_maximum_prefix_warning_cmd
);
11657 install_element (BGP_IPV6L_NODE
, &neighbor_maximum_prefix_threshold_warning_cmd
);
11658 install_element (BGP_IPV6L_NODE
, &neighbor_maximum_prefix_restart_cmd
);
11659 install_element (BGP_IPV6L_NODE
, &neighbor_maximum_prefix_threshold_restart_cmd
);
11660 install_element (BGP_IPV6L_NODE
, &no_neighbor_maximum_prefix_cmd
);
11661 install_element (BGP_VPNV4_NODE
, &neighbor_maximum_prefix_cmd
);
11662 install_element (BGP_VPNV4_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
11663 install_element (BGP_VPNV4_NODE
, &neighbor_maximum_prefix_warning_cmd
);
11664 install_element (BGP_VPNV4_NODE
, &neighbor_maximum_prefix_threshold_warning_cmd
);
11665 install_element (BGP_VPNV4_NODE
, &neighbor_maximum_prefix_restart_cmd
);
11666 install_element (BGP_VPNV4_NODE
, &neighbor_maximum_prefix_threshold_restart_cmd
);
11667 install_element (BGP_VPNV4_NODE
, &no_neighbor_maximum_prefix_cmd
);
11668 install_element (BGP_VPNV6_NODE
, &neighbor_maximum_prefix_cmd
);
11669 install_element (BGP_VPNV6_NODE
, &neighbor_maximum_prefix_threshold_cmd
);
11670 install_element (BGP_VPNV6_NODE
, &neighbor_maximum_prefix_warning_cmd
);
11671 install_element (BGP_VPNV6_NODE
, &neighbor_maximum_prefix_threshold_warning_cmd
);
11672 install_element (BGP_VPNV6_NODE
, &neighbor_maximum_prefix_restart_cmd
);
11673 install_element (BGP_VPNV6_NODE
, &neighbor_maximum_prefix_threshold_restart_cmd
);
11674 install_element (BGP_VPNV6_NODE
, &no_neighbor_maximum_prefix_cmd
);
11676 /* "neighbor allowas-in" */
11677 install_element (BGP_NODE
, &neighbor_allowas_in_hidden_cmd
);
11678 install_element (BGP_NODE
, &no_neighbor_allowas_in_hidden_cmd
);
11679 install_element (BGP_IPV4_NODE
, &neighbor_allowas_in_cmd
);
11680 install_element (BGP_IPV4_NODE
, &no_neighbor_allowas_in_cmd
);
11681 install_element (BGP_IPV4M_NODE
, &neighbor_allowas_in_cmd
);
11682 install_element (BGP_IPV4M_NODE
, &no_neighbor_allowas_in_cmd
);
11683 install_element (BGP_IPV4L_NODE
, &neighbor_allowas_in_cmd
);
11684 install_element (BGP_IPV4L_NODE
, &no_neighbor_allowas_in_cmd
);
11685 install_element (BGP_IPV6_NODE
, &neighbor_allowas_in_cmd
);
11686 install_element (BGP_IPV6_NODE
, &no_neighbor_allowas_in_cmd
);
11687 install_element (BGP_IPV6M_NODE
, &neighbor_allowas_in_cmd
);
11688 install_element (BGP_IPV6M_NODE
, &no_neighbor_allowas_in_cmd
);
11689 install_element (BGP_IPV6L_NODE
, &neighbor_allowas_in_cmd
);
11690 install_element (BGP_IPV6L_NODE
, &no_neighbor_allowas_in_cmd
);
11691 install_element (BGP_VPNV4_NODE
, &neighbor_allowas_in_cmd
);
11692 install_element (BGP_VPNV4_NODE
, &no_neighbor_allowas_in_cmd
);
11693 install_element (BGP_VPNV6_NODE
, &neighbor_allowas_in_cmd
);
11694 install_element (BGP_VPNV6_NODE
, &no_neighbor_allowas_in_cmd
);
11695 install_element (BGP_EVPN_NODE
, &neighbor_allowas_in_cmd
);
11696 install_element (BGP_EVPN_NODE
, &no_neighbor_allowas_in_cmd
);
11698 /* address-family commands. */
11699 install_element (BGP_NODE
, &address_family_ipv4_safi_cmd
);
11700 install_element (BGP_NODE
, &address_family_ipv6_safi_cmd
);
11701 #ifdef KEEP_OLD_VPN_COMMANDS
11702 install_element (BGP_NODE
, &address_family_vpnv4_cmd
);
11703 install_element (BGP_NODE
, &address_family_vpnv6_cmd
);
11704 #endif /* KEEP_OLD_VPN_COMMANDS */
11706 install_element (BGP_NODE
, &address_family_evpn_cmd
);
11708 /* "exit-address-family" command. */
11709 install_element (BGP_IPV4_NODE
, &exit_address_family_cmd
);
11710 install_element (BGP_IPV4M_NODE
, &exit_address_family_cmd
);
11711 install_element (BGP_IPV4L_NODE
, &exit_address_family_cmd
);
11712 install_element (BGP_IPV6_NODE
, &exit_address_family_cmd
);
11713 install_element (BGP_IPV6M_NODE
, &exit_address_family_cmd
);
11714 install_element (BGP_IPV6L_NODE
, &exit_address_family_cmd
);
11715 install_element (BGP_VPNV4_NODE
, &exit_address_family_cmd
);
11716 install_element (BGP_VPNV6_NODE
, &exit_address_family_cmd
);
11717 install_element (BGP_EVPN_NODE
, &exit_address_family_cmd
);
11719 /* "clear ip bgp commands" */
11720 install_element (ENABLE_NODE
, &clear_ip_bgp_all_cmd
);
11722 /* clear ip bgp prefix */
11723 install_element (ENABLE_NODE
, &clear_ip_bgp_prefix_cmd
);
11724 install_element (ENABLE_NODE
, &clear_bgp_ipv6_safi_prefix_cmd
);
11725 install_element (ENABLE_NODE
, &clear_bgp_instance_ipv6_safi_prefix_cmd
);
11727 /* "show [ip] bgp summary" commands. */
11728 install_element (VIEW_NODE
, &show_bgp_instance_all_ipv6_updgrps_cmd
);
11729 install_element (VIEW_NODE
, &show_bgp_instance_updgrps_adj_cmd
);
11730 install_element (VIEW_NODE
, &show_bgp_instance_updgrps_adj_s_cmd
);
11731 install_element (VIEW_NODE
, &show_bgp_instance_updgrps_stats_cmd
);
11732 install_element (VIEW_NODE
, &show_bgp_updgrps_adj_cmd
);
11733 install_element (VIEW_NODE
, &show_bgp_updgrps_adj_s_cmd
);
11734 install_element (VIEW_NODE
, &show_bgp_updgrps_afi_adj_cmd
);
11735 install_element (VIEW_NODE
, &show_bgp_updgrps_afi_adj_s_cmd
);
11736 install_element (VIEW_NODE
, &show_bgp_updgrps_stats_cmd
);
11737 install_element (VIEW_NODE
, &show_ip_bgp_instance_updgrps_adj_cmd
);
11738 install_element (VIEW_NODE
, &show_ip_bgp_instance_updgrps_adj_s_cmd
);
11739 install_element (VIEW_NODE
, &show_ip_bgp_summary_cmd
);
11740 install_element (VIEW_NODE
, &show_ip_bgp_updgrps_adj_cmd
);
11741 install_element (VIEW_NODE
, &show_ip_bgp_updgrps_adj_s_cmd
);
11742 install_element (VIEW_NODE
, &show_ip_bgp_updgrps_cmd
);
11744 /* "show [ip] bgp neighbors" commands. */
11745 install_element (VIEW_NODE
, &show_ip_bgp_neighbors_cmd
);
11747 /* "show [ip] bgp peer-group" commands. */
11748 install_element (VIEW_NODE
, &show_ip_bgp_peer_groups_cmd
);
11750 /* "show [ip] bgp paths" commands. */
11751 install_element (VIEW_NODE
, &show_ip_bgp_paths_cmd
);
11753 /* "show [ip] bgp community" commands. */
11754 install_element (VIEW_NODE
, &show_ip_bgp_community_info_cmd
);
11756 /* "show ip bgp large-community" commands. */
11757 install_element (VIEW_NODE
, &show_ip_bgp_lcommunity_info_cmd
);
11758 /* "show [ip] bgp attribute-info" commands. */
11759 install_element (VIEW_NODE
, &show_ip_bgp_attr_info_cmd
);
11761 /* "redistribute" commands. */
11762 install_element (BGP_NODE
, &bgp_redistribute_ipv4_hidden_cmd
);
11763 install_element (BGP_NODE
, &no_bgp_redistribute_ipv4_hidden_cmd
);
11764 install_element (BGP_NODE
, &bgp_redistribute_ipv4_rmap_hidden_cmd
);
11765 install_element (BGP_NODE
, &bgp_redistribute_ipv4_metric_hidden_cmd
);
11766 install_element (BGP_NODE
, &bgp_redistribute_ipv4_rmap_metric_hidden_cmd
);
11767 install_element (BGP_NODE
, &bgp_redistribute_ipv4_metric_rmap_hidden_cmd
);
11768 install_element (BGP_NODE
, &bgp_redistribute_ipv4_ospf_hidden_cmd
);
11769 install_element (BGP_NODE
, &no_bgp_redistribute_ipv4_ospf_hidden_cmd
);
11770 install_element (BGP_NODE
, &bgp_redistribute_ipv4_ospf_rmap_hidden_cmd
);
11771 install_element (BGP_NODE
, &bgp_redistribute_ipv4_ospf_metric_hidden_cmd
);
11772 install_element (BGP_NODE
, &bgp_redistribute_ipv4_ospf_rmap_metric_hidden_cmd
);
11773 install_element (BGP_NODE
, &bgp_redistribute_ipv4_ospf_metric_rmap_hidden_cmd
);
11774 install_element (BGP_IPV4_NODE
, &bgp_redistribute_ipv4_cmd
);
11775 install_element (BGP_IPV4_NODE
, &no_bgp_redistribute_ipv4_cmd
);
11776 install_element (BGP_IPV4_NODE
, &bgp_redistribute_ipv4_rmap_cmd
);
11777 install_element (BGP_IPV4_NODE
, &bgp_redistribute_ipv4_metric_cmd
);
11778 install_element (BGP_IPV4_NODE
, &bgp_redistribute_ipv4_rmap_metric_cmd
);
11779 install_element (BGP_IPV4_NODE
, &bgp_redistribute_ipv4_metric_rmap_cmd
);
11780 install_element (BGP_IPV4_NODE
, &bgp_redistribute_ipv4_ospf_cmd
);
11781 install_element (BGP_IPV4_NODE
, &no_bgp_redistribute_ipv4_ospf_cmd
);
11782 install_element (BGP_IPV4_NODE
, &bgp_redistribute_ipv4_ospf_rmap_cmd
);
11783 install_element (BGP_IPV4_NODE
, &bgp_redistribute_ipv4_ospf_metric_cmd
);
11784 install_element (BGP_IPV4_NODE
, &bgp_redistribute_ipv4_ospf_rmap_metric_cmd
);
11785 install_element (BGP_IPV4_NODE
, &bgp_redistribute_ipv4_ospf_metric_rmap_cmd
);
11786 install_element (BGP_IPV6_NODE
, &bgp_redistribute_ipv6_cmd
);
11787 install_element (BGP_IPV6_NODE
, &no_bgp_redistribute_ipv6_cmd
);
11788 install_element (BGP_IPV6_NODE
, &bgp_redistribute_ipv6_rmap_cmd
);
11789 install_element (BGP_IPV6_NODE
, &bgp_redistribute_ipv6_metric_cmd
);
11790 install_element (BGP_IPV6_NODE
, &bgp_redistribute_ipv6_rmap_metric_cmd
);
11791 install_element (BGP_IPV6_NODE
, &bgp_redistribute_ipv6_metric_rmap_cmd
);
11793 /* ttl_security commands */
11794 install_element (BGP_NODE
, &neighbor_ttl_security_cmd
);
11795 install_element (BGP_NODE
, &no_neighbor_ttl_security_cmd
);
11797 /* "show [ip] bgp memory" commands. */
11798 install_element (VIEW_NODE
, &show_bgp_memory_cmd
);
11800 /* "show [ip] bgp views" commands. */
11801 install_element (VIEW_NODE
, &show_bgp_views_cmd
);
11803 /* "show [ip] bgp vrfs" commands. */
11804 install_element (VIEW_NODE
, &show_bgp_vrfs_cmd
);
11806 /* Community-list. */
11807 community_list_vty ();
11810 #include "memory.h"
11811 #include "bgp_regex.h"
11812 #include "bgp_clist.h"
11813 #include "bgp_ecommunity.h"
11815 /* VTY functions. */
11817 /* Direction value to string conversion. */
11818 static const char *
11819 community_direct_str (int direct
)
11823 case COMMUNITY_DENY
:
11825 case COMMUNITY_PERMIT
:
11832 /* Display error string. */
11834 community_list_perror (struct vty
*vty
, int ret
)
11838 case COMMUNITY_LIST_ERR_CANT_FIND_LIST
:
11839 vty_out (vty
, "%% Can't find community-list%s", VTYNL
);
11841 case COMMUNITY_LIST_ERR_MALFORMED_VAL
:
11842 vty_out (vty
, "%% Malformed community-list value%s", VTYNL
);
11844 case COMMUNITY_LIST_ERR_STANDARD_CONFLICT
:
11845 vty_out (vty
, "%% Community name conflict, previously defined as standard community%s", VTYNL
);
11847 case COMMUNITY_LIST_ERR_EXPANDED_CONFLICT
:
11848 vty_out (vty
, "%% Community name conflict, previously defined as expanded community%s", VTYNL
);
11853 /* "community-list" keyword help string. */
11854 #define COMMUNITY_LIST_STR "Add a community list entry\n"
11857 /* ip community-list standard */
11858 DEFUN (ip_community_list_standard
,
11859 ip_community_list_standard_cmd
,
11860 "ip community-list <(1-99)|standard WORD> <deny|permit> AA:NN...",
11863 "Community list number (standard)\n"
11864 "Add an standard community-list entry\n"
11865 "Community list name\n"
11866 "Specify community to reject\n"
11867 "Specify community to accept\n"
11870 char *cl_name_or_number
= NULL
;
11872 int style
= COMMUNITY_LIST_STANDARD
;
11875 argv_find (argv
, argc
, "(1-99)", &idx
);
11876 argv_find (argv
, argc
, "WORD", &idx
);
11877 cl_name_or_number
= argv
[idx
]->arg
;
11878 direct
= argv_find (argv
, argc
, "permit", &idx
) ? COMMUNITY_PERMIT
: COMMUNITY_DENY
;
11879 argv_find (argv
, argc
, "AA:NN", &idx
);
11880 char *str
= argv_concat (argv
, argc
, idx
);
11882 int ret
= community_list_set (bgp_clist
, cl_name_or_number
, str
, direct
, style
);
11884 XFREE (MTYPE_TMP
, str
);
11888 /* Display error string. */
11889 community_list_perror (vty
, ret
);
11890 return CMD_WARNING_CONFIG_FAILED
;
11893 return CMD_SUCCESS
;
11896 DEFUN (no_ip_community_list_standard_all
,
11897 no_ip_community_list_standard_all_cmd
,
11898 "no ip community-list <(1-99)|standard WORD> <deny|permit> AA:NN...",
11902 "Community list number (standard)\n"
11903 "Add an standard community-list entry\n"
11904 "Community list name\n"
11905 "Specify community to reject\n"
11906 "Specify community to accept\n"
11909 int delete_all
= 0;
11911 char *cl_name_or_number
= NULL
;
11913 int style
= COMMUNITY_LIST_STANDARD
;
11916 argv_find (argv
, argc
, "(1-99)", &idx
);
11917 argv_find (argv
, argc
, "WORD", &idx
);
11918 cl_name_or_number
= argv
[idx
]->arg
;
11919 direct
= argv_find (argv
, argc
, "permit", &idx
) ? COMMUNITY_PERMIT
: COMMUNITY_DENY
;
11920 argv_find (argv
, argc
, "AA:NN", &idx
);
11921 char *str
= argv_concat (argv
, argc
, idx
);
11923 int ret
= community_list_unset (bgp_clist
, cl_name_or_number
, str
, direct
, style
, delete_all
);
11925 XFREE (MTYPE_TMP
, str
);
11929 community_list_perror (vty
, ret
);
11930 return CMD_WARNING_CONFIG_FAILED
;
11933 return CMD_SUCCESS
;
11936 /* ip community-list expanded */
11937 DEFUN (ip_community_list_expanded_all
,
11938 ip_community_list_expanded_all_cmd
,
11939 "ip community-list <(100-500)|expanded WORD> <deny|permit> AA:NN...",
11942 "Community list number (expanded)\n"
11943 "Add an expanded community-list entry\n"
11944 "Community list name\n"
11945 "Specify community to reject\n"
11946 "Specify community to accept\n"
11949 char *cl_name_or_number
= NULL
;
11951 int style
= COMMUNITY_LIST_EXPANDED
;
11954 argv_find (argv
, argc
, "(100-500)", &idx
);
11955 argv_find (argv
, argc
, "WORD", &idx
);
11956 cl_name_or_number
= argv
[idx
]->arg
;
11957 direct
= argv_find (argv
, argc
, "permit", &idx
) ? COMMUNITY_PERMIT
: COMMUNITY_DENY
;
11958 argv_find (argv
, argc
, "AA:NN", &idx
);
11959 char *str
= argv_concat (argv
, argc
, idx
);
11961 int ret
= community_list_set (bgp_clist
, cl_name_or_number
, str
, direct
, style
);
11963 XFREE (MTYPE_TMP
, str
);
11967 /* Display error string. */
11968 community_list_perror (vty
, ret
);
11969 return CMD_WARNING_CONFIG_FAILED
;
11972 return CMD_SUCCESS
;
11975 DEFUN (no_ip_community_list_expanded_all
,
11976 no_ip_community_list_expanded_all_cmd
,
11977 "no ip community-list <(100-500)|expanded WORD> <deny|permit> AA:NN...",
11981 "Community list number (expanded)\n"
11982 "Add an expanded community-list entry\n"
11983 "Community list name\n"
11984 "Specify community to reject\n"
11985 "Specify community to accept\n"
11988 int delete_all
= 0;
11990 char *cl_name_or_number
= NULL
;
11992 int style
= COMMUNITY_LIST_EXPANDED
;
11995 argv_find (argv
, argc
, "(100-500)", &idx
);
11996 argv_find (argv
, argc
, "WORD", &idx
);
11997 cl_name_or_number
= argv
[idx
]->arg
;
11998 direct
= argv_find (argv
, argc
, "permit", &idx
) ? COMMUNITY_PERMIT
: COMMUNITY_DENY
;
11999 argv_find (argv
, argc
, "AA:NN", &idx
);
12000 char *str
= argv_concat (argv
, argc
, idx
);
12002 int ret
= community_list_unset (bgp_clist
, cl_name_or_number
, str
, direct
, style
, delete_all
);
12004 XFREE (MTYPE_TMP
, str
);
12008 community_list_perror (vty
, ret
);
12009 return CMD_WARNING_CONFIG_FAILED
;
12012 return CMD_SUCCESS
;
12016 community_list_show (struct vty
*vty
, struct community_list
*list
)
12018 struct community_entry
*entry
;
12020 for (entry
= list
->head
; entry
; entry
= entry
->next
)
12022 if (entry
== list
->head
)
12024 if (all_digit (list
->name
))
12025 vty_out (vty
, "Community %s list %s%s",
12026 entry
->style
== COMMUNITY_LIST_STANDARD
?
12027 "standard" : "(expanded) access",
12028 list
->name
, VTYNL
);
12030 vty_out (vty
, "Named Community %s list %s%s",
12031 entry
->style
== COMMUNITY_LIST_STANDARD
?
12032 "standard" : "expanded",
12033 list
->name
, VTYNL
);
12036 vty_out (vty
, " %s%s",
12037 community_direct_str (entry
->direct
), VTYNL
);
12039 vty_out (vty
, " %s %s%s",
12040 community_direct_str (entry
->direct
),
12041 entry
->style
== COMMUNITY_LIST_STANDARD
12042 ? community_str (entry
->u
.com
) : entry
->config
,
12047 DEFUN (show_ip_community_list
,
12048 show_ip_community_list_cmd
,
12049 "show ip community-list",
12052 "List community-list\n")
12054 struct community_list
*list
;
12055 struct community_list_master
*cm
;
12057 cm
= community_list_master_lookup (bgp_clist
, COMMUNITY_LIST_MASTER
);
12059 return CMD_SUCCESS
;
12061 for (list
= cm
->num
.head
; list
; list
= list
->next
)
12062 community_list_show (vty
, list
);
12064 for (list
= cm
->str
.head
; list
; list
= list
->next
)
12065 community_list_show (vty
, list
);
12067 return CMD_SUCCESS
;
12070 DEFUN (show_ip_community_list_arg
,
12071 show_ip_community_list_arg_cmd
,
12072 "show ip community-list <(1-500)|WORD>",
12075 "List community-list\n"
12076 "Community-list number\n"
12077 "Community-list name\n")
12079 int idx_comm_list
= 3;
12080 struct community_list
*list
;
12082 list
= community_list_lookup (bgp_clist
, argv
[idx_comm_list
]->arg
, COMMUNITY_LIST_MASTER
);
12085 vty_out (vty
, "%% Can't find community-list%s", VTYNL
);
12086 return CMD_WARNING
;
12089 community_list_show (vty
, list
);
12091 return CMD_SUCCESS
;
12095 * Large Community code.
12098 lcommunity_list_set_vty (struct vty
*vty
, int argc
, struct cmd_token
**argv
,
12099 int style
, int reject_all_digit_name
)
12107 direct
= argv_find (argv
, argc
, "permit", &idx
) ? COMMUNITY_PERMIT
: COMMUNITY_DENY
;
12109 /* All digit name check. */
12111 argv_find (argv
, argc
, "WORD", &idx
);
12112 argv_find (argv
, argc
, "(1-99)", &idx
);
12113 argv_find (argv
, argc
, "(100-500)", &idx
);
12114 cl_name
= argv
[idx
]->arg
;
12115 if (reject_all_digit_name
&& all_digit (cl_name
))
12117 vty_out (vty
, "%% Community name cannot have all digits%s", VTYNL
);
12118 return CMD_WARNING_CONFIG_FAILED
;
12122 argv_find (argv
, argc
, "AA:BB:CC", &idx
);
12123 argv_find (argv
, argc
, "LINE", &idx
);
12124 /* Concat community string argument. */
12126 str
= argv_concat (argv
, argc
, idx
);
12130 ret
= lcommunity_list_set (bgp_clist
, cl_name
, str
, direct
, style
);
12132 /* Free temporary community list string allocated by
12135 XFREE (MTYPE_TMP
, str
);
12139 community_list_perror (vty
, ret
);
12140 return CMD_WARNING_CONFIG_FAILED
;
12142 return CMD_SUCCESS
;
12146 lcommunity_list_unset_vty (struct vty
*vty
, int argc
, struct cmd_token
**argv
,
12154 argv_find (argv
, argc
, "permit", &idx
);
12155 argv_find (argv
, argc
, "deny", &idx
);
12159 /* Check the list direct. */
12160 if (strncmp (argv
[idx
]->arg
, "p", 1) == 0)
12161 direct
= COMMUNITY_PERMIT
;
12163 direct
= COMMUNITY_DENY
;
12166 argv_find (argv
, argc
, "LINE", &idx
);
12167 argv_find (argv
, argc
, "AA:AA:NN", &idx
);
12168 /* Concat community string argument. */
12169 str
= argv_concat (argv
, argc
, idx
);
12173 argv_find (argv
, argc
, "(1-99)", &idx
);
12174 argv_find (argv
, argc
, "(100-500)", &idx
);
12175 argv_find (argv
, argc
, "WORD", &idx
);
12177 /* Unset community list. */
12178 ret
= lcommunity_list_unset (bgp_clist
, argv
[idx
]->arg
, str
, direct
, style
);
12180 /* Free temporary community list string allocated by
12183 XFREE (MTYPE_TMP
, str
);
12187 community_list_perror (vty
, ret
);
12188 return CMD_WARNING_CONFIG_FAILED
;
12191 return CMD_SUCCESS
;
12194 /* "large-community-list" keyword help string. */
12195 #define LCOMMUNITY_LIST_STR "Add a large community list entry\n"
12196 #define LCOMMUNITY_VAL_STR "large community in 'aa:bb:cc' format\n"
12198 DEFUN (ip_lcommunity_list_standard
,
12199 ip_lcommunity_list_standard_cmd
,
12200 "ip large-community-list (1-99) <deny|permit>",
12202 LCOMMUNITY_LIST_STR
12203 "Large Community list number (standard)\n"
12204 "Specify large community to reject\n"
12205 "Specify large community to accept\n")
12207 return lcommunity_list_set_vty (vty
, argc
, argv
, LARGE_COMMUNITY_LIST_STANDARD
, 0);
12210 DEFUN (ip_lcommunity_list_standard1
,
12211 ip_lcommunity_list_standard1_cmd
,
12212 "ip large-community-list (1-99) <deny|permit> AA:BB:CC...",
12214 LCOMMUNITY_LIST_STR
12215 "Large Community list number (standard)\n"
12216 "Specify large community to reject\n"
12217 "Specify large community to accept\n"
12218 LCOMMUNITY_VAL_STR
)
12220 return lcommunity_list_set_vty (vty
, argc
, argv
, LARGE_COMMUNITY_LIST_STANDARD
, 0);
12223 DEFUN (ip_lcommunity_list_expanded
,
12224 ip_lcommunity_list_expanded_cmd
,
12225 "ip large-community-list (100-500) <deny|permit> LINE...",
12227 LCOMMUNITY_LIST_STR
12228 "Large Community list number (expanded)\n"
12229 "Specify large community to reject\n"
12230 "Specify large community to accept\n"
12231 "An ordered list as a regular-expression\n")
12233 return lcommunity_list_set_vty (vty
, argc
, argv
, LARGE_COMMUNITY_LIST_EXPANDED
, 0);
12236 DEFUN (ip_lcommunity_list_name_standard
,
12237 ip_lcommunity_list_name_standard_cmd
,
12238 "ip large-community-list standard WORD <deny|permit>",
12240 LCOMMUNITY_LIST_STR
12241 "Specify standard large-community-list\n"
12242 "Large Community list name\n"
12243 "Specify large community to reject\n"
12244 "Specify large community to accept\n")
12246 return lcommunity_list_set_vty (vty
, argc
, argv
, LARGE_COMMUNITY_LIST_STANDARD
, 1);
12249 DEFUN (ip_lcommunity_list_name_standard1
,
12250 ip_lcommunity_list_name_standard1_cmd
,
12251 "ip large-community-list standard WORD <deny|permit> AA:BB:CC...",
12253 LCOMMUNITY_LIST_STR
12254 "Specify standard large-community-list\n"
12255 "Large Community list name\n"
12256 "Specify large community to reject\n"
12257 "Specify large community to accept\n"
12258 LCOMMUNITY_VAL_STR
)
12260 return lcommunity_list_set_vty (vty
, argc
, argv
, LARGE_COMMUNITY_LIST_STANDARD
, 1);
12263 DEFUN (ip_lcommunity_list_name_expanded
,
12264 ip_lcommunity_list_name_expanded_cmd
,
12265 "ip large-community-list expanded WORD <deny|permit> LINE...",
12267 LCOMMUNITY_LIST_STR
12268 "Specify expanded large-community-list\n"
12269 "Large Community list name\n"
12270 "Specify large community to reject\n"
12271 "Specify large community to accept\n"
12272 "An ordered list as a regular-expression\n")
12274 return lcommunity_list_set_vty (vty
, argc
, argv
, LARGE_COMMUNITY_LIST_EXPANDED
, 1);
12277 DEFUN (no_ip_lcommunity_list_standard_all
,
12278 no_ip_lcommunity_list_standard_all_cmd
,
12279 "no ip large-community-list <(1-99)|(100-500)|WORD>",
12282 LCOMMUNITY_LIST_STR
12283 "Large Community list number (standard)\n"
12284 "Large Community list number (expanded)\n"
12285 "Large Community list name\n")
12287 return lcommunity_list_unset_vty (vty
, argc
, argv
, LARGE_COMMUNITY_LIST_STANDARD
);
12290 DEFUN (no_ip_lcommunity_list_name_expanded_all
,
12291 no_ip_lcommunity_list_name_expanded_all_cmd
,
12292 "no ip large-community-list expanded WORD",
12295 LCOMMUNITY_LIST_STR
12296 "Specify expanded large-community-list\n"
12297 "Large Community list name\n")
12299 return lcommunity_list_unset_vty (vty
, argc
, argv
, LARGE_COMMUNITY_LIST_EXPANDED
);
12302 DEFUN (no_ip_lcommunity_list_standard
,
12303 no_ip_lcommunity_list_standard_cmd
,
12304 "no ip large-community-list (1-99) <deny|permit> AA:AA:NN...",
12307 LCOMMUNITY_LIST_STR
12308 "Large Community list number (standard)\n"
12309 "Specify large community to reject\n"
12310 "Specify large community to accept\n"
12311 LCOMMUNITY_VAL_STR
)
12313 return lcommunity_list_unset_vty (vty
, argc
, argv
, LARGE_COMMUNITY_LIST_STANDARD
);
12316 DEFUN (no_ip_lcommunity_list_expanded
,
12317 no_ip_lcommunity_list_expanded_cmd
,
12318 "no ip large-community-list (100-500) <deny|permit> LINE...",
12321 LCOMMUNITY_LIST_STR
12322 "Large Community list number (expanded)\n"
12323 "Specify large community to reject\n"
12324 "Specify large community to accept\n"
12325 "An ordered list as a regular-expression\n")
12327 return lcommunity_list_unset_vty (vty
, argc
, argv
, LARGE_COMMUNITY_LIST_EXPANDED
);
12330 DEFUN (no_ip_lcommunity_list_name_standard
,
12331 no_ip_lcommunity_list_name_standard_cmd
,
12332 "no ip large-community-list standard WORD <deny|permit> AA:AA:NN...",
12335 LCOMMUNITY_LIST_STR
12336 "Specify standard large-community-list\n"
12337 "Large Community list name\n"
12338 "Specify large community to reject\n"
12339 "Specify large community to accept\n"
12340 LCOMMUNITY_VAL_STR
)
12342 return lcommunity_list_unset_vty (vty
, argc
, argv
, LARGE_COMMUNITY_LIST_STANDARD
);
12345 DEFUN (no_ip_lcommunity_list_name_expanded
,
12346 no_ip_lcommunity_list_name_expanded_cmd
,
12347 "no ip large-community-list expanded WORD <deny|permit> LINE...",
12350 LCOMMUNITY_LIST_STR
12351 "Specify expanded large-community-list\n"
12352 "Large community list name\n"
12353 "Specify large community to reject\n"
12354 "Specify large community to accept\n"
12355 "An ordered list as a regular-expression\n")
12357 return lcommunity_list_unset_vty (vty
, argc
, argv
, LARGE_COMMUNITY_LIST_EXPANDED
);
12361 lcommunity_list_show (struct vty
*vty
, struct community_list
*list
)
12363 struct community_entry
*entry
;
12365 for (entry
= list
->head
; entry
; entry
= entry
->next
)
12367 if (entry
== list
->head
)
12369 if (all_digit (list
->name
))
12370 vty_out (vty
, "Large community %s list %s%s",
12371 entry
->style
== EXTCOMMUNITY_LIST_STANDARD
?
12372 "standard" : "(expanded) access",
12373 list
->name
, VTYNL
);
12375 vty_out (vty
, "Named large community %s list %s%s",
12376 entry
->style
== EXTCOMMUNITY_LIST_STANDARD
?
12377 "standard" : "expanded",
12378 list
->name
, VTYNL
);
12381 vty_out (vty
, " %s%s",
12382 community_direct_str (entry
->direct
), VTYNL
);
12384 vty_out (vty
, " %s %s%s",
12385 community_direct_str (entry
->direct
),
12386 entry
->style
== EXTCOMMUNITY_LIST_STANDARD
?
12387 entry
->u
.ecom
->str
: entry
->config
,
12392 DEFUN (show_ip_lcommunity_list
,
12393 show_ip_lcommunity_list_cmd
,
12394 "show ip large-community-list",
12397 "List large-community list\n")
12399 struct community_list
*list
;
12400 struct community_list_master
*cm
;
12402 cm
= community_list_master_lookup (bgp_clist
, LARGE_COMMUNITY_LIST_MASTER
);
12404 return CMD_SUCCESS
;
12406 for (list
= cm
->num
.head
; list
; list
= list
->next
)
12407 lcommunity_list_show (vty
, list
);
12409 for (list
= cm
->str
.head
; list
; list
= list
->next
)
12410 lcommunity_list_show (vty
, list
);
12412 return CMD_SUCCESS
;
12415 DEFUN (show_ip_lcommunity_list_arg
,
12416 show_ip_lcommunity_list_arg_cmd
,
12417 "show ip large-community-list <(1-500)|WORD>",
12420 "List large-community list\n"
12421 "large-community-list number\n"
12422 "large-community-list name\n")
12424 struct community_list
*list
;
12426 list
= community_list_lookup (bgp_clist
, argv
[3]->arg
, LARGE_COMMUNITY_LIST_MASTER
);
12429 vty_out (vty
, "%% Can't find extcommunity-list%s", VTYNL
);
12430 return CMD_WARNING
;
12433 lcommunity_list_show (vty
, list
);
12435 return CMD_SUCCESS
;
12438 /* "extcommunity-list" keyword help string. */
12439 #define EXTCOMMUNITY_LIST_STR "Add a extended community list entry\n"
12440 #define EXTCOMMUNITY_VAL_STR "Extended community attribute in 'rt aa:nn_or_IPaddr:nn' OR 'soo aa:nn_or_IPaddr:nn' format\n"
12442 DEFUN (ip_extcommunity_list_standard
,
12443 ip_extcommunity_list_standard_cmd
,
12444 "ip extcommunity-list <(1-99)|standard WORD> <deny|permit> AA:NN...",
12446 EXTCOMMUNITY_LIST_STR
12447 "Extended Community list number (standard)\n"
12448 "Specify standard extcommunity-list\n"
12449 "Community list name\n"
12450 "Specify community to reject\n"
12451 "Specify community to accept\n"
12452 EXTCOMMUNITY_VAL_STR
)
12454 int style
= EXTCOMMUNITY_LIST_STANDARD
;
12456 char *cl_number_or_name
= NULL
;
12459 argv_find (argv
, argc
, "(1-99)", &idx
);
12460 argv_find (argv
, argc
, "WORD", &idx
);
12461 cl_number_or_name
= argv
[idx
]->arg
;
12462 direct
= argv_find (argv
, argc
, "permit", &idx
) ? COMMUNITY_PERMIT
: COMMUNITY_DENY
;
12463 argv_find (argv
, argc
, "AA:NN", &idx
);
12464 char *str
= argv_concat (argv
, argc
, idx
);
12466 int ret
= extcommunity_list_set (bgp_clist
, cl_number_or_name
, str
, direct
, style
);
12468 XFREE (MTYPE_TMP
, str
);
12472 community_list_perror (vty
, ret
);
12473 return CMD_WARNING_CONFIG_FAILED
;
12476 return CMD_SUCCESS
;
12479 DEFUN (ip_extcommunity_list_name_expanded
,
12480 ip_extcommunity_list_name_expanded_cmd
,
12481 "ip extcommunity-list <(100-500)|expanded WORD> <deny|permit> LINE...",
12483 EXTCOMMUNITY_LIST_STR
12484 "Extended Community list number (expanded)\n"
12485 "Specify expanded extcommunity-list\n"
12486 "Extended Community list name\n"
12487 "Specify community to reject\n"
12488 "Specify community to accept\n"
12489 "An ordered list as a regular-expression\n")
12491 int style
= EXTCOMMUNITY_LIST_EXPANDED
;
12493 char *cl_number_or_name
= NULL
;
12496 argv_find (argv
, argc
, "(100-500)", &idx
);
12497 argv_find (argv
, argc
, "WORD", &idx
);
12498 cl_number_or_name
= argv
[idx
]->arg
;
12499 direct
= argv_find (argv
, argc
, "permit", &idx
) ? COMMUNITY_PERMIT
: COMMUNITY_DENY
;
12500 argv_find (argv
, argc
, "LINE", &idx
);
12501 char *str
= argv_concat (argv
, argc
, idx
);
12503 int ret
= extcommunity_list_set (bgp_clist
, cl_number_or_name
, str
, direct
, style
);
12505 XFREE (MTYPE_TMP
, str
);
12509 community_list_perror (vty
, ret
);
12510 return CMD_WARNING_CONFIG_FAILED
;
12513 return CMD_SUCCESS
;
12516 DEFUN (no_ip_extcommunity_list_standard_all
,
12517 no_ip_extcommunity_list_standard_all_cmd
,
12518 "no ip extcommunity-list <(1-99)|standard WORD> <deny|permit> AA:NN...",
12521 EXTCOMMUNITY_LIST_STR
12522 "Extended Community list number (standard)\n"
12523 "Specify standard extcommunity-list\n"
12524 "Community list name\n"
12525 "Specify community to reject\n"
12526 "Specify community to accept\n"
12527 EXTCOMMUNITY_VAL_STR
)
12531 int style
= EXTCOMMUNITY_LIST_STANDARD
;
12533 char *cl_number_or_name
= NULL
;
12536 argv_find (argv
, argc
, "(1-99)", &idx
);
12537 argv_find (argv
, argc
, "WORD", &idx
);
12538 cl_number_or_name
= argv
[idx
]->arg
;
12539 direct
= argv_find (argv
, argc
, "permit", &idx
) ? COMMUNITY_PERMIT
: COMMUNITY_DENY
;
12540 argv_find (argv
, argc
, "AA:NN", &idx
);
12541 char *str
= argv_concat (argv
, argc
, idx
);
12543 int ret
= extcommunity_list_unset (bgp_clist
, cl_number_or_name
, str
, direct
, style
, deleteall
);
12545 XFREE (MTYPE_TMP
, str
);
12549 community_list_perror (vty
, ret
);
12550 return CMD_WARNING_CONFIG_FAILED
;
12553 return CMD_SUCCESS
;
12556 DEFUN (no_ip_extcommunity_list_expanded_all
,
12557 no_ip_extcommunity_list_expanded_all_cmd
,
12558 "no ip extcommunity-list <(100-500)|expanded WORD> <deny|permit> LINE...",
12561 EXTCOMMUNITY_LIST_STR
12562 "Extended Community list number (expanded)\n"
12563 "Specify expanded extcommunity-list\n"
12564 "Extended Community list name\n"
12565 "Specify community to reject\n"
12566 "Specify community to accept\n"
12567 "An ordered list as a regular-expression\n")
12571 int style
= EXTCOMMUNITY_LIST_EXPANDED
;
12573 char *cl_number_or_name
= NULL
;
12576 argv_find (argv
, argc
, "(100-500)", &idx
);
12577 argv_find (argv
, argc
, "WORD", &idx
);
12578 cl_number_or_name
= argv
[idx
]->arg
;
12579 direct
= argv_find (argv
, argc
, "permit", &idx
) ? COMMUNITY_PERMIT
: COMMUNITY_DENY
;
12580 argv_find (argv
, argc
, "LINE", &idx
);
12581 char *str
= argv_concat (argv
, argc
, idx
);
12583 int ret
= extcommunity_list_unset (bgp_clist
, cl_number_or_name
, str
, direct
, style
, deleteall
);
12585 XFREE (MTYPE_TMP
, str
);
12589 community_list_perror (vty
, ret
);
12590 return CMD_WARNING_CONFIG_FAILED
;
12593 return CMD_SUCCESS
;
12597 extcommunity_list_show (struct vty
*vty
, struct community_list
*list
)
12599 struct community_entry
*entry
;
12601 for (entry
= list
->head
; entry
; entry
= entry
->next
)
12603 if (entry
== list
->head
)
12605 if (all_digit (list
->name
))
12606 vty_out (vty
, "Extended community %s list %s%s",
12607 entry
->style
== EXTCOMMUNITY_LIST_STANDARD
?
12608 "standard" : "(expanded) access",
12609 list
->name
, VTYNL
);
12611 vty_out (vty
, "Named extended community %s list %s%s",
12612 entry
->style
== EXTCOMMUNITY_LIST_STANDARD
?
12613 "standard" : "expanded",
12614 list
->name
, VTYNL
);
12617 vty_out (vty
, " %s%s",
12618 community_direct_str (entry
->direct
), VTYNL
);
12620 vty_out (vty
, " %s %s%s",
12621 community_direct_str (entry
->direct
),
12622 entry
->style
== EXTCOMMUNITY_LIST_STANDARD
?
12623 entry
->u
.ecom
->str
: entry
->config
,
12628 DEFUN (show_ip_extcommunity_list
,
12629 show_ip_extcommunity_list_cmd
,
12630 "show ip extcommunity-list",
12633 "List extended-community list\n")
12635 struct community_list
*list
;
12636 struct community_list_master
*cm
;
12638 cm
= community_list_master_lookup (bgp_clist
, EXTCOMMUNITY_LIST_MASTER
);
12640 return CMD_SUCCESS
;
12642 for (list
= cm
->num
.head
; list
; list
= list
->next
)
12643 extcommunity_list_show (vty
, list
);
12645 for (list
= cm
->str
.head
; list
; list
= list
->next
)
12646 extcommunity_list_show (vty
, list
);
12648 return CMD_SUCCESS
;
12651 DEFUN (show_ip_extcommunity_list_arg
,
12652 show_ip_extcommunity_list_arg_cmd
,
12653 "show ip extcommunity-list <(1-500)|WORD>",
12656 "List extended-community list\n"
12657 "Extcommunity-list number\n"
12658 "Extcommunity-list name\n")
12660 int idx_comm_list
= 3;
12661 struct community_list
*list
;
12663 list
= community_list_lookup (bgp_clist
, argv
[idx_comm_list
]->arg
, EXTCOMMUNITY_LIST_MASTER
);
12666 vty_out (vty
, "%% Can't find extcommunity-list%s", VTYNL
);
12667 return CMD_WARNING
;
12670 extcommunity_list_show (vty
, list
);
12672 return CMD_SUCCESS
;
12675 /* Return configuration string of community-list entry. */
12676 static const char *
12677 community_list_config_str (struct community_entry
*entry
)
12685 if (entry
->style
== COMMUNITY_LIST_STANDARD
)
12686 str
= community_str (entry
->u
.com
);
12688 str
= entry
->config
;
12693 /* Display community-list and extcommunity-list configuration. */
12695 community_list_config_write (struct vty
*vty
)
12697 struct community_list
*list
;
12698 struct community_entry
*entry
;
12699 struct community_list_master
*cm
;
12702 /* Community-list. */
12703 cm
= community_list_master_lookup (bgp_clist
, COMMUNITY_LIST_MASTER
);
12705 for (list
= cm
->num
.head
; list
; list
= list
->next
)
12706 for (entry
= list
->head
; entry
; entry
= entry
->next
)
12708 vty_out (vty
, "ip community-list %s %s %s%s",
12709 list
->name
, community_direct_str (entry
->direct
),
12710 community_list_config_str (entry
),
12714 for (list
= cm
->str
.head
; list
; list
= list
->next
)
12715 for (entry
= list
->head
; entry
; entry
= entry
->next
)
12717 vty_out (vty
, "ip community-list %s %s %s %s%s",
12718 entry
->style
== COMMUNITY_LIST_STANDARD
12719 ? "standard" : "expanded",
12720 list
->name
, community_direct_str (entry
->direct
),
12721 community_list_config_str (entry
),
12726 /* Extcommunity-list. */
12727 cm
= community_list_master_lookup (bgp_clist
, EXTCOMMUNITY_LIST_MASTER
);
12729 for (list
= cm
->num
.head
; list
; list
= list
->next
)
12730 for (entry
= list
->head
; entry
; entry
= entry
->next
)
12732 vty_out (vty
, "ip extcommunity-list %s %s %s%s",
12733 list
->name
, community_direct_str (entry
->direct
),
12734 community_list_config_str (entry
), VTYNL
);
12737 for (list
= cm
->str
.head
; list
; list
= list
->next
)
12738 for (entry
= list
->head
; entry
; entry
= entry
->next
)
12740 vty_out (vty
, "ip extcommunity-list %s %s %s %s%s",
12741 entry
->style
== EXTCOMMUNITY_LIST_STANDARD
12742 ? "standard" : "expanded",
12743 list
->name
, community_direct_str (entry
->direct
),
12744 community_list_config_str (entry
), VTYNL
);
12749 /* lcommunity-list. */
12750 cm
= community_list_master_lookup (bgp_clist
, LARGE_COMMUNITY_LIST_MASTER
);
12752 for (list
= cm
->num
.head
; list
; list
= list
->next
)
12753 for (entry
= list
->head
; entry
; entry
= entry
->next
)
12755 vty_out (vty
, "ip large-community-list %s %s %s%s",
12756 list
->name
, community_direct_str (entry
->direct
),
12757 community_list_config_str (entry
), VTYNL
);
12760 for (list
= cm
->str
.head
; list
; list
= list
->next
)
12761 for (entry
= list
->head
; entry
; entry
= entry
->next
)
12763 vty_out (vty
, "ip large-community-list %s %s %s %s%s",
12764 entry
->style
== LARGE_COMMUNITY_LIST_STANDARD
12765 ? "standard" : "expanded",
12766 list
->name
, community_direct_str (entry
->direct
),
12767 community_list_config_str (entry
), VTYNL
);
12774 static struct cmd_node community_list_node
=
12776 COMMUNITY_LIST_NODE
,
12778 1 /* Export to vtysh. */
12782 community_list_vty (void)
12784 install_node (&community_list_node
, community_list_config_write
);
12786 /* Community-list. */
12787 install_element (CONFIG_NODE
, &ip_community_list_standard_cmd
);
12788 install_element (CONFIG_NODE
, &ip_community_list_expanded_all_cmd
);
12789 install_element (CONFIG_NODE
, &no_ip_community_list_standard_all_cmd
);
12790 install_element (CONFIG_NODE
, &no_ip_community_list_expanded_all_cmd
);
12791 install_element (VIEW_NODE
, &show_ip_community_list_cmd
);
12792 install_element (VIEW_NODE
, &show_ip_community_list_arg_cmd
);
12794 /* Extcommunity-list. */
12795 install_element (CONFIG_NODE
, &ip_extcommunity_list_standard_cmd
);
12796 install_element (CONFIG_NODE
, &ip_extcommunity_list_name_expanded_cmd
);
12797 install_element (CONFIG_NODE
, &no_ip_extcommunity_list_standard_all_cmd
);
12798 install_element (CONFIG_NODE
, &no_ip_extcommunity_list_expanded_all_cmd
);
12799 install_element (VIEW_NODE
, &show_ip_extcommunity_list_cmd
);
12800 install_element (VIEW_NODE
, &show_ip_extcommunity_list_arg_cmd
);
12802 /* Large Community List */
12803 install_element (CONFIG_NODE
, &ip_lcommunity_list_standard_cmd
);
12804 install_element (CONFIG_NODE
, &ip_lcommunity_list_standard1_cmd
);
12805 install_element (CONFIG_NODE
, &ip_lcommunity_list_expanded_cmd
);
12806 install_element (CONFIG_NODE
, &ip_lcommunity_list_name_standard_cmd
);
12807 install_element (CONFIG_NODE
, &ip_lcommunity_list_name_standard1_cmd
);
12808 install_element (CONFIG_NODE
, &ip_lcommunity_list_name_expanded_cmd
);
12809 install_element (CONFIG_NODE
, &no_ip_lcommunity_list_standard_all_cmd
);
12810 install_element (CONFIG_NODE
, &no_ip_lcommunity_list_name_expanded_all_cmd
);
12811 install_element (CONFIG_NODE
, &no_ip_lcommunity_list_standard_cmd
);
12812 install_element (CONFIG_NODE
, &no_ip_lcommunity_list_expanded_cmd
);
12813 install_element (CONFIG_NODE
, &no_ip_lcommunity_list_name_standard_cmd
);
12814 install_element (CONFIG_NODE
, &no_ip_lcommunity_list_name_expanded_cmd
);
12815 install_element (VIEW_NODE
, &show_ip_lcommunity_list_cmd
);
12816 install_element (VIEW_NODE
, &show_ip_lcommunity_list_arg_cmd
);